/* MOSAIC IPE — Theme CSS
   Extracted from design-12.html blueprint theme.
   White-label ready: swap this file to change the look. */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --bg-deep: #0A1628;
  --bg-panel: #0E1E36;
  --grid-line: rgba(126, 200, 227, 0.08);
  --primary: #7EC8E3;
  --primary-dim: rgba(126, 200, 227, 0.15);
  --primary-faint: rgba(126, 200, 227, 0.08);
  --text: #D4E8F1;
  --text-secondary: #9BB6CE;
  --text-tertiary: #4A6A80;
  --accent: #FF6B35;
  --accent-dim: rgba(255, 107, 53, 0.12);
  --success: #45B69C;
  --warning: #F4C95D;
  --danger: #E05252;
  --sidebar-bg: #071020;
  --border: rgba(126, 200, 227, 0.3);
  --border-solid: rgba(126, 200, 227, 0.4);
  --font-mono: 'JetBrains Mono', monospace;
  --font-body: 'Outfit', sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background-color: var(--bg-deep);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  background-image:
    repeating-linear-gradient(0deg, var(--grid-line) 0px, var(--grid-line) 1px, transparent 1px, transparent 40px),
    repeating-linear-gradient(90deg, var(--grid-line) 0px, var(--grid-line) 1px, transparent 1px, transparent 40px);
  background-size: 40px 40px;
}

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

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 220px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px dashed var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: block;
}

.sidebar-title {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 3px;
}

.sidebar-title::before {
  content: '+  ';
  color: var(--primary);
  font-weight: 400;
}

.sidebar-subtitle {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-tertiary);
  letter-spacing: 3px;
  margin-top: 6px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
  user-select: none;
  text-decoration: none;
}

.nav-item:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-dim);
}

.nav-prefix {
  color: var(--text-tertiary);
  margin-right: 10px;
  font-size: 11px;
  min-width: 24px;
}

.nav-item.active .nav-prefix {
  color: var(--accent);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px dashed var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
  line-height: 1.8;
  letter-spacing: 1px;
}

/* ── Main Content ──────────────────────────────────────────── */
.main {
  margin-left: 220px;
  height: 100vh;
  overflow-y: auto;
  position: relative;
}

/* ── Collapsible sidebar (hide / show) ───────────────────────── */
.sidebar,
.main { transition: transform 0.2s ease, margin-left 0.2s ease; }
html.sidebar-collapsed .sidebar { transform: translateX(-100%); }
html.sidebar-collapsed .main { margin-left: 0; }
.sidebar-toggle {
  position: fixed; top: 8px; left: 186px; z-index: 101;
  width: 26px; height: 26px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--sidebar-bg); color: var(--primary);
  border: 1px solid var(--border); border-radius: 3px;
  font-family: var(--font-mono); font-size: 15px; line-height: 1;
  cursor: pointer;
  transition: left 0.2s ease, color 0.15s, border-color 0.15s;
}
.sidebar-toggle:hover { color: var(--text); border-color: var(--primary); }
html.sidebar-collapsed .sidebar-toggle { left: 8px; }

.ruler {
  height: 24px;
  border-bottom: 1px solid var(--border);
  background: var(--sidebar-bg);
  display: flex;
  align-items: flex-end;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.ruler-tick {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-tertiary);
  min-width: 80px;
  border-left: 1px solid var(--border);
  padding-left: 4px;
  padding-bottom: 2px;
}

.content {
  padding: 32px;
}

/* ── Section Headers ───────────────────────────────────────── */
.section-header { margin-bottom: 28px; }

.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 3px;
  text-transform: uppercase;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--primary-dim);
}

/* ── Blueprint Panel ───────────────────────────────────────── */
.bp-panel {
  border: 1px dashed var(--border);
  background: rgba(14, 30, 54, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(126, 200, 227, 0.1), 0 2px 12px rgba(0, 0, 0, 0.2);
  padding: 20px;
  position: relative;
  transition: border-color 0.2s ease, border-style 0.2s ease;
}

.bp-panel:hover {
  border-color: var(--accent);
  border-style: solid;
}

.bp-panel::before, .bp-panel::after {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
  position: absolute;
}

.bp-panel::before { content: attr(data-corner-tl); top: -8px; left: 6px; }
.bp-panel::after { content: attr(data-corner-br); bottom: -8px; right: 6px; }

/* Corner brackets */
.corner-panel { position: relative; }

.corner-panel::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 10px; height: 10px;
  border-top: 2px solid var(--primary);
  border-left: 2px solid var(--primary);
  pointer-events: none;
}

.corner-panel::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 10px; height: 10px;
  border-bottom: 2px solid var(--primary);
  border-right: 2px solid var(--primary);
  pointer-events: none;
}

