/* =========================================================
   Portfolio AlpHima — Casual Smart design system
   Warm editorial fintech. Fraunces + Sora.
   ========================================================= */

:root {
  /* Canvas & ink */
  --canvas:      #F6F3EC;
  --surface:     #FFFDF8;
  --surface-2:   #F0ECE2;
  --ink:         #1A1712;
  --ink-soft:    #6B6455;
  --ink-faint:   #A39B8B;
  --line:        #E5DFD2;
  --line-strong: #D2C9B6;

  /* Brand accents */
  --clay:        #C2410C;
  --clay-deep:   #9A3412;
  --clay-soft:   #FBEEE6;
  --moss:        #1F6F50;
  --moss-soft:   #E7F1EA;
  --plum:        #7A3E8E;
  --plum-soft:   #F2E9F5;
  --gold:        #B08430;

  /* Sub-portfolio identity */
  --s-div:  #B08430;
  --s-cmd:  #A9713B;
  --s-grw:  #1E5C6B;

  /* Semantic */
  --up:    #1F6F50;
  --down:  #B33A32;

  /* Shape & depth */
  --radius:   16px;
  --radius-s: 10px;
  --radius-l: 24px;
  --shadow-s: 0 1px 2px rgba(26,23,18,.05), 0 1px 1px rgba(26,23,18,.04);
  --shadow-m: 0 4px 16px -4px rgba(26,23,18,.10), 0 1px 3px rgba(26,23,18,.05);
  --shadow-l: 0 18px 48px -18px rgba(26,23,18,.22), 0 2px 8px rgba(26,23,18,.05);

  --font-display: 'Fraunces', 'Songti SC', 'STSong', 'Noto Serif SC', Georgia, serif;
  --font-body: 'Sora', -apple-system, 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --maxw: 1180px;
  --gutter: clamp(20px, 4vw, 48px);
  --ease: cubic-bezier(.22,.61,.36,1);
}

[data-accent="citrus"] {
  --clay: #B7791F; --clay-deep: #8C5A12; --clay-soft: #FBF1DE;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle paper grain for warmth */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background-image: radial-gradient(rgba(26,23,18,.028) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: .6;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; line-height: 1.12; letter-spacing: -0.02em; }
p  { margin: 0; }
a  { color: inherit; text-decoration: none; }
button { font-family: inherit; }
svg { display: block; }

.shell { position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.eyebrow {
  font-family: var(--font-body); font-size: .72rem; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint);
}

/* ---------- Reveal on scroll ---------- */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
[data-reveal].in { opacity: 1; transform: none; }

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--clay) 0%, var(--clay-deep) 100%);
  color: #fff; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 700;
  box-shadow: var(--shadow-s);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-title { font-family: var(--font-display); font-weight: 600; font-size: 1.06rem; letter-spacing: -.02em; }
.brand-sub { font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint); }

.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a {
  padding: 8px 14px; border-radius: 999px; font-size: .88rem; font-weight: 500;
  color: var(--ink-soft); transition: color .18s var(--ease), background .18s var(--ease);
  cursor: pointer;
}
.main-nav a:hover { color: var(--ink); background: var(--surface-2); }
.main-nav a.active { color: var(--clay-deep); background: var(--clay-soft); }

.header-meta { display: flex; align-items: center; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: .76rem; font-weight: 500; color: var(--ink-soft);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--moss); box-shadow: 0 0 0 3px var(--moss-soft); }
.density-toggle {
  display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; background: var(--surface);
}
.density-toggle button {
  border: 0; background: transparent; padding: 7px 12px; font-size: .76rem; font-weight: 500;
  color: var(--ink-soft); cursor: pointer; transition: background .18s var(--ease), color .18s var(--ease);
}
.density-toggle button + button { border-left: 1px solid var(--line); }
.density-toggle button.on { background: var(--ink); color: var(--surface); }

/* =========================================================
   Hero
   ========================================================= */
