/* =========================================================================
   Ward Saathi admin - design system
   Sections: tokens · base · layout · components · pages · charts · print
   ========================================================================= */

/* ---- Tokens ---------------------------------------------------------------- */
:root {
  --indigo: #4F46E5; --violet: #7C3AED; --pink: #EC4899;
  --teal: #06B6D4; --emerald: #10B981; --amber: #F59E0B; --red: #EF4444; --blue: #3B82F6;
  --grad-primary: linear-gradient(135deg, #4F46E5 0%, #7C3AED 55%, #EC4899 100%);
  --grad-teal: linear-gradient(135deg, #06B6D4, #10B981);
  --grad-amber: linear-gradient(135deg, #F59E0B, #EF4444);
  --grad-blue: linear-gradient(135deg, #3B82F6, #06B6D4);
  --grad-pink: linear-gradient(135deg, #EC4899, #F59E0B);
  --grad-violet: linear-gradient(135deg, #7C3AED, #3B82F6);

  --bg: #F5F3FF; --text: #1E1B3A; --muted: #625C88;
  --surface: rgba(255, 255, 255, .74); --surface-solid: #FFFFFF; --surface-2: #F0EDFF;
  --border: rgba(99, 102, 241, .16); --border-strong: rgba(99, 102, 241, .3);
  --input-bg: rgba(255, 255, 255, .9);
  --shadow: 0 12px 32px -14px rgba(79, 70, 229, .32), 0 2px 6px -2px rgba(79, 70, 229, .08);
  --shadow-lg: 0 30px 70px -24px rgba(79, 70, 229, .45);
  --glow: 0 10px 28px -6px rgba(124, 58, 237, .55);
  --ring: 0 0 0 3px rgba(124, 58, 237, .35);
  --blob-a: rgba(124, 58, 237, .22); --blob-b: rgba(236, 72, 153, .18); --blob-c: rgba(6, 182, 212, .18);

  --r-sm: 10px; --r: 16px; --r-lg: 22px;
  --sb: 268px; --topbar: 68px;
  --font: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', 'Noto Sans Devanagari', sans-serif;
  --font-body: 'Inter', 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', 'Noto Sans Devanagari', sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0F0B1F; --text: #EEEBFF; --muted: #A9A4CC;
  --surface: rgba(26, 21, 48, .72); --surface-solid: #1A1530; --surface-2: #231C42;
  --border: rgba(167, 139, 250, .18); --border-strong: rgba(167, 139, 250, .36);
  --input-bg: rgba(15, 11, 31, .6);
  --shadow: 0 14px 34px -14px rgba(0, 0, 0, .7), 0 0 0 1px rgba(167, 139, 250, .04);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .8);
  --blob-a: rgba(124, 58, 237, .32); --blob-b: rgba(236, 72, 153, .2); --blob-c: rgba(6, 182, 212, .16);
  color-scheme: dark;
}

/* ---- Base --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font-body); font-size: 14.5px; line-height: 1.55; color: var(--text);
  background: var(--bg); min-height: 100vh; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4 { font-family: var(--font); margin: 0; line-height: 1.2; letter-spacing: -.015em; }
p { margin: 0; }
a { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
::selection { background: rgba(124, 58, 237, .28); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }

.ic { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.grad-text { background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.spacer { flex: 1; }
.pad { padding: 20px; }
.grid { display: grid; gap: 18px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* Animated background mesh (floating blurred blobs) */
.bg-mesh { position: fixed; inset: 0; z-index: -1; overflow: hidden; background:
  radial-gradient(1200px 600px at 10% -10%, var(--blob-a), transparent 60%),
  radial-gradient(900px 500px at 100% 0%, var(--blob-b), transparent 60%),
  var(--bg); }
.bg-mesh i { position: absolute; border-radius: 50%; filter: blur(80px); animation: float 22s ease-in-out infinite; }
.bg-mesh i:nth-child(1) { width: 420px; height: 420px; left: 55%; top: 55%; background: var(--blob-c); }
.bg-mesh i:nth-child(2) { width: 360px; height: 360px; left: -80px; top: 60%; background: var(--blob-a); animation-delay: -8s; }
.bg-mesh i:nth-child(3) { width: 300px; height: 300px; left: 70%; top: -80px; background: var(--blob-b); animation-delay: -14s; }

@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(40px, -30px) scale(1.1); } 66% { transform: translate(-30px, 30px) scale(.95); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes gradshift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(236, 72, 153, .6); } 100% { box-shadow: 0 0 0 10px rgba(236, 72, 153, 0); } }

/* ---- Buttons ------------------------------------------------------------------- */
.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border: 1px solid transparent; border-radius: 12px; font-weight: 600; font-size: 14px;
  line-height: 1.2; white-space: nowrap; text-decoration: none; background: transparent; color: var(--text);
  transition: transform .2s var(--ease), box-shadow .25s var(--ease), background .2s, filter .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--grad-primary); background-size: 140% 140%; color: #fff; box-shadow: 0 6px 16px -6px rgba(124, 58, 237, .6); }
.btn-primary:hover { box-shadow: var(--glow); background-position: 100% 50%; }
.btn-soft { background: rgba(124, 58, 237, .1); color: var(--violet); border-color: rgba(124, 58, 237, .14); }
[data-theme="dark"] .btn-soft { color: #C4B5FD; background: rgba(167, 139, 250, .14); }
.btn-soft:hover { background: rgba(124, 58, 237, .18); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-outline { border-color: var(--border-strong); background: var(--surface); }
.btn-outline:hover { border-color: var(--violet); }
.btn-danger { background: var(--grad-amber); color: #fff; box-shadow: 0 6px 16px -6px rgba(239, 68, 68, .6); }
.btn-danger:hover { box-shadow: 0 10px 26px -6px rgba(239, 68, 68, .6); }
.btn-success { background: var(--grad-teal); color: #fff; box-shadow: 0 6px 16px -6px rgba(16, 185, 129, .6); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; gap: 6px; }
.btn-lg { padding: 14px 24px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-soft.is-loading::after, .btn-ghost.is-loading::after, .btn-outline.is-loading::after { border-color: var(--border-strong); border-top-color: var(--violet); }
.ripple { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .45); transform: scale(0); animation: ripple .6s ease-out forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; color: var(--muted); position: relative; transition: all .2s var(--ease); flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); transform: translateY(-1px); }
.icon-btn.danger:hover { background: rgba(239, 68, 68, .12); color: var(--red); }
.icon-btn.bordered { border-color: var(--border); background: var(--surface); }

/* ---- Cards ----------------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
}
.card-hover { transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; font-size: 15.5px; font-weight: 700; font-family: var(--font); }
.card-title small { font-weight: 500; color: var(--muted); font-size: 12.5px; }
.rise, .stagger > * { animation: rise .55s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 55ms); }
.chip-ic {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: #fff; flex: none;
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, .35);
}
.g-indigo { background: var(--grad-primary); } .g-teal { background: var(--grad-teal); } .g-amber { background: var(--grad-amber); }
.g-blue { background: var(--grad-blue); } .g-pink { background: var(--grad-pink); } .g-violet { background: var(--grad-violet); }

/* ---- Badges, avatars ----------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  line-height: 1.5; white-space: nowrap; border: 1px solid transparent;
}
.badge-gray { background: rgba(100, 100, 140, .12); color: var(--muted); }
.badge-indigo { background: rgba(79, 70, 229, .12); color: #4338CA; }
.badge-violet { background: rgba(124, 58, 237, .12); color: #6D28D9; }
.badge-pink { background: rgba(236, 72, 153, .13); color: #BE185D; }
.badge-teal { background: rgba(6, 182, 212, .14); color: #0E7490; }
.badge-green { background: rgba(16, 185, 129, .15); color: #047857; }
.badge-amber { background: rgba(245, 158, 11, .16); color: #B45309; }
.badge-red { background: rgba(239, 68, 68, .13); color: #B91C1C; }
.badge-blue { background: rgba(59, 130, 246, .14); color: #1D4ED8; }
[data-theme="dark"] .badge-indigo { color: #A5B4FC; } [data-theme="dark"] .badge-violet { color: #C4B5FD; }
[data-theme="dark"] .badge-pink { color: #F9A8D4; } [data-theme="dark"] .badge-teal { color: #67E8F9; }
[data-theme="dark"] .badge-green { color: #6EE7B7; } [data-theme="dark"] .badge-amber { color: #FCD34D; }
[data-theme="dark"] .badge-red { color: #FCA5A5; } [data-theme="dark"] .badge-blue { color: #93C5FD; }

.avatar {
  --s: 40px; display: inline-grid; place-items: center; width: var(--s); height: var(--s); border-radius: 50%; flex: none; overflow: hidden;
  background: linear-gradient(135deg, var(--a), var(--b)); color: #fff; font-family: var(--font); font-weight: 700;
  font-size: calc(var(--s) * .38); box-shadow: 0 6px 14px -6px var(--a); letter-spacing: .02em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Forms ---------------------------------------------------------------------------- */
.form-grid { display: grid; gap: 16px 18px; grid-template-columns: 1fr; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: 1 / -1; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--text); }
.req { color: var(--pink); }
.input {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--input-bg);
  transition: border-color .2s, box-shadow .2s, background .2s; min-height: 44px; appearance: none; -webkit-appearance: none;
}
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237C3AED' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.input::placeholder { color: var(--muted); opacity: .7; }
.input:hover { border-color: var(--border-strong); }
.input:focus { outline: none; border-color: var(--violet); box-shadow: var(--ring); }
.input:disabled { opacity: .6; cursor: not-allowed; }
textarea.input { resize: vertical; min-height: 84px; }
.field-msg { min-height: 0; font-size: 12.5px; }
.field-msg .hint { color: var(--muted); }
.field-msg .err, .form-error { color: #DC2626; font-weight: 600; }
[data-theme="dark"] .field-msg .err, [data-theme="dark"] .form-error { color: #FCA5A5; }
.field.invalid .input { border-color: var(--red); background: rgba(239, 68, 68, .05); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.form-error { background: rgba(239, 68, 68, .1); border: 1px solid rgba(239, 68, 68, .3); padding: 10px 14px; border-radius: 12px; }
.input-icon { position: relative; }
.input-icon > .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .input { padding-left: 42px; }
.input-icon > .icon-btn { position: absolute; right: 4px; top: 2px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 500; min-height: 44px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 44px; height: 26px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .25s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .3s var(--spring); }
.switch input:checked + .track { background: var(--grad-primary); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.field-switch { justify-content: center; }

.photo-field { display: flex; align-items: center; gap: 16px; padding: 12px; border: 1.5px dashed var(--border-strong); border-radius: 16px; background: var(--input-bg); }
.photo-preview { width: 76px; height: 76px; border-radius: 22px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); overflow: hidden; flex: none; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.photo-actions .hint { flex-basis: 100%; font-size: 12px; color: var(--muted); }
[data-photo-field].uploading .photo-preview { animation: pulse 1s infinite; }

.search { position: relative; flex: 1 1 260px; min-width: 200px; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 42px; border-radius: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fchip {
  padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600;
  color: var(--muted); transition: all .2s var(--ease); display: inline-flex; align-items: center; gap: 6px;
}
.fchip:hover { border-color: var(--violet); color: var(--violet); transform: translateY(-1px); }
.fchip.active { background: var(--grad-primary); color: #fff; border-color: transparent; box-shadow: 0 6px 16px -6px rgba(124, 58, 237, .6); }
.seg { display: inline-flex; padding: 4px; border-radius: 14px; background: var(--surface-2); gap: 2px; border: 1px solid var(--border); }
.seg button, .seg label { border: 0; background: transparent; padding: 7px 14px; border-radius: 10px; font-weight: 600; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: all .2s; }
.seg button.active, .seg input:checked + span { background: var(--surface-solid); color: var(--violet); box-shadow: 0 4px 10px -4px rgba(79, 70, 229, .4); }
.seg label input { position: absolute; opacity: 0; }
.seg label span { padding: 7px 14px; border-radius: 10px; display: inline-block; }
.seg label { padding: 0; }
.seg label:focus-within span { box-shadow: var(--ring); }

/* ---- Tables ----------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 14px 16px; white-space: nowrap; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.table th:first-child { border-top-left-radius: var(--r-lg); } .table th:last-child { border-top-right-radius: var(--r-lg); }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--violet); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .2s; animation: rise .45s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 28ms); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:hover { background: rgba(124, 58, 237, .06); }
.table tbody tr:last-child td { border-bottom: 0; }
.cell-person { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.cell-person b { display: block; font-weight: 600; font-family: var(--font); }
.cell-person small { color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; flex-wrap: wrap; border-top: 1px solid var(--border); }
.pager .pages { display: flex; gap: 4px; }
.pager button { min-width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; transition: all .2s; }
.pager button:hover:not(:disabled) { border-color: var(--violet); color: var(--violet); }
.pager button.active { background: var(--grad-primary); color: #fff; border-color: transparent; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

/* ---- Skeleton & empty ----------------------------------------------------------------------- */
.skeleton, .sk-row { background: linear-gradient(90deg, var(--surface-2) 25%, rgba(124, 58, 237, .12) 37%, var(--surface-2) 63%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 12px; border-color: transparent; }
.sk-row { height: 44px; }
.empty { text-align: center; padding: 48px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty h3 { font-size: 18px; } .empty p { color: var(--muted); max-width: 380px; }
.empty .btn { margin-top: 8px; }
.empty-art { position: relative; width: 120px; height: 110px; display: grid; place-items: center; margin-bottom: 6px; }
.empty-blob { position: absolute; inset: 6px; border-radius: 42% 58% 55% 45% / 50% 45% 55% 50%; background: var(--grad-primary); opacity: .16; animation: float 9s ease-in-out infinite; }
.empty-emoji { font-size: 52px; position: relative; animation: bob 3.2s ease-in-out infinite; filter: drop-shadow(0 10px 12px rgba(79, 70, 229, .3)); }

/* ---- Toast ------------------------------------------------------------------------------------ */
.toasts { position: fixed; z-index: 400; top: 18px; right: 18px; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 36px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; border-radius: 16px; background: var(--surface-solid);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-weight: 500; cursor: pointer; animation: toastIn .45s var(--spring) both;
  border-left: 4px solid var(--violet);
}
.toast.out { animation: toastOut .25s ease-in forwards; }
.toast-ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; background: var(--grad-primary); flex: none; }
.toast-success { border-left-color: var(--emerald); } .toast-success .toast-ic { background: var(--grad-teal); }
.toast-error { border-left-color: var(--red); } .toast-error .toast-ic { background: var(--grad-amber); }
.toast-msg { padding-top: 3px; word-break: break-word; }
@keyframes toastIn { from { opacity: 0; transform: translateX(60px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(60px); } }

/* ---- Modal & drawer ------------------------------------------------------------------------------ */
.overlay { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 11, 31, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s; }
.overlay.open { opacity: 1; }
.overlay.closing { opacity: 0; pointer-events: none; }
.modal, .drawer { background: var(--surface-solid); border: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: 100%; position: relative; }
.modal { width: min(600px, 100%); border-radius: 26px; transform: translateY(30px) scale(.94); transition: transform .45s var(--spring); }
.modal[data-size="sm"] { width: min(430px, 100%); }
.modal[data-size="lg"] { width: min(820px, 100%); }
.overlay.open .modal { transform: none; }
.overlay.closing .modal { transform: translateY(16px) scale(.97); transition-duration: .2s; }
.overlay-drawer { justify-content: flex-end; padding: 0; }
.drawer { width: min(620px, 100%); height: 100%; border-radius: 28px 0 0 28px; transform: translateX(100%); transition: transform .5s var(--ease); }
.drawer[data-size="lg"] { width: min(760px, 100%); }
.overlay.open .drawer { transform: none; }
.overlay.closing .drawer { transform: translateX(100%); transition-duration: .25s; }
.modal-head, .drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 22px 24px 14px; }
.modal-title, .drawer-title { flex: 1; min-width: 0; }
.modal-title h2, .drawer-title h2 { font-size: 20px; }
.modal-title p, .drawer-title p { font-size: 13px; margin-top: 2px; }
.head-extra { display: flex; gap: 6px; }
.modal-body, .drawer-body { padding: 8px 24px 22px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.modal-foot, .drawer-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.is-busy .modal-body, .is-busy .drawer-body { opacity: .6; pointer-events: none; }
.confirm { display: flex; gap: 14px; align-items: flex-start; padding-top: 4px; }
.confirm-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: rgba(124, 58, 237, .12); color: var(--violet); flex: none; }
.confirm-ic.danger { background: rgba(239, 68, 68, .12); color: var(--red); }
.confirm p { padding-top: 4px; color: var(--muted); }

/* ---- Shell: sidebar, topbar, content ---------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--sb) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .35s var(--ease); }
.shell.collapsed { --sb: 84px; }
.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 60; padding: 18px 14px; display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border-right: 1px solid var(--border); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 12px; text-decoration: none !important; color: var(--text); }
.brand-text { overflow: hidden; white-space: nowrap; }
.brand-text b { display: block; font-family: var(--font); font-size: 18px; font-weight: 800; }
.brand-text small { color: var(--muted); font-size: 11.5px; }
.nav { position: relative; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; flex: 1; padding-right: 2px; }
.nav-indicator { position: absolute; left: 0; right: 0; top: 0; height: 46px; border-radius: 14px; background: var(--grad-primary); box-shadow: var(--glow); transition: transform .45s var(--spring), height .3s, opacity .2s; opacity: 0; z-index: 0; }
.nav-link { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; padding: 0 14px; height: 46px; border-radius: 14px; color: var(--muted); font-weight: 600; text-decoration: none !important; white-space: nowrap; transition: color .25s, background .2s; flex: none; }
.nav-link:hover { color: var(--text); background: rgba(124, 58, 237, .08); }
.nav-link.active { color: #fff; background: transparent; }
.nav-link .nav-label { overflow: hidden; }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 14px 14px 4px; font-weight: 700; white-space: nowrap; }
.collapsed .brand-text, .collapsed .nav-label, .collapsed .nav-sep, .collapsed .sb-ward { display: none; }
.collapsed .nav-link { justify-content: center; padding: 0; }
.sb-ward { padding: 14px; border-radius: 18px; background: var(--grad-primary); color: #fff; font-size: 12.5px; position: relative; overflow: hidden; }
.sb-ward::after { content: ''; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; border-radius: 50%; background: rgba(255, 255, 255, .15); }
.sb-ward b { display: block; font-family: var(--font); font-size: 14px; }
.sb-ward span { opacity: .85; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar); display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: var(--surface); border-bottom: 1px solid var(--border); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
}
.topbar .search { max-width: 460px; flex: 1 1 320px; }
.topbar .search kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 11px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border); color: var(--muted); font-family: var(--font); }
.menu-btn { display: none; }
.bell-dot { position: absolute; top: 3px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--grad-pink); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; animation: pulse 2s infinite; }
.profile-btn { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.profile-btn:hover { border-color: var(--violet); }
.profile-btn span { font-weight: 600; font-size: 13px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 0; top: calc(100% + 10px); min-width: 230px; padding: 8px; border-radius: 18px; background: var(--surface-solid); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: rise .25s var(--spring); z-index: 70; }
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-head small { color: var(--muted); display: block; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; background: transparent; border-radius: 12px; font-weight: 600; color: var(--text); text-align: left; text-decoration: none !important; }
.menu a:hover, .menu button:hover { background: rgba(124, 58, 237, .1); }
.rel { position: relative; }

.page { padding: 28px; max-width: 1480px; width: 100%; margin: 0 auto; outline: none; animation: pageIn .5s var(--ease) backwards; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: clamp(26px, 3.2vw, 34px); font-weight: 800; }
.page-head p { margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; padding: 14px; margin-bottom: 16px; }
.toolbar .input { min-width: 140px; width: auto; flex: 0 1 170px; }
.toolbar .search .input { width: 100%; min-width: 0; }
.bottom-nav { display: none; }
.sidebar-backdrop { display: none; }

.breadcrumb { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.breadcrumb a { color: var(--muted); font-weight: 600; } .breadcrumb a:hover { color: var(--violet); }

/* ---- Login ------------------------------------------------------------------------------------------------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { position: relative; overflow: hidden; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(120deg, #4F46E5, #7C3AED, #EC4899, #7C3AED, #4F46E5); background-size: 300% 300%; animation: gradshift 14s ease infinite; }
.login-hero .blob { position: absolute; border-radius: 50%; filter: blur(50px); opacity: .55; animation: float 16s ease-in-out infinite; }
.login-hero .b1 { width: 340px; height: 340px; background: #06B6D4; left: -90px; bottom: -60px; }
.login-hero .b2 { width: 280px; height: 280px; background: #F59E0B; right: 8%; top: 10%; animation-delay: -6s; opacity: .4; }
.login-hero .b3 { width: 220px; height: 220px; background: #EC4899; right: -60px; bottom: 25%; animation-delay: -11s; }
.login-hero > * { position: relative; }
.login-hero h1 { font-size: clamp(34px, 4.6vw, 56px); font-weight: 800; line-height: 1.08; margin: 18px 0 14px; }
.login-hero .tag { font-size: 19px; opacity: .92; font-weight: 500; }
.hero-list { display: grid; gap: 12px; margin-top: 30px; }
.hero-list div { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); max-width: 430px; animation: rise .7s var(--ease) both; }
.hero-list div:nth-child(2) { animation-delay: .12s; } .hero-list div:nth-child(3) { animation-delay: .24s; }
.hero-ward { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .3); font-weight: 600; width: fit-content; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.login-pane { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(440px, 100%); padding: 34px; animation: rise .7s var(--ease) both .1s; }
.login-card h2 { font-size: 28px; margin-bottom: 4px; }
.login-card form { display: flex; flex-direction: column; gap: 18px; margin-top: 22px; }
.demo { margin-top: 24px; padding-top: 18px; border-top: 1px dashed var(--border-strong); }
.demo p { font-size: 12.5px; margin-bottom: 10px; }

/* ---- Dashboard ------------------------------------------------------------------------------------------------- */
.hero-card { position: relative; overflow: hidden; border-radius: 28px; padding: 30px 32px; color: #fff; background: linear-gradient(120deg, #4F46E5, #7C3AED 55%, #EC4899); background-size: 200% 200%; animation: gradshift 12s ease infinite, rise .6s var(--ease) both; box-shadow: var(--shadow-lg); margin-bottom: 22px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }
.hero-card::before, .hero-card::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .13); }
.hero-card::before { width: 260px; height: 260px; right: -60px; top: -110px; }
.hero-card::after { width: 160px; height: 160px; right: 20%; bottom: -90px; }
.hero-card > * { position: relative; z-index: 1; }
.hero-card h1 { font-size: clamp(24px, 3vw, 32px); font-weight: 800; }
.hero-card p { opacity: .9; margin-top: 6px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .btn { background: rgba(255, 255, 255, .18); color: #fff; border-color: rgba(255, 255, 255, .35); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.hero-actions .btn:hover { background: #fff; color: var(--violet); box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .35); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { position: relative; padding: 18px; display: flex; gap: 14px; align-items: center; text-decoration: none !important; color: var(--text); overflow: hidden; }
.stat:hover { text-decoration: none; }
.stat::after { content: ''; position: absolute; right: -24px; bottom: -34px; width: 90px; height: 90px; border-radius: 50%; background: var(--grad-primary); opacity: .07; transition: transform .5s var(--ease); }
.stat:hover::after { transform: scale(1.8); }
.stat .num, .stat .lbl { display: block; }
.stat .num { font-family: var(--font); font-size: 28px; font-weight: 800; line-height: 1.05; }
.stat .lbl { color: var(--muted); font-weight: 600; font-size: 13px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-radius: 12px; text-decoration: none !important; color: var(--text); transition: background .2s; width: 100%; border: 0; background: transparent; text-align: left; }
.list-item:hover { background: rgba(124, 58, 237, .07); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item b { display: block; font-weight: 600; font-family: var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item small { color: var(--muted); }
.event-date { width: 48px; text-align: center; border-radius: 14px; padding: 6px 0; background: var(--grad-primary); color: #fff; font-family: var(--font); line-height: 1.1; flex: none; }
.event-date b { font-size: 18px; display: block; } .event-date small { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; opacity: .9; color: #fff; }

/* ---- Charts ------------------------------------------------------------------------------------------------------- */
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center; }
.donut { position: relative; width: 168px; height: 168px; flex: none; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.donut-track { stroke: var(--surface-2); }
.donut .seg { stroke-dasharray: 0 100; stroke-dashoffset: var(--off); transition: stroke-dasharray 1.1s var(--ease) calc(var(--d) * 110ms), opacity .2s; }
.in .donut .seg { stroke-dasharray: var(--len) 100; }
.donut .seg:hover { opacity: .8; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-center strong { font-family: var(--font); font-size: 26px; font-weight: 800; line-height: 1; }
.donut-center span { font-size: 12px; color: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 150px; flex: 1; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend i { width: 10px; height: 10px; border-radius: 4px; flex: none; }
.legend span { flex: 1; color: var(--muted); font-weight: 500; }
.legend em { font-style: normal; color: var(--muted); font-size: 12px; width: 36px; text-align: right; }
.vbars { display: flex; align-items: flex-end; gap: 14px; height: 210px; padding-top: 6px; }
.vbar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; min-width: 0; }
.vbar-track { flex: 1; width: 100%; max-width: 62px; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 14px; overflow: hidden; }
.vbar-fill { width: 100%; height: 0; border-radius: 14px; background: linear-gradient(180deg, var(--a), var(--b)); transition: height 1s var(--ease) calc(var(--i) * 80ms); }
.in .vbar-fill { height: var(--h); }
.vbar-val { font-weight: 700; font-family: var(--font); font-size: 13px; }
.vbar-label { font-size: 12px; color: var(--muted); font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.hbars { display: grid; gap: 13px; }
.hbar-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; font-weight: 600; }
.hbar-top span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.hbar-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--a), var(--b)); transition: width 1.1s var(--ease) calc(var(--i) * 80ms); }
.in .hbar-fill { width: var(--w); }
.linechart svg { width: 100%; height: auto; overflow: visible; }
.line-path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.8s var(--ease); }
.in .line-path { stroke-dashoffset: 0; }
.line-area { opacity: 0; transition: opacity 1.2s ease .6s; } .in .line-area { opacity: 1; }
.line-dot { opacity: 0; transform: scale(.4); transform-box: fill-box; transform-origin: center; transition: opacity .4s ease calc(.9s + var(--i) * 120ms), transform .5s var(--spring) calc(.9s + var(--i) * 120ms); }
.in .line-dot { opacity: 1; transform: none; }
.grid-line { stroke: var(--border); stroke-dasharray: 4 6; } .axis { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.ring { position: relative; width: var(--size); height: var(--size); flex: none; }
.ring svg { width: 100%; height: 100%; }
.ring-fill { stroke-dasharray: 0 100; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dasharray 1.3s var(--ease) .15s; }
.in .ring-fill { stroke-dasharray: var(--len) 100; }
.ring-text { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font); font-weight: 800; font-size: calc(var(--size) * .22); }

/* ---- Dl, drawer profile -------------------------------------------------------------------------------------------- */
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin: 0; }
.dl > div { min-width: 0; } .dl .wide { grid-column: 1 / -1; }
.dl dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.dl dd { margin: 2px 0 0; font-weight: 500; word-break: break-word; }
.section { padding: 16px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border); margin-top: 14px; }
.section h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--violet); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
[data-theme="dark"] .section h4 { color: #C4B5FD; }
.profile-hero { display: flex; gap: 16px; align-items: center; padding: 18px; border-radius: 22px; background: var(--grad-primary); color: #fff; position: relative; overflow: hidden; margin-top: 4px; }
.profile-hero::after { content: ''; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.profile-hero h3 { font-size: 21px; } .profile-hero small { opacity: .88; display: block; }
.profile-hero .avatar { box-shadow: 0 0 0 4px rgba(255, 255, 255, .35); }
.profile-hero .badge { background: rgba(255, 255, 255, .22); color: #fff; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--violet); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.mini-list { display: grid; gap: 6px; }
.scheme-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface-solid); border-radius: 12px; border: 1px solid var(--border); }
.scheme-row .grow { flex: 1; min-width: 0; font-weight: 600; }

/* ---- Wizard --------------------------------------------------------------------------------------------------------------- */
.wizard { max-width: 920px; margin: 0 auto; }
.stepper { display: flex; padding: 22px 12px 8px; margin-bottom: 18px; }
.step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: none; font-size: 12px; font-weight: 700; color: var(--muted); flex: 1; padding: 0; min-width: 0; text-align: center; }
/* Connector between dots: grey track + gradient fill that grows when the step is reached. */
.step:not(:first-child)::before, .step:not(:first-child)::after { content: ''; position: absolute; top: 18px; right: 50%; width: 100%; height: 4px; border-radius: 4px; background: var(--surface-2); }
.step:not(:first-child)::after { background: var(--grad-primary); transform: scaleX(0); transform-origin: left; transition: transform .6s var(--ease); }
.step.done::after, .step.current::after { transform: scaleX(1); }
.step-dot { position: relative; z-index: 1; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-solid); border: 2px solid var(--border-strong); transition: all .35s var(--spring); }
.step.current .step-dot { background: var(--grad-primary); border-color: transparent; color: #fff; transform: scale(1.18); box-shadow: var(--glow); }
.step.done .step-dot { background: var(--grad-teal); border-color: transparent; color: #fff; }
.step.current { color: var(--violet); } .step.done { color: var(--emerald); }
.step:disabled { cursor: default; }
.wizard-panel { padding: 26px; min-height: 360px; }
.wizard-panel > section { animation: slideNext .45s var(--ease) both; }
.wizard-panel.back > section { animation-name: slideBack; }
@keyframes slideNext { from { opacity: 0; transform: translateX(34px); } to { opacity: 1; transform: none; } }
@keyframes slideBack { from { opacity: 0; transform: translateX(-34px); } to { opacity: 1; transform: none; } }
.wizard-panel h2 { font-size: 21px; margin-bottom: 4px; } .wizard-panel .sub { color: var(--muted); margin-bottom: 20px; }
.wizard-foot { display: flex; justify-content: space-between; gap: 12px; padding: 16px 26px; border-top: 1px solid var(--border); }
.age-pill { display: inline-block; margin-top: 2px; font-weight: 700; color: var(--violet); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.choice { position: relative; padding: 16px; border: 2px solid var(--border); border-radius: 18px; cursor: pointer; background: var(--surface-solid); transition: all .25s var(--ease); display: flex; gap: 12px; align-items: flex-start; }
.choice:hover { border-color: var(--violet); transform: translateY(-2px); }
.choice input { position: absolute; opacity: 0; }
.choice:has(input:checked) { border-color: var(--violet); background: rgba(124, 58, 237, .08); box-shadow: 0 10px 24px -12px rgba(124, 58, 237, .6); }
.choice:has(input:focus-visible) { box-shadow: var(--ring); }
.choice b { display: block; font-family: var(--font); } .choice small { color: var(--muted); }
.result-list { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--border); border-radius: 14px; max-height: 240px; overflow: auto; background: var(--surface-solid); }
.result-list li button { display: flex; width: 100%; align-items: center; gap: 12px; padding: 10px 12px; border: 0; background: none; text-align: left; border-bottom: 1px solid var(--border); }
.result-list li button:hover { background: rgba(124, 58, 237, .08); }
.result-list li:last-child button { border-bottom: 0; }
.picked { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(16, 185, 129, .1); border: 1px solid rgba(16, 185, 129, .35); margin-top: 8px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.check-card { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 14px; cursor: pointer; transition: all .2s; background: var(--surface-solid); }
.check-card:has(input:checked) { border-color: var(--emerald); background: rgba(16, 185, 129, .09); }
.check-card input { accent-color: var(--violet); width: 18px; height: 18px; }
.check-card.locked { opacity: .65; cursor: default; }
.review { display: grid; gap: 14px; }
.review .section { margin: 0; }
.review h4 button { margin-left: auto; font-size: 12px; text-transform: none; letter-spacing: 0; }
.success-card { text-align: center; padding: 56px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.success-check { width: 96px; height: 96px; border-radius: 50%; background: var(--grad-teal); display: grid; place-items: center; color: #fff; animation: pop .7s var(--spring) both; box-shadow: 0 20px 40px -12px rgba(16, 185, 129, .7); margin-bottom: 10px; }
.success-check svg { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .6s ease .35s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---- Families ---------------------------------------------------------------------------------------------------------------- */
.family-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; text-decoration: none !important; color: var(--text); position: relative; overflow: hidden; }
.family-card:hover { text-decoration: none; }
.family-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--grad-primary); }
.family-card .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.code-chip { font-family: var(--font); font-weight: 800; letter-spacing: .04em; color: var(--violet); background: rgba(124, 58, 237, .1); padding: 3px 10px; border-radius: 8px; font-size: 12.5px; }
[data-theme="dark"] .code-chip { color: #C4B5FD; }
.family-hero { position: relative; overflow: hidden; border-radius: 28px; padding: 28px; color: #fff; background: linear-gradient(125deg, #4F46E5, #7C3AED 55%, #EC4899); box-shadow: var(--shadow-lg); margin-bottom: 20px; }
.family-hero::before { content: ''; position: absolute; width: 280px; height: 280px; border-radius: 50%; background: rgba(255, 255, 255, .12); right: -70px; top: -120px; }
.family-hero > * { position: relative; }
.family-hero h1 { font-size: clamp(24px, 3vw, 32px); font-weight: 800; }
.family-hero .code-chip { background: rgba(255, 255, 255, .22); color: #fff; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .28); }
.pill.off { opacity: .55; text-decoration: line-through; }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.mini-stat { padding: 16px; display: flex; gap: 12px; align-items: center; }
.mini-stat b { font-family: var(--font); font-size: 22px; display: block; line-height: 1.1; }
.mini-stat div span { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.member-card { padding: 16px; display: flex; gap: 14px; align-items: center; position: relative; }
.member-card .grow { flex: 1; min-width: 0; }
.member-card b { display: block; font-family: var(--font); }
.member-card small { color: var(--muted); }
.crown { position: absolute; top: -9px; left: 14px; background: var(--grad-amber); color: #fff; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 6px 12px -4px rgba(245, 158, 11, .7); }
.member-actions { display: flex; flex-direction: column; gap: 2px; }
.tree-wrap { overflow-x: auto; padding: 10px 4px 4px; }
.tree { position: relative; margin: 0 auto; }
.tree svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.tree-link { fill: none; stroke: var(--violet); opacity: .55; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.2s var(--ease); }
.in .tree-link { stroke-dashoffset: 0; }
.tree-node { position: absolute; width: 124px; height: 108px; cursor: pointer; color: inherit; font-family: inherit; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 8px 6px; border-radius: 18px; background: var(--surface-solid); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 12.5px; animation: pop .6s var(--spring) backwards; animation-delay: calc(var(--i, 0) * 70ms); }
.tree-node b { font-family: var(--font); line-height: 1.2; max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-node small { color: var(--muted); }
.tree-node:hover { transform: translateY(-3px); border-color: var(--violet); }
.tree-node.head { border-color: var(--amber); box-shadow: 0 10px 26px -10px rgba(245, 158, 11, .7); }
.timeline { position: relative; display: grid; gap: 14px; padding-left: 8px; }
.timeline::before { content: ''; position: absolute; left: 25px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--violet), var(--pink)); opacity: .35; }
.tl-item { position: relative; display: flex; gap: 14px; align-items: flex-start; }
.tl-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; font-size: 16px; z-index: 1; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .4); }
.tl-body { flex: 1; padding: 10px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.tl-body b { font-family: var(--font); }
.tabs { display: flex; gap: 6px; padding: 4px; background: var(--surface-2); border-radius: 14px; margin-bottom: 16px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 10px; font-weight: 600; color: var(--muted); transition: all .2s; }
.tabs button.active { background: var(--surface-solid); color: var(--violet); box-shadow: 0 4px 10px -4px rgba(79, 70, 229, .4); }

/* ---- Complaints board ----------------------------------------------------------------------------------------------------------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(235px, 1fr); gap: 16px; overflow-x: auto; padding-bottom: 14px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--border); border-radius: 22px; padding: 12px; min-height: 280px; transition: background .2s, box-shadow .2s; }
.col.drop { background: rgba(124, 58, 237, .14); box-shadow: inset 0 0 0 2px var(--violet); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 12px; font-weight: 700; font-family: var(--font); }
.col-head i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent); }
.col-head .count { margin-left: auto; background: var(--surface-solid); border-radius: 999px; padding: 1px 10px; font-size: 12.5px; color: var(--muted); }
.k-card { background: var(--surface-solid); border: 1px solid var(--border); border-left: 4px solid var(--c, var(--violet)); border-radius: 16px; padding: 13px; margin-bottom: 10px; cursor: grab; box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s; display: block; width: 100%; text-align: left; }
.k-card:hover { transform: translateY(-3px) rotate(-.4deg); box-shadow: var(--shadow-lg); }
.k-card.dragging { opacity: .45; transform: rotate(2deg) scale(.97); }
.k-card h4 { font-size: 14px; margin: 6px 0 4px; font-weight: 700; }
.k-card .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.k-card .top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.prio-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.status-steps button { flex: 1; min-width: 92px; padding: 9px 8px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface-solid); font-weight: 600; font-size: 12.5px; color: var(--muted); transition: all .25s var(--spring); }
.status-steps button.past { border-color: var(--emerald); color: #047857; background: rgba(16, 185, 129, .08); }
.status-steps button.active { background: var(--grad-primary); color: #fff; border-color: transparent; transform: scale(1.04); box-shadow: var(--glow); }

/* ---- Content cards ---------------------------------------------------------------------------------------------------------------------- */
.content-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; }
.content-card .actions { display: flex; gap: 2px; margin-left: auto; }
.content-card h3 { font-size: 17px; }
.content-card p { color: var(--muted); }
.accent-bar { position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--grad-primary); }
.progress { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--grad-teal); transition: width 1.1s var(--ease); }
.in .progress i { width: var(--w); }
.progress.warn i { background: var(--grad-amber); }
.banner-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.banner-card { overflow: hidden; padding: 0; }
.banner-card.off .banner-thumb { filter: grayscale(.8); opacity: .65; }
.banner-thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--border); }
.banner-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-text { position: absolute; inset: auto 0 0 0; padding: 28px 16px 12px; color: #fff; display: grid; gap: 2px; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); }
.banner-text b { font-size: 17px; } .banner-text span { font-size: 13px; opacity: .9; }
.banner-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; }
.notice-list { display: grid; gap: 14px; }
.notice { display: flex; gap: 16px; padding: 18px; position: relative; }
.notice.pinned { border-color: rgba(245, 158, 11, .5); box-shadow: 0 14px 34px -16px rgba(245, 158, 11, .6); }
.notice-ic { width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; font-size: 24px; flex: none; color: #fff; }
.notice h3 { font-size: 17px; } .notice p { color: var(--muted); margin-top: 4px; }
.setting-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 18px; align-items: start; }
.log { list-style: none; margin: 0; padding: 0; max-height: 440px; overflow: auto; display: grid; gap: 4px; }
.log li { display: flex; gap: 12px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--border); font-size: 13px; }
.log li > span:first-child { width: 8px; height: 8px; border-radius: 50%; background: var(--grad-primary); flex: none; }
.table-note { font-size: 12px; color: var(--muted); padding: 6px 18px 0; }

/* ---- Print: family card -------------------------------------------------------------------------------------------------------------------- */
#print-root { display: none; }
.pcard { font-family: var(--font-body); color: #1E1B3A; max-width: 760px; margin: 0 auto; border: 2px solid #4F46E5; border-radius: 18px; overflow: hidden; }
.pcard-head { padding: 18px 24px; color: #fff; background: linear-gradient(120deg, #4F46E5, #7C3AED, #EC4899); display: flex; justify-content: space-between; align-items: center; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pcard-head h1 { font-size: 22px; margin: 0; } .pcard-head p { margin: 2px 0 0; font-size: 12px; opacity: .9; }
.pcard-body { padding: 18px 24px; }
.pcard table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.pcard th, .pcard td { border: 1px solid #D9D5F5; padding: 7px 10px; text-align: left; }
.pcard th { background: #F0EDFF; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pcard .kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 16px; font-size: 13px; }
.pcard .kv small { color: #6B6890; display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.pcard-foot { padding: 12px 24px; font-size: 11.5px; color: #6B6890; border-top: 1px dashed #B9B3E8; display: flex; justify-content: space-between; }
@media print {
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  body { background: #fff !important; }
  @page { margin: 14mm; }
}

/* ---- Responsive ---------------------------------------------------------------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 32px 28px; min-height: 360px; }
  .hero-list { display: none; }
}
@media (max-width: 900px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); --sb: 280px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-102%); transition: transform .4s var(--ease); background: var(--surface-solid); box-shadow: var(--shadow-lg); z-index: 150; }
  .shell.nav-open .sidebar { transform: none; }
  .shell.collapsed .brand-text, .shell.collapsed .nav-label, .shell.collapsed .nav-sep, .shell.collapsed .sb-ward { display: revert; }
  .shell.collapsed .nav-link { justify-content: flex-start; padding: 0 14px; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 140; background: rgba(15, 11, 31, .5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .shell.nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-grid; }
  .collapse-btn { display: none; }
  .topbar { padding: 0 14px; }
  .page { padding: 18px 14px calc(96px + env(safe-area-inset-bottom)); }
  .bottom-nav { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 55; padding: 6px; border-radius: 22px; justify-content: space-around; background: var(--surface-solid); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
  .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 16px; font-size: 11px; font-weight: 700; color: var(--muted); text-decoration: none !important; border: 0; background: transparent; }
  .bottom-nav .active { color: #fff; background: var(--grad-primary); box-shadow: var(--glow); }
  .toasts { top: auto; bottom: calc(92px + env(safe-area-inset-bottom)); right: 50%; transform: translateX(50%); }
  .profile-btn span, .topbar .search kbd { display: none; }
  .drawer { border-radius: 24px 24px 0 0; width: 100% !important; height: 94%; align-self: flex-end; transform: translateY(100%); }
  .overlay.open .drawer { transform: none; }
  .overlay.closing .drawer { transform: translateY(100%); }
  .overlay-drawer { align-items: flex-end; }
  .overlay { padding: 12px; }
  .overlay-drawer, .overlay-modal { padding-bottom: 0; }
  .modal { border-radius: 24px; max-height: 94%; }
}
@media (max-width: 760px) {
  .toolbar .input { flex: 1 1 140px; }
  .form-grid.cols-2, .form-grid.cols-3, .dl { grid-template-columns: 1fr; }
  .table-wrap { overflow: visible; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tbody tr { margin: 0 0 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface-solid); box-shadow: var(--shadow); }
  .table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border: 0; text-align: right; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; text-align: left; flex: none; }
  .table td[data-label=""]::before, .table td:not([data-label])::before { content: none; }
  .table td.cell-main { display: block; text-align: left; border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 4px; }
  .cell-person { min-width: 0; }
  .login-pane { padding: 18px; }
  .login-card { padding: 24px; }
  .stepper { padding: 18px 8px 10px; }
  .step span.lbl { display: none; }
  .wizard-panel { padding: 18px; }
  .page-head { align-items: flex-start; }
  .hero-card { padding: 22px; }
  .vbars { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important; }
}
