/* ==========================================================================
 * CANARY DASHBOARD — MATERIAL DESIGN 3 / INSTRUMENT COMPONENT SUITE
 * ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--space-6);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-m);
  line-height: var(--leading);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body.has-bar {
  padding-bottom: 72px;
}

::selection {
  background: var(--primary-container);
  color: var(--on-primary-container);
}

/* Material 3 Focus Ring */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: var(--radius-s);
}

.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  min-width: 0;
  padding-inline: var(--gutter);
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

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

/* Typography Scale */
h1, h2, h3, h4 {
  margin: 0;
  line-height: var(--leading-tight);
  font-weight: 600;
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-3xl);
  letter-spacing: -0.025em;
  font-weight: 600;
}

h2 {
  font-size: var(--text-2xl);
  letter-spacing: -0.02em;
  font-weight: 600;
}

h3 {
  font-size: var(--text-xl);
  font-weight: 500;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
  max-width: var(--measure);
  text-wrap: pretty;
}

a {
  color: var(--canary-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: color var(--duration) var(--ease-out), text-decoration-color var(--duration) var(--ease-out);
}

a:hover {
  text-decoration-thickness: 2px;
  color: var(--primary);
}

code, pre, .mono {
  font-family: var(--font-mono);
}

.mono {
  font-size: 0.9em;
}

.wrap-anywhere {
  overflow-wrap: anywhere;
  min-width: 0;
}

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

strong {
  font-weight: 600;
}

/* Icons & Glyphs */
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  vertical-align: middle;
}

.glyph {
  width: 16px;
  height: 16px;
  flex: none;
}

.s-verified { color: var(--state-verified); }
.s-resolved { color: var(--state-resolved); }
.s-unresolvable { color: var(--state-unresolvable); }
.s-unverified { color: var(--state-unverified); }
.s-disputed { color: var(--state-disputed); }
.s-compromised { color: var(--state-compromised); }

.tone-good { color: var(--state-verified); }
.tone-bad { color: var(--state-compromised); }
.tone-neutral { color: var(--state-unverified); }

/* M3 Chip / State Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius-m);
  background: var(--surface-highest);
  border: var(--rule-width) solid var(--rule);
  box-shadow: var(--shadow-sm);
  transition: background var(--duration) var(--ease-out), border-color var(--duration) var(--ease-out);
}

.badge-large {
  font-size: var(--text-s);
  padding: 6px 14px;
  border-radius: var(--radius-m);
}

.badge-warning {
  color: var(--state-disputed);
}

.badge .glyph {
  width: 14px;
  height: 14px;
}

/* Shell & Navigation Rail */
.shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.column {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

main {
  flex: 1 0 auto;
  min-width: 0;
  padding-block: var(--space-6) var(--space-8);
}

main:focus {
  outline: none;
}

.skip-link {
  position: absolute;
  top: -9999px;
  left: var(--space-4);
  z-index: 100;
  background: var(--canary);
  color: var(--on-canary);
  padding: var(--space-2) var(--space-4);
  font-weight: 600;
  border-radius: var(--radius-m);
  text-decoration: none;
  box-shadow: var(--shadow-md);
}

.skip-link:focus {
  top: var(--space-3);
}

.watermark {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  text-align: center;
  font-weight: 600;
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  padding: 6px var(--gutter);
  border-bottom: var(--rule-width) solid var(--rule);
}

.watermark-foot {
  display: block;
  background: transparent;
  color: var(--ink-muted);
  border-top: var(--rule-width) solid var(--rule);
  border-bottom: 0;
  margin-top: var(--space-4);
}

/* Material 3 Modern Navigation Rail */
.rail {
  background: var(--surface);
  border-bottom: var(--rule-width) solid var(--rule);
  padding: var(--space-4) var(--gutter);
}

.rail-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
}

.rail-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.rail-build {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

@media (min-width: 1024px) {
  .shell {
    flex-direction: row;
  }
  .rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: 18rem;
    height: 100vh;
    overflow-y: auto;
    z-index: 30;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--space-6);
    border-right: var(--rule-width) solid var(--rule);
    border-bottom: 0;
    padding: var(--space-6) var(--space-5);
    box-shadow: var(--shadow-sm);
  }
  .rail-top {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    align-items: stretch;
  }
  .rail .nav ul {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: var(--space-2);
    align-items: stretch;
  }
  .column {
    margin-left: 18rem;
  }
  .rail-foot {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
    margin-top: 0;
  }
}

