/* FuelFlow — shared styles. Bootstrap 5.3 colour modes drive light/dark;
   these tokens add the FuelFlow look on top (amber accent, dense ops tables). */

:root {
  --ff-accent: #e09b00;
  --ff-accent-strong: #b87d00;
  --ff-accent-soft: rgba(224, 155, 0, .12);
  --ff-accent-line: rgba(224, 155, 0, .35);
  --ff-sidebar-w: 232px;
  --ff-topbar-h: 54px;
  --ff-radius: 10px;
  --bs-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-link-color-rgb: 184, 125, 0;
  --bs-link-hover-color-rgb: 140, 95, 0;
  --bs-link-color: #b87d00;
  --bs-link-hover-color: #8c5f00;
}

[data-bs-theme="light"] {
  --ff-bg: #f4f5f7;
  --ff-surface: #ffffff;
  --ff-surface-2: #f8f9fb;
  --ff-border: #e3e6ea;
  --ff-muted: #6b7280;
  --ff-sidebar-bg: #111827;
  --ff-sidebar-text: rgba(255, 255, 255, .72);
  --ff-sidebar-muted: rgba(255, 255, 255, .38);
  --ff-sidebar-hover: rgba(255, 255, 255, .06);
  --ff-topbar-bg: rgba(255, 255, 255, .92);
  --bs-body-bg: var(--ff-bg);
}

[data-bs-theme="dark"] {
  --ff-bg: #0b0f14;
  --ff-surface: #121820;
  --ff-surface-2: #161d27;
  --ff-border: #232c38;
  --ff-muted: #8b95a3;
  --ff-sidebar-bg: #0a0e13;
  --ff-sidebar-text: rgba(255, 255, 255, .70);
  --ff-sidebar-muted: rgba(255, 255, 255, .32);
  --ff-sidebar-hover: rgba(224, 155, 0, .08);
  --ff-topbar-bg: rgba(18, 24, 32, .92);
  --bs-body-bg: var(--ff-bg);
  --bs-link-color-rgb: 240, 177, 40;
  --bs-link-hover-color-rgb: 255, 200, 90;
  --bs-link-color: #f0b128;
  --bs-link-hover-color: #ffc85a;
}

body { background: var(--ff-bg); font-size: .9rem; }
.text-muted, .form-text { color: var(--ff-muted) !important; }
.mono, .tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ── Shell ───────────────────────────────────────────── */
.ff-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--ff-sidebar-w);
  background: var(--ff-sidebar-bg); color: var(--ff-sidebar-text);
  display: flex; flex-direction: column; z-index: 1035; overflow-y: auto;
  transition: transform .2s ease;
  border-right: 1px solid rgba(255,255,255,.04);
}
.ff-brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1rem .9rem; text-decoration: none; color: #fff; border-bottom: 1px solid rgba(255,255,255,.06); }
.ff-brand .mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--ff-accent), #f6c453); display: grid; place-items: center; color: #111; font-weight: 800; }
.ff-brand .word { font-weight: 700; letter-spacing: .2px; line-height: 1.05; }
.ff-brand .word span { color: var(--ff-accent); }
.ff-brand .org { font-size: .7rem; color: var(--ff-sidebar-muted); font-weight: 500; display: block; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ff-nav { padding: .4rem 0 1rem; flex: 1; }
.ff-nav .sec { font-size: .66rem; letter-spacing: .09em; text-transform: uppercase; color: var(--ff-sidebar-muted); padding: .9rem 1.1rem .3rem; font-weight: 600; }
.ff-nav a { display: flex; align-items: center; gap: .65rem; margin: 1px .55rem; padding: .44rem .65rem; border-radius: 7px; color: var(--ff-sidebar-text); text-decoration: none; font-size: .86rem; }
.ff-nav a i { width: 16px; text-align: center; opacity: .85; font-size: .85rem; }
.ff-nav a:hover { background: var(--ff-sidebar-hover); color: #fff; }
.ff-nav a.active { background: var(--ff-accent-soft); color: var(--ff-accent); box-shadow: inset 2px 0 0 var(--ff-accent); }
.ff-nav .badge { margin-left: auto; }
.ff-sidebar-foot { padding: .8rem 1.1rem; font-size: .7rem; color: var(--ff-sidebar-muted); border-top: 1px solid rgba(255,255,255,.06); }

.ff-topbar {
  position: fixed; top: 0; right: 0; left: var(--ff-sidebar-w); height: var(--ff-topbar-h);
  background: var(--ff-topbar-bg); backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--ff-border); display: flex; align-items: center; gap: .75rem;
  padding: 0 1.25rem; z-index: 1030; transition: left .2s ease;
}
.ff-topbar .title { font-weight: 600; font-size: .98rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ff-clock { font-family: ui-monospace, Menlo, monospace; color: var(--ff-muted); font-size: .82rem; }
.ff-iconbtn { border: 1px solid var(--ff-border); background: transparent; color: var(--bs-body-color); border-radius: 8px; height: 32px; min-width: 32px; padding: 0 .55rem; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; font-size: .82rem; }
.ff-iconbtn:hover { border-color: var(--ff-accent-line); color: var(--ff-accent); }
.ff-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ff-accent-soft); color: var(--ff-accent); border: 1px solid var(--ff-accent-line); display: grid; place-items: center; font-weight: 700; font-size: .78rem; }
#ffIdle { display: none; background: #b42318; color: #fff; padding: .2rem .6rem; border-radius: 6px; font-size: .78rem; }

