@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300..800;1,300..800&family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg: #f8fafc;
  --bg-accent: #f1f5f9;
  --surface: rgba(255, 255, 255, 0.85);
  --surface-strong: #ffffff;
  --surface-muted: #f8fafc;
  --text: #0f172a;
  --text-soft: #334155;
  --text-faint: #64748b;
  --border: rgba(16, 185, 129, 0.1);
  --primary: #047857;
  --primary-strong: #065f46;
  --secondary: #10b981;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --gold: #F59E0B;
  --gold-strong: #D97706;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.03), 0 1px 3px rgba(15, 23, 42, 0.01);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --blur: blur(16px);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(4, 120, 87, 0.15), transparent 35%),
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.1), transparent 30%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Plus Jakarta Sans", "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  background: transparent;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

input, select, textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  padding: 0.9rem 1rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: none;
  border-color: rgba(4, 120, 87, 0.7);
  box-shadow: 0 0 0 4px rgba(4, 120, 87, 0.12);
}

label {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0 0 0.45rem;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar,
.screen-header,
.dashboard-tabs,
.surface-card {
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.eyebrow {
  margin: 0 0 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--gold);
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
}

h2 {
  font-size: clamp(1.8rem, 4vw, 3.1rem);
  line-height: 1.08;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: clamp(1.15rem, 2vw, 1.6rem);
  margin-bottom: 0;
}

.ghost-button,
.primary-button,
.tab-button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 999px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.ghost-button,
.tab-button,
.icon-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
  border-color: var(--border);
}

.ghost-button,
.primary-button {
  padding: 0.9rem 1.15rem;
  font-weight: 700;
}

.ghost-button:hover,
.primary-button:hover,
.tab-button:hover,
.icon-button:hover { transform: translateY(-1px); }

.ghost-button.subtle { color: var(--text-soft); }

.ghost-button.danger {
  color: white;
  background: var(--danger);
  border-color: rgba(220, 38, 38, 0.1);
}

.primary-button {
  color: #0f172a; /* Dark text for high contrast on gold */
  background: linear-gradient(135deg, var(--gold), #FBBF24);
  box-shadow: 0 12px 30px rgba(245, 158, 11, 0.25);
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(245, 158, 11, 0.35);
}

.primary-button.secondary { 
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong)); 
  box-shadow: 0 12px 30px rgba(4, 120, 87, 0.2);
}

.app-main {
  width: min(1500px, calc(100% - 2.4rem));
  margin: 1.2rem auto 2rem;
  flex: 1;
}

.view {
  display: none;
  animation: fadeSlide 260ms ease;
}

.view.active-view { display: block; }

.surface-card,
.screen-header,
.dashboard-tabs {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
}

.hero-card {
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
}

.hero-text,
.help-text,
.muted,
.metric-label { color: var(--text-soft); }

.status-pill,
.progress-chip,
.inline-pill,
.status-tag,
.mini-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.12);
  color: var(--primary-strong);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 23, 0.35);
  z-index: 50;
}

.loading-overlay[hidden] {
  display: none !important;
}

.spinner-card {
  min-width: 220px;
  padding: 1.2rem 1.4rem;
  display: grid;
  justify-items: center;
  gap: 0.8rem;
}

.spinner {
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  border: 4px solid rgba(148, 163, 184, 0.25);
  border-top-color: var(--primary);
  animation: spin 900ms linear infinite;
}

.toast-region {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  gap: 0.7rem;
  z-index: 60;
  pointer-events: none;
}

.toast-region * {
  pointer-events: auto;
}

.toast {
  min-width: 280px;
  max-width: min(420px, calc(100vw - 2rem));
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: toastIn 180ms ease;
  display: none;
}

.toast.show {
  display: block;
}

.toast.success { border-left: 5px solid var(--success); }
.toast.error { border-left: 5px solid var(--danger); }
.toast.info { border-left: 5px solid var(--primary); }

.toast p { margin-bottom: 0; color: var(--text-soft); }

.modal-dialog {
  width: min(720px, calc(100vw - 2rem));
  border: none;
  padding: 0;
  background: transparent;
}

.modal-dialog::backdrop {
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(8px);
}

.modal-card {
  padding: 1.2rem;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface-strong);
}

.modal-header,
.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.modal-body {
  display: grid;
  gap: 0.9rem;
  padding: 1rem 0;
}

.modal-footer { justify-content: flex-end; }

.icon-button {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.section-heading { margin-bottom: 1rem; }
.compact { margin-bottom: 0.75rem; }
.hidden { display: none !important; }

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-soft);
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.3);
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .hero-card { grid-template-columns: 1fr; }
  .screen-header,
  .section-heading.compact {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  .app-main { width: min(100%, calc(100% - 1rem)); }
  .toast-region {
    right: 0.5rem;
    left: 0.5rem;
  }
  .ghost-button,
  .primary-button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}
