:root {
  color-scheme: dark;
  --navy-950: #050b16;
  --navy-925: #08111f;
  --navy-900: #0a1425;
  --navy-850: #0e1a2e;
  --navy-800: #13213a;
  --navy-760: #182944;
  --line: rgba(181, 198, 224, 0.13);
  --line-strong: rgba(221, 188, 101, 0.32);
  --text: #f4f7fb;
  --text-soft: #bec9d8;
  --muted: #8795aa;
  --gold: #e4bd5b;
  --gold-light: #ffe7a0;
  --gold-dark: #9b6b16;
  --red: #ed5b55;
  --red-soft: #ff8a82;
  --green: #38c992;
  --cyan: #64c6dc;
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.38);
  --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.24);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --safe-left: max(18px, env(safe-area-inset-left));
  --safe-right: max(18px, env(safe-area-inset-right));
}

/* Historical review is a clean-room result viewer.  Its layout mirrors the
   private report while all data still arrives through the public allowlist. */
.viewer-page .review-page-section {
  --review-ink: #17212b;
  --review-muted: #64717d;
  --review-line: #d9e0e5;
  --review-soft: #f4f6f7;
  --review-paper: #fff;
  color: var(--review-ink);
}

.viewer-page .review-toolbar {
  position: sticky;
  top: 74px;
  z-index: 14;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--review-line);
  border-radius: 10px 10px 0 0;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 22px rgba(23, 33, 43, 0.08);
  backdrop-filter: blur(10px);
}

.viewer-page .review-toolbar > strong {
  margin-right: auto;
  white-space: nowrap;
}

.viewer-page .review-toolbar select,
.viewer-page .review-toolbar input,
.viewer-page .review-toolbar button,
.viewer-page .review-error button {
  min-height: 36px;
  border: 1px solid #bac5cc;
  border-radius: 5px;
  background: #fff;
  color: var(--review-ink);
  font: inherit;
}

.viewer-page .review-toolbar select,
.viewer-page .review-toolbar input {
  padding: 0 10px;
}

.viewer-page .review-toolbar button,
.viewer-page .review-error button {
  padding: 0 14px;
  cursor: pointer;
}

.viewer-page .review-search-label input {
  width: 240px;
}

.viewer-page .review-state {
  display: flex;
  min-height: 260px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--review-line);
  border-top: 0;
  background: var(--review-paper);
  color: var(--review-muted);
}

.viewer-page .review-error {
  flex-direction: column;
}

.viewer-page .review-error strong {
  color: var(--review-ink);
  font-size: 18px;
}

.viewer-page .review-content {
  border: 1px solid var(--review-line);
  border-top: 0;
  background: var(--review-paper);
  min-height: 70vh;
}

.viewer-page .review-report-header {
  padding: 26px 24px 18px;
  border-bottom: 1px solid var(--review-line);
}

.viewer-page .review-report-header h1 {
  margin: 0 0 7px;
  font-size: 28px;
  line-height: 1.3;
}

.viewer-page .review-report-header p {
  margin: 0;
  color: var(--review-muted);
  overflow-wrap: anywhere;
}

.viewer-page .review-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  border-bottom: 1px solid var(--review-line);
}

.viewer-page .review-summary > div {
  padding: 15px 18px;
  border-right: 1px solid var(--review-line);
}

.viewer-page .review-summary > div:last-child {
  border-right: 0;
}

.viewer-page .review-summary span {
  display: block;
  margin-bottom: 5px;
  color: var(--review-muted);
  font-size: 12px;
}

.viewer-page .review-summary strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.viewer-page .review-method {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--review-line);
  background: #f8fafb;
  color: #42515c;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.viewer-page .review-method strong {
  color: var(--review-ink);
}

.viewer-page .review-method small {
  flex-basis: 100%;
  color: var(--review-muted);
}

.viewer-page .review-overview {
  padding: 20px 24px 26px;
  border-bottom: 8px solid #eef1f3;
}

.viewer-page .review-overview h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.viewer-page .review-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--review-line);
  scrollbar-gutter: stable;
}

.viewer-page .review-month-table {
  width: 100%;
  border-collapse: collapse;
}

.viewer-page .review-month-table th,
.viewer-page .review-month-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--review-line);
  text-align: right;
  white-space: nowrap;
}

.viewer-page .review-month-table th:first-child,
.viewer-page .review-month-table td:first-child {
  text-align: left;
}

.viewer-page .review-month-table th {
  background: var(--review-soft);
  color: #4d5b65;
}

.viewer-page .review-month-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: #285f96;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.viewer-page .review-month-link:hover,
.viewer-page .review-month-link:focus-visible {
  text-decoration: underline;
}

.viewer-page .review-month-section {
  border-bottom: 10px solid #eef1f3;
  scroll-margin-top: 132px;
}

.viewer-page .review-zero-month {
  margin: 20px 24px 24px;
  padding: 22px;
  border: 1px dashed #bac5cc;
  border-radius: 6px;
  background: #f8fafb;
  color: var(--review-muted);
  text-align: center;
}

.viewer-page .review-month-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--review-line);
}

.viewer-page .review-month-kicker {
  color: var(--review-muted);
  font-size: 12px;
}

.viewer-page .review-month-heading h2 {
  margin: 2px 0 0;
  font-size: 21px;
}

.viewer-page .review-month-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  justify-content: flex-end;
  color: var(--review-muted);
}

.viewer-page .review-month-metrics strong {
  margin-left: 4px;
  color: var(--review-ink);
}

.viewer-page .review-month-metrics strong.value-up,
.viewer-page .review-month-table .value-up,
.viewer-page .review-trade-table .value-up,
.viewer-page .review-day-heading .value-up {
  color: #a3262a;
}

.viewer-page .review-month-metrics strong.value-down,
.viewer-page .review-month-table .value-down,
.viewer-page .review-trade-table .value-down,
.viewer-page .review-day-heading .value-down {
  color: #087b5a;
}

.viewer-page .review-archive-status {
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef3f7;
  color: #526473;
  font-size: 11px;
}

.viewer-page .review-day-block {
  padding: 0 24px 20px;
}

.viewer-page .review-day-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0 8px;
}

.viewer-page .review-day-heading h3 {
  margin: 0;
  font-size: 15px;
}

.viewer-page .review-day-heading > span {
  color: var(--review-muted);
}

.viewer-page .review-trade-table {
  width: 100%;
  min-width: 1700px;
  border-collapse: collapse;
  table-layout: auto;
}

.viewer-page .review-trade-table th,
.viewer-page .review-trade-table td {
  padding: 8px 9px;
  border-right: 1px solid #eef1f3;
  border-bottom: 1px solid #e5eaed;
  text-align: right;
  white-space: nowrap;
  vertical-align: middle;
}

.viewer-page .review-trade-table th {
  background: #f1f4f5;
  color: #43515b;
  font-size: 12px;
}

.viewer-page .review-trade-table tbody tr:hover {
  background: #f8fafb;
}

.viewer-page .review-left {
  text-align: left !important;
}

.viewer-page .review-wrap {
  min-width: 120px;
  max-width: 230px;
  white-space: normal !important;
  line-height: 1.4;
}

.viewer-page .review-exit-reason {
  min-width: 160px;
  max-width: 220px;
  white-space: normal !important;
  line-height: 1.4;
}

.viewer-page .review-stock-name {
  font-weight: 700;
}

.viewer-page .review-source-tag,
.viewer-page .review-time-tag {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 700;
}

.viewer-page .review-source-attribution,
.viewer-page .review-time-1450 {
  background: #e8f0f8;
  color: #285f96;
}

.viewer-page .review-source-parent,
.viewer-page .review-time-0930 {
  background: #e6f2ef;
  color: #155c54;
}

.viewer-page .review-time-0935,
.viewer-page .review-time-1420 {
  background: #f8eedc;
  color: #8a5b13;
}

.viewer-page .review-time-0941,
.viewer-page .review-time-1421 {
  background: #f5e9f3;
  color: #7a3d76;
}

.viewer-page .review-empty {
  padding: 50px;
  text-align: center;
  color: var(--review-muted);
}

.viewer-page .review-footer {
  padding: 18px 24px 28px;
  color: var(--review-muted);
  font-size: 12px;
}

@media (max-width: 900px) {
  .viewer-page .review-toolbar {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    padding: 9px;
  }

  .viewer-page .review-toolbar > strong,
  .viewer-page .review-search-label {
    grid-column: 1 / -1;
    margin: 0;
  }

  .viewer-page .review-toolbar select,
  .viewer-page .review-toolbar input,
  .viewer-page .review-toolbar button,
  .viewer-page .review-toolbar label {
    width: 100%;
    min-width: 0;
  }

  .viewer-page .review-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .viewer-page .review-summary > div:nth-child(2n) {
    border-right: 0;
  }

  .viewer-page .review-report-header,
  .viewer-page .review-method,
  .viewer-page .review-overview,
  .viewer-page .review-day-block {
    padding-left: 14px;
    padding-right: 14px;
  }

  .viewer-page .review-month-heading,
  .viewer-page .review-day-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .viewer-page .review-month-metrics {
    justify-content: flex-start;
  }
}