/* Wordmark & Branding */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  padding: var(--space-1) 0;
}

.wordmark::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--primary);
  margin-left: 2px;
}

.wordmark:hover {
  text-decoration: none;
}

/* Navigation Links — Material 3 Pill Styles */
.nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 14px;
  font-size: var(--text-m);
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  border-radius: var(--radius-full);
  transition: all var(--duration) var(--ease-out);
}

.nav a:hover {
  color: var(--ink);
  background: var(--surface-high);
}

.nav a[aria-current="page"] {
  color: var(--on-secondary-container);
  background: var(--secondary-container);
  font-weight: 600;
}

.rail .nav a {
  font-family: var(--font-sans);
  font-size: var(--text-m);
  padding: 10px 16px;
  border-radius: var(--radius-full);
}

.net-badge {
  margin: 0;
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: var(--rule-width) solid var(--rule);
}

/* Status Bar & Header Chrome */
.statusbar {
  position: sticky;
  top: 0;
  z-index: 25;
  min-height: 56px;
  background: var(--surface);
  border-bottom: var(--rule-width) solid var(--rule);
  box-shadow: var(--shadow-chrome);
  backdrop-filter: blur(8px);
}

.statusbar .wrap {
  display: flex;
  align-items: center;
  min-height: 56px;
}

.status-line {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

/* Material 3 Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 18px;
  font-family: var(--font-sans);
  font-size: var(--text-m);
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
  background: var(--surface-high);
  border: var(--rule-width) solid var(--rule-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--duration) var(--ease-out);
}

.btn:hover {
  background: var(--surface-highest);
  border-color: var(--primary);
  color: var(--primary);
}

.btn:active {
  transform: scale(0.98);
}

.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-small {
  min-height: 32px;
  padding: 4px 12px;
  font-size: var(--text-s);
}

.theme-toggle {
  justify-content: center;
}

.rail .theme-toggle {
  width: 100%;
}

/* Material 3 Card Callouts & Notices */
.notice {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  margin-top: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: var(--rule-width) solid var(--rule);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-sm);
}

.notice .icon {
  margin-top: 2px;
  color: var(--primary);
}

.lower-bound {
  margin-top: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--surface-high);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-m) var(--radius-m) 0;
  font-size: var(--text-m);
  color: var(--ink);
  font-weight: 500;
}

/* Sections & Typography */
.section {
  margin-top: var(--space-7);
  min-width: 0;
}

.section-tight {
  margin-top: var(--space-5);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
}

.section-note {
  margin: calc(-1 * var(--space-2)) 0 var(--space-4);
  color: var(--ink-muted);
  font-size: var(--text-s);
}

.page-head {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.lede {
  font-size: var(--text-l);
  max-width: var(--measure);
  color: var(--ink-muted);
}

.state-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
}

.crumbs {
  margin-bottom: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
}

.empty {
  color: var(--ink-muted);
  font-style: italic;
}

.verdict {
  display: grid;
  gap: var(--space-4);
  padding-top: var(--space-3);
}

.verdict-head {
  font-size: var(--text-4xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  max-width: 44ch;
}

/* Coverage Strip Instrument */
.strip-figure {
  margin: 0;
  padding: var(--space-4);
  background: var(--surface);
  border: var(--rule-width) solid var(--rule);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-sm);
}

.strip-figure.section-tight {
  margin-top: var(--space-4);
}

.strip {
  display: block;
  overflow: visible;
}

.strip-axis, .strip-tick {
  stroke: var(--rule-strong);
  stroke-width: 1;
}

