:root {
  --ink: #102a31;
  --ink-soft: #38565c;
  --canvas: #f4efe8;
  --card: rgba(255, 255, 255, 0.92);
  --accent: #d96c32;
  --ok: #2e6f57;
  --warn: #b14e2d;
  --critical: #8f2431;
  --shadow: 0 24px 60px rgba(16, 42, 49, 0.12);
  --radius: 24px;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(217, 108, 50, 0.18), transparent 28%),
    linear-gradient(135deg, #f9f4ee 0%, #dce7e2 100%);
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  padding: 0.85rem 1.25rem;
  transition: transform 150ms ease, background 150ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: #183740;
}

.secondary-button {
  background: white;
  color: var(--ink);
  border: 1px solid rgba(16, 42, 49, 0.12);
}

.install-button.ready {
  border-color: rgba(217, 108, 50, 0.42);
  color: var(--accent);
}

.install-status {
  background: rgba(46, 111, 87, 0.12);
  color: var(--ok);
  font-weight: 700;
}

.shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.auth-shell {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 1.5rem;
  min-height: 100vh;
  align-items: center;
}

.hero-panel {
  padding: 3rem;
}

.hero-panel h1,
.app-header h1 {
  margin: 0.2rem 0 0.8rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 3vw, 3.5rem);
  line-height: 1.05;
}

.hero-copy {
  max-width: 36rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.card {
  background: var(--card);
  backdrop-filter: blur(18px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.login-card {
  max-width: 460px;
}

.status-banner {
  padding: 0.8rem 1rem;
  margin: 1rem 0;
  border-radius: 16px;
  background: rgba(217, 108, 50, 0.12);
  color: var(--ink);
}

.subscription-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  padding: 0.9rem 1.1rem;
  margin: 1rem 0;
  border-radius: 16px;
  font-size: 0.95rem;
}

.subscription-banner strong {
  display: block;
  font-size: 1rem;
}

.subscription-banner.tone-warning {
  background: rgba(177, 78, 45, 0.14);
  border: 1px solid rgba(177, 78, 45, 0.35);
  color: var(--warn);
}

.subscription-banner.tone-critical {
  background: rgba(143, 36, 49, 0.16);
  border: 2px solid var(--critical);
  color: var(--critical);
  box-shadow: 0 2px 10px rgba(143, 36, 49, 0.2);
}

.subscription-banner-loading {
  font-style: italic;
  opacity: 0.8;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.grid {
  display: grid;
  gap: 1.2rem;
}

.stats-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 1.2rem;
}

.analytics-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1.2rem;
}

.main-grid,
.panels-grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 1.2rem;
}

.stat-card strong {
  display: block;
  margin-top: 0.45rem;
  font-size: 1.8rem;
}

.critical-stat strong {
  color: var(--critical);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.header-actions,
.actions-row,
.tag-group,
.badge-row,
.meta-row,
.split-row,
.nav-tabs {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nav-tab {
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

.nav-tab.active {
  background: var(--ink);
  color: white;
}

.filter-form {
  margin-top: 1rem;
}

.filter-grid,
.input-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
}

.stack-form,
.stack-form label {
  display: grid;
  gap: 0.55rem;
}

.stack-form {
  gap: 0.9rem;
}

input,
select,
textarea,
code {
  width: 100%;
  border: 1px solid rgba(16, 42, 49, 0.14);
  border-radius: 16px;
  padding: 0.85rem 0.95rem;
  background: rgba(255, 255, 255, 0.9);
}

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

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
}

.checkbox-label input {
  width: auto;
}

.minor-list,
.alert-list,
.bar-list {
  display: grid;
  gap: 0.85rem;
}

.tutor-section {
  margin-top: 1.2rem;
}

.minor-card,
.alert-card {
  border-radius: 18px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(16, 42, 49, 0.08);
}

.tone-high {
  border-left: 5px solid var(--warn);
}

.tone-medium {
  border-left: 5px solid #d89a35;
}

.tone-low {
  border-left: 5px solid var(--ok);
}

.risk-badge,
.tracking-badge,
.pill,
.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.risk-badge,
.pill,
.tag {
  background: rgba(16, 42, 49, 0.08);
}

.tracking-badge.active {
  background: rgba(46, 111, 87, 0.12);
  color: var(--ok);
}

.tracking-badge.idle {
  background: rgba(177, 78, 45, 0.12);
  color: var(--warn);
}

.minor-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.minor-meta,
.minor-notes,
.empty-state {
  color: var(--ink-soft);
}

.alert-card.critical {
  border-left: 5px solid var(--critical);
}

.alert-card.high {
  border-left: 5px solid var(--warn);
}

.alert-card.medium {
  border-left: 5px solid #d89a35;
}

.alert-card.low {
  border-left: 5px solid var(--ok);
}

.alert-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.bar-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(16, 42, 49, 0.08);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #e59a53);
}

.timeline-grid {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  min-height: 170px;
}

.timeline-item {
  display: grid;
  gap: 0.4rem;
  justify-items: center;
  min-width: 64px;
}

.timeline-bar {
  display: block;
  width: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--ink));
}

