:root {
  color-scheme: light;
  --ink: #11243a;
  --muted: #5e7087;
  --soft: #d7e8f6;
  --line: rgba(78, 126, 156, 0.18);
  --glass: rgba(255, 255, 255, 0.66);
  --glass-strong: rgba(255, 255, 255, 0.84);
  --blue: #4aa7ff;
  --blue-deep: #1670d5;
  --green: #42c98b;
  --green-deep: #159966;
  --mint: #c9f7e4;
  --cyan: #86def4;
  --amber: #ffbd59;
  --red: #ff6d75;
  --shadow: 0 24px 70px rgba(38, 88, 127, 0.18);
  --small-shadow: 0 14px 34px rgba(55, 103, 131, 0.13);
  --radius: 8px;
  --report-width: 1080px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 14% 10%, rgba(121, 205, 255, 0.36), transparent 34%),
    radial-gradient(circle at 86% 6%, rgba(136, 239, 190, 0.32), transparent 30%),
    linear-gradient(135deg, #eff8ff 0%, #f8fffb 42%, #eef9ff 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
}

html[data-theme="dark"] {
  --ink: #eaf4ff;
  --muted: #a9b9c9;
  --soft: #203748;
  --line: rgba(170, 216, 240, 0.18);
  --glass: rgba(20, 35, 48, 0.72);
  --glass-strong: rgba(24, 42, 57, 0.88);
  --blue: #58b8ff;
  --blue-deep: #78caff;
  --green: #57d99a;
  --green-deep: #70edb0;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --small-shadow: 0 14px 34px rgba(0, 0, 0, 0.26);
  background:
    radial-gradient(circle at 14% 10%, rgba(58, 148, 216, 0.3), transparent 34%),
    radial-gradient(circle at 86% 6%, rgba(54, 188, 121, 0.24), transparent 30%),
    linear-gradient(135deg, #081827 0%, #10283a 48%, #092619 100%);
}

body {
  min-height: 100vh;
  margin: 0;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1680px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.glass-surface {
  border: 1px solid rgba(255, 255, 255, 0.74);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.74), rgba(236, 249, 255, 0.52));
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(1.35);
  -webkit-backdrop-filter: blur(26px) saturate(1.35);
}

html[data-theme="dark"] .glass-surface {
  border-color: rgba(180, 220, 242, 0.18);
  background: linear-gradient(145deg, rgba(24, 42, 57, 0.86), rgba(18, 52, 47, 0.58));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 104px;
  padding: 24px 28px;
  border-radius: var(--radius);
}

.eyebrow,
.report-kicker,
.block-label {
  margin: 0 0 8px;
  color: var(--blue-deep);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.08;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}

.button-row.single {
  grid-template-columns: 1fr;
}

.parse-diagnostics + .button-row,
.history-list + .button-row {
  margin-top: 12px;
}

.button-row + .button-row {
  margin-top: 10px;
}

.button-row > button {
  width: 100%;
  min-width: 0;
  white-space: nowrap;
}

.icon-button,
.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(69, 133, 172, 0.22);
  border-radius: var(--radius);
  min-height: 40px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 9px 24px rgba(58, 118, 153, 0.13);
}

html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .secondary-button,
html[data-theme="dark"] .ghost-button,
html[data-theme="dark"] .nav-button {
  border-color: rgba(160, 213, 240, 0.2);
  color: var(--ink);
  background: rgba(28, 50, 65, 0.78);
}

.icon-button {
  width: 58px;
  font-weight: 780;
}

.theme-toggle {
  width: 66px;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(69, 133, 172, 0.22);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 9px 24px rgba(58, 118, 153, 0.13);
  font-weight: 780;
  text-decoration: none;
}

.module-tab.is-active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, #0e3768, #0b7567);
  box-shadow: 0 12px 30px rgba(25, 99, 139, 0.2);
}

html[data-theme="dark"] .module-tab.is-active {
  color: #f3fbff;
  background: linear-gradient(135deg, rgba(72, 166, 246, 0.94), rgba(61, 207, 143, 0.88));
}

.primary-button {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--blue), var(--green));
  font-weight: 780;
}

.secondary-button {
  background: rgba(236, 250, 255, 0.82);
  font-weight: 690;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.34);
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-top: 22px;
}

.control-rail {
  position: sticky;
  top: 18px;
  padding: 18px;
  border-radius: var(--radius);
}

.control-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.control-section:first-child {
  padding-top: 0;
}

.control-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 780;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--green-deep);
  background: rgba(209, 249, 230, 0.9);
  font-size: 12px;
  font-weight: 720;
}

.field-label {
  display: block;
  margin: 12px 0 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 690;
}

.date-input,
textarea {
  width: 100%;
  border: 1px solid rgba(77, 130, 161, 0.22);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  outline: none;
}

html[data-theme="dark"] .date-input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .select-input,
html[data-theme="dark"] .admin-data-table input {
  border-color: rgba(160, 213, 240, 0.22);
  color: var(--ink);
  background: rgba(11, 25, 38, 0.7);
}

.date-input {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 232px;
  resize: vertical;
  padding: 12px;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

textarea:focus,
.date-input:focus {
  border-color: rgba(48, 152, 219, 0.56);
  box-shadow: 0 0 0 4px rgba(74, 167, 255, 0.14);
}

.parse-diagnostics {
  margin-top: 9px;
  padding: 9px 10px;
  border: 1px solid rgba(77, 130, 161, 0.16);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.46);
  font-size: 12px;
  line-height: 1.45;
}

html[data-theme="dark"] .parse-diagnostics,
html[data-theme="dark"] .admin-note {
  border-color: rgba(160, 213, 240, 0.16);
  background: rgba(14, 32, 45, 0.68);
}

