:root {
  --bg: #07121f;
  --bg-soft: #102138;
  --panel: rgba(9, 18, 32, 0.84);
  --panel-strong: rgba(13, 24, 42, 0.95);
  --border: rgba(148, 163, 184, 0.18);
  --text: #e8eef7;
  --muted: #95a7c4;
  --accent: #34d399;
  --accent-2: #38bdf8;
  --accent-3: #fbbf24;
  --danger: #f87171;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  --radius: 26px;
  --radius-sm: 18px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-width: 320px;
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(52, 211, 153, 0.18), transparent 26rem),
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.18), transparent 24rem),
    linear-gradient(180deg, #0a1528 0%, #07121f 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.68), transparent);
}

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

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

button,
.button-link,
.button-like {
  border: 0;
  border-radius: 999px;
  padding: 0.9rem 1.15rem;
  color: white;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
  background: linear-gradient(135deg, #10b981, #38bdf8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:hover,
.button-link:hover,
.button-like:hover {
  transform: translateY(-1px);
}

button.secondary,
.button-link.secondary,
.button-like.secondary {
  background: rgba(51, 65, 85, 0.72);
}

button.ghost,
.button-link.ghost,
.button-like.ghost {
  background: rgba(148, 163, 184, 0.12);
}

button.danger,
.button-like.danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}

button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 16px;
  padding: 0.95rem 1rem;
  background: rgba(15, 23, 42, 0.78);
  color: var(--text);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.page {
  width: min(1320px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 52px;
}

.hero,
.panel,
.glass-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  padding: 28px;
  margin-bottom: 18px;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.24), transparent 72%);
}

.analysis-hero::after {
  background: radial-gradient(circle, rgba(251, 191, 36, 0.2), transparent 72%);
}

.hero-top,
.toolbar,
.section-head,
.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-top {
  margin-bottom: 18px;
}

.hero h1,
.hero h2,
.panel h2,
.panel h3,
.panel h4 {
  margin: 0;
}

.hero-copy,
.muted,
.empty-state {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  color: #7dd3fc;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
}

.hero-grid,
.content-grid,
.double-grid,
.stats-grid,
.report-grid {
  display: grid;
  gap: 16px;
}

.hero-grid {
  grid-template-columns: 1.1fr 1fr;
}

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

.content-grid {
  grid-template-columns: 1.06fr 0.94fr;
  align-items: start;
}

.double-grid,
.report-grid,
.two-up,
.three-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.stat-card,
.report-card,
.mini-card {
  background: rgba(8, 15, 28, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 20px;
  padding: 16px;
}

.linkish {
  appearance: none;
  background: transparent;
  border: 0;
  color: #7dd3fc;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
}

.linkish:hover {
  color: #e2f3ff;
  text-decoration: underline;
}

.stat-card.tone-green,
.legend-chip.tone-green,
.analysis-table tbody tr.tone-green td {
  background: rgba(34, 197, 94, 0.14);
}

.stat-card.tone-blue,
.analysis-table tbody tr.tone-blue td {
  background: rgba(56, 189, 248, 0.14);
}

.stat-card.tone-yellow,
.legend-chip.tone-yellow,
.analysis-table tbody tr.tone-yellow td {
  background: rgba(251, 191, 36, 0.16);
}

.stat-card.tone-red {
  background: rgba(239, 68, 68, 0.15);
}

.analysis-table tbody tr.tone-red td,
.legend-chip.tone-red,
.danger-chip {
  background: rgba(239, 68, 68, 0.15);
}

.matrix-table thead th {
  white-space: nowrap;
}

.matrix-table tbody tr.tone-green td {
  background: rgba(132, 204, 22, 0.28);
}

.matrix-table tbody tr.tone-yellow td {
  background: rgba(250, 204, 21, 0.28);
}

.matrix-table tbody tr.tone-red td {
  background: rgba(248, 113, 113, 0.22);
}

.matrix-table tbody td:nth-child(2),
.matrix-table tbody td:nth-child(4) {
  min-width: 180px;
}

.period-toggle {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.period-toggle button {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.7);
  color: #e5eef9;
  border-radius: 999px;
  padding: 10px 18px;
}

.period-toggle button.active {
  background: linear-gradient(135deg, #0ea5e9, #14b8a6);
  color: white;
  border-color: transparent;
}

.compact-table {
  min-width: 780px;
}

.performance-hero .hero-copy {
  max-width: 880px;
}

.stat-value {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.45rem, 3vw, 2rem);
  font-weight: 700;
}

.panel {
  padding: 18px;
}

.stack,
.form-grid,
.list {
  display: grid;
  gap: 14px;
}

.actions,
.top-nav,
.report-meta,
.account-meta,
.metric-line,
.tab-row,
.analysis-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.locale-row {
  justify-content: flex-end;
}

.pill,
.legend-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  background: rgba(148, 163, 184, 0.14);
  color: #d3deee;
  font-size: 0.88rem;
}

