:root {
    --navy-950: #071127;
    --navy-900: #0b1739;
    --navy-800: #132552;
    --signal: #2f6bff;
    --cyan: #48d7ff;
    --amber: #f7b84b;
    --red: #dc4c64;
    --ink: #17213a;
    --muted: #6d7892;
    --line: #dce3f0;
    --surface: #ffffff;
    --paper: #f3f6fb;
    --shadow: 0 14px 42px rgba(25, 45, 86, .08);
    --radius: 14px;
    --sidebar: 252px;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
    color: var(--ink);
    background: var(--paper);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(72, 215, 255, .7); outline-offset: 2px; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar); padding: 22px 16px; color: #fff; background: linear-gradient(168deg, var(--navy-950) 0%, var(--navy-900) 57%, #102657 100%); display: flex; flex-direction: column; box-shadow: 14px 0 40px rgba(7, 17, 39, .14); }
.sidebar::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .18; background-image: linear-gradient(rgba(72,215,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(72,215,255,.08) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(to bottom, #000, transparent 76%); }
.brand { position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; border-radius: 11px; color: #071127; background: linear-gradient(135deg, #fff 0%, var(--cyan) 100%); font: 800 14px/1 "Arial Narrow", sans-serif; letter-spacing: -.04em; box-shadow: 0 0 28px rgba(72,215,255,.28); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .06em; }
.brand small { margin-top: 3px; color: #8ea7d7; font: 700 9px/1 "Consolas", monospace; letter-spacing: .18em; }
.nav { position: relative; margin-top: 32px; overflow-x: hidden; overflow-y: auto; }
.nav-label { margin: 20px 12px 8px; color: #6480b6; font: 700 10px/1 "Consolas", monospace; letter-spacing: .16em; }
.nav a { display: flex; align-items: center; justify-content: space-between; min-height: 43px; margin: 4px 0; padding: 0 12px; border: 1px solid transparent; border-radius: 9px; color: #b8c6e4; font-size: 14px; transition: background .18s ease, color .18s ease, transform .18s ease; }
.nav a:hover, .nav a[aria-current="page"] { color: #fff; background: rgba(72, 215, 255, .10); border-color: rgba(72, 215, 255, .16); transform: translateX(2px); }
.nav kbd { border: 0; color: #536d9f; background: transparent; font: 10px/1 "Consolas", monospace; }
.sidebar-foot { position: relative; display: flex; gap: 10px; align-items: center; margin-top: auto; padding: 14px 12px; border: 1px solid rgba(255,255,255,.09); border-radius: 10px; background: rgba(255,255,255,.04); }
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot strong { font-size: 12px; }
.sidebar-foot small { margin-top: 4px; color: #7690c1; font: 10px/1 "Consolas", monospace; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #43d1a0; box-shadow: 0 0 0 5px rgba(67,209,160,.12); }
.muted-dot { background: #8190ad; box-shadow: 0 0 0 5px rgba(129,144,173,.12); }

.workspace { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { position: sticky; top: 0; z-index: 20; height: 68px; padding: 0 34px; display: flex; align-items: center; gap: 20px; border-bottom: 1px solid rgba(220,227,240,.85); background: rgba(243,246,251,.88); backdrop-filter: blur(16px); }
.breadcrumb { color: var(--muted); font-size: 13px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-actions form { margin: 0; }
.user-chip { padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--navy-800); background: #fff; font-size: 12px; font-weight: 700; }
.link-button { border: 0; color: var(--muted); background: none; cursor: pointer; font-size: 12px; }
.icon-button { border: 0; background: none; cursor: pointer; }
.mobile-menu { display: none; }
.main-content { max-width: 1600px; margin: 0 auto; padding: 34px; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-heading.compact { margin-bottom: 18px; }
.page-heading h1 { margin: 5px 0 6px; color: var(--navy-950); font-size: clamp(27px, 3vw, 38px); line-height: 1.12; letter-spacing: -.04em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.eyebrow { color: var(--signal); font: 800 10px/1 "Consolas", monospace; letter-spacing: .17em; text-transform: uppercase; }
.mono { font-family: "Consolas", "SFMono-Regular", monospace; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-weight: 700; font-size: 13px; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--signal); box-shadow: 0 8px 20px rgba(47,107,255,.23); }
.button.secondary { color: var(--navy-800); background: #e9efff; border-color: #cfdaff; }
.button.ghost { color: var(--navy-800); background: #fff; border-color: var(--line); }
.button.text { min-height: 32px; padding: 0 8px; color: var(--signal); background: transparent; }
.button.wide { width: 100%; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.metric { position: relative; overflow: hidden; min-height: 142px; padding: 20px; border: 1px solid #e1e7f1; border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 26px rgba(25,45,86,.05); }
.metric::after { content: ""; position: absolute; top: 0; right: 0; width: 54px; height: 3px; background: #c7d2e7; }
.metric.signal::after { width: 84px; background: linear-gradient(90deg, var(--signal), var(--cyan)); }
.metric span, .metric small { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin: 14px 0 10px; color: var(--navy-950); font: 700 36px/1 "DIN Alternate", "Arial Narrow", sans-serif; font-variant-numeric: tabular-nums; }
.metric.signal strong { color: var(--signal); }
.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.content-grid.two-thirds { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); }
.panel { margin-bottom: 18px; padding: 22px; border: 1px solid #e0e6f0; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head h2, .panel h2 { margin: 0 0 5px; color: var(--navy-950); font-size: 17px; }
.panel-head p, .panel > p { margin: 0; color: var(--muted); font-size: 12px; }
.panel-head a { color: var(--signal); font-size: 12px; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 12px; color: #71809c; background: #f7f9fc; border-bottom: 1px solid var(--line); text-align: left; font-size: 11px; font-weight: 800; letter-spacing: .04em; white-space: nowrap; }
td { padding: 14px 12px; border-bottom: 1px solid #edf0f6; color: #34405b; }
tbody tr:hover td { background: #fafcff; }
td a { color: var(--navy-800); font-weight: 700; }
.table-action { color: var(--signal); }
.tag, .state-badge { display: inline-flex; align-items: center; min-height: 25px; padding: 0 9px; border: 1px solid #cfdaef; border-radius: 999px; color: #42567d; background: #f0f4fb; font-size: 11px; font-weight: 700; white-space: nowrap; }
.state-badge { color: #fff; background: var(--navy-800); border-color: var(--navy-800); }
.status-list { list-style: none; margin: 0 0 18px; padding: 0; }
.status-list li { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid #edf0f6; font-size: 12px; }
.status-list li span { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.status-list strong { color: var(--navy-800); }

.filter-bar, .upload-row { display: flex; align-items: end; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-bar label { flex: 1 1 280px; }
label { display: grid; gap: 7px; color: #42506c; font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #ced7e7; border-radius: 8px; color: var(--ink); background: #fff; transition: border-color .16s ease, box-shadow .16s ease; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--signal); box-shadow: 0 0 0 3px rgba(47,107,255,.1); outline: 0; }
.form-panel fieldset { margin: 0 0 22px; padding: 0; border: 0; }
.form-panel legend { margin-bottom: 14px; color: var(--navy-950); font-size: 15px; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.span-full { grid-column: 1 / -1; }
.compact-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.compact-form > input { width: auto; min-width: 140px; flex: 1 1 140px; }
.compact-form .check-inline { flex: 0 0 auto; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; margin: 4px 14px 4px 0; font-weight: 500; }
.check-inline input { width: 16px; min-height: 16px; margin: 0; }
.form-grid fieldset { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); margin: 0; gap: 0; }
.detail-list div { padding: 15px 0; border-bottom: 1px solid #edf0f6; }
.detail-list dt { color: var(--muted); font-size: 11px; }
.detail-list dd { margin: 7px 0 0; font-size: 13px; font-weight: 700; }
.tabs { display: flex; gap: 3px; margin-bottom: 18px; padding: 5px; overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.tabs a { padding: 9px 14px; border-radius: 7px; color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.tabs a:hover, .tabs a.active { color: var(--navy-800); background: #edf3ff; }

.workflow-rail { display: flex; align-items: start; list-style: none; margin: 8px 0 0; padding: 12px 0; overflow-x: auto; }
.workflow-rail li { position: relative; min-width: 150px; flex: 1 0 150px; padding: 34px 12px 0 0; }
.workflow-rail li::before { content: ""; position: absolute; top: 12px; left: 10px; right: -10px; height: 2px; background: #d9e1ef; }
.workflow-rail li:last-child::before { right: calc(100% - 12px); }
.rail-node { position: absolute; top: 6px; left: 4px; z-index: 1; width: 14px; height: 14px; border: 3px solid #fff; border-radius: 50%; background: #aab7cc; box-shadow: 0 0 0 2px #aab7cc; }
.stage-completed::before { background: var(--signal) !important; }
.stage-completed .rail-node { background: var(--signal); box-shadow: 0 0 0 2px var(--signal); }
.stage-current .rail-node { background: var(--cyan); box-shadow: 0 0 0 2px var(--signal), 0 0 18px 5px rgba(72,215,255,.38); }
.workflow-rail strong, .workflow-rail small { display: block; }
.workflow-rail strong { color: var(--navy-950); font-size: 12px; }
.workflow-rail small { margin-top: 5px; color: var(--muted); font-size: 10px; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.role-card { padding: 22px; border: 1px solid #e0e6f0; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.role-top { display: flex; justify-content: space-between; align-items: center; }
.role-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: #fff; background: var(--navy-800); font: 800 12px/1 "Consolas", monospace; }
.role-card h2 { margin: 18px 0 7px; font-size: 18px; }
.role-card p { min-height: 38px; color: var(--muted); font-size: 12px; }
.role-card dl { display: flex; gap: 26px; padding: 14px 0; border-top: 1px solid #edf0f6; border-bottom: 1px solid #edf0f6; }
.role-card dl div { display: grid; gap: 5px; }
.role-card dt { color: var(--muted); font-size: 10px; }
.role-card dd { margin: 0; font: 700 20px/1 "Consolas", monospace; }
.role-card .button-row { margin-top: 16px; }
.permission-toolbar { display: flex; justify-content: space-between; padding: 12px 14px; margin-bottom: 10px; border-radius: 9px; background: #f5f8fc; font-size: 12px; }
.permission-node { position: relative; grid-template-columns: 20px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 11px 12px; border-bottom: 1px solid #edf0f6; cursor: pointer; }
.permission-node input { width: 17px; min-height: 17px; accent-color: var(--signal); }
.permission-node span strong, .permission-node span small { display: block; }
.permission-node small { margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 400; }
.permission-node em { color: var(--muted); font: normal 10px/1 "Consolas", monospace; }
.permission-node.level-page { padding-left: 34px; }
.permission-node.level-action { padding-left: 58px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(90px,1fr)); gap: 6px; }
.calendar-day { min-height: 64px; padding: 9px; border-radius: 8px; background: #f5f8fc; }
.calendar-day strong, .calendar-day span { display: block; }
.calendar-day strong { font: 11px/1 "Consolas", monospace; }
.calendar-day span { margin-top: 10px; color: var(--muted); font-size: 10px; }
.calendar-day.holiday { background: #fff4f2; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.choice-card { grid-template-columns: 20px 1fr; align-items: start; padding: 18px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--signal); background: #f3f7ff; box-shadow: 0 0 0 3px rgba(47,107,255,.08); }
.choice-card input { width: 17px; min-height: 17px; accent-color: var(--signal); }
.choice-card strong, .choice-card small { display: block; }
.choice-card small { margin-top: 7px; color: var(--muted); line-height: 1.55; font-weight: 400; }
.drop-zone { display: grid; place-items: center; min-height: 310px; padding: 34px; border: 1px dashed #aebbd2; border-radius: 12px; background: linear-gradient(135deg, #fbfcff, #f1f5fc); text-align: center; }
.drop-zone input { max-width: 420px; }
.drop-zone strong { margin-top: 8px; }
.drop-zone span { color: var(--muted); font-size: 12px; }
.empty-state { padding: 60px 20px; text-align: center; }

.auth-page { min-height: 100vh; color: #fff; background: var(--navy-950); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0,1.25fr) minmax(400px,.75fr); }
.auth-shell.single { grid-template-columns: minmax(320px,520px); place-content: center; padding: 24px; }
.auth-context { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: clamp(42px, 8vw, 120px); background: radial-gradient(circle at 30% 34%, rgba(47,107,255,.30), transparent 34%), linear-gradient(145deg, #071127, #0f2450); }
.auth-context::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(72,215,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(72,215,255,.07) 1px, transparent 1px); background-size: 38px 38px; mask-image: radial-gradient(circle at 35% 45%, black, transparent 62%); }
.auth-context > * { position: relative; z-index: 1; }
.auth-context h1 { margin: 18px 0; max-width: 650px; font-size: clamp(42px, 6vw, 82px); line-height: .98; letter-spacing: -.065em; }
.auth-context p { max-width: 520px; color: #a8badc; line-height: 1.8; }
.auth-signal { display: flex; align-items: center; gap: 10px; margin-top: 48px; color: #7893c4; font: 11px/1 "Consolas", monospace; }
.auth-signal span { width: 42px; height: 2px; background: var(--cyan); box-shadow: 0 0 14px var(--cyan); }
.auth-card { align-self: stretch; display: flex; flex-direction: column; justify-content: center; padding: clamp(34px, 6vw, 90px); color: var(--ink); background: #fff; }
.auth-shell.single .auth-card { border-radius: 18px; box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.auth-brand { margin-bottom: 70px; color: var(--navy-950); }
.auth-card h2 { margin: 0 0 8px; font-size: 28px; letter-spacing: -.03em; }
.form-stack { display: grid; gap: 17px; margin-top: 30px; }
.security-note { display: block; margin-top: 22px; color: #8994a9; line-height: 1.6; }

@media (max-width: 1120px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .card-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 820px) {
    .sidebar { transform: translateX(-105%); transition: transform .22s ease; }
    .sidebar.open { transform: translateX(0); }
    .workspace { margin-left: 0; }
    .mobile-menu { display: inline-grid; }
    .topbar { padding: 0 18px; }
    .main-content { padding: 22px 16px; }
    .content-grid, .content-grid.two-thirds, .auth-shell { grid-template-columns: 1fr; }
    .auth-context { display: none; }
    .auth-card { min-height: 100vh; padding: 34px 24px; }
    .auth-brand { margin-bottom: 48px; }
}
@media (max-width: 600px) {
    .page-heading { align-items: flex-start; flex-direction: column; }
    .metric-grid, .card-grid, .form-grid, .detail-list, .choice-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .metric { min-height: 120px; }
    .calendar-grid { grid-template-columns: repeat(3, minmax(80px,1fr)); }
    .topbar .breadcrumb { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
