@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&family=Playfair+Display:wght@500;600;700&display=swap');

/* ============ Fothi — midnight navy & gold ============ */
:root {
  color-scheme: dark;
  --bg: #071226; --bg2: #0a1a33;
  --card: #102340; --card2: #152b4c; --well: #0b1c35;
  --line: #22395a; --line2: #33507a;
  --ink: #f3f5fb; --ink2: #c9d5e8; --muted: #8fa3c1; --faint: #6c84a6;
  --gold: #e9cc93; --gold2: #d2a965; --gold-ink: #0b1a31;
  --blue: #8bb6ff; --green: #86dfbd; --amber: #ffd58a; --red: #ff9ea8; --rose: #f2bcae;
  --r-lg: 20px; --r-md: 14px; --r-sm: 10px;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --ease: cubic-bezier(.2, .9, .25, 1);
  --tabbar-h: 64px;
  font-family: var(--sans);
  background: var(--bg); color: var(--ink);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html.locked, html.locked body { overflow: hidden; }
body {
  margin: 0; min-height: 100dvh; color: var(--ink);
  background: radial-gradient(120% 60% at 85% -10%, #17365e 0%, #0b1b34 40%, var(--bg) 75%) fixed, var(--bg);
  font-size: 15px; line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: not-allowed; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.ico { width: 20px; height: 20px; flex-shrink: 0; }
.muted { color: var(--muted); font-size: 14px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; color: var(--gold); opacity: .85; }
.pos { color: var(--green) !important; } .neg { color: var(--red) !important; } .amber { color: var(--amber) !important; } .gold { color: var(--gold); }
.hidden { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 13px; border: 1px solid transparent;
  background: linear-gradient(120deg, var(--gold), var(--gold2)); color: var(--gold-ink);
  font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap;
  box-shadow: 0 6px 20px #d2a96522; transition: transform .15s var(--ease), filter .15s;
}
.btn .ico { width: 18px; height: 18px; }
.btn:active:not(:disabled) { transform: scale(.97); }
@media (hover: hover) { .btn:hover:not(:disabled) { filter: brightness(1.07); } }
.btn.secondary { background: var(--card2); color: var(--ink); border-color: var(--line2); box-shadow: none; }
.btn.danger { background: #3c2437; color: #ffc0c8; border-color: #5b3450; box-shadow: none; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.small .ico { width: 16px; height: 16px; }
.btn.grow { flex: 1; width: 100%; }
.btn.big { min-height: 54px; font-size: 16px; }
.btn.icon-only { width: 48px; padding: 0; flex-shrink: 0; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink2);
  transition: transform .15s var(--ease), background .15s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn.on { color: var(--gold); border-color: #5d5235; }
.icon-btn.gold { color: var(--gold); }
.icon-btn.spin .ico { animation: spin .8s linear infinite; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 6px 2px; color: var(--blue); font-weight: 600; font-size: 14px; }
.link-btn .ico { width: 16px; height: 16px; }
.link-btn.more { margin-top: 6px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- shell ---------- */
.app-shell { display: flex; min-height: 100dvh; }
.sidebar {
  width: 248px; flex-shrink: 0; position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; padding: 28px 14px 20px;
  background: linear-gradient(175deg, #07142c, #0a182f 70%, #0c1c33); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 30px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 46px; border-radius: 13px;
  background: linear-gradient(145deg, #233d61, #0c2448); border: 1px solid #577195;
  color: var(--gold); font: 600 27px var(--serif); box-shadow: 0 10px 30px #0004;
}
.brand-mark.sm { width: 34px; height: 36px; font-size: 21px; border-radius: 10px; }
.brand-mark-dot { color: var(--blue); }
.brand-name { font: 600 28px var(--serif); color: #f7f0df; line-height: 1.05; }
.brand-sub { font-size: 9px; font-weight: 700; letter-spacing: 1.8px; color: var(--muted); margin-top: 5px; }
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 13px; border-radius: 12px;
  background: none; border: 1px solid transparent; color: #a3b4cf; font-weight: 600; font-size: 14px; text-align: left;
  transition: background .15s, color .15s;
}
.nav-btn:hover { background: #142b4a; color: #fff; }
.nav-btn.active { background: linear-gradient(100deg, #223c61, #172b4b); color: #f9e2aa; border-color: #35527a; box-shadow: inset 3px 0 0 var(--gold); }
.side-bottom { margin-top: auto; border-top: 1px solid var(--line); padding: 16px 8px 0; font-size: 12.5px; color: var(--muted); display: grid; gap: 8px; }
.sync-note { display: flex; align-items: center; gap: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px #86dfbd22; flex-shrink: 0; }
.side-bottom .link-btn { color: var(--muted); font-size: 13px; }

.main { flex: 1; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 0 36px; height: 68px; background: #08172fcc; backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border-bottom: 1px solid #1d3352;
}
.top-brand { display: flex; align-items: center; gap: 10px; }
.top-brand .brand-mark { display: none; }
.top-title { font-weight: 700; font-size: 13px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
.top-actions { display: flex; gap: 8px; }
.content { padding: 32px 36px 60px; max-width: 1240px; margin: 0 auto; }
.page-in { animation: page-in .35s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-heading h1 { font: 600 clamp(30px, 3vw, 40px)/1.12 var(--serif); letter-spacing: -.4px; color: #f8f3e8; margin: 4px 0 6px; }

.tabbar, .fab { display: none; }

/* ---------- banner, panels ---------- */
.banner {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; margin-bottom: 18px;
  border-radius: var(--r-md); background: #2a2a33; border: 1px solid #6d5c3f; color: #ecd6aa; font-size: 13px;
}
.banner .ico { width: 18px; height: 18px; }
.banner span { flex: 1; }
.banner-x { background: none; border: 0; color: inherit; display: grid; place-items: center; width: 32px; height: 32px; opacity: .7; }
.panel {
  background: linear-gradient(150deg, #132946, #0e203b); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 20px; margin-bottom: 16px;
}
.panel h2 { font: 600 19px var(--serif); color: #f6f1e7; }
.panel > h2 { margin-bottom: 10px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.count { min-width: 26px; height: 22px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 99px; background: #233c5f; color: var(--ink2); font-size: 12px; font-weight: 700; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.detail-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #1f3554; font-size: 14px; color: var(--ink2); }
.detail-row:last-child { border-bottom: 0; }
.detail-row strong { color: var(--ink); font-variant-numeric: tabular-nums; text-align: right; display: inline-flex; align-items: center; gap: 6px; }

/* ---------- dashboard ---------- */
.dash { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.hero {
  display: flex; align-items: center; gap: 22px; padding: 22px; margin-bottom: 14px; border-radius: 24px;
  background: radial-gradient(120% 120% at 0% 0%, #1d3b63 0%, #112644 45%, #0d1f3a 100%);
  border: 1px solid #34527a; box-shadow: 0 20px 50px #02091640; position: relative; overflow: hidden;
}
.hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, #e9cc9318, transparent 70%); pointer-events: none; }
.ring { position: relative; width: 132px; height: 132px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; }
.ring-bg { stroke: #233b5e; }
.ring-fg { stroke: var(--gold); stroke-linecap: round; animation: ring-in 1s var(--ease); }
@keyframes ring-in { from { stroke-dashoffset: var(--c); } }
.ring-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-c b { font: 600 30px var(--serif); color: #fbf3e2; line-height: 1; }
.ring-c small { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.hero-figs { flex: 1; min-width: 0; position: relative; z-index: 1; }
.hero-big { font: 600 clamp(26px, 3vw, 34px)/1.1 var(--serif); color: #fbf3e2; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.hero-split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.hero-split button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  padding: 10px 12px; border-radius: 12px; background: #0b1d38aa; border: 1px solid #2c4870;
  transition: transform .15s var(--ease);
}
.hero-split button:active { transform: scale(.97); }
.hero-split span { font-size: 12px; color: var(--muted); }
.hero-split strong { font-size: 15px; font-variant-numeric: tabular-nums; }

.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px 12px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--card);
  font-size: 12.5px; font-weight: 600; color: var(--ink2); text-align: center; line-height: 1.2;
  transition: transform .15s var(--ease), border-color .15s, background .15s;
}
.quick-btn:active { transform: scale(.95); background: var(--card2); }
@media (hover: hover) { .quick-btn:hover { border-color: var(--line2); background: var(--card2); } }
.quick-ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: linear-gradient(145deg, #2a4469, #1a304f); border: 1px solid #3d5a82; color: var(--gold); flex-shrink: 0; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile {
  display: flex; flex-direction: column; gap: 4px; padding: 14px; text-align: left; min-width: 0;
  border-radius: 16px; border: 1px solid var(--line); background: var(--card); transition: transform .15s var(--ease), border-color .15s;
}
button.tile:active { transform: scale(.97); }
@media (hover: hover) { button.tile:hover { border-color: var(--line2); } }
.tile-l { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile-v { font: 600 22px var(--serif); color: #f8f3e8; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile-b { font-size: 11.5px; color: var(--faint); }

.all-good { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 12px; background: #11332f66; color: var(--green); font-size: 14px; font-weight: 600; }

.setup .steps { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.setup li { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--well); border: 1px solid var(--line); }
.setup li div { flex: 1; display: grid; }
.setup li small { color: var(--muted); font-size: 12.5px; }
.setup li.done { opacity: .6; }
.setup li.done .btn { display: none; }
.step-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #233c5f; color: var(--gold); font-weight: 700; flex-shrink: 0; }
.setup li.done .step-n { background: #18433c; color: var(--green); }
.step-n .ico { width: 16px; }

.stock { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 4px; border: 0; background: none; text-align: left; border-radius: 10px; }
.stock:active { background: #ffffff08; }
.stock-main { flex: 1; min-width: 0; display: grid; gap: 7px; }
.stock-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.stock-top span { color: var(--muted); font-size: 13px; white-space: nowrap; }

.fam-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fam { display: grid; gap: 6px; text-align: left; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--well); transition: transform .15s var(--ease); }
.fam:active { transform: scale(.97); }
.fam.bride { border-color: #5a3e55; background: linear-gradient(150deg, #2a2236, #131d36); }
.fam.groom { border-color: #2f5283; background: linear-gradient(150deg, #173257, #0f1f3b); }
.fam-name { font-weight: 700; font-size: 14px; }
.fam-sub { font-size: 12px; color: var(--muted); }
.fam-due { font-size: 13px; font-weight: 600; color: var(--ink2); }

/* ---------- meters, pills, avatars, swatches ---------- */
.meter { display: block; height: 8px; border-radius: 99px; background: #213758; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6c9cf0, var(--gold)); transform-origin: left; animation: grow .8s var(--ease); }
.meter.thin { height: 4px; margin-top: 4px; }
.meter.stockbar i { background: linear-gradient(90deg, #8a7ae0, #8bb6ff); }
@keyframes grow { from { transform: scaleX(0); } }
.pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.pill.green { background: #133f3a; color: var(--green); }
.pill.amber { background: #4a3920; color: var(--amber); }
.pill.red { background: #4a2a3b; color: var(--red); }
.pill.blue { background: #1f3c63; color: #a9c8ff; }
.pill.rose { background: #432c3e; color: var(--rose); }
.pill.gray { background: #263955; color: #b7c6dd; }
.av { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-weight: 700; font-size: 14px; letter-spacing: .3px; }
.av.bride { background: linear-gradient(145deg, #4b3249, #33233a); color: var(--rose); border: 1px solid #6d4a63; }
.av.groom { background: linear-gradient(145deg, #23477a, #183257); color: #b3cfff; border: 1px solid #3a619a; }
.av.lg { width: 64px; height: 64px; font-size: 22px; }
.sw {
  width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0; background-color: var(--c);
  background-image: linear-gradient(135deg, #ffffff40, transparent 45%, #00000026), repeating-linear-gradient(45deg, #ffffff0a 0 2px, transparent 2px 5px);
  box-shadow: inset 0 0 0 1px #ffffff26, 0 4px 12px #0004;
}
.sw.sm { width: 34px; height: 34px; border-radius: 10px; }
.sw.xs { width: 16px; height: 16px; border-radius: 5px; display: inline-block; vertical-align: -3px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 0; box-shadow: inset 0 0 0 1px #ffffff30; }

/* ---------- toolbar: search & chips ---------- */
.toolbar { display: grid; gap: 10px; margin-bottom: 16px; }
.searchbox {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 6px 0 14px;
  border-radius: 14px; border: 1px solid var(--line2); background: var(--well); color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.searchbox:focus-within { border-color: #7ea6ea; box-shadow: 0 0 0 3px #6c9cf026; }
.searchbox input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font-size: 16px; color: var(--ink); -webkit-appearance: none; appearance: none; }
.searchbox input::placeholder { color: var(--faint); }
.searchbox input::-webkit-search-cancel-button { display: none; }
.searchbox .clear { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #22385a; color: var(--ink2); }
.searchbox .clear .ico { width: 16px; height: 16px; }
.chips-row { display: flex; gap: 8px; align-items: center; overflow-x: auto; scrollbar-width: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 2px; }
.chips::-webkit-scrollbar, .chips-row::-webkit-scrollbar { display: none; }
.chips-row .chips { flex: 1 1 auto; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; height: 36px; padding: 0 14px;
  border-radius: 99px; border: 1px solid var(--line2); background: var(--card); color: var(--ink2);
  font-size: 13.5px; font-weight: 600; white-space: nowrap; transition: background .15s, color .15s, transform .12s;
}
.chip:active { transform: scale(.95); }
.chip.on { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.chip-n { font-size: 11.5px; font-weight: 700; opacity: .65; }
.chip.sort { flex-shrink: 0; color: var(--blue); }
.chip.sort .ico { width: 15px; height: 15px; }

/* ---------- list rows ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.list.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.list-sum { display: flex; justify-content: space-between; gap: 10px; padding: 0 4px 10px; font-size: 13px; color: var(--muted); }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 66px; text-align: left;
  padding: 11px 12px 11px 13px; border-radius: 16px; border: 1px solid var(--line); background: var(--card);
  transition: transform .14s var(--ease), background .14s, border-color .14s;
}
.row:active { transform: scale(.985); background: var(--card2); }
@media (hover: hover) { .row:hover { border-color: var(--line2); background: var(--card2); } }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-title { font-weight: 600; font-size: 15.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-pills { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 3px; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; max-width: 45%; }
.amt { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.chev { width: 16px; height: 16px; color: var(--faint); margin-left: -4px; }
.pay-ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: #15393a; color: var(--green); flex-shrink: 0; }
.list.flat { gap: 0; }
.list.flat .row { border: 0; background: none; border-radius: 12px; padding: 9px 4px; min-height: 58px; }
.list.flat > * + * { border-top: 1px solid #1f3554; }
.row-wrap { display: flex; align-items: center; gap: 6px; }
.row-wrap .row { flex: 1; min-width: 0; }
.group { margin-bottom: 18px; }
.group-h { display: flex; justify-content: space-between; padding: 0 4px 8px; font-size: 12.5px; font-weight: 700; letter-spacing: .4px; color: var(--muted); text-transform: uppercase; }

.empty { text-align: center; padding: 44px 20px; border-radius: var(--r-lg); border: 1px dashed var(--line2); background: #0c1d3780; display: grid; justify-items: center; gap: 8px; }
.empty-art { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: #1b3253; color: var(--gold); margin-bottom: 4px; }
.empty strong { font: 600 19px var(--serif); }
.empty p { color: var(--muted); font-size: 14px; max-width: 300px; margin-bottom: 8px; }

.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.export-grid .btn { font-size: 14px; }
.file-btn { cursor: pointer; }

/* ---------- sheets ---------- */
.sheet-layer { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.sheet-backdrop { position: absolute; inset: 0; background: #010712b8; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheet-layer.enter .sheet-backdrop { animation: fade .25s ease; }
.sheet-layer.leaving .sheet-backdrop { animation: fade .22s ease reverse forwards; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: relative; width: min(560px, 100%); max-height: min(88dvh, 860px); display: flex; flex-direction: column;
  background: linear-gradient(180deg, #13284a, #0f2140); border: 1px solid #3a5980; border-radius: 24px;
  box-shadow: 0 30px 100px #000a; transition: transform .25s var(--ease);
}
.sheet-layer.enter .sheet { animation: pop .3s var(--ease); }
.sheet-layer.leaving .sheet { animation: pop-out .2s ease forwards; }
.sheet.swap-in { animation: swap-in .28s var(--ease); }
.sheet.swap-back { animation: swap-back .28s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes pop-out { to { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes swap-in { from { opacity: .3; transform: translateX(36px); } }
@keyframes swap-back { from { opacity: .3; transform: translateX(-36px); } }
.sheet-grab { display: none; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid #22395a; }
.sheet-titles { flex: 1; min-width: 0; }
.sheet-titles h2 { font: 600 22px/1.2 var(--serif); color: #f8f2e6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-titles p { font-size: 13px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-head .icon-btn { width: 38px; height: 38px; border-radius: 50%; background: #1e3557; border-color: transparent; }
#sheet-form { display: contents; }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 18px; display: grid; gap: 14px; align-content: start; }
.sheet-foot { display: flex; gap: 10px; padding: 14px 18px 18px; border-top: 1px solid #22395a; background: #0f2140; border-radius: 0 0 24px 24px; }

.menu-list { display: grid; gap: 8px; }
.menu-item { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); text-align: left; transition: transform .14s var(--ease); }
.menu-item:active { transform: scale(.98); background: var(--card2); }
.menu-item > span:nth-child(2) { flex: 1; display: grid; gap: 2px; }
.menu-item small { color: var(--muted); font-size: 13px; }

.profile { display: flex; align-items: center; gap: 14px; }
.profile-info { display: grid; gap: 6px; justify-items: start; }
.contact { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.contact .btn { font-size: 14px; }
.sboxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sbox { padding: 11px 12px; border-radius: 14px; background: var(--well); border: 1px solid var(--line); display: grid; gap: 2px; min-width: 0; }
.sbox span { font-size: 12px; color: var(--muted); }
.sbox b { font-size: 15.5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.sec-h h3 { font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.note { white-space: pre-wrap; padding: 12px 14px; border-radius: 12px; background: var(--well); color: var(--ink2); font-size: 14px; }
.details { padding: 2px 14px; border-radius: 14px; background: var(--well); border: 1px solid var(--line); }
.fabric-strip { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); text-align: left; width: 100%; }
.progress-card { padding: 14px; border-radius: 16px; background: var(--well); border: 1px solid var(--line); display: grid; gap: 8px; }
.pc-top { display: flex; align-items: center; justify-content: space-between; }
.pc-top > span:first-child { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink2); }
.pc-top .ico { width: 18px; height: 18px; color: var(--gold); }
.pc-fig { display: flex; align-items: baseline; gap: 8px; }
.pc-fig b { font: 600 24px var(--serif); font-variant-numeric: tabular-nums; }
.pc-fig span { color: var(--muted); font-size: 14px; }
.pc-act { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; font-size: 13.5px; font-weight: 600; }
.fabric-hero { height: 110px; border-radius: 18px; background-color: var(--c); background-image: linear-gradient(135deg, #ffffff45, transparent 40%, #00000030), repeating-linear-gradient(45deg, #ffffff0d 0 2px, transparent 2px 6px); box-shadow: inset 0 0 0 1px #ffffff26; display: flex; align-items: flex-end; padding: 12px 14px; }
.fabric-hero span { background: #071226b3; padding: 4px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; backdrop-filter: blur(4px); }
.fabric-hero span:empty { display: none; }

/* ---------- forms ---------- */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 12px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label, .field .label { font-size: 13px; font-weight: 600; color: var(--ink2); }
.field input, .field select, .field textarea, .auth-card input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 13px; border: 1px solid var(--line2);
  background: var(--well); color: var(--ink); font-size: 16px; outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 64px; line-height: 1.4; }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field select:focus, .field textarea:focus, .auth-card input:focus { border-color: #7ea6ea; box-shadow: 0 0 0 3px #6c9cf026; }
.field input[type=date] { display: block; }
.field.invalid input, .field.invalid select, .field.invalid .fab-pick { border-color: var(--red) !important; box-shadow: 0 0 0 3px #ff9ea822; }
.select-wrap { position: relative; }
.select-wrap::after { content: ''; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.select-wrap select { padding-right: 38px; text-overflow: ellipsis; }
.big-input { font: 600 26px var(--serif) !important; min-height: 60px !important; font-variant-numeric: tabular-nums; }
.hint { color: var(--faint); font-size: 12px; line-height: 1.4; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--well); border: 1px solid var(--line2); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 10px 6px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; transition: background .18s, color .18s; }
.seg input:checked + span { background: linear-gradient(120deg, var(--gold), var(--gold2)); color: var(--gold-ink); box-shadow: 0 3px 10px #0003; }
.seg input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.stepper { display: grid; grid-template-columns: 48px 1fr 48px; gap: 6px; }
.stepper input { text-align: center; font-weight: 700; font-size: 18px !important; }
.stepper button { border-radius: 13px; border: 1px solid var(--line2); background: var(--card2); font-size: 22px; color: var(--gold); }
.stepper button:active { transform: scale(.93); }
.mini-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.mini { height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line2); background: transparent; color: var(--ink2); font-size: 13px; font-weight: 600; }
.mini:active { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.fab-pick { display: grid; gap: 8px; border-radius: 14px; }
.fab-opt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line2); background: var(--well); cursor: pointer; transition: border-color .15s, background .15s; }
.fab-opt input { position: absolute; opacity: 0; pointer-events: none; }
.fab-opt .tick { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line2); display: grid; place-items: center; color: transparent; flex-shrink: 0; }
.fab-opt .tick .ico { width: 14px; height: 14px; }
.fab-opt:has(input:checked) { border-color: var(--gold); background: #2a2a2f; background: linear-gradient(150deg, #2b2f3a, #17233a); }
.fab-opt:has(input:checked) .tick { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.fab-opt:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.fab-opt.out { opacity: .5; }
.swatch-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sw-pick, .sw-custom { width: 36px; height: 36px; border-radius: 11px; border: 2px solid transparent; background: var(--c); box-shadow: inset 0 0 0 1px #ffffff30; padding: 0; transition: transform .12s; }
.sw-pick.on { border-color: var(--gold); transform: scale(1.08); box-shadow: 0 0 0 2px var(--bg), inset 0 0 0 1px #ffffff30; }
.sw-custom { position: relative; overflow: hidden; cursor: pointer; background: conic-gradient(from 0deg, #f88, #fd8, #8f8, #8df, #a8f, #f8c, #f88); display: grid; place-items: center; }
.sw-custom::after { content: ''; width: 18px; height: 18px; border-radius: 6px; background: var(--c); box-shadow: 0 0 0 2px #0b1c35; }
.sw-custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; min-height: 0; padding: 0; border: 0; }
.calc { padding: 12px 14px; border-radius: 14px; border: 1px dashed #3d5a82; background: #0b1c3599; display: grid; gap: 6px; font-size: 14px; }
.calc:empty { display: none; }
.calc > div { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); }
.calc > div > span:last-child { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.calc.warn { border-color: #8a6a35; }
.calc-warn { color: var(--amber) !important; align-items: center; justify-content: flex-start !important; gap: 6px !important; font-weight: 600; }
.calc-warn .ico { width: 16px; height: 16px; }
.form-error, .alert { display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border-radius: 12px; font-size: 14px; line-height: 1.4; }
.form-error { background: #46263a; color: #ffc6cd; border: 1px solid #6c3850; }
.form-error[hidden] { display: none; }
.alert { background: #3f3522; color: #f5d9a3; border: 1px solid #6d5a37; }
.form-error .ico, .alert .ico { width: 18px; height: 18px; margin-top: 1px; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 90; right: 24px; bottom: 24px; display: grid; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 8px 8px 14px; max-width: 420px;
  border-radius: 14px; background: #f3e3bf; color: #13213a; font-size: 14px; font-weight: 600;
  box-shadow: 0 14px 40px #0008; animation: toast-in .3s var(--ease);
}
.toast > span { flex: 1; padding-right: 6px; }
.toast .ico { width: 18px; height: 18px; color: #2c7a5a; }
.toast.error { background: #ffd9dd; color: #4a1422; }
.toast.error .ico { color: #b63a52; }
.toast.out { animation: toast-out .25s ease forwards; }
.toast-action { border: 0; background: #13213a; color: var(--gold); font-weight: 700; padding: 0 14px; height: 34px; border-radius: 10px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

/* ---------- login / splash ---------- */
.splash { min-height: 100dvh; display: grid; place-items: center; align-content: center; gap: 22px; color: var(--gold); }
.auth-page { min-height: 100dvh; display: grid; place-items: center; padding: max(20px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom)); background: radial-gradient(ellipse at 72% 12%, #1b416e 0%, #091a33 48%, #051024 100%); }
.auth-card { width: 100%; max-width: 410px; padding: 36px 28px; border-radius: 26px; background: linear-gradient(145deg, #162e4c, #0c1e39); border: 1px solid #3a577b; box-shadow: 0 40px 100px #0008; animation: pop .4s var(--ease); }
.auth-card .brand { padding: 0 0 28px; }
.auth-card h1 { font: 600 32px var(--serif); margin-bottom: 6px; }
.auth-card form { display: grid; gap: 14px; margin-top: 24px; }
.pw { position: relative; }
.pw input { padding-right: 70px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--blue); font-weight: 600; font-size: 14px; padding: 8px 10px; }
.login-note { font-size: 13px; color: var(--muted); margin-top: 20px; text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
  .content { padding: 26px 24px 60px; }
  .topbar { padding: 0 24px; }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .sidebar, .desk-only { display: none !important; }
  .app-shell { display: block; }
  .topbar { height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); background: #071226d9; }
  .top-brand .brand-mark { display: inline-flex; }
  .top-title { font-size: 12px; }
  .icon-btn { width: 40px; height: 40px; }
  .content { padding: 18px max(16px, env(safe-area-inset-right)) calc(var(--tabbar-h) + 96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .page-heading { margin-bottom: 16px; }
  .page-heading h1 { font-size: 31px; }

  .tabbar {
    display: flex; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    background: #081730e6; backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-top: 1px solid #1f3656;
  }
  .tabbar button {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 4px;
    border: 0; background: none; color: #7f94b4; font-size: 10.5px; font-weight: 600; position: relative; transition: color .15s;
  }
  .tabbar .ico { width: 24px; height: 24px; transition: transform .2s var(--ease); }
  .tabbar button.active { color: var(--gold); }
  .tabbar button.active .ico { transform: translateY(-1px) scale(1.06); }
  .tabbar button.active::before { content: ''; position: absolute; top: -6px; width: 22px; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }
  .tabbar button:active .ico { transform: scale(.88); }
  .fab {
    display: grid; place-items: center; position: fixed; z-index: 31; right: max(18px, env(safe-area-inset-right));
    bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 20px; border: 0;
    background: linear-gradient(135deg, var(--gold), var(--gold2)); color: var(--gold-ink);
    box-shadow: 0 12px 30px #0009, 0 0 0 1px #ffffff30 inset; transition: transform .18s var(--ease);
    animation: fab-in .4s var(--ease);
  }
  .fab .ico { width: 28px; height: 28px; stroke-width: 2.2; }
  .fab:active { transform: scale(.9); }
  @keyframes fab-in { from { transform: scale(.4); opacity: 0; } }

  .hero { display: grid; grid-template-columns: 112px 1fr; align-items: center; column-gap: 16px; row-gap: 2px; padding: 18px; }
  .ring { grid-row: 1 / span 3; }
  .ring { width: 112px; height: 112px; }
  .ring-c b { font-size: 26px; }
  .hero-split { grid-column: 1 / -1; margin-top: 0; }
  .hero-figs { display: contents; }
  .hero-figs > .eyebrow, .hero-figs > .hero-big, .hero-figs > .muted { grid-column: 2; }
  .hero-split { margin-top: 14px; }
  .quick { gap: 8px; }
  .quick-btn { font-size: 11.5px; padding: 12px 4px 10px; border-radius: 15px; }
  .quick-ico { width: 40px; height: 40px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile-v { font-size: 20px; }
  .panel { padding: 16px; border-radius: 18px; }
  .list.grid { grid-template-columns: 1fr; }
  .fam-grid { gap: 8px; }

  .toolbar { gap: 10px; }
  .toolbar .chips { margin: 0 -16px; padding: 2px 16px; }
  .chips-row { margin: 0 -16px; padding: 0 16px; }
  .chips-row .chips { margin: 0; padding: 2px 0; overflow: visible; }

  .sheet-layer { padding: 0; align-items: flex-end; }
  .sheet {
    width: 100%; max-height: calc(100dvh - env(safe-area-inset-top) - 14px); border-radius: 26px 26px 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
  }
  .sheet-layer.enter .sheet { animation: sheet-up .38s var(--ease); }
  .sheet-layer.leaving .sheet { animation: sheet-down .24s ease-in forwards; }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  @keyframes sheet-down { to { transform: translateY(100%); } }
  .sheet-grab { display: block; position: absolute; top: 7px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 99px; background: #4a6488; }
  .sheet-head { padding: 22px 16px 12px; }
  .sheet-body { padding: 16px; }
  .sheet-foot { border-radius: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .fields { grid-template-columns: 1fr; }
  .menu.sheet .sheet-body { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }

  .toasts { left: 12px; right: 12px; bottom: auto; top: calc(10px + env(safe-area-inset-top)); }
  .toast { animation-name: toast-drop; }
  .toast.out { animation-name: toast-lift; }
  @keyframes toast-drop { from { opacity: 0; transform: translateY(-16px) scale(.97); } }
  @keyframes toast-lift { to { opacity: 0; transform: translateY(-12px); } }
  .toast { max-width: none; }
  .auth-card { padding: 30px 22px; }
}

@media (max-width: 370px) {
  .quick { grid-template-columns: repeat(2, 1fr); }
  .quick-btn { flex-direction: row; justify-content: flex-start; padding: 10px; text-align: left; }
  .hero { grid-template-columns: 96px 1fr; }
  .ring { width: 96px; height: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
