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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #F0EDE6;
  --bg-warm:      #E8E4DC;
  --surface:      #FFFFFF;
  --surface-warm: #FAF8F4;

  --dark:    #181E1B;
  --dark-2:  #212924;
  --dark-3:  #2C3530;
  --dark-4:  #384039;

  --sage:       #3D6B47;
  --sage-light: #5A8F68;
  --sage-pale:  #C8DFD0;
  --sage-deep:  #1E3A2A;

  --gold:       #C4973A;
  --gold-light: #DDB55A;
  --gold-pale:  #FDF4E1;
  --gold-deep:  #8A6420;

  --income-card:  #1E3A2A;
  --expense-card: #3A1C1C;
  --balance-card: #181E1B;

  --red:       #C0392B;
  --red-pale:  #FDECEA;
  --red-deep:  #7A1A1A;

  --text-dark:        #181E1B;
  --text-secondary:   #3D4A3F;
  --text-muted:       #7A8A7C;
  --text-placeholder: #ADBCAF;
  --text-on-dark:     #EDE9E2;
  --text-on-dark-sub: #9AAA9C;

  --border:       #DDD8CF;
  --border-light: #EAE6DE;
  --border-dark:  rgba(255,255,255,0.08);

  --radius-sm: 0.5rem;
  --radius:    0.875rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.75rem;

  --shadow-sm:  0 1px 2px rgba(0,0,0,0.06);
  --shadow:     0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 8px rgba(0,0,0,0.08), 0 12px 28px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 16px rgba(0,0,0,0.10), 0 24px 48px rgba(0,0,0,0.12);

  --font-body:    'Plus Jakarta Sans', system-ui, sans-serif;
  --font-heading: 'Fraunces', Georgia, serif;
}

html { font-size: 16px; }

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text-dark);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── TYPOGRAPHY ─────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text-dark);
}
h1 { font-size: 2.5rem;  letter-spacing: -0.03em; }
h2 { font-size: 1.875rem; letter-spacing: -0.025em; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem;     font-weight: 600; font-family: var(--font-body); }
h6 { font-size: 0.875rem; font-weight: 600; font-family: var(--font-body); }
p  { line-height: 1.75; color: var(--text-secondary); font-size: 0.9375rem; }
a  { color: var(--sage); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--sage-light); }

.heading-serif { font-family: var(--font-heading); }
.overline {
  font-size: 0.6875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted);
}
.overline-gold {
  font-size: 0.6875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--gold);
}

/* ─── LAYOUT ─────────────────────────────── */
.container     { max-width: 72rem; margin: 0 auto; padding: 0 2.5rem; }
.page-content  { padding: 2.5rem 0 5rem; }
.page-header   { margin-bottom: 2rem; }
.page-header p { margin-top: 0.375rem; }

/* ─── NAVBAR ─────────────────────────────── */
.navbar {
  background: var(--dark);
  border-bottom: 1px solid var(--border-dark);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  transition: background 0.35s ease, border-color 0.35s ease, backdrop-filter 0.35s ease;
  position: relative;
  z-index: 100;
}

.navbar-scrolled {
  background: rgba(24, 30, 27, 0.97);
  border-bottom-color: var(--border-dark);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.navbar-inner {
  display: flex; align-items: center;
  justify-content: space-between; height: 4rem;
}
.navbar-brand {
  font-family: var(--font-heading);
  font-size: 1.375rem; font-weight: 800;
  color: var(--text-on-dark);
  letter-spacing: -0.02em; text-decoration: none;
}
.navbar-brand span { color: var(--gold); }
.navbar-nav { display: flex; align-items: center; gap: 0.25rem; }
.nav-link {
  font-size: 0.875rem; font-weight: 500;
  color: var(--text-on-dark-sub);
  text-decoration: none; padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm); transition: all 0.15s;
}
.nav-link:hover { color: var(--text-on-dark); background: rgba(255,255,255,0.06); }
.nav-link.active { color: var(--text-on-dark); background: rgba(255,255,255,0.1); }
.navbar-divider { width: 1px; height: 1.25rem; background: var(--border-dark); margin: 0 0.5rem; }
.navbar-user {
  font-size: 0.8125rem; font-weight: 700;
  color: var(--dark); background: var(--gold);
  padding: 0.4375rem 1rem; border-radius: var(--radius-sm);
  text-decoration: none; transition: all 0.15s;
  letter-spacing: 0.01em;
}
.navbar-user:hover { background: var(--gold-light); color: var(--dark); }
.nav-logout {
  font-size: 0.8125rem; font-weight: 500;
  color: var(--text-on-dark-sub);
  text-decoration: none; padding: 0.5rem 0.75rem;
  transition: color 0.15s; border-radius: var(--radius-sm);
}
.nav-logout:hover { color: #f08080; background: rgba(255,100,100,0.08); }

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.15s;
}