.ff-main { margin-left: var(--ff-sidebar-w); padding: calc(var(--ff-topbar-h) + 1.25rem) 1.5rem 2rem; min-height: 100vh; transition: margin-left .2s ease; }
body.ff-collapsed .ff-sidebar { transform: translateX(calc(-1 * var(--ff-sidebar-w))); }
body.ff-collapsed .ff-topbar { left: 0; }
body.ff-collapsed .ff-main { margin-left: 0; }
@media (max-width: 991.98px) {
  .ff-sidebar { transform: translateX(calc(-1 * var(--ff-sidebar-w))); }
  body.ff-open .ff-sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .ff-topbar { left: 0; }
  .ff-main { margin-left: 0; padding-left: 1rem; padding-right: 1rem; }
}

/* ── Surfaces ────────────────────────────────────────── */
.card, .ff-card { background: var(--ff-surface); border: 1px solid var(--ff-border); border-radius: var(--ff-radius); box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--ff-border); font-weight: 600; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.25rem; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--ff-muted); font-size: .85rem; }

.kpi { padding: 1rem 1.1rem; }
.kpi .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ff-muted); font-weight: 600; }
.kpi .value { font-size: 1.6rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: .78rem; color: var(--ff-muted); }
.kpi.accent { border-left: 3px solid var(--ff-accent); }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .5rem .65rem; border-bottom-color: var(--ff-border); }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ff-muted); font-weight: 600; background: var(--ff-surface-2); white-space: nowrap; }
.table-hover tbody tr:hover > * { background: var(--ff-accent-soft); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-responsive { border-radius: var(--ff-radius); }

.form-control, .form-select { background-color: var(--ff-surface); border-color: var(--ff-border); }
.form-control:focus, .form-select:focus { border-color: var(--ff-accent); box-shadow: 0 0 0 .2rem var(--ff-accent-soft); }
.form-label { font-size: .78rem; font-weight: 600; color: var(--ff-muted); margin-bottom: .25rem; }
.form-check-input:checked { background-color: var(--ff-accent); border-color: var(--ff-accent); }

.btn-primary { --bs-btn-bg: var(--ff-accent); --bs-btn-border-color: var(--ff-accent); --bs-btn-color: #111; --bs-btn-hover-bg: var(--ff-accent-strong); --bs-btn-hover-border-color: var(--ff-accent-strong); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--ff-accent-strong); --bs-btn-disabled-bg: var(--ff-accent); --bs-btn-disabled-border-color: var(--ff-accent); font-weight: 600; }
.btn-outline-primary { --bs-btn-color: var(--ff-accent-strong); --bs-btn-border-color: var(--ff-accent-line); --bs-btn-hover-bg: var(--ff-accent); --bs-btn-hover-border-color: var(--ff-accent); --bs-btn-hover-color: #111; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: var(--ff-accent); }
.page-link { color: var(--ff-accent-strong); }
.active > .page-link, .page-link.active { background-color: var(--ff-accent); border-color: var(--ff-accent); color: #111; }

.calc-box { background: var(--ff-surface-2); border: 1px dashed var(--ff-border); border-radius: 8px; padding: .6rem .8rem; }
.calc-box .v { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.calc-box .l { font-size: .7rem; text-transform: uppercase; color: var(--ff-muted); letter-spacing: .06em; }

.status-dot { width: .55rem; height: .55rem; border-radius: 50%; display: inline-block; margin-right: .35rem; }
.st-FUELING { background: #16a34a; } .st-TOPPED_OFF { background: #2563eb; } .st-COMMITTED { background: #7c3aed; } .st-STANDBY { background: #9ca3af; }

.autocomplete { position: relative; }
.autocomplete .list-group { position: absolute; z-index: 1050; left: 0; right: 0; top: 100%; max-height: 260px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,.15); }

/* Auth / guest */
.guest-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background:
  radial-gradient(1200px 500px at 10% -10%, var(--ff-accent-soft), transparent 60%), var(--ff-bg); }
.guest-card { width: 100%; max-width: 420px; }
.guest-card .card-body { padding: 2rem; }
.sso-btn { display: flex; align-items: center; justify-content: center; gap: .6rem; width: 100%; padding: .6rem; border: 1px solid var(--ff-border); border-radius: 8px; background: var(--ff-surface); color: var(--bs-body-color); text-decoration: none; font-weight: 600; }
.sso-btn:hover { border-color: var(--ff-accent); color: var(--bs-body-color); }
.divider { display: flex; align-items: center; gap: .8rem; color: var(--ff-muted); font-size: .75rem; margin: 1.1rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--ff-border); }

/* Print */
@media print {
  .ff-sidebar, .ff-topbar, .no-print, .btn { display: none !important; }
  .ff-main { margin: 0 !important; padding: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
  .card { border: none !important; box-shadow: none !important; }
}

/* Keep the action column visible when a wide table scrolls sideways. */
.ff-sticky-end > :is(thead, tbody) > tr > :last-child { position: sticky; right: 0; background: var(--ff-surface); box-shadow: -8px 0 8px -8px rgba(0,0,0,.25); }
