:root {
  --primary: #6d5dfc;
  --primary-2: #7b6cf6;
  --grad: linear-gradient(135deg, #6d5dfc 0%, #9b59f5 50%, #b06bf0 100%);
  --grad-soft: linear-gradient(135deg, rgba(109,93,252,0.12), rgba(176,107,240,0.12));
  --ink: #1a1c2e;
  --muted: #6b7280;
  --line: #e8eaf2;
  --bg: #f4f5fb;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(40, 40, 90, 0.08);
  --shadow-lg: 0 20px 60px rgba(40, 40, 90, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: auto; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 256px; flex-shrink: 0;
  background: #14152b;
  background: linear-gradient(180deg, #1b1c38 0%, #14152b 100%);
  color: #cdd0e6; padding: 22px 16px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 22px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 12px; background: var(--grad);
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 18px;
  box-shadow: 0 8px 20px rgba(123,108,246,0.45);
}
.brand-name { font-size: 19px; font-weight: 800; color: #fff; letter-spacing: .3px; }
.brand-sub { font-size: 11px; color: #8b8fb5; }

.nav {
  display: flex; flex-direction: column; gap: 4px; margin-top: 8px;
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent;
  scrollbar-gutter: stable; overscroll-behavior: contain;
}
.nav::-webkit-scrollbar { width: 10px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.28); border-radius: 5px;
  border: 2px solid transparent; background-clip: padding-box;
}
.nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.45); border: 2px solid transparent; background-clip: padding-box; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px;
  color: #c3c6e0; text-decoration: none; font-size: 14px; font-weight: 500; transition: .18s;
}
.nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav a.active { background: var(--grad); color: #fff; box-shadow: 0 8px 18px rgba(123,108,246,0.4); }
.nav .ico { width: 20px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-spacer { flex: 0 0 12px; }

/* ---------- Nav group (collapsible submenu) ---------- */
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-parent { cursor: pointer; user-select: none; }
.nav-parent .caret { margin-left: auto; font-size: 10px; transition: transform .18s; }
.nav-group.open .nav-parent .caret { transform: rotate(180deg); }
.nav-sub {
  display: none; flex-direction: column; gap: 2px;
  margin: 2px 0 2px 14px; padding-left: 12px;
  border-left: 1px solid rgba(255,255,255,.14);
}
.nav-group.open .nav-sub { display: flex; }
.nav-sub a { padding: 9px 12px; font-size: 13px; border-radius: 9px; }
.nav-sub a.active { background: rgba(123,108,246,.35); box-shadow: none; }
.nav-user { font-size: 12px; color: #8b8fb5; padding: 12px 14px 4px; border-top: 1px solid rgba(255,255,255,0.08); margin-top: 12px; }
.nav-user b { color: #e7e9ff; display: block; font-size: 13px; }

/* ---------- Sidebar collapse ---------- */
.side-toggle {
  margin-left: auto; width: 30px; height: 30px; flex-shrink: 0; border: none; border-radius: 8px;
  background: rgba(255,255,255,.08); color: #cdd0e6; cursor: pointer; font-size: 14px;
  display: grid; place-items: center; transition: .18s;
}
.side-toggle:hover { background: rgba(255,255,255,.18); color: #fff; }
.side-reopen {
  position: fixed; top: 14px; left: 14px; z-index: 120; width: 42px; height: 42px; border: none;
  border-radius: 11px; background: var(--grad); color: #fff; font-size: 18px; cursor: pointer;
  box-shadow: var(--shadow-lg); display: none;
}
.app-shell.sidebar-collapsed .side-reopen { display: block; }
.app-shell.sidebar-collapsed .sidebar { width: 0; min-width: 0; padding-left: 0; padding-right: 0; overflow: hidden; }
/* Leave room for the fixed reopen button so the page heading isn't covered. */
.app-shell.sidebar-collapsed .main { padding-left: 72px; }
@media (max-width: 980px) { .side-toggle { display: none; } .side-reopen { display: none !important; } }

.main { flex: 1; padding: 28px 34px; max-width: 1280px; min-width: 0; }
.main-wide { max-width: none; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.3px; }
.page-head p { color: var(--muted); margin-top: 4px; font-size: 14px; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--primary); text-decoration: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 22px; margin-bottom: 22px;
}
.card h2 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.card .card-sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px){ .grid-3,.grid-4{grid-template-columns:repeat(2,1fr);} .sidebar{display:none;} }
@media (max-width: 680px){ .grid-2,.grid-3,.grid-4{grid-template-columns:1fr;} .main{padding:18px;} }

.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::before { content:""; position:absolute; right:-20px; top:-20px; width:90px; height:90px; border-radius:50%; background: var(--grad-soft); }
.stat .label { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stat .value { font-size: 30px; font-weight: 800; margin-top: 6px; }
.stat .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.fg { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.fg label { font-size: 12.5px; font-weight: 600; color: #5a607a; letter-spacing: .2px; }
.fg input, .fg select, .fg textarea {
  padding: 11px 13px; border: 1px solid #d8dbe8; border-radius: 10px; font-size: 14px;
  background: #fbfbfe; transition: border-color .15s, box-shadow .15s, background .15s; font-family: inherit; color: var(--ink);
}
.fg input:hover, .fg select:hover, .fg textarea:hover { border-color: #b9bce0; }
.fg input:focus, .fg select:focus, .fg textarea:focus {
  outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(109,93,252,0.13);
}
.fg input[readonly], .fg input[readonly]:hover, .fg input[readonly]:focus {
  background: #eef0f6; color: #555; border-color: #d8dbe8; border-style: dashed; cursor: not-allowed; box-shadow: none;
}
.section-title {
  position: relative; padding-left: 14px; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; color: #3a3f5a; margin: 2px 0 16px;
}
.section-title::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 16px; border-radius: 3px; background: var(--grad);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border: none;
  border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none;
  transition: .15s; font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 24px rgba(109,93,252,0.35); }
.btn-primary:hover { box-shadow: 0 14px 30px rgba(109,93,252,0.45); }
.btn-ghost { background: #fff; color: var(--primary); border: 1px solid #d6d9e6; }
.btn-ghost:hover { background: #f4f3ff; }
.btn-success { background: linear-gradient(135deg,#16a34a,#22c55e); color:#fff; box-shadow:0 8px 20px rgba(22,163,74,.3); }
.btn-warn { background: linear-gradient(135deg,#d97706,#f59e0b); color:#fff; }
.btn-danger { background: linear-gradient(135deg,#dc2626,#ef4444); color:#fff; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 8px; }

/* ---------- Tables ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); padding: 12px 14px; border-bottom: 2px solid var(--line); background: #fafbff;
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); }
table.data tbody tr:hover { background: #f7f7ff; }
.empty { text-align: center; color: var(--muted); padding: 30px; font-size: 14px; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-draft { background: #eef0f6; color: #6b7280; }
.badge-submitted { background: #e0ecff; color: #2563eb; }
.badge-progress { background: #fff3df; color: #b45309; }
.badge-approved { background: #def7e6; color: #15803d; }
.badge-returned { background: #fde4e4; color: #b91c1c; }
.badge-info { background: #e5e7ff; color: #4338ca; }

/* ---------- Alerts ---------- */
.alert { padding: 13px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 18px; font-weight: 600; }
.alert-success { background: #def7e6; color: #15803d; }
.alert-error { background: #fde4e4; color: #b91c1c; }
.alert-info { background: #e0ecff; color: #1d4ed8; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab-btn {
  padding: 10px 16px; border: none; background: transparent; cursor: pointer; font-size: 13.5px;
  font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; transition: .15s;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: block; margin-bottom: 22px; scroll-margin-top: 150px; }
.tab-pane.active { display: block; }

/* ---------- Program form: stacked sections, no horizontal overflow ---------- */
#pfForm .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#pfForm table.data { width: 100%; table-layout: auto; }
#pfForm table.data th, #pfForm table.data td { overflow-wrap: break-word; }
#pfForm table.data td input,
#pfForm table.data td select {
  width: 100%; min-width: 0; box-sizing: border-box;
}
@media (max-width: 820px) {
  .form-progress { position: static; }
  .stepper { flex-wrap: wrap; gap: 12px 6px; }
  .step-line { display: none; }
  .tab-btn.step { flex: 0 0 calc(25% - 8px); min-width: 0; }
  .tab-btn.step .step-num { width: 30px; height: 30px; font-size: 13px; }
  .tab-btn.step .step-label { max-width: 100%; font-size: 10px; }
  .tab-pane { scroll-margin-top: 76px; }
}
@media (max-width: 680px) {
  #pfForm .form-grid { grid-template-columns: 1fr; }
  .tab-pane { margin-bottom: 16px; }
}

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-hero {
  background: linear-gradient(150deg, #1b1c38 0%, #4b2a8a 55%, #7b3fc4 100%);
  color: #fff; padding: 56px 52px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.login-hero::after {
  content:""; position:absolute; width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(176,107,240,0.45), transparent 70%); right: -120px; top: -120px;
}
.login-hero::before {
  content:""; position:absolute; width: 360px; height: 360px; border-radius: 50%;
  background: radial-gradient(circle, rgba(109,93,252,0.4), transparent 70%); left: -100px; bottom: -120px;
}
.login-hero > * { position: relative; z-index: 1; }
.login-logo { display: flex; align-items: center; gap: 14px; }
.login-logo .logo {
  width: 52px; height: 52px; border-radius: 14px; background: rgba(255,255,255,0.16);
  display: grid; place-items: center; font-weight: 800; font-size: 22px; backdrop-filter: blur(6px);
}
.login-hero h1 { font-size: 34px; font-weight: 800; line-height: 1.15; margin: 18px 0 12px; }
.login-hero p { color: #d8d2f5; font-size: 15px; max-width: 420px; line-height: 1.6; }
.login-feats { list-style: none; margin-top: 26px; display: flex; flex-direction: column; gap: 14px; }
.login-feats li { display: flex; align-items: flex-start; gap: 12px; font-size: 14.5px; color: #e9e6fb; }
.login-feats .ic { width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,0.14); display: grid; place-items: center; flex-shrink: 0; }
.login-foot { font-size: 12.5px; color: #c7c0ea; }
.login-form-side { display: grid; place-items: center; padding: 40px; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.login-card .fg { margin-bottom: 16px; }
.input-icon { position: relative; }
.input-icon .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #9aa0b5; }
.input-icon input { padding-left: 40px; width: 100%; }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.role-pick label {
  border: 1px solid #d6d9e6; border-radius: 12px; padding: 12px; text-align: center; cursor: pointer; transition: .15s; font-size: 13px; font-weight: 600; color: #555;
}
.role-pick input { display: none; }
.role-pick label:hover { border-color: var(--primary); }
.role-pick input:checked + span { color: var(--primary); }
.role-pick label:has(input:checked) { border-color: var(--primary); background: #f4f3ff; box-shadow: 0 0 0 3px rgba(109,93,252,0.12); }

@media (max-width: 820px){ .login-wrap{ grid-template-columns: 1fr; } .login-hero{ display:none; } }

/* ---------- Mobile top bar & off-canvas sidebar ---------- */
.topbar-mobile { display: none; }
.hamburger {
  width: 40px; height: 40px; border: none; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,0.14); color: #fff; font-size: 20px; line-height: 1;
}
.nav-overlay { display: none; }
@media (max-width: 980px) {
  .sidebar { display: flex; }
}
@media (max-width: 820px) {
  .topbar-mobile {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    background: #14152b; color: #fff; position: sticky; top: 0; z-index: 900;
  }
  .topbar-mobile .tb-brand { font-weight: 800; font-size: 17px; letter-spacing: .3px; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 1000; height: 100vh; width: 264px;
    transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg);
  }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .nav-overlay { position: fixed; inset: 0; background: rgba(10,10,30,.45); z-index: 999; }
  .app-shell.nav-open .nav-overlay { display: block; }
  .main { padding: 16px; max-width: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .form-grid { grid-template-columns: 1fr; }
  .stat .value { font-size: 24px; }
}

/* ---------- Collapsible panel ---------- */
.collapse-btn {
  background: var(--grad); color: #fff; border: none; width: 30px; height: 30px;
  border-radius: 8px; font-size: 18px; font-weight: 700; cursor: pointer; line-height: 1;
  display: grid; place-items: center; flex-shrink: 0;
}
.collapse-hint {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  font-size: 12.5px; font-weight: 600; color: #6d5dfc;
  background: var(--grad-soft); border: 1px solid rgba(109,93,252,.25);
  padding: 5px 11px; border-radius: 999px; user-select: none;
}
.collapse-hint .chev { display: inline-block; transition: transform .2s ease; font-size: 11px; }
.collapse-hint .txt-expand { display: none; }
.card-head.is-collapsed .collapse-hint .chev { transform: rotate(-90deg); }
.card-head.is-collapsed .collapse-hint .txt-collapse { display: none; }
.card-head.is-collapsed .collapse-hint .txt-expand { display: inline; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2 { margin: 0; }

/* ---------- Form progress bar / stepper ---------- */
.form-progress { margin-bottom: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px 18px; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 40; }
.fp-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; color: #444; margin-bottom: 14px; }
.fp-head span:last-child { color: var(--primary); }
.stepper { position: relative; display: flex; justify-content: space-between; }
.step-line { position: absolute; top: 17px; left: 7%; right: 7%; height: 3px; background: #e7e9f2; border-radius: 3px; z-index: 0; }
.step-line-fill { height: 100%; width: 0; background: var(--grad); border-radius: 3px; transition: width .35s ease; }
.tab-btn.step { position: relative; z-index: 1; background: none; border: none; cursor: pointer; font: inherit; color: #9aa0b5; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 7px; flex: 1 1 0; min-width: 56px; }
.tab-btn.step .step-num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: #eef0f6; color: #9aa0b5; border: 2px solid #e3e6f0; transition: .25s; }
.tab-btn.step .step-label { font-size: 11px; font-weight: 600; text-align: center; line-height: 1.2; max-width: 84px; }
.tab-btn.step.done .step-num { background: var(--grad); color: #fff; border-color: transparent; }
.tab-btn.step.done .step-label { color: #5b6178; }
.tab-btn.step.current .step-num { border-color: #6d5dfc; color: #6d5dfc; box-shadow: 0 0 0 4px rgba(109,93,252,.15); transform: scale(1.06); }
.tab-btn.step.current .step-label { color: #6d5dfc; }
.tabs { display: none; }
.card-head.panel-toggle:hover .collapse-hint { box-shadow: 0 4px 12px rgba(109,93,252,.25); }
.card-body.collapsed { display: none; }
.aip-empty { text-align: center; color: var(--muted); padding: 26px; font-size: 14px; }

/* ---------- Misc ---------- */
.ac-balance { background: #f4f5fb; border: 1px dashed #c9cde8; border-radius: 12px; padding: 12px 16px; font-size: 14px; color: #444; min-height: 20px; }
.ac-bal-row { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; }
.ac-bal-row > span { white-space: nowrap; }
.ac-bal-neg { color: #c0392b; font-weight: 700; }
.kpi-row { display:flex; gap:10px; flex-wrap:wrap; }
.pill { font-size:12px; padding:3px 10px; border-radius:999px; background:#f0f1f9; color:#555; font-weight:600; }
.timeline { list-style:none; position:relative; padding-left:8px; }
.timeline li { padding:10px 0 10px 26px; border-left:2px solid var(--line); position:relative; }
.timeline li::before { content:""; position:absolute; left:-7px; top:14px; width:12px; height:12px; border-radius:50%; background:#cbd0e0; }
.timeline li.done::before { background: var(--ok); }
.timeline li.rejected::before { background: var(--bad); }
.timeline li.current::before { background: var(--primary); box-shadow:0 0 0 4px rgba(109,93,252,0.2); }
.timeline .t-title { font-weight:600; font-size:14px; }
.timeline .t-meta { font-size:12.5px; color:var(--muted); }
.filterbar { display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end; margin-bottom:18px; }
.filterbar .fg { margin:0; }

/* ---------- AIP Report ---------- */
.aip-scroll { overflow-x: auto; }
.aip-wrap { font-size: 12px; color: var(--ink); }
.aip-wrap h5 { font-size: 16px; font-weight: 800; margin-bottom: 2px; }
.aip-sub { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.aip-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.aip-table td { border: 1px solid #c9cdd8; padding: 6px 9px; vertical-align: top; font-size: 12px; }
.aip-table.aip-detail { font-size: 11.5px; }
.aip-detail th {
  border: 1px solid #c9cdd8; background: #eef0f6; padding: 6px 6px; text-align: center;
  font-size: 10.5px; vertical-align: middle; font-weight: 700; color: #444;
}
.aip-detail th small { display: block; color: var(--muted); font-weight: 500; font-size: 9.5px; }
.aip-detail td { border: 1px solid #c9cdd8; padding: 5px 6px; text-align: left; }
.aip-detail .text-center { text-align: center; }
.aip-detail .text-end { text-align: right; }
.aip-total td { font-weight: 700; background: #f3f4fa; border: 1px solid #c9cdd8; }
.aip-sign { display: flex; justify-content: space-between; gap: 40px; margin-top: 20px; font-size: 12px; }
.aip-sign > div { flex: 1; }
.aip-line { border-bottom: 1px solid #555; height: 22px; margin: 14px 0 4px; }
.aip-date { color: var(--muted); margin: 0; }
.aip-report-block { margin-bottom: 30px; }
.aip-report-block h3 { font-size: 15px; margin-bottom: 10px; border-left: 4px solid var(--primary); padding-left: 10px; }

@media print {
  .sidebar, .nav, .page-head, .filterbar, .btn, .crumbs, .no-print, #sakura { display: none !important; }
  .main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: none; padding: 0; margin: 0 0 20px; }
  @page { size: A4 landscape; margin: 10mm; }
}

/* ---------- Zonal Allocations ---------- */
.alloc-toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.alloc-toolbar .spacer { flex: 1 1 auto; }
.alloc-toolbar .btn { margin-bottom: 0; }

/* Compact filter bar */
.alloc-filters { padding: 14px 16px; margin-bottom: 16px; }
.alloc-filter-form .filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 14px;
  width: 100%;
  margin-bottom: 14px;
}
@media (max-width: 900px) {
  .alloc-filter-form .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .alloc-filter-form .filter-grid { grid-template-columns: 1fr; }
}
.alloc-filter-form .fg { flex-direction: column; align-items: stretch; gap: 5px; margin: 0; }
.alloc-filter-form .fg label { font-size: 11.5px; white-space: nowrap; font-weight: 600; color: var(--muted); }
.alloc-filter-form .fg input,
.alloc-filter-form .fg select {
  width: 100%; min-width: 0;
  padding: 7px 10px;
  border: 1px solid #d8dbe8; border-radius: 8px;
  font-size: 13px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.alloc-filter-form .fg input:hover,
.alloc-filter-form .fg select:hover { border-color: #b9bce0; }
.alloc-filter-form .fg input:focus,
.alloc-filter-form .fg select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(109,93,252,.14);
}
.alloc-filter-form .acts {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  justify-content: flex-end;
  border-top: 1px solid var(--line); padding-top: 12px;
}

.stat .value.sm { font-size: 24px; }

.alloc-card { padding: 0; overflow: hidden; }
.alloc-scroll {
  max-height: calc(100vh - 250px); overflow: auto;
  border-bottom-left-radius: 16px; border-bottom-right-radius: 16px;
  scrollbar-width: thin; scrollbar-color: #b9bce0 #eef0f7;
}
.alloc-scroll::-webkit-scrollbar { width: 14px; height: 14px; }
.alloc-scroll::-webkit-scrollbar-track { background: #eef0f7; border-radius: 8px; }
.alloc-scroll::-webkit-scrollbar-thumb {
  background: #b9bce0; border-radius: 8px; border: 3px solid #eef0f7;
}
.alloc-scroll::-webkit-scrollbar-thumb:hover { background: #8b8fb5; }
.alloc-scroll::-webkit-scrollbar-corner { background: #eef0f7; }
.alloc-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: 1320px; }
.alloc-table thead th {
  position: sticky; top: 0; z-index: 3; background: #f3f4fb;
  text-align: center; font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: #5a607a; font-weight: 700; padding: 11px 6px; border-bottom: 2px solid var(--line);
  border-right: 1px solid #eceef5; white-space: nowrap;
}
.alloc-table thead th.txt { text-align: left; }
.alloc-table tbody td { padding: 9px 10px; border-bottom: 1px solid var(--line); border-right: 1px solid #f1f2f8; vertical-align: middle; }
.alloc-table tbody td.txt { text-align: left; }
.alloc-table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding: 8px 6px; }
.alloc-table tbody tr:nth-child(even) { background: #fbfbfe; }
.alloc-table tbody tr:hover { background: var(--grad-soft); }
.alloc-table .thrust { font-weight: 700; color: #3a3f5a; }
.alloc-table .activity { font-family: "SF Mono", "Consolas", monospace; font-size: 11.5px; color: #4b5070; }
.alloc-table .fs { font-weight: 700; }
.alloc-table .fs-gemp { color: #6d28d9; }
.alloc-table .fs-cf { color: #0e7490; }
.alloc-table .col-fund { background: rgba(109,93,252,0.05); }
.alloc-table .col-prov { background: rgba(22,163,74,0.06); font-weight: 700; }
.alloc-table .col-total { background: #f3f4fa; font-weight: 700; }
.alloc-table tbody td.col-total { font-weight: 700; color: var(--ink); }
.alloc-table .alloc-input {
  width: 42px; text-align: right; padding: 4px 2px; border: 1px solid #d8dbe8; border-radius: 7px;
  font-size: 11px; background: #fff; font-variant-numeric: tabular-nums; transition: .15s;
}
.alloc-table th.z, .alloc-table td.z { width: 46px; min-width: 46px; font-size: 11px; }
.alloc-table th.z { font-size: 10px; }
.alloc-table th.col-fund, .alloc-table td.col-fund { width: 80px; min-width: 80px; }
.alloc-table th.col-prov, .alloc-table td.col-prov { width: 72px; min-width: 72px; }
.alloc-table th.col-total, .alloc-table td.col-total { width: 72px; min-width: 72px; }
.alloc-table th.col-sub, .alloc-table td.col-sub { width: 220px; min-width: 160px; }
.alloc-table .col-hidden { display: none; }

/* Column visibility menu */
.col-menu-wrap { position: relative; }
.col-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 200;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 14px; width: 320px; max-height: 64vh; overflow: auto;
}
.col-menu[hidden] { display: none; }
.col-menu-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; }
.col-menu-head > label { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.col-menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-bottom: 10px; }
.col-menu-grid label, .col-menu-foot label {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: #444; cursor: pointer; user-select: none;
}
.col-menu-grid label:hover, .col-menu-foot label:hover { color: var(--primary); }
.col-menu-foot { border-top: 1px solid var(--line); padding-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.col-menu-actions { flex-shrink: 0; }
.col-menu-actions a { color: var(--primary); font-size: 12px; text-decoration: none; font-weight: 600; cursor: pointer; }
.col-menu-actions a:hover { text-decoration: underline; }
.alloc-table .alloc-input:hover { border-color: #b9bce0; }
.alloc-table .alloc-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(109,93,252,.14); background: #fff; }
.alloc-table .thrust-input {
  width: 110px; padding: 4px 6px; border: 1px solid #d8dbe8; border-radius: 7px;
  font-size: 11.5px; font-weight: 700; color: #3a3f5a; background: #fff; transition: .15s;
}
.alloc-table .thrust-input:hover { border-color: #b9bce0; }
.alloc-table .thrust-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(109,93,252,.14); background: #fff; }
.alloc-table tfoot td, .alloc-table tfoot th {
  position: sticky; bottom: 0; z-index: 2; background: #1b1c38; color: #e7e9ff;
  padding: 11px 10px; border-top: 2px solid #2c2d52; font-size: 12px; text-align: right; font-weight: 700;
}
.alloc-table tfoot th.txt, .alloc-table tfoot td.txt { text-align: left; }
.alloc-table tfoot th.col-total, .alloc-table tfoot td.col-total { color: #fff; }
.alloc-table tfoot .col-fund { background: rgba(123,108,246,0.25); }
.alloc-legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 14px 0 0; font-size: 12.5px; color: var(--muted); }
.alloc-legend .lg { display: inline-flex; align-items: center; gap: 7px; }
.alloc-legend .sw { width: 12px; height: 12px; border-radius: 4px; }
.alloc-legend .sw-gemp { background: rgba(109,93,252,0.45); }
.alloc-legend .sw-cf { background: rgba(14,116,144,0.35); }
.alloc-legend .sw-prov { background: rgba(22,163,74,0.3); }

/* ---------- Sakura petal effect ---------- */
#sakura { position: fixed; inset: 0; pointer-events: none; z-index: 9999; overflow: hidden; }
.petal {
  position: absolute; top: -8vh; will-change: transform;
  animation-name: petalfall; animation-timing-function: linear; animation-iteration-count: infinite;
}
.petal i {
  display: block; transform: rotate(20deg);
  background: linear-gradient(135deg, #ffd9e8, #ff9ecb);
  border-radius: 0 100% 0 100%;
  box-shadow: 0 2px 5px rgba(255,150,190,.35);
  animation-name: petalSway; animation-timing-function: ease-in-out; animation-iteration-count: infinite;
}
@keyframes petalfall {
  0%   { transform: translateY(-10vh) rotate(0deg); }
  100% { transform: translateY(112vh) rotate(360deg); }
}
@keyframes petalSway {
  0%, 100% { margin-left: 0; }
  50%      { margin-left: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  #sakura { display: none !important; }
}

/* Step guides + field hints shown inside the program form */
.step-guide{background:#eef0fb;border:1px solid #d8dbf0;border-left:4px solid var(--primary,#4b53c9);border-radius:8px;padding:10px 14px;margin:0 0 16px;color:#4a4e75;font-size:.9rem;line-height:1.55;}
.field-hint{display:block;font-size:.78rem;color:#7b7fa6;margin-top:5px;line-height:1.4;}