.strip-label {
  fill: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.strip-ground {
  fill: var(--surface-low);
}

.strip-hatch {
  stroke: var(--state-unresolvable);
}

.seg .seg-fill { fill: currentColor; }
.seg .seg-edge { stroke: currentColor; stroke-width: 2; }
.seg .seg-ring { fill: none; stroke: currentColor; stroke-width: 1.5; }
.seg .seg-hollow { fill: var(--surface-low); stroke: currentColor; stroke-width: 1.5; }
.seg .seg-hatch { stroke: currentColor; stroke-width: 1.5; stroke-dasharray: 3 2; }
.strip-marker { overflow: visible; }

/* 6-State M3 Interactive Cards Grid */
.counts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

@media (min-width: 600px) {
  .counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
  .counts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1400px) {
  .counts { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

.count-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: var(--rule-width) solid var(--rule);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out), border-color var(--duration) var(--ease-out);
}

.count-row:hover {
  border-color: var(--rule-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.count-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-width: 0;
  max-width: 100%;
}

.count-n {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

.count-meaning {
  font-size: var(--text-s);
  color: var(--ink-muted);
  line-height: 1.4;
}

.count-explain {
  margin-top: auto;
  padding-top: var(--space-2);
  width: 100%;
}

.count-row.is-zero .count-n {
  color: var(--ink-muted);
  font-weight: 400;
}

/* Disclosure dropdown */
.explain summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--canary-text);
  background: var(--surface-high);
  border: var(--rule-width) solid var(--rule);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  transition: background var(--duration) var(--ease-out);
}

.explain summary:hover, .explain[open] summary {
  background: var(--surface-highest);
  color: var(--ink);
}

.explain summary::-webkit-details-marker {
  display: none;
}

.explain p {
  font-size: var(--text-s);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-low);
  border: var(--rule-width) solid var(--rule);
  border-radius: var(--radius-m);
  margin-top: var(--space-2);
}

/* Findings & List Cards */
.finding-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

.finding-item {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: var(--rule-width) solid var(--rule);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
}

.finding-item:hover {
  border-color: var(--rule-strong);
  box-shadow: var(--shadow-md);
}

.finding-sentence {
  font-size: var(--text-l);
  font-weight: 600;
  line-height: 1.35;
}

.finding-sentence a {
  text-decoration: none;
}

.finding-sentence a:hover {
  text-decoration: underline;
}

.finding-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-s);
  color: var(--ink-muted);
}

.finding-provable {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--canary-text);
}

/* Facts Grid */
.facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
  margin: var(--space-5) 0;
  padding: var(--space-5);
  background: var(--surface);
  border: var(--rule-width) solid var(--rule);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.facts div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.facts dt {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.facts dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-m);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.facts-compact {
  padding: var(--space-4);
  gap: var(--space-2);
}

/* Command Snippet Boxes */
.command {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-low);
  border: var(--rule-width) solid var(--rule);
  border-radius: var(--radius-m);
}

.command pre {
  margin: 0;
  font-size: var(--text-s);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Tables — Material 3 Styled Cards */
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  background: var(--surface);
  border: var(--rule-width) solid var(--rule);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

th, td {
  text-align: left;
  vertical-align: middle;
  padding: 12px 16px;
  border-bottom: var(--rule-width) solid var(--rule);
}

thead th {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: var(--surface-high);
}

tbody tr:hover {
  background: var(--surface-high);
}

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

.server-name {
  font-weight: 600;
  color: var(--ink);
}

.server-url {
  display: block;
  font-size: 11px;
  color: var(--ink-muted);
}

/* Goto Form */
.goto {
  margin: var(--space-5) 0;
}

.goto-row {
  display: flex;
  gap: var(--space-2);
  max-width: 320px;
}

.goto input {
  flex: 1;
  min-height: 40px;
  padding: 8px 14px;
  border: var(--rule-width) solid var(--rule-strong);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--text-m);
}

.goto .btn {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
  font-weight: 600;
}

/* Verification Report Steps */
.report {
  margin-top: var(--space-4);
  padding: var(--space-5);
  background: var(--surface);
  border: var(--rule-width) solid var(--rule);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-sm);
}

.report-steps {
  list-style: none;
  margin: var(--space-4) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-m);
  background: var(--surface-low);
  border: var(--rule-width) solid var(--rule);
}

.step-status {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.step-name {
  font-weight: 600;
}

.step-text {
  grid-column: 2;
  font-size: var(--text-s);
  color: var(--ink-muted);
}

/* Responsive Table Stacking */
@media (max-width: 719px) {
  .table-stack table,
  .table-stack tbody,
  .table-stack tr,
  .table-stack th,
  .table-stack td {
    display: block;
  }
  .table-stack thead {
    display: none;
  }
  .table-stack tr {
    padding: var(--space-4);
    border-bottom: var(--rule-width) solid var(--rule);
  }
  .table-stack td {
    padding: 4px 0;
    border: 0;
  }
}

/* Footer */
.site-footer {
  margin-top: auto;
  border-top: var(--rule-width) solid var(--rule);
  padding: var(--space-6) 0;
  background: var(--surface);
}

.footer-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-s);
  color: var(--ink-muted);
}