/* ── Panel Title ───────────────────────────────────────────── */
.panel-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

/* ── Grid Layouts ──────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 28px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 28px; }
.four-col { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.six-col { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-bottom: 28px; }

/* ── Data Tables ───────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  color: var(--primary); text-transform: uppercase; letter-spacing: 1px;
  padding: 8px 10px; text-align: left;
  border-bottom: 1px dashed var(--primary-faint);
  background: rgba(126,200,227,0.03);
}
.data-table tbody td {
  padding: 8px 10px; font-size: 12px; color: var(--text-secondary);
  border-bottom: 1px dashed rgba(126,200,227,0.06);
}
.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover { background: rgba(126,200,227,0.04); }

/* ── KPI Blocks ────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-bottom: 28px; }

.kpi-block {
  border: 1px dashed var(--border);
  padding: 18px 14px;
  text-align: center;
  position: relative;
  background: rgba(14, 30, 54, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(126, 200, 227, 0.1), 0 2px 12px rgba(0, 0, 0, 0.2);
}

.kpi-block::before { content: '+'; position: absolute; top: 2px; left: 4px; font-family: var(--font-mono); font-size: 8px; color: var(--text-tertiary); }
.kpi-block::after { content: '+'; position: absolute; bottom: 2px; right: 4px; font-family: var(--font-mono); font-size: 8px; color: var(--text-tertiary); }

.kpi-value { font-family: var(--font-mono); font-size: 32px; font-weight: 700; color: var(--primary); line-height: 1; }
.kpi-label { font-family: var(--font-body); font-size: 13px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1.5px; margin-top: 8px; }
.kpi-delta { font-family: var(--font-mono); font-size: 12px; margin-top: 6px; }
.kpi-delta.up { color: var(--accent); }
.kpi-delta.down { color: var(--success); }

/* ── Stat Boxes ────────────────────────────────────────────── */
.stats-row { display: flex; gap: 16px; margin-bottom: 24px; }

.stat-box {
  border: 1px dashed var(--border);
  padding: 12px 20px;
  text-align: center;
  flex: 1;
  background: rgba(14, 30, 54, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(126, 200, 227, 0.1), 0 2px 12px rgba(0, 0, 0, 0.2);
}

.stat-value { font-family: var(--font-mono); font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }

/* ── Tables ────────────────────────────────────────────────── */
.bp-table { width: 100%; border-collapse: collapse; font-size: 13px; background: rgba(14, 30, 54, 0.4); }
.bp-table th { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); background: rgba(126, 200, 227, 0.06); }
.bp-table td { padding: 8px 10px; border-bottom: 1px dashed var(--primary-faint); color: var(--text); font-size: 13px; vertical-align: middle; }
.bp-table tr:hover td { background: var(--primary-faint); }

/* ── Badges ────────────────────────────────────────────────── */
.badge { display: inline-block; font-family: var(--font-mono); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 2px; letter-spacing: 1px; text-transform: uppercase; }
.badge-critical { color: var(--accent); border: 1px solid var(--accent); background: rgba(255,107,53,0.1); }
.badge-high { color: var(--warning); border: 1px solid var(--warning); background: rgba(244,201,93,0.1); }
.badge-medium { color: var(--primary); border: 1px solid var(--primary); background: var(--primary-faint); }
.badge-low { color: var(--success); border: 1px solid var(--success); background: rgba(69,182,156,0.1); }
.badge-info { color: var(--primary); border: 1px solid var(--primary); background: var(--primary-faint); }

/* ── Progress Bars ─────────────────────────────────────────── */
.bar-track { height: 6px; border: 1px dashed var(--border); position: relative; margin-top: 4px; background: transparent; }
.bar-fill { position: absolute; top: 0; left: 0; bottom: 0; background: var(--primary); transition: width 0.6s ease; }
.bar-fill.orange { background: var(--accent); }
.bar-fill.yellow { background: var(--warning); }
.bar-fill.green { background: var(--success); }

/* ── Status Indicators ─────────────────────────────────────── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.status-dot.active { background: var(--success); animation: pulse-dot 2s infinite; }
.status-dot.warning { background: var(--warning); }
.status-dot.error { background: var(--accent); }
.status-dot.offline { background: var(--text-tertiary); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(69,182,156,0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 4px rgba(69,182,156,0); }
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  background: rgba(14, 30, 54, 0.8);
  border: 1px dashed var(--border);
  outline: none;
  transition: border-color 0.2s, border-style 0.2s;
}

.form-input:focus {
  border-color: var(--primary);
  border-style: solid;
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

textarea.form-input {
  resize: vertical;
  min-height: 60px;
}

select.form-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237A9BB5' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

select.form-input option {
  background: var(--bg-panel);
  color: var(--text);
}

/* ── Custom Dropdown ───────────────────────────────────────── */
.custom-dropdown {
  position: relative;
  width: 100%;
}

