:root {
  --bg: #F5F6F8; --surface: #FFFFFF; --ink: #101828; --ink-2: #344054; --muted: #667085; --line: #E4E7EC; --line-2: #F0F2F5;
  --brand: #2150D8; --brand-dark: #173FB0; --brand-soft: #EBF0FF;
  --crit: #C8251A; --crit-bg: #FDECEA;
  --hold: #F59E0B; --hold-ink: #3B2200; --hold-bg: #FEF6E7;
  --transit: #1E46B8; --transit-bg: #EAF0FF;
  --ok: #0E6B37; --ok-bg: #E6F5EC;
  --pre: #475467; --pre-bg: #EEF0F3;
  --sidebar-w: 248px;
}
html, body { height: 100%; }
body { font-feature-settings: "tnum" 1, "cv11" 1; }

/* ---------- Sidebar ---------- */
.sidebar { width: var(--sidebar-w); transition: width .18s ease; }
.app.is-collapsed .sidebar { --sidebar-w: 68px; }
.app.is-collapsed .sb-text, .app.is-collapsed .sb-sub, .app.is-collapsed .plan-full { display: none; }
.app:not(.is-collapsed) .plan-mini { display: none; }
.app.is-collapsed .collapse-icon { transform: rotate(180deg); }
.nav-link { display: flex; align-items: center; gap: .7rem; padding: .5rem .7rem; border-radius: 6px; color: var(--ink-2); font-weight: 500; font-size: .92rem; white-space: nowrap; }
.nav-link:hover { background: var(--line-2); color: var(--ink); }
.nav-link.is-active { background: var(--brand-soft); color: var(--brand-dark); }
.nav-link svg { flex: none; }
.sb-sub .nav-link { padding-left: 2.6rem; font-size: .87rem; font-weight: 400; }
.sb-sub .count { margin-left: auto; font-size: .78rem; color: var(--muted); }
.plan-bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.plan-bar > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.plan-bar.is-full > span { background: var(--hold); }

