/* ============================================================
   SANDWICH ALERTER — MODERN THEMED DESIGN SYSTEM
   Dark (Default) & Light Modes + Responsive Navigation
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ---------- CSS Variables & Themes ---------- */
:root,
:root[data-theme="light"] {
  --bg: #f8fafc;
  --bg-gradient: radial-gradient(circle at 50% 0%, #eef2f8 0%, #f8fafc 70%);
  --panel: #ffffff;
  --panel-card: rgba(255, 255, 255, 0.88);
  --panel-elevated: #f1f5f9;
  --panel-hover: #f8fafc;
  --panel-input: #ffffff;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --line-focus: #2563eb;

  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #64748b;
  --subtle: #94a3b8;

  --accent: #2563eb;
  --accent-rgb: 37, 99, 235;
  --accent-hover: #1d4ed8;
  --accent-light: rgba(37, 99, 235, 0.09);
  --accent-gradient: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);

  --green: #059669;
  --green-rgb: 5, 150, 105;
  --green-bg: rgba(5, 150, 105, 0.1);
  --green-border: rgba(5, 150, 105, 0.25);

  --red: #e11d48;
  --red-rgb: 225, 29, 72;
  --red-bg: rgba(225, 29, 72, 0.1);
  --red-border: rgba(225, 29, 72, 0.25);

  --amber: #d97706;
  --amber-rgb: 217, 119, 6;
  --amber-bg: rgba(217, 119, 6, 0.1);
  --amber-border: rgba(217, 119, 6, 0.25);

  --nav-bg: rgba(255, 255, 255, 0.9);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px -4px rgba(0, 0, 0, 0.08);
  --glow-accent: 0 0 20px -3px rgba(37, 99, 235, 0.25);

  --code-bg: #f1f5f9;
}

:root[data-theme="dark"] {
  --bg: #0a0d14;
  --bg-gradient: radial-gradient(circle at 50% 0%, #151d2f 0%, #0a0d14 70%);
  --panel: #111726;
  --panel-card: rgba(17, 23, 38, 0.75);
  --panel-elevated: #161e31;
  --panel-hover: #1c273e;
  --panel-input: #0e1422;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --line-focus: #3b82f6;
  
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --muted: #64748b;
  --subtle: #475569;

  --accent: #3b82f6;
  --accent-rgb: 59, 130, 246;
  --accent-hover: #2563eb;
  --accent-light: rgba(59, 130, 246, 0.12);
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  
  --green: #10b981;
  --green-rgb: 16, 185, 129;
  --green-bg: rgba(16, 185, 129, 0.12);
  --green-border: rgba(16, 185, 129, 0.3);
  
  --red: #f43f5e;
  --red-rgb: 244, 63, 94;
  --red-bg: rgba(244, 63, 94, 0.12);
  --red-border: rgba(244, 63, 94, 0.3);
  
  --amber: #f59e0b;
  --amber-rgb: 245, 158, 11;
  --amber-bg: rgba(245, 158, 11, 0.12);
  --amber-border: rgba(245, 158, 11, 0.3);

  --nav-bg: rgba(11, 15, 25, 0.88);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px -4px rgba(0, 0, 0, 0.5);
  --glow-accent: 0 0 20px -3px rgba(59, 130, 246, 0.35);

  --code-bg: #090d16;
}

/* ---------- Global Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ---------- Layout Containers ---------- */
main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

/* ---------- Navigation Bar ---------- */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  height: 64px;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  transition: all 0.2s ease;
}

/* Hamburger button (Left side on mobile) */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--panel-elevated);
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  margin-right: 8px;
  transition: all 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}
.mobile-menu-btn:hover {
  background: var(--panel-hover);
  border-color: var(--line-strong);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
  margin-right: 14px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: var(--glow-accent);
  flex-shrink: 0;
}

.drawer-header {
  display: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

nav a.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
  position: relative;
}

nav a.nav-link:hover {
  color: var(--text);
  background: var(--panel-hover);
}

nav a.nav-link.on {
  color: var(--accent);
  background: var(--accent-light);
  font-weight: 600;
}

nav .spacer {
  flex: 1;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Worker Status Indicator */
.worker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  letter-spacing: 0.1px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.worker-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.worker.up {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green-border);
}
.worker.up .worker-dot {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}
.worker.up .worker-dot::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--green);
  opacity: 0.7;
  animation: pulse-ring 1.8s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