html[data-theme="dark"] .parse-diagnostics.ok {
  color: #7ff0b6;
  background: rgba(23, 89, 62, 0.4);
}

html[data-theme="dark"] .parse-diagnostics.warn {
  color: #ffd98a;
  background: rgba(101, 72, 24, 0.38);
}

html[data-theme="dark"] .parse-diagnostics.error {
  color: #ff9aa1;
  background: rgba(104, 37, 46, 0.42);
}

.parse-diagnostics.ok {
  color: #13754f;
  background: rgba(219, 252, 235, 0.64);
}

.parse-diagnostics.warn {
  color: #996012;
  background: rgba(255, 244, 213, 0.72);
}

.parse-diagnostics.error {
  color: #b33c47;
  background: rgba(255, 230, 232, 0.72);
}

.muted-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.muted-note p {
  margin-bottom: 0;
}

.history-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding-right: 2px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(67, 132, 159, 0.15);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.54);
}

html[data-theme="dark"] .history-item,
html[data-theme="dark"] .mini-button {
  border-color: rgba(160, 213, 240, 0.14);
  background: rgba(19, 39, 52, 0.74);
}

.history-item strong {
  display: block;
  font-size: 13px;
}

.history-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.history-actions {
  display: flex;
  gap: 6px;
}

.mini-button {
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid rgba(74, 137, 171, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  font-size: 12px;
}

.mini-button.danger {
  color: #bd3942;
}

.report-stage {
  min-width: 0;
}

.empty-state {
  min-height: 360px;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 46px;
  border-radius: var(--radius);
}

.empty-state h2 {
  margin-bottom: 10px;
  font-size: 30px;
}

.empty-state p {
  width: min(560px, 100%);
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.report-canvas {
  --report-heading: #11243a;
  --report-text: #233b53;
  --report-subtle: #5e7087;
  --report-card-bg: rgba(255, 255, 255, 0.7);
  --report-card-border: rgba(84, 143, 173, 0.16);
  --report-panel-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(235, 253, 247, 0.66));
  width: min(var(--report-width), 100%);
  margin: 0 auto;
  padding: 30px;
  font-size: 16px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 253, 255, 0.94)),
    radial-gradient(circle at 22% 8%, rgba(100, 188, 255, 0.22), transparent 24%),
    radial-gradient(circle at 84% 10%, rgba(89, 220, 154, 0.2), transparent 26%);
  box-shadow: var(--shadow);
}

html[data-theme="dark"] .report-canvas {
  --report-heading: #edf7ff;
  --report-text: #d7e7f4;
  --report-subtle: #a9bdcf;
  --report-card-bg: rgba(22, 38, 52, 0.78);
  --report-card-border: rgba(149, 204, 235, 0.16);
  --report-panel-bg: linear-gradient(145deg, rgba(22, 42, 57, 0.82), rgba(18, 58, 51, 0.64));
  border-color: rgba(152, 209, 237, 0.2);
  background:
    linear-gradient(180deg, rgba(13, 29, 43, 0.97), rgba(11, 40, 39, 0.97)),
    radial-gradient(circle at 22% 8%, rgba(82, 174, 255, 0.18), transparent 24%),
    radial-gradient(circle at 84% 10%, rgba(80, 220, 150, 0.14), transparent 26%);
}

.report-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 24px;
  align-items: center;
  padding: 28px;
  border: 1px solid rgba(90, 150, 185, 0.18);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(233, 248, 255, 0.9), rgba(235, 255, 247, 0.72));
}

html:not([data-theme="dark"]) .report-hero {
  border-color: rgba(162, 215, 244, 0.38);
  background:
    linear-gradient(90deg, rgba(74, 167, 255, 0.16), transparent 36%, rgba(66, 201, 139, 0.14)),
    linear-gradient(135deg, #082647 0%, #0d3b65 52%, #075342 100%);
  box-shadow: 0 18px 46px rgba(10, 62, 103, 0.2);
}

html:not([data-theme="dark"]) .report-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.38;
  pointer-events: none;
}

html:not([data-theme="dark"]) .report-hero::after {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  opacity: 0.92;
}

html:not([data-theme="dark"]) .report-hero > * {
  position: relative;
  z-index: 1;
}

html:not([data-theme="dark"]) .report-hero .report-kicker {
  color: #8be5ff;
}

html:not([data-theme="dark"]) .report-hero h2 {
  color: #f5fbff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .report-hero {
  border-color: rgba(141, 203, 235, 0.2);
  background: linear-gradient(135deg, rgba(23, 55, 75, 0.86), rgba(18, 66, 54, 0.68));
}

.report-hero h2 {
  margin-bottom: 10px;
  font-size: 42px;
  line-height: 1.08;
}

.report-subtitle {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.report-stamp {
  display: grid;
  place-items: center;
  width: 112px;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(72, 171, 255, 0.95), rgba(56, 203, 139, 0.94));
  color: white;
  box-shadow: var(--small-shadow);
}

.report-stamp span {
  align-self: end;
  font-size: 15px;
  font-weight: 720;
}

.report-stamp strong {
  align-self: start;
  font-size: 48px;
  line-height: 0.95;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.kpi-card,
.chart-card,
.insight-panel {
  border: 1px solid var(--report-card-border);
  border-radius: var(--radius);
  background: var(--report-card-bg);
  box-shadow: var(--small-shadow);
}

html[data-theme="dark"] .kpi-card,
html[data-theme="dark"] .chart-card,
html[data-theme="dark"] .insight-panel {
  border-color: var(--report-card-border);
  background: var(--report-card-bg);
}

.kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding: 18px;
  min-height: 128px;
}

.kpi-card span {
  display: block;
  color: var(--report-subtle);
  font-size: 14px;
  font-weight: 720;
  line-height: 1.25;
}

