*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body { font-family: var(--font); font-size: var(--fs-md); color: var(--text); background: var(--bg); line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--navy-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; color: var(--navy-900); letter-spacing: -.01em; }
h1 { font-size: var(--fs-2xl); } h2 { font-size: var(--fs-xl); } h3 { font-size: var(--fs-lg); } h4 { font-size: var(--fs-md); }
p { margin: 0 0 var(--sp-2); }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--text-muted); } .small { font-size: var(--fs-sm); } .xs { font-size: var(--fs-xs); }
.hidden { display: none !important; }

/* App shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: var(--topbar-h) 1fr; height: 100vh; }
.app.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
.sidebar { grid-row: 1 / 3; background: var(--navy-900); color: #c9d5e6; display: flex; flex-direction: column; overflow: hidden; }
.brand { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.07); flex: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; background: linear-gradient(135deg, var(--teal-500), var(--teal-700)); display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff; flex: none; }
.brand-name { font-weight: 700; font-size: 15.5px; letter-spacing: .01em; white-space: nowrap; }
.brand-name small { display: block; font-weight: 450; font-size: 10.5px; color: #8fa3bf; letter-spacing: .02em; }
.nav { flex: 1; overflow-y: auto; padding: 8px 0 16px; scrollbar-width: thin; scrollbar-color: #2a4468 transparent; }
.nav-section { padding: 14px 18px 5px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #6f86a6; white-space: nowrap; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 16px 7px 18px; color: #c9d5e6; font-size: 13px; white-space: nowrap; border-left: 3px solid transparent; }
.nav a:hover { background: rgba(255,255,255,.05); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(20,163,165,.14); border-left-color: var(--teal-500); color: #fff; font-weight: 550; }
.nav a svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav a > span:not(.stage-no) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav .stage-no { width: 18px; height: 18px; border-radius: 50%; font-size: 10px; display: grid; place-items: center; background: rgba(255,255,255,.08); flex: none; }
.nav .stage-no.done { background: var(--teal-600); color: #fff; }
.nav .stage-no.current { background: #fff; color: var(--navy-900); font-weight: 700; }
.nav .eng-chip { margin: 4px 14px 2px; padding: 8px 10px; background: rgba(255,255,255,.05); border-radius: 6px; font-size: 12px; color: #dfe7f2; white-space: normal; }
.nav .eng-chip b { display: block; color: #fff; font-size: 12.5px; }
.app.collapsed .nav-section, .app.collapsed .nav a span, .app.collapsed .brand-name, .app.collapsed .eng-chip, .app.collapsed .sidebar-foot span { display: none; }
.app.collapsed .nav a { justify-content: center; padding: 9px 0; }
.sidebar-foot { padding: 10px 16px; font-size: 11px; color: #6f86a6; border-top: 1px solid rgba(255,255,255,.07); white-space: nowrap; }

.topbar { grid-column: 2; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 18px 0 10px; z-index: 20; }
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search input { width: 100%; height: 34px; border: 1px solid var(--border); background: var(--grey-50); border-radius: 17px; padding: 0 14px 0 34px; font: inherit; }
.topbar .search input:focus { outline: none; box-shadow: var(--focus); border-color: var(--teal-500); background: #fff; }
.topbar .search svg { position: absolute; left: 11px; top: 9px; width: 16px; height: 16px; color: var(--grey-500); }
.search-results { position: absolute; top: 38px; left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-2); max-height: 380px; overflow: auto; z-index: 50; }
.search-results a { display: block; padding: 8px 12px; border-bottom: 1px solid var(--grey-150); color: var(--text); }
.search-results a:hover { background: var(--navy-50); text-decoration: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: var(--grey-700); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--grey-100); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot { position: absolute; top: 4px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red-700); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.user-pill { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 18px; cursor: pointer; border: 1px solid var(--border); background: #fff; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--navy-700); color: #fff; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; flex: none; }
.user-pill .meta { line-height: 1.1; font-size: 12px; }
.user-pill .meta small { display: block; color: var(--text-muted); font-size: 10.5px; }

.main { grid-column: 2; overflow-y: auto; position: relative; }
.ribbon { background: var(--navy-50); border-bottom: 1px solid var(--navy-100); padding: 8px 24px; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 12px; color: var(--grey-700); }
.ribbon b { color: var(--navy-900); font-weight: 600; }
.ribbon .warn b { color: var(--red-700); }
.page { padding: 20px 24px 48px; max-width: 1480px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .crumbs { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.page-head .crumbs a { color: var(--text-muted); }
.page-head p { color: var(--text-muted); margin: 4px 0 0; max-width: 820px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