.custom-dropdown-trigger {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  background: rgba(14, 30, 54, 0.8);
  border: 1px dashed var(--border);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.2s, border-style 0.2s;
  user-select: none;
}

.custom-dropdown-trigger:hover,
.custom-dropdown.open .custom-dropdown-trigger {
  border-color: var(--primary);
  border-style: solid;
}

.custom-dropdown-arrow {
  font-size: 8px;
  color: var(--text-tertiary);
  transition: transform 0.2s;
}

.custom-dropdown.open .custom-dropdown-arrow {
  transform: rotate(180deg);
}

.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  z-index: 200;
  max-height: 200px;
  overflow-y: auto;
}

.custom-dropdown-item {
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  border-bottom: 1px dashed var(--primary-faint);
}

.custom-dropdown-item:last-child {
  border-bottom: none;
}

.custom-dropdown-item:hover {
  background: var(--primary-faint);
  color: var(--text);
}

.custom-dropdown-item.selected {
  color: var(--primary);
  background: var(--primary-faint);
}

/* ── Toggle Switch ─────────────────────────────────────────── */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  display: none;
}

.toggle-track {
  width: 36px;
  height: 18px;
  border: 1px dashed var(--border);
  background: rgba(14, 30, 54, 0.8);
  position: relative;
  transition: all 0.2s;
  flex-shrink: 0;
}

.toggle-knob {
  width: 12px;
  height: 12px;
  background: var(--text-tertiary);
  position: absolute;
  top: 2px;
  left: 2px;
  transition: all 0.2s;
}

.toggle input:checked ~ .toggle-track {
  border-color: var(--primary);
  border-style: solid;
  background: var(--primary-faint);
}

.toggle input:checked ~ .toggle-track .toggle-knob {
  left: 20px;
  background: var(--primary);
}

.toggle-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.toggle input:checked ~ .toggle-label {
  color: var(--primary);
}

/* ── Custom Checkbox ───────────────────────────────────────── */
.custom-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.custom-check input {
  display: none;
}

.custom-check-box {
  width: 16px;
  height: 16px;
  border: 1px dashed var(--border);
  background: rgba(14, 30, 54, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.custom-check-box::after {
  content: '';
  width: 8px;
  height: 8px;
  background: transparent;
  transition: background 0.2s;
}

.custom-check input:checked ~ .custom-check-box {
  border-color: var(--primary);
  border-style: solid;
}

.custom-check input:checked ~ .custom-check-box::after {
  background: var(--primary);
}

.custom-check-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.custom-check input:checked ~ .custom-check-label {
  color: var(--text);
}

/* ── Segmented Control (Radio replacement) ─────────────────── */
.segmented {
  display: inline-flex;
  border: 1px dashed var(--border);
}

.segmented-option {
  display: block;
}

.segmented-option input {
  display: none;
}

.segmented-btn {
  padding: 8px 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s;
  border-right: 1px dashed var(--border);
  user-select: none;
}

.segmented-option:last-child .segmented-btn {
  border-right: none;
}

.segmented-option input:checked + .segmented-btn {
  background: var(--primary-faint);
  color: var(--primary);
  border-color: var(--primary);
}

.segmented-btn:hover {
  background: var(--primary-faint);
  color: var(--text-secondary);
}

/* ── Data Preview ──────────────────────────────────────────── */
.data-preview {
  border: 1px dashed var(--border);
  background: rgba(7, 16, 32, 0.6);
  padding: 12px;
  margin-top: 12px;
  max-height: 300px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
}

.data-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  cursor: pointer;
  padding: 8px 12px;
  border: 1px dashed var(--primary-faint);
  background: rgba(126, 200, 227, 0.04);
  transition: border-color 0.2s;
}

.data-preview-header:hover {
  border-color: var(--primary);
  border-style: solid;
}

.path-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px dashed var(--primary-faint);
  background: rgba(7, 16, 32, 0.4);
  margin-top: 8px;
}

.path-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  border-bottom: 1px dashed var(--primary-faint);
  transition: background 0.15s;
}

.path-item:hover { background: var(--primary-faint); }
.path-item:last-child { border-bottom: none; }