.kpi-card strong {
  display: block;
  margin: 2px 0;
  color: var(--report-heading);
  font-size: 34px;
  font-weight: 820;
  line-height: 1;
}

.kpi-card strong.kpi-name {
  min-height: 50px;
  display: flex;
  align-items: center;
  font-size: 23px;
  font-weight: 820;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

.kpi-card em {
  display: block;
  color: var(--report-subtle);
  font-style: normal;
  font-size: 14px;
  line-height: 1.45;
}

.delta-up {
  color: var(--green-deep) !important;
}

.delta-down {
  color: #cf4d57 !important;
}

.insight-panel {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 12px;
  padding: 18px 20px;
  background: var(--report-panel-bg);
}

html[data-theme="dark"] .insight-panel {
  background: var(--report-panel-bg);
}

.insight-panel h3 {
  margin-bottom: 0;
  color: var(--report-heading);
  font-size: 23px;
}

.insight-panel ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--report-text);
  font-size: 16px;
  line-height: 1.48;
}

html[data-theme="dark"] .insight-panel ul {
  color: var(--report-text);
}

.insight-panel li {
  position: relative;
  padding-left: 18px;
}

.insight-panel li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.66em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.chart-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

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

.quality-grid {
  grid-template-columns: minmax(0, 0.98fr) minmax(0, 1.02fr);
  align-items: stretch;
}

.chart-card {
  min-width: 0;
  padding: 20px;
  overflow: hidden;
}

.chart-card.full-width {
  margin-top: 14px;
}

.chart-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.chart-title-row h3 {
  margin-bottom: 0;
  color: var(--report-heading);
  font-size: 21px;
  font-weight: 820;
}

.chart-title-row span {
  color: var(--report-subtle);
  font-size: 13px;
  font-weight: 720;
  white-space: nowrap;
}

.chart-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed rgba(99, 142, 163, 0.28);
  border-radius: var(--radius);
  color: var(--report-subtle);
  text-align: center;
  padding: 18px;
  line-height: 1.6;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  font-family: inherit;
}

.axis-label {
  fill: var(--report-subtle);
  font-size: 13px;
}

.chart-label {
  fill: var(--report-heading);
  font-size: 14px;
  font-weight: 690;
}

.chart-value {
  fill: var(--report-text);
  font-size: 14px;
  font-weight: 720;
}

.ranking-track {
  fill: rgba(218, 235, 246, 0.74);
}

.chart-actual-value {
  fill: var(--report-heading);
  font-size: 18px;
  font-weight: 860;
}

.chart-svg.dense-svg .axis-label {
  font-size: 19px;
  font-weight: 760;
}

.chart-svg.dense-svg .chart-label {
  font-size: 19px;
  font-weight: 800;
}

.chart-svg.dense-svg .chart-value {
  font-size: 19px;
  font-weight: 820;
}

.chart-svg.comparison-svg .chart-actual-value {
  font-size: 20px;
}

html[data-theme="dark"] .axis-label {
  fill: var(--report-subtle);
}

html[data-theme="dark"] .chart-label {
  fill: var(--report-heading);
}

html[data-theme="dark"] .chart-value {
  fill: var(--report-text);
}

html[data-theme="dark"] .ranking-track {
  fill: rgba(46, 76, 93, 0.8);
}

html[data-theme="dark"] .chart-actual-value {
  fill: var(--report-heading);
}

.grid-line {
  stroke: rgba(82, 129, 157, 0.16);
  stroke-width: 1;
}

.zero-line {
  stroke: rgba(42, 85, 111, 0.36);
  stroke-width: 1.6;
}

html[data-theme="dark"] .grid-line,
html[data-theme="dark"] .zero-line {
  stroke: rgba(187, 224, 244, 0.18);
}

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

.channel-brief-card {
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(84, 143, 173, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
}

.channel-brief-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.channel-brief-head strong {
  overflow: hidden;
  color: var(--report-heading);
  font-size: 14px;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-brief-head span,
.channel-brief-tags span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 25px;
  border-radius: 6px;
  padding: 4px 6px;
  color: #0d2338;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.1;
  white-space: nowrap;
}

.channel-brief-tags {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 7px;
}

html[data-theme="dark"] .channel-brief-card {
  border-color: rgba(149, 204, 235, 0.14);
  background: rgba(18, 36, 50, 0.72);
}

html[data-theme="dark"] .channel-brief-head strong {
  color: var(--report-heading);
}

.shortboard-bars {
  display: grid;
  gap: 10px;
  padding: 6px 0 2px;
}

.shortboard-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 64px;
  gap: 10px;
  align-items: center;
}

.shortboard-row span,
.shortboard-row strong {
  font-size: 13px;
  font-weight: 760;
}

.shortboard-row span {
  color: var(--report-heading);
}

.shortboard-row strong {
  color: var(--report-subtle);
  text-align: right;
}

.shortboard-track {
  height: 22px;
  border-radius: 999px;
  background: rgba(218, 235, 246, 0.74);
  overflow: hidden;
}

.shortboard-track i {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
}

html[data-theme="dark"] .shortboard-row span {
  color: var(--report-heading);
}

html[data-theme="dark"] .shortboard-track {
  background: rgba(46, 76, 93, 0.8);
}

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

.matrix-card {
  min-height: 118px;
  padding: 12px;
  border: 1px solid rgba(84, 143, 173, 0.16);
  border-left: 5px solid var(--matrix-color);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.66);
}

html[data-theme="dark"] .matrix-card {
  border-color: rgba(149, 204, 235, 0.14);
  background: rgba(18, 36, 50, 0.76);
}

.matrix-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.matrix-head strong {
  color: var(--report-heading);
  font-size: 16px;
}

.matrix-head span {
  color: var(--matrix-color);
  font-size: 13px;
  font-weight: 780;
}

