:root {
  color-scheme: dark;
  --bg: #080b14;
  --sidebar: #0d111d;
  --panel: #111725;
  --panel-2: #151d2d;
  --line: #253047;
  --line-soft: rgba(120, 142, 176, .18);
  --text: #f6f8ff;
  --muted: #98a5ba;
  --primary: #a77aff;
  --primary-2: #7050ff;
  --cyan: #4fd8ff;
  --green: #59e0a7;
  --amber: #ffbd66;
  --red: #ff6b82;
  --radius: 16px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 65% -10%, rgba(112, 80, 255, .13), transparent 35%), var(--bg); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 50% 15%, rgba(167, 122, 255, .2), transparent 32%); }
.login-card { width: min(460px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 24px; background: rgba(17, 23, 37, .94); box-shadow: var(--shadow); }
.login-card h1 { margin: 8px 0 14px; font-size: clamp(25px, 6vw, 35px); }
.login-copy { margin: 0 0 26px; color: var(--muted); line-height: 1.75; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; color: #0b0811; background: linear-gradient(135deg, var(--primary), #f1bcff); font-weight: 800; font-size: 25px; box-shadow: 0 10px 30px rgba(167, 122, 255, .25); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: 20px; flex: 0 0 auto; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 16px; background: rgba(13, 17, 29, .96); border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; }
.brand b { display: block; letter-spacing: .1em; }
.brand small { color: var(--muted); display: block; margin-top: 2px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { width: 100%; border: 0; border-radius: 11px; padding: 12px 13px; display: flex; align-items: center; gap: 13px; text-align: left; color: var(--muted); background: transparent; cursor: pointer; }
.nav-item span { color: #65708a; font-size: 11px; font-variant-numeric: tabular-nums; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.035); }
.nav-item.active { color: var(--text); background: linear-gradient(90deg, rgba(167, 122, 255, .18), rgba(167, 122, 255, .06)); box-shadow: inset 2px 0 var(--primary); }
.nav-item.active span { color: var(--primary); }
.sidebar-foot { margin-top: auto; padding: 15px 12px; border-top: 1px solid var(--line-soft); display: flex; gap: 10px; align-items: flex-start; }
.sidebar-foot b, .sidebar-foot small { display: block; }
.sidebar-foot b { font-size: 12px; }
.sidebar-foot small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.status-dot { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px var(--green); flex: 0 0 auto; }

.workspace { min-width: 0; }
.topbar { height: 86px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line-soft); background: rgba(8, 11, 20, .74); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 8; }
.topbar h1 { margin: 2px 0 0; font-size: 20px; }
.eyebrow { margin: 0; color: var(--primary); letter-spacing: .16em; font-size: 10px; font-weight: 700; }
.top-actions, .toolbar, .hero-actions, .modal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.mode-pill, .badge { display: inline-flex; align-items: center; min-height: 27px; padding: 5px 10px; border: 1px solid rgba(89, 224, 167, .3); border-radius: 999px; color: var(--green); background: rgba(89, 224, 167, .08); font-size: 10px; letter-spacing: .08em; white-space: nowrap; }
.badge.amber { color: var(--amber); border-color: rgba(255,189,102,.35); background: rgba(255,189,102,.08); }
.badge.red { color: var(--red); border-color: rgba(255,107,130,.35); background: rgba(255,107,130,.08); }
.badge.blue { color: var(--cyan); border-color: rgba(79,216,255,.35); background: rgba(79,216,255,.08); }
.btn { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--panel-2); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #50607b; transform: translateY(-1px); }
.btn.primary { border-color: transparent; color: white; background: linear-gradient(135deg, var(--primary-2), var(--primary)); box-shadow: 0 8px 24px rgba(112, 80, 255, .22); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: rgba(255,107,130,.35); background: rgba(255,107,130,.06); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.text-button { border: 0; padding: 0; color: var(--primary); background: transparent; cursor: pointer; }
.mobile-menu { display: none; border: 1px solid var(--line); color: var(--text); background: var(--panel); border-radius: 9px; width: 39px; height: 39px; }

main { padding: 28px 32px 60px; max-width: 1600px; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; animation: page-in .22s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .8fr); gap: 18px; }
.hero-panel, .boundary-panel, .panel, .metric-card, .platform-card, .task-card { border: 1px solid var(--line-soft); border-radius: var(--radius); background: linear-gradient(145deg, rgba(21, 29, 45, .92), rgba(15, 20, 33, .92)); box-shadow: 0 10px 35px rgba(0,0,0,.12); }
.hero-panel { min-height: 265px; padding: 32px; position: relative; overflow: hidden; }
.hero-panel::after { content: ""; position: absolute; width: 260px; height: 260px; right: -70px; top: -100px; border-radius: 50%; background: radial-gradient(circle, rgba(167,122,255,.2), transparent 65%); pointer-events: none; }
.hero-panel h2 { max-width: 700px; margin: 12px 0; font-size: clamp(27px, 3vw, 43px); line-height: 1.15; letter-spacing: -.03em; }
.hero-panel > p:not(.eyebrow) { max-width: 740px; color: var(--muted); line-height: 1.75; }
.hero-actions { margin-top: 25px; }
.boundary-panel { padding: 25px; }
.boundary-title { display: flex; align-items: center; gap: 11px; }
.shield { width: 29px; height: 29px; display: grid; place-items: center; color: #08130e; background: var(--green); border-radius: 9px; font-weight: 900; }
.boundary-panel ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 17px; }
.boundary-panel li { display: grid; grid-template-columns: 44px 1fr; gap: 10px; color: var(--muted); line-height: 1.55; font-size: 13px; }
.boundary-panel li span { height: 24px; display: grid; place-items: center; border-radius: 7px; font-size: 10px; font-weight: 700; }
.ok { color: var(--green); background: rgba(89,224,167,.1); }.review { color: var(--amber); background: rgba(255,189,102,.1); }.stop { color: var(--red); background: rgba(255,107,130,.1); }

.metric-grid { margin: 18px 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-card { min-height: 116px; padding: 18px; display: grid; align-content: space-between; }
.metric-card small { color: var(--muted); }
.metric-value { font-size: 30px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.metric-foot { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; }
.metric-accent { color: var(--green); }
.flow-section { margin: 18px 0; padding: 24px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: rgba(10,14,24,.58); }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.section-head h2 { margin: 3px 0 0; font-size: 18px; }
.section-head p:not(.eyebrow) { margin: 8px 0 0; }
.flow-map { display: grid; grid-template-columns: 1fr 25px 1fr 25px 1fr 25px 1fr 25px 1fr; align-items: stretch; gap: 4px; }
.flow-map > i { display: grid; place-items: center; color: #526077; font-style: normal; }
.flow-node { min-height: 105px; padding: 15px; border: 1px solid rgba(89,224,167,.18); border-radius: 12px; background: rgba(89,224,167,.035); display: grid; align-content: center; gap: 6px; }
.flow-node span { color: var(--green); font-size: 10px; letter-spacing: .1em; }
.flow-node small { color: var(--muted); line-height: 1.45; }
.flow-node.warn { border-color: rgba(255,189,102,.28); background: rgba(255,189,102,.04); }.flow-node.warn span { color: var(--amber); }
.flow-node.danger { border-color: rgba(255,107,130,.28); background: rgba(255,107,130,.04); }.flow-node.danger span { color: var(--red); }
.platform-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.platform-card { padding: 19px; }
.platform-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.platform-logo { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 11px; font-weight: 800; }
.platform-name { margin-left: 11px; flex: 1; }.platform-name b,.platform-name small { display:block; }.platform-name small { color: var(--muted); margin-top: 3px; }
.platform-card dl { margin: 17px 0 0; display: grid; gap: 9px; }
.platform-card dl div { display:flex; justify-content:space-between; gap:12px; font-size:12px; }.platform-card dt { color:var(--muted); }.platform-card dd { margin:0; text-align:right; }
.platform-actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }

.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.panel { padding: 20px; min-width: 0; }
.compact-list, .work-list { display: grid; gap: 9px; }
.compact-item, .work-item { padding: 12px 0; border-top: 1px solid var(--line-soft); display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.compact-item:first-child, .work-item:first-child { border-top: 0; padding-top: 0; }
.compact-item b, .compact-item small, .work-item b, .work-item small { display: block; }
.compact-item small, .work-item small { color: var(--muted); margin-top: 5px; line-height: 1.5; }
.work-item { display: block; }
.work-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.work-body { margin: 12px 0; padding: 12px; border-left: 2px solid var(--line); color: #cad2e1; background: rgba(255,255,255,.02); line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.work-actions { display: flex; flex-wrap: wrap; gap: 7px; }

.page-tools { margin-bottom: 23px; }
.subtle, .micro { color: var(--muted); font-size: 12px; }
.micro { margin: 18px 0 0; text-align: center; line-height: 1.5; }
.form-error { min-height: 20px; color: var(--red); font-size: 12px; }
.filter-row { margin-bottom: 14px; display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.filter-row label { min-width: 180px; }
label { display: grid; gap: 7px; color: #c7d0df; font-size: 12px; }
input, select, textarea { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: #0d1320; outline: none; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(167,122,255,.12); }
.checkbox { display: flex; align-items: flex-start; gap: 9px; line-height: 1.5; }
.checkbox input { width: 17px; min-height: 17px; margin-top: 1px; }
.stack-form { display: grid; gap: 15px; }
.form-grid { padding: 22px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
.triple { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; }
fieldset { margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; display: flex; gap: 14px; flex-wrap: wrap; }
legend { padding: 0 6px; color: var(--muted); font-size: 11px; }

.table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); background: rgba(13,18,30,.64); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 14px 15px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; font-size: 12px; }
th { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; background: rgba(255,255,255,.018); }
tr:last-child td { border-bottom: 0; }
td b, td small { display: block; } td small { color: var(--muted); margin-top: 4px; line-height: 1.5; }
.row-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.row-actions .btn { min-height: 31px; padding: 5px 9px; font-size: 11px; }
.readiness { display: flex; gap: 5px; flex-wrap: wrap; }.ready-dot { width: 26px; height: 26px; border-radius: 8px; display:grid;place-items:center;color:var(--green);background:rgba(89,224,167,.08);font-size:10px; }.ready-dot.no { color:var(--amber);background:rgba(255,189,102,.08); }
.empty { padding: 55px 20px; display: grid; justify-items: center; gap: 10px; color: var(--muted); text-align: center; }
.empty b { color: var(--text); font-size: 18px; }
.empty .btn { margin-top: 8px; }
.hide-empty-table { display: none; }
.notice-line { padding: 12px 14px; border: 1px solid rgba(79,216,255,.18); border-radius: 11px; color: #b7c9d5; background: rgba(79,216,255,.04); line-height: 1.6; font-size: 12px; }
.task-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 16px; }
.task-card { padding: 18px; }
.task-card pre { max-height: 150px; overflow:auto; padding: 11px; border: 1px solid var(--line-soft); border-radius: 9px; color:#bfc9d9;background:#0a0f19;font-size:10px;white-space:pre-wrap;overflow-wrap:anywhere; }
.approval-banner { margin-bottom: 17px; padding: 17px; display:flex; gap:14px; align-items:flex-start; border:1px solid rgba(255,189,102,.25);border-radius:var(--radius);background:rgba(255,189,102,.05); }
.approval-banner > span { width:30px;height:30px;display:grid;place-items:center;border-radius:9px;color:#1b1005;background:var(--amber);font-weight:900; }.approval-banner p{margin:6px 0 0;color:var(--muted);line-height:1.6;}
.audit-panel { margin-top: 18px; }

.modal { width: min(590px, calc(100% - 30px)); max-height: calc(100vh - 30px); padding: 0; border: 1px solid var(--line); border-radius: 18px; color: var(--text); background: var(--panel); box-shadow: var(--shadow); }
.modal.wide { width: min(900px, calc(100% - 30px)); }
.modal::backdrop { background: rgba(2,4,9,.78); backdrop-filter: blur(5px); }
.modal-head { position: sticky; top: 0; z-index: 2; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); display:flex;align-items:center;justify-content:space-between; background: rgba(17,23,37,.96); }
.modal-head h2 { margin:4px 0 0; font-size:19px; }
.icon-button { width:34px;height:34px;border:1px solid var(--line);border-radius:9px;color:var(--muted);background:transparent;font-size:22px;cursor:pointer; }
.modal-body { padding: 22px; }
.modal-actions { justify-content: flex-end; padding-top: 7px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: min(420px, calc(100% - 44px)); padding: 13px 16px; border: 1px solid rgba(89,224,167,.28); border-radius: 11px; color: var(--text); background: #15231e; box-shadow: var(--shadow); transform: translateY(120px); opacity: 0; transition: .22s ease; }
.toast.show { transform: translateY(0); opacity: 1; }.toast.error { border-color:rgba(255,107,130,.3);background:#2a151b; }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hero-grid { grid-template-columns: 1fr; }
  .platform-grid { grid-template-columns: 1fr; }
  .flow-map { grid-template-columns: 1fr; }
  .flow-map > i { transform: rotate(90deg); min-height: 20px; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); transition: transform .22s ease; width: 250px; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: grid; place-items: center; }
  .topbar { height: auto; min-height: 76px; padding: 14px 18px; }
  .topbar > div:nth-child(2) { flex: 1; }
  .mode-pill, #refreshButton { display: none; }
  main { padding: 20px 18px 45px; }
  .two-column, .customer-layout, .task-grid { grid-template-columns: 1fr; }
  .hero-panel { padding: 24px; min-height: auto; }
  .page-tools { align-items: stretch; flex-direction: column; }
}

@media (max-width: 560px) {
  .login-shell { padding: 14px; }.login-card { padding: 27px 21px; }
  .topbar h1 { font-size: 17px; }.top-actions { gap:4px; }.top-actions .btn { padding:7px 9px; min-height:35px; }
  .metric-grid, .metric-grid.compact { grid-template-columns: 1fr; }
  .hero-panel h2 { font-size: 27px; }
  .toolbar, .hero-actions { display:grid;grid-template-columns:1fr 1fr;width:100%; }.toolbar .btn,.hero-actions .btn { width:100%; }
  .form-grid { grid-template-columns:1fr; padding:18px; }.span-2 { grid-column:span 1; }.triple { grid-template-columns:1fr; }
  .section-head { flex-direction: column; }
  .modal-actions { display:grid;grid-template-columns:1fr 1fr; }.modal-actions .btn{width:100%;}
  .toast { right:12px;bottom:12px;max-width:calc(100% - 24px); }
}

@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior:auto!important;animation:none!important;transition:none!important; } }
