:root {
  --brand: #315efb;
  --brand-strong: #2148d8;
  --canvas: #f2f5fa;
  --surface: #fff;
  --surface-2: #f7f9fc;
  --text: #172033;
  --muted: #5f6d82;
  --border: #dfe5ee;
  --danger: #bd3434;
  --focus: rgba(49, 94, 251, .25);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; min-height: 100dvh; font: 16px/1.6 Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; color: var(--text); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 9999; background: #fff; color: var(--brand-strong); padding: 10px 14px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.auth-shell { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr); background: radial-gradient(circle at 18% 18%, rgba(75,107,255,.28), transparent 32%), radial-gradient(circle at 85% 82%, rgba(32,200,165,.18), transparent 28%), linear-gradient(135deg, #0c1428, #111d39 52%, #0b1223); }
.auth-story { min-height: 100dvh; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(40px, 7vw, 90px); color: #fff; }
.auth-story h1 { max-width: 760px; margin: 14px 0; font-size: clamp(34px, 5vw, 62px); line-height: 1.1; letter-spacing: -.04em; }
.auth-story p:not(.eyebrow) { max-width: 620px; color: #b7c3d8; }
.brand-lockup { display: flex; gap: 12px; align-items: center; color: #fff; }
.brand-lockup b, .brand-lockup small { display: block; }
.brand-lockup small { color: #9baccc; font-size: 12px; }
.brand-lockup.dark-text { color: var(--text); margin-bottom: 28px; }
.brand-lockup.dark-text small { color: var(--muted); }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: linear-gradient(135deg, #5277ff, #20c8a5); color: #fff; font-weight: 800; }
.eyebrow { margin: 0; color: #7194ff; font-size: 12px; font-weight: 700; letter-spacing: .16em; }
.legal-note { font-size: 12px; }
.auth-panel { min-height: 100dvh; display: grid; place-items: center; padding: 28px; background: rgba(7, 12, 24, .26); }
.auth-panel.solo { background: var(--canvas); }
.auth-card { width: min(440px, 100%); padding: 30px; border: 1px solid rgba(255,255,255,.5); border-radius: 24px; background: rgba(255,255,255,.98); box-shadow: 0 28px 80px rgba(0,0,0,.3); }
.auth-card h1, .auth-card h2 { margin: 6px 0; line-height: 1.25; }
.muted { color: var(--muted); }
.field { margin-top: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); color: var(--text); }
.field small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.form-error { min-height: 24px; margin: 10px 0; color: var(--danger); font-size: 13px; }
.button { min-height: 44px; padding: 10px 15px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; transition: background-color .18s ease, border-color .18s ease, opacity .18s ease; }
.button.primary { border-color: var(--brand); background: var(--brand); color: #fff; font-weight: 700; }
.button.primary:hover { background: var(--brand-strong); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button.full { width: 100%; }
.auth-help { color: var(--muted); font-size: 12px; }
.portal-link { color: var(--brand-strong); font-size: 13px; }
.placeholder-shell { max-width: 720px; margin: 10vh auto; padding: 28px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.app-layout { min-height: 100dvh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 22px 16px; background: #101a31; color: #d7e0f0; z-index: 30; }
.sidebar-brand { padding: 0 8px 20px; text-decoration: none; }
.side-nav { display: grid; gap: 4px; }
.side-nav a { min-height: 44px; display: flex; align-items: center; padding: 9px 13px; border-radius: 9px; color: #b9c5db; text-decoration: none; font-size: 14px; }
.side-nav a:hover { background: #182641; color: #fff; }
.side-nav a.active { background: linear-gradient(100deg, rgba(73,107,255,.3), rgba(73,107,255,.1)); color: #fff; box-shadow: inset 3px 0 #6f8dff; }
.sidebar-foot { margin-top: auto; display: flex; gap: 8px; align-items: center; padding: 10px; color: #8fa0bd; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #20c8a5; box-shadow: 0 0 0 4px rgba(32,200,165,.12); }
.app-main { min-width: 0; }
.topbar { position: sticky; top: 0; min-height: 70px; display: flex; align-items: center; gap: 20px; padding: 12px clamp(18px, 3vw, 38px); border-bottom: 1px solid var(--border); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); z-index: 20; }
.global-search { position: relative; width: min(520px, 55vw); }
.global-search input { width: 100%; height: 44px; padding: 10px 15px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.search-results { position: absolute; inset: calc(100% + 7px) 0 auto; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: #fff; box-shadow: 0 18px 45px rgba(20,34,59,.16); }
.search-results a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 13px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.search-results a:hover { background: var(--surface-2); }
.search-results span { color: var(--muted); font-size: 12px; }
.search-results p { padding: 8px 13px; color: var(--muted); }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-user span, .topbar-user small { display: block; }
.topbar-user small { color: var(--muted); font-size: 11px; text-align: right; }
.button.compact { min-height: 38px; padding: 7px 11px; font-size: 13px; }
.icon-button { width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 10px; background: #fff; cursor: pointer; }
.mobile-menu { display: none; }
.content { max-width: 1520px; margin: 0 auto; padding: clamp(22px, 3vw, 40px); }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.page-heading h1 { margin: 4px 0 0; font-size: clamp(26px, 3vw, 36px); letter-spacing: -.03em; }
.eyebrow.dark { color: var(--brand-strong); }
.as-of-badge { padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--muted); font-size: 12px; }
.notice { margin-bottom: 18px; padding: 11px 14px; border-radius: 10px; font-size: 13px; }
.notice.info { border: 1px solid #f2d48b; background: #fff9e8; color: #725311; }
.loading-card, .empty-state { padding: 32px; border: 1px dashed #c8d2e2; border-radius: 14px; background: rgba(255,255,255,.6); color: var(--muted); text-align: center; }
.empty-state.large { min-height: 300px; display: grid; place-content: center; }
.empty-state h2, .empty-state p { margin: 5px; }
.empty-icon { width: 64px; height: 64px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 18px; background: #e9efff; color: var(--brand-strong); font-weight: 800; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card, .panel { border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: 0 5px 18px rgba(33,48,76,.045); }
.metric-card { padding: 18px; }
.metric-card span, .metric-card small { display: block; color: var(--muted); font-size: 12px; }
.metric-card strong { display: block; margin: 7px 0 3px; font-size: clamp(22px, 2vw, 29px); line-height: 1.2; font-style: normal; }
.metric-card i { font-style: normal; }
.panel { padding: 20px; margin-bottom: 18px; overflow: hidden; }
.panel.narrow { max-width: 760px; margin-inline: auto; }
.panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; margin-bottom: 15px; }
.panel-head h2, .panel h2 { margin: 0; font-size: 18px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.panel-head a { color: var(--brand-strong); font-size: 13px; text-decoration: none; }
.two-column { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(330px, .8fr); gap: 18px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 9px 10px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 11px; font-weight: 600; text-align: left; white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid #edf0f5; vertical-align: middle; white-space: nowrap; }
tbody tr:hover { background: #f8faff; }
td a { color: var(--text); text-decoration: none; }
td a:hover { color: var(--brand-strong); }
td small { display: block; color: var(--muted); font-size: 10px; }
.up { color: #c33b3b !important; }
.down { color: #087e68 !important; }
.index-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.index-strip div { padding: 13px; border-radius: 10px; background: var(--surface-2); }
.index-strip span, .index-strip b, .index-strip small { display: block; }
.index-strip span { color: var(--muted); font-size: 11px; }
.v6d-callout { display: flex; justify-content: space-between; align-items: center; padding: 26px; background: linear-gradient(120deg, #fff, #eef3ff); }
.v6d-callout h2, .v6d-callout p { margin: 4px 0; }
.stock-hero { display: flex; justify-content: space-between; align-items: end; margin-bottom: 18px; padding: 24px; border-radius: 16px; background: linear-gradient(120deg, #101b33, #1c2d54); color: #fff; }
.stock-hero p, .stock-hero h2 { margin: 0; }
.stock-hero h2 { font-size: 30px; }
.stock-hero span { color: #b7c6df; font-size: 13px; }
.stock-hero > div:last-child { text-align: right; }
.stock-hero > div:last-child strong { display: block; font-size: 34px; }
.spark-chart { width: 100%; height: 260px; border-radius: 10px; background: linear-gradient(#f7f9fd, #fff); }
.spark-chart polyline { fill: none; stroke: var(--brand); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
details summary { min-height: 44px; padding: 10px 0; color: var(--brand-strong); cursor: pointer; }
.availability { display: grid; gap: 8px; margin: 15px 0; }
.availability div { display: flex; justify-content: space-between; padding: 10px 12px; border-radius: 9px; background: var(--surface-2); }
.status { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px !important; font-weight: 700; text-transform: uppercase; }
.status.ready { background: #e4f6ef; color: #08745f; }
.status.warning { background: #fff0cb; color: #76520a; }
.status.unavailable { background: #edf0f5; color: #5f6d82; }
.inline-form { display: flex; gap: 10px; margin: 20px 0; }
.inline-form input { flex: 1; min-height: 44px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)) auto; gap: 12px; align-items: end; }
.filter-grid label { color: var(--muted); font-size: 11px; }
.filter-grid input, .filter-grid select { width: 100%; min-height: 42px; display: block; margin-top: 5px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; }
.result-count { color: var(--muted); font-size: 12px; }
.industry-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; }
.industry-picker { align-self: start; }
.industry-links { max-height: 70vh; overflow-y: auto; display: grid; gap: 4px; margin-top: 14px; }
.industry-links button, .chip-list button { min-height: 40px; border: 1px solid transparent; border-radius: 8px; background: var(--surface-2); color: var(--text); cursor: pointer; text-align: left; }
.industry-links button:hover, .chip-list button:hover { border-color: var(--brand); color: var(--brand-strong); }
.chip-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 20px; }
.chip-list button { padding: 7px 10px; }
.mini-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.mini-metrics div { padding: 12px; border-radius: 9px; background: var(--surface-2); }
.mini-metrics span, .mini-metrics b { display: block; }
.mini-metrics span { color: var(--muted); font-size: 11px; }
.admin-form { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 12px; align-items: end; margin: 14px 0 20px; padding: 14px; border-radius: 10px; background: var(--surface-2); }
.admin-form label, .upload-box label { color: var(--muted); font-size: 11px; }
.admin-form input, .admin-form select { width: 100%; min-height: 42px; display: block; margin-top: 5px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; background: #fff; }
.upload-box { display: flex; align-items: end; gap: 14px; margin-top: 14px; padding: 18px; border: 1px dashed #afbad0; border-radius: 12px; background: var(--surface-2); }
.upload-box input { display: block; margin-top: 7px; }
.validation-box { margin-top: 14px; padding: 12px 14px; border-radius: 10px; }
.validation-box.valid { background: #e4f6ef; color: #08745f; }
.validation-box.invalid { background: #fde9e9; color: #8a2727; }
.validation-box p { margin: 4px 0 0; font-size: 12px; }
.process-list { margin: 15px 0; padding-left: 24px; color: var(--muted); }
.process-list li { margin: 8px 0; }
.notice.error { border: 1px solid #eab4b4; background: #fdeeee; color: #8a2727; }
.watchlist-toolbar { max-width: 600px; }
code { font-family: "Cascadia Code", Consolas, monospace; font-size: .9em; }
@media (max-width: 760px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-story { display: none; }
  .auth-panel { padding: 18px; }
  .auth-card { padding: 24px 20px; }
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -280px; width: 260px; transition: left .18s ease; }
  .menu-open .sidebar { left: 0; box-shadow: 20px 0 50px rgba(0,0,0,.25); }
  .mobile-menu { display: block; }
  .global-search { width: auto; flex: 1; }
  .topbar-user > span { display: none; }
  .content { padding: 20px 14px; }
  .page-heading { align-items: start; flex-direction: column; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column, .industry-layout { grid-template-columns: 1fr; }
  .index-strip { grid-template-columns: repeat(2, 1fr); }
  .filter-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-grid .button { grid-column: span 2; }
  .admin-form { grid-template-columns: 1fr; }
  .upload-box { align-items: stretch; flex-direction: column; }
  .stock-hero { align-items: start; }
}
@media (max-width: 420px) {
  .topbar { gap: 8px; padding: 10px; }
  .topbar-user .button { padding-inline: 8px; }
  .metric-grid { grid-template-columns: 1fr; }
  .v6d-callout, .stock-hero { align-items: start; flex-direction: column; gap: 16px; }
  .stock-hero > div:last-child { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