.hero { padding: clamp(48px, 8vw, 96px) 0 0; }
.hero-grid { display: grid; grid-template-columns: 1.35fr .95fr; gap: clamp(28px, 5vw, 64px); align-items: end; }
.hero h1 { font-size: clamp(2.5rem, 5.4vw, 4rem); font-weight: 500; letter-spacing: -.028em; }
.hero h1 em { font-style: italic; color: var(--clay); font-weight: 400; }
.hero-lede { margin-top: 20px; max-width: 46ch; font-size: 1.06rem; color: var(--ink-soft); line-height: 1.62; }
.hero-meta { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; color: var(--ink-faint); font-size: .82rem; }
.hero-meta .sep { width: 1px; height: 14px; background: var(--line-strong); }

.hero-total {
  border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface);
  padding: 26px 28px; box-shadow: var(--shadow-m); position: relative; overflow: hidden;
}
.hero-total::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 180px; height: 180px;
  border-radius: 50%; background: radial-gradient(circle, var(--clay-soft), transparent 70%);
}
.hero-total .label { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }
.hero-total .value { font-family: var(--font-display); font-size: clamp(2rem, 3.6vw, 2.7rem); font-weight: 600; margin-top: 8px; letter-spacing: -.02em; }
.hero-total .value small { font-size: .5em; font-weight: 400; color: var(--ink-soft); margin-right: 6px; }
.hero-total .delta { margin-top: 10px; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .95rem; }
.delta.pos { color: var(--up); }
.delta.neg { color: var(--down); }
.delta .pill { padding: 3px 9px; border-radius: 999px; font-size: .8rem; background: var(--moss-soft); }
.delta.neg .pill { background: #F7E6E3; }
.hero-total .foot { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line-strong); display: flex; justify-content: space-between; font-size: .8rem; color: var(--ink-faint); }

/* Composed sparkline */
.hero-spark { margin-top: 40px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 20px 22px 12px; box-shadow: var(--shadow-s); }
.spark-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.spark-head h3 { font-size: 1rem; font-weight: 600; }
.spark-head .range { font-size: .78rem; color: var(--ink-faint); }

/* =========================================================
   Sections
   ========================================================= */
section { padding: clamp(48px, 7vw, 88px) 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(1.7rem, 3vw, 2.35rem); font-weight: 500; }
.section-head .desc { color: var(--ink-soft); font-size: .95rem; max-width: 52ch; margin-top: 10px; }
.section-num { font-family: var(--font-mono); font-size: .78rem; color: var(--clay); letter-spacing: .1em; }

/* ---------- KPI strip ---------- */
.kpi-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-s); }
.kpi { background: var(--surface); padding: 22px 24px; }
.kpi .k-label { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.kpi .k-value { font-family: var(--font-display); font-size: clamp(1.5rem, 2.4vw, 1.9rem); font-weight: 600; margin-top: 10px; letter-spacing: -.02em; }
.kpi .k-sub { font-size: .8rem; color: var(--ink-soft); margin-top: 4px; }
.k-sub.pos, .k-value.pos { color: var(--up); }
.k-sub.neg, .k-value.neg { color: var(--down); }

/* =========================================================
   Sub-portfolio cards
   ========================================================= */
.subgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.subcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l);
  padding: 26px 24px 22px; box-shadow: var(--shadow-s); position: relative; overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
  cursor: pointer;
}
.subcard::before { content: ""; position: absolute; left: 0; top: 0; width: 4px; height: 100%; background: var(--tint); opacity: .85; }
.subcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-l); border-color: var(--line-strong); }
.subcard[data-key="dividend"] { --tint: var(--s-div); }
.subcard[data-key="commodity"] { --tint: var(--s-cmd); }
.subcard[data-key="growth"] { --tint: var(--s-grw); }

.subcard-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.subcard .sc-idx { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-faint); }
.subcard h3 { font-size: 1.28rem; font-weight: 600; margin-top: 10px; letter-spacing: -.02em; }
.subcard .sc-en { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); margin-top: 5px; }
.subcard .sc-tag { font-size: .78rem; color: var(--ink-soft); margin-top: 14px; line-height: 1.5; }