.matrix-card p {
  margin: 4px 0 8px;
  color: var(--report-subtle);
  font-size: 13px;
}

.matrix-card ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.matrix-card li {
  display: grid;
  gap: 2px;
}

.matrix-card li strong {
  overflow: hidden;
  color: var(--report-heading);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme="dark"] .matrix-card li strong {
  color: var(--report-heading);
}

.matrix-card li span,
.matrix-more {
  color: var(--report-subtle);
  font-size: 12px;
}

.matrix-more {
  margin: 7px 0 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid rgba(56, 133, 173, 0.2);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  backdrop-filter: blur(18px);
}

html[data-theme="dark"] .toast {
  border-color: rgba(160, 213, 240, 0.18);
  background: rgba(18, 37, 50, 0.9);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.admin-shell {
  width: min(1720px, calc(100vw - 32px));
}

.admin-workspace {
  margin-top: 22px;
}

.admin-panel {
  padding: 22px;
  border-radius: var(--radius);
}

.admin-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: end;
}

.admin-toolbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.select-input {
  width: 100%;
  height: 42px;
  border: 1px solid rgba(77, 130, 161, 0.22);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  outline: none;
}

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

.admin-summary-card {
  min-height: 92px;
  padding: 14px;
  border: 1px solid rgba(84, 143, 173, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--small-shadow);
}

.admin-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.admin-summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  line-height: 1.2;
}

.admin-summary-card em {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.admin-tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(84, 143, 173, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.52);
}

html[data-theme="dark"] .admin-tabs,
html[data-theme="dark"] .admin-table-wrap {
  border-color: rgba(149, 204, 235, 0.16);
  background: rgba(16, 34, 47, 0.74);
}

.tab-button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 760;
}

.tab-button.active {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.admin-note {
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px solid rgba(77, 130, 161, 0.16);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.48);
  font-size: 13px;
  line-height: 1.55;
}

.admin-table-wrap {
  overflow: auto;
  max-height: calc(100vh - 360px);
  border: 1px solid rgba(84, 143, 173, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.admin-data-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.admin-data-table th,
.admin-data-table td {
  border-right: 1px solid rgba(84, 143, 173, 0.13);
  border-bottom: 1px solid rgba(84, 143, 173, 0.13);
  padding: 6px;
  background: rgba(255, 255, 255, 0.84);
}

html[data-theme="dark"] .admin-data-table th,
html[data-theme="dark"] .admin-data-table td {
  border-color: rgba(149, 204, 235, 0.12);
  background: rgba(18, 37, 50, 0.9);
}

.admin-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  color: #244059;
  background: rgba(229, 247, 255, 0.96);
  font-weight: 780;
  white-space: nowrap;
}

html[data-theme="dark"] .admin-data-table thead th {
  color: #e6f3ff;
  background: rgba(31, 62, 78, 0.98);
}

.admin-data-table thead tr:nth-child(2) th {
  top: 31px;
  z-index: 5;
}

.admin-data-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 6;
}

.admin-data-table .sticky-name {
  position: sticky;
  left: 74px;
  z-index: 6;
}

.admin-data-table tbody .sticky-col,
.admin-data-table tbody .sticky-name {
  background: rgba(255, 255, 255, 0.96);
}

html[data-theme="dark"] .admin-data-table tbody .sticky-col,
html[data-theme="dark"] .admin-data-table tbody .sticky-name {
  background: rgba(18, 37, 50, 0.98);
}

.admin-data-table thead .sticky-col,
.admin-data-table thead .sticky-name {
  z-index: 7;
}

.admin-data-table input {
  width: 74px;
  height: 30px;
  border: 1px solid rgba(77, 130, 161, 0.2);
  border-radius: 6px;
  padding: 0 7px;
  color: var(--ink);
  background: white;
  outline: none;
}

.admin-data-table input:focus {
  border-color: rgba(48, 152, 219, 0.56);
  box-shadow: 0 0 0 3px rgba(74, 167, 255, 0.12);
}

.admin-data-table .name-cell {
  min-width: 154px;
  font-weight: 720;
  white-space: nowrap;
}

.admin-data-table .type-cell {
  min-width: 74px;
  color: var(--muted);
  font-weight: 720;
  white-space: nowrap;
}

.admin-data-table .summary-row td {
  background: rgba(235, 253, 247, 0.88);
  font-weight: 760;
}

html[data-theme="dark"] .admin-data-table .summary-row td {
  background: rgba(24, 69, 57, 0.76);
}

html[data-theme="dark"] .admin-summary-card {
  border-color: rgba(149, 204, 235, 0.16);
  background: rgba(22, 38, 52, 0.78);
}

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

  .control-rail {
    position: static;
  }

  .admin-toolbar,
  .admin-summary {
    grid-template-columns: 1fr;
  }

  .admin-toolbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 20px, 1680px);
    padding-top: 10px;
  }

  .topbar,
  .report-hero,
  .insight-panel {
    grid-template-columns: 1fr;
  }

  .channel-brief-grid {
    grid-template-columns: 1fr;
  }

  .kpi-grid,
  .two-col,
  .quality-grid {
    grid-template-columns: 1fr;
  }

  .report-canvas {
    padding: 16px;
  }

  .report-hero h2 {
    font-size: 32px;
  }
}

