/* ─── Variables – Dark (default) ─────────────────────────────────────────────── */
:root {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface-2:   #21262d;
  --surface-3:   #2d333b;
  --border:      #30363d;
  --border-sub:  #1c2128;
  --text:        #cdd9e5;
  --text-muted:  #768390;
  --text-bright: #e6edf3;
  --accent:      #f0900a;
  --accent-h:    #ff9d1a;
  --accent-dim:  rgba(240,144,10,.13);
  --accent-glow: rgba(240,144,10,.22);
  --success:     #3fb950;
  --success-dim: rgba(63,185,80,.12);
  --danger:      #f85149;
  --danger-dim:  rgba(248,81,73,.12);
  --warning:     #e3b341;
  --info:        #58a6ff;
  --font-ui:     'Source Sans 3', sans-serif;
  --font-body:   'Source Sans 3', sans-serif;
  --font-mono:   'JetBrains Mono', monospace;
  --sidebar-w:   210px;
  --header-h:    54px;
  --r:           5px;
  --shadow:      0 1px 3px rgba(0,0,0,.5), 0 4px 12px rgba(0,0,0,.3);
}

/* ─── Variables – Light ──────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:          #f2f4f6;
  --surface:     #ffffff;
  --surface-2:   #f0f2f4;
  --surface-3:   #e4e7eb;
  --border:      #ced4da;
  --border-sub:  #e9ecef;
  --text:        #212529;
  --text-muted:  #6c757d;
  --text-bright: #0d1117;
  --accent:      #c87000;
  --accent-h:    #a85e00;
  --accent-dim:  rgba(200,112,0,.1);
  --accent-glow: rgba(200,112,0,.18);
  --success:     #198754;
  --success-dim: rgba(25,135,84,.1);
  --danger:      #dc3545;
  --danger-dim:  rgba(220,53,69,.1);
  --warning:     #856404;
  --info:        #0d6efd;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
}

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

html, body {
  height: 100%;
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(circle, #21262d 1px, transparent 1px);
  background-size: 22px 22px;
}

[data-theme="light"] body {
  background-image: radial-gradient(circle, #d0d5db 1px, transparent 1px);
}

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

/* ─── Header ─────────────────────────────────────────────────────────────────── */
#app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem 0 0.75rem;
  z-index: 1000;
  box-shadow: 0 1px 0 var(--border), 0 2px 12px rgba(0,0,0,.4);
}

/* thin amber accent line at top of header */
#app-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-h), transparent 80%);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.header-brand {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.header-brand-icon {
  font-size: 1.1rem;
  color: var(--accent);
  line-height: 1;
  position: relative;
  top: 1px;
}

#app-header h1 {
  font-family: var(--font-ui);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-bright);
}

.brand-sub {
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-left: 0.1em;
}

.menu-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: var(--r);
  line-height: 1;
  display: none;
  transition: color .15s, background .15s;
}
.menu-btn:hover { color: var(--text-bright); background: var(--surface-2); }

.theme-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 9px;
  border-radius: var(--r);
  line-height: 1;
  transition: color .15s, background .15s, border-color .15s;
  margin-right: 0.5rem;
}
.theme-btn:hover { color: var(--text-bright); background: var(--surface-2); border-color: var(--accent); }

/* ─── Stock Display ──────────────────────────────────────────────────────────── */
.stock-display {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  transition: all .3s;
}

.stock-info {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.stock-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stock-value {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--success);
  transition: color .3s;
  min-width: 7ch;
  text-align: right;
}

.stock-bar {
  width: 130px;
  height: 3px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}

.stock-bar-fill {
  height: 100%;
  width: 0;
  background: var(--success);
  border-radius: 2px;
  transition: width .8s cubic-bezier(.4,0,.2,1), background .3s;
}

.stock-display.stock-low .stock-value { color: var(--danger); }
.stock-display.stock-low .stock-bar-fill { background: var(--danger); }
.stock-display.stock-low { animation: pulseWarn 2s infinite; }

