/* Ops Command V2 — the control center's one stylesheet (design 2026-10-13 §4.5).

   The end state of Fleet Commander's matte look, not its file: tokens by its names with the LIGHT values as the
   root, five layer roles, the headroom header, the phone dock.

   Rules, held by tests/test_cc_style.py:
     - no backdrop blur (glass was rejected) and no !important
     - z-index only through a layer token: pick a role, never a new number
     - logical properties only (inline/block, start/end): the page is Arabic, right to left
     - a colour is a token of :root, never a literal in a rule
     - under 500 lines
   Not in this program: a dark theme, an English view. */

:root {
  color-scheme: light;

  /* surfaces and ink */
  --bg: #eaeef4;
  --bg-elevated: #ffffff;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --panel-3: #eef1f5;
  --border: #d3dae3;
  --border-strong: #c3cbd6;
  --text: #0a1a2f;
  --muted: #566273;
  --input-bg: #f2f4f7;
  --shadow: 0 1px 2px rgba(11, 34, 57, .10), 0 8px 24px -14px rgba(11, 34, 57, .30);

  /* one accent */
  --accent: #0a6fd8;
  --accent-dim: rgba(10, 111, 216, .14);
  --ring: rgba(27, 123, 235, .35);

  /* three state colours */
  --success: #1aa15a;
  --warn: #f0a020;
  --err: #e0342b;

  /* three radii, one font stack */
  --radius-sm: 9px;
  --radius: 12px;
  --radius-lg: 16px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, Tahoma, Arial, sans-serif;

  /* the phone dock; the home indicator's inset is trimmed as Fleet Commander trims it */
  --dock-h: 46px;
  --dock-pad: max(4px, calc(env(safe-area-inset-bottom, 0px) - 20px));

  /* five layer roles, lowest first */
  --z-header: 100;
  --z-dock: 190;
  --z-menu: 210;
  --z-modal: 220;
  --z-toast: 230;

  /* the map's marks (map marks design 2026-10-21 §3): the fill is the type of job — one meaning per colour */
  --mk-delivery: #1565d8;
  --mk-pickup: #d32f2f;                      /* solid red: the only red on the map (map status S2) */
  --mk-vip: #c2187a;
  --mk-service: #7b3fc4;
  --mk-free: var(--success);
  /* an order's state (map status design 2026-10-23): completed, on the road, not started */
  --st-done: #1f9d55;
  --st-ongoing: #f0960e;
  --st-waiting: #8a94a3;
  --mk-warn: #ffd21f;                        /* a problem's triangle and its dark edge (map status S2) */
  --mk-warn-edge: #3b2f00;
  --mk-nogps: #6b7685;
  --mk-veil: rgba(255, 255, 255, .55);       /* a position 2 to 20 minutes old: the fill seen through it */
  --mk-shadow: 0 1px 3px rgba(11, 34, 57, .45);
  --mk-pulse: 1.6s;                          /* map-look.js PULSE_MS */
  --mk-h: 0deg;                              /* a moving mark's heading; map-look.js sets it on the mark */
  --mk-pd: 0ms;                              /* a pulse's beat; map-look.js sets it on the mark */
  --deg: 0deg;                               /* a ping's arrow heading; map-trails.js sets it (S3) */

  /* fuel: turquoise, reserved for the station fences and a car at a pump (plan 2026-10-29 station fences) */
  --fuel: #0b7d77;                           /* its words: 5.0:1 on white */
  --fuel-edge: #0f9d92;                      /* a fence's edge, the car's ring, the glyph */
  --fuel-fill: rgba(15, 157, 146, .16);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}

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

h1 { margin-block: 0 12px; font-size: 1.35rem; }
h2 { margin-block: 0 8px; font-size: 1.05rem; }
p { margin-block: 6px; }
ul { margin-block: 6px; padding-inline-start: 20px; }
li { margin-block: 5px; }

/* 16px so iOS does not zoom the page when a field takes focus */
input, button, select, textarea { font-family: inherit; font-size: 16px; }

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

/* ---- header: sticky, hides on the way down and returns on the way up (headroom.js) ----
   Nothing fixed lives inside it: a transformed ancestor becomes the containing block of its fixed children. */
.cc-head {
  position: sticky;
  inset-block-start: 0;
  z-index: var(--z-header);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding-block: 10px;
  padding-inline: 16px;
  background: var(--bg-elevated);
  border-block-end: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform .2s cubic-bezier(.22, .61, .36, 1);
  will-change: transform;
}
.cc-head.headroom--unpinned { transform: translateY(-100%); }
.cc-head.headroom--pinned { transform: translateY(0); }
.cc-head .brand { font-weight: 700; color: var(--text); text-decoration: none; }
.cc-head .who { margin-inline-start: auto; color: var(--muted); font-size: .85rem; }
.cc-head .out { color: var(--muted); font-size: .85rem; }

.cc-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-nav a {
  padding-block: 4px;
  padding-inline: 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
}
.cc-nav a:hover { background: var(--panel-3); }
.cc-nav a.on { background: var(--accent-dim); color: var(--accent); font-weight: 700; }