.hamburger:hover { background: rgba(255,255,255,0.8)}
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--text-on-dark); border-radius: 99px;
  transition: all 0.2s ease; transform-origin: center;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--dark-2);
  border-top: 1px solid var(--border-dark);
  display: none; flex-direction: column;
  z-index: 99; box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.mobile-menu.open { display: flex}

.mobile-nav-item {
  display: block; color: var(--text-on-dark-sub);
  padding: 1rem 1.5rem; text-decoration: none;
  font-size: 0.9375rem; font-weight: 500;
  border-bottom: 1px solid var(--border-dark);
  transition: all 0.15s;
}

.mobile-nav-item:hover {
  color: var(--text-on-dark); background: rgba(255,255,255,0.04);
}

.mobile-nav-item.gold { color: var(--gold); font-weight: 700;}
.mobile-nav-item.danger { color: #f08080; border-bottom: none; }

/* Footer */
.site-footer {
  background: var(--dark);
  margin-top: 3rem;
}
.footer-accent {
  height: 3px;
  background: linear-gradient(90deg, var(--sage) 0%, var(--gold) 100%);
}

.footer-main {
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border-dark);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem; align-items: start;
}

.footer-brand {
  font-family: var(--font-heading);
  font-size: 1.5rem; font-weight: 800;
  color: var(--text-on-dark); letter-spacing: -0.03em;
  margin-bottom: 0.875rem; display: block; text-decoration: none;
}

.footer-brand span { color: var(--gold); }
.footer-tagline {
  font-size: 0.875rem; color: var(--text-on-dark-sub);
  line-height: 1.7; max-width: 20rem; margin: 0;
}

.footer-col-title {
  font-size: 0.6875rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-on-dark-sub); margin-bottom: 1rem;
}

.footer-links { display: flex; flex-direction: column; gap: 0.625rem; }
.footer-link {
  color: var(--text-on-dark-sub); font-size: 0.875rem; font-weight: 500;
  text-decoration: none; transition: color 0.15s;
}

.footer-link:hover { color: var(--text-on-dark); }
.footer-bottom { padding: 1.25rem 0; }
.footer-bottom-row {
  display: flex; justify-content: space-between; align-items: center;
}

.footer-copy { font-size: 0.8125rem; color: var(--text-on-dark-sub); }
.footer-note { font-size: 0.8125rem; color: var(--text-on-dark-sub); font-style: italic; }


