/* DESIGN.md tokens — operate-mode, one accent (taxi yellow) per screen. */
:root {
  --ink: #14212B;
  --paper: #F2F4F3;
  --card: #FFFFFF;
  --line: #D5DBD8;
  --field-line: #AEB9B4;
  --muted: #5B6A72;
  --accent: #F5B800;
  --ok: #1B7A4B;
  --bad: #B42318;
  --cam: #11181D;
  --cam-muted: #B8C4CA;
  --radius-btn: 10px;
  --radius-field: 6px;
}

* { box-sizing: border-box; margin: 0; }

html, body {
  height: 100%;
}

body {
  font-family: 'IBM Plex Sans Arabic', 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- screens ---------- */

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px;
  gap: 14px;
}

.screen.centered {
  justify-content: center;
  text-align: center;
  gap: 18px;
}

/* Bilingual pattern: Arabic main line, English smaller below (LTR). */
h1 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

h1 .en, .pill .en, .prompt .en, .warn .en, .btn .en, .st .en {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  direction: ltr;
}

.warn {
  font-size: 17px;
  font-weight: 500;
  color: var(--bad);
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
}

.muted { color: var(--muted); font-size: 14px; }

/* ---------- buttons ---------- */

.btn {
  min-height: 56px;
  min-width: 220px;
  padding: 0 28px;
  border-radius: var(--radius-btn);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-weight: 600;
}

.btn .en { font-size: 12px; font-weight: 400; }

.btn.primary {
  background: var(--accent);
  color: var(--ink);
}

.btn.primary:active { filter: brightness(0.95); }

.btn.ghost {
  background: none;
  border: 2px solid var(--field-line);
  color: var(--muted);
}

.pill {
  min-height: 44px;
  padding: 6px 14px;
  border: 2px solid var(--cam-muted);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

.pill .en { font-size: 11px; color: var(--cam-muted); }

/* ---------- camera ---------- */

.screen.cam {
  background: var(--cam);
  color: #fff;
  justify-content: space-between;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.cam-top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.cam-name {
  color: var(--cam-muted);
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cam-frame {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 290 / 450;
}

.cam-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.prompt {
  color: var(--cam-muted);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}

.cam-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.shutter {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 4px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: opacity .2s;
}

.shutter .disc {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform .1s ease;
}

.shutter:active .disc { transform: scale(0.92); }
.shutter:disabled { opacity: .45; cursor: default; }

.debug {
  color: var(--cam-muted);
  font-size: 12px;
  direction: rtl;
  min-height: 16px;
}

/* Tall frame with four yellow corner brackets (290x450 ratio). */
.corners {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.corners i {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 4px solid var(--accent);
}

.corners i:nth-child(1) { top: 0; right: 0; border-bottom: none; border-left: none; }
.corners i:nth-child(2) { top: 0; left: 0; border-bottom: none; border-right: none; }
.corners i:nth-child(3) { bottom: 0; right: 0; border-top: none; border-left: none; }
.corners i:nth-child(4) { bottom: 0; left: 0; border-top: none; border-right: none; }

/* ---------- success ---------- */

.tick {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: var(--ok);
  position: relative;
}

.tick::after {
  content: '';
  position: absolute;
  left: 38px;
  top: 44px;
  width: 26px;
  height: 48px;
  border-right: 8px solid #fff;
  border-bottom: 8px solid #fff;
  transform: rotate(45deg);
}

.progress {
  width: min(260px, 80%);
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.progress i {
  display: block;
  height: 100%;
  background: var(--ok);
  animation: fill 3s linear forwards;
}

@keyframes fill {
  from { width: 0; }
  to { width: 100%; }
}

/* ---------- thumbnails ---------- */

.thumb {
  width: 120px;
  height: 150px;
  border-radius: var(--radius-field);
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
}

.thumb img { width: 100%; height: 100%; object-fit: cover; }

.badge.cross {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bad);
}

.badge.cross::before,
.badge.cross::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 3px;
  background: #fff;
}

.badge.cross::before { transform: translate(-50%, -50%) rotate(45deg); }
.badge.cross::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* ---------- today list ---------- */

.screen.list {
  justify-content: flex-start;
  padding-top: 28px;
}

.screen.list h1 { align-items: flex-start; text-align: start; }
.screen.list h1 { flex-direction: row; flex-wrap: wrap; }
.screen.list h1 .en { margin-inline-start: 8px; }

#list {
  list-style: none;
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-field);
  padding: 6px 14px;
  flex: 1;
  overflow-y: auto;
}

#list .muted { padding: 14px 0; display: flex; flex-wrap: wrap; gap: 4px; }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.row:last-child { border-bottom: none; }

.time { color: var(--muted); font-size: 14px; min-width: 56px; }
.amt { font-weight: 600; }
.amt.dim { color: var(--muted); font-weight: 400; }

.st {
  margin-inline-start: auto;
  text-align: end;
  font-size: 13px;
  font-weight: 500;
}

.st.pending { color: var(--muted); }
.st.needs_check { color: var(--bad); }
.st.confirmed { color: var(--ok); }
.st.rejected { color: var(--bad); }

.st small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  max-width: 180px;
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