.sc-return { text-align: right; flex: none; }
.sc-return .rv { font-family: var(--font-display); font-size: 1.55rem; font-weight: 600; letter-spacing: -.02em; }
.sc-return .rl { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); margin-top: 2px; }
.rv.pos { color: var(--up); } .rv.neg { color: var(--down); }

.subcard-foot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sc-metric .m-l { font-size: .7rem; color: var(--ink-faint); letter-spacing: .04em; }
.sc-metric .m-v { font-family: var(--font-mono); font-size: .95rem; font-weight: 500; margin-top: 3px; }

/* weight bar */
.sc-weight { margin-top: 20px; }
.sc-weight .wl { display: flex; justify-content: space-between; font-size: .72rem; color: var(--ink-faint); margin-bottom: 7px; }
.wbar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.wbar > span { display: block; height: 100%; border-radius: 999px; background: var(--tint); width: 0; transition: width 1s var(--ease); }

/* =========================================================
   Charts
   ========================================================= */
.chartframe { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 24px; box-shadow: var(--shadow-s); }
.chartframe .cf-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 8px; flex-wrap: wrap; }
.chartframe h3 { font-size: 1.12rem; font-weight: 600; }
.chart-head-note { font-size: .8rem; color: var(--ink-faint); }
.legend { display: flex; flex-wrap: wrap; gap: 8px; }
.legend button {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-soft); padding: 6px 12px; border-radius: 999px;
  font-size: .78rem; font-weight: 500; cursor: pointer; transition: all .18s var(--ease);
}
.legend button .sw { width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.legend button:hover { border-color: var(--ink-faint); color: var(--ink); }
.legend button.off { opacity: .38; }
.legend button.total { border-style: dashed; }

.range-group { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; background: var(--surface); }
.range-group button { border: 0; background: transparent; padding: 7px 14px; font-size: .78rem; font-weight: 500; color: var(--ink-soft); cursor: pointer; transition: background .18s var(--ease), color .18s var(--ease); }
.range-group button + button { border-left: 1px solid var(--line); }
.range-group button.on { background: var(--ink); color: var(--surface); }

.chart-wrap { position: relative; width: 100%; }
#perfChart { width: 100%; height: clamp(300px, 40vw, 420px); display: block; touch-action: pan-y; }
#contribChart { width: 100%; height: clamp(260px, 32vw, 340px); display: block; }

.tooltip {
  position: absolute; pointer-events: none; opacity: 0; transform: translate(-50%, -114%);
  background: var(--ink); color: var(--surface); border-radius: 12px; padding: 10px 13px;
  font-size: .78rem; box-shadow: var(--shadow-l); transition: opacity .15s var(--ease); z-index: 5; min-width: 148px;
}
.tooltip .tt-date { font-weight: 600; margin-bottom: 7px; color: #fff; letter-spacing: .02em; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 16px; color: #D8D2C4; }
.tooltip .tt-row b { color: #fff; font-family: var(--font-mono); font-weight: 500; }
.tooltip .tt-total { margin-top: 7px; padding-top: 7px; border-top: 1px solid rgba(255,255,255,.18); }

/* stat line under chart */
.chart-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--line); margin-top: 20px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cs { background: var(--surface); padding: 14px 16px; }
.cs .cs-l { font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-faint); }
.cs .cs-v { font-family: var(--font-mono); font-size: 1.02rem; font-weight: 500; margin-top: 6px; }

/* =========================================================
   Holdings table
   ========================================================= */
.table-shell { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow-s); overflow: hidden; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.table-toolbar h3 { font-size: 1.1rem; font-weight: 600; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters button {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft);
  padding: 7px 14px; border-radius: 999px; font-size: .8rem; font-weight: 500; cursor: pointer;
  transition: all .18s var(--ease);
}
.filters button:hover { border-color: var(--ink-faint); color: var(--ink); }
.filters button.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 780px; }
thead th {
  text-align: left; padding: 13px 18px; font-size: .7rem; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint); background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0;
}
thead th.num, tbody td.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
tbody td { padding: 15px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s var(--ease); }
tbody tr:hover { background: var(--clay-soft); }
.tick-name { font-weight: 600; }
.tick-code { font-family: var(--font-mono); font-size: .76rem; color: var(--ink-faint); margin-top: 2px; }
.tagdot { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.tagdot .d { width: 8px; height: 8px; border-radius: 50%; }
td .pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 500; }
.pos-t { color: var(--up); } .neg-t { color: var(--down); }
tr.hide { display: none; }

