:root {
  --federal-blue: #1a5493;
  --federal-green: #a8cf45;
  --ink: #0f2a47;
  --muted: #4d637e;
  --paper: #f7fbff;
  --card: #ffffff;
  --danger: #c62828;
  --success: #2e7d32;
  --shadow: 0 20px 45px rgba(20, 56, 94, 0.15);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1400px 700px at 5% 0%, rgba(168, 207, 69, 0.26), transparent 60%),
    radial-gradient(1200px 700px at 100% 0%, rgba(26, 84, 147, 0.20), transparent 60%),
    linear-gradient(180deg, #f9fdff 0%, #edf5fb 100%);
  padding: 30px 18px 60px;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(2px);
  z-index: -1;
  animation: float 10s ease-in-out infinite;
}

.bg-shape-1 {
  width: 180px;
  height: 180px;
  top: 8%;
  left: -70px;
  background: rgba(168, 207, 69, 0.35);
}

.bg-shape-2 {
  width: 240px;
  height: 240px;
  right: -90px;
  top: 50%;
  background: rgba(26, 84, 147, 0.22);
  animation-delay: 1.5s;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(10px); }
  100% { transform: translateY(0px); }
}

.app-shell {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
}

.brand-logo {
  height: 62px;
  width: auto;
  object-fit: contain;
}

.brand-fallback {
  display: none;
  align-items: center;
  gap: 12px;
  font-family: "Sora", sans-serif;
}

.brand-fallback strong {
  display: block;
  font-size: 1.1rem;
}

.brand-fallback span {
  display: block;
  color: var(--federal-blue);
  font-size: 1rem;
}

.badge-f {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--federal-blue), #0d3d72);
  color: var(--federal-green);
  font-weight: 800;
}

.topbar-chip {
  background: linear-gradient(90deg, rgba(26, 84, 147, 0.16), rgba(168, 207, 69, 0.24));
  border: 1px solid rgba(26, 84, 147, 0.2);
  color: var(--federal-blue);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(26, 84, 147, 0.08);
  padding: 22px;
}

.hero h1,
.card h2,
.project-title {
  margin: 0 0 10px;
  font-family: "Sora", sans-serif;
}

.hero p,
.actions-left p,
.helper-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.helper-text {
  margin-top: 12px;
  font-size: 0.93rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
}

.field input,
.field textarea,
.field select {
  border: 1px solid #c5d2e1;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 0.95rem;
  font-family: "Manrope", sans-serif;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}

.field input[type="file"] {
  padding: 8px;
}

.field input[type="file"]::file-selector-button {
  border: none;
  border-radius: 10px;
  background: var(--federal-blue);
  color: #fff;
  padding: 9px 12px;
  margin-right: 10px;
  font-family: "Sora", sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.2s ease;
}

.field input[type="file"]::file-selector-button:hover {
  filter: brightness(1.08);
}

.field textarea {
  resize: vertical;
  min-height: 90px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--federal-blue);
  box-shadow: 0 0 0 4px rgba(26, 84, 147, 0.13);
  outline: none;
}

.field small {
  color: var(--muted);
  font-size: 0.82rem;
}

.file-name {
  color: var(--federal-blue);
  font-weight: 600;
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.project-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.project-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}

.project-form .field.full {
  grid-column: 1 / -1;
}

.btn-primary,
.btn-secondary {
  border: none;
  border-radius: 12px;
  padding: 11px 15px;
  cursor: pointer;
  font-weight: 700;
  font-family: "Sora", sans-serif;
  transition: transform 0.15s ease, filter 0.2s ease;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(140deg, var(--federal-blue), #134677);
}

.btn-secondary {
  color: var(--federal-blue);
  background: rgba(26, 84, 147, 0.1);
}

.btn-primary:hover,
.btn-secondary:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.btn-primary:disabled {
  cursor: not-allowed;
  filter: grayscale(0.35);
  transform: none;
}

.actions-card {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 999;
  display: grid;
  gap: 10px;
  width: min(92vw, 360px);
}

.toast {
  border-left: 5px solid #bac8d8;
  background: #f4f8fd;
  color: #254363;
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(15, 42, 71, 0.22);
  padding: 11px 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  animation: toast-in 0.22s ease-out;
}

.toast.success {
  border-left-color: var(--success);
  background: #effaf0;
}

.toast.error {
  border-left-color: var(--danger);
  background: #fff3f3;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.json-preview {
  margin-top: 14px;
}

.json-preview summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--federal-blue);
}

.json-code {
  margin: 10px 0 0;
  background: #0f2236;
  color: #c4f0ff;
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
  font-size: 0.82rem;
}

.error-message {
  margin-top: -4px;
  font-size: 0.79rem;
  color: var(--danger);
}

@media (max-width: 900px) {
  .settings-grid,
  .project-form {
    grid-template-columns: 1fr;
  }

  .project-form .field.full {
    grid-column: auto;
  }

  .brand-logo {
    height: 50px;
  }
}