@media print {
  html,
  body {
    background: white !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .topbar,
  .control-rail,
  .empty-state,
  .toast {
    display: none !important;
  }

  .workspace {
    display: block;
    margin: 0;
  }

  .report-canvas {
    width: 100%;
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: white;
  }

  .chart-card,
  .kpi-card,
  .insight-panel {
    break-inside: avoid;
    box-shadow: none;
  }
}

/* Broadband operations dashboard */
.broadband-upload-panel {
  display: grid;
  gap: 12px;
}

.file-drop {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 16px;
  border: 1px solid rgba(74, 137, 171, 0.24);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: var(--small-shadow);
  cursor: pointer;
}

.file-drop span {
  color: var(--blue-deep);
  font-size: 13px;
  font-weight: 800;
}

.file-drop strong {
  font-size: 18px;
  line-height: 1.3;
}

.file-drop em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

html[data-theme="dark"] .file-drop {
  border-color: rgba(149, 204, 235, 0.18);
  background: rgba(17, 35, 49, 0.72);
}

.broadband-canvas {
  --bb-heading: #10243a;
  --bb-text: #243b55;
  --bb-subtle: #63768d;
  --bb-line: rgba(80, 137, 170, 0.18);
  --bb-card: rgba(255, 255, 255, 0.72);
  --bb-card-strong: rgba(255, 255, 255, 0.86);
  --bb-track: rgba(217, 235, 247, 0.86);
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: var(--radius);
  color: var(--bb-text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(243, 252, 255, 0.96)),
    linear-gradient(135deg, rgba(74, 167, 255, 0.1), rgba(66, 201, 139, 0.08));
  box-shadow: var(--shadow);
}

html[data-theme="dark"] .broadband-canvas {
  --bb-heading: #edf7ff;
  --bb-text: #d8e8f5;
  --bb-subtle: #aabdcf;
  --bb-line: rgba(160, 214, 242, 0.18);
  --bb-card: rgba(21, 39, 53, 0.78);
  --bb-card-strong: rgba(22, 43, 58, 0.92);
  --bb-track: rgba(47, 78, 96, 0.58);
  border-color: rgba(152, 209, 237, 0.18);
  background:
    linear-gradient(180deg, rgba(11, 27, 41, 0.98), rgba(11, 39, 38, 0.98)),
    linear-gradient(135deg, rgba(74, 167, 255, 0.1), rgba(66, 201, 139, 0.07));
}

.broadband-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 126px;
  gap: 24px;
  align-items: center;
  min-height: 170px;
  padding: 30px 34px;
  border: 1px solid rgba(114, 182, 218, 0.28);
  border-radius: var(--radius);
  background:
    linear-gradient(110deg, rgba(7, 39, 77, 0.96), rgba(9, 72, 87, 0.92) 55%, rgba(11, 99, 79, 0.92)),
    linear-gradient(135deg, rgba(79, 178, 255, 0.18), rgba(76, 215, 149, 0.16));
  box-shadow: 0 18px 52px rgba(15, 83, 121, 0.22);
}

.broadband-hero .report-kicker {
  color: #90e7ff;
}

.broadband-hero h2 {
  margin-bottom: 10px;
  color: #f4fbff;
  font-size: 46px;
  line-height: 1.05;
  font-weight: 860;
}

.broadband-hero p:last-child {
  margin: 0;
  color: rgba(230, 248, 255, 0.86);
  font-size: 16px;
  line-height: 1.6;
}

.broadband-date-card {
  display: grid;
  place-items: center;
  width: 126px;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  color: white;
  background: linear-gradient(145deg, rgba(73, 169, 255, 0.95), rgba(64, 205, 143, 0.96));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}

.broadband-date-card span {
  align-self: end;
  font-size: 15px;
  font-weight: 760;
}

.broadband-date-card strong {
  align-self: start;
  font-size: 54px;
  line-height: 0.95;
}

.broadband-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.broadband-kpi,
.broadband-card,
.broadband-insight {
  border: 1px solid var(--bb-line);
  border-radius: var(--radius);
  background: var(--bb-card);
  box-shadow: var(--small-shadow);
}

.broadband-kpi {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  padding: 17px;
}

.broadband-kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--tone, var(--blue));
}

.broadband-kpi.tone-blue { --tone: var(--blue); }
.broadband-kpi.tone-green { --tone: var(--green); }
.broadband-kpi.tone-cyan { --tone: var(--cyan); }
.broadband-kpi.tone-mint { --tone: var(--green-deep); }
.broadband-kpi.tone-red { --tone: var(--red); }
.broadband-kpi.tone-amber { --tone: var(--amber); }
.broadband-kpi.tone-deep { --tone: #0f5fba; }

.broadband-kpi span {
  display: block;
  color: var(--bb-subtle);
  font-size: 14px;
  font-weight: 780;
}

.broadband-kpi strong {
  display: block;
  margin: 8px 0 7px;
  color: var(--bb-heading);
  font-size: 32px;
  line-height: 1.04;
  font-weight: 860;
  overflow-wrap: anywhere;
}

.broadband-kpi em,
.broadband-kpi small {
  display: block;
  color: var(--bb-subtle);
  font-size: 13px;
  line-height: 1.35;
  font-style: normal;
  font-weight: 690;
}

.broadband-insight {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-top: 14px;
  padding: 20px 24px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(234, 255, 246, 0.68)),
    linear-gradient(90deg, rgba(74, 167, 255, 0.08), rgba(66, 201, 139, 0.08));
}

html[data-theme="dark"] .broadband-insight {
  background: linear-gradient(145deg, rgba(22, 42, 57, 0.82), rgba(18, 58, 51, 0.64));
}

.broadband-insight h3 {
  margin-bottom: 0;
  color: var(--bb-heading);
  font-size: 26px;
  line-height: 1.22;
}

.broadband-insight ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  color: var(--bb-text);
  font-size: 16px;
  line-height: 1.55;
  list-style: none;
}

.broadband-insight li {
  position: relative;
  padding-left: 18px;
}

.broadband-insight li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.broadband-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.broadband-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.broadband-card {
  min-width: 0;
  padding: 20px;
  overflow: hidden;
}

.broadband-grid.two-col > .broadband-card {
  min-height: 386px;
}

.broadband-canvas .axis-label {
  fill: var(--bb-subtle);
}