.worker.warn {
  background: var(--amber-bg);
  color: var(--amber);
  border-color: var(--amber-border);
}
.worker.warn .worker-dot {
  background: var(--amber);
}

.worker.down {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-border);
}
.worker.down .worker-dot {
  background: var(--red);
}

@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Theme Switcher Button */
.theme-btn {
  background: var(--panel-elevated);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  flex-shrink: 0;
}
.theme-btn:hover {
  background: var(--panel-hover);
  color: var(--text);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.theme-btn svg {
  width: 17px;
  height: 17px;
  transition: transform 0.3s ease;
}
.theme-btn:hover svg {
  transform: rotate(18deg);
}

/* Log out button in nav */
.logout-btn {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.logout-btn:hover {
  color: var(--red);
  background: var(--red-bg);
}

/* ---------- Typography & Headers ---------- */
h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin: 0 0 6px;
  color: var(--text);
}

h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
  margin: 32px 0 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sub {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 13.5px;
  line-height: 1.5;
}

.page-header {
  margin-bottom: 24px;
}

.header-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.header-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-elevated);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.header-chip strong {
  color: var(--text);
}

/* ---------- Cards ---------- */
.card {
  background: var(--panel-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- Stat Tiles / Metrics Grid ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.tile {
  background: var(--panel-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background 0.2s ease;
}

.tile:hover::before {
  background: var(--accent);
}

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

.tile .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.tile .tile-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile .value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.tile .value.green { color: var(--green); }
.tile .value.red   { color: var(--red); }
.tile .value.muted { color: var(--muted); }

.tile .tile-footnote {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 6px;
}

/* ---------- Range Bar / Filter Controls ---------- */
.rangebar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  padding: 6px;
  background: var(--panel-card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.range-segments {
  display: inline-flex;
  gap: 4px;
  background: var(--panel-elevated);
  padding: 4px;
  border-radius: 9px;
  border: 1px solid var(--line);
}

.range-segments a {
  padding: 6px 14px;
  border-radius: 7px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.range-segments a:hover {
  color: var(--text);
}

.range-segments a.on {
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.range-custom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* ---------- Tables ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
}

th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-elevated);
  white-space: nowrap;
}

th:first-child {
  border-top-left-radius: 8px;
}
th:last-child {
  border-top-right-radius: 8px;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  vertical-align: middle;
}

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

tbody tr {
  transition: background-color 0.15s ease;
}

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

.num {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}

.green { color: var(--green); }
.red   { color: var(--red); }
.amber { color: var(--amber); }
.muted { color: var(--muted); }

.pair-badge {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tf-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--panel-elevated);
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
  color: var(--text-secondary);
}

/* ---------- Badges & Status Pills ---------- */
.pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.pill.long {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}
.pill.short {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}
.pill.won {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}
.pill.lost {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}
.pill.pending {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}
.pill.filled {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
}
.pill.expired {
  background: var(--panel-elevated);
  color: var(--muted);
  border: 1px solid var(--line);
}

/* ---------- Forms & Inputs ---------- */
.field {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=date],
input[type=search],
textarea,
select {
  width: 100%;
  padding: 10px 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-input);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--line-focus);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
}

select {
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
  line-height: 1.45;
}

/* Modern iOS Style Toggle Switch */
.switch-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--line-strong);
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
}

.slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .slider {
  background-color: var(--green);
}

.switch input:focus + .slider {
  box-shadow: 0 0 0 3px rgba(var(--green-rgb), 0.25);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

.switch-label {
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
  user-select: none;
}

/* Checkbox Chip Selector (e.g., for timeframes) */
.chip-checkboxes {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.chip-checkbox {
  position: relative;
}

.chip-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.chip-checkbox label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--panel-elevated);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  margin: 0;
}

.chip-checkbox input[type="checkbox"]:checked + label {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.chip-checkbox input[type="checkbox"]:focus + label {
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.2);
}

/* Legacy .check support fallback */
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}
.check input[type=checkbox] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
}
.check label {
  margin: 0;
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
}

/* ---------- Buttons ---------- */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

button:hover, .btn:hover {
  background: var(--panel-hover);
  border-color: var(--line-strong);
  color: var(--text);
  transform: translateY(-1px);
}

button:active, .btn:active {
  transform: translateY(0);
}