.pill.admin,
.pill.highlight {
  background: rgba(56, 189, 248, 0.18);
}

.brand {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.shell-header {
  position: sticky;
  top: 0;
  z-index: 30;
  margin-bottom: 16px;
  background: rgba(7, 18, 31, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 22px;
  backdrop-filter: blur(16px);
  padding: 14px 16px;
}

.shell-tabs {
  margin-top: 12px;
}

.tab-row button.active {
  background: linear-gradient(135deg, #10b981, #38bdf8);
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px 0;
}

.auth-card {
  width: min(1040px, calc(100% - 24px));
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 18px;
}

.auth-side,
.auth-panel {
  padding: 28px;
}

.error-banner,
.success-banner {
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 0.96rem;
}

.error-banner {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #fecaca;
}

.success-banner {
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.28);
  color: #bbf7d0;
}

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

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

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  vertical-align: top;
}

.analysis-table {
  min-width: 980px;
}

.analysis-table thead th {
  position: sticky;
  top: 0;
  background: rgba(15, 23, 42, 0.94);
}

.analysis-table tbody tr td:first-child,
.analysis-table tbody tr td:nth-child(2) {
  font-weight: 600;
}

.accent-panel {
  position: relative;
}

.accent-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(90deg, #10b981, #38bdf8);
}

.upload-button {
  position: relative;
  overflow: hidden;
}

.compact {
  padding: 14px;
}

.footer-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.stat-note {
  display: block;
  margin-top: 8px;
}

.export-actions {
  margin-top: 18px;
}

.compact-stats {
  margin-top: 16px;
}

.rich-table {
  min-width: 1480px;
}

.mini-card.tone-green,
.mini-card.tone-blue,
.mini-card.tone-yellow,
.mini-card.tone-red {
  border-color: rgba(148, 163, 184, 0.16);
}

.status-pill.tone-green,
.status-pill.tone-yellow,
.status-pill.tone-red,
.status-pill.tone-blue {
  color: var(--text);
}

.chart-stack {
  display: grid;
  gap: 12px;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 2fr) auto;
  gap: 12px;
  align-items: center;
}

.chart-label {
  display: grid;
  gap: 4px;
}

.chart-bar-wrap {
  height: 14px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  overflow: hidden;
}

.chart-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #10b981);
}

.chart-bar.tone-green {
  background: linear-gradient(90deg, #22c55e, #84cc16);
}

.chart-bar.tone-blue {
  background: linear-gradient(90deg, #38bdf8, #6366f1);
}

.chart-value {
  font-weight: 700;
  text-align: right;
}

.dashboard-chart {
  width: 100%;
  height: auto;
  display: block;
}

.svg-label {
  fill: var(--text);
  font-size: 12px;
}

.svg-value {
  fill: #f8fafc;
  font-size: 12px;
  font-weight: 700;
}

.svg-axis-label {
  fill: var(--muted);
  font-size: 11px;
}

.svg-axis {
  stroke: rgba(148, 163, 184, 0.24);
  stroke-width: 1;
}

.svg-line {
  fill: none;
  stroke: #38bdf8;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svg-dot {
  fill: #34d399;
  stroke: rgba(7, 18, 31, 0.9);
  stroke-width: 2;
}

.svg-bar-bg {
  fill: rgba(148, 163, 184, 0.12);
}

.svg-bar {
  fill: #38bdf8;
}

.svg-bar.tone-green {
  fill: #34d399;
}

.svg-bar.tone-blue {
  fill: #38bdf8;
}

.svg-donut-slice {
  stroke-linecap: round;
}

.donut-chart {
  max-width: 680px;
}

.print-only {
  display: none;
}

.print-sheet {
  border: 1px dashed rgba(148, 163, 184, 0.35);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 12px;
  background: rgba(15, 23, 42, 0.5);
}

.board-sheet {
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(10, 18, 34, 0.98)),
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.16), transparent 18rem);
  border: 1px solid rgba(125, 211, 252, 0.18);
}