@media print {
  .viewer-page .viewer-sidebar,
  .viewer-page .viewer-topbar,
  .viewer-page .stale-banner,
  .viewer-page .viewer-footer,
  .viewer-page .review-toolbar,
  .viewer-page .ambient {
    display: none !important;
  }

  .viewer-page .viewer-workspace,
  .viewer-page .viewer-shell {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .viewer-page .viewer-page-section {
    display: none !important;
  }

  .viewer-page #backtest {
    display: block !important;
  }

  .viewer-page .review-month-section {
    break-before: page;
  }

  .viewer-page .review-table-wrap {
    overflow: visible;
  }

  .viewer-page .review-trade-table {
    min-width: 0;
    font-size: 8px;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 16% -8%, rgba(36, 65, 108, 0.55), transparent 36rem),
    radial-gradient(circle at 100% 18%, rgba(147, 98, 19, 0.14), transparent 30rem),
    linear-gradient(160deg, var(--navy-925), var(--navy-950) 72%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
select,
label,
a {
  -webkit-tap-highlight-color: transparent;
}

button,
select {
  cursor: pointer;
}

button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3,
strong {
  letter-spacing: -0.02em;
}

:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 3px;
}

::selection {
  color: var(--navy-950);
  background: var(--gold-light);
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
}

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

.nowrap {
  white-space: nowrap;
}

.is-hidden {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(90px);
  opacity: 0.13;
}

.ambient-one {
  top: 8rem;
  left: -15rem;
  background: #4d78b1;
}

.ambient-two {
  right: -13rem;
  bottom: 8%;
  background: #ba7d23;
}

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px var(--safe-right) 13px var(--safe-left);
  border-bottom: 1px solid var(--line);
  background: rgba(5, 11, 22, 0.8);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(20px) saturate(135%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  flex: 0 0 auto;
  border-radius: 13px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(255, 231, 160, 0.08);
}

.brand-copy {
  display: grid;
  line-height: 1.18;
}

.brand-copy strong {
  color: #fff8e8;
  font-size: 17px;
  font-weight: 760;
  letter-spacing: 0.04em;
}

.brand-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.topbar-meta,
.viewer-status-cluster {
  display: flex;
  align-items: center;
  gap: 16px;
}

.connection-pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  min-height: 30px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.035);
  font-size: 12px;
  font-weight: 680;
  white-space: nowrap;
}

.connection-pill i,
.status-badge i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 4px rgba(135, 149, 170, 0.1);
}

.connection-pill.is-live,
.connection-pill.source-online,
.status-badge.status-active {
  color: #bdf4de;
  border-color: rgba(56, 201, 146, 0.25);
  background: rgba(56, 201, 146, 0.08);
}

.connection-pill.is-live i,
.connection-pill.source-online i,
.status-badge.status-active i {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(56, 201, 146, 0.13), 0 0 16px rgba(56, 201, 146, 0.5);
}

.connection-pill.is-polling,
.connection-pill.source-stale,
.status-badge.status-paused {
  color: #ffe7a0;
  border-color: rgba(228, 189, 91, 0.28);
  background: rgba(228, 189, 91, 0.08);
}

.connection-pill.is-polling i,
.connection-pill.source-stale i,
.status-badge.status-paused i {
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(228, 189, 91, 0.13);
}

.connection-pill.is-offline,
.connection-pill.source-offline,
.status-badge.status-revoked {
  color: #ffc4c0;
  border-color: rgba(237, 91, 85, 0.28);
  background: rgba(237, 91, 85, 0.08);
}

.connection-pill.is-offline i,
.connection-pill.source-offline i,
.status-badge.status-revoked i {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(237, 91, 85, 0.13);
}

.connection-pill.is-connecting i {
  background: var(--cyan);
  animation: status-pulse 1.3s ease-in-out infinite;
}

.status-badge.status-expired {
  color: #b5c0d0;
  background: rgba(135, 149, 170, 0.08);
}

.page-shell {
  width: min(1480px, calc(100% - 36px));
  margin: 0 auto;
  padding: 44px 0 max(64px, env(safe-area-inset-bottom));
}

.admin-shell {
  width: min(1240px, calc(100% - 36px));
}

.admin-page.is-embedded > .topbar {
  display: none;
}

.admin-page.is-embedded .admin-shell {
  padding-top: 24px;
}

.admin-hero,
.viewer-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 48px;
  margin: 10px 0 32px;
}

.admin-hero > div:first-child,
.viewer-hero > div:first-child {
  max-width: 760px;
}

.eyebrow,
.section-kicker {
  margin-bottom: 9px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 780;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.admin-hero h1,
.viewer-hero h1 {
  margin-bottom: 13px;
  color: #fff;
  font-size: clamp(32px, 5vw, 58px);
  font-weight: 750;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.admin-hero h1 {
  font-size: clamp(30px, 4.6vw, 52px);
}

.hero-copy {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--text-soft);
  font-size: 16px;
  line-height: 1.75;
}

.security-note,
.market-session-card {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 13px;
  min-width: 250px;
  padding: 17px 19px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(228, 189, 91, 0.09), rgba(13, 25, 45, 0.76));
  box-shadow: var(--shadow-md);
}

.security-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(228, 189, 91, 0.3);
  border-radius: 12px;
  color: var(--gold-light);
  background: rgba(228, 189, 91, 0.08);
  font-size: 13px;
  font-weight: 760;
}

.security-note div,
.market-session-card {
  display: grid;
}

.security-note strong {
  color: #fff6df;
}

.security-note small,
.market-session-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 44%),
    rgba(10, 20, 37, 0.82);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
}

.panel::before {
  position: absolute;
  top: 0;
  right: 9%;
  left: 9%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 231, 160, 0.32), transparent);
  content: "";
  pointer-events: none;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 25px 28px 21px;
}

.panel-heading h2 {
  margin: 0;
  color: #f8fafc;
  font-size: 21px;
  line-height: 1.25;
}

.section-kicker {
  margin-bottom: 5px;
  font-size: 10px;
}

.soft-badge,
.count-badge {
  display: inline-flex;
  min-height: 29px;
  align-items: center;
  justify-content: center;
  padding: 5px 11px;
  border: 1px solid rgba(228, 189, 91, 0.2);
  border-radius: 999px;
  color: var(--gold-light);
  background: rgba(228, 189, 91, 0.07);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.count-badge {
  min-width: 31px;
  padding-inline: 9px;
  color: var(--text-soft);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
  font-variant-numeric: tabular-nums;
}

.heading-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.create-panel {
  margin-bottom: 22px;
}

.create-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.create-mode-grid .create-form {
  grid-template-columns: 1fr;
}

.create-mode-grid .ttl-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  padding: 0 28px 22px;
}

.ttl-fieldset {
  min-width: 0;
  padding: 0;
  border: 0;
}

.ttl-fieldset legend,
.field > span {
  margin-bottom: 9px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(118px, 1fr));
  gap: 7px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(3, 9, 18, 0.46);
}

.segmented label {
  position: relative;
  min-width: 0;
}

.segmented input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented span {
  display: grid;
  min-height: 39px;
  place-items: center;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 670;
  white-space: nowrap;
  transition: 160ms ease;
}

.segmented input:hover + span {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.segmented input:checked + span {
  color: #fff1bf;
  border-color: rgba(228, 189, 91, 0.26);
  background: linear-gradient(145deg, rgba(228, 189, 91, 0.17), rgba(228, 189, 91, 0.06));
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.18);
}

.field {
  display: grid;
}

input[type="text"],
input[type="datetime-local"],
select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  background: rgba(3, 9, 18, 0.7);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

input[type="text"],
input[type="datetime-local"] {
  width: 100%;
  padding: 10px 13px;
}

select {
  padding: 9px 38px 9px 12px;
}

input:hover,
select:hover {
  border-color: rgba(181, 198, 224, 0.25);
}

input:focus,
select:focus {
  border-color: rgba(228, 189, 91, 0.48);
  outline: none;
  box-shadow: 0 0 0 3px rgba(228, 189, 91, 0.09);
}