/* ─── HERO / DASHBOARD TOP ───────────────── */
.hero {
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark-3) 60%, #304038 100%);
  padding: 3rem 0 2.5rem;
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; top: -40%; right: -10%;
  width: 50rem; height: 50rem;
  background: radial-gradient(circle, rgba(100,170,120,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.hero-overline { color: var(--gold); }
.hero h1, .hero h2 { color: var(--text-on-dark); font-family: var(--font-heading); }
.hero p { color: var(--text-on-dark-sub); font-size: 1rem; }

/* ─── CARDS ──────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  overflow: hidden;
}
.card-body { padding: 1.75rem; }
.card-warm { background: var(--surface-warm); }

/* Colored stat cards */
.stat-card {
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  position: relative; overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute; right: -1rem; top: -1rem;
  width: 5rem; height: 5rem;
  border-radius: 50%;
  opacity: 0.07;
}
.stat-card .overline { margin-bottom: 0.625rem; display: block; }
.stat-card .stat-value {
  font-family: var(--font-heading);
  font-size: 2rem; font-weight: 800;
  letter-spacing: -0.04em; line-height: 1;
  display: block; margin-bottom: 0.5rem;
}
.stat-card .stat-sub { font-size: 0.8125rem; opacity: 0.7; }

.stat-income {
  background: var(--income-card);
  box-shadow: 0 4px 24px rgba(30,58,42,0.4);
}
.stat-income::after { background: #5AA86A; }
.stat-income .overline { color: rgba(180,220,180,0.8); }
.stat-income .stat-value, .stat-income .stat-sub { color: #E8F5EC; }

.stat-expense {
  background: var(--expense-card);
  box-shadow: 0 4px 24px rgba(58,28,28,0.4);
}
.stat-expense::after { background: #E06060; }
.stat-expense .overline { color: rgba(220,160,160,0.8); }
.stat-expense .stat-value, .stat-expense .stat-sub { color: #FAE8E8; }

.stat-balance {
  background: var(--balance-card);
  box-shadow: 0 4px 24px rgba(20,28,22,0.4);
}
.stat-balance::after { background: var(--gold); }
.stat-balance .overline { color: var(--gold); }
.stat-balance .stat-value { color: var(--gold-light); }
.stat-balance .stat-sub { color: var(--text-on-dark-sub); }

/* ─── FEATURE CARDS ──────────────────────── */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.feature-card {
  background: var(--surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 1.5rem;
  text-decoration: none; display: block;
  transition: all 0.2s ease;
  position: relative; overflow: hidden;
}
.feature-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--sage) 0%, var(--gold) 100%);
  opacity: 0; transition: opacity 0.2s;
}
.feature-card:hover { border-color: transparent; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.feature-card:hover::before { opacity: 1; }
.feature-card:hover { color: var(--text-dark); }
.feature-card .fc-num {
  font-family: var(--font-heading); font-size: 2rem; font-weight: 800;
  color: var(--border); line-height: 1; margin-bottom: 0.75rem;
  transition: color 0.2s;
}
.feature-card:hover .fc-num { color: var(--sage-pale); }
.feature-card .fc-title { font-weight: 700; font-size: 0.9375rem; color: var(--text-dark); }
.feature-card .fc-desc { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ─── BUTTONS ────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-body); font-weight: 700; font-size: 0.875rem;
  border: none; cursor: pointer; transition: all 0.15s;
  border-radius: var(--radius-sm); padding: 0.6875rem 1.375rem;
  text-decoration: none; line-height: 1; white-space: nowrap;
  letter-spacing: 0.01em;
}
.btn-primary { background: var(--dark); color: var(--text-on-dark); }
.btn-primary:hover { background: var(--dark-3); color: var(--text-on-dark); }
.btn-gold { background: var(--gold); color: var(--dark); }
.btn-gold:hover { background: var(--gold-light); color: var(--dark); }
.btn-sage { background: var(--sage); color: #fff; }
.btn-sage:hover { background: var(--sage-light); color: #fff; }
.btn-secondary {
  background: var(--surface); color: var(--text-dark);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-warm); border-color: var(--border); color: var(--text-dark); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-warm); color: var(--text-dark); }
.btn-danger { background: var(--red-pale); color: var(--red); border: 1.5px solid #f5c6c6; }
.btn-danger:hover { background: #fbd8d5; }
.btn-sm  { padding: 0.4375rem 0.875rem; font-size: 0.8125rem; }
.btn-lg  { padding: 1rem 2rem; font-size: 1rem; border-radius: var(--radius); }
.btn-full { width: 100%; }
.btn-outline-dark {
  background: transparent; color: var(--text-on-dark);
  border: 1.5px solid var(--border-dark);
}
.btn-outline-dark:hover { background: rgba(255,255,255,0.08); color: var(--text-on-dark); }

/* ─── FORMS ──────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block; font-weight: 600; font-size: 0.875rem;
  color: var(--text-dark); margin-bottom: 0.5rem;
}
.form-control {
  width: 100%; padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-family: var(--font-body);
  font-size: 0.9375rem; color: var(--text-dark);
  background: var(--surface); transition: all 0.15s; outline: none;
}
.form-control:focus {
  border-color: var(--dark-3);
  box-shadow: 0 0 0 3px rgba(24,30,27,0.08);
}
.form-control::placeholder { color: var(--text-placeholder); }
.form-control.is-invalid { border-color: var(--red); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(192,57,43,0.1); }
.invalid-feedback { color: var(--red); font-size: 0.8125rem; font-weight: 500; margin-top: 0.375rem; display: block; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 7rem; }

/* ─── TABLES ─────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  font-size: 0.6875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); padding: 1rem 1.5rem;
  border-bottom: 1.5px solid var(--border-light);
  white-space: nowrap; text-align: left;
  background: var(--surface-warm);
}
tbody td {
  padding: 1.0625rem 1.5rem; font-size: 0.9rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-dark);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover td { background: #F7F4EF; }

/* ─── BADGES ─────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2813rem 0.75rem; border-radius: 99px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em;
}
.badge-income  { background: #D6F0DD; color: #1A5C2A; }
.badge-expense { background: #FDDEDE; color: #8A1A1A; }
.badge-admin   { background: var(--gold-pale); color: var(--gold-deep); }
.badge-user    { background: var(--bg-warm); color: var(--text-muted); }
.badge-active  { background: #D6F0DD; color: #1A5C2A; }
.badge-inactive{ background: #FDDEDE; color: #8A1A1A; }
.badge-cat     { background: var(--bg-warm); color: var(--text-secondary); border: 1px solid var(--border); }

/* ─── ALERTS ─────────────────────────────── */
.alert {
  padding: 1rem 1.25rem; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 500;
  border-left: 3px solid transparent; margin-bottom: 1.25rem;
}
.alert-success { background: #EBF6EC; color: #1A5C2A; border-color: var(--sage); }
.alert-danger  { background: #FDF0F0; color: #8A1A1A; border-color: var(--red); }
.alert-warning { background: #FDF8ED; color: #7A5A10; border-color: var(--gold); }

/* ─── PROGRESS ───────────────────────────── */
.progress-wrap { background: var(--border-light); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-bar  { height: 100%; border-radius: 99px; transition: width 0.4s ease;
  background: linear-gradient(90deg, var(--sage) 0%, var(--sage-light) 100%); }

/* ─── AUTH LAYOUT ────────────────────────── */
.auth-wrap { min-height: 100vh; display: flex; }
.auth-left {
  width: 42%; background: var(--dark);
  display: flex; flex-direction: column;
  justify-content: space-between; padding: 3rem;
  position: relative; overflow: hidden;
}
.auth-left::before {
  content: '';
  position: absolute; bottom: -10rem; left: -10rem;
  width: 30rem; height: 30rem;
  background: radial-gradient(circle, rgba(100,170,120,0.12) 0%, transparent 70%);
}
.auth-left::after {
  content: '';
  position: absolute; top: -5rem; right: -5rem;
  width: 18rem; height: 18rem;
  background: radial-gradient(circle, rgba(196,151,58,0.08) 0%, transparent 70%);
}
.auth-right {
  flex: 1; display: flex; align-items: center;
  justify-content: center; padding: 3rem 2rem;
  background: var(--surface);
}
.auth-form-wrap { width: 100%; max-width: 24rem; }
.auth-brand-big {
  font-family: var(--font-heading); font-size: 2.75rem; font-weight: 900;
  color: var(--text-on-dark); letter-spacing: -0.04em; line-height: 1;
}
.auth-brand-big span { color: var(--gold); }
.auth-tagline { color: var(--text-on-dark-sub); font-size: 1.0625rem; margin-top: 1rem; line-height: 1.6; }
.auth-footer-link { font-size: 0.875rem; color: var(--text-muted); margin-top: 1.5rem; text-align: center; }
.auth-footer-link a { color: var(--sage); font-weight: 700; }

/* ─── QUIZ ───────────────────────────────── */
.quiz-option {
  width: 100%; text-align: left; padding: 1rem 1.25rem;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-family: var(--font-body);
  font-size: 0.9375rem; font-weight: 500; color: var(--text-dark);
  cursor: pointer; transition: all 0.15s; margin-bottom: 0.625rem; display: block;
}
.quiz-option:hover {
  border-color: var(--dark-3); background: var(--surface-warm);
  box-shadow: var(--shadow-sm);
}
.opt-key {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.625rem; height: 1.625rem; border-radius: 0.375rem;
  background: var(--bg-warm); color: var(--text-secondary);
  font-size: 0.75rem; font-weight: 800; margin-right: 0.875rem; flex-shrink: 0;
  transition: all 0.15s;
}
.quiz-option:hover .opt-key { background: var(--dark); color: var(--gold); }

/* ─── UTILITY ────────────────────────────── */
.section-title {
  font-size: 0.6875rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted); margin-bottom: 1rem;
}
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.row    { display: flex; gap: 1.25rem; }
.col    { flex: 1; }
.flex           { display: flex; }
.flex-between   { display: flex; justify-content: space-between; align-items: center; }
.flex-center    { display: flex; justify-content: center; align-items: center; }
.items-start    { align-items: flex-start; }
.gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }  .mt-2 { margin-top: 1rem; }  .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }.mb-2 { margin-bottom: 1rem; }.mb-3 { margin-bottom: 1.5rem; }
.p-0 { padding: 0 !important; }
.w-full { width: 100%; }
.text-sm   { font-size: 0.875rem; }
.text-xs   { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-muted   { color: var(--text-muted); }
.text-gold    { color: var(--gold); }
.text-sage    { color: var(--sage); }
.text-red     { color: var(--red); }
.text-success { color: #1A5C2A; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.divider { height: 1px; background: var(--border-light); margin: 1.5rem 0; }
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-state p { font-size: 1rem; margin-bottom: 1.25rem; }

/* ─── DARK CARD ──────────────────────────── */
.card-dark {
  background: var(--dark-2); border-radius: var(--radius-lg);
  border: 1px solid var(--border-dark); overflow: hidden;
}
.card-dark .card-body { padding: 1.75rem; }

/* ─── SCROLLBAR ──────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #C8C0B4; }

/* ─── MODAL ──────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 20, 17, 0.65);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 1.5rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active{
  opacity: 1;
  pointer-events: all;
}

/* ─── MODAL ──────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 15, 12, 0.72);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 1.5rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  max-width: 22rem; width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2), 0 2px 8px rgba(0,0,0,0.12);
  transform: scale(0.94) translateY(14px);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}
.modal-overlay.active .modal-box {
  transform: scale(1) translateY(0);
}

/* Versi khusus modal dengan header gelap */
.modal-box .modal-header {
  padding: 1.25rem 1.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface-warm);
}
.modal-box .modal-header h4 {
  font-family: var(--font-heading);
  font-size: 1.1875rem; font-weight: 700;
  color: var(--text-dark); margin-bottom: 0.25rem;
}
.modal-box .modal-header .modal-subtitle {
  font-size: 0.875rem; font-weight: 600;
  color: var(--text-secondary); font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.modal-box .modal-body {
  padding: 1.125rem 1.75rem;
}
.modal-box .modal-body p {
  font-size: 0.9rem; color: var(--text-muted);
  line-height: 1.65; margin: 0;
}

.modal-box .modal-footer {
  padding: 1rem 1.75rem 1.5rem;
  display: flex; gap: 0.75rem;
}
.modal-footer .btn { flex: 1; }

/* Danger modal: garis merah di atas */
.modal-box.modal-danger::before {
  content: '';
  display: block; height: 3px;
  background: linear-gradient(90deg, #c0392b 0%, #e74c3c 100%);
}

/* Neutral modal (logout, konfirmasi umum): garis dark di atas */
.modal-box.modal-neutral::before {
  content: '';
  display: block; height: 3px;
  background: linear-gradient(90deg, var(--dark) 0%, var(--dark-4) 100%);
}

/* Chart Row */
.charts-row {
  display: flex; gap: 1.25rem; margin-bottom: 1.25rem;
  align-items: flex-start;
}

.chart-col-main {
  flex: 2;
  min-width: 0;
}
.chart-col-side {
  flex: 1;
  min-width: 0;
}

/* Responsive */

@media (max-width: 860px){
  /* Navbar */
  .hamburger { display: flex; }
  .navbar-nav { display: none; }

  /* Hero */
  .hero { padding: 1.75rem 0 1.25rem; }
  .hero h1 { font-size: 1.875rem; }
  .hero h2 { font-size: 1.5rem; }
  .hero .grid-3 { grid-template-columns: 1fr; gap: 0.75rem; }
  .hero .stat-card { box-shadow: none; }

  /* Grids */
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }

  /* Page */
  .page-content { padding: 1.75rem 0 3rem; }
  .flex-between { flex-wrap: wrap; gap: 0.75rem; }

  /* Modal */
  .modal-box { max-width: calc(100% - 2rem) !important; }

  /* Chart Row */
  .charts-row {
    flex-direction: column;
  }
  .chart-col-main, .chart-col-side {
    flex: 1; min-width: 100%;
  }

  /* row generic */
  .row {
    flex-direction: column;
  }
  .row > .col {
    flex: 1;
    width: 100% !important;
  }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
  .footer-bottom-row { flex-direction: column; gap: 0.5rem; text-align: center; }
}

@media (max-width: 560px){
  .container { padding: 0 1rem; }
  .feature-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.5rem; }
  .hero h2 { font-size: 1.375rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .footer-brand { font-size: 1.25rem; }
  .stat-card .stat-value { font-size: 1.5rem; }
  .stat-card { padding: 1.25rem; }
  thead th { font-size: 0.625rem; padding: 0.75rem; }
  tbody td { padding: 0.875rem 0.75rem; font-size: 0.8125rem; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .btn-lg { padding: 0.875rem 1.25rem; font-size: 0.9375rem; }
  .hero { padding: 1.25rem 0 1rem; }
  .page-content { padding: 1.25rem 0 2.5rem; }
}


@media (max-width: 900px) {
  .auth-left { display: none; }
  .auth-right { padding: 2rem 1.5rem; }
  .feature-grid, .grid-3 { grid-template-columns: repeat(2,1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .container { padding: 0 1.25rem; }
}
@media (max-width: 600px) {
  .feature-grid, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}