/* =========================================================
   Composition / allocation
   ========================================================= */
.comp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.stackbar { display: flex; height: 30px; border-radius: 999px; overflow: hidden; border: 1px solid var(--line); margin-top: 6px; }
.stackbar > span { height: 100%; transition: width 1s var(--ease); position: relative; }
.stacklegend { margin-top: 20px; display: grid; gap: 2px; }
.stacklegend .sl-row { display: grid; grid-template-columns: 16px 1fr auto auto; gap: 12px; align-items: center; padding: 11px 4px; border-bottom: 1px dashed var(--line); font-size: .88rem; }
.stacklegend .sl-row:last-child { border-bottom: 0; }
.stacklegend .sl-sw { width: 12px; height: 12px; border-radius: 4px; }
.stacklegend .sl-pct { font-family: var(--font-mono); font-weight: 500; }
.stacklegend .sl-val { font-family: var(--font-mono); color: var(--ink-soft); font-size: .82rem; }

.sector-list { margin-top: 10px; display: grid; gap: 14px; }
.sector-row .sr-head { display: flex; justify-content: space-between; font-size: .84rem; margin-bottom: 7px; }
.sector-row .sr-head .v { font-family: var(--font-mono); color: var(--ink-soft); }
.sector-track { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.sector-track > span { display: block; height: 100%; border-radius: 999px; transition: width 1s var(--ease); }

/* =========================================================
   Notes / cards
   ========================================================= */
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
.note-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 26px 26px 22px; box-shadow: var(--shadow-s); }
.note-card h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 14px; }
.note-card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 13px; }
.note-card li { display: grid; grid-template-columns: 24px 1fr; gap: 12px; font-size: .9rem; color: var(--ink-soft); line-height: 1.55; }
.note-card li .mk { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; background: var(--clay-soft); color: var(--clay-deep); font-size: .7rem; font-weight: 700; margin-top: 2px; }
.note-card li b { color: var(--ink); font-weight: 600; }

.risk-card { border: 1px solid var(--line); border-radius: var(--radius-l); background: linear-gradient(160deg, var(--surface), var(--surface-2)); padding: 26px; box-shadow: var(--shadow-s); }
.risk-card h3 { font-size: 1.1rem; font-weight: 600; }
.risk-scale { margin-top: 18px; }
.risk-scale .rs-track { display: flex; gap: 6px; }
.risk-scale .rs-seg { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-2); }
.risk-scale .rs-seg.on { background: var(--clay); }
.risk-scale .rs-labels { display: flex; justify-content: space-between; margin-top: 10px; font-size: .72rem; color: var(--ink-faint); }
.risk-list { margin-top: 20px; display: grid; gap: 12px; }
.risk-list .rli { display: flex; justify-content: space-between; align-items: center; font-size: .86rem; padding-bottom: 11px; border-bottom: 1px dashed var(--line); }
.risk-list .rli:last-child { border-bottom: 0; padding-bottom: 0; }
.risk-list .rli .w { font-family: var(--font-mono); font-weight: 500; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 46px 0 30px; background: var(--surface); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 32px; }
.footer-grid h4 { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; margin-bottom: 14px; font-family: var(--font-body); }
.footer-grid a { display: block; font-size: .88rem; color: var(--ink-soft); padding: 5px 0; transition: color .18s var(--ease); cursor: pointer; }
.footer-grid a:hover { color: var(--clay-deep); }
.footer-about p { font-size: .88rem; color: var(--ink-soft); max-width: 42ch; margin-top: 12px; line-height: 1.6; }
.disclaimer { margin-top: 34px; padding-top: 22px; border-top: 1px dashed var(--line-strong); font-size: .78rem; color: var(--ink-faint); line-height: 1.65; max-width: 92ch; }
.footer-bottom { margin-top: 20px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: .76rem; color: var(--ink-faint); }

