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

:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --border:    #30363d;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --accent:    #58a6ff;
  --accent-dk: #1f6feb;
  --success:   #3fb950;
  --error:     #f85149;
  --radius:    8px;
  --sched-grid-line: rgba(255,255,255,.08);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

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

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity .15s, background .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.btn-primary  { background: var(--accent-dk); color: #fff; border-color: var(--accent-dk); }
.btn-primary:hover { background: #388bfd; border-color: #388bfd; }

.btn-outline  { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--muted); background: rgba(255,255,255,.04); }

.btn-ghost    { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,.06); }

/* ── Auth layout ─────────────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(31, 111, 235, .12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(88, 166, 255, .06) 0%, transparent 50%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.logo-mark { font-size: 24px; }
.logo-text  { font-size: 20px; font-weight: 700; letter-spacing: .05em; color: var(--accent); }

.auth-heading {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 24px;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field .optional { font-weight: 400; }
.field input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--accent); }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 13px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-alts { display: flex; flex-direction: column; gap: 10px; }

.auth-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-error   { background: rgba(248, 81, 73, .12); border: 1px solid rgba(248, 81, 73, .3); color: #ff8b83; }
.alert-success { background: rgba(63, 185, 80, .12); border: 1px solid rgba(63, 185, 80, .3); color: var(--success); }

/* ── Company switcher ────────────────────────────────────────── */
.company-switcher {
  position: relative;
}
.company-switcher summary { list-style: none; }
.company-switcher summary::-webkit-details-marker { display: none; }

.company-switcher-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
  user-select: none;
}
.company-switcher-trigger:hover { background: rgba(255,255,255,.06); border-color: var(--border); }
.company-switcher[open] .company-switcher-trigger { background: rgba(255,255,255,.06); border-color: var(--border); }

.switcher-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.switcher-chevron { width: 14px; height: 14px; color: var(--muted); transition: transform .15s; }
.company-switcher[open] .switcher-chevron { transform: rotate(180deg); }

.company-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 260px;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 200;
  padding: 4px;
  animation: dropdown-in .1s ease;
}
@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background .1s;
  gap: 16px;
}
.dropdown-item:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.dropdown-item-active { background: rgba(88,166,255,.1); color: var(--accent); }
.dropdown-item-active:hover { background: rgba(88,166,255,.15); }
.dropdown-capital { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dropdown-code {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  letter-spacing: .04em;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(88,166,255,.12);
  color: var(--accent);
  vertical-align: middle;
  margin-right: 2px;
}
.dropdown-item-action { color: var(--accent); gap: 7px; justify-content: flex-start; }
.dropdown-item-action svg { width: 14px; height: 14px; flex-shrink: 0; }

.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Setup / create-company layout ───────────────────────────── */
.setup-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(31, 111, 235, .12) 0%, transparent 60%),
    var(--bg);
}

.setup-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px;
}

.setup-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.setup-heading { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.setup-sub     { font-size: 13px; color: var(--muted); margin-bottom: 24px; line-height: 1.6; }
.setup-footer  { margin-top: 20px; text-align: center; font-size: 13px; color: var(--muted); }

.setup-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s;
  cursor: pointer;
}
.field select:focus { border-color: var(--accent); }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Capital display box ─────────────────────────────────────── */
.capital-box {
  background: rgba(88,166,255,.06);
  border: 1px solid rgba(88,166,255,.2);
  border-radius: 8px;
  padding: 16px 18px;
}
.capital-box-fixed {
  background: rgba(63,185,80,.06);
  border-color: rgba(63,185,80,.2);
}
.capital-box-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.capital-box-value {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  margin-bottom: 4px;
}
.capital-box-fixed .capital-box-value { color: var(--success); }
.capital-box-hint { font-size: 12px; color: var(--muted); }
.capital-insufficient { color: var(--error) !important; font-size: 16px !important; }