.broadband-canvas .chart-label,
.broadband-canvas .chart-value,
.broadband-canvas .chart-actual-value {
  fill: var(--bb-heading);
}

.broadband-card .chart-title-row h3 {
  color: var(--bb-heading);
  font-size: 22px;
}

.broadband-card .chart-title-row span {
  color: var(--bb-subtle);
  font-size: 13px;
}

.broadband-ranking-list {
  display: grid;
  gap: 12px;
}

.broadband-ranking-row {
  display: grid;
  grid-template-columns: 34px minmax(132px, 0.56fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(83, 143, 174, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.46);
}

html[data-theme="dark"] .broadband-ranking-row {
  border-color: rgba(151, 207, 238, 0.14);
  background: rgba(15, 31, 43, 0.52);
}

.rank-index {
  display: grid;
  place-items: center;
  width: 28px;
  aspect-ratio: 1;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--green));
  font-size: 14px;
  font-weight: 820;
}

.rank-name strong,
.reach-head strong,
.opportunity-row strong,
.compact-list strong,
.property-list strong {
  color: var(--bb-heading);
  font-weight: 820;
}

.rank-name span,
.rank-metrics span,
.opportunity-row span,
.reach-item p,
.compact-list span,
.property-list span {
  color: var(--bb-subtle);
  font-size: 13px;
  line-height: 1.35;
}

.rank-name {
  display: grid;
  gap: 4px;
}

.rank-bar,
.mini-track,
.opportunity-bar {
  position: relative;
  height: 28px;
  border-radius: 999px;
  background: var(--bb-track);
  overflow: hidden;
}

.rank-bar i,
.mini-track i,
.opportunity-bar i {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
}

.rank-bar span,
.opportunity-bar em {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bb-heading);
  font-size: 14px;
  font-style: normal;
  font-weight: 820;
}

.rank-metrics {
  grid-column: 2 / -1;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.broadband-trend-svg {
  min-height: 330px;
}

.broadband-trend-svg .axis-label {
  font-size: 15px;
  font-weight: 760;
}

.broadband-trend-svg .trend-label {
  font-size: 16px;
  font-weight: 780;
}

.broadband-trend-svg .chart-actual-value {
  font-size: 20px;
  font-weight: 880;
}

.opportunity-list {
  display: grid;
  gap: 11px;
}

.opportunity-row {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(170px, 0.62fr);
  gap: 12px;
  align-items: center;
}

.opportunity-row > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.opportunity-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opportunity-bar i {
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.reach-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  height: 100%;
}

.reach-item {
  display: grid;
  gap: 8px;
  align-content: center;
  padding: 12px;
  border: 1px solid rgba(83, 143, 174, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
}

html[data-theme="dark"] .reach-item {
  border-color: rgba(151, 207, 238, 0.12);
  background: rgba(15, 31, 43, 0.5);
}

.reach-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.reach-head span {
  color: var(--green-deep);
  font-weight: 840;
}

.mini-track {
  height: 20px;
}

.risk-layout,
.double-low-layout,
.action-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.56fr);
  gap: 14px;
  min-height: 292px;
}

.risk-bars,
.double-low-bars {
  display: grid;
  gap: 10px;
}

.risk-row {
  display: grid;
  grid-template-columns: 102px minmax(0, 1fr) 46px;
  gap: 10px;
  align-items: center;
}

.risk-row span,
.risk-row strong {
  color: var(--bb-heading);
  font-size: 13px;
  font-weight: 780;
}

.risk-row strong {
  text-align: right;
}

.risk-row .mini-track i {
  background: linear-gradient(90deg, var(--red), var(--amber));
}

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

.reason-card {
  padding: 11px;
  border: 1px solid rgba(83, 143, 174, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
}

html[data-theme="dark"] .reason-card {
  border-color: rgba(151, 207, 238, 0.12);
  background: rgba(15, 31, 43, 0.5);
}

.reason-card span,
.reason-card em {
  display: block;
  color: var(--bb-subtle);
  font-size: 12px;
  font-style: normal;
  font-weight: 720;
}

.reason-card strong {
  display: block;
  margin: 6px 0 3px;
  font-size: 24px;
  line-height: 1;
}

.broadband-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  height: 100%;
}

.broadband-matrix-card {
  min-height: 0;
  padding: 13px;
  border: 1px solid rgba(83, 143, 174, 0.14);
  border-left: 5px solid var(--matrix-color);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
}

html[data-theme="dark"] .broadband-matrix-card {
  border-color: rgba(151, 207, 238, 0.12);
  background: rgba(15, 31, 43, 0.52);
}

.broadband-matrix-card > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--bb-heading);
  font-weight: 820;
}

.broadband-matrix-card > div span {
  color: var(--matrix-color);
}

.broadband-matrix-card p {
  margin: 4px 0 8px;
  color: var(--bb-subtle);
  font-size: 13px;
}

.broadband-matrix-card ul,
.compact-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.broadband-matrix-card li {
  color: var(--bb-text);
  font-size: 13px;
  line-height: 1.35;
}

.action-columns h4,
.property-list h4 {
  margin: 0 0 10px;
  color: var(--bb-heading);
  font-size: 16px;
}

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

.month-strip span {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: var(--radius);
  color: var(--bb-heading);
  background: rgba(74, 167, 255, 0.12);
}

.month-strip em {
  color: var(--bb-subtle);
  font-size: 12px;
  font-style: normal;
  font-weight: 720;
}

.month-strip strong {
  font-size: 22px;
}