/* =========================================================
   Data drawer
   ========================================================= */
.drawer-scrim { position: fixed; inset: 0; background: rgba(26,23,18,.42); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); z-index: 90; backdrop-filter: blur(2px); }
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(440px, 92vw); z-index: 100;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-l);
  transform: translateX(102%); transition: transform .38s var(--ease);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { font-size: 1.15rem; font-weight: 600; }
.drawer-close { border: 1px solid var(--line-strong); background: var(--surface); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; color: var(--ink-soft); display: grid; place-items: center; transition: all .18s var(--ease); }
.drawer-close:hover { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.drawer-body { padding: 22px 24px; overflow-y: auto; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: .78rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 7px; }
.field input[type="text"], .field input[type="number"], .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--canvas); font-family: var(--font-body); font-size: .88rem; color: var(--ink);
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--clay); outline-offset: 1px; border-color: var(--clay); }
.field textarea { min-height: 108px; font-family: var(--font-mono); font-size: .82rem; resize: vertical; }
.field .hint { font-size: .72rem; color: var(--ink-faint); margin-top: 6px; line-height: 1.5; }
.drawer-actions { display: flex; gap: 10px; margin-top: 6px; }
.btn {
  border: 1px solid var(--ink); background: var(--ink); color: var(--surface);
  padding: 11px 18px; border-radius: 999px; font-size: .86rem; font-weight: 600; cursor: pointer;
  transition: transform .15s var(--ease), background .18s var(--ease);
}
.btn:hover { background: var(--clay-deep); border-color: var(--clay-deep); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-faint); }
.drawer-foot { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line-strong); font-size: .76rem; color: var(--ink-faint); line-height: 1.6; }

/* Accordion (allocation detail) */
.acc { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.acc-item + .acc-item { border-top: 1px solid var(--line); }
.acc-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 15px 18px; background: transparent; border: 0; cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--ink); text-align: left; }
.acc-head .caret { margin-left: auto; transition: transform .25s var(--ease); color: var(--ink-faint); }
.acc-item.open .caret { transform: rotate(180deg); }
.acc-body { max-height: 0; overflow: hidden; transition: max-height .34s var(--ease); }
.acc-item.open .acc-body { max-height: 640px; }
.acc-body-inner { padding: 2px 18px 16px; }
.acc-body table { min-width: 0; font-size: .84rem; }
.acc-body thead th { background: transparent; padding: 8px 10px; }
.acc-body tbody td { padding: 9px 10px; }
.acc .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 8px; vertical-align: middle; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; align-items: start; }
  .subgrid { grid-template-columns: 1fr 1fr; }
  .subgrid .subcard:nth-child(3) { grid-column: 1 / -1; }
  .comp-grid, .two-col { grid-template-columns: 1fr; }
  .chart-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .main-nav { display: none; }
  .subgrid { grid-template-columns: 1fr; }
  .subgrid .subcard:nth-child(3) { grid-column: auto; }
  .kpi-strip { grid-template-columns: 1fr 1fr; }
  .chart-stats { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .header-meta .chip { display: none; }
  .table-toolbar { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .kpi-strip { grid-template-columns: 1fr; }
  .chart-stats { grid-template-columns: 1fr 1fr; }
  .brand-sub { display: none; }
}

/* print */
@media print {
  .site-header, .drawer, .drawer-scrim, .density-toggle { display: none !important; }
  body::before { display: none; }
  body { background: #fff; }
}