.helper-stack,
.code-block,
.url-list {
  display: grid;
  gap: 0.65rem;
}

.code-block code,
.url-list code {
  font-family: Consolas, monospace;
  white-space: normal;
  word-break: break-word;
}

@media (max-width: 1160px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .analytics-grid,
  .main-grid,
  .panels-grid,
  .filter-grid,
  .input-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .auth-shell,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    padding: 1rem 0;
  }

  .app-header {
    align-items: start;
    flex-direction: column;
  }
}

.section-block {
  margin-top: 1.5rem;
}

.section-title {
  margin-bottom: 0.85rem;
}

.section-title h2 {
  margin: 0.2rem 0 0;
  font-size: 1.4rem;
}

.stats-grid-large {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 1.2rem;
}

.stat-card.critical strong,
.pill.critical {
  color: var(--critical);
}

.stat-card.high strong,
.pill.high {
  color: var(--warn);
}

.stat-card.medium strong,
.pill.medium {
  color: #c17b16;
}

.stat-card.low strong,
.pill.low {
  color: var(--ok);
}

.stat-card.healthy strong {
  color: var(--ok);
}

.stat-card.warning strong {
  color: var(--warn);
}

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

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

.stacked-main-grid {
  grid-template-columns: 1.2fr 1fr;
}

.stacked-chart {
  display: flex;
  align-items: end;
  gap: 0.8rem;
  min-height: 220px;
  overflow-x: auto;
}

.stacked-column {
  min-width: 72px;
  display: grid;
  justify-items: center;
  gap: 0.35rem;
}

.stacked-bar {
  width: 24px;
  border-radius: 999px;
  background: rgba(16, 42, 49, 0.08);
  display: flex;
  flex-direction: column-reverse;
  overflow: hidden;
}

.stack-segment {
  width: 100%;
}

.stack-segment.low {
  background: var(--ok);
}

.stack-segment.medium {
  background: #d89a35;
}

.stack-segment.high {
  background: var(--warn);
}

.stack-segment.critical {
  background: var(--critical);
}

.series-list {
  display: grid;
  gap: 1rem;
}

.series-row {
  display: grid;
  gap: 0.55rem;
}

.series-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.sparkline {
  display: flex;
  gap: 0.45rem;
  align-items: end;
  overflow-x: auto;
}

.spark-point {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  min-width: 40px;
}

.spark-point small,
.stacked-column small,
.mini-timeline-point small {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.spark-bar {
  display: block;
  width: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--ink));
}

.source-card,
.focus-card {
  padding: 1.1rem;
}

.source-card-head {
  margin-bottom: 0.8rem;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.nested-alerts {
  margin-top: 1rem;
}

.compact .alert-card {
  padding: 0.85rem;
}

.mini-timeline {
  display: flex;
  gap: 0.55rem;
  align-items: end;
  min-height: 90px;
  margin-top: 0.8rem;
  overflow-x: auto;
}

.mini-timeline-point {
  display: grid;
  gap: 0.3rem;
  justify-items: center;
  min-width: 34px;
}

.mini-timeline-bar {
  display: block;
  width: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e59a53, var(--ink));
}

.table-card {
  padding-bottom: 1rem;
}

.table-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.table-search-form {
  display: flex;
  gap: 0.7rem;
  align-items: center;
}

.table-search-form input {
  min-width: 280px;
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(16, 42, 49, 0.08);
}

.alerts-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
  background: rgba(255, 255, 255, 0.8);
}

.alerts-table th,
.alerts-table td {
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid rgba(16, 42, 49, 0.08);
  text-align: left;
  vertical-align: top;
}

.alerts-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
}

.empty-table {
  text-align: center;
  color: var(--ink-soft);
}

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.page-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  background: rgba(16, 42, 49, 0.08);
  font-weight: 700;
}

.triple-grid {
  grid-template-columns: 1.5fr 1fr 1fr;
}

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