.board-highlights {
  margin-top: 14px;
  flex-wrap: wrap;
}

.section-note {
  margin: 6px 0 0;
  color: #94a3b8;
  font-size: 0.92rem;
}

.segmented-switch {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.5);
}

.segmented-switch button {
  border-radius: 999px;
}

.segmented-switch button.active {
  background: linear-gradient(135deg, #22c55e, #0ea5e9);
  color: #04111f;
  border-color: transparent;
}

@media (max-width: 980px) {
  .hero-grid,
  .content-grid,
  .auth-card,
  .double-grid,
  .report-grid,
  .stats-grid,
  .two-up,
  .three-up {
    grid-template-columns: 1fr;
  }

  .shell-header,
  .hero-top,
  .toolbar,
  .section-head,
  .card-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media print {
  body {
    background: white;
    color: black;
  }

  body::before,
  .shell-header,
  .hero-top .actions,
  .export-actions,
  .analysis-legend,
  #analysis-filters-form,
  #refresh-data,
  #logout,
  #print-analysis-view,
  .tab-row,
  .button-link,
  button,
  input,
  select,
  textarea {
    display: none !important;
  }

  .page {
    width: 100%;
    padding: 0;
  }

  .hero,
  .panel,
  .glass-card,
  .stat-card,
  .mini-card,
  .report-card {
    background: white !important;
    color: black !important;
    border: 1px solid #d1d5db;
    box-shadow: none;
    backdrop-filter: none;
  }

  .muted,
  .eyebrow,
  .svg-axis-label {
    color: #4b5563 !important;
    fill: #4b5563 !important;
  }

  .svg-label,
  .svg-value {
    fill: black !important;
  }

  .print-only {
    display: block !important;
  }

  body[data-print-pack="ceo"] .print-pack,
  body[data-print-pack="manager"] .print-pack {
    display: none !important;
  }

  body[data-print-pack="ceo"] .ceo-pack,
  body[data-print-pack="manager"] .manager-pack,
  body[data-print-pack="monthly-sheet"] .monthly-sheet-pack {
    display: block !important;
  }

  body[data-print-pack="ceo"] .hero,
  body[data-print-pack="ceo"] .panel:not(.ceo-pack),
  body[data-print-pack="manager"] .hero,
  body[data-print-pack="manager"] .panel:not(.manager-pack),
  body[data-print-pack="monthly-sheet"] .hero,
  body[data-print-pack="monthly-sheet"] .panel:not(.monthly-sheet-pack) {
    display: none !important;
  }

  .analysis-table thead th {
    position: static;
    background: white;
  }
}

@media (max-width: 640px) {
  .page {
    width: min(100% - 16px, 100%);
    padding-bottom: 32px;
  }

  .auth-wrap {
    min-height: auto;
    padding: 12px 0 24px;
  }

  .auth-card {
    width: min(100% - 16px, 100%);
    gap: 12px;
  }

  .hero,
  .panel,
  .auth-side,
  .auth-panel {
    padding: 16px;
    border-radius: 20px;
  }

  .actions,
  .tab-row,
  .top-nav {
    width: 100%;
  }

  .section-head,
  .hero-top,
  .toolbar,
  .card-row {
    align-items: flex-start;
  }

  .top-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .top-nav > * {
    flex: 0 0 auto;
  }

  .top-locale-row {
    display: flex;
    flex-wrap: nowrap;
    width: auto;
  }

  .top-locale-row button {
    flex: 0 0 auto;
    min-width: max-content;
  }

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

  .hero-copy,
  .muted,
  .empty-state {
    font-size: 0.96rem;
  }

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

  .actions button,
  .actions .button-link,
  .actions .button-like,
  .auth-panel .tab-row button,
  .auth-locale-row button {
    flex: 1 1 100%;
  }

  .shell-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .shell-tabs button {
    flex: 0 0 auto;
    min-width: max-content;
  }

  .hero-grid,
  .content-grid,
  .double-grid,
  .report-grid,
  .stats-grid,
  .two-up,
  .three-up {
    gap: 12px;
  }

  .stat-card,
  .report-card,
  .mini-card {
    padding: 14px;
  }

  .analysis-table {
    font-size: 0.92rem;
  }
}