.compact-list li {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.compact-list strong,
.compact-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.property-list {
  display: grid;
  gap: 9px;
}

.property-list > div {
  display: grid;
  gap: 3px;
  padding: 9px 0;
  border-bottom: 1px solid var(--bb-line);
}

@media (max-width: 1100px) {
  .broadband-grid.two-col,
  .broadband-insight {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .broadband-canvas {
    padding: 16px;
  }

  .broadband-hero,
  .broadband-ranking-row,
  .opportunity-row,
  .risk-layout,
  .double-low-layout,
  .action-columns {
    grid-template-columns: 1fr;
  }

  .broadband-hero h2 {
    font-size: 34px;
  }

  .broadband-kpis,
  .reach-panel,
  .broadband-matrix,
  .reason-stack {
    grid-template-columns: 1fr;
  }

  .rank-metrics {
    justify-items: start;
  }
}


/* ============================================================
   Expert pass 1 — layout, rhythm, states (no markup changes)
   规则约束：报表/看板容器（.report-canvas / .broadband-canvas）
   内部只允许 transition，禁止 keyframe 动画与新滤镜，保证
   html2canvas 克隆导出结果与屏幕一致。
   ============================================================ */

:root {
  --radius-lg: 14px;
  --dur: 160ms;
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- 外壳与表面：更大圆角、更收敛的层级 ---------- */

.topbar,
.control-rail,
.empty-state,
.broadband-control,
.admin-panel {
  border-radius: var(--radius-lg);
}

.report-canvas,
.broadband-canvas {
  border-radius: var(--radius-lg);
}

.topbar {
  flex-wrap: wrap;
  row-gap: 14px;
}

/* ---------- 按钮系统：hover / active / focus 三态 ---------- */

.icon-button,
.primary-button,
.secondary-button,
.ghost-button,
.nav-button,
.mini-button,
.tab-button,
.file-drop {
  transition:
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    background-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    opacity var(--dur) var(--ease);
}

.icon-button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.ghost-button:focus-visible,
.nav-button:focus-visible,
.mini-button:focus-visible,
.tab-button:focus-visible,
.file-drop:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

@media (hover: hover) {
  .icon-button:hover,
  .secondary-button:hover,
  .ghost-button:hover,
  .nav-button:hover,
  .mini-button:hover {
    transform: translateY(-1px);
    border-color: rgba(69, 133, 172, 0.4);
    box-shadow: 0 14px 30px rgba(58, 118, 153, 0.2);
  }

  html[data-theme="dark"] .icon-button:hover,
  html[data-theme="dark"] .secondary-button:hover,
  html[data-theme="dark"] .ghost-button:hover,
  html[data-theme="dark"] .nav-button:hover,
  html[data-theme="dark"] .mini-button:hover {
    border-color: rgba(160, 213, 240, 0.38);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.34);
  }

  .primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 34px rgba(38, 148, 122, 0.32);
  }

  .module-tab.is-active:hover {
    transform: none;
  }

  .file-drop:hover {
    transform: translateY(-1px);
    border-color: rgba(74, 167, 255, 0.55);
  }

  .history-item:hover {
    border-color: rgba(74, 167, 255, 0.4);
  }

  .kpi-card:hover,
  .broadband-kpi:hover,
  .chart-card:hover,
  .broadband-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(55, 103, 131, 0.17);
  }

  html[data-theme="dark"] .kpi-card:hover,
  html[data-theme="dark"] .broadband-kpi:hover,
  html[data-theme="dark"] .chart-card:hover,
  html[data-theme="dark"] .broadband-card:hover {
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
  }
}

.icon-button:active,
.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.nav-button:active,
.mini-button:active {
  transform: translateY(0) scale(0.985);
}

.kpi-card,
.broadband-kpi,
.chart-card,
.broadband-card,
.history-item {
  transition:
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

/* ---------- 报表/看板纵向节奏：分区留白 ---------- */

.report-canvas,
.broadband-canvas {
  padding: 34px;
}

.kpi-grid,
.insight-panel,
.broadband-kpis,
.broadband-insight {
  margin-top: 18px;
}

.chart-grid,
.chart-card.full-width,
.broadband-grid {
  margin-top: 18px;
}

.report-hero {
  padding: 30px;
}

/* ---------- 深色主题 hero 与浅色对齐（同一海军蓝渐变） ---------- */

html[data-theme="dark"] .report-hero {
  border-color: rgba(162, 215, 244, 0.32);
  background:
    linear-gradient(90deg, rgba(74, 167, 255, 0.16), transparent 36%, rgba(66, 201, 139, 0.14)),
    linear-gradient(135deg, #0a2b4e 0%, #10406c 52%, #0a5a45 100%);
  box-shadow: 0 18px 46px rgba(4, 22, 40, 0.5);
}

html[data-theme="dark"] .report-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.38;
  pointer-events: none;
}

html[data-theme="dark"] .report-hero::after {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  opacity: 0.92;
}

html[data-theme="dark"] .report-hero > * {
  position: relative;
  z-index: 1;
}

html[data-theme="dark"] .report-hero .report-kicker {
  color: #8be5ff;
}

html[data-theme="dark"] .report-hero h2 {
  color: #f5fbff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.22);
}

/* ---------- 空状态：增加引导性 ---------- */

.empty-state {
  min-height: 420px;
}

.empty-state::before {
  content: "";
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, var(--blue), var(--green));
  box-shadow: var(--small-shadow);
}

.empty-state h2 {
  color: var(--ink);
}

/* ---------- 控制栏细节 ---------- */

textarea {
  caret-color: var(--blue-deep);
}

.history-list::-webkit-scrollbar {
  width: 8px;
}

.history-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--line);
}

/* 状态 pill 语义化（阶段 2 由 JS 写入 class） */

.status-pill.is-neutral {
  color: var(--muted);
  background: rgba(231, 240, 247, 0.9);
}

.status-pill.is-warn {
  color: #996012;
  background: rgba(255, 244, 213, 0.92);
}

.status-pill.is-error {
  color: #b33c47;
  background: rgba(255, 230, 232, 0.92);
}

