/* Rob's Workshop - Global Stylesheet
   Slate Dashboard System - Design System & Style Guide
   ================================================ */

/* --- 1. Color Tokens (Design System §3) --- */

/* Light theme */
:root {
  color-scheme: light;
  --bg: #e9edf3;            /* muted blue-gray page */
  --surface: #f7f9fc;       /* off-white panel */
  --surface-soft: #e3e9f2;  /* secondary surface */
  --text: #0f1b2d;          /* near-black navy text (~13:1 on surface) */
  --muted: #4a5a6e;         /* muted text, >=4.5:1 contrast */
  --line: #c3ccda;          /* blue-gray borders */
  --accent: #1d4ed8;        /* deep blue primary */
  --accent-2: #1e40af;      /* darker blue for strong/links */
  --accent-3: #9a6a1d;      /* tertiary (amber-brown) */
  --good: #15803d;          /* green — positive */
  --warn: #b45309;          /* amber — warning */
  --bad: #b42318;           /* red — critical/negative */
  --shadow: 0 18px 50px rgba(15, 27, 45, 0.10);
  --row-stripe: rgba(29, 78, 216, 0.045);
  --row-hover: rgba(29, 78, 216, 0.09);

  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Dark theme (Default and primary intent) */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;            /* navy-charcoal page */
  --surface: #111c30;       /* blue-tinted panel */
  --surface-soft: #16243d;  /* raised/secondary surface */
  --text: #eef2f7;          /* near-AAA body text */
  --muted: #9fb3d1;         /* blue-gray muted text */
  --line: #29374f;          /* subtle blue-gray borders */
  --accent: #2563eb;        /* deep blue primary */
  --accent-2: #60a5fa;      /* lighter blue for links/secondary */
  --accent-3: #fbbf24;      /* amber tertiary highlight */
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --row-stripe: rgba(96, 165, 250, 0.06);
  --row-hover: rgba(96, 165, 250, 0.12);
}

/* --- 2. Base Resets & Layout --- */
* {
  box-sizing: border-box;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  margin-top: 0;
  font-weight: 700;
  line-height: 1.25;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.35rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}

a {
  color: var(--accent-2);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent);
  text-decoration: underline;
}

p {
  margin: 0 0 1rem;
}

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

pre {
  background-color: var(--surface-soft);
  border: 1px solid var(--line);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0 0 1.25rem;
}

code {
  background-color: var(--surface-soft);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.9em;
}

pre code {
  background-color: transparent;
  padding: 0;
  font-size: inherit;
  color: inherit;
  border-radius: 0;
}

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

/* Keyboard hint styles */
.kbd-hint kbd {
  font-family: var(--font-mono);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  font-size: 0.8rem;
  color: var(--text);
}

/* --- 3. DS Skeleton Components (Design System §5) --- */
.shell {
  max-width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px;
}

@media (max-width: 768px) {
  .shell {
    padding: 18px;
  }
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .topbar .header-right {
    width: 100%;
    justify-content: space-between;
  }
}

.topbar .header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.topbar .updated {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: right;
  line-height: 1.25;
}

.topbar .updated strong {
  display: block;
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 700;
}

/* Eyebrow / Kicker */
.eyebrow {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.25rem;
}

/* Tabs Bar & Group - Sticky Navigation */
.tabs-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  background-color: var(--bg);
  padding: 8px 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.tabs {
  display: inline-flex;
  background-color: var(--surface-soft);
  padding: 4px;
  border-radius: 999px;
  gap: 2px;
  max-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
}

.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
}

.tab:hover {
  color: var(--text);
  text-decoration: none;
}

.tab.is-active {
  background-color: var(--accent);
  color: #ffffff !important;
  font-weight: 750;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

/* Views & Subnav */
.view, .subview {
  display: none;
}

.view.is-active, .subview.is-active {
  display: block;
}

.subnav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.tab-group-head {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.5rem 0 0.75rem;
}

/* Grids */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
  margin-bottom: 24px;
}

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

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

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

/* --- 4. Component Library (Design System §6) --- */

/* Panels */
.panel {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  border-bottom: none;
  padding-bottom: 0;
}

/* Collapsible Panel */
details.panel {
  padding: 0;
  overflow: hidden;
}

details.panel summary {
  list-style: none;
  padding: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  background-color: var(--surface);
  transition: background-color 0.15s ease;
}

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