@media (max-width: 1023px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; --sidebar-w: 260px; }
  .app.is-mobile-open .sidebar { transform: none; }
  .app.is-collapsed .sb-text, .app.is-collapsed .sb-sub, .app.is-collapsed .plan-full { display: initial; }
  .app.is-collapsed .plan-mini { display: none; }
}

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font-weight: 600; font-size: .9rem; padding: .55rem .95rem; border-radius: 6px; line-height: 1.2; white-space: nowrap; transition: background-color .12s, border-color .12s; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); }
.btn-outline:hover { border-color: #CBD2DC; background: #FAFBFC; }
.btn-danger { color: var(--crit); }
.btn-danger:hover { background: var(--crit-bg); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
:is(button, a, input, select, textarea):focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.field { display: block; }
.field > span:first-child { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: .3rem; }
.inp { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .5rem .65rem; font-size: .9rem; color: var(--ink); }
.inp.has-icon { padding-left: 2.3rem; }
.inp::placeholder { color: #98A2B3; }
.inp:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hint { display: block; font-size: .76rem; color: var(--muted); margin-top: .3rem; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.page-title { font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; }

/* Search banner */
.hero { background: linear-gradient(180deg, #F0F4FF 0%, #FFFFFF 100%); border: 1px solid #DCE4FA; border-radius: 12px; }
.hero-input { font-size: 1.05rem; padding: .85rem 1rem .85rem 2.9rem; border-radius: 8px; border: 1px solid #C9D3EE; background: #fff; width: 100%; }
.hero-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 700; line-height: 1; padding: .34rem .55rem; border-radius: 5px; white-space: nowrap; }
.badge svg { width: 12px; height: 12px; }
.b-critical { background: var(--crit); color: #fff; }
.b-hold { background: var(--hold); color: var(--hold-ink); }
.b-transit { background: var(--transit-bg); color: var(--transit); box-shadow: inset 0 0 0 1px #C9D6FB; }
.b-ok { background: var(--ok-bg); color: var(--ok); box-shadow: inset 0 0 0 1px #BFE5CF; }
.b-pre { background: var(--pre-bg); color: var(--pre); box-shadow: inset 0 0 0 1px #DDE1E7; }
.badges { display: flex; flex-wrap: wrap; gap: .3rem; }

/* ---------- Table ---------- */
.tbl { width: 100%; font-size: .875rem; border-collapse: separate; border-spacing: 0; }
.tbl th { text-align: left; font-size: .75rem; font-weight: 600; color: var(--muted); padding: .7rem .75rem; background: #FAFBFC; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: .8rem .75rem; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: #F8FAFF; }
.tbl tr.is-critical td:first-child { box-shadow: inset 3px 0 0 var(--crit); }
.tbl tr.is-hold td:first-child { box-shadow: inset 3px 0 0 var(--hold); }
.sub { display: block; font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.id-main { font-weight: 600; letter-spacing: .01em; }
.lfd-left { font-weight: 600; }
.lfd-left.bad { color: var(--crit); }
.lfd-left.soon { color: #B45309; }

/* Tabs / chips */
.tabs { display: flex; gap: 1.4rem; border-bottom: 1px solid var(--line); }
.tab { padding: .6rem 0; font-weight: 600; font-size: .92rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--brand-dark); border-color: var(--brand); }
.tab .n { margin-left: .35rem; font-size: .76rem; background: var(--line-2); color: var(--ink-2); padding: .1rem .45rem; border-radius: 99px; }
@media (max-width: 767px) { #filters:not(.show-all) .filter-extra { display: none; } }
.chip { font-size: .8rem; font-weight: 600; padding: .35rem .7rem; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); }
.chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Milestone track ---------- */
.track { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: relative; }
.step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 .2rem; min-width: 0; }
.step::before { content: ''; position: absolute; top: 9px; left: -50%; right: 50%; height: 3px; background: var(--line); }
.step:first-child::before { display: none; }
.step.done::before, .step.current::before { background: var(--brand); }
.step .dot { position: relative; z-index: 1; width: 21px; height: 21px; border-radius: 50%; background: #fff; border: 3px solid var(--line); display: grid; place-items: center; }
.step.done .dot { background: var(--brand); border-color: var(--brand); }
.step.current .dot { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.step.current .dot::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.step .lbl { font-size: .74rem; font-weight: 600; color: var(--ink-2); margin-top: .45rem; line-height: 1.25; }
.step.todo .lbl { color: var(--muted); font-weight: 500; }
.step .dt { font-size: .72rem; color: var(--muted); margin-top: .1rem; }
button.step-btn { all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; width: 100%; border-radius: 6px; }
button.step-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.step.is-selected .lbl { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Drawer, toast, dropzone ---------- */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(640px, 100%); background: var(--surface); z-index: 50; transform: translateX(100%); transition: transform .2s ease-out, visibility .2s; display: flex; flex-direction: column; visibility: hidden; }
.drawer.is-open { transform: none; visibility: visible; box-shadow: -16px 0 40px rgba(16,24,40,.14); }
.scrim { position: fixed; inset: 0; background: rgba(16,24,40,.35); z-index: 45; }
.timeline li { position: relative; padding-left: 1.4rem; padding-bottom: 1rem; }
.timeline li::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: -6px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ''; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); }
.timeline li:first-child::after { background: var(--brand); }
.dropzone { border: 2px dashed #C9D3EE; border-radius: 10px; background: #FAFBFF; }
.dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem); opacity: 0; pointer-events: none; z-index: 70; background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 8px; font-size: .9rem; max-width: 92vw; transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--crit); }
.skeleton { color: var(--muted); padding: 3rem; text-align: center; }

@media (prefers-reduced-motion: reduce) { .sidebar, .drawer, .toast { transition: none; } }