.path-name { flex: 1; color: var(--text); }
.path-type { color: var(--text-tertiary); font-size: 10px; min-width: 60px; }
.path-sample { color: var(--text-tertiary); font-size: 10px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.field-preview {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
  padding: 2px 6px;
  background: rgba(14, 30, 54, 0.6);
  border: 1px dashed var(--primary-faint);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  border: 1px solid;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  color: var(--bg-deep);
  background: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: transparent;
  color: var(--primary);
}

.btn-accent {
  color: var(--bg-deep);
  background: var(--accent);
  border-color: var(--accent);
}

.btn-accent:hover {
  background: transparent;
  color: var(--accent);
}

.btn-outline {
  color: var(--primary);
  background: transparent;
  border-color: var(--border);
  border-style: dashed;
}

.btn-outline:hover {
  border-color: var(--primary);
  border-style: solid;
  background: var(--primary-faint);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 11px;
  letter-spacing: 1px;
}

/* ── Alerts / Messages ─────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border: 1px dashed;
  font-family: var(--font-mono);
  font-size: 12px;
  margin-bottom: 20px;
}

.alert-error { color: var(--danger); border-color: var(--danger); background: rgba(224,82,82,0.08); }
.alert-success { color: var(--success); border-color: var(--success); background: rgba(69,182,156,0.08); }
.alert-warning { color: var(--warning); border-color: var(--warning); background: rgba(244,201,93,0.08); }
.alert-info { color: var(--primary); border-color: var(--primary); background: var(--primary-faint); }

/* ── Utility Classes ───────────────────────────────────────── */
.mono { font-family: var(--font-mono); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-cyan { color: var(--primary); }
.text-orange { color: var(--accent); }
.text-yellow { color: var(--warning); }
.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.text-white { color: var(--text); }
.fw-600 { font-weight: 600; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }

/* ── Confirm Modal ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(7, 16, 32, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box {
  width: 400px;
  border: 1px dashed var(--border);
  background: var(--bg-panel);
  padding: 28px;
  position: relative;
}

.modal-box::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 12px; height: 12px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
}

.modal-box::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 12px; height: 12px;
  border-bottom: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
}

.modal-title {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.modal-message {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── HTMX Transitions ─────────────────────────────────────── */
#main-content {
  transition: opacity 0.2s ease;
}

#main-content.htmx-swapping {
  opacity: 0;
}

#main-content.htmx-settling {
  opacity: 1;
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: block;
}

.htmx-request.htmx-indicator {
  display: block;
}

/* ── Login Page ────────────────────────────────────────────── */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  margin-left: 0;
}

.login-box {
  width: 380px;
  border: 1px dashed var(--border);
  background: rgba(14, 30, 54, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 40px;
  position: relative;
}

.login-box::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 14px; height: 14px;
  border-top: 2px solid var(--primary);
  border-left: 2px solid var(--primary);
}

.login-box::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 14px; height: 14px;
  border-bottom: 2px solid var(--primary);
  border-right: 2px solid var(--primary);
}

.login-logo {
  display: block;
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
}

.login-title {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 4px;
  text-align: center;
  margin-bottom: 8px;
}

.login-subtitle {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
  letter-spacing: 3px;
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 32px;
}

/* ── Error Page ────────────────────────────────────────────── */
.error-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  margin-left: 0;
}

.error-box {
  text-align: center;
}

.error-code {
  font-family: var(--font-mono);
  font-size: 80px;
  font-weight: 700;
  color: var(--primary-dim);
  line-height: 1;
}

.error-message {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-secondary);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 12px;
}

.error-link {
  margin-top: 24px;
}

/* Loading skeleton */
@keyframes skel-shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.loading-skeleton { padding: 0; }
.skel-header {
  height: 18px; width: 200px; margin-bottom: 20px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(126,200,227,0.04) 25%, rgba(126,200,227,0.1) 50%, rgba(126,200,227,0.04) 75%);
  background-size: 800px 100%;
  animation: skel-shimmer 1.5s infinite linear;
}
.skel-row { display: flex; gap: 16px; margin-bottom: 16px; }
.skel-block {
  height: 90px; flex: 1; border-radius: 2px;
  border: 1px dashed rgba(126,200,227,0.08);
  background: linear-gradient(90deg, rgba(126,200,227,0.03) 25%, rgba(126,200,227,0.07) 50%, rgba(126,200,227,0.03) 75%);
  background-size: 800px 100%;
  animation: skel-shimmer 1.5s infinite linear;
}
.skel-block.skel-wide { height: 160px; flex: none; width: 100%; }
.skel-msg {
  text-align: center; padding: 16px 0; font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 2px; color: rgba(126,200,227,0.3);
  text-transform: uppercase;
  animation: skel-shimmer 1.5s infinite linear;
  background: linear-gradient(90deg, rgba(126,200,227,0.15) 25%, rgba(126,200,227,0.4) 50%, rgba(126,200,227,0.15) 75%);
  background-size: 800px 100%;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