/* ── Capital number input ────────────────────────────────────── */
.capital-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s;
}
.capital-input-wrap:focus-within { border-color: var(--accent); }
.capital-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 10px 12px;
  color: var(--text);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.capital-unit {
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

/* KPI value smaller variant for longer numbers */
.kpi-value-sm { font-size: 18px !important; }

/* ── Nav ─────────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.nav-brand { font-weight: 700; font-size: 16px; letter-spacing: .06em; color: var(--accent); }
.nav-actions { display: flex; align-items: center; gap: 16px; }
.nav-user { font-size: 13px; color: var(--muted); }

/* ── App shell ───────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.sidebar-brand .logo-mark { font-size: 18px; }
.sidebar-brand .logo-text { font-size: 15px; font-weight: 700; letter-spacing: .08em; color: var(--accent); }

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 4px 8px;
  gap: 1px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
  transition: background .12s, color .12s;
  cursor: pointer;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .7; }
.nav-item:hover { background: rgba(255,255,255,.05); color: var(--text); text-decoration: none; }
.nav-item:hover svg { opacity: 1; }
.nav-item.active { background: rgba(88,166,255,.1); color: var(--accent); }
.nav-item.active svg { opacity: 1; }

.nav-item-btn {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
}

.nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,.08);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Locked sidebar — disable all nav links in the nav section */
.sidebar-locked .sidebar-nav .nav-item {
  pointer-events: none;
  opacity: 0.35;
  cursor: default;
}

/* ── Main area ───────────────────────────────────────────────── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  height: 52px;
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: relative;
  z-index: 500;
}

.topbar-left { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.breadcrumb-root { color: var(--muted); }
.breadcrumb-sep  { color: var(--border); }
.breadcrumb-current { color: var(--text); font-weight: 500; }

.topbar-right { display: flex; align-items: center; gap: 20px; }

.topbar-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-ok      { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-warn    { background: #d29922; }
.status-error   { background: var(--error); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--text);
}
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-dk);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Page content ────────────────────────────────────────────── */
.page-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.page-content > * { flex-shrink: 0; }

/* ── KPI row ─────────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
}
.kpi-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.kpi-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; margin-bottom: 6px; }
.kpi-delta { font-size: 12px; }
.kpi-up    { color: var(--success); }
.kpi-down  { color: var(--error); }
.kpi-neutral { color: var(--muted); }

/* ── Content grid ────────────────────────────────────────────── */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}
.content-col-wide, .content-col-narrow { display: flex; flex-direction: column; gap: 16px; }

/* ── Panel ───────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 13px; font-weight: 600; }

.info-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  line-height: 1.6;
}
.info-body h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-top: 12px;
}
.info-body p, .info-body ul { margin: 0; }
.info-body ul { padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

.panel-placeholder {
  padding: 40px 18px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* ── Data table ──────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  padding: 10px 18px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 18px;
  border-bottom: 1px solid rgba(48,54,61,.6);
  font-variant-numeric: tabular-nums;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(255,255,255,.02); }
.table-empty td { color: var(--muted); text-align: center; padding: 32px; }

.table-empty-state {
  padding: 28px 18px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* ── Alert list ──────────────────────────────────────────────── */