details.panel summary:hover {
  background-color: var(--surface-soft);
}

details.panel summary::after {
  content: '▸';
  color: var(--accent-2);
  font-size: 1.15rem;
  transition: transform 0.2s ease;
}

details.panel[open] summary::after {
  transform: rotate(90deg);
}

.details-content {
  padding: 0 18px 18px;
  border-top: 1px solid var(--line);
  background-color: var(--surface);
}

/* Metric / KPI Card */
.metric {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  min-height: 148px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric strong {
  font-size: clamp(1.45rem, 2.8vw, 2.35rem);
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin: 0.5rem 0;
}

.metric small {
  font-size: 0.82rem;
  color: var(--muted);
}

/* Action Center Tiles */
.ac-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.ac-tile {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.ac-tile.ac-good    { border-left-color: var(--good); }
.ac-tile.ac-bad     { border-left-color: var(--bad); }
.ac-tile.ac-warn    { border-left-color: var(--warn); }
.ac-tile.ac-accent  { border-left-color: var(--accent); }
.ac-tile.ac-muted   { border-left-color: var(--muted); }

.ac-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.ac-value {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.25rem;
}
.ac-good .ac-value   { color: var(--good); }
.ac-bad .ac-value    { color: var(--bad); }
.ac-warn .ac-value   { color: var(--warn); }
.ac-accent .ac-value { color: var(--accent-2); }
.ac-muted .ac-value  { color: var(--text); }

.ac-sub {
  font-size: 0.78rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  background-color: var(--surface-soft);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  background-color: var(--surface);
}

th {
  background-color: var(--surface-soft);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

tr:last-child td {
  border-bottom: none;
}

tr:nth-child(even) td {
  background-color: var(--row-stripe);
}

tr:hover td {
  background-color: var(--row-hover);
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.positive {
  color: var(--good) !important;
  font-weight: 600;
}

.positive::before {
  content: '▲ ';
  font-size: 0.75em;
}

.negative {
  color: var(--bad) !important;
  font-weight: 600;
}

.negative::before {
  content: '▼ ';
  font-size: 0.75em;
}

/* Status Alerts & Cautions */
.alert-item {
  border-left: 6px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 14px;
}

.alert-item.critical {
  background-color: rgba(180, 35, 24, 0.08);
  border-left-color: var(--bad);
}

.alert-item.warning {
  background-color: rgba(180, 83, 9, 0.08);
  border-left-color: var(--warn);
}

.alert-item.info {
  background-color: rgba(37, 99, 235, 0.08);
  border-left-color: var(--accent-2);
}

.alert-item h4 {
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alert-item.critical h4 { color: var(--bad); }
.alert-item.warning h4 { color: var(--warn); }
.alert-item.info h4 { color: var(--accent-2); }

.alert-item p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.count-badge, .alert-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  min-width: 1.25rem;
}

.count-badge.critical, .alert-badge.critical { background-color: var(--bad); }
.count-badge.warning, .alert-badge.warning { background-color: var(--warn); }
.count-badge.info, .alert-badge.info { background-color: var(--accent); }

/* Buttons */
.btn-primary {
  background-color: var(--accent);
  color: #ffffff !important;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.25rem;
  font-family: var(--font-sans);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.btn-primary:hover {
  background-color: var(--accent-2);
  text-decoration: none;
}

/* Theme Toggle Button */
.theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.theme-btn:hover {
  background-color: var(--surface-soft);
  border-color: var(--accent-2);
}

/* Inputs & Form Fields */
input, select, textarea {
  background-color: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  border-radius: 8px;
  min-height: 42px;
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.input-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Progress & Range Sliders */
.progress-track {
  background-color: var(--surface-soft);
  border-radius: 999px;
  height: 14px;
  width: 100%;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.bucket-bar, .ac-progress {
  height: 6px;
}

/* Range Slider Styles */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  min-height: auto;
  padding: 0;
}

input[type="range"]::-webkit-slider-runnable-track {
  background: var(--surface-soft);
  border-radius: 999px;
  height: 6px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--accent);
  border-radius: 50%;
  height: 16px;
  width: 16px;
  margin-top: -5px;
  transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

/* Tooltips */
.info-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--muted);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  cursor: help;
  position: relative;
  transition: all 0.15s ease;
}

.info-tooltip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.info-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  width: 200px;
  padding: 8px;
  border-radius: 6px;
  background-color: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.4;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: all 0.15s ease;
  z-index: 100;
  text-align: center;
}

.info-tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* --- 5. Page-Specific Styles (Cleaned & Restructured) --- */

/* Footer */
footer.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 4rem;
  padding: 1.75rem 2rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.footer-inner {
  max-width: min(1440px, 100%);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-inner code {
  color: var(--accent-3);
  background: none;
}

/* Operational Clusters Grid (Home) */
.cluster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.cluster-card {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  text-decoration: none !important;
  color: var(--text) !important;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.cluster-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
}

.cluster-card .card-icon-wrapper {
  margin-right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--accent);
  transition: all 0.2s ease;
}

.cluster-card:hover .card-icon-wrapper {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.cluster-card .card-content-center {
  flex-grow: 1;
}

.cluster-card .card-title {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.cluster-card .card-bullets {
  margin: 0;
  padding: 0 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.cluster-card .card-bullets li {
  margin-bottom: 0.15rem;
}

.cluster-card .card-num-right {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  opacity: 0.8;
}

.cluster-card .card-mini-icon {
  color: var(--muted);
}

.cluster-card:hover .card-mini-icon {
  color: var(--accent);
}

.cluster-card .card-big-num {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--surface-soft);
}

.cluster-card:hover .card-big-num {
  color: var(--line);
}

/* Terminal Console Component (Home Changelog) */
.terminal-container {
  background-color: #0b1220;
  border: 1px solid #29374f;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-top: 1rem;
}

.terminal-header {
  background-color: #111c30;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #29374f;
}

.terminal-buttons {
  display: flex;
  gap: 6px;
}

.terminal-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.terminal-btn.red    { background-color: #f87171; }
.terminal-btn.yellow { background-color: #fbbf24; }
.terminal-btn.green  { background-color: #4ade80; }

.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #9fb3d1;
}

.terminal-status {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--good);
  display: flex;
  align-items: center;
  gap: 6px;
}

.terminal-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--good);
  box-shadow: 0 0 6px var(--good);
}

.terminal-body {
  padding: 18px;
  max-height: 600px;
  overflow-y: auto;
  font-family: var(--font-mono);
  background-color: #080d16;
}

.terminal-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed #29374f;
}

.terminal-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.term-filter-btn {
  background: transparent;
  border: 1px solid #29374f;
  color: #9fb3d1;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.term-filter-btn:hover,
.term-filter-btn.active {
  border-color: var(--accent);
  color: var(--accent-2);
  background-color: rgba(37, 99, 235, 0.08);
}

.terminal-search {
  display: flex;
  align-items: center;
  color: #9fb3d1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  border: 1px solid #29374f;
  padding: 4px 8px;
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.3);
}

.terminal-search-prompt {
  color: var(--accent-2);
  margin-right: 6px;
  font-weight: bold;
}

.terminal-search-input {
  background: transparent;
  border: none;
  outline: none;
  color: #eef2f7;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  width: 160px;
}

.terminal-logs-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.terminal-row {
  border-radius: 4px;
  transition: background-color 0.15s ease;
  overflow: hidden;
}

.terminal-line {
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}

.terminal-line:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.terminal-line-date {
  color: #9fb3d1;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.terminal-line-badge {
  padding: 2px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 3px;
  text-transform: uppercase;
  border: 1px solid #29374f;
  background-color: #111c30;
  color: #9fb3d1;
}

.terminal-line-title {
  color: #eef2f7;
  flex-grow: 1;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.terminal-line-arrow {
  color: #9fb3d1;
  font-size: 0.7rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.terminal-row.expanded .terminal-line-arrow {
  transform: rotate(90deg);
}

.terminal-row-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  background-color: rgba(0, 0, 0, 0.4);
  border-left: 2px solid var(--accent);
  margin: 0 8px 8px;
  border-radius: 0 0 4px 4px;
}

.terminal-row.expanded .terminal-row-detail {
  max-height: 500px;
}

.terminal-detail-content {
  padding: 12px 16px;
  font-size: 0.82rem;
  color: #eef2f7;
  margin: 0;
  white-space: pre-wrap;
  background: transparent;
  border: none;
}

.terminal-command-line {
  color: var(--accent-2);
  font-weight: 700;
  margin-bottom: 6px;
  display: block;
}

/* Activity Planner Page Styles & Drag and Drop */
.planner-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.weekly-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.75rem;
}

@media (max-width: 1100px) {
  .weekly-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 768px) {
  .weekly-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.weekly-column {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.weekly-column.drag-over {
  background-color: var(--surface-soft) !important;
  border-color: var(--accent) !important;
}

.weekly-day-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  margin-bottom: 4px;
}

.weekly-task-card {
  background-color: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  font-size: 0.82rem;
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.15s ease, opacity 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.weekly-task-card:active {
  cursor: grabbing;
}

.weekly-task-card.dragging {
  opacity: 0.4;
  border-style: dashed;
  box-shadow: none;
}

.weekly-task-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent-2);
}

.weekly-task-card.completed {
  opacity: 0.65;
  background-color: var(--surface);
}

.weekly-task-card.completed .weekly-task-text {
  text-decoration: line-through;
  color: var(--muted);
}

.weekly-task-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.weekly-task-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.weekly-task-card:hover .weekly-task-actions {
  opacity: 1;
}

.weekly-task-shift-btn {
  background-color: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.65rem;
  padding: 1px 4px;
  border-radius: 3px;
  cursor: pointer;
}

.weekly-task-shift-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* Monthly Calendar Grid */
.monthly-calendar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.monthly-header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.month-title-display {
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.month-nav-btn {
  background-color: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.85rem;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s ease;
}

.month-nav-btn:hover {
  background-color: var(--surface);
  border-color: var(--accent);
}

.monthly-grid-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.monthly-day-header {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 0;
}

.monthly-cell {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 80px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.2s ease;
}

.monthly-cell:hover {
  border-color: var(--accent-2);
}

.monthly-cell.other-month {
  opacity: 0.35;
  background-color: transparent;
}

.monthly-cell.today {
  border-color: var(--accent);
  background-color: rgba(37, 99, 235, 0.03);
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.15);
}

.monthly-cell-num {
  font-size: 0.85rem;
  font-weight: 700;
  align-self: flex-end;
}

.monthly-cell.today .monthly-cell-num {
  color: var(--accent);
}

.monthly-cell-tasks {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  flex-grow: 1;
  overflow-y: auto;
  max-height: 60px;
}

.monthly-mini-task {
  font-size: 0.65rem;
  padding: 1px 4px;
  border-radius: 2px;
  background-color: var(--surface-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 2px solid var(--accent);
}

.monthly-mini-task.completed {
  text-decoration: line-through;
  opacity: 0.6;
}

/* Daily View Helpers */
.calendar-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.calendar-day-card {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.calendar-day-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.calendar-day-card.active {
  background-color: rgba(37, 99, 235, 0.05);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.15);
}

.calendar-day-name {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.calendar-day-num {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  margin-top: 4px;
}

.calendar-day-card.active .calendar-day-num {
  color: var(--accent);
}

.calendar-day-dots {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: 6px;
  height: 5px;
}

.calendar-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--accent-2);
}

.checklist-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.checklist-progress-bar-wrapper {
  flex-grow: 1;
  max-width: 200px;
  height: 8px;
  background-color: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-left: 1rem;
}

.checklist-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.3s ease;
}

.task-row {
  display: flex;
  align-items: center;
  background-color: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  gap: 12px;
  transition: all 0.2s ease;
}

.task-row:hover {
  border-color: var(--accent-2);
  background-color: var(--surface);
}

.task-checkbox-wrapper {
  cursor: pointer;
  display: flex;
  align-items: center;
}

.task-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--muted);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.task-checkbox svg {
  width: 12px;
  height: 12px;
  stroke: #ffffff;
  stroke-width: 3;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.15s ease;
}

.task-row.completed .task-checkbox {
  background-color: var(--good);
  border-color: var(--good);
}

.task-row.completed .task-checkbox svg {
  opacity: 1;
  transform: scale(1);
}

.task-text {
  flex-grow: 1;
  font-size: 0.92rem;
  color: var(--text);
  transition: all 0.2s ease;
}

.task-row.completed .task-text {
  text-decoration: line-through;
  color: var(--muted);
  opacity: 0.6;
}

.task-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.task-row:hover .task-actions {
  opacity: 1;
}

.task-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-btn:hover {
  color: var(--text);
  background-color: var(--surface-soft);
}

.task-btn.delete:hover {
  color: var(--bad);
  background-color: rgba(248, 113, 113, 0.1);
}

.task-edit-input {
  flex-grow: 1;
  background-color: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--text);
  outline: none;
  font-size: 0.92rem;
}

