/* =========================================================================
   ĐÀO QUẢN GIA — Design System
   Đỏ sơn mài • Vàng kim • Nền giấy dó  |  Be Vietnam Pro + Noto Serif
   ========================================================================= */
:root {
  --bg: #F6F1E8;
  --bg-deep: #EFE7DA;
  --surface: #FFFFFF;
  --surface-2: #FBF8F3;
  --ink: #221B17;
  --ink-2: #4A403A;
  --muted: #7A6E66;
  --line: #E8DFD2;
  --line-strong: #D9CCBA;

  --brand: #9E1F24;
  --brand-700: #7D161B;
  --brand-50: #FBEDEC;
  --brand-100: #F5D7D5;
  --gold: #B8862B;
  --gold-50: #FBF4E4;
  --gold-100: #F3E3BD;

  --green: #2E7D57;
  --green-50: #E8F4EC;
  --blue: #2B5C8A;
  --blue-50: #E8F0F8;
  --amber: #B45D09;
  --amber-50: #FDF1E3;
  --violet: #6A3F98;
  --violet-50: #F1EAF8;
  --teal: #1F7A78;
  --teal-50: #E4F3F2;
  --danger: #C2272D;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(60, 35, 20, .06);
  --shadow: 0 1px 2px rgba(60, 35, 20, .05), 0 6px 20px rgba(60, 35, 20, .06);
  --shadow-lg: 0 24px 60px rgba(40, 20, 10, .22);

  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Noto Serif', Georgia, 'Times New Roman', serif;
  --sidebar-w: 280px;
  --bottom-nav-h: 68px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

.icon { width: 1.25em; height: 1.25em; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 1em; height: 1em; }
.icon-lg { width: 1.5em; height: 1.5em; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }

/* ----------------------------- Buttons ----------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .6rem 1.1rem; border-radius: 12px;
  border: 1px solid transparent; font-weight: 600; font-size: .95rem; line-height: 1.2;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
  white-space: nowrap; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(158, 31, 36, .25); }
.btn-primary:hover { background: var(--brand-700); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #9E7222; }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft { background: var(--brand-50); color: var(--brand); }
.btn-soft:hover { background: var(--brand-100); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: .4rem .8rem; font-size: .85rem; border-radius: 10px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--brand); border-color: var(--line-strong); }
.icon-btn.danger:hover { color: var(--danger); background: var(--brand-50); }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; }
.link-btn:hover { text-decoration: underline; }

/* ----------------------------- Forms ----------------------------- */
.field { display: flex; flex-direction: column; gap: .35rem; }
.field > label, .label { font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: .65rem .85rem; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 1rem;
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 12%, transparent); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .icon { position: absolute; left: .85rem; color: var(--muted); pointer-events: none; }
.input-wrap > .input { padding-left: 2.6rem; }
.input-wrap > .input-action { position: absolute; right: .35rem; width: 38px; height: 38px; border: 0; background: none; color: var(--muted); border-radius: 10px; display: grid; place-items: center; }
.hint { font-size: .78rem; color: var(--muted); }
.checkbox { display: inline-flex; align-items: center; gap: .6rem; font-weight: 500; cursor: pointer; user-select: none; }
.checkbox input { width: 20px; height: 20px; accent-color: var(--brand); }
.form-grid { display: grid; gap: .9rem; grid-template-columns: 1fr 1fr; }
.form-grid .span-2 { grid-column: 1 / -1; }
.alert { padding: .75rem .9rem; border-radius: 12px; font-size: .9rem; font-weight: 500; display: flex; gap: .55rem; align-items: flex-start; }
.alert-error { background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100); }
.alert-warn { background: var(--amber-50); color: #8A4705; border: 1px solid #F3D5AE; }
.alert-info { background: var(--blue-50); color: var(--blue); border: 1px solid #CFDDEB; }

/* ----------------------------- Login ----------------------------- */
.login-screen {
  position: fixed; inset: 0; z-index: 80; overflow-y: auto;
  display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(184, 134, 43, .16), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(158, 31, 36, .14), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 420px; background: var(--surface); border-radius: 26px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--line); overflow: hidden;
}
.login-card .ribbon { height: 6px; background: linear-gradient(90deg, var(--brand-700), var(--gold), var(--brand-700)); }
.login-body { padding: 32px 28px 24px; display: flex; flex-direction: column; gap: 18px; }
.login-brand { text-align: center; }
.login-brand img { width: 84px; height: 84px; margin: 0 auto 12px; border-radius: 22px; box-shadow: 0 10px 24px rgba(125, 22, 27, .28); }
.brand-name { font-family: var(--font-serif); font-weight: 700; font-size: 1.6rem; letter-spacing: .06em; color: var(--brand-700); }
.brand-tagline { font-size: .85rem; color: var(--muted); margin-top: 2px; }
.login-title { font-size: 1.15rem; font-weight: 700; margin-top: 16px; }
.login-foot { border-top: 1px solid var(--line); padding-top: 14px; text-align: center; font-size: .78rem; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.apk-link { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font-size: .88rem; font-weight: 600; color: var(--green); text-decoration: none; padding: .5rem; border-radius: 10px; }
.apk-link:hover { background: var(--green-50); }

/* ----------------------------- Layout ----------------------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; }
.sidebar-brand img { width: 46px; height: 46px; border-radius: 13px; }
.sidebar-brand .brand-name { font-size: 1.15rem; }
.sidebar-brand .brand-tagline { font-size: .75rem; }
.lunar-card { margin: 0 16px 12px; padding: 14px 16px; border-radius: var(--radius); background: linear-gradient(135deg, var(--gold-50), #FFF); border: 1px solid var(--gold-100); }
.lunar-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lunar-row span { font-size: .8rem; color: var(--muted); font-weight: 500; }
.lunar-row strong { font-size: 1.05rem; }
.lunar-row.lunar strong { color: var(--brand); }
.lunar-canchi { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--gold-100); font-size: .78rem; color: #7A5A1C; text-align: center; font-weight: 500; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 12px;
  border: 0; background: none; text-align: left; font-weight: 500; color: var(--ink-2); font-size: .95rem;
}
.nav-item .icon { color: var(--muted); }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--brand-50); color: var(--brand-700); font-weight: 700; }
.nav-item.active .icon { color: var(--brand); }
.nav-item .count { margin-left: auto; }
.sidebar-user { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.sidebar-user .who { min-width: 0; flex: 1; }
.sidebar-user .who strong { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .who span { font-size: .75rem; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-title { font-family: var(--font-serif); font-weight: 700; font-size: 1.3rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-mobile-brand { display: none; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.topbar-mobile-brand img { width: 36px; height: 36px; border-radius: 10px; }
.clock-chip { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.clock-chip strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.clock-chip span { font-size: .72rem; color: var(--muted); }
.bell-btn { position: relative; }
.bell-btn.off { color: var(--muted); }
.bell-btn .dot { position: absolute; top: -5px; right: -5px; }

.content { padding: 8px 28px 40px; max-width: 1240px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.view { display: flex; flex-direction: column; gap: 20px; animation: fade-in .2s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ----------------------------- Cards ----------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 0; flex-wrap: wrap; }
.card-head h3 { font-size: 1.08rem; font-weight: 700; }
.card-head p { font-size: .84rem; color: var(--muted); }
.card-head .grow { flex: 1; min-width: 160px; }
.card-body { padding: 16px 20px 20px; }
.tile-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.tone-brand { background: var(--brand-50); color: var(--brand); }
.tone-gold { background: var(--gold-50); color: #8C6418; }
.tone-green { background: var(--green-50); color: var(--green); }
.tone-blue { background: var(--blue-50); color: var(--blue); }
.tone-amber { background: var(--amber-50); color: var(--amber); }
.tone-violet { background: var(--violet-50); color: var(--violet); }
.tone-teal { background: var(--teal-50); color: var(--teal); }

.grid-2 { display: grid; gap: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 20px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Hero */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 24px;
  background: linear-gradient(135deg, #8E1B20 0%, #6B1216 60%, #4E0D10 100%); color: #FFF7EE;
  box-shadow: 0 14px 34px rgba(110, 18, 22, .25);
}
.hero::after {
  content: ''; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px;
  background: url('/icon-maskable.svg') center/contain no-repeat; opacity: .10; border-radius: 50%;
}
.hero-top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-greet { font-family: var(--font-serif); font-size: 1.6rem; font-weight: 700; line-height: 1.25; }
.hero-sub { margin-top: 6px; color: #F3D9C9; font-size: .95rem; }
.hero-date { text-align: right; }
.hero-date strong { display: block; font-size: 1.05rem; }
.hero-date span { color: #F1CFA0; font-size: .88rem; }
.hero-badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 4px 10px; border-radius: 999px; background: rgba(233, 180, 76, .2); color: #FBE3B0; font-size: .8rem; font-weight: 600; }
.command {
  position: relative; z-index: 1; margin-top: 18px; display: flex; gap: 8px; padding: 6px;
  background: rgba(255, 255, 255, .97); border-radius: 16px; box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
}
.command input { flex: 1; min-width: 0; border: 0; outline: none; background: none; padding: .6rem .8rem; font-size: 1rem; color: var(--ink); }
.command-hints { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip-hint { border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08); color: #FFEFE3; font-size: .8rem; padding: 5px 10px; border-radius: 999px; }
.chip-hint:hover { background: rgba(255, 255, 255, .16); }

/* KPI */
.kpi { padding: 16px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; text-align: left; }
.kpi:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi-label { font-size: .82rem; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .82rem; color: var(--ink-2); }
.progress { height: 8px; border-radius: 99px; background: var(--bg-deep); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--green); transition: width .3s; }
.progress.warn > i { background: var(--amber); }
.progress.over > i { background: var(--danger); }

/* Lists */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 1rem; line-height: 1.35; overflow-wrap: anywhere; }
.row-meta { font-size: .84rem; color: var(--muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.row-meta .icon { width: .95em; height: .95em; }
.row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.row.done .row-title { text-decoration: line-through; color: var(--muted); }
.row-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount-in { color: var(--green); }
.amount-out { color: var(--brand); }

.check {
  width: 30px; height: 30px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center;
  border: 2px solid var(--line-strong); background: var(--surface); color: transparent; transition: all .15s;
}
.check:hover { border-color: var(--green); }
.check.on { background: var(--green); border-color: var(--green); color: #fff; }
.time-pill { font-variant-numeric: tabular-nums; font-weight: 700; font-size: .95rem; padding: 6px 10px; border-radius: 10px; background: var(--gold-50); color: #7A5718; border: 1px solid var(--gold-100); flex-shrink: 0; min-width: 64px; text-align: center; }
.row.done .time-pill { background: var(--bg-deep); color: var(--muted); border-color: var(--line); }
.row.now .time-pill { background: var(--brand); color: #fff; border-color: var(--brand); }
.days-box { flex-shrink: 0; width: 66px; text-align: center; padding: 8px 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.days-box strong { display: block; font-size: 1.35rem; line-height: 1; font-variant-numeric: tabular-nums; }
.days-box span { font-size: .68rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.days-box.urgent { background: var(--brand); border-color: var(--brand); color: #fff; }
.days-box.urgent span { color: #FBD9D6; }
.days-box.soon { background: var(--gold-50); border-color: var(--gold-100); color: #7A5718; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.badge-brand { background: var(--brand-50); color: var(--brand-700); }
.badge-gold { background: var(--gold-50); color: #7A5718; }
.badge-green { background: var(--green-50); color: var(--green); }
.badge-blue { background: var(--blue-50); color: var(--blue); }
.badge-gray { background: var(--bg-deep); color: var(--ink-2); }
.badge-violet { background: var(--violet-50); color: var(--violet); }
.count {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--brand); color: #fff;
  font-size: .74rem; font-weight: 700; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums;
}
.count.soft { background: var(--brand-100); color: var(--brand-700); }

.empty { text-align: center; padding: 28px 12px; color: var(--muted); font-size: .92rem; }
.empty .icon { width: 40px; height: 40px; margin: 0 auto 8px; display: block; color: var(--line-strong); stroke-width: 1.5; }

/* Alerts on overview */
.brief { display: flex; flex-direction: column; gap: 10px; }
.brief-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface-2); text-align: left; width: 100%;
}
.brief-item:hover { border-color: var(--line-strong); background: #fff; }
.brief-item .row-main { min-width: 0; }
.brief-item.high { border-left: 4px solid var(--brand); }
.brief-item.mid { border-left: 4px solid var(--gold); }
.brief-item.low { border-left: 4px solid var(--blue); }

/* Toolbar & segmented */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .input-wrap { flex: 1; min-width: 200px; }
.seg { display: inline-flex; padding: 4px; background: var(--bg-deep); border-radius: 12px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 9px; font-size: .86rem; font-weight: 600; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-sm); }

/* Notes */
.notes-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.note { padding: 14px; border-radius: 14px; background: #FFFBEF; border: 1px solid #F1E2B5; position: relative; display: flex; flex-direction: column; gap: 8px; }
.note p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; }
.note footer { display: flex; justify-content: space-between; align-items: center; font-size: .75rem; color: var(--muted); }

/* Table (admin) */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); padding: 10px 14px; font-weight: 700; white-space: nowrap; }
td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.avatar {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center;
  font-weight: 700; font-size: .95rem; color: #fff; background: var(--gold);
}
.avatar.lg { width: 52px; height: 52px; border-radius: 15px; font-size: 1.1rem; }
.person { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.person strong { display: block; }
.person span { font-size: .8rem; color: var(--muted); }
.book { display: flex; align-items: center; gap: 8px; min-width: 200px; }
.book .icon { color: var(--gold); }
.book strong { font-weight: 600; font-size: .88rem; }
.book span { display: block; font-size: .76rem; color: var(--muted); }
.member-cards { display: none; }

/* Modal / sheet */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(30, 18, 12, .5);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: hidden; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
.modal.sm { max-width: 420px; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 1.1rem; font-weight: 700; flex: 1; }
.modal-head p { font-size: .82rem; color: var(--muted); }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2); }

.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sheet-item { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); font-size: .84rem; font-weight: 600; text-align: center; }
.sheet-item:hover { border-color: var(--line-strong); background: #fff; }

/* Toast */
.toast-stack { position: fixed; z-index: 120; top: 16px; right: 16px; left: auto; display: flex; flex-direction: column; gap: 10px; width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px;
  background: #2A1F1A; color: #FFF5EC; box-shadow: var(--shadow-lg); border-left: 5px solid var(--gold);
  animation: toast-in .2s ease; font-size: .95rem;
}
.toast.error { border-left-color: #F06A6F; }
.toast.success { border-left-color: #5CC28E; }
.toast .icon { color: #F1C66A; margin-top: 2px; }
.toast p { flex: 1; }
.toast button { background: none; border: 0; color: #C9B7AA; padding: 0 2px; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Banner */
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 14px; font-size: .9rem; flex-wrap: wrap; }
.banner .grow { flex: 1; min-width: 200px; }
.banner-warn { background: var(--amber-50); border: 1px solid #F3D5AE; color: #7B4206; }
.banner-danger { background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-700); }

/* Lock / update overlay */
.blocker { position: fixed; inset: 0; z-index: 110; background: rgba(30, 18, 12, .72); display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(4px); }
.blocker .modal { text-align: center; }
.blocker .big-icon { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto; display: grid; place-items: center; }
.changelog { text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 12px 30px; font-size: .88rem; color: var(--ink-2); margin: 0; }
.changelog li + li { margin-top: 4px; }

/* Bottom nav (mobile) */
.bottom-nav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  grid-template-columns: repeat(5, 1fr);
}
.bottom-nav button {
  position: relative; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: .7rem; font-weight: 600; color: var(--muted);
}
.bottom-nav button .icon { width: 24px; height: 24px; }
.bottom-nav button.active { color: var(--brand); }
.bottom-nav button.active::before { content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
.bottom-nav .count { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: .66rem; padding: 0 5px; }

.fab {
  display: none; position: fixed; right: 18px; bottom: calc(var(--bottom-nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 35;
  width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--brand); color: #fff;
  box-shadow: 0 10px 24px rgba(158, 31, 36, .35); place-items: center;
}
.fab .icon { width: 26px; height: 26px; }

.muted { color: var(--muted); }
.mt-1 { margin-top: 4px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.section-title { font-family: var(--font-serif); font-size: 1.05rem; font-weight: 700; }
.stat-line { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; padding: 6px 0; }
.stat-line span { color: var(--muted); }
.code { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; background: var(--bg-deep); padding: 2px 6px; border-radius: 6px; }
.audit-list .row { padding: 10px 4px; }
.pack-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.pack-list .checkbox { font-size: .9rem; }
.pack-list .checkbox.on span { text-decoration: line-through; color: var(--muted); }

/* ----------------------------- Responsive ----------------------------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .sidebar { display: none; }
  .bottom-nav { display: grid; }
  .fab { display: grid; }
  .topbar { padding: 10px 16px; }
  .topbar-title { display: none; }
  .topbar-mobile-brand { display: flex; }
  .content { padding: 4px 16px calc(var(--bottom-nav-h) + 88px + env(safe-area-inset-bottom)); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { padding: 20px 18px; }
  .hero-greet { font-size: 1.35rem; }
  .hero-date { text-align: left; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 1.35rem; }
  .card-head { padding: 16px 16px 0; }
  .card-body { padding: 12px 16px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 22px 22px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); }
  .row { gap: 10px; }
  .row-actions .icon-btn { width: 36px; height: 36px; }
  .clock-chip span { display: none; }
  .clock-chip strong { font-size: 1rem; }
  .topbar-mobile-brand .brand-name { font-size: .95rem !important; letter-spacing: .03em; white-space: nowrap; }
  .topbar-mobile-brand .brand-tagline { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-mobile-brand > div { min-width: 0; }
  .topbar .icon-btn { width: 38px; height: 38px; }
  .hero-date { display: none; }
  .command .btn span { display: none; }
  .command .btn { padding: .6rem .9rem; }
  .command-hints { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -18px; padding-right: 18px; }
  .command-hints::-webkit-scrollbar { display: none; }
  .chip-hint { flex-shrink: 0; }
  .banner { padding: 10px 12px; font-size: .85rem; }
  .table-wrap.members { display: none; }
  .member-cards { display: flex; flex-direction: column; gap: 10px; }
  .member-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
  .toast-stack { top: auto; bottom: calc(var(--bottom-nav-h) + 12px + env(safe-area-inset-bottom)); right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