html[data-theme="dark"] .status-pill.is-neutral {
  color: var(--muted);
  background: rgba(43, 66, 82, 0.85);
}

html[data-theme="dark"] .status-pill.is-warn {
  color: #ffd98a;
  background: rgba(101, 72, 24, 0.5);
}

html[data-theme="dark"] .status-pill.is-error {
  color: #ff9aa1;
  background: rgba(104, 37, 46, 0.52);
}

/* ---------- 移动端：修复顶栏（原 grid-template-columns 对 flex 无效） ---------- */

@media (max-width: 760px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    min-height: 0;
    padding: 18px;
  }

  .topbar h1 {
    font-size: clamp(24px, 6.4vw, 30px);
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .topbar-actions > * {
    width: 100%;
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
  }

  .topbar-actions .icon-button,
  .topbar-actions .theme-toggle {
    width: auto;
  }

  .workspace,
  .broadband-workspace {
    gap: 14px;
    margin-top: 14px;
  }

  .report-canvas,
  .broadband-canvas {
    padding: 18px;
  }

  .report-hero {
    padding: 22px;
  }
}

/* ---------- 动效降级 ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* 打印修正：保持原有的直角/无阴影重置不被上面的圆角覆盖，
   同时把宽带控制区也纳入直接打印的隐藏范围。 */
@media print {
  .report-canvas,
  .broadband-canvas {
    width: 100%;
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: white;
  }

  .broadband-card,
  .broadband-kpi,
  .broadband-insight {
    break-inside: avoid;
    box-shadow: none;
  }
}

/* ============================================================
   Expert pass 2 — topbar clusters, segmented module switch,
   empty-state steps (pairs with index.html structure changes)
   ============================================================ */

.brand-block {
  min-width: 0;
}

.topbar-actions {
  flex-wrap: nowrap;
}

/* 模块切换：分段控件 */

.module-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
}

html[data-theme="dark"] .module-switch {
  border-color: rgba(160, 213, 240, 0.16);
  background: rgba(15, 32, 44, 0.6);
}

.module-switch .nav-button {
  min-height: 34px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.module-switch .nav-button:hover {
  transform: none;
  box-shadow: none;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.65);
}

html[data-theme="dark"] .module-switch .nav-button:hover {
  background: rgba(40, 66, 84, 0.6);
}

.module-switch .nav-button.is-active,
.module-switch .nav-button.is-active:hover {
  color: #fff;
  background: linear-gradient(135deg, #0e3768, #0b7567);
  box-shadow: 0 8px 20px rgba(25, 99, 139, 0.28);
}

html[data-theme="dark"] .module-switch .nav-button.is-active,
html[data-theme="dark"] .module-switch .nav-button.is-active:hover {
  color: #f3fbff;
  background: linear-gradient(135deg, rgba(72, 166, 246, 0.94), rgba(61, 207, 143, 0.88));
}

/* 工具组 / 导出组：竖分隔线聚类 */

.action-cluster {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.export-cluster::before {
  content: "导出";
  margin-right: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0.06em;
}

/* 空状态：三步引导 */

.empty-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: min(720px, 100%);
  margin: 28px auto 0;
  padding: 0;
  list-style: none;
  counter-reset: empty-step;
}

.empty-steps li {
  position: relative;
  padding: 14px 14px 14px 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  text-align: left;
  counter-increment: empty-step;
}

html[data-theme="dark"] .empty-steps li {
  border-color: rgba(160, 213, 240, 0.16);
  background: rgba(19, 39, 52, 0.66);
}

.empty-steps li::before {
  content: counter(empty-step);
  position: absolute;
  left: 14px;
  top: 14px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--green));
  font-size: 13px;
  font-weight: 820;
}

.empty-steps strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
}

.empty-steps span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

/* 移动端：顶栏按组堆叠（覆盖 pass 1 的扁平 3 列网格） */

@media (max-width: 760px) {
  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
  }

  .module-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .module-switch .nav-button {
    width: 100%;
  }

  .action-cluster {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-left: 0;
    border-left: 0;
  }

  .action-cluster > * {
    width: 100%;
  }

  .export-cluster::before {
    display: none;
  }

  .empty-steps {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Expert pass 3 — chart readability & bar transitions
   条形从 0 生长由 JS 在渲染后一帧写入最终宽度触发；
   导出克隆节点复制的是最终内联宽度，html2canvas 不受影响。
   ============================================================ */

.chart-svg rect[data-w] {
  transition: width 560ms var(--ease);
}

.rank-bar i,
.mini-track i,
.opportunity-bar i,
.shortboard-track i {
  transition: width 560ms var(--ease);
}

/* 图表卡片右上提示 chip 化，便于扫读 */

.chart-title-row span {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(74, 167, 255, 0.1);
}

html[data-theme="dark"] .chart-title-row span {
  background: rgba(88, 184, 255, 0.14);
}

/* ============================================================
   Expert pass 4 — unified module skeleton
   宽带经营与渠道日报共用 左侧控制栏 + 右侧画布 骨架；
   后台顶栏与前台一致的模块切换。死样式已在原区块删除。
   ============================================================ */

@media (max-width: 760px) {
  .action-cluster {
    display: flex;
  }

  .action-cluster > * {
    flex: 1;
  }

  .admin-panel,
  .admin-table-wrap {
    min-width: 0;
    max-width: 100%;
  }

  .admin-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .admin-tabs .tab-button {
    min-width: 0;
    padding-inline: 6px;
  }
}

/* 后台-宽带经营面板 */

.bb-history-list {
  max-height: 460px;
  margin-top: 14px;
}

.bb-history-list .status-pill {
  margin-left: 6px;
  vertical-align: 2px;
}

.bb-backup-row {
  max-width: 460px;
  margin-top: 14px;
}