/* ---- page ---- */
.cc-main { max-width: 1100px; margin-inline: auto; padding-block: 16px; padding-inline: 16px; }
.cc-foot { padding-block: 12px 24px; padding-inline: 16px; color: var(--muted); font-size: .8rem; text-align: center; }

/* one column on a phone, two on a desktop */
.cc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 900px) {
  .cc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.card, .block {
  padding-block: 12px;
  padding-inline: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.note, .hint, .unseen, .built { color: var(--muted); font-size: .85rem; }
/* what a box cannot see: one heading and short lines, set off from what it says */
.unseen { border-block-start: 1px dashed var(--border); padding-block-start: 6px; }
.unseen ul { margin-block: 2px 0; padding-inline-start: 18px; }
.unseen li { margin-block: 1px; }
.unseen p { margin-block: 4px 0; }

/* ---- the plate box ---- */
.open { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.open input {
  flex: 1 1 160px;
  min-block-size: 44px;
  min-width: 0;
  padding-block: 8px;
  padding-inline: 10px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.open button {
  min-block-size: 44px;
  padding-block: 8px;
  padding-inline: 16px;
  background: var(--accent);
  color: var(--bg-elevated);
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
}
.error { color: var(--err); font-weight: 700; }

/* ---- a live block: its edge says how it stands ----
   There is no green edge. A block with nothing to report is neutral ("calm"): it does not see everything, and
   an edge that said "all is well" would say more than it knows. */
.block { border-inline-start: 4px solid var(--border-strong); }
.block.warn { border-inline-start-color: var(--warn); }
.block.bad { border-inline-start-color: var(--err); }
.block .fail { color: var(--err); font-weight: 700; }
.block .alarms { list-style: none; padding-inline-start: 0; }
.block .alarm {
  padding-block: 6px;
  padding-inline: 10px;
  background: var(--panel-2);
  border-inline-start: 3px solid var(--err);
  border-radius: var(--radius-sm);
}
.block .alarm.undelivered { border-inline-start-style: dashed; }
.block .sources { list-style: none; padding-inline-start: 0; }
.st::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-inline-end: 8px;
  border-radius: 50%;
  background: var(--border-strong);
}
.st.ok::before { background: var(--success); }
.st.stale::before { background: var(--warn); }
.st.ok.past::before { background: var(--warn); }

/* a block that could not be fetched again: its old lines never look current */
.block.stale { border-inline-start-color: var(--border-strong); }
.block.stale > * { opacity: .45; }
.block.stale > .cc-stale { opacity: 1; color: var(--err); font-weight: 700; }

/* ---- the dock: phones only ---- */
.cc-dock { display: none; }
@media (max-width: 640px) {
  .cc-nav, .cc-head .who, .cc-head .out { display: none; }
  .cc-main { padding-block-end: calc(var(--dock-h) + var(--dock-pad) + 20px); }
  .cc-foot { padding-block-end: calc(var(--dock-h) + var(--dock-pad) + 20px); }
  .cc-dock {
    position: fixed;
    inset-inline: 0;
    inset-block-end: 0;
    z-index: var(--z-dock);
    display: flex;
    gap: 2px;
    min-height: var(--dock-h);
    padding-block: 3px var(--dock-pad);
    padding-inline: 4px;
    background: var(--bg-elevated);
    border-block-start: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .cc-dock > a, .cc-dock summary {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    min-height: var(--dock-h);
    border-radius: var(--radius);
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    list-style: none;
  }
  .cc-dock summary::-webkit-details-marker { display: none; }
  .cc-dock details { display: flex; flex: 1 1 0; }
  .cc-dock > a.on, .cc-dock details[open] > summary { background: var(--accent-dim); color: var(--accent); }
  .cc-menu {
    position: fixed;
    inset-inline: 8px;
    inset-block-end: calc(var(--dock-h) + var(--dock-pad) + 10px);
    z-index: var(--z-menu);
    display: grid;
    gap: 2px;
    padding-block: 8px;
    padding-inline: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
  }
  .cc-menu a {
    padding-block: 12px;
    padding-inline: 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
  }
  .cc-menu a.on { background: var(--accent-dim); color: var(--accent); }
}

/* the carried pages (old-UI carry-over install 1): departures, one case, the audit list */
.pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block: 0 12px; }
.pick input, .decide select, .decide input {
  min-block-size: 44px;
  padding-inline: 10px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.pick button, .rows button, .decide button, .claim button {
  min-block-size: 44px;
  padding-inline: 14px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.pick button { background: var(--accent); color: var(--bg-elevated); border: 0; font-weight: 700; }
.rows { list-style: none; padding-inline-start: 0; }
.rows li { border-block-end: 1px solid var(--border); padding-block: 2px; padding-inline-start: 8px; }
.rows a { display: block; min-block-size: 44px; padding-block: 10px; color: var(--text); text-decoration: none; }
.rows a:hover { text-decoration: underline; }
.rows li.v-UNEXPLAINED { border-inline-start: 4px solid var(--err); }
.rows li.v-LATE_AUTHORIZATION { border-inline-start: 4px solid var(--warn); }
.rows li.v-CANNOT_VERIFY { border-inline-start: 4px solid var(--border-strong); }
.fail, .said { color: var(--err); font-weight: 700; }
h1 bdi, .rows bdi { white-space: nowrap; }
.card li { overflow-wrap: anywhere; }
.decide label { display: block; margin-block: 8px 2px; color: var(--muted); font-size: .85rem; }
.decide select, .decide input { inline-size: 100%; }
.decide button { margin-block: 6px; margin-inline-end: 6px; }

/* the homepage's buttons (old-UI carry-over install 2): one for every page the account may open */
.tiles { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-block-size: 64px;
  padding-block: 12px;
  padding-inline: 14px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
}
.tile:hover { border-color: var(--accent); background: var(--accent-dim); }
.tile b { font-size: 1.05rem; }
.tile small { color: var(--muted); font-size: .85rem; }

/* the contracts, the car story, the sheet history (old-UI carry-over install 3) */
.contract h3 { margin-block: 0 8px; font-size: 1rem; }
.contract details { margin-block-start: 8px; }
.contract summary { min-block-size: 44px; display: flex; align-items: center; cursor: pointer; color: var(--accent); }
.case {
  border-inline-start: 4px solid var(--err);
  padding-block: 6px;
  padding-inline: 10px;
  margin-block: 8px;
  background: var(--panel-2);
  border-radius: var(--radius-sm);
}
.case.cleared { border-inline-start-color: var(--border-strong); color: var(--muted); }
.none { color: var(--muted); margin-block: 6px; }
.warn { color: var(--warn); font-weight: 700; }
.links { margin-block: 6px; }
.story { padding-inline-start: 20px; }
.story .t { font-weight: 700; margin-inline-end: 6px; }
.story li.shadow { background: var(--accent-dim); border-radius: var(--radius-sm); }
.story b.shadow { color: var(--accent); }
.record {
  inline-size: 100%;
  block-size: 75vh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

/* every plain link inside a page is a 44 px target too (install 3 review I5): a line's links, the periods, the way
   back — set as a block of its own height, still read inside its sentence */
main a:not([class]) {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  min-inline-size: 44px;
}

/* the reports and the lab (old-UI carry-over install 4) */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block: 0 12px; }
.toolbar button, .toolbar .button, .lab button {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  padding-inline: 14px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.toolbar button[data-generate] { background: var(--accent); color: var(--bg-elevated); border: 0; font-weight: 700; }
.toolbar button:disabled { opacity: .6; cursor: progress; }
.toolbar .error { flex-basis: 100%; margin: 0; }
.tag {
  display: inline-flex;
  align-items: center;
  min-block-size: 32px;
  padding-inline: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
}
.muted { color: var(--muted); font-size: .85rem; }
p.fuel { color: var(--fuel); font-weight: 700; }      /* «يعبّئ وقود» on a card, the plan, the car story */
.wide { overflow-x: auto; }
table.saved { inline-size: 100%; border-collapse: collapse; font-size: .9rem; }
table.saved th, table.saved td { padding-block: 8px; padding-inline: 8px; text-align: start; white-space: nowrap; }
table.saved th { color: var(--muted); font-weight: 600; border-block-end: 1px solid var(--border-strong); }
table.saved td { border-block-end: 1px solid var(--border); }
table.saved td a { display: inline-block; min-block-size: 44px; min-inline-size: 44px; line-height: 44px; text-align: center; }
.lab-card { max-inline-size: 560px; }
.lab .ask { font-size: 1.05rem; font-weight: 700; margin-block: 0 10px; }
.lab .opts { display: flex; flex-direction: column; gap: 8px; margin-block: 8px; }
.lab .opts button { justify-content: flex-start; inline-size: 100%; }
.lab input, .lab textarea {
  inline-size: 100%;
  min-block-size: 44px;
  padding: 10px;
  margin-block: 0 10px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
}
.lab .go { margin-inline-end: 8px; }
.lab .ans {
  background: var(--panel-2);
  border-inline-start: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-block: 12px;
}
.lab .ans > b:first-child { display: block; margin-block-end: 4px; }
.lab .yes { background: var(--success); color: var(--bg-elevated); border: 0; font-weight: 700; }
.lab .no { color: var(--err); }
.lab .alarm { display: inline-block; margin-inline-end: 6px; color: var(--warn); font-weight: 700; }
.hint { color: var(--muted); font-size: .9rem; }

/* sign-in and the password form (old-UI carry-over install 6) */
.signin { display: grid; gap: 6px; max-inline-size: 360px; }
.signin label { color: var(--muted); font-size: .9rem; margin-block-start: 6px; }
.signin input[type="text"], .signin input[type="password"] {
  min-block-size: 44px;
  padding-inline: 12px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
}
.signin .remember { display: flex; align-items: center; gap: 10px; min-block-size: 44px; color: var(--text); }
.signin .remember input { inline-size: 22px; block-size: 22px; margin: 0; }
.signin button {
  min-block-size: 48px;
  margin-block-start: 8px;
  background: var(--accent);
  color: var(--bg-elevated);
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
