/* Sanusi Nodelay - base styles */

:root {
  --ink: #12303a;
  --teal: #1e5f66;
  --amber: #e6a532;
  --surface: #eef2f1;
  --card: #ffffff;
  --text: #17262b;
  --muted: #5a6b70;
  --line: #d3dcda;
  --error: #b3261e;
  --error-bg: #fbeceb;
  --info-bg: #e5f0f1;

  --font-body: "Barlow", "Segoe UI", Roboto, Arial, sans-serif;
  --font-head: "Barlow Semi Condensed", "Arial Narrow", "Segoe UI", sans-serif;
}

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

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 12px;
}
h1 { font-size: 30px; }
h2 { font-size: 22px; }

p { margin: 0 0 12px; }
.muted { color: var(--muted); }

a { color: var(--teal); }

:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--ink);
  color: #fff;
  border-bottom: 4px solid var(--amber);
}

.brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 22px;
  color: #fff;
  text-decoration: none;
  margin-right: 8px;
}

.nav { display: flex; gap: 4px; margin-right: auto; flex-wrap: wrap; }
.nav a {
  color: #cfdcdd;
  text-decoration: none;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -3px 0 var(--amber); border-radius: 0; }

.who { display: flex; flex-direction: column; text-align: right; line-height: 1.25; }
.who-name { font-weight: 600; color: #fff; text-decoration: none; }
.who-name:hover { text-decoration: underline; }
.who-role { font-size: 14px; color: #b9cbcd; }

.logout {
  color: #fff;
  font-weight: 500;
  padding: 6px 12px;
  border: 1px solid #4a6b72;
  border-radius: 6px;
  text-decoration: none;
}
.logout:hover { background: var(--teal); }

/* ---------- Page ---------- */

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
}

/* ---------- Forms and buttons ---------- */

label {
  display: block;
  font-weight: 500;
  margin: 16px 0 6px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid #b7c4c2;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}
input:focus { border-color: var(--teal); }

.button {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  border: 1px solid var(--teal);
  border-radius: 6px;
  background: #fff;
  color: var(--teal);
  text-decoration: none;
  cursor: pointer;
}

.button-primary {
  background: var(--teal);
  color: #fff;
}
.button-primary:hover { background: var(--ink); border-color: var(--ink); }

.alert {
  padding: 10px 14px;
  border-radius: 6px;
  margin: 0 0 8px;
}
.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid #f1c2bf; }
.alert-info  { background: var(--info-bg); color: var(--ink); border: 1px solid #c3dadc; }

/* ---------- Login ---------- */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 820px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.login-brand {
  background: var(--ink);
  color: #fff;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-right: 6px solid var(--amber);
}

.login-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 44px;
  line-height: 1.02;
  margin: 0 0 12px;
}

.login-tag { color: #b9cbcd; margin: 0; }

.login-form { padding: 40px 36px; }
.login-form .button { width: 100%; margin-top: 24px; }

/* ---------- Pages, tables, badges ---------- */

.page-head { margin-bottom: 20px; }
.page-head h1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: 8px; font-weight: 500; }
.back::before { content: "\2190\00a0"; }

.panel + .panel { margin-top: 20px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 14px; font-weight: 600; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }
td.actions > * + * { margin-left: 6px; }

.badge {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
}
.badge-active   { background: #dcefe4; color: #1b5e3a; }
.badge-inactive { background: #e6e9e8; color: #4d5a5d; }

.button-small { padding: 5px 12px; font-size: 14px; }
form.inline { display: inline; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid .span-2 .button { margin-top: 20px; }
.form-grid .span-2 .button + .button { margin-left: 8px; }
.subform { margin-top: 24px; padding-top: 20px; border-top: 1px dashed var(--line); }
.subform h3 { font-size: 18px; margin: 0; }

.hint { font-size: 14px; color: var(--muted); margin: 6px 0 0; }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }

.alert-success { background: #e2f2e8; color: #1b5e3a; border: 1px solid #b9dcc6; }

.filters { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.filters > div { min-width: 180px; }
.filters label { margin-top: 0; }

.panel.narrow { max-width: 520px; }
.button.spaced { margin-top: 20px; }

[hidden] { display: none !important; }

.bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  color: #fff;
}
.bell:hover { background: rgba(255, 255, 255, 0.08); }
.bell[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--amber); border-radius: 0; }
.bell-count {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--amber);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

.price { display: block; font-family: var(--font-head); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.price-sub { display: block; font-size: 13px; color: var(--muted); }
.price-table td { vertical-align: top; }

.station-picks { border: 0; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.station-picks legend { font-weight: 500; margin-bottom: 6px; padding: 0; }
label.check { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; }
label.check input { width: 18px; height: 18px; }

.reject-form { display: inline-flex; gap: 6px; margin-left: 6px; }
.reject-form input { width: 180px; padding: 5px 8px; font-size: 14px; }

.subhead { margin: 28px 0 8px; font-size: 18px; }

.badge-approved  { background: #dcefe4; color: #1b5e3a; }
.badge-rejected  { background: var(--error-bg); color: var(--error); }
.badge-cancelled { background: #e6e9e8; color: #4d5a5d; }

.notes { list-style: none; margin: 0; padding: 0; }
.note { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.note:last-child { border-bottom: 0; }
.note p { margin: 4px 0; }
.note-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.note-head time { font-size: 14px; color: var(--muted); }
.note-unread { background: #fdf5e6; border-left: 4px solid var(--amber); }

.badge-selling { background: #fdf0d5; color: #7a4f00; }
.badge-waiting { background: #e5f0f1; color: var(--teal); }
.badge-closed  { background: #e6e9e8; color: #4d5a5d; }

.panel-alert { border: 2px solid var(--amber); background: #fffaf0; }
.alert-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
             padding: 12px 0; border-top: 1px solid #f0dfb8; }
.inline-reading { display: flex; gap: 8px; align-items: center; }

input.reading { width: 160px; text-align: right; font-variant-numeric: tabular-nums; }
.reading-table td { vertical-align: middle; }
.row-disabled td { color: var(--muted); }

tfoot td { font-weight: 600; border-bottom: 0; }
tfoot tr.grand td { font-size: 18px; border-top: 2px solid var(--ink); }

.field-label { font-weight: 500; margin: 20px 0 4px; }
.narrow-field { max-width: 360px; }
.small-head { font-size: 17px; margin: 0 0 4px; }
label.plain { display: inline; margin: 0; font-weight: 500; }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-label { color: var(--muted); font-weight: 500; }
.stat-value { font-family: var(--font-head); font-weight: 700; font-size: 34px; font-variant-numeric: tabular-nums; }
.toggle-row { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }

.sum-table { max-width: 520px; }
.sum-table td { padding: 8px 4px; }
.sum-table tr.grand td { font-weight: 700; font-size: 18px; border-top: 2px solid var(--ink); }
.sum-table tr.result td { font-weight: 700; font-size: 20px; }
.result-ok    { color: #1b5e3a; }
.result-short { color: var(--error); }
.result-over  { color: #7a4f00; }

.money-row { display: grid; grid-template-columns: repeat(3, minmax(0, 200px)); gap: 0 16px; }
.money-row input { text-align: right; font-variant-numeric: tabular-nums; }
.live-result { font-weight: 600; font-size: 18px; margin: 16px 0 4px; }
.link-danger { color: var(--error); border-color: #e3b5b1; }
.link-danger:hover { background: var(--error-bg); }

@media (max-width: 700px) {
  .money-row { grid-template-columns: 1fr; }
}

.tank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.tank-card { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: #fbfcfc; }
.tank-card header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tank-litres { font-family: var(--font-head); font-weight: 700; font-size: 30px; margin: 0 0 6px; font-variant-numeric: tabular-nums; }
.tank-litres span { font-size: 16px; color: var(--muted); font-weight: 600; }
.gauge { height: 10px; border-radius: 999px; background: #dfe6e5; overflow: hidden; }
.gauge div { height: 100%; background: var(--teal); }
.tank-low { border-color: var(--amber); background: #fffaf0; }
.tank-low .gauge div { background: var(--amber); }
.details.small { font-size: 14px; margin-top: 10px; }
.plain-list { margin: 0; padding-left: 20px; }

.delivery-card { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
                 padding: 16px 0; border-top: 1px solid var(--line); }
.delivery-card:first-of-type { border-top: 0; }
.delivery-info { flex: 1 1 280px; }
.cost-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.cost-form > div { width: 170px; }
.cost-form label { margin-top: 0; }
.cost-form input { text-align: right; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 2px solid var(--line); }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 600; margin-bottom: -2px; border-bottom: 3px solid transparent; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--amber); }

.presets { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 0; }
.presets a { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: 14px; }
.presets a[aria-current="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.stat-row { display: flex; flex-wrap: wrap; gap: 16px 40px; }
.stat-row .stat-value { font-size: 28px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }

.bar-col { width: 30%; min-width: 120px; }
.bar { height: 12px; border-radius: 3px; background: var(--teal); min-width: 2px; }
.bar-warn { background: var(--error); }

@media (max-width: 700px) {
  .two-col { grid-template-columns: 1fr; }
  .bar-col { display: none; }
}

@media print {
  .topbar, .no-print, .button, form { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
  .panel { border: 0; padding: 0 0 16px; }
  .bar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.todo { border-left: 5px solid var(--amber); }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px;
                padding: 10px 0; border-top: 1px solid var(--line); }
.todo-list li:first-child { border-top: 0; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.dash-grid .panel + .panel { margin-top: 0; }
.dash-grid + .panel { margin-top: 20px; }

.mini-tank { padding: 8px 0; }
.mini-tank-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.mini-tank.tank-low { background: none; }
.mini-tank.tank-low .gauge div { background: var(--amber); }

@media (max-width: 700px) {
  .dash-grid { grid-template-columns: 1fr; }
  .todo-list li { flex-direction: column; align-items: flex-start; }
}

.audit-list { list-style: none; margin: 0; padding: 0; }
.audit-item { padding: 12px 0; border-top: 1px solid var(--line); }
.audit-item:first-child { border-top: 0; }
.audit-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.audit-head time { color: var(--muted); font-size: 14px; white-space: nowrap; }
.audit-flag { border-left: 4px solid var(--amber); padding-left: 12px; }
.change-table { width: auto; margin-top: 6px; font-size: 14px; }
.change-table td { padding: 3px 12px 3px 0; border-bottom: 0; vertical-align: top; }
.change-table td:first-child { color: var(--muted); white-space: nowrap; }
.old-val { text-decoration: line-through; color: var(--error); }
.new-val { color: #1b5e3a; font-weight: 600; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }

.change-row td { background: #fffaf0; font-size: 15px; }

.spaced-top { margin-top: 20px; }

select:disabled { background: var(--surface); color: var(--muted); }

@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-brand { border-right: 0; border-bottom: 6px solid var(--amber); padding: 28px; }
  .login-name { font-size: 34px; }
  .login-form { padding: 28px; }

  .topbar { flex-wrap: wrap; padding: 12px 16px; }
  .who { text-align: left; order: 3; width: 100%; }
  .page { padding: 20px 16px; }
}

/* =====================================================================
   Layout v2: side menu, Hausa descriptions, bigger touch targets,
   and tables that turn into cards on phones.
   (These rules come last, so they take over from the older ones above.)
   ===================================================================== */

body { font-size: 17px; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--amber); color: var(--ink); padding: 8px 14px; border-radius: 6px; font-weight: 600;
}
.skip-link:focus { left: 8px; }

/* ---------- Shell ---------- */

.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.shell > .page { max-width: 1180px; width: 100%; margin: 0 auto; padding: 28px 32px 48px; }
body:not(.app) .page, .page:only-child { max-width: 1180px; }

/* ---------- Side menu ---------- */

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--ink); color: #fff;
  border-right: 5px solid var(--amber);
  display: flex; flex-direction: column; padding: 18px 12px 16px;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 12px; }
.sidebar .brand { font-size: 24px; margin: 0; line-height: 1.1; }
.menu-close { display: none; }

.sidebar .who {
  display: flex; flex-direction: column; text-align: left; gap: 1px;
  margin: 0 0 14px; padding: 10px 10px 12px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.06); text-decoration: none; color: #fff;
}
.sidebar .who:hover { background: rgba(255, 255, 255, 0.1); }
.sidebar .who-name { font-weight: 600; font-size: 17px; }
.sidebar .who-role { font-size: 14px; color: #b9cbcd; }

.side-nav ul { list-style: none; margin: 0; padding: 0; }
.side-nav a {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 6px 10px; border-radius: 8px;
  color: #dbe6e7; text-decoration: none;
}
.side-nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.side-nav a[aria-current="page"] { background: #fff; color: var(--ink); }
.side-nav a[aria-current="page"] .nav-ha { color: var(--teal); }
.side-nav .icon { flex: 0 0 auto; }
.nav-text { display: flex; flex-direction: column; line-height: 1.2; }
.nav-en { font-weight: 600; font-size: 16px; }
.nav-ha { font-size: 13.5px; color: #9fb7ba; }
.nav-count {
  margin-left: auto; min-width: 24px; padding: 0 7px; border-radius: 999px;
  background: var(--amber); color: var(--ink); font-size: 13px; font-weight: 600; line-height: 24px; text-align: center;
}
.side-bottom { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.12); }

/* Top bar only on phones and tablets */
.mobilebar { display: none; }

/* ---------- Hausa description ---------- */

.hausa-intro {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 0 0 20px; padding: 12px 16px;
  background: #e8f3f1; border: 1px solid #c4dfdb; border-left: 5px solid var(--teal); border-radius: 8px;
}
.hausa-intro p { margin: 0; font-size: 16.5px; line-height: 1.55; color: var(--ink); max-width: 75ch; }
.hausa-tag {
  flex: 0 0 auto; margin-top: 2px; padding: 1px 9px; border-radius: 999px;
  background: var(--teal); color: #fff; font-size: 13px; font-weight: 600;
}

/* ---------- Bigger, clearer controls ---------- */

input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="datetime-local"], select {
  min-height: 48px; font-size: 17px;
}
.button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.button-small { min-height: 38px; padding: 6px 14px; font-size: 15px; }
label { font-size: 16px; }
label.check { min-height: 44px; }
label.check input { width: 22px; height: 22px; }
.reading-table input[type="checkbox"] { width: 24px; height: 24px; }
.hint { font-size: 15px; }
.alert { font-size: 16px; }

/* ---------- Tablets and phones ---------- */

@media (max-width: 1000px) {
  .shell { display: block; }
  .shell > .page { padding: 20px 16px 40px; }

  .mobilebar {
    display: flex; align-items: center; gap: 8px;
    position: sticky; top: 0; z-index: 40;
    padding: 8px 12px; background: var(--ink); color: #fff; border-bottom: 4px solid var(--amber);
  }
  .menu-button {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 46px; padding: 6px 12px; border-radius: 8px;
    background: rgba(255, 255, 255, 0.1); color: #fff; border: 0; font: inherit; font-weight: 600; cursor: pointer;
  }
  .mobile-brand {
    flex: 1; text-align: center; color: #fff; text-decoration: none;
    font-family: var(--font-head); font-weight: 700; font-size: 20px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mobilebar .bell { width: 46px; height: 46px; }

  /* The side menu slides in over the page */
  .js .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: min(320px, 86vw); height: auto;
    transform: translateX(-105%); transition: transform 0.2s ease;
  }
  .js body.menu-open .sidebar { transform: none; }
  .menu-close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 8px; border: 0; background: rgba(255, 255, 255, 0.1); color: #fff; cursor: pointer;
  }
  .menu-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(10, 25, 30, 0.55); }
  body.menu-open { overflow: hidden; }

  /* Without JavaScript the menu simply sits at the top of the page */
  .no-js .sidebar { position: static; height: auto; border-right: 0; border-bottom: 5px solid var(--amber); }
  .no-js .menu-button, .no-js .menu-close { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .js .sidebar { transition: none; }
}

@media (max-width: 760px) {
  h1 { font-size: 26px; }
  .panel { padding: 18px 16px; }
  .stat-row { gap: 14px 28px; }
  .stat-row .stat-value, .stat-value { font-size: 24px; }
  .filters > div { min-width: 0; flex: 1 1 140px; }
  .filters-actions { flex-basis: 100%; display: flex; gap: 8px; }
  .filters-actions .button { flex: 1; }
  .form-grid .span-2 .button, .button-primary { width: 100%; }
  td.actions .button-primary, .todo-list .button-primary { width: auto; }

  /* Tables turn into cards: each row is a card, each cell shows its column name */
  .table-wrap { overflow: visible; }
  table.rtable, table.rtable tbody, table.rtable tfoot, table.rtable tr, table.rtable td { display: block; width: 100%; }
  table.rtable thead { display: none; }
  table.rtable tr {
    margin: 0 0 12px; padding: 4px 14px;
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
  }
  table.rtable tfoot tr { background: var(--surface); }
  table.rtable td {
    display: flex; justify-content: space-between; align-items: center; gap: 14px;
    padding: 10px 0; border-bottom: 1px dashed var(--line); text-align: right;
  }
  table.rtable td:last-child { border-bottom: 0; }
  table.rtable td[data-label]::before {
    content: attr(data-label); flex: 0 0 42%;
    text-align: left; font-weight: 600; color: var(--muted); font-size: 15px;
  }
  table.rtable td.cell-empty { display: none; }
  table.rtable td.num { text-align: right; }
  table.rtable td.actions { justify-content: flex-end; flex-wrap: wrap; gap: 8px; white-space: normal; }
  table.rtable td.actions > * + * { margin-left: 0; }
  table.rtable td > .price-sub { display: block; }
  table.rtable input.reading { width: 55%; max-width: 220px; }
  .reject-form { display: flex; flex-wrap: wrap; width: 100%; margin: 0; }
  .reject-form input { flex: 1 1 160px; width: auto; }

  .sum-table { max-width: none; }
  .delivery-card { flex-direction: column; }
  .cost-form > div { width: 100%; }
  .alert-row { flex-direction: column; align-items: stretch; }
  .inline-reading { flex-wrap: wrap; }
  .inline-reading input.reading { flex: 1; width: auto; }
}

@media print {
  .sidebar, .mobilebar, .menu-backdrop, .hausa-intro, .skip-link { display: none !important; }
  .shell { display: block; }
}

/* Login page on phones */
.login-form .hausa-intro { margin: 8px 0 16px; }
.login-form .hausa-intro span:last-child { font-size: 16px; line-height: 1.5; }
@media (max-width: 700px) {
  .login-body { padding: 12px; align-items: flex-start; }
}

/* PIN boxes */
.pin-input { max-width: 240px; font-size: 26px !important; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
.pin-rules { margin: 14px 0 0; color: var(--muted); font-size: 15px; }

/* =====================================================================
   Layout v3: comfortable on every device
   ===================================================================== */

/* ---------- Never scroll sideways ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-wrap: break-word; }
.page, .panel, .form-grid > *, .filters > *, .stat, .dash-grid > * { min-width: 0; }
img, svg, video { max-width: 100%; }
td, th { overflow-wrap: break-word; }
th { overflow-wrap: normal; }
input, select, textarea, button { max-width: 100%; }
a, button, label, summary { -webkit-tap-highlight-color: rgba(30, 95, 102, 0.18); }
button, .button, [role="button"] { touch-action: manipulation; }

/* Busy button after tapping Save */
.button.is-busy, button.is-busy { opacity: 0.7; cursor: progress; }

/* ---------- Bottom bar (phones and tablets) ---------- */
.bottom-nav { display: none; }

@media (max-width: 1000px) {
  .mobilebar {
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
  }
  .has-bottom-nav .shell > .page { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; z-index: 45; left: 0; right: 0; bottom: 0;
    padding: 4px max(4px, env(safe-area-inset-left, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-right, 0px));
    background: #fff; border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgba(18, 48, 58, 0.08);
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 58px; padding: 4px 2px; border: 0; border-radius: 10px; background: none;
    color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; text-decoration: none; cursor: pointer;
  }
  .bottom-nav a[aria-current="page"] { color: var(--ink); background: #fdf0d5; }
  .bottom-nav a[aria-current="page"] .icon { color: var(--teal); }
  .bn-icon { position: relative; display: inline-flex; }
  .bn-count {
    position: absolute; top: -6px; right: -12px; min-width: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--error); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
  }
  /* The top bar keeps the title; its bell and menu are in the bottom bar now */
  .mobilebar .bell, .mobilebar .menu-button { display: none; }
  .mobile-brand { text-align: left; padding: 6px 0; }

  .js .sidebar { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .menu-backdrop { z-index: 55; }
}

/* ---------- Tablets (portrait) ---------- */
@media (min-width: 761px) and (max-width: 1000px) {
  .shell > .page { padding: 24px 24px 40px; }
  .stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 24px; }
}

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  .page-head { margin-bottom: 14px; }
  .page-head p { font-size: 15.5px; }
  .panel + .panel, .dash-grid, .dash-grid + .panel { margin-top: 14px; }
  .dash-grid { gap: 14px; }

  /* Figures two per row */
  .stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
  .stat-row .stat-value, .stat-value { font-size: 22px; line-height: 1.2; }
  .stat-label { font-size: 14.5px; }

  /* Lists of things to do: text on top, button full width below */
  .todo-list li { flex-direction: column; align-items: stretch; gap: 8px; }
  .todo-list li .button { width: 100%; }

  /* Filters: one per row, buttons side by side */
  .filters { gap: 10px; }
  .filters > div { flex: 1 1 100%; }
  .filters-actions .button { min-height: 48px; }
  .presets { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .presets a { white-space: nowrap; padding: 8px 14px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tabs a { white-space: nowrap; padding: 12px 14px; }

  /* Forms */
  .form-grid { gap: 0; }
  .form-grid .span-2 .button + .button { margin-left: 0; margin-top: 10px; }
  .money-row { gap: 0; }
  input.reading { width: 100%; }
  .two-col { gap: 16px; }
  .sum-table td { padding: 9px 2px; }
  .sum-table tr.grand td { font-size: 17px; }
  .live-result { font-size: 17px; }

  /* Cards made from tables: comfortable to tap */
  table.rtable td { min-height: 44px; }
  table.rtable td.actions .button, table.rtable td.actions form.inline, table.rtable td.actions .button-small { min-height: 42px; }
  table.rtable td.actions > form.inline { display: inline-flex; }
  table.rtable tfoot td { font-weight: 700; }

  /* Long amounts stay on one line where possible */
  td.num { white-space: nowrap; }
  table.rtable td.num { white-space: normal; }

  .audit-head { flex-direction: column; gap: 2px; }
  .change-table td:first-child { white-space: normal; }
  .note-head { flex-direction: column; gap: 2px; }
  .delivery-card { gap: 12px; }
  .tank-grid { grid-template-columns: 1fr; }
  .details { grid-template-columns: minmax(0, 45%) minmax(0, 1fr); }
}

/* ---------- Small phones ---------- */
@media (max-width: 380px) {
  body { font-size: 16px; }
  h1 { font-size: 23px; }
  h2 { font-size: 19px; }
  .panel { padding: 14px 12px; }
  .shell > .page { padding-left: 10px; padding-right: 10px; }
  .stat-row { grid-template-columns: 1fr; }
  .bottom-nav a, .bottom-nav button { font-size: 11.5px; }
  table.rtable td[data-label]::before { flex-basis: 46%; font-size: 14px; }
}

/* ---------- Phones held sideways ---------- */
@media (max-height: 500px) and (orientation: landscape) {
  .mobilebar { position: static; }
  .bottom-nav a, .bottom-nav button { min-height: 46px; flex-direction: row; gap: 6px; }
  .has-bottom-nav .shell > .page { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Large screens ---------- */
@media (min-width: 1600px) {
  .shell { grid-template-columns: 290px minmax(0, 1fr); }
  .shell > .page { max-width: 1320px; }
}

/* ---------- Login page on every device ---------- */
.login-body { padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px)); }
@media (max-width: 700px) {
  .login { border-radius: 10px; }
  .login-brand { padding: 22px 20px; }
  .login-name { font-size: 30px; }
  .login-form { padding: 22px 20px; }
}

@media print {
  .bottom-nav { display: none !important; }
}

@media (max-width: 760px) {
  table.rtable .cell-value { display: block; text-align: right; min-width: 0; }
  table.rtable .cell-value .price-sub { display: block; }
  table.rtable .cell-value form.inline { display: inline-flex; }
  table.rtable tfoot tr.grand td, tfoot tr.grand td { border-top: 0; }
  table.rtable tfoot tr { border-width: 2px; border-color: var(--ink); }
}

/* Numbers never split across lines; wide tables slide inside their box on tablets */
td.num, th.num { white-space: nowrap; overflow-wrap: normal; }
@media (min-width: 761px) {
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap > table { min-width: 640px; }
}
/* An older phone rule moved the name block to the bottom of the menu; keep it at the top */
.sidebar .who { order: 0; width: auto; }

/* Cards on phones may break very long words (references, long names) anywhere */
@media (max-width: 760px) {
  table.rtable td, table.rtable .cell-value { overflow-wrap: anywhere; }
}
@media (min-width: 761px) {
  .table-wrap td:first-child, .table-wrap th:first-child { min-width: 8.5em; }
}

/* Litres per product on the dashboard's station list */
.litres-list { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.litres-list strong { font-weight: 600; color: var(--muted); margin-right: 4px; }

.result-neutral { color: var(--ink); }

/* Phone notifications box */
.push-status { font-weight: 600; margin: 8px 0 14px; padding: 10px 14px; border-radius: 8px; background: var(--surface); }
.push-ok { background: #e2f2e8; color: #1b5e3a; }
.push-warn { background: #fdf0d5; color: #7a4f00; }
.push-bad { background: var(--error-bg); color: var(--error); }
.push-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.push-help { margin-top: 16px; }
.push-help summary { cursor: pointer; font-weight: 600; color: var(--teal); min-height: 44px; display: flex; align-items: center; }
.push-help ol { padding-left: 20px; margin: 8px 0 0; }
.push-help li { margin-bottom: 8px; line-height: 1.5; }
@media (max-width: 760px) { .push-actions .button { width: 100%; } }

/* Station switcher for managers of more than one station */
.station-switch { padding: 0 16px 12px; display: grid; gap: 4px; }
.station-switch select { width: 100%; padding: 8px; border-radius: 6px; border: 1px solid #3c5a62; font: inherit; }

/* ---------- Fuel arrived (simple delivery screen for managers) ---------- */
.fa { max-width: 720px; margin: 0 auto; }
.fa-title { font-size: 26px; }
.fa-title .muted { font-size: 18px; font-weight: 600; }
.fa-progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 0 0 14px; }
.fa-progress span { display: block; height: 100%; width: 0; background: var(--amber); transition: width .2s; }
.fa-step h2 { font-size: 26px; margin-bottom: 4px; }
.fa-num { display: inline-grid; place-items: center; width: 40px; height: 40px; margin: 0 0 8px; border-radius: 50%;
  background: var(--ink); color: #fff; font: 700 20px var(--font-head); }
.fa-ha { color: var(--teal); font-style: italic; font-size: 18px; margin-bottom: 16px; }
.fa-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.fa-choice { position: relative; display: grid; gap: 2px; padding: 18px 18px 18px 22px; min-height: 96px; cursor: pointer;
  background: var(--card); border: 2px solid var(--line); border-left: 10px solid var(--teal); border-radius: 12px; }
.fa-choice input { position: absolute; opacity: 0; pointer-events: none; }
.fa-choice.is-checked, .fa-choice:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 3px var(--amber); background: #fffaf0; }
.fa-choice:has(input:focus-visible) { outline: 3px solid var(--amber); outline-offset: 2px; }
.fa-code { font: 700 30px/1 var(--font-head); }
.fa-name { font: 700 22px/1.2 var(--font-head); }
.fa-sub { color: var(--muted); font-size: 15px; }
.fa-pms { border-left-color: #d9480f; }
.fa-ago { border-left-color: #343a40; }
.fa-dpk { border-left-color: #1c7ed6; }
.fa-yes { border-left-color: #2b8a3e; }
.fa-no { border-left-color: var(--error); }
.fa-quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.fa-pick { font: 700 24px var(--font-head); padding: 18px 8px; border-width: 2px; border-radius: 12px; }
.fa-label { display: block; font-weight: 600; margin: 8px 0 6px; }
.fa-input { width: 100%; font: 700 32px var(--font-head); padding: 14px 16px; text-align: center; letter-spacing: 1px;
  border: 2px solid var(--teal); border-radius: 12px; }
.fa-less { margin-top: 16px; }
.fa-camera input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fa-camera-btn { display: block; text-align: center; padding: 28px 16px; font: 700 26px var(--font-head); cursor: pointer;
  border: 3px dashed var(--teal); border-radius: 14px; color: var(--teal); background: var(--info-bg); }
.fa-camera:focus-within .fa-camera-btn { outline: 3px solid var(--amber); }
.fa-preview { display: block; max-width: 100%; max-height: 320px; margin: 14px auto; border-radius: 10px; border: 1px solid var(--line); }
.fa-more { margin-top: 14px; }
.fa-more summary { cursor: pointer; color: var(--teal); font-weight: 600; padding: 8px 0; }
.fa-summary { display: grid; gap: 10px; margin: 0 0 16px; }
.fa-summary div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--surface); border-radius: 10px; }
.fa-summary dt { color: var(--muted); }
.fa-summary dd { margin: 0; font: 700 20px var(--font-head); text-align: right; }
.fa-btn { white-space: nowrap; min-width: 110px; min-height: 58px; font-size: 20px; padding: 12px 22px; border-radius: 12px; }
.fa-save { width: 100%; font-size: 26px; min-height: 68px; }
.fa-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; }
.fa-nav .button-primary { margin-left: auto; }
.fa-done { text-align: center; }
.fa-tick { display: inline-grid; place-items: center; width: 84px; height: 84px; margin-bottom: 8px; border-radius: 50%;
  background: #2b8a3e; color: #fff; font-size: 48px; font-weight: 700; }
.fa-big { font: 700 34px var(--font-head); margin-bottom: 4px; }
.fa-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.fa-home-btn { display: flex; align-items: center; gap: 16px; padding: 20px 22px; margin-bottom: 16px; text-decoration: none;
  background: var(--ink); color: #fff; border-radius: 14px; border-bottom: 5px solid var(--amber); }
.fa-home-btn strong { display: block; font: 700 26px var(--font-head); }
.fa-home-sub { display: block; color: #cfe0e2; font-size: 15px; }
.fa-home-btn:hover { background: var(--teal); }
.waybill-thumb { display: inline-flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 14px; }
.waybill-thumb img { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
@media (max-width: 480px) { .fa-step h2 { font-size: 22px; } .fa-choices { grid-template-columns: 1fr; } }
.fa-backlink { margin-top: 12px; }
.fa-show { color: var(--muted); margin: 6px 0 14px; }