::-webkit-calendar-picker-indicator {
  filter: invert(1) sepia(0.25);
  opacity: 0.72;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 720;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button-primary {
  color: #1e1708;
  border-color: #f3d174;
  background: linear-gradient(135deg, #fff0ae, #e5b94d 56%, #bc8522);
  box-shadow: 0 10px 25px rgba(202, 145, 36, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.button-primary:hover:not(:disabled) {
  box-shadow: 0 13px 30px rgba(202, 145, 36, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.button-large {
  min-height: 49px;
  padding-inline: 19px;
}

.button-secondary,
.button-quiet {
  color: var(--text-soft);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
  color: var(--text);
  border-color: rgba(228, 189, 91, 0.26);
  background: rgba(228, 189, 91, 0.07);
}

.button-danger {
  color: white;
  border-color: rgba(237, 91, 85, 0.7);
  background: linear-gradient(135deg, #f26e67, #c83f3b);
}

.button-ghost-danger {
  color: #ffaaa4;
  border-color: rgba(237, 91, 85, 0.22);
  background: rgba(237, 91, 85, 0.055);
}

.button-ghost-danger:hover:not(:disabled) {
  color: white;
  border-color: rgba(237, 91, 85, 0.5);
  background: rgba(237, 91, 85, 0.16);
}

.button.is-busy {
  animation: busy-fade 900ms ease-in-out infinite alternate;
}

.form-hint {
  margin: 0;
  padding: 0 28px 23px;
  color: var(--muted);
  font-size: 12px;
}

.stats-grid,
.account-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card,
.metric-card {
  position: relative;
  display: grid;
  min-width: 0;
  padding: 20px 21px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(12, 24, 43, 0.72);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.stat-card::after,
.metric-card::after {
  position: absolute;
  right: -22px;
  bottom: -36px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(228, 189, 91, 0.045);
  content: "";
}

.stat-card > span,
.metric-card > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.stat-card strong {
  margin: 4px 0 0;
  color: #fff;
  font-size: 31px;
  font-variant-numeric: tabular-nums;
}

.stat-card small,
.metric-card small {
  color: var(--muted);
  font-size: 11px;
}

.links-panel {
  min-height: 300px;
}

.link-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.compact-select select {
  min-height: 40px;
}

.links-list {
  display: grid;
  gap: 13px;
  padding: 20px;
}

.link-card {
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.027), rgba(3, 9, 18, 0.28));
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.link-card:hover {
  border-color: rgba(181, 198, 224, 0.22);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(3, 9, 18, 0.32));
}

.link-card.status-active {
  border-left-color: rgba(56, 201, 146, 0.62);
}

.link-card.status-paused {
  border-left-color: rgba(228, 189, 91, 0.62);
}

.link-card.status-revoked {
  border-left-color: rgba(237, 91, 85, 0.58);
  opacity: 0.82;
}

.link-card-head,
.link-title-group,
.link-actions,
.share-link-row,
.recipient-note-row,
.extend-control {
  display: flex;
  align-items: center;
}

.link-card-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.link-title-group {
  min-width: 0;
  gap: 11px;
}

.access-mode-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid rgba(181, 198, 224, 0.2);
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.access-mode-badge.is-single_device {
  color: #fff1bf;
  border-color: rgba(228, 189, 91, 0.28);
  background: rgba(228, 189, 91, 0.09);
}

.link-id {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-count {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.share-link-row {
  gap: 8px;
}

.share-link-input {
  color: #d9e3ef !important;
  font-size: 12px !important;
}

.recipient-note-row {
  gap: 8px;
  margin-top: 10px;
}

.recipient-note-label {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.recipient-note-input {
  min-width: 0;
  color: var(--text) !important;
}

.link-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 13px;
}

.link-meta-item {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(2, 8, 16, 0.3);
}

.link-meta-item span {
  color: var(--muted);
  font-size: 10px;
}

.link-meta-item strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-actions {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(181, 198, 224, 0.08);
}

.extend-control {
  flex: 1 1 390px;
  gap: 7px;
}

.extend-select {
  min-width: 160px;
  flex: 0 1 190px;
}

.revoked-note {
  color: var(--red-soft);
  font-size: 12px;
}

.empty-state,
.table-empty,
.record-empty,
.stage-empty {
  color: var(--muted);
  text-align: center;
}

.empty-state {
  padding: 58px 20px 64px;
}

.empty-state h3 {
  margin: 12px 0 4px;
  color: var(--text-soft);
  font-size: 17px;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
}

.empty-symbol {
  display: grid;
  width: 52px;
  height: 52px;
  margin: auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(228, 189, 91, 0.055);
  font-size: 22px;
}

.loading-list {
  display: grid;
  gap: 13px;
  padding: 20px;
}

.skeleton-card {
  height: 184px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.025) 20%, rgba(255, 255, 255, 0.07) 40%, rgba(255, 255, 255, 0.025) 60%);
  background-size: 220% 100%;
  animation: skeleton 1.6s ease infinite;
}

.confirm-dialog {
  width: min(450px, calc(100% - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(237, 91, 85, 0.32);
  border-radius: 22px;
  color: var(--text);
  background: #0b1526;
  box-shadow: var(--shadow-lg);
}

.confirm-dialog::backdrop {
  background: rgba(1, 5, 12, 0.77);
  backdrop-filter: blur(7px);
}

.confirm-dialog form {
  padding: 28px;
  text-align: center;
}

.danger-mark {
  display: grid;
  width: 50px;
  height: 50px;
  margin: 0 auto 16px;
  place-items: center;
  border: 1px solid rgba(237, 91, 85, 0.34);
  border-radius: 50%;
  color: #fff;
  background: rgba(237, 91, 85, 0.15);
  font-size: 23px;
  font-weight: 800;
}

.confirm-dialog h2 {
  margin-bottom: 9px;
  font-size: 22px;
}

.confirm-dialog p {
  color: var(--text-soft);
  font-size: 13px;
}

.dialog-link {
  margin: 17px 0;
  padding: 11px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(2, 8, 16, 0.42);
  font-family: Consolas, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: grid;
  width: min(370px, calc(100% - 36px));
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(12, 24, 43, 0.96);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-mark {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--navy-950);
  background: var(--gold);
  font-size: 12px;
  font-weight: 850;
}

.toast-success .toast-mark {
  background: var(--green);
}

.toast-error {
  border-color: rgba(237, 91, 85, 0.34);
}

.toast-error .toast-mark {
  color: white;
  background: var(--red);
}

.toast-copy {
  color: var(--text-soft);
  font-size: 13px;
}

/* Viewer */

.viewer-topbar {
  gap: 40px;
}

.viewer-status-cluster {
  justify-content: flex-end;
}

.viewer-updated,
.viewer-countdown {
  display: grid;
  line-height: 1.15;
}

.viewer-updated span,
.viewer-countdown span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.viewer-updated strong,
.viewer-countdown strong {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.viewer-countdown strong {
  color: var(--gold-light);
}

.stale-banner {
  position: sticky;
  z-index: 45;
  top: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px var(--safe-right) 8px var(--safe-left);
  border-bottom: 1px solid rgba(228, 189, 91, 0.22);
  color: #f6e4b4;
  background: rgba(100, 70, 18, 0.88);
  backdrop-filter: blur(14px);
  font-size: 12px;
  text-align: center;
}

.stale-banner span {
  color: rgba(255, 244, 214, 0.78);
}

.mobile-jump-nav {
  display: none;
}

.viewer-shell {
  padding-top: 38px;
}

.viewer-hero {
  margin-top: 0;
  margin-bottom: 28px;
}

.market-session-card {
  min-width: 210px;
  align-content: center;
  text-align: right;
}

.market-session-card > span {
  color: var(--muted);
  font-size: 11px;
}

.market-session-card strong {
  margin: 2px 0;
  color: #fff0b2;
  font-size: 24px;
}

.metric-card {
  min-height: 134px;
  justify-content: stretch;
  padding: 22px;
}

.metric-card strong {
  align-self: end;
  margin: 13px 0 5px;
  overflow: hidden;
  color: #f9fbff;
  font-size: clamp(22px, 2.4vw, 31px);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-primary {
  border-color: rgba(228, 189, 91, 0.24);
  background: linear-gradient(145deg, rgba(228, 189, 91, 0.115), rgba(12, 24, 43, 0.76));
}

.value-up {
  color: var(--red-soft) !important;
}

.value-down {
  color: #69d5a9 !important;
}

.value-flat {
  color: var(--text-soft) !important;
}

.stage-panel,
.manual-desk-panel,
.data-panel,
.records-grid {
  margin-bottom: 20px;
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  padding: 0 20px 22px;
}

.stage-card {
  position: relative;
  min-width: 0;
  min-height: 190px;
  padding: 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(3, 9, 18, 0.34);
}

.stage-card::after {
  position: absolute;
  right: -24px;
  bottom: -24px;
  width: 70px;
  height: 70px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 50%;
  content: "";
}

.stage-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.stage-order {
  color: rgba(228, 189, 91, 0.58);
  font-size: 10px;
}

.stage-status {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-time {
  display: block;
  margin: 19px 0 2px;
  color: #fff0ae;
  font-size: 22px;
}

.stage-card h3 {
  margin: 0 0 10px;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-card p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.stage-stock-list {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.stage-stock-row {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.stage-complete {
  border-color: rgba(56, 201, 146, 0.2);
}

.stage-complete .stage-status {
  color: #79dbb4;
}

.stage-current {
  border-color: rgba(228, 189, 91, 0.4);
  background: linear-gradient(145deg, rgba(228, 189, 91, 0.11), rgba(3, 9, 18, 0.37));
  box-shadow: inset 0 1px 0 rgba(255, 231, 160, 0.08), 0 10px 30px rgba(0, 0, 0, 0.17);
}

.stage-current .stage-status {
  color: var(--gold-light);
}

.stage-warning {
  border-color: rgba(237, 91, 85, 0.28);
}

.stage-warning .stage-status {
  color: var(--red-soft);
}

.stage-empty {
  grid-column: 1 / -1;
  padding: 40px 16px;
  border: 1px dashed var(--line);
  border-radius: 15px;
}

.manual-desk-panel {
  border-color: rgba(228, 189, 91, 0.24);
  background:
    radial-gradient(circle at 92% 0, rgba(228, 189, 91, 0.095), transparent 32rem),
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 44%),
    rgba(10, 20, 37, 0.9);
}

.manual-desk-heading {
  align-items: center;
}

.manual-summary {
  min-width: 132px;
}

.manual-stage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 13px;
  padding: 0 22px 24px;
}

.manual-stage-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(3, 9, 18, 0.42);
}

.manual-state-ready {
  border-color: rgba(237, 91, 85, 0.3);
  box-shadow: inset 3px 0 0 rgba(237, 91, 85, 0.72);
}

.manual-state-empty {
  border-color: rgba(56, 201, 146, 0.2);
  box-shadow: inset 3px 0 0 rgba(56, 201, 146, 0.44);
}

.manual-state-warning,
.manual-state-missed {
  border-color: rgba(228, 189, 91, 0.26);
  box-shadow: inset 3px 0 0 rgba(228, 189, 91, 0.58);
}

.manual-stage-header {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(181, 198, 224, 0.085);
  background: rgba(255, 255, 255, 0.018);
}

.manual-stage-title {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 11px;
}

.manual-stage-title strong {
  flex: 0 0 auto;
  color: var(--gold-light);
  font-size: 21px;
}

.manual-stage-title span {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-stage-count,
.manual-buy-badge {
  display: inline-flex;
  min-height: 27px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.manual-state-ready .manual-stage-count,
.manual-buy-badge {
  color: #ffaaa4;
  border-color: rgba(237, 91, 85, 0.26);
  background: rgba(237, 91, 85, 0.09);
}

.manual-state-empty .manual-stage-count {
  color: #79dbb4;
  border-color: rgba(56, 201, 146, 0.2);
  background: rgba(56, 201, 146, 0.07);
}

.manual-stock-list {
  display: grid;
  max-height: 360px;
  overflow-y: auto;
  scrollbar-color: rgba(228, 189, 91, 0.24) transparent;
}

.manual-stock-row {
  display: grid;
  grid-template-columns: minmax(116px, 0.8fr) minmax(124px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(181, 198, 224, 0.07);
}

.manual-stock-row:last-child {
  border-bottom: 0;
}

.manual-stock-identity {
  min-width: 0;
}

.manual-stock-identity strong,
.manual-stock-identity small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-stock-identity strong {
  color: var(--text);
  font-size: 13px;
}

.manual-stock-identity small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.manual-stock-note {
  min-width: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-stage-empty {
  display: grid;
  min-height: 82px;
  align-content: center;
  gap: 4px;
  padding: 15px 16px;
}

.manual-stage-empty strong {
  color: var(--text-soft);
  font-size: 12px;
}

.manual-stage-empty span {
  color: var(--muted);
  font-size: 10px;
}

.data-panel {
  overflow: hidden;
}

.table-wrap {
  position: relative;
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  scrollbar-color: rgba(228, 189, 91, 0.24) transparent;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(181, 198, 224, 0.075);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  background: rgba(2, 8, 16, 0.28);
  font-size: 10px;
  font-weight: 680;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

td {
  color: var(--text-soft);
  font-size: 12px;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.stock-cell {
  min-width: 112px;
}

.stock-cell strong,
.stock-cell small,
td > small {
  display: block;
}

.stock-cell strong {
  color: var(--text);
  font-size: 13px;
}

.stock-cell small,
td > small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.note-cell {
  min-width: 210px;
  max-width: 400px;
  line-height: 1.55;
}

.rank-cell,
.score-cell {
  color: var(--gold-light);
  font-weight: 730;
}

.table-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.03);
  font-size: 10px;
  font-weight: 690;
  white-space: nowrap;
}

.action-buy {
  color: #ffaaa4;
  border-color: rgba(237, 91, 85, 0.23);
  background: rgba(237, 91, 85, 0.075);
}

.action-sell {
  color: #83e1bb;
  border-color: rgba(56, 201, 146, 0.22);
  background: rgba(56, 201, 146, 0.07);
}

.action-hold {
  color: var(--gold-light);
  border-color: rgba(228, 189, 91, 0.22);
  background: rgba(228, 189, 91, 0.07);
}

.neutral-badge,
.risk-badge {
  color: #c7d2e2;
}

.table-empty {
  padding: 42px 18px;
  font-size: 12px;
}

.records-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.record-panel {
  min-width: 0;
}

.record-list {
  display: grid;
  gap: 0;
  max-height: 460px;
  padding: 0 24px 22px;
  overflow-y: auto;
}

.record-item {
  position: relative;
  display: grid;
  grid-template-columns: 11px minmax(0, 1fr);
  gap: 13px;
  padding: 15px 0;
  border-bottom: 1px solid rgba(181, 198, 224, 0.075);
}

.record-item:last-child {
  border-bottom: 0;
}

.record-marker {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(228, 189, 91, 0.085);
}

.record-risk .record-marker {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(237, 91, 85, 0.085);
}

.record-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.record-head strong {
  color: var(--text);
  font-size: 13px;
}

.record-head time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
}

.record-body p {
  margin: 5px 0 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.6;
}

.record-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.record-empty {
  padding: 8px 24px 40px;
  font-size: 12px;
}

.viewer-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 26px 12px 0;
  color: var(--muted);
  font-size: 11px;
}

.viewer-footer img {
  opacity: 0.72;
}

.access-state {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 8, 17, 0.83);
  backdrop-filter: blur(17px) saturate(110%);
}

.access-card {
  width: min(480px, 100%);
  padding: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  background:
    radial-gradient(circle at 50% 0, rgba(228, 189, 91, 0.1), transparent 55%),
    #0b1526;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.access-card img {
  margin: 0 auto 19px;
  border-radius: 18px;
  box-shadow: 0 13px 36px rgba(0, 0, 0, 0.32);
}

.access-card h1 {
  margin-bottom: 10px;
  font-size: 26px;
}

.access-card p:not(.eyebrow) {
  margin: 0 auto;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.7;
}

.access-card .button {
  min-width: 130px;
  margin-top: 22px;
}

.access-state[data-state="revoked"] .access-card,
.access-state[data-state="invalid"] .access-card {
  border-color: rgba(237, 91, 85, 0.28);
}

@keyframes status-pulse {
  0%, 100% { opacity: 0.48; transform: scale(0.82); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes skeleton {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

@keyframes busy-fade {
  from { opacity: 0.62; }
  to { opacity: 0.9; }
}

@media (max-width: 1180px) {
  .create-mode-grid {
    grid-template-columns: 1fr;
  }

  .create-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .create-form > .button {
    grid-column: 2;
    align-self: stretch;
  }

  .stage-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .manual-stage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .page-shell,
  .admin-shell {
    width: min(100% - 28px, 760px);
    padding-top: 30px;
  }

  .admin-hero,
  .viewer-hero {
    align-items: stretch;
    flex-direction: column;
    gap: 20px;
  }

  .security-note,
  .market-session-card {
    min-width: 0;
    width: 100%;
  }

  .market-session-card {
    text-align: left;
  }

  .stats-grid,
  .account-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .create-form {
    grid-template-columns: 1fr;
  }

  .create-form > .button {
    grid-column: auto;
    grid-row: auto;
  }

  .link-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .records-grid {
    grid-template-columns: 1fr;
  }

  .manual-stage-grid {
    grid-template-columns: 1fr;
  }

  .viewer-status-cluster {
    gap: 10px;
  }

  .viewer-updated {
    display: none;
  }
}

@media (max-width: 680px) {
  :root {
    --radius-xl: 19px;
  }

  html {
    scroll-padding-top: 132px;
  }

  body {
    font-size: 14px;
  }

  .topbar {
    min-height: 68px;
    gap: 12px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .brand img {
    width: 39px;
    height: 39px;
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .brand-copy small {
    display: none;
  }

  .topbar-meta {
    gap: 9px;
  }

  .topbar-meta .mono {
    display: none;
  }

  .viewer-status-cluster {
    margin-left: auto;
  }

  .viewer-countdown span {
    display: none;
  }

  .viewer-countdown strong {
    font-size: 11px;
  }

  .connection-pill {
    min-height: 27px;
    padding: 4px 8px;
    font-size: 10px;
  }

  .stale-banner {
    top: 68px;
    display: grid;
    gap: 1px;
    padding-block: 7px;
    font-size: 10px;
  }

  .mobile-jump-nav {
    position: sticky;
    z-index: 40;
    top: 68px;
    display: flex;
    gap: 5px;
    padding: 7px var(--safe-right) 7px var(--safe-left);
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    background: rgba(5, 11, 22, 0.88);
    scrollbar-width: none;
    backdrop-filter: blur(14px);
  }

  .stale-banner:not(.is-hidden) + .mobile-jump-nav {
    top: 110px;
  }

  .mobile-jump-nav::-webkit-scrollbar {
    display: none;
  }

  .mobile-jump-nav a {
    flex: 0 0 auto;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.025);
    font-size: 10px;
  }

  .page-shell,
  .admin-shell {
    width: calc(100% - 22px);
    padding-top: 24px;
  }

  .admin-hero,
  .viewer-hero {
    margin-bottom: 23px;
  }

  .admin-hero h1,
  .viewer-hero h1 {
    margin-bottom: 10px;
    font-size: 34px;
  }

  .hero-copy {
    font-size: 13px;
    line-height: 1.65;
  }

  .security-note,
  .market-session-card {
    padding: 14px;
  }

  .panel-heading {
    gap: 13px;
    padding: 20px 17px 17px;
  }

  .panel-heading h2 {
    font-size: 18px;
  }

  .soft-badge {
    max-width: 145px;
    overflow: hidden;
    font-size: 9px;
    text-overflow: ellipsis;
  }

  .create-form {
    gap: 14px;
    padding: 0 17px 18px;
  }

  .segmented {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-hint {
    padding: 0 17px 20px;
  }

  .stats-grid,
  .account-grid {
    gap: 9px;
  }

  .stat-card,
  .metric-card {
    padding: 16px;
  }

  .metric-card {
    min-height: 118px;
  }

  .metric-card strong {
    font-size: 20px;
  }

  .link-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .heading-actions {
    width: 100%;
  }

  .compact-select,
  .compact-select select {
    width: 100%;
  }

  .links-list,
  .loading-list {
    padding: 11px;
  }

  .link-card {
    padding: 14px;
  }

  .link-card-head {
    align-items: flex-start;
  }

  .link-title-group {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .viewer-count {
    font-size: 10px;
  }

  .share-link-row {
    align-items: stretch;
    flex-direction: column;
  }

  .share-link-row .button {
    width: 100%;
  }

  .link-meta-grid {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .link-actions,
  .extend-control {
    align-items: stretch;
    flex-direction: column;
  }

  .extend-control {
    flex-basis: auto;
  }

  .extend-select,
  .link-actions .button {
    width: 100%;
    flex: none;
  }

  .stage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 0 11px 13px;
  }

  .manual-desk-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .manual-summary {
    min-width: 0;
  }

  .manual-stage-grid {
    gap: 9px;
    padding: 0 11px 13px;
  }

  .manual-stage-header,
  .manual-stock-row {
    padding-inline: 13px;
  }

  .manual-stock-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 12px;
  }

  .manual-stock-note {
    grid-column: 1;
    grid-row: 2;
    overflow: visible;
    text-align: left;
    text-overflow: clip;
    white-space: normal;
  }

  .manual-buy-badge {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .stage-card {
    min-height: 174px;
    padding: 13px;
  }

  .stage-time {
    font-size: 19px;
  }

  th,
  td {
    padding: 12px 13px;
  }

  .record-list {
    padding-inline: 17px;
  }

  .access-state {
    padding: 15px;
  }

  .access-card {
    padding: 30px 21px;
  }

  .access-card h1 {
    font-size: 22px;
  }

  .dialog-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 410px) {
  .viewer-status-cluster .connection-pill {
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .viewer-countdown {
    display: none;
  }

  .stage-grid {
    grid-template-columns: 1fr;
  }

  .stage-card {
    min-height: 150px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Viewer R3 clean-room multi-page shell */

.viewer-page {
  background:
    radial-gradient(circle at 23% -10%, rgba(36, 65, 108, 0.46), transparent 34rem),
    radial-gradient(circle at 95% 8%, rgba(155, 107, 22, 0.12), transparent 30rem),
    var(--navy-950);
}

.viewer-app,
.viewer-layout,
.viewer-workspace {
  min-width: 0;
  min-height: 100vh;
}

.viewer-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.viewer-sidebar {
  position: sticky;
  z-index: 60;
  top: 0;
  display: flex;
  height: 100vh;
  min-width: 0;
  align-self: start;
  flex-direction: column;
  padding: 22px 16px 18px;
  overflow: hidden;
  border-right: 1px solid rgba(181, 198, 224, 0.11);
  background:
    linear-gradient(180deg, rgba(15, 28, 49, 0.98), rgba(6, 13, 25, 0.985)),
    var(--navy-925);
  box-shadow: 18px 0 48px rgba(0, 0, 0, 0.16);
}

.viewer-side-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  margin: 0 5px 30px;
  padding: 2px;
  border-radius: 14px;
}

.viewer-side-brand img {
  flex: 0 0 auto;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(255, 231, 160, 0.08);
}

.viewer-side-brand > span {
  display: grid;
  min-width: 0;
  line-height: 1.15;
}

.viewer-side-brand strong {
  overflow: hidden;
  color: #fff7df;
  font-size: 16px;
  letter-spacing: 0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-side-brand small {
  margin-top: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.045em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-primary-nav {
  display: grid;
  gap: 7px;
}

.viewer-nav-link {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 48px;
  grid-template-columns: 31px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 13px;
  color: #9ba9bd;
  font-size: 13px;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.viewer-nav-link::after {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: transparent;
  content: "";
}

.viewer-nav-link > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(181, 198, 224, 0.1);
  border-radius: 9px;
  color: #b9c5d6;
  background: rgba(255, 255, 255, 0.025);
  font-size: 13px;
  font-weight: 800;
}

.viewer-nav-link strong {
  overflow: hidden;
  font-weight: 660;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-nav-link:hover {
  color: var(--text);
  border-color: rgba(181, 198, 224, 0.1);
  background: rgba(255, 255, 255, 0.032);
  transform: translateX(2px);
}

.viewer-nav-link.is-active {
  color: #fff2c1;
  border-color: rgba(228, 189, 91, 0.2);
  background: linear-gradient(90deg, rgba(228, 189, 91, 0.14), rgba(228, 189, 91, 0.035));
  box-shadow: inset 0 1px 0 rgba(255, 241, 194, 0.045);
}

.viewer-nav-link.is-active::after {
  background: var(--gold);
  box-shadow: 0 0 18px rgba(228, 189, 91, 0.46);
}

.viewer-nav-link.is-active > span {
  color: var(--gold-light);
  border-color: rgba(228, 189, 91, 0.24);
  background: rgba(228, 189, 91, 0.1);
}

.viewer-sidebar-boundary {
  margin-top: auto;
  padding: 15px;
  border: 1px solid rgba(56, 201, 146, 0.15);
  border-radius: 14px;
  background: rgba(56, 201, 146, 0.045);
}

.viewer-sidebar-boundary p {
  margin: 9px 0 2px;
  color: #d9f7eb;
  font-size: 12px;
  font-weight: 680;
}

.viewer-sidebar-boundary small {
  display: block;
  color: #7f958e;
  font-size: 10px;
  line-height: 1.55;
}

.readonly-mark,
.readonly-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border: 1px solid rgba(56, 201, 146, 0.2);
  border-radius: 999px;
  color: #91e4c4;
  background: rgba(56, 201, 146, 0.07);
  font-size: 9px;
  font-weight: 780;
  letter-spacing: 0.08em;
}

.viewer-workspace {
  position: relative;
}

.viewer-workspace > .viewer-topbar {
  min-height: 76px;
  padding-inline: clamp(18px, 2.2vw, 34px);
}

.viewer-page-heading {
  display: grid;
  min-width: 0;
  line-height: 1.12;
}

.viewer-page-heading small {
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.14em;
}

.viewer-page-heading strong {
  color: #f8f9fc;
  font-size: 17px;
}

.viewer-page-heading span {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-workspace > .stale-banner {
  top: 76px;
}

.viewer-workspace .viewer-shell {
  width: min(1560px, calc(100% - 36px));
  padding-top: 32px;
}

.viewer-page-section[hidden] {
  display: none !important;
}

.viewer-page-section.is-active {
  display: block;
  min-width: 0;
}

.viewer-section-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin: 2px 2px 25px;
}

.viewer-section-intro > div {
  min-width: 0;
  max-width: 820px;
}

.viewer-section-intro h1 {
  margin: 0 0 10px;
  color: #fff;
  font-size: clamp(30px, 3.8vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.viewer-section-intro p:last-child {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.7;
}

.readonly-status {
  flex: 0 0 auto;
  min-height: 30px;
  padding-inline: 12px;
  color: #b8ecd8;
  letter-spacing: 0.04em;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.dashboard-grid .metric-card {
  min-height: 128px;
}

.dashboard-grid .metric-card strong {
  font-size: clamp(21px, 2.15vw, 29px);
}

.viewer-page-section .data-panel,
.viewer-page-section .full-record-panel {
  margin-bottom: 20px;
}

.risk-position-table {
  min-width: 680px;
}

.full-record-panel .record-list {
  max-height: 610px;
}

.full-record-panel .record-item {
  grid-template-columns: 12px minmax(0, 1fr);
}

.full-record-panel .record-body {
  min-width: 0;
}

.full-record-panel .record-head strong {
  font-size: 14px;
}

.execution-record-panel .record-marker {
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(228, 189, 91, 0.085);
}

.viewer-page .viewer-footer {
  padding-bottom: 4px;
}

@media (max-width: 1180px) {
  .viewer-layout {
    grid-template-columns: 218px minmax(0, 1fr);
  }

  .viewer-sidebar {
    padding-inline: 12px;
  }

  .viewer-side-brand {
    margin-inline: 3px;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .viewer-workspace .viewer-shell {
    width: calc(100% - 28px);
  }
}

@media (max-width: 900px) {
  html {
    scroll-padding-top: 132px;
  }

  .viewer-layout {
    display: block;
  }

  .viewer-sidebar {
    position: sticky;
    top: 0;
    display: block;
    width: 100%;
    height: 56px;
    padding: 8px 11px;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  }

  .viewer-side-brand,
  .viewer-sidebar-boundary {
    display: none;
  }

  .viewer-primary-nav {
    display: flex;
    gap: 6px;
    padding-bottom: 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .viewer-primary-nav::-webkit-scrollbar {
    display: none;
  }

  .viewer-nav-link {
    min-height: 39px;
    flex: 0 0 auto;
    grid-template-columns: 22px auto;
    gap: 6px;
    padding: 5px 10px;
    border-color: rgba(181, 198, 224, 0.08);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.02);
    font-size: 11px;
  }

  .viewer-nav-link::after {
    top: auto;
    right: 9px;
    bottom: 0;
    left: 9px;
    width: auto;
    height: 2px;
    border-radius: 3px 3px 0 0;
  }

  .viewer-nav-link > span {
    width: 22px;
    height: 22px;
    border: 0;
    background: transparent;
    font-size: 11px;
  }

  .viewer-nav-link:hover {
    transform: none;
  }

  .viewer-workspace > .viewer-topbar {
    top: 56px;
    min-height: 68px;
  }

  .viewer-workspace > .stale-banner {
    top: 124px;
  }

  .viewer-page-heading span {
    display: none;
  }

  .viewer-section-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
  }

  .readonly-status {
    align-self: flex-start;
  }
}

@media (max-width: 680px) {
  html {
    scroll-padding-top: 118px;
  }

  .viewer-sidebar {
    height: 50px;
    padding-block: 6px;
  }

  .viewer-nav-link {
    min-height: 37px;
    grid-template-columns: auto;
    padding-inline: 12px;
  }

  .viewer-nav-link > span {
    display: none;
  }

  .viewer-workspace > .viewer-topbar {
    top: 50px;
  }

  .viewer-workspace > .stale-banner {
    top: 118px;
  }

  .viewer-workspace .viewer-shell {
    width: calc(100% - 22px);
    padding-top: 23px;
  }

  .viewer-page-heading small {
    display: none;
  }

  .viewer-page-heading strong {
    font-size: 15px;
  }

  .viewer-section-intro {
    margin-bottom: 20px;
  }

  .viewer-section-intro h1 {
    font-size: 32px;
  }

  .dashboard-grid {
    gap: 9px;
  }

  .dashboard-grid .metric-card {
    min-height: 112px;
  }
}

@media (max-width: 410px) {
  .viewer-topbar .viewer-page-heading {
    max-width: 122px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .viewer-section-intro h1 {
    font-size: 29px;
  }
}

/* Public viewer mirrors the private console presentation, while its data and
   behavior remain the independent allowlisted read-only implementation. */
.viewer-page {
  color-scheme: light;
  --line: #d9e0e7;
  --line-strong: #c7d1dc;
  --text: #17202a;
  --text-soft: #435266;
  --muted: #617184;
  --gold: #a86900;
  --gold-light: #a86900;
  --red: #b33636;
  --red-soft: #b33636;
  --green: #148257;
  --cyan: #2457d6;
  min-height: 100vh;
  color: var(--text);
  background: #f4f6f8;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.viewer-page .ambient {
  display: none;
}

.viewer-page .viewer-layout {
  display: block;
  min-height: 100vh;
}

.viewer-page .viewer-sidebar {
  position: fixed;
  z-index: 80;
  inset: 0 auto 0 0;
  width: 236px;
  height: 100vh;
  padding: 18px 14px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
  color: #fff;
  background: #1e2937;
  box-shadow: none;
}

.viewer-page .viewer-side-brand {
  gap: 10px;
  margin: 0;
  padding: 6px 4px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
}

.viewer-page .viewer-side-brand img {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.22);
}

.viewer-page .viewer-side-brand strong {
  color: #fff;
  font-size: 16px;
  letter-spacing: 0;
}

.viewer-page .viewer-side-brand small {
  margin-top: 3px;
  color: #b9c4d0;
  letter-spacing: 0;
}

.viewer-page .viewer-primary-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 18px;
}

.viewer-page .viewer-nav-link {
  display: grid;
  min-height: 40px;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 12px;
  overflow: visible;
  border: 0;
  border-radius: 8px;
  color: #dce5ef;
  background: transparent;
  font-size: 14px;
  text-align: left;
  transform: none;
}

.viewer-page .viewer-nav-link::after {
  display: none;
}

.viewer-page .viewer-nav-link > span {
  display: block;
  width: 18px;
  height: auto;
  border: 0;
  border-radius: 0;
  color: #e7b554;
  background: transparent;
  font-size: 14px;
  text-align: center;
}

.viewer-page .viewer-nav-link strong {
  font-weight: 400;
  letter-spacing: 0;
}

.viewer-page .viewer-nav-link em,
.viewer-page .viewer-nav-link small {
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  color: #c6d0dc;
  background: rgba(255, 255, 255, 0.08);
  font-size: 10px;
  font-style: normal;
  line-height: 18px;
  text-align: center;
  white-space: nowrap;
}

.viewer-page .viewer-nav-link:hover,
.viewer-page .viewer-nav-link.is-active {
  color: #fff;
  background: #334256;
}

.viewer-page .viewer-nav-link.is-active > span {
  color: #e7b554;
  background: transparent;
}

.viewer-page .viewer-nav-disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

.viewer-page .viewer-nav-disabled:hover {
  color: #dce5ef;
  background: transparent;
}

.viewer-page .viewer-sidebar-boundary {
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.viewer-page .viewer-sidebar-boundary p {
  color: #e7edf4;
}

.viewer-page .viewer-sidebar-boundary small {
  color: #9fabb9;
}

.viewer-page .readonly-mark {
  color: #bcebd8;
  border-color: rgba(82, 197, 151, 0.3);
  background: rgba(56, 201, 146, 0.1);
}

.viewer-page .viewer-workspace {
  min-height: 100vh;
  margin-left: 236px;
  background: #f4f6f8;
}

.viewer-page .viewer-workspace > .viewer-topbar {
  top: 0;
  min-height: 82px;
  padding: 16px 26px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  background: rgba(244, 246, 248, 0.96);
  box-shadow: none;
  backdrop-filter: blur(12px);
}

.viewer-page .viewer-page-heading small {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0;
}

.viewer-page .viewer-page-heading strong {
  color: var(--text);
  font-size: 24px;
  letter-spacing: 0;
}

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

.viewer-page .connection-pill,
.viewer-page .viewer-updated,
.viewer-page .viewer-countdown {
  border-color: var(--line);
  color: var(--muted);
  background: #fff;
  box-shadow: none;
}

.viewer-page .viewer-updated strong,
.viewer-page .viewer-countdown strong {
  color: var(--ink, #263241);
}

.viewer-page .viewer-workspace > .stale-banner {
  top: 82px;
  color: #7a271a;
  border-color: #e7b8b3;
  background: #fff4f2;
}

.viewer-page .viewer-workspace .viewer-shell {
  display: flex;
  width: auto;
  max-width: none;
  flex-direction: column;
  margin: 0;
  padding: 22px 26px 40px;
}

.viewer-page .dashboard-notices {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #e8c57e;
  border-radius: 8px;
  background: #fff9ea;
}

.viewer-page .dashboard-notices[hidden] {
  display: none;
}

.viewer-page .dashboard-notices[data-level="important"] {
  border-color: #e4a4a4;
  background: #fff4f2;
}

.viewer-page .dashboard-notice-mark {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: #a86900;
  font-size: 16px;
  font-weight: 850;
}

.viewer-page .dashboard-notices[data-level="important"] .dashboard-notice-mark {
  background: var(--red);
}

.viewer-page .dashboard-notice-content,
.viewer-page .dashboard-notice-row > div,
.viewer-page .dashboard-branch-copy {
  min-width: 0;
}

.viewer-page .dashboard-notice-content > strong {
  display: block;
  margin: 3px 0 7px;
  color: var(--text);
  font-size: 14px;
}

.viewer-page .dashboard-notice-list {
  display: grid;
  gap: 6px;
}

.viewer-page .dashboard-notice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
}

.viewer-page .dashboard-notice-row b,
.viewer-page .dashboard-notice-row span {
  display: inline;
  color: var(--text-soft);
  font-size: 12px;
}

.viewer-page .dashboard-notice-row b::after {
  content: "：";
}

.viewer-page .dashboard-notice-row time {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.viewer-page .dashboard-operation-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.35fr) minmax(280px, 0.65fr);
  align-items: stretch;
  gap: 14px;
  margin-bottom: 20px;
}

.viewer-page .dashboard-operation-grid > .panel {
  min-width: 0;
  margin-bottom: 0;
}

.viewer-page .dashboard-branch-list {
  display: grid;
  gap: 0;
  padding: 0 14px 14px;
}

.viewer-page .dashboard-branch-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 15px 2px;
  border-bottom: 1px solid #e8edf2;
}

.viewer-page .dashboard-branch-item:last-child {
  border-bottom: 0;
}

.viewer-page .dashboard-branch-copy strong,
.viewer-page .dashboard-branch-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-page .dashboard-branch-copy strong {
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

.viewer-page .dashboard-branch-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.viewer-page .dashboard-branch-item > b {
  color: var(--red);
  font-size: 16px;
}

.viewer-page .dashboard-branch-empty {
  padding: 34px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.viewer-page .dashboard-safe-panel,
.viewer-page .today-sell-panel {
  margin-bottom: 20px;
}

.viewer-page .dashboard-safe-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 0 14px 14px;
}

.viewer-page .dashboard-market-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.viewer-page .dashboard-safe-grid > div {
  display: grid;
  min-width: 0;
  min-height: 86px;
  align-content: center;
  gap: 5px;
  padding: 13px 15px;
  border-right: 1px solid #e8edf2;
  border-bottom: 1px solid #e8edf2;
  background: #fbfcfe;
}

.viewer-page .dashboard-safe-grid > div:nth-child(4n),
.viewer-page .dashboard-market-grid > div:nth-child(3n) {
  border-right: 0;
}

.viewer-page .dashboard-safe-grid > div > span {
  color: var(--muted);
  font-size: 10px;
}

.viewer-page .dashboard-safe-grid > div > strong {
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-page .dashboard-safe-grid > div > small {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-page .today-sell-panel {
  overflow: hidden;
  border-top: 3px solid var(--red);
}

.viewer-page .today-sell-table {
  min-width: 1080px;
}

.viewer-page .today-sell-action {
  color: var(--red);
  font-weight: 800;
  white-space: nowrap;
}

.viewer-page .today-sell-status {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 760;
  white-space: nowrap;
}

.viewer-page .today-sell-status.is-filled {
  color: #148257;
  border-color: #86c9aa;
  background: #eef9f4;
}

.viewer-page .today-sell-status.is-pending {
  color: var(--red);
  border-color: #e4a4a4;
  background: #fff4f2;
}

.viewer-page .today-sell-status.is-locked {
  color: #a86900;
  border-color: #e8c57e;
  background: #fff9ea;
}

.viewer-page .today-sell-status.is-recorded {
  color: var(--text-soft);
  background: #f7f9fb;
}

.viewer-page .viewer-hero {
  align-items: center;
  gap: 24px;
  margin: 0 0 18px;
}

.viewer-page .viewer-hero h1,
.viewer-page .viewer-section-intro h1 {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.viewer-page .viewer-page-section h1[tabindex="-1"]:focus {
  outline: none;
}

.viewer-page .eyebrow,
.viewer-page .section-kicker {
  margin-bottom: 4px;
  color: var(--amber, #a86900);
  letter-spacing: 0.12em;
}

.viewer-page .hero-copy,
.viewer-page .viewer-section-intro p:last-child {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.viewer-page .market-session-card {
  min-width: 220px;
  padding: 12px 14px;
  border-color: var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  box-shadow: none;
}

.viewer-page .market-session-card strong {
  color: var(--text);
}

.viewer-page .viewer-section-intro {
  align-items: center;
  margin: 0 0 18px;
}

.viewer-page .readonly-status {
  color: #148257;
  border-color: #86c9aa;
  background: #eef9f4;
}

.viewer-page .panel,
.viewer-page .stat-card,
.viewer-page .metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  box-shadow: none;
}

.viewer-page .stat-card::after,
.viewer-page .metric-card::after {
  display: none;
}

.viewer-page .metric-card {
  min-height: 98px;
  padding: 14px;
}

.viewer-page .metric-card strong,
.viewer-page .stat-card strong {
  color: var(--text);
}

.viewer-page .panel-heading {
  padding: 14px 14px 12px;
}

.viewer-page .panel-heading h2 {
  color: var(--text);
  font-size: 16px;
  letter-spacing: 0;
}

.viewer-page .soft-badge,
.viewer-page .count-badge {
  color: var(--muted);
  border-color: var(--line);
  background: #f7f9fb;
}

.viewer-page .stage-grid {
  gap: 8px;
  padding: 0 14px 14px;
}

.viewer-page .stage-card {
  min-height: 150px;
  padding: 12px;
  border-color: var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fbfcfe;
}

.viewer-page .stage-card::after {
  display: none;
}

.viewer-page .stage-time,
.viewer-page .manual-stage-title strong,
.viewer-page .rank-cell,
.viewer-page .score-cell {
  color: #a86900;
}

.viewer-page .stage-card h3,
.viewer-page .manual-stock-identity strong,
.viewer-page .record-head strong,
.viewer-page .stock-cell strong {
  color: var(--text);
}

.viewer-page .manual-desk-panel {
  border-color: #e4c98e;
  background: #fffdf8;
}

.viewer-page .manual-stage-grid {
  padding: 0 14px 14px;
}

.viewer-page .manual-stage-card {
  border-radius: 8px;
  background: #fff;
}

.viewer-page .manual-stage-header {
  border-bottom-color: var(--line);
  background: #fbfcfe;
}

.viewer-page .manual-stage-title span,
.viewer-page .manual-stock-note,
.viewer-page td,
.viewer-page .record-body p {
  color: var(--text-soft);
}

.viewer-page .manual-stock-row,
.viewer-page .record-item,
.viewer-page th,
.viewer-page td {
  border-bottom-color: #e8edf2;
}

.viewer-page .table-wrap {
  border-top-color: var(--line);
}

.viewer-page th {
  color: var(--muted);
  background: #f5f7fa;
}

.viewer-page tbody tr:hover {
  background: #f8fafc;
}

.viewer-page .table-badge {
  color: var(--text-soft);
  border-color: var(--line);
  background: #f7f9fb;
}

.viewer-page .action-buy {
  color: #b33636;
  border-color: #e4a4a4;
  background: #fff4f2;
}

.viewer-page .action-sell {
  color: #148257;
  border-color: #86c9aa;
  background: #eef9f4;
}

.viewer-page .action-hold {
  color: #a86900;
  border-color: #e8c57e;
  background: #fff9ea;
}

.viewer-page .record-list {
  scrollbar-color: #c8d0da transparent;
}

.viewer-page .viewer-footer {
  color: var(--muted);
}

.viewer-page .access-state {
  background: rgba(30, 41, 55, 0.74);
}

.viewer-page .access-card {
  border-color: var(--line);
  border-radius: 12px;
  color: var(--text);
  background: #fff;
  box-shadow: 0 24px 70px rgba(21, 31, 43, 0.24);
}

.viewer-page .access-card h1 {
  color: var(--text);
}

@media (max-width: 980px) {
  .viewer-page .dashboard-operation-grid {
    grid-template-columns: 1fr;
  }

  .viewer-page .dashboard-safe-grid,
  .viewer-page .dashboard-market-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .viewer-page .dashboard-safe-grid > div:nth-child(3n) {
    border-right: 1px solid #e8edf2;
  }

  .viewer-page .dashboard-safe-grid > div:nth-child(2n) {
    border-right: 0;
  }

  .viewer-page .viewer-sidebar {
    position: static;
    inset: auto;
    display: flex;
    width: auto;
    height: auto;
    min-height: 0;
    padding: 18px 14px;
    overflow: visible;
    flex-direction: column;
    gap: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .viewer-page .viewer-side-brand {
    display: flex;
  }

  .viewer-page .viewer-sidebar-boundary {
    display: block;
    margin-top: 0;
  }

  .viewer-page .viewer-primary-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .viewer-page .viewer-nav-link {
    min-height: 40px;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    padding: 10px 12px;
    font-size: 14px;
  }

  .viewer-page .viewer-workspace {
    margin-left: 0;
  }

  .viewer-page .viewer-workspace > .viewer-topbar {
    top: 0;
  }

  .viewer-page .viewer-workspace > .stale-banner {
    top: 82px;
  }

  .viewer-page .viewer-workspace .viewer-shell {
    padding: 16px;
  }
}

@media (max-width: 600px) {
  .viewer-page .dashboard-notices {
    grid-template-columns: 30px minmax(0, 1fr);
    padding: 12px;
  }

  .viewer-page .dashboard-notices > .count-badge {
    display: none;
  }

  .viewer-page .dashboard-notice-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .viewer-page .dashboard-safe-grid,
  .viewer-page .dashboard-market-grid {
    grid-template-columns: 1fr;
  }

  .viewer-page .dashboard-safe-grid > div,
  .viewer-page .dashboard-safe-grid > div:nth-child(2n),
  .viewer-page .dashboard-safe-grid > div:nth-child(3n),
  .viewer-page .dashboard-safe-grid > div:nth-child(4n) {
    border-right: 0;
  }

  .viewer-page .viewer-nav-link em,
  .viewer-page .viewer-nav-link small,
  .viewer-page .viewer-status-cluster .viewer-updated {
    display: none;
  }

  .viewer-page .viewer-sidebar {
    width: 100%;
    max-width: 100vw;
    padding: 12px;
    overflow: hidden;
    gap: 10px;
  }

  .viewer-page .viewer-side-brand {
    padding-bottom: 10px;
  }

  .viewer-page .viewer-primary-nav {
    flex-direction: row;
    width: 100%;
    min-width: 0;
    padding-bottom: 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .viewer-page .viewer-nav-link {
    flex: 0 0 auto;
    grid-template-columns: 18px auto auto;
  }

  .viewer-page .viewer-sidebar-boundary {
    display: none;
  }

  .viewer-page .viewer-workspace > .viewer-topbar {
    min-height: 68px;
    padding: 10px 12px;
  }

  .viewer-page .viewer-workspace > .stale-banner {
    top: 68px;
  }

  .viewer-page .viewer-workspace .viewer-shell {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    padding: 14px 12px 32px;
  }

  .viewer-page .viewer-page-heading strong {
    font-size: 17px;
  }

  .viewer-page .viewer-page-heading span,
  .viewer-page .viewer-countdown span {
    display: none;
  }

  .viewer-page .viewer-hero,
  .viewer-page .viewer-section-intro {
    align-items: stretch;
    flex-direction: column;
  }

  .viewer-page .market-session-card {
    min-width: 0;
  }
}

.monthly-execution-state {
  padding: 0 16px 12px;
}

.monthly-execution-month + .monthly-execution-month {
  border-top: 1px solid var(--mirror-line);
}

.monthly-execution-month > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px 10px;
}

.monthly-execution-month h3,
.monthly-execution-month p {
  margin: 0;
}

.monthly-execution-month p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.monthly-execution-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--mirror-line);
  border-top: 1px solid var(--mirror-line);
  border-bottom: 1px solid var(--mirror-line);
}

.monthly-execution-metrics span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--panel-bg);
  font-size: 13px;
}

.monthly-execution-table {
  min-width: 1420px;
}

@media (max-width: 800px) {
  .monthly-execution-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* R7: the three operational pages mirror the private console's information
   architecture while values still come only from the public allowlist. */
.viewer-page .mirror-page {
  --mirror-ink: #17212b;
  --mirror-muted: #64717d;
  --mirror-line: #d9e0e5;
  --mirror-bg: #eef1f3;
  color: var(--mirror-ink);
}

.viewer-page .mirror-toolbar,
.viewer-page .mirror-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.viewer-page .mirror-toolbar {
  margin-bottom: 14px;
}

.viewer-page .mirror-panel-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.viewer-page .mirror-panel-head h2 {
  margin: 0;
  color: var(--mirror-ink);
  font-size: 16px;
}

.viewer-page .mirror-muted {
  color: var(--mirror-muted);
  font-size: 13px;
}

.viewer-page .mirror-button,
.viewer-page .mirror-risk-search,
.viewer-page .mirror-risk-filter {
  min-height: 36px;
  border: 1px solid #c7d1dc;
  border-radius: 8px;
  background: #fff;
  color: var(--mirror-ink);
  font: inherit;
  font-size: 14px;
}

.viewer-page .mirror-button {
  padding: 8px 12px;
  cursor: pointer;
}

.viewer-page .mirror-button.is-primary {
  border-color: #1f6fb2;
  background: #1f6fb2;
  color: #fff;
}

.viewer-page .mirror-button:disabled {
  cursor: progress;
  opacity: 0.68;
}

.viewer-page .mirror-risk-search,
.viewer-page .mirror-risk-filter {
  padding: 7px 10px;
}

.viewer-page .mirror-risk-search {
  width: min(320px, 100%);
}

.viewer-page .mirror-risk-filter {
  min-width: 150px;
}

.viewer-page .mirror-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.viewer-page .mirror-metric {
  min-height: 98px;
  padding: 14px;
  border: 1px solid var(--mirror-line);
  border-radius: 8px;
  background: #fff;
}

.viewer-page .mirror-metric > span,
.viewer-page .mirror-metric > small {
  display: block;
  color: var(--mirror-muted);
}

.viewer-page .mirror-metric > span {
  font-size: 13px;
}

.viewer-page .mirror-metric > strong {
  display: block;
  margin: 8px 0 5px;
  color: var(--mirror-ink);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.viewer-page .mirror-metric > small {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.viewer-page .mirror-page > .panel {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--mirror-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

.viewer-page .mirror-portfolio-report-panel {
  padding: 0 !important;
  overflow: hidden;
}

.viewer-page .mirror-portfolio-report-panel > .mirror-panel-head {
  padding: 14px 14px 0;
}

.viewer-page .mirror-portfolio-report {
  border-top: 1px solid var(--mirror-line);
}
.viewer-page #account-daily-pnl { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); grid-template-rows:repeat(6,min-content); grid-auto-flow:column; gap:2px 10px; }
.viewer-page #account-daily-pnl .mirror-portfolio-day { padding:2px 4px; min-height:20px; }

.viewer-page .mirror-portfolio-statistics {
  border-bottom: 8px solid var(--mirror-bg);
  background: #fff;
}

.viewer-page .mirror-portfolio-stat-note {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--mirror-line);
  background: #fff9e9;
  color: #69520f;
}

.viewer-page .mirror-portfolio-stat-note b {
  font-size: 13px;
}

.viewer-page .mirror-portfolio-stat-note span {
  font-size: 12px;
}

.viewer-page .mirror-portfolio-stat-overview {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  border-bottom: 1px solid var(--mirror-line);
}

.viewer-page .mirror-portfolio-stat-overview > div {
  min-width: 0;
  padding: 12px 16px;
  border-right: 1px solid var(--mirror-line);
}

.viewer-page .mirror-portfolio-stat-overview > div:last-child {
  border-right: 0;
}

.viewer-page .mirror-portfolio-stat-overview span,
.viewer-page .mirror-portfolio-stat-overview small {
  display: block;
  color: var(--mirror-muted);
  font-size: 12px;
}

.viewer-page .mirror-portfolio-stat-overview b {
  display: block;
  margin: 4px 0 2px;
  font-size: 18px;
}

.viewer-page .mirror-portfolio-stat-breakdowns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.viewer-page .mirror-portfolio-closed-breakdowns {
  border-top: 1px solid var(--mirror-line);
  background: #f7f9fb;
}

.viewer-page .mirror-portfolio-stat-breakdown {
  min-width: 0;
  padding: 12px 16px 14px;
  border-right: 1px solid var(--mirror-line);
}

.viewer-page .mirror-portfolio-stat-breakdown:last-child {
  border-right: 0;
}

.viewer-page .mirror-portfolio-stat-breakdown h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.viewer-page .mirror-portfolio-stat-breakdown-list {
  display: grid;
  gap: 6px;
}

.viewer-page .mirror-portfolio-stat-breakdown-item {
  display: grid;
  grid-template-columns: minmax(82px, 1.25fr) minmax(92px, 1fr) minmax(105px, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid #edf1f4;
  font-size: 12px;
}

.viewer-page .mirror-portfolio-stat-breakdown-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.viewer-page .mirror-portfolio-stat-breakdown-item > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

.viewer-page .mirror-portfolio-stat-breakdown-item span {
  color: var(--mirror-muted);
}

.viewer-page .mirror-portfolio-stat-breakdown-item strong {
  text-align: right;
  white-space: nowrap;
}

.viewer-page .mirror-portfolio-month-section + .mirror-portfolio-month-section {
  border-top: 8px solid var(--mirror-bg);
}

.viewer-page .mirror-portfolio-month-heading,
.viewer-page .mirror-portfolio-day-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.viewer-page .mirror-portfolio-month-heading {
  padding: 16px 18px;
  border-bottom: 1px solid var(--mirror-line);
  background: #f7f9fb;
}

.viewer-page .mirror-portfolio-month-heading > div:first-child {
  min-width: 128px;
}

.viewer-page .mirror-portfolio-month-heading span {
  color: var(--mirror-muted);
  font-size: 12px;
}

.viewer-page .mirror-portfolio-month-heading h2 {
  margin: 4px 0 0;
  font-size: 19px;
}

.viewer-page .mirror-portfolio-month-metrics {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  flex-wrap: wrap;
}

.viewer-page .mirror-portfolio-month-metrics span {
  display: flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

.viewer-page .mirror-portfolio-month-metrics b {
  color: var(--mirror-ink);
  font-size: 16px;
}

.viewer-page .mirror-portfolio-day-block + .mirror-portfolio-day-block {
  border-top: 1px solid var(--mirror-line);
}

.viewer-page .mirror-portfolio-day-heading {
  padding: 12px 18px;
  background: #fff;
}

.viewer-page .mirror-portfolio-day-heading h3 {
  margin: 0;
  font-size: 15px;
}

.viewer-page .mirror-portfolio-day-heading span {
  color: var(--mirror-muted);
  font-size: 13px;
  text-align: right;
}

.viewer-page .mirror-page .table-wrap {
  overflow: auto;
  border: 1px solid var(--mirror-line);
  border-radius: 8px;
  background: #fff;
}

.viewer-page .mirror-portfolio-table-wrap {
  border: 0 !important;
  border-top: 1px solid var(--mirror-line) !important;
  border-radius: 0 !important;
}

.viewer-page .mirror-page table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  color: var(--mirror-ink);
  font-size: 13px;
}

.viewer-page .mirror-page th,
.viewer-page .mirror-page td {
  padding: 8px 10px;
  border-bottom: 1px solid #e8edf2;
  text-align: left;
  white-space: nowrap;
}

.viewer-page .mirror-page th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3f7;
  color: #415066;
}

.viewer-page .mirror-portfolio-table {
  min-width: 2180px;
}

.viewer-page .mirror-portfolio-table th {
  position: static;
}

.viewer-page .mirror-portfolio-table th,
.viewer-page .mirror-portfolio-table td {
  padding: 8px 9px;
  vertical-align: middle;
}

.viewer-page .mirror-wrap-cell,
.viewer-page .mirror-reason-cell {
  white-space: normal !important;
  line-height: 1.45;
}

.viewer-page .mirror-wrap-cell {
  min-width: 120px;
  max-width: 210px;
}

.viewer-page .mirror-reason-cell {
  min-width: 220px;
  max-width: 420px;
}

.viewer-page .mirror-portfolio-strategy-tag,
.viewer-page .mirror-portfolio-time-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 7px;
  border: 1px solid #cad6e4;
  border-radius: 6px;
  background: #f4f7fb;
  color: #36516f;
  font-weight: 700;
  white-space: nowrap;
}

.viewer-page .mirror-portfolio-time-tag {
  border-color: #d5c593;
  background: #fff9e9;
  color: #745713;
}

.viewer-page .mirror-risk-state-cell {
  min-width: 240px;
  max-width: 320px;
  white-space: normal !important;
  line-height: 1.35;
}

.viewer-page .mirror-risk-state-cell b,
.viewer-page .mirror-risk-state-cell span {
  display: block;
}

.viewer-page .mirror-risk-state-cell span {
  margin-top: 3px;
  color: var(--mirror-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

.viewer-page .mirror-engine-grid > div {
  min-height: 90px;
  padding: 12px;
  border: 1px solid var(--mirror-line);
  border-radius: 8px;
  background: #fbfcfe;
}

.viewer-page .mirror-engine-grid span,
.viewer-page .mirror-engine-grid em {
  display: block;
  color: var(--mirror-muted);
  font-size: 13px;
}

.viewer-page .mirror-engine-grid b {
  display: block;
  margin: 7px 0 5px;
  color: var(--mirror-ink);
  font-size: 18px;
}

.viewer-page .mirror-engine-grid em {
  overflow-wrap: anywhere;
  font-style: normal;
  line-height: 1.45;
}

.viewer-page .mirror-risk-table-wrap {
  height: calc(100vh - 330px);
  min-height: 430px;
}

.viewer-page .mirror-tall {
  max-height: 520px;
}

.viewer-page .mirror-empty-row,
.viewer-page .mirror-page .table-empty {
  padding: 20px;
  color: var(--mirror-muted);
  text-align: center;
}

.viewer-page .mirror-page .value-up {
  color: #b33636 !important;
  font-weight: 700;
}

.viewer-page .mirror-page .value-down,
.viewer-page .mirror-risk-action {
  color: #148257 !important;
  font-weight: 700;
}

.viewer-page .mirror-risk-watch {
  color: #b33636 !important;
  font-weight: 700;
}

.viewer-page .mirror-risk-hold {
  color: #b33636 !important;
  font-weight: 700;
}

.viewer-page .mirror-sell-action {
  color: #b33636 !important;
  font-weight: 800;
}

@media (max-width: 980px) {
  .viewer-page .mirror-metrics-grid,
  .viewer-page .mirror-engine-grid {
    grid-template-columns: 1fr;
  }

  .viewer-page .mirror-risk-table-wrap {
    height: 58vh;
    min-height: 360px;
  }

  .viewer-page .mirror-portfolio-stat-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .viewer-page .mirror-portfolio-stat-overview > div {
    border-bottom: 1px solid var(--mirror-line);
  }

  .viewer-page .mirror-portfolio-stat-breakdowns {
    grid-template-columns: 1fr;
  }

  .viewer-page .mirror-portfolio-stat-breakdown {
    border-right: 0;
    border-bottom: 1px solid var(--mirror-line);
  }

  .viewer-page .mirror-portfolio-stat-breakdown:last-child {
    border-bottom: 0;
  }

  .viewer-page .mirror-portfolio-month-heading,
  .viewer-page .mirror-portfolio-day-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .viewer-page .mirror-portfolio-month-metrics {
    justify-content: flex-start;
    gap: 10px 16px;
  }

  .viewer-page .mirror-portfolio-day-heading span {
    text-align: left;
  }
}

@media (max-width: 600px) {
  .viewer-page .mirror-toolbar,
  .viewer-page .mirror-panel-head {
    flex-wrap: wrap;
  }

  .viewer-page .mirror-risk-toolbar {
    align-items: stretch;
  }

  .viewer-page .mirror-risk-search,
  .viewer-page .mirror-risk-filter {
    width: 100%;
  }

  .viewer-page .mirror-metrics-grid,
  .viewer-page .mirror-engine-grid,
  .viewer-page .mirror-portfolio-stat-overview {
    grid-template-columns: 1fr;
  }

  .viewer-page .mirror-portfolio-report-panel > .mirror-panel-head {
    padding: 12px 12px 0;
  }

  .viewer-page .mirror-portfolio-stat-note,
  .viewer-page .mirror-portfolio-month-heading,
  .viewer-page .mirror-portfolio-day-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .viewer-page .mirror-portfolio-stat-note {
    gap: 3px;
    padding: 10px 12px;
  }

  .viewer-page .mirror-portfolio-stat-overview > div,
  .viewer-page .mirror-portfolio-stat-breakdown {
    padding: 10px 12px 12px;
    border-right: 0;
  }

  .viewer-page .mirror-portfolio-stat-breakdown-item {
    grid-template-columns: minmax(82px, 1fr) minmax(92px, 1fr) auto;
  }

  .viewer-page .mirror-portfolio-stat-breakdown-item span:nth-of-type(2) {
    grid-column: 1 / 3;
  }

  .viewer-page .mirror-portfolio-month-heading,
  .viewer-page .mirror-portfolio-day-heading {
    padding: 12px;
  }

  .viewer-page .mirror-portfolio-month-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    justify-content: flex-start;
    gap: 10px 16px;
  }

  .viewer-page .mirror-portfolio-month-metrics span {
    white-space: normal;
  }

  .viewer-page .mirror-portfolio-day-heading span {
    text-align: left;
  }

  .viewer-page .mirror-risk-table-wrap {
    height: 58vh;
    min-height: 360px;
  }
}