@keyframes pulseWarn {
  0%, 100% { opacity: 1; }
  50% { opacity: .75; }
}

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* ─── Auth ──────────────────────────────────────────────────────────────────── */
.auth-shell {
  min-height: calc(100vh - var(--header-h) - 2rem);
  display: grid;
  place-items: center;
  padding: 1.5rem 0;
}

.auth-card {
  width: min(100%, 430px);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.auth-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.45rem;
}

.auth-title {
  font-size: 1.7rem;
  line-height: 1.1;
  color: var(--text-bright);
  margin-bottom: 0.5rem;
}

.auth-copy {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.auth-alert {
  margin-bottom: 0.85rem;
}

.auth-form .form-actions {
  margin-top: 0.5rem;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem 0 2rem;
  flex-shrink: 0;
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 900;
  transition: transform .25s ease;
}

.sidebar-section-label {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 1rem 0.6rem;
  opacity: 0.7;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0.75rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 1rem;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: color .15s, background .15s;
  position: relative;
  border-left: 2px solid transparent;
}

.nav-icon {
  font-size: 0.8rem;
  width: 1.1rem;
  text-align: center;
  opacity: 0.7;
  flex-shrink: 0;
}

.nav-link:hover {
  color: var(--text-bright);
  background: var(--surface-2);
  text-decoration: none;
}
.nav-link:hover .nav-icon { opacity: 1; }

.nav-link.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
  font-weight: 600;
}
.nav-link.active .nav-icon { opacity: 1; color: var(--accent); }

/* ─── Content ────────────────────────────────────────────────────────────────── */
#content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 1.5rem;
  min-width: 0;
  position: relative;
}

/* ─── Page Title ─────────────────────────────────────────────────────────────── */
.page-title {
  font-family: var(--font-ui);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text-bright);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.page-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border) 0%, transparent 100%);
  margin-left: 0.75rem;
}

/* ─── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 60%);
  opacity: 0.7;
}

.card-title {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

/* ─── Dashboard Grid ─────────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.2rem 1.3rem;
  position: relative;
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.stat-card:hover {
  border-color: var(--surface-3);
  box-shadow: 0 0 0 1px var(--surface-3);
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent);
  opacity: 0.6;
}

.stat-card.stat-ok::after  { background: var(--success); }
.stat-card.stat-warn::after { background: var(--warning); }
.stat-card.stat-bad::after  { background: var(--danger); }

.stat-label {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-bright);
  line-height: 1;
  margin-bottom: 0.3rem;
}
.stat-card.stat-bad .stat-value { color: var(--danger); }
.stat-card.stat-warn .stat-value { color: var(--warning); }
.stat-card.stat-ok .stat-value  { color: var(--success); }

.stat-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Fuel gauge bar inside stat card */
.stat-gauge {
  margin-top: 0.75rem;
  height: 5px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}
.stat-gauge-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--success);
  transition: width .8s cubic-bezier(.4,0,.2,1), background .3s;
}

/* ─── Quick Actions ──────────────────────────────────────────────────────────── */
.quick-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1.05rem;
  border: 1px solid transparent;
  border-radius: var(--r);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  line-height: 1.5;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: #0d1117;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-3); color: var(--text-bright); }