button.primary, .btn.primary {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #ffffff;
  font-weight: 600;
  box-shadow: var(--glow-accent);
}
button.primary:hover, .btn.primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 24px -2px rgba(var(--accent-rgb), 0.5);
}

button.danger, .btn.danger {
  color: var(--red);
  background: var(--red-bg);
  border-color: var(--red-border);
}
button.danger:hover, .btn.danger:hover {
  background: var(--red);
  color: #ffffff;
  border-color: var(--red);
}

button.success, .btn.success {
  color: var(--green);
  background: var(--green-bg);
  border-color: var(--green-border);
}
button.success:hover, .btn.success:hover {
  background: var(--green);
  color: #ffffff;
  border-color: var(--green);
}

button.sm, .btn.sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.row .field {
  margin-bottom: 0;
}

/* ---------- Banners & Alerts ---------- */
.banner {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: var(--shadow-sm);
  animation: slide-in 0.25s ease-out;
}

.banner svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.banner.ok {
  border-color: var(--green-border);
  background: var(--green-bg);
  color: var(--green);
}

.banner.error {
  border-color: var(--red-border);
  background: var(--red-bg);
  color: var(--red);
}

.banner.warn {
  border-color: var(--amber-border);
  background: var(--amber-bg);
  color: var(--amber);
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Code & Terminal Styling ---------- */
code {
  background: var(--code-bg);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  border: 1px solid var(--line);
}

.log-table td {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
}

.log-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}
.log-badge.info { background: var(--accent-light); color: var(--accent); }
.log-badge.warn { background: var(--amber-bg); color: var(--amber); }
.log-badge.error { background: var(--red-bg); color: var(--red); }

/* ---------- Login Screen ---------- */
.login-container {
  min-height: calc(85vh - 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}

.login-box {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-brand-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent-gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: var(--glow-accent);
  margin-bottom: 16px;
}

.login-card {
  background: var(--panel-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
}

.input-icon-wrap {
  position: relative;
  width: 100%;
}

.input-icon-wrap input {
  width: 100% !important;
  height: 44px !important;
  padding: 0 14px 0 42px !important;
  border-radius: 9px !important;
  font-size: 14px !important;
  box-sizing: border-box !important;
}

.input-icon {
  position: absolute;
  left: 13px;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  pointer-events: none;
  z-index: 2;
}

.login-btn {
  width: 100%;
  height: 44px;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: 9px;
  margin-top: 8px;
}

/* ---------- Responsive Breakpoints & Mobile Drawer ---------- */
.nav-overlay {
  display: none;
}

@media (max-width: 860px) {
  nav {
    padding: 0 16px;
    gap: 6px;
  }
  
  /* Show hamburger button on the far left */
  .mobile-menu-btn {
    display: inline-flex;
  }

  /* Compact worker text on mobile */
  .worker-label {
    display: none;
  }
  .worker {
    padding: 6px 8px;
  }

  /* Backdrop Scrim Overlay */
  .nav-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 998;
  }
  .nav-overlay.open {
    opacity: 1;
    visibility: visible;
  }

  /* Left-sliding Off-canvas Navigation Drawer */
  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: calc(100vw - 50px);
    height: 100vh;
    height: 100dvh;
    background: var(--panel);
    border-right: 1px solid var(--line);
    box-shadow: 12px 0 36px rgba(0, 0, 0, 0.45);
    flex-direction: column;
    padding: 20px 16px;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 999;
    overflow-y: auto;
    gap: 6px;
  }

  .nav-links.open {
    transform: translateX(0);
  }

  /* Header inside mobile drawer with brand and close button */
  .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding-bottom: 16px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
  }

  .drawer-close-btn {
    background: var(--panel-elevated);
    border: 1px solid var(--line);
    color: var(--text-secondary);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s ease;
  }
  .drawer-close-btn:hover {
    color: var(--text);
    background: var(--panel-hover);
    border-color: var(--line-strong);
  }

  nav a.nav-link {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border-radius: 9px;
  }

  .range-custom {
    margin-left: 0;
    width: 100%;
    margin-top: 8px;
  }
}

@media (max-width: 640px) {
  main {
    padding: 18px 14px 50px;
  }
  .tiles {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .tile {
    padding: 14px;
  }
  .tile .value {
    font-size: 20px;
  }
  .range-segments {
    width: 100%;
    justify-content: space-between;
  }
  .range-segments a {
    padding: 6px 10px;
    font-size: 12px;
    text-align: center;
    flex: 1;
  }
}
