:root {
  color-scheme: light;
  --bg: #f8fafd;
  --surface: #ffffff;
  --surface-soft: #f1f5fd;
  --surface-warm: #fff8e6;
  --line: #dde3ee;
  --line-strong: #c8d1e0;
  --text: #202124;
  --muted: #5f6368;
  --subtle: #8792a2;
  --accent: #1a73e8;
  --accent-strong: #1558b0;
  --accent-weak: #e8f0fe;
  --success: #137333;
  --success-bg: #e6f4ea;
  --warn: #b06000;
  --warn-bg: #fef7e0;
  --danger: #b3261e;
  --danger-bg: #fce8e6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Geist, "Segoe UI", system-ui, sans-serif;
}

.dashboard-page { display: grid; gap: 24px; padding-bottom: 12px; }
.dashboard-hero { position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); gap: 24px; min-height: 300px; padding: clamp(28px, 5vw, 64px); border-radius: 24px; background: radial-gradient(circle at 85% 15%, rgba(94, 234, 212, .32), transparent 28%), radial-gradient(circle at 12% 0%, rgba(120, 119, 198, .5), transparent 35%), linear-gradient(130deg, #14213d 0%, #0a192f 53%, #132a3d 100%); color: #f8fbff; box-shadow: 0 18px 40px rgba(8, 20, 40, .15); }
.dashboard-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .35; background-image: linear-gradient(rgba(255,255,255,.11) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.11) 1px, transparent 1px); background-size: 34px 34px; mask-image: linear-gradient(to right, #000, transparent); }
.hero-copy { display: grid; align-content: center; gap: 18px; max-width: 760px; }
.hero-eyebrow { display: block; color: #7ee8d6; font-size: 11px; font-weight: 760; letter-spacing: .12em; text-transform: uppercase; }
.dashboard-hero h1 { max-width: 800px; color: #fff; font-size: clamp(32px, 4.4vw, 64px); line-height: .98; letter-spacing: -.055em; font-weight: 760; }
.dashboard-hero p { max-width: 62ch; color: rgba(238, 246, 255, .76); font-size: 15px; }
.hero-actions, .action-panel-links { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-primary { border-color: #b8f7e6; background: #b8f7e6; color: #0a192f; }
.hero-primary:hover { border-color: #7ee8d6; background: #7ee8d6; color: #081323; }
.hero-secondary { border-color: rgba(255,255,255,.33); background: rgba(255,255,255,.08); color: #fff; }
.hero-secondary:hover { border-color: #fff; background: #fff; color: #0a192f; }
.hero-art { position: relative; min-height: 210px; display: grid; place-items: center; }
.hero-art-core { position: relative; z-index: 1; display: grid; place-items: center; width: 128px; aspect-ratio: 1; border: 1px solid rgba(255,255,255,.55); border-radius: 50%; background: rgba(11, 31, 57, .72); box-shadow: 0 0 0 13px rgba(255,255,255,.05), 0 20px 60px rgba(0,0,0,.25); color: #fff; font-size: 19px; font-weight: 720; line-height: 1.05; text-align: center; }
.orbit { position: absolute; border: 1px solid rgba(184,247,230,.45); border-radius: 50%; transform: rotate(-25deg); }
.orbit-a { width: 250px; height: 105px; }.orbit-b { width: 195px; height: 240px; transform: rotate(55deg); }.orbit-c { width: 300px; height: 300px; border-style: dashed; opacity: .45; }
.bento-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-flow: dense; gap: 12px; }
.bento-card { display: grid; gap: 10px; min-height: 158px; padding: 22px; border: 1px solid #dce6f2; border-radius: 18px; background: #fff; box-shadow: 0 12px 28px rgba(35, 58, 82, .06); transition: transform .35s ease, box-shadow .35s ease; }
.bento-card:hover, .portfolio-card:hover { transform: translateY(-4px); box-shadow: 0 20px 42px rgba(35, 58, 82, .12); }
.bento-card span, .analysis-metrics span, .portfolio-values span { color: #64748b; font-size: 12px; font-weight: 700; }.bento-card strong { align-self: end; font-size: clamp(33px, 4vw, 52px); line-height: .9; letter-spacing: -.06em; }.bento-card p { color: #64748b; font-size: 13px; }
.bento-wide { grid-column: span 6; background: linear-gradient(135deg, #f7fbff, #ecf7ff); }.bento-dark { grid-column: span 3; color: #fff; background: linear-gradient(145deg, #162a4a, #264d68); }.bento-dark span, .bento-dark p { color: rgba(255,255,255,.72); }.bento-accent { grid-column: span 3; background: linear-gradient(145deg, #e0fff8, #c8f3e6); }
.analysis-shell { display: grid; gap: 20px; padding: clamp(20px, 3.2vw, 38px); border: 1px solid #dbe7f2; border-radius: 24px; background: #fff; box-shadow: 0 16px 42px rgba(35,58,82,.07); }
.analysis-heading, .section-title-row { display: flex; align-items: end; justify-content: space-between; gap: 18px; }.analysis-heading h2, .section-title-row h2, .action-panel h2 { font-size: clamp(24px, 3vw, 38px); letter-spacing: -.045em; }.analysis-heading strong { max-width: 260px; color: #163d5c; font-size: 13px; text-align: right; }
.analysis-metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }.analysis-metrics article { min-width: 0; display: grid; gap: 7px; padding: 14px; border-radius: 13px; background: #f4f8fc; }.analysis-metrics strong { font-size: 20px; letter-spacing: -.04em; overflow-wrap: anywhere; }.analysis-metrics small { color: #64748b; font-size: 11px; line-height: 1.45; }
.analysis-story { display: grid; grid-template-columns: minmax(230px,.7fr) minmax(0,1.3fr); gap: 24px; align-items: center; padding: 22px; border-radius: 18px; background: linear-gradient(120deg, #f6f8fc, #eef9f6); }.story-copy { display: grid; gap: 8px; }.story-copy > span { color: #17836f; font-size: 12px; font-weight: 750; }.story-copy h3 { font-size: 22px; letter-spacing: -.035em; }.story-copy p { color: #617286; }
.policy-timeline { position: relative; min-height: 160px; border-left: 1px solid #bdd0df; }.policy-timeline::before { content: "观察窗口"; position: absolute; left: 0; bottom: -6px; color: #7890a5; font-size: 11px; transform: translateY(100%); }.policy-band { position: absolute; left: var(--left); width: var(--width); min-width: 145px; display: grid; gap: 5px; padding: 13px; border-radius: 13px; color: #0f2535; box-shadow: 0 12px 20px rgba(25,56,79,.12); }.policy-band:nth-child(odd) { top: 8px; }.policy-band:nth-child(even) { top: 76px; }.policy-band span { font-size: 11px; font-weight: 760; }.policy-band strong { font-size: 13px; }.policy-band small { font-size: 10px; color: #496176; }.policy-band-24 { background: #b8f7e6; }.policy-band-30 { background: #c7dcff; }.policy-band-35 { background: #d9ccff; }
.evidence-table-wrap { overflow-x: auto; border: 1px solid #e0e8f1; border-radius: 15px; }.evidence-table { min-width: 760px; }.evidence-table th { padding: 12px 15px; background: #f7fafc; }.evidence-table td { padding: 14px 15px; color: #31475b; }.analysis-disclaimer { padding-top: 2px; color: #64748b; font-size: 12px; }
.portfolio-section { display: grid; gap: 16px; }.portfolio-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }.portfolio-card { display: grid; gap: 15px; min-width: 0; padding: 19px; border: 1px solid #dce6f2; border-radius: 18px; background: #fff; box-shadow: 0 8px 22px rgba(35,58,82,.05); transition: transform .35s ease, box-shadow .35s ease; }.portfolio-card-head { display: flex; align-items: start; justify-content: space-between; gap: 8px; }.portfolio-card-head h3 { font-size: 17px; }.portfolio-card-head > div > span, .portfolio-meta, .portfolio-card p { color: #6b7e90; font-size: 12px; }.portfolio-values { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }.portfolio-values div { display: grid; gap: 4px; min-width: 0; }.portfolio-values strong { font-size: 17px; letter-spacing: -.04em; overflow-wrap: anywhere; }.portfolio-meta { display: flex; flex-wrap: wrap; gap: 8px; }.portfolio-meta span { padding: 4px 7px; border-radius: 999px; background: #f1f6fb; }.portfolio-card > a { color: #126c9d; font-weight: 750; }
.action-panel { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: clamp(24px,4vw,48px); border-radius: 24px; background: #122642; color: #fff; }.action-panel h2 { color: #fff; }.action-panel p { max-width: 62ch; margin-top: 8px; color: rgba(255,255,255,.72); }.action-panel .hero-eyebrow { color: #7ee8d6; }

@media (max-width: 1180px) { .analysis-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }.portfolio-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 860px) { .dashboard-page { gap: 16px; }.dashboard-hero { grid-template-columns: 1fr; min-height: 0; padding: 28px; }.hero-art { min-height: 150px; }.bento-wide, .bento-dark, .bento-accent { grid-column: span 12; }.analysis-heading, .section-title-row, .action-panel { display: grid; align-items: start; }.analysis-heading strong { text-align: left; }.analysis-metrics, .portfolio-grid, .analysis-story { grid-template-columns: 1fr; }.policy-timeline { min-height: 230px; }.policy-band { position: relative; left: auto; top: auto !important; width: 100%; min-width: 0; margin-bottom: 8px; }.policy-timeline::before { display: none; }.action-panel-links .button { width: 100%; } }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

h1, h2, h3, p { margin: 0; letter-spacing: 0; }
h1 { font-size: 28px; line-height: 1.18; font-weight: 650; }
h2 { font-size: 17px; line-height: 1.25; font-weight: 650; }
h3 { font-size: 14px; line-height: 1.25; font-weight: 650; }

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 8px 13px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  transition: background 160ms ease, border-color 160ms ease, transform 120ms ease, box-shadow 160ms ease;
}

button:hover,
.button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}

button:active,
.button:active { transform: translateY(1px); }

button:focus-visible,
.button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, white);
  outline-offset: 2px;
}

button.ghost,
.button.ghost {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--text);
}

button.ghost:hover,
.button.ghost:hover {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent-strong);
}

.button.full { width: 100%; }

.text-action {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  font-weight: 650;
  white-space: nowrap;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 600;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  min-height: 38px;
}

.check input { width: auto; }
form { margin: 0; }

.app-frame {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}

.app-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.brand {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--text);
  padding: 0 8px;
}

.brand:hover { color: var(--text); }

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
  font-size: 18px;
}

.brand strong,
.brand span span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand span span {
  color: var(--muted);
  font-size: 12px;
}

.side-nav {
  display: grid;
  gap: 4px;
}

.side-nav a {
  display: flex;
  align-items: center;
  min-height: 38px;
  border-radius: 8px;
  padding: 8px 11px;
  color: var(--muted);
  font-weight: 600;
}

.side-nav a:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.side-nav a.active {
  background: var(--accent-weak);
  color: var(--accent-strong);
}

.rail-logout {
  margin-top: auto;
  padding: 0 8px;
}

.rail-logout button { width: 100%; }

.workspace {
  min-width: 0;
  width: 100%;
  max-width: 1540px;
  padding: 26px 28px 36px;
}

.screen-head,
.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.screen-label,
.hero-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
}

.screen-head p,
.toolbar p,
.panel-head p,
.section-head p,
.side-card p,
.surface-panel > p {
  max-width: 78ch;
  color: var(--muted);
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-strip > div,
.stat-card,
.metric-grid > div {
  min-width: 0;
  min-height: 92px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 14px;
}

.summary-strip span,
.stat-card span,
.metric-grid span,
.asset-row span {
  color: var(--muted);
  font-size: 13px;
}

.summary-strip strong,
.stat-card strong,
.metric-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 24px;
  line-height: 1.15;
  font-weight: 720;
}

.profitability-panel { margin-bottom: 16px; }
.rules-panel { margin-bottom: 16px; }

.profit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.profit-grid > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.profit-grid span,
.profit-grid small { color: var(--muted); font-size: 12px; }
.profit-grid strong { font-size: 20px; overflow-wrap: anywhere; }
.calculation-note { margin: 14px 0 0; color: var(--muted); font-size: 13px; }

.rule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.rule-grid article {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.rule-grid strong { font-size: 21px; overflow-wrap: anywhere; }
.rule-grid span, .rule-grid p, .rule-grid small { margin: 0; color: var(--muted); font-size: 12px; }
.rule-grid p { line-height: 1.65; }

.ops-grid,
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-areas: "main side";
  gap: 16px;
  align-items: start;
}

.ops-grid > .surface-panel,
.detail-main { grid-area: main; }
.ops-grid > .detail-panel,
.detail-side { grid-area: side; }

.surface-panel,
.side-card,
.panel,
.table-wrap {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 16px;
}

.surface-panel,
.side-card,
.panel {
  box-shadow: 0 1px 2px rgba(32, 33, 36, 0.04);
}

.detail-main,
.detail-side,
.detail-panel {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.panel-head,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2,
.section-head h2,
.side-card h2 { margin-bottom: 4px; }

.muted {
  display: block;
  color: var(--muted);
}

.inline-muted {
  display: inline;
  margin-left: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.state-dot,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef1f5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.state-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 999px;
  background: currentColor;
}

.state-dot.ok,
.pill.ok {
  background: var(--success-bg);
  color: var(--success);
}

.state-dot.off,
.pill.off {
  background: #f1f3f4;
  color: var(--muted);
}

.pill.warn,
.state-dot.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.pill.danger,
.state-dot.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.device-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 26px;
  margin: 6px 6px 0 0;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-chip.risk { background: var(--danger-bg); color: var(--danger); }
.device-chip.ready { background: var(--success-bg); color: var(--success); }
.device-chip.waiting { background: var(--warn-bg); color: var(--warn); }

.risk-card,
.asset-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 16px;
}

.risk-card { background: #fffdf8; }

.risk-list,
.profile-list,
.asset-list,
.reward-list,
.device-notes {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.risk-list > div,
.profile-list > div,
.asset-row {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.risk-list strong,
.profile-list strong,
.asset-row strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.profile-list .muted {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.profile-kv {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
}

.profile-kv > div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.profile-kv dt,
.profile-kv dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.profile-kv dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.profile-kv dd { color: var(--text); }

.profile-path {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 150px;
  overflow: auto;
  margin-top: 8px;
  padding-right: 2px;
}

.path-chip {
  display: inline-flex;
  max-width: 100%;
  min-height: 24px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.asset-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.asset-row + .asset-row { margin-top: 8px; }
.asset-card .button { margin-top: 12px; }

.empty {
  color: var(--muted);
  text-align: center;
  padding: 18px;
}

.alert {
  margin-bottom: 14px;
  border: 1px solid #e9b8b4;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  padding: 10px 12px;
  font-weight: 600;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-grid-wide { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.table-wrap {
  overflow-x: auto;
  padding: 0;
}

.surface-panel > .table-wrap,
.side-card > .table-wrap {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

td { min-width: 0; }
tr:last-child td { border-bottom: 0; }
tr.row-risk td { background: #fff8f7; }

.long-value {
  max-width: 720px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.records-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.management-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.wide { min-width: 0; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.side-card .form-grid { grid-template-columns: 1fr; }
.form-grid label { margin-bottom: 0; }
.form-grid button { min-height: 38px; }
.list { margin: 0; padding-left: 18px; }
.actions { white-space: nowrap; }
.actions form { display: inline; }
.actions button {
  min-height: 30px;
  padding: 5px 9px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(180deg, #f7faff 0%, #eef3fb 100%);
}

.auth-panel {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 24px;
  box-shadow: 0 14px 34px rgba(32, 33, 36, 0.08);
}

.auth-panel h1 { margin-bottom: 8px; }
.auth-panel p { margin-bottom: 14px; color: var(--muted); }

@media (max-width: 1080px) {
  .profit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rule-grid { grid-template-columns: 1fr; }
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-grid,
  .detail-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "side"
      "main";
  }
  .detail-panel,
  .detail-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .detail-panel > :first-child,
  .detail-side > :first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .app-frame { display: block; }
  .app-rail {
    position: static;
    height: auto;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    gap: 12px;
  }
  .brand { padding: 0; }
  .side-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .side-nav a {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 10px;
  }
  .rail-logout { display: none; }
  .workspace { padding: 16px 12px 28px; }
  .screen-head,
  .toolbar {
    display: grid;
    gap: 12px;
  }
  .inline-actions,
  .inline-actions form,
  .inline-actions button,
  .inline-actions .button {
    width: 100%;
    justify-content: center;
  }
  h1 { font-size: 23px; }
  .summary-strip,
  .profit-grid,
  .metric-grid,
  .management-grid,
  .records-grid,
  .detail-panel,
  .detail-side,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .summary-strip > div,
  .metric-grid > div {
    min-height: 78px;
  }
  .surface-panel,
  .side-card,
  .panel {
    padding: 14px;
  }
  .table-wrap {
    overflow-x: visible;
    padding: 0;
  }
  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap th,
  .table-wrap td {
    display: block;
  }
  .table-wrap thead { display: none; }
  .table-wrap tr {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    padding: 8px;
    margin-bottom: 10px;
  }
  .table-wrap tr:last-child { margin-bottom: 0; }
  .table-wrap td {
    border-bottom: 0;
    display: grid;
    grid-template-columns: minmax(88px, 34%) minmax(0, 1fr);
    gap: 10px;
    padding: 8px 4px;
  }
  .table-wrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
  }
  .table-wrap td.empty,
  .table-wrap td[colspan] {
    display: block;
  }
  .table-wrap td.empty::before,
  .table-wrap td[colspan]::before {
    content: "";
    display: none;
  }
  .asset-row {
    display: grid;
    gap: 4px;
  }
  .device-chip {
    white-space: normal;
    overflow: visible;
  }
  .long-value { max-width: none; }
}

/* Phone-first dashboard density: summary before detail, without page-level horizontal scroll. */
.mobile-evidence-details { border: 0; }
.mobile-evidence-details summary { cursor: pointer; color: #126c9d; font-weight: 750; }
.mobile-accounts-toggle { display: none; }
.dashboard-view[hidden] { display: none !important; }
.dashboard-switcher { position: sticky; top: 10px; z-index: 5; display: flex; align-items: center; gap: 6px; width: max-content; max-width: 100%; padding: 6px; overflow-x: auto; border: 1px solid rgba(190, 209, 226, .9); border-radius: 14px; background: rgba(255, 255, 255, .9); box-shadow: 0 10px 24px rgba(34, 59, 82, .09); backdrop-filter: blur(12px); }
.dashboard-tab { min-height: 34px; border: 0; border-radius: 9px; background: transparent; color: #63778a; padding: 7px 12px; font-size: 13px; font-weight: 750; white-space: nowrap; }
.dashboard-tab:hover { background: #eef5fb; color: #1b4c70; }
.dashboard-tab.is-active { background: #163d5c; color: #fff; box-shadow: none; }

@media (max-width: 640px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .workspace { padding: 10px 10px 30px; }
  .dashboard-page { gap: 14px; width: 100%; }
  .dashboard-switcher { top: 6px; width: 100%; border-radius: 12px; }
  .dashboard-tab { flex: 1 0 auto; min-height: 38px; padding: 8px 12px; }
  .dashboard-hero { min-height: 0; padding: 22px 18px; gap: 12px; border-radius: 18px; }
  .dashboard-hero h1 { font-size: clamp(26px, 8vw, 34px); line-height: 1.02; letter-spacing: -.045em; }
  .dashboard-hero p { font-size: 13px; line-height: 1.6; }
  .hero-copy { gap: 13px; }
  .hero-art { display: none; }
  .hero-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .hero-actions .button { width: 100%; min-height: 42px; }
  .bento-grid { gap: 8px; }
  .bento-card { min-height: 0; gap: 7px; padding: 16px; border-radius: 16px; }
  .bento-card strong { font-size: 34px; }
  .analysis-shell { gap: 15px; padding: 16px; border-radius: 18px; }
  .analysis-heading, .section-title-row { gap: 8px; }
  .analysis-heading h2, .section-title-row h2, .action-panel h2 { font-size: 25px; line-height: 1.08; }
  .analysis-heading strong { max-width: none; font-size: 12px; }
  .analysis-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .analysis-metrics article { min-height: 96px; padding: 12px; gap: 5px; }
  .analysis-metrics strong { font-size: 17px; line-height: 1.05; }
  .analysis-metrics small { font-size: 10px; }
  .analysis-story { gap: 14px; padding: 16px; border-radius: 15px; }
  .story-copy h3 { font-size: 20px; }
  .policy-timeline { min-height: 0; border-left: 0; }
  .policy-band { padding: 12px; margin-bottom: 7px; border-radius: 12px; }
  .mobile-evidence-details { border: 1px solid #dbe7f2; border-radius: 14px; background: #f8fbff; }
  .mobile-evidence-details summary { padding: 13px 14px; font-size: 13px; }
  .mobile-evidence-details[open] summary { border-bottom: 1px solid #dbe7f2; }
  .mobile-evidence-details .evidence-table-wrap { border: 0; border-radius: 0 0 14px 14px; max-width: 100%; }
  .evidence-table { min-width: 620px; font-size: 12px; }
  .evidence-table th, .evidence-table td { padding: 11px 12px; white-space: nowrap; }
  .portfolio-section { gap: 12px; }
  .portfolio-grid { grid-template-columns: 1fr !important; gap: 9px; }
  .portfolio-grid.mobile-collapsed .portfolio-card:nth-child(n + 4) { display: none; }
  .portfolio-card { gap: 12px; padding: 16px; border-radius: 16px; }
  .portfolio-values { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .portfolio-values > :last-child { grid-column: 1 / -1; }
  .portfolio-values strong { font-size: 18px; }
  .mobile-accounts-toggle { display: inline-flex; width: 100%; min-height: 42px; justify-content: center; margin-top: 2px; border-color: #bfd4e8; background: #f4f8fc; color: #165a86; }
  .action-panel { gap: 16px; padding: 22px 18px; border-radius: 18px; }
  .action-panel-links { display: grid; grid-template-columns: 1fr; }
  .action-panel-links .button { min-height: 42px; }
}

/* Account details use the same compact interaction model as a native app. */
.account-view[hidden] { display: none !important; }
.account-app { display: grid; gap: 16px; }
.account-switcher { position: sticky; top: 10px; z-index: 5; display: flex; gap: 6px; width: max-content; max-width: 100%; padding: 6px; overflow-x: auto; border: 1px solid rgba(190, 209, 226, .9); border-radius: 14px; background: rgba(255,255,255,.9); box-shadow: 0 10px 24px rgba(34,59,82,.09); backdrop-filter: blur(12px); }
.account-tab { min-height: 34px; border: 0; border-radius: 9px; background: transparent; color: #63778a; padding: 7px 12px; font-size: 13px; font-weight: 750; white-space: nowrap; }
.account-tab:hover { background: #eef5fb; color: #1b4c70; }
.account-tab.is-active { background: #163d5c; color: #fff; box-shadow: none; }
.detail-grid.only-main { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main"; }
.detail-grid.only-side { grid-template-columns: minmax(0, 1fr); grid-template-areas: "side"; }
.app-detail-toggle { display: none; }

@media (max-width: 640px) {
  .account-app { gap: 12px; }
  .account-app .screen-head { margin-bottom: 0; padding: 4px 2px 0; }
  .account-app .screen-head h1 { font-size: clamp(24px, 7vw, 32px); line-height: 1.05; }
  .account-app .screen-head p { margin-top: 4px; font-size: 12px; }
  .account-app .status-row { gap: 5px; }
  .account-app .pill { font-size: 11px; }
  .account-switcher { top: 6px; width: 100%; border-radius: 12px; }
  .account-tab { flex: 1 0 auto; min-height: 38px; padding: 8px 12px; }
  .account-app .inline-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .account-app .inline-actions form, .account-app .inline-actions button { width: 100%; }
  .account-app .surface-panel, .account-app .side-card { padding: 16px; border-radius: 16px; }
  .account-app .panel-head { display: grid; gap: 8px; }
  .account-app .panel-head h2, .account-app .side-card h2 { font-size: 20px; }
  .account-app .panel-head p, .account-app .side-card p { font-size: 12px; line-height: 1.6; }
  .account-app .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 0; }
  .account-app .summary-strip > div { min-height: 86px; padding: 12px; border-radius: 14px; }
  .account-app .summary-strip strong { font-size: 21px; }
  .account-app .profit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .account-app .profit-grid > div { min-height: 84px; padding: 11px; border-radius: 12px; }
  .account-app .profit-grid strong { font-size: 18px; }
  .account-app .calculation-note { font-size: 12px; line-height: 1.6; }
  .account-app .rule-grid { gap: 9px; }
  .account-app .rule-grid article { padding: 14px; border-radius: 14px; }
  .account-app .rule-grid strong { font-size: 20px; }
  .account-app .detail-grid { display: block; }
  .account-app .detail-main, .account-app .detail-side { gap: 10px; }
  .account-app .activity-collapsed [data-activity-extra], .account-app .management-collapsed [data-management-extra] { display: none; }
  .app-detail-toggle { display: inline-flex; width: 100%; min-height: 42px; justify-content: center; border-color: #bfd4e8; background: #f4f8fc; color: #165a86; }
  .account-app .table-wrap { border-radius: 12px; }
  .account-app .table-wrap td { font-size: 13px; }
}

/* Shared mobile application shell. */
.app-frame { display: block; min-height: 100dvh; padding-bottom: 88px; }
.app-topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 62px; padding: 10px max(16px, calc((100vw - 1120px) / 2)); border-bottom: 1px solid rgba(210, 222, 234, .85); background: rgba(248,250,253,.92); backdrop-filter: blur(16px); }
.app-topbar .brand { grid-template-columns: 34px minmax(0, 1fr); gap: 9px; padding: 0; }
.app-topbar .brand-mark { width: 34px; height: 34px; border-radius: 11px; font-size: 15px; }
.app-topbar .brand strong { font-size: 14px; }
.app-topbar .brand span span { font-size: 11px; }
.app-logout button { min-height: 34px; border-color: transparent; background: transparent; color: #63778a; padding: 6px 8px; }
.app-logout button:hover { background: #eef4fa; color: #173d5a; }
.workspace { max-width: 1120px; margin: 0 auto; padding: 22px 20px 34px; }
.app-bottom-nav { position: fixed; right: 50%; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 30; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: min(500px, calc(100vw - 20px)); transform: translateX(50%); padding: 6px; border: 1px solid rgba(198, 213, 229, .95); border-radius: 19px; background: rgba(255,255,255,.94); box-shadow: 0 14px 36px rgba(21,52,79,.16); backdrop-filter: blur(18px); }
.app-bottom-nav a { display: grid; place-items: center; gap: 3px; min-height: 51px; border-radius: 13px; color: #718397; font-size: 11px; font-weight: 700; }
.app-bottom-nav a:hover { color: #173d5a; background: #eff5fa; }
.app-bottom-nav a.active { color: #fff; background: #173d5a; }
.app-bottom-nav svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.app-screen { display: grid; gap: 14px; }
.app-screen-header { display: flex; align-items: end; justify-content: space-between; gap: 14px; padding: 8px 2px 2px; }
.app-screen-header > div > span { display: block; margin-bottom: 4px; color: #24749a; font-size: 12px; font-weight: 780; }
.app-screen-header h1 { font-size: clamp(25px, 4vw, 36px); letter-spacing: -.045em; }
.app-screen-header p { margin-top: 6px; color: #65798c; }
.screen-count { display: grid; place-items: center; min-width: 54px; min-height: 34px; border-radius: 12px; background: #eaf4fb; color: #1e628a; font-size: 12px; }
.app-disclosure, .app-section-card, .app-empty { border: 1px solid #dbe6f1; border-radius: 18px; background: #fff; box-shadow: 0 5px 18px rgba(34,59,82,.05); }
.app-disclosure summary { cursor: pointer; padding: 16px; color: #193f5c; font-weight: 760; }
.app-disclosure[open] summary { border-bottom: 1px solid #e4edf5; }
.app-form { display: grid; gap: 12px; padding: 16px; }
.app-form label { display: grid; gap: 6px; color: #567086; font-size: 12px; font-weight: 700; }
.app-form input { min-height: 42px; }
.app-form button { min-height: 44px; }
.account-card-list, .run-result-list { display: grid; gap: 10px; }
.account-app-card, .run-result-card { display: grid; gap: 13px; padding: 17px; border: 1px solid #dbe6f1; border-radius: 18px; background: #fff; box-shadow: 0 5px 18px rgba(34,59,82,.05); }
.account-card-head, .run-result-card > div { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.account-card-head h2 { font-size: 18px; }.account-card-head p, .account-card-note { color: #718397; font-size: 12px; }
.account-mini-metrics, .setting-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.account-mini-metrics > div, .setting-summary-grid > div { display: grid; gap: 5px; min-width: 0; padding: 10px; border-radius: 12px; background: #f4f8fc; }
.account-mini-metrics span, .setting-summary-grid span, .run-status-card span { color: #718397; font-size: 11px; font-weight: 700; }
.account-mini-metrics strong, .setting-summary-grid strong { overflow-wrap: anywhere; color: #193f5c; font-size: 15px; letter-spacing: -.03em; }
.account-card-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }.account-card-actions form { display: contents; }.account-card-actions .button, .account-card-actions button { min-height: 40px; }
.run-status-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; padding: 19px; border-radius: 18px; background: linear-gradient(135deg, #173d5a, #245c7f); color: #fff; }.run-status-card span, .run-status-card p { color: rgba(255,255,255,.7); }.run-status-card strong { display: block; margin-top: 4px; font-size: 24px; }.run-status-card p { margin-top: 5px; font-size: 12px; }
.run-result-card p, .run-result-card small { color: #647a8e; }.run-result-card small { font-size: 12px; }
.app-section-card { display: grid; gap: 14px; padding: 17px; }.app-section-card h2 { font-size: 18px; }.channel-list { display: grid; gap: 8px; }.channel-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid #e9eff5; }.channel-list > div:last-child { border-bottom: 0; }.channel-list span { color: #63788c; }.channel-list strong { color: #247352; }
.app-empty { display: grid; gap: 6px; padding: 24px 18px; color: #5f7387; text-align: center; }.app-empty strong { color: #193f5c; font-size: 16px; }

@media (max-width: 640px) {
  body { font-size: 14px; line-height: 1.48; }
  .app-frame { padding-bottom: 94px; }
  .app-topbar { min-height: 58px; padding: 8px 14px; }
  .workspace { padding: 14px 12px 24px; }
  .app-bottom-nav { bottom: max(8px, env(safe-area-inset-bottom)); width: calc(100vw - 16px); border-radius: 18px; }
  .app-bottom-nav a { min-height: 52px; font-size: 10px; }
  .app-screen { gap: 12px; }
  .app-screen-header { align-items: start; padding: 3px 2px; }
  .app-screen-header h1 { font-size: 27px; line-height: 1.08; }
  .app-screen-header p { font-size: 12px; line-height: 1.55; }
  .account-mini-metrics, .setting-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-card-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }.account-card-actions .button { grid-column: 1 / -1; }
  .account-card-actions form { display: block; }.account-card-actions button { width: 100%; }
  .run-status-card { grid-template-columns: 1fr; }.run-status-card strong { font-size: 21px; }
  .app-disclosure, .app-section-card, .account-app-card, .run-result-card, .app-empty { border-radius: 16px; }
}