@media (max-width: 1160px) {
  .stats-grid-large {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wide-grid,
  .triple-grid,
  .large-grid,
  .mini-grid,
  .source-breakdown-grid,
  .stacked-main-grid {
    grid-template-columns: 1fr;
  }

  .table-header,
  .table-footer,
  .table-search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .table-search-form input {
    min-width: 0;
  }
}

@media (max-width: 700px) {
  .stats-grid-large {
    grid-template-columns: 1fr;
  }

  .stacked-chart,
  .sparkline,
  .mini-timeline {
    padding-bottom: 0.25rem;
  }
}


.app-shell {
  padding-top: 1.1rem;
}

.app-header {
  position: sticky;
  top: 1rem;
  z-index: 8;
  align-items: center;
  margin-bottom: 1.2rem;
  padding: 1.25rem 1.35rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid rgba(16, 42, 49, 0.08);
  background: rgba(244, 239, 232, 0.78);
  backdrop-filter: blur(20px);
  box-shadow: 0 18px 48px rgba(16, 42, 49, 0.12);
}

.header-copy {
  display: grid;
  gap: 0.45rem;
}

.compact-copy {
  margin: 0;
  max-width: 48rem;
  font-size: 0.98rem;
}

.header-meta,
.filter-chip-row,
.chart-legend {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.summary-chip,
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  border: 1px solid rgba(16, 42, 49, 0.1);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
}

.summary-chip strong {
  font-size: 0.95rem;
}

.summary-chip span,
.filter-chip {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.summary-chip.tone-critical {
  border-color: rgba(143, 36, 49, 0.24);
  background: rgba(143, 36, 49, 0.08);
}

.summary-chip.tone-high {
  border-color: rgba(177, 78, 45, 0.24);
  background: rgba(177, 78, 45, 0.08);
}

.summary-chip.tone-medium {
  border-color: rgba(216, 154, 53, 0.24);
  background: rgba(216, 154, 53, 0.1);
}

.summary-chip.tone-low,
.summary-chip.tone-healthy {
  border-color: rgba(46, 111, 87, 0.24);
  background: rgba(46, 111, 87, 0.1);
}

.summary-chip.tone-warning {
  border-color: rgba(177, 78, 45, 0.24);
  background: rgba(177, 78, 45, 0.08);
}

.filter-chip.muted {
  color: var(--ink-soft);
  background: rgba(16, 42, 49, 0.06);
}

.overview-hero {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1.45rem;
  border: 1px solid rgba(16, 42, 49, 0.08);
  background:
    radial-gradient(circle at top right, rgba(217, 108, 50, 0.15), transparent 30%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(242, 235, 227, 0.92));
}

.overview-copy {
  display: grid;
  gap: 0.8rem;
  align-content: start;
}

.overview-copy h2 {
  margin: 0;
  font-size: clamp(1.8rem, 2.6vw, 2.5rem);
  line-height: 1.08;
  font-family: Georgia, "Times New Roman", serif;
}

.overview-rail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.overview-tile {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid rgba(16, 42, 49, 0.08);
  background: rgba(255, 255, 255, 0.88);
}

.overview-tile span {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.overview-tile strong {
  font-size: 1.3rem;
}

.overview-tile small,
.stat-card small {
  color: var(--ink-soft);
  line-height: 1.45;
}

.filter-form {
  margin-top: 1.1rem;
  border: 1px solid rgba(16, 42, 49, 0.08);
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.filter-header h3,
.panel-title,
.table-header h3,
.card h3,
.focus-card h3 {
  margin: 0;
}

.filter-actions {
  margin-top: 1rem;
}

.stats-grid-large {
  margin-top: 1.1rem;
}

.stat-card {
  position: relative;
  min-height: 156px;
  overflow: hidden;
  border: 1px solid rgba(16, 42, 49, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(245, 240, 234, 0.92));
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  border-radius: 24px;
  background: rgba(16, 42, 49, 0.1);
}

.stat-card.low::after,
.stat-card.healthy::after {
  background: rgba(46, 111, 87, 0.9);
}

.stat-card.medium::after {
  background: rgba(216, 154, 53, 0.95);
}

.stat-card.high::after,
.stat-card.warning::after {
  background: rgba(177, 78, 45, 0.92);
}

.stat-card.critical::after {
  background: rgba(143, 36, 49, 0.95);
}

.stat-card span {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.stat-card strong {
  margin-top: 0.6rem;
  font-size: 2rem;
  line-height: 1.05;
}

.panel-card,
.source-card,
.focus-card,
.table-card {
  border: 1px solid rgba(16, 42, 49, 0.08);
}

.panel-title {
  margin-bottom: 1rem;
  font-size: 1.02rem;
}

.bar-item,
.series-row {
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  background: rgba(247, 243, 238, 0.88);
  border: 1px solid rgba(16, 42, 49, 0.05);
}

.chart-legend {
  margin-top: 1rem;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.legend-dot.low {
  background: var(--ok);
}

.legend-dot.medium {
  background: #d89a35;
}

.legend-dot.high {
  background: var(--warn);
}

.legend-dot.critical {
  background: var(--critical);
}

.alerts-panel {
  margin-top: 1.2rem;
}

.alert-card {
  box-shadow: 0 12px 24px rgba(16, 42, 49, 0.08);
}

.alert-card h3 {
  margin: 0.45rem 0 0.5rem;
}

.alert-card p {
  margin: 0;
  line-height: 1.5;
}

.section-block {
  margin-top: 2rem;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-title > div {
  max-width: 52rem;
}

.section-title h2 {
  font-size: 1.55rem;
}

.source-card-head,
.table-header {
  margin-bottom: 1rem;
}

.table-wrap {
  background: rgba(255, 255, 255, 0.92);
}

.alerts-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f0ea;
}

.alerts-table tbody tr:nth-child(even) {
  background: rgba(244, 239, 232, 0.48);
}

.alerts-table tbody tr:hover {
  background: rgba(217, 108, 50, 0.08);
}

.page-pill {
  border: 1px solid rgba(16, 42, 49, 0.08);
  background: rgba(255, 255, 255, 0.8);
}

@media (max-width: 1160px) {
  .overview-hero,
  .overview-rail {
    grid-template-columns: 1fr;
  }

  .filter-header,
  .section-title {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 960px) {
  .app-header {
    position: static;
  }

  .header-meta {
    gap: 0.5rem;
  }
}