.btn-accent {
  background: var(--accent);
  color: #0d1117;
  border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-h); }

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: rgba(248,81,73,.3);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-success {
  background: var(--success-dim);
  color: var(--success);
  border-color: rgba(63,185,80,.3);
}
.btn-success:hover { background: var(--success); color: #0d1117; }

.btn-sm { padding: 0.28rem 0.65rem; font-size: 0.8rem; }
.btn-lg { padding: 0.6rem 1.5rem; font-size: 1rem; }

/* ─── Tables ─────────────────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  padding: 0.65rem 0.9rem;
  text-align: left;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border-sub);
  transition: background .1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:nth-child(even) { background: rgba(255,255,255,.018); }
tbody tr:nth-child(even):hover { background: var(--surface-2); }

tbody td {
  padding: 0.6rem 0.9rem;
  vertical-align: middle;
  color: var(--text);
}

.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }

/* Mono numbers in tables */
tbody td.num, tfoot td.num {
  font-family: var(--font-mono);
  font-size: 0.83rem;
}

tfoot td {
  padding: 0.6rem 0.85rem;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.83rem;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  color: var(--text-bright);
}

/* ─── Forms ──────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.form-group label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--text-bright);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-control::placeholder { color: var(--text-muted); opacity: 0.6; }

.form-control.is-invalid { border-color: var(--danger); }

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23768390'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

select.form-control option { background: var(--surface-2); }

textarea.form-control { resize: vertical; min-height: 80px; }

.invalid-feedback {
  color: var(--danger);
  font-size: 0.78rem;
  margin-top: 0.25rem;
  display: none;
}

.is-invalid ~ .invalid-feedback,
.form-control.is-invalid ~ .invalid-feedback { display: block; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.form-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--accent);
}

.form-check label {
  font-size: 0.9rem;
  cursor: pointer;
  margin: 0;
  color: var(--text);
}

/* ─── Filter Bar ─────────────────────────────────────────────────────────────── */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.filter-bar .form-group {
  margin-bottom: 0;
  min-width: 140px;
}

/* ─── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--r);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.alert-success { background: var(--success-dim); color: var(--success); border-color: rgba(63,185,80,.25); }
.alert-warning { background: rgba(227,179,65,.1); color: var(--warning); border-color: rgba(227,179,65,.25); }
.alert-danger  { background: var(--danger-dim);  color: var(--danger);  border-color: rgba(248,81,73,.25); }
.alert-info    { background: rgba(88,166,255,.1); color: var(--info);   border-color: rgba(88,166,255,.25); }

/* ─── Confirmation Result ────────────────────────────────────────────────────── */
.confirm-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 2rem;
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.confirm-result::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--success);
}

.confirm-result .result-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

.confirm-result h2 {
  font-family: var(--font-ui);
  font-size: 1.25rem;
  letter-spacing: 0.06em;
  color: var(--success);
  margin-bottom: 1.25rem;
}

.result-details {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 1.5rem;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-sub);
}
.result-row:last-child { border-bottom: none; }

.result-row span { color: var(--text-muted); font-size: 0.83rem; }

.result-row strong {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-bright);
}

/* ─── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.18em 0.55em;
  font-family: var(--font-ui);
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 0.06em;
  border-radius: 3px;
  line-height: 1.4;
  text-transform: uppercase;
}

.badge-success { background: var(--success-dim); color: var(--success); }
.badge-warning { background: rgba(227,179,65,.12); color: var(--warning); }
.badge-danger  { background: var(--danger-dim);   color: var(--danger); }
.badge-info    { background: rgba(88,166,255,.12); color: var(--info); }
.badge-muted   { background: var(--surface-3);    color: var(--text-muted); }

/* ─── Charts ─────────────────────────────────────────────────────────────────── */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem;
}

.chart-card h3 {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.chart-canvas-wrapper {
  position: relative;
  height: 260px;
}

/* ─── Toast ──────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  color: var(--text-bright);
  padding: 0.7rem 1rem;
  border-radius: var(--r);
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  box-shadow: var(--shadow);
  font-family: var(--font-body);
  font-size: 0.88rem;
  max-width: 320px;
  animation: slideIn .25s ease;
  pointer-events: auto;
  opacity: 1;
  transition: opacity .3s;
}

.toast.toast-error   { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info    { border-left-color: var(--info); }
.toast.fade-out      { opacity: 0; }

@keyframes slideIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(2px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  padding: 1.75rem;
  max-width: 420px;
  width: 100%;
}

.modal-box h3 {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-bright);
  margin-bottom: 0.75rem;
}

.modal-box p {
  margin-bottom: 1.25rem;
  color: var(--text);
  line-height: 1.55;
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ─── Loading ────────────────────────────────────────────────────────────────── */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13,17,23,.75);
  backdrop-filter: blur(1px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: var(--r);
}
.loading-overlay.hidden { display: none; }