.alert-list { display: flex; flex-direction: column; }
.alert-item {
  display: flex;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid rgba(48,54,61,.6);
  align-items: flex-start;
}
.alert-item:last-child { border-bottom: none; }
.alert-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.alert-info .alert-dot { background: var(--accent); }
.alert-warn .alert-dot { background: #d29922; }
.alert-error .alert-dot { background: var(--error); }
.alert-title { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.alert-desc  { font-size: 12px; color: var(--muted); }

/* ── Account panel ───────────────────────────────────────────── */
.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  font-size: 13px;
}
.account-label { color: var(--muted); }

/* ── Acquisition toggle ──────────────────────────────────────── */
.acq-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.acq-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 0;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  transition: background .12s, color .12s;
  user-select: none;
}
.acq-btn + .acq-btn { border-left: 1px solid var(--border); }
.acq-btn input[type="radio"] { display: none; }
.acq-btn-active { background: var(--accent-dk); color: #fff; }
.acq-btn:not(.acq-btn-active):hover { background: rgba(255,255,255,.05); color: var(--text); }

/* ── Fleet form ──────────────────────────────────────────────── */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.type-specs {
  background: rgba(88,166,255,.05);
  border: 1px solid rgba(88,166,255,.15);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px 16px;
}
.spec-item { display: flex; flex-direction: column; gap: 2px; }
.spec-label { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.spec-value { font-size: 13px; font-variant-numeric: tabular-nums; }

.price-box {
  border-top: 1px solid rgba(88,166,255,.15);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.price-box-lease { border-color: rgba(63,185,80,.2); }
.price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.price-label { font-size: 13px; color: var(--text); }
.price-rate  { font-size: 11px; color: var(--muted); }
.price-amount { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); white-space: nowrap; }
.price-box-lease .price-amount { color: var(--success); }
.price-balance { font-size: 12px; margin-top: 2px; }
.price-ok           { color: var(--success); }
.price-insufficient { color: var(--error); }

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}
.state-range-hints {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Condition bar (fleet table) ─────────────────────────────── */
.state-bar  { display: flex; align-items: center; gap: 8px; }
.state-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.state-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.state-good { background: var(--success); }
.state-fair { background: #d29922; }
.state-warn { background: #f0883e; }
.state-crit { background: var(--error); }
.state-pct  { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.mono { font-family: ui-monospace, "SFMono-Regular", monospace; font-size: 12.5px; }

.badge-lease {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: rgba(63,185,80,.12);
  color: var(--success);
  border: 1px solid rgba(63,185,80,.25);
  vertical-align: middle;
}

/* ── Financial statement ─────────────────────────────────────── */
.stmt-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.stmt-title    { font-size: 20px; font-weight: 700; }
.stmt-subtitle { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stmt-period   { font-size: 12px; color: var(--muted); margin-top: 2px; }

.stmt-balance-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
}
.stmt-balance-check svg { width: 14px; height: 14px; }
.stmt-balance-check.balanced   { background: rgba(63,185,80,.1); color: var(--success); border: 1px solid rgba(63,185,80,.25); }
.stmt-balance-check.unbalanced { background: rgba(248,81,73,.1); color: var(--error);   border: 1px solid rgba(248,81,73,.25); }

.stmt-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ── Bilanz (two-column T-account) ───────────────────────────── */
.bilanz {
  display: grid;
  grid-template-columns: 1fr 2px 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.bilanz-divider { background: var(--border); }

.bilanz-side { display: flex; flex-direction: column; }

.bilanz-side-head {
  padding: 12px 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}

.bilanz-group {
  border-bottom: 1px solid rgba(48,54,61,.6);
  padding: 12px 0 4px;
}
.bilanz-group:last-of-type { border-bottom: none; flex: 1; }

.bilanz-group-head {
  padding: 0 20px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.bilanz-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 20px 4px 32px;
  font-size: 13px;
  gap: 16px;
}
.bilanz-row-muted { color: var(--muted); }
.bilanz-row-neg   { color: var(--error); }
.bilanz-label  { flex: 1; }
.bilanz-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }

.bilanz-subtotal {
  display: flex;
  justify-content: space-between;
  padding: 6px 20px 10px 20px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  border-top: 1px solid rgba(48,54,61,.5);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.bilanz-total {
  display: flex;
  justify-content: space-between;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 700;
  border-top: 2px solid var(--border);
  background: rgba(255,255,255,.02);
  font-variant-numeric: tabular-nums;
  margin-top: auto;
}

/* ── GuV (income statement — stacked) ───────────────────────── */
.guv {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  max-width: 640px;
}

.guv-block {
  border-bottom: 1px solid rgba(48,54,61,.6);
  padding: 10px 0;
}
.guv-block-head {
  padding: 4px 20px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}
.guv-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 20px 3px 32px;
  font-size: 13px;
  color: var(--muted);
  gap: 16px;
  font-variant-numeric: tabular-nums;
}
.guv-subtotal {
  display: flex;
  justify-content: space-between;
  padding: 6px 20px 4px;
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
  border-top: 1px solid rgba(48,54,61,.5);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.guv-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid rgba(48,54,61,.6);
  font-variant-numeric: tabular-nums;
}
.guv-result-label { color: var(--text); }
.guv-result-value { }
.guv-result-final {
  background: rgba(255,255,255,.02);
  border-bottom: none;
  font-size: 14px;
}
.guv-result-final .guv-result-label { font-weight: 700; }

/* ── Schedules ───────────────────────────────────────────────── */
.sched-week-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  vertical-align: middle;
}
.sched-week-every { background: rgba(88,166,255,.12); color: var(--accent);  border: 1px solid rgba(88,166,255,.3); }
.sched-week-a  { background: rgba(63,185,80,.12);  color: var(--success); border: 1px solid rgba(63,185,80,.3); }
.sched-week-b  { background: rgba(210,153,34,.12); color: #d29922;        border: 1px solid rgba(210,153,34,.3); }

/* ── Schedule visualiser ─────────────────────────────────────────────── */
.sched-viz {
  display: grid;
  grid-template-columns: 26px 1fr;
  row-gap: 2px;
}
.sched-viz-label {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  user-select: none;
}
.sched-viz-track {
  position: relative;
  height: 26px;
  border-radius: 3px;
  background: repeating-linear-gradient(
    to right,
    var(--sched-grid-line) 0px, var(--sched-grid-line) 1px,
    transparent 1px, transparent calc(100% / 24)
  );
  border: 1px solid var(--border);
}
.sched-viz-block {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  padding: 0 3px;
  overflow: hidden;
  opacity: 0.88;
  cursor: pointer;
  min-width: 3px;
  text-decoration: none;
}
.sched-viz-block:hover { opacity: 1; }
.sched-viz-fn {
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: .02em;
}

.dow-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.dow-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  transition: background .12s, color .12s, border-color .12s;
  user-select: none;
}
.dow-btn input { display: none; }
.dow-btn:has(input:checked) {
  background: var(--accent-dk);
  color: #fff;
  border-color: var(--accent-dk);
}
.dow-btn:not(:has(input:checked)):hover {
  border-color: var(--muted);
  color: var(--text);
}

/* ── Flightplan ──────────────────────────────────────────────── */
.fp-aircraft-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  gap: 24px;
}
.fp-ac-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fp-ac-reg   { font-size: 22px; font-weight: 700; color: var(--text); }
.fp-ac-type  { font-size: 14px; color: var(--text); }
.fp-ac-meta  { font-size: 12px; color: var(--muted); }

.fp-ac-pos {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  text-align: right;
}
.fp-pos-label { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fp-pos-value { font-size: 14px; font-weight: 600; color: var(--accent); }
.fp-pos-meta  { font-size: 11px; color: var(--muted); }

.fp-leg-count { font-size: 12px; color: var(--muted); }

.fp-row-past    td { opacity: .55; }
.fp-row-inflight td { background: rgba(88,166,255,.05); }

.fp-status {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.fp-status-sched  { background: rgba(88,166,255,.12); color: var(--accent); border: 1px solid rgba(88,166,255,.3); }
.fp-status-flying { background: rgba(63,185,80,.12); color: var(--success); border: 1px solid rgba(63,185,80,.3); }
.fp-status-done   { background: rgba(139,148,158,.1); color: var(--muted); border: 1px solid var(--border); }

.fp-add-form { display: flex; flex-direction: column; gap: 16px; }

.fp-calc-box {
  background: rgba(88,166,255,.05);
  border: 1px solid rgba(88,166,255,.15);
  border-radius: 8px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 24px;
}
.fp-calc-row { display: flex; justify-content: space-between; font-size: 12.5px; gap: 8px; }
.fp-calc-label { color: var(--muted); }
.fp-calc-val   { font-variant-numeric: tabular-nums; font-weight: 500; }

/* ── Aircraft log event badges ──────────────────────────────── */
.log-event {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: capitalize;
  background: rgba(139,148,158,.1);
  color: var(--muted);
  border: 1px solid var(--border);
}
.log-event-manufactured       { background: rgba(88,166,255,.08); color: var(--accent);  border-color: rgba(88,166,255,.25); }
.log-event-acquired-purchase  { background: rgba(63,185,80,.08);  color: var(--success); border-color: rgba(63,185,80,.25); }
.log-event-acquired-lease     { background: rgba(63,185,80,.08);  color: var(--success); border-color: rgba(63,185,80,.25); }
.log-event-acquired-creditbuy { background: rgba(63,185,80,.08);  color: var(--success); border-color: rgba(63,185,80,.25); }
.log-event-transferred        { background: rgba(210,153,34,.08); color: #d29922;        border-color: rgba(210,153,34,.25); }
.log-event-insolvency-transfer{ background: rgba(248,81,73,.08);  color: #ff8b83;        border-color: rgba(248,81,73,.25); }
.log-event-incident           { background: rgba(248,81,73,.08);  color: #ff8b83;        border-color: rgba(248,81,73,.25); }

/* ── Amortization schedule ───────────────────────────────────── */
.amort-covered td { opacity: .45; text-decoration: line-through; }
.amort-covered td.mono { text-decoration: line-through; }

/* ── Shared amount colours ───────────────────────────────────── */
.amount-neg { color: var(--error); }
.amount-pos { color: var(--success); }

/* ── Contract badges ─────────────────────────────────────────── */
.contract-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  vertical-align: middle;
}
.contract-badge-credit   { background: rgba(88,166,255,.12);  color: var(--accent);  border: 1px solid rgba(88,166,255,.3); }
.contract-badge-lease    { background: rgba(63,185,80,.12);   color: var(--success); border: 1px solid rgba(63,185,80,.3); }
.contract-badge-rent     { background: rgba(210,153,34,.12);  color: #d29922;        border: 1px solid rgba(210,153,34,.3); }
.contract-badge-wetlease  { background: rgba(248,81,73,.10);   color: #ff8b83;        border: 1px solid rgba(248,81,73,.25); }
.contract-badge-insurance { background: rgba(139,148,158,.12); color: var(--muted);   border: 1px solid var(--border); }

.contract-terms { color: var(--text); font-size: 12.5px; }
.contract-security {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #d29922;
  border: 1px solid rgba(210,153,34,.3);
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
}

/* ── Market actions column ───────────────────────────────────── */
.market-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 220px;
}
.market-actions form { display: inline-flex; }

/* ── Table helpers ───────────────────────────────────────────── */
.muted-sm {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Form section label ──────────────────────────────────────── */
.field-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 4px;
}

/* ── Modal ───────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
}
.modal-title  { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.modal-desc   { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.modal-summary { font-size: 13px; color: var(--text); margin-bottom: 20px; line-height: 1.7; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ── Admin nav item ──────────────────────────────────────────── */
.nav-item-admin {
  background: #6e1010;
  color: #fff !important;
  border-radius: var(--radius);
  margin: 0 4px;
}
.nav-item-admin:hover { background: #8b1414 !important; color: #fff !important; }
.nav-item-admin-active,
.nav-item-admin.nav-item-admin-active { background: #a01a1a !important; color: #fff !important; }

/* ── Airport links ───────────────────────────────────────────── */
a.ap-link { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--muted); }
a.ap-link:hover { color: var(--accent); border-bottom-color: var(--accent); text-decoration: none; }

/* ── Sortable table headers ──────────────────────────────────── */
.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  text-decoration: none;
  white-space: nowrap;
}
.sort-link:hover { color: var(--text); text-decoration: none; }
.sort-link.sort-active { color: var(--accent); }
.sort-idle { opacity: .35; font-size: 10px; }

/* ── Market filter bar ───────────────────────────────────────── */
.market-filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.mf-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.mf-wide { flex: 1; min-width: 200px; }
.mf-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.mf-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px 10px;
  font-size: 13px;
  height: 34px;
  width: 100%;
}
.mf-input:focus { outline: none; border-color: var(--accent); }
.mf-input-unit {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mf-input-unit .mf-input { width: 90px; }
.mf-unit { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mf-sep {
  width: 1px;
  background: var(--border);
  align-self: stretch;
  margin: 0 2px;
}
.mf-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 1px;
}

/* ── Aircraft detail: top row ────────────────────────────────── */
.ac-detail-top {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}
.ac-detail-top > * { height: 100%; box-sizing: border-box; }
.ac-map-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ac-map-panel #ac-map { width: 100%; flex: 1; min-height: 180px; }
.ac-info-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ac-info-header { display: flex; align-items: baseline; gap: 10px; }
.ac-info-reg    { font-size: 22px; font-weight: 700; color: var(--text); }
.ac-info-type   { font-size: 14px; color: var(--muted); }
.ac-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
}
.ac-info-item {}
.ac-info-label { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.ac-info-value { font-size: 13px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.ac-info-pos {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Aircraft detail: inline schedule form ───────────────────── */
.inline-sched-wrap { border-bottom: 1px solid var(--border); }
.inline-sched-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.inline-sched-toggle:hover { color: var(--text); }
.inline-sched-wrap[open] .inline-sched-toggle { color: var(--accent); }
.inline-sched-form {
  padding: 12px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border);
  background: rgba(88,166,255,.03);
}
.inline-sched-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.inline-sched-row .field { margin: 0; flex: 1; min-width: 120px; }

/* ── Aircraft detail: contract sections ─────────────────────── */
.ac-contract-section {
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ac-contract-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.ac-contract-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}
.ac-contract-kpis {
  display: flex;
  gap: 24px;
}
.ac-contract-val {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── Aircraft detail: CSS tabs ───────────────────────────────── */
.ac-tabs-wrap { display: flex; flex-direction: column; gap: 0; }

.ac-tab-radio { display: none; }

.ac-tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px 8px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  overflow: hidden;
}
.ac-tab-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 18px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  user-select: none;
}
.ac-tab-label:hover { color: var(--text); }
.ac-tab-count {
  font-size: 11px;
  font-weight: 600;
  background: rgba(255,255,255,.06);
  border-radius: 10px;
  padding: 1px 6px;
  color: var(--muted);
}

.ac-tab-panels {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}
.ac-tab-panel { display: none; }

#contracts-tab-active:checked ~ .panel-head label[for="contracts-tab-active"],
#contracts-tab-closed:checked ~ .panel-head label[for="contracts-tab-closed"],
#ac-tab-schedule:checked ~ .ac-tab-nav label[for="ac-tab-schedule"],
#ac-tab-flights:checked  ~ .ac-tab-nav label[for="ac-tab-flights"],
#ac-tab-log:checked      ~ .ac-tab-nav label[for="ac-tab-log"],
#admin-tab-users:checked     ~ .ac-tab-nav label[for="admin-tab-users"],
#admin-tab-scheduler:checked ~ .ac-tab-nav label[for="admin-tab-scheduler"],
#admin-tab-funds:checked     ~ .ac-tab-nav label[for="admin-tab-funds"],
#admin-tab-message:checked   ~ .ac-tab-nav label[for="admin-tab-message"],
#admin-tab-broadcast:checked ~ .ac-tab-nav label[for="admin-tab-broadcast"],
#admin-tab-ferry:checked       ~ .ac-tab-nav label[for="admin-tab-ferry"],
#admin-tab-airportfees:checked ~ .ac-tab-nav label[for="admin-tab-airportfees"],
#roster-tab-pilots:checked   ~ .ac-tab-nav label[for="roster-tab-pilots"],
#roster-tab-cabin:checked    ~ .ac-tab-nav label[for="roster-tab-cabin"],
#roster-tab-ground:checked   ~ .ac-tab-nav label[for="roster-tab-ground"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
#contracts-tab-active:checked ~ .ac-tab-panels #contracts-panel-active,
#contracts-tab-closed:checked ~ .ac-tab-panels #contracts-panel-closed,
#admin-tab-broadcast:checked ~ .ac-tab-panels #ac-panel-broadcast,
#admin-tab-ferry:checked       ~ .ac-tab-panels #ac-panel-ferry,
#admin-tab-airportfees:checked ~ .ac-tab-panels #ac-panel-airportfees,
#ac-tab-schedule:checked ~ .ac-tab-panels #ac-panel-schedule,
#ac-tab-flights:checked  ~ .ac-tab-panels #ac-panel-flights,
#ac-tab-log:checked      ~ .ac-tab-panels #ac-panel-log,
#admin-tab-users:checked     ~ .ac-tab-panels #ac-panel-users,
#admin-tab-scheduler:checked ~ .ac-tab-panels #ac-panel-scheduler,
#admin-tab-funds:checked     ~ .ac-tab-panels #ac-panel-funds,
#admin-tab-message:checked   ~ .ac-tab-panels #ac-panel-message,
#roster-tab-pilots:checked   ~ .ac-tab-panels #roster-panel-pilots,
#roster-tab-cabin:checked    ~ .ac-tab-panels #roster-panel-cabin,
#roster-tab-ground:checked   ~ .ac-tab-panels #roster-panel-ground {
  display: block;
}

/* ── Mail / Messages ─────────────────────────────────────────────────── */
.mail-shell {
  display: flex;
  height: 100%;
  overflow: hidden;
}
.mail-contacts {
  width: 200px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.mail-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.mail-list {
  flex: 0 0 40%;
  overflow-y: auto;
  border-bottom: 1px solid var(--border);
}
.mail-preview {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.mail-preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.mail-preview-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mail-preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  color: var(--text);
}
.contact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 14px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  border-bottom: 1px solid var(--border);
  width: 100%;
}
.contact-item:last-child { border-bottom: none; }
.contact-item:hover { background: rgba(255,255,255,.04); }
.contact-item-active { background: rgba(88,166,255,.08); color: var(--accent); }
.contact-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-badge {
  font-size: 10px; font-weight: 700;
  background: var(--border); color: var(--muted);
  border-radius: 10px; padding: 1px 6px; flex-shrink: 0;
}
.contact-badge-unread { background: #d29922; color: #000; }
.msg-row:hover { background: rgba(255,255,255,.04); }
.msg-row-active { background: rgba(88,166,255,.08) !important; }