.quick-add-form {
  display: flex;
  gap: 12px;
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.quick-add-input {
  flex-grow: 1;
  min-width: 180px;
}

.quick-add-select {
  min-width: 100px;
}

.quick-add-btn {
  background-color: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 42px;
  padding: 0 16px;
  border-radius: 8px;
}

.quick-add-btn:hover {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* Category Indicators */
.planner-cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

/* Console Textarea for Export */
.console-textarea {
  width: 100%;
  height: 100px;
  background-color: #080d16;
  border: 1px solid #29374f;
  border-radius: 8px;
  color: var(--good);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 10px;
  outline: none;
  resize: vertical;
}

.console-buttons {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.console-btn {
  background-color: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.console-btn:hover {
  border-color: var(--accent);
  background-color: var(--surface);
}

.console-btn.accent {
  background-color: rgba(37, 99, 235, 0.08);
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.console-btn.accent:hover {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* Passcode Validation Gated View overlay styling (for ledger.html client side validation) */
.gate-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 440px;
  margin: 4rem auto;
  box-shadow: var(--shadow);
}

.gate-icon {
  margin-bottom: 1.5rem;
  color: var(--accent);
}

.gate-input-group {
  display: flex;
  gap: 8px;
  margin-top: 1.5rem;
  width: 100%;
}

.gate-input-group input {
  flex-grow: 1;
  text-align: center;
  letter-spacing: 0.15em;
  font-weight: bold;
}

.gate-error {
  color: var(--bad);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  font-weight: 600;
  min-height: 1.25rem;
}

/* General responsive media rules */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-delay: 0s !important;
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-delay: 0s !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }
  .progress-fill {
    transition: none !important;
  }
}

/* --- Utility classes (replaces inline style attrs for strict CSP compliance) --- */
/* Visibility (load-bearing: enforces correct first paint before JS runs) */
.is-hidden { display: none; }

/* Spacing utilities */
.u-mt-1   { margin-top: 1rem; }
.u-mt-125 { margin-top: 1.25rem; }
.u-mt-15  { margin-top: 1.5rem; }
.u-mt-2   { margin-top: 2rem; }
.u-mb-0   { margin-bottom: 0; }
.u-mb-05  { margin-bottom: 0.5rem; }
.u-mb-15  { margin-bottom: 1.5rem; }
.u-mb-24  { margin-bottom: 24px; }
.u-m-0    { margin: 0; }
.u-ml-auto{ margin-left: auto; }

/* Typography utilities */
.u-fs-065 { font-size: 0.65rem; }
.u-fs-09  { font-size: 0.9rem; color: var(--muted); margin-bottom: 1.5rem; }
.u-fs-11  { font-size: 1.1rem; line-height: 1.6; margin: 0; }
.u-fs-115 { font-size: 1.15rem; margin-top: 4px; }

/* Badge/pill tint utilities (status-tinted chips, DS status language) */
.u-tint-info { color: var(--accent-2); background-color: rgba(96, 165, 250, 0.1); }
.u-tint-good { color: var(--good); background-color: rgba(74, 222, 128, 0.1); }
.u-tint-soft { font-size: 0.65rem; background-color: var(--surface-soft); }
.u-tint-accent { font-size: 0.65rem; background-color: rgba(37, 99, 235, 0.15); color: var(--accent); }

/* Layout helpers */
.u-flex-center { display: flex; align-items: center; gap: 0.5rem; }
.u-inline-mark { display: inline-block; margin-right: 8px; vertical-align: middle; }
.u-mark-sm { margin-right: 4px; vertical-align: middle; }
.u-list-indent { margin-left: 1.5rem; padding-left: 0; line-height: 1.8; margin-bottom: 1.5rem; }
.u-grid-7 { margin-top: 1.5rem; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.u-grid-2-flush { grid-template-columns: repeat(2, 1fr); margin-bottom: 0; }
.u-input-tall { height: 42px; border-radius: 8px; }
.u-btn-bad { margin-left: auto; border-color: var(--bad); color: var(--bad); }
.u-bare { border: none; padding: 0; margin: 0; }

/* --- Ledger: manual refresh controls --- */
.refresh-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.refresh-controls .btn-primary[disabled] {
  opacity: 0.6;
  cursor: progress;
}