.spinner {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Utilities ──────────────────────────────────────────────────────────────── */
.hidden            { display: none !important; }
.mt-1              { margin-top: .5rem; }
.mt-2              { margin-top: 1rem; }
.mb-1              { margin-bottom: .5rem; }
.mb-2              { margin-bottom: 1rem; }
.flex              { display: flex; }
.flex-wrap         { flex-wrap: wrap; }
.items-center      { align-items: center; }
.justify-between   { justify-content: space-between; }
.gap-1             { gap: .5rem; }
.mono              { font-family: var(--font-mono); font-size: 0.88em; }

.empty-state {
  text-align: center;
  padding: 2.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

tr.editing-row td { background: rgba(240,144,10,.06) !important; }

/* ─── Vehicle checkboxes (legacy, kept for other uses) ───────────────────────── */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  padding: 0.5rem 0;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.87rem;
}

.checkbox-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* ─── Group management ───────────────────────────────────────────────────────── */
.group-color-dot { width:14px; height:14px; border-radius:50%; display:inline-block; flex-shrink:0; }

/* Group badge in vehicle table */
.group-badge { display:inline-flex; align-items:center; gap:0.35rem; font-size:0.82rem; color: var(--text-muted); }

/* Grouped chip sections in reports */
.veh-group-section { margin-bottom: 0.9rem; }
.veh-group-header { display:flex; align-items:center; gap:0.5rem; margin-bottom:0.4rem; }
.veh-group-label { font-weight:600; font-size:0.85rem; color:var(--text); }
.veh-group-actions { margin-left:auto; display:flex; gap:0.3rem; }

/* ─── Vehicle chip selector (Auswertungen) ───────────────────────────────────── */
.veh-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.25rem 0;
}

.veh-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.87rem;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, background .15s, color .15s;
}

.veh-chip:hover {
  border-color: var(--accent);
  color: var(--text-bright);
}

.veh-chip.checked {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text-bright);
}

.veh-chip input[type="checkbox"] {
  display: none; /* visually replaced by chip style */
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .menu-btn { display: block; }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.6);
  }

  #content {
    margin-left: 0;
    padding: 1rem;
  }

  .form-row { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .chart-grid { grid-template-columns: 1fr; }

  thead { display: none; }

  tbody tr {
    display: block;
    margin-bottom: 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 0.5rem;
    background: var(--surface) !important;
  }

  tbody td {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--border-sub);
  }
  tbody td:last-child { border-bottom: none; }
  tbody td::before {
    content: attr(data-label);
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-right: 0.5rem;
    flex-shrink: 0;
  }

  .filter-bar { flex-direction: column; }
  .filter-bar .form-group { width: 100%; }
  .quick-actions { flex-direction: column; }
  .stock-bar { width: 80px; }
}

@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .modal-box { padding: 1.25rem; }
}

