:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #172033;
  --muted: #68738a;
  --line: #dfe5ef;
  --primary: #3559e0;
  --primary-dark: #2342b7;
  --private: #16213f;
  --positive: #087a55;
  --negative: #ba2f3b;
  --warning: #9a5b00;
  --channel: #0c6570;
  --channel-dark: #084b54;
  --shadow: 0 12px 36px rgba(28, 41, 70, 0.09);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(28px, 3vw, 42px); line-height: 1.15; letter-spacing: -.035em; }
h2 { margin-bottom: 5px; font-size: 20px; }
p { color: var(--muted); line-height: 1.65; }
small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.eyebrow { margin-bottom: 8px; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }

.app-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 18px; color: #fff; background: var(--private); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 16px; letter-spacing: -.02em; }
.brand span { display: block; margin-top: 3px; color: rgba(255,255,255,.58); font-size: 9px; letter-spacing: .12em; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; color: #fff; font-weight: 900; background: linear-gradient(145deg, #5d75f3, #2f49bb); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.brand-mark.light { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25); }
.privacy-badge { margin: 24px 0 16px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; color: #b9c5ff; background: rgba(255,255,255,.05); font-size: 12px; }
.nav-list { display: grid; gap: 6px; }
.nav-link { padding: 11px 13px; border-radius: 11px; color: rgba(255,255,255,.68); font-size: 14px; transition: .18s ease; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-link.active { color: #fff; background: rgba(87, 112, 238, .32); box-shadow: inset 3px 0 0 #8ca0ff; }
.sidebar-footer { margin-top: auto; display: grid; gap: 12px; }
.signed-in { display: flex; justify-content: space-between; align-items: center; padding: 0 4px; font-size: 12px; color: rgba(255,255,255,.55); }
.signed-in strong { color: #fff; }
.main-content { min-width: 0; padding: 34px clamp(20px, 4vw, 56px) 60px; }
.mobile-header { display: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 28px; margin-bottom: 24px; }
.page-head p { margin-bottom: 0; max-width: 760px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 11px; font-weight: 700; font-size: 13px; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--primary); box-shadow: 0 8px 20px rgba(53,89,224,.2); }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { color: var(--ink); background: #fff; border-color: var(--line); }
.button.ghost { color: rgba(255,255,255,.78); background: transparent; border-color: rgba(255,255,255,.14); }
.button.ghost-light { min-height: 34px; padding: 7px 12px; color: #fff; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); }
.button.channel-primary { color: #fff; background: var(--channel); box-shadow: 0 8px 20px rgba(12,101,112,.18); }
.button.channel-primary:hover { background: var(--channel-dark); }
.button.channel-secondary { color: var(--channel); background: #fff; border-color: #b9d6da; }
.button.full { width: 100%; }

.filter-bar { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.72); }
.filter-bar label { min-width: 165px; }
label { display: grid; gap: 7px; color: #3d465b; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 42px; padding: 10px 12px; color: var(--ink); border: 1px solid #ced6e3; border-radius: 10px; outline: none; background: #fff; transition: border-color .16s, box-shadow .16s; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #7590ee; box-shadow: 0 0 0 3px rgba(53,89,224,.1); }
input:disabled { color: #667085; background: #f1f4f8; }
label > small { font-weight: 400; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric { min-height: 142px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 3px 12px rgba(30, 46, 78, .035); }
.metric > span { display: block; margin-bottom: 15px; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric strong { display: block; font-size: clamp(22px, 2.2vw, 31px); letter-spacing: -.04em; }
.metric.highlight { color: #fff; background: linear-gradient(145deg, #3357dc, #233ea7); border-color: transparent; box-shadow: 0 14px 30px rgba(48, 76, 190, .21); }
.metric.highlight span, .metric.highlight small { color: rgba(255,255,255,.72); }
.metric.investment { border-color: #d6c7f1; background: linear-gradient(145deg, #fff, #faf7ff); }
.metric.danger strong { color: var(--negative); }

.panel { margin-bottom: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 22px 16px; }
.panel-head p { margin-bottom: 0; font-size: 13px; }
.narrow-panel { max-width: 760px; padding: 24px; }
.narrow-panel .panel-head { padding: 0; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 12px 14px; color: #778196; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; font-size: 11px; letter-spacing: .03em; }
td { padding: 15px 14px; border-bottom: 1px solid #edf0f5; vertical-align: top; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfe; }
td strong { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 45px 20px; color: var(--muted); text-align: center; }
.positive { color: var(--positive); font-weight: 800; }
.negative { color: var(--negative); font-weight: 800; }
.pill, .status { display: inline-flex; align-items: center; justify-content: center; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.pill { color: #46516a; background: #eef1f7; }
.pill.private { color: #4d47a6; background: #eeecff; }
.status.yes { color: #08734f; background: #e7f7f0; }
.status.no { color: #9c3840; background: #fbecef; }
.status.neutral { color: #586175; background: #edf0f5; }
.actions-cell { display: flex; gap: 10px; align-items: center; }
.actions-cell a, .link { color: var(--primary); font-weight: 700; }
.actions-cell form { margin: 0; }
.link { padding: 0; border: 0; background: transparent; }
.danger-link { color: var(--negative); }

.two-column { display: grid; grid-template-columns: minmax(300px, .75fr) minmax(0, 1.7fr); gap: 20px; align-items: start; }
.sticky-panel { position: sticky; top: 28px; padding: 4px 22px 24px; }
.stack-form { display: grid; gap: 16px; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.record-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.record-layout > .panel { padding: 4px 22px 24px; }
.record-layout .panel-head { padding-left: 0; padding-right: 0; }
.check-card { grid-template-columns: 20px 1fr; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.check-card input { width: 18px; height: 18px; min-height: 0; margin-top: 2px; }
.check-card span { display: block; }
.check-card strong { display: block; }
.preview-card { position: sticky; top: 28px; padding: 22px !important; }
.preview-list { display: grid; margin: 20px 0; }
.preview-list div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.preview-list dt { color: var(--muted); font-size: 12px; }
.preview-list dd { margin: 0; font-weight: 800; text-align: right; }
.preview-list .preview-profit dd { color: var(--positive); font-size: 18px; }
.fine-print { margin: 14px 0 0; font-size: 11px; }

.reserved-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.reserved-card { padding: 24px; border: 1px dashed #c8d0dd; border-radius: var(--radius); background: rgba(255,255,255,.6); }
.reserved-card > span { color: #a2aabd; font-size: 34px; font-weight: 900; }
.reserved-card p { min-height: 78px; }
.reserved-card strong { color: #8c95a7; font-size: 12px; }
.architecture-flow { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 30px 24px; }
.architecture-flow span { min-width: 170px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; text-align: center; font-weight: 800; background: var(--surface-2); }
.architecture-flow b { color: #a6afc0; }
.error-card { max-width: 650px; margin: 10vh auto; padding: 42px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); text-align: center; }

.flash-stack { display: grid; gap: 10px; margin-bottom: 18px; }
.flash { padding: 12px 14px; border: 1px solid; border-radius: 11px; font-size: 13px; }
.flash.success { color: #08684a; border-color: #aadcc9; background: #ecfaf4; }
.flash.error { color: #9c2e39; border-color: #e8b8bd; background: #fff1f2; }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.internal-login { background: radial-gradient(circle at 15% 15%, #e8ecff 0, transparent 34%), radial-gradient(circle at 90% 85%, #eae5ff 0, transparent 28%), #f4f6fb; }
.channel-login { background: radial-gradient(circle at 15% 15%, #dff3f1 0, transparent 34%), radial-gradient(circle at 90% 85%, #d7ecef 0, transparent 28%), #f2f8f8; }
.login-card { width: min(460px, 100%); padding: 38px; border: 1px solid rgba(213,220,232,.85); border-radius: 24px; background: rgba(255,255,255,.92); box-shadow: 0 24px 70px rgba(31, 45, 77, .14); backdrop-filter: blur(14px); }
.login-card h1 { font-size: 34px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; font-weight: 800; }
.login-copy { margin-bottom: 24px; }
.login-footnote { margin: 18px 0 0; font-size: 12px; text-align: center; }
.channel-card { border-color: #cde0e2; }
.channel-card .eyebrow { color: var(--channel); }

.channel-body { background: #f2f7f7; }
.channel-shell { min-height: 100vh; }
.channel-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 15px clamp(20px, 4vw, 56px); color: #fff; background: linear-gradient(110deg, #084b54, #0c6f78); box-shadow: 0 8px 24px rgba(6, 58, 66, .18); }
.channel-account { display: flex; align-items: center; gap: 14px; font-size: 13px; font-weight: 800; }
.channel-account form { margin: 0; }
.channel-main { padding: 38px clamp(20px, 5vw, 70px) 60px; }
.channel-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 25px; margin-bottom: 24px; }
.channel-hero .eyebrow { color: var(--channel); }
.channel-hero p { margin-bottom: 0; }
.channel-filter { border-color: #d4e4e5; }
.channel-metrics .metric { border-color: #d7e5e6; }
.metric.channel-highlight { color: #fff; border-color: transparent; background: linear-gradient(145deg, #0d6c76, #08515a); box-shadow: 0 14px 30px rgba(8,81,90,.18); }
.metric.channel-highlight span, .metric.channel-highlight small { color: rgba(255,255,255,.72); }
.channel-panel { border-color: #d4e4e5; }
.pill.channel-pill { color: #09616a; background: #e1f2f1; }
.disclosure { display: flex; gap: 12px 24px; flex-wrap: wrap; padding: 17px 19px; border: 1px solid #cfe1e3; border-radius: 14px; color: #4d6266; background: #eaf4f4; font-size: 12px; }
.disclosure strong { color: var(--channel-dark); }
.channel-error .eyebrow { color: var(--channel); }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-layout { grid-template-columns: 1fr 1fr; }
  .preview-card { grid-column: 1 / -1; position: static; }
}
@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 18px; }
  .privacy-badge, .sidebar-footer { display: none; }
  .nav-list { grid-template-columns: repeat(5, minmax(120px, 1fr)); margin-top: 16px; overflow-x: auto; }
  .nav-link { text-align: center; white-space: nowrap; }
  .main-content { padding-top: 24px; }
  .two-column { grid-template-columns: 1fr; }
  .sticky-panel { position: static; }
  .reserved-grid { grid-template-columns: 1fr; }
  .architecture-flow { flex-direction: column; }
  .architecture-flow b { transform: rotate(90deg); }
}
@media (max-width: 680px) {
  h1 { font-size: 30px; }
  .main-content, .channel-main { padding-left: 14px; padding-right: 14px; }
  .page-head, .channel-hero { display: grid; }
  .head-actions { justify-content: flex-start; }
  .filter-bar { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-bar label { min-width: 0; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric { min-height: 120px; }
  .form-grid.two, .record-layout { grid-template-columns: 1fr; }
  .record-layout .preview-card { grid-column: auto; }
  .channel-header { align-items: flex-start; gap: 12px; }
  .channel-header .brand span { display: none; }
  .login-card { padding: 28px 22px; }
}