/* ─── Print ──────────────────────────────────────────────────────────────────── */
@media print {
  #app-header,
  .sidebar,
  .filter-bar,
  .form-actions,
  .btn,
  #toast-container,
  #modal-overlay,
  .loading-overlay,
  .no-print { display: none !important; }

  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 10pt;
  }

  #content { margin-left: 0 !important; padding: 0 !important; }
  .app-layout { margin-top: 0 !important; }

  .card, .table-wrapper, .chart-card {
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
  }
  .card::before { display: none; }

  /* ── Tabellen-Layout im Druck wiederherstellen (überschreibt Mobile-CSS) ── */
  table   { display: table !important;       width: 100% !important;
            font-size: 8.5pt;                border-collapse: collapse; }
  thead   { display: table-header-group !important; }
  tbody   { display: table-row-group !important; }
  tfoot   { display: table-footer-group !important; }

  tbody tr {
    display: table-row !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    break-inside: avoid;
  }

  tbody td {
    display: table-cell !important;
    justify-content: unset !important;
    padding: 0.3rem 0.5rem !important;
    border-bottom: 1px solid #ddd !important;
    vertical-align: middle;
  }

  /* data-label-Präfixe ausblenden (nur für Mobile-Ansicht) */
  tbody td::before { content: none !important; }

  thead th {
    background: #333 !important;
    color: #fff !important;
    padding: 0.3rem 0.5rem;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  tbody tr:nth-child(even) {
    background: #f5f5f5 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ─── Refueling list filter toolbar ─────────────────────────────────────────── */
.fl-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.fl-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.87rem;
}

.fl-active-badge {
  color: var(--accent);
  font-size: 0.7rem;
  line-height: 1;
}

/* ─── Refuel form two-column layout ─────────────────────────────────────────── */
.refuel-layout {
  display: grid;
  grid-template-columns: minmax(0, 600px) minmax(0, 380px);
  gap: 1.25rem;
  align-items: start;
}

.refuel-form-card { min-width: 0; }
.refuel-sidebar   { min-width: 0; display: flex; flex-direction: column; gap: 1.25rem; }

.chart-card-sm { padding: 1rem; }

/* Sichtkontrolle panel */
.sicht-placeholder { color: var(--text-muted); font-size: 0.9rem; padding: 0.5rem 0; }

.sicht-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border-sub);
  font-size: 0.92rem;
}
.sicht-row:last-child { border-bottom: none; }

.sicht-label { color: var(--text-muted); flex-shrink: 0; }
.sicht-value { font-weight: 600; color: var(--text-bright); text-align: right; }

.sicht-highlight .sicht-label { color: var(--accent); }
.sicht-highlight .sicht-value { color: var(--accent); font-size: 1.05rem; }

/* Consumption warning highlight */
.cons-warn {
  color: var(--danger) !important;
  font-weight: 700;
}
.sicht-row:has(.cons-warn) .sicht-label {
  color: var(--danger) !important;
}

/* Collapse to single column on smaller screens */
@media (max-width: 900px) {
  .refuel-layout {
    grid-template-columns: 1fr;
  }
}

/* ─── Report detail grouped table ───────────────────────────────────────────── */
tr.detail-group-header td {
  background: var(--surface-3);
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
  border-top: 2px solid var(--border);
  color: var(--text-bright);
}

tr.detail-group-subtotal td {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 2px solid var(--border);
  padding: 0.4rem 0.75rem;
  font-size: 0.88rem;
}

@media print {
  tr.detail-group-header td {
    background: #e8e8e8 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  tr.detail-group-subtotal td {
    background: #f0f0f0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ─── Vehicle Autocomplete Combobox ──────────────────────────────────────────── */
.vehicle-combobox {
  position: relative;
}
.vehicle-combobox .form-control {
  padding-right: 2rem;
}
.combobox-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 4px;
  line-height: 1;
}
.combobox-clear:hover {
  color: var(--text);
}
.vehicle-dropdown {
  position: absolute;
  z-index: 200;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  max-height: 280px;
  overflow-y: auto;
  top: calc(100% + 2px);
}
.vd-group {
  padding: 4px 10px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border-sub);
  margin-top: 2px;
}
.vd-item {
  padding: 7px 14px;
  cursor: pointer;
  font-size: .95rem;
}
.vd-item:hover,
.vd-item.vd-active {
  background: var(--accent-dim);
  color: var(--accent);
}
.vd-empty {
  padding: 10px 14px;
  color: var(--text-muted);
  font-size: .9rem;
  font-style: italic;
}

/* ─── Help button & modal ────────────────────────────────────────────────── */
.help-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.8rem; font-weight: 700;
  cursor: pointer; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.help-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.modal-box-wide { max-width: 560px; }
.help-content h4 { font-size: 0.9rem; font-weight: 700; margin: 0.9rem 0 0.3rem; color: var(--text-bright); }
.help-content p, .help-content li { font-size: 0.88rem; color: var(--text); line-height: 1.55; }
.help-content ul { padding-left: 1.25rem; margin: 0.2rem 0 0.5rem; }
