/* Shared phone chrome + the kit components every screen uses. Values come from tokens.css (= ThemeConfig.kt).
   1 px = 1 dp. The frame is the garage AVD used for QA: 411 × 914 dp (1080 × 2400 px @ 2.625).
   Screen files: keep this file as is; put screen-only styles in a <style> block of that screen. */

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; width: 411px; min-height: 914px; overflow-x: hidden;
  background: var(--page); color: var(--foreground);
  font-family: var(--font); font-size: 15px; line-height: 22px; font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
html[dir="rtl"] body { font-family: var(--font-ar); }
a { color: inherit; text-decoration: none; }
img { display: block; }
.ic { width: 24px; height: 24px; flex: 0 0 auto; color: currentColor; }
.ic.sm { width: 20px; height: 20px; }
.ic.xs { width: 16px; height: 16px; }

/* ── Type scale (Typography.kt) ── */
.display { font-size: 32px; line-height: 38px; font-weight: 700; letter-spacing: -0.6px; }
.title   { font-size: 30px; line-height: 36px; font-weight: 700; letter-spacing: -0.5px; }
.hero    { font-size: 22px; line-height: 26px; font-weight: 700; }
.h24     { font-size: 24px; line-height: 30px; font-weight: 700; }
.h20     { font-size: 20px; line-height: 26px; font-weight: 700; }
.heading { font-size: 17px; line-height: 22px; font-weight: 700; }
.body    { font-size: 15px; line-height: 22px; }
.caption { font-size: 13px; line-height: 18px; }
.label   { font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; }
.mono    { font-family: var(--font-mono); font-size: 14px; line-height: 20px; font-weight: 600; }
.muted   { color: var(--muted-foreground); }
.b       { font-weight: 700; }
.sb      { font-weight: 600; }
.ellip   { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Android status bar (the QA phone: 52 dp inset, text centred at 26 dp) + gesture bar ── */
.statusbar {
  height: 52px; padding: 0 24px 0 20px; display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 500; line-height: 16px; color: var(--foreground);
}
.statusbar .left, .statusbar .right { display: flex; align-items: center; gap: 6px; }
.statusbar svg { width: 14px; height: 14px; }
.navhandle { position: absolute; left: 50%; bottom: 8px; width: 108px; height: 4px; border-radius: 2px; background: var(--foreground); opacity: .85; transform: translateX(-50%); }

/* ── Layout helpers ── */
.screen { position: relative; height: 914px; overflow: hidden; display: flex; flex-direction: column; }
.screen > * { flex-shrink: 0; }
.scroll { flex: 1; min-height: 0; }
.gutter { padding-left: var(--gutter); padding-right: var(--gutter); }
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap4 { gap: 4px; } .gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap10 { gap: 10px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.grow { flex: 1; min-width: 0; }
.nos { flex-shrink: 0; }
.section { margin-top: var(--section-gap); }
.section > .label { margin-bottom: var(--label-gap); color: var(--muted-foreground); }

/* ── Top bar (Bars.kt McTopBar): 56 dp, 20 px title, 44 dp round icon buttons ── */
.topbar { height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.topbar .ttl { flex: 1; min-width: 0; font-size: 20px; line-height: 26px; font-weight: 700; }
.topbar.big { height: auto; padding: 8px 20px 6px; }
.topbar.big .ttl { font-size: 30px; line-height: 36px; letter-spacing: -0.5px; }
.iconbtn { width: 44px; height: 44px; border-radius: 999px; display: flex; align-items: center; justify-content: center; color: var(--foreground); flex: 0 0 auto; }
.iconbtn.fill { background: var(--control-fill); }
.iconbtn.tint { background: var(--primary-tint); color: var(--primary-tint-foreground); border-radius: 14px; }
.iconbtn.primary { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--lift); }

/* ── Cards (radius 20 / 24, no border, no shadow) ── */
.card { background: var(--card); color: var(--card-foreground); border-radius: var(--radius-card); padding: var(--card-padding); }
.card.compact { padding: var(--card-padding-compact); }
.card.lg { border-radius: var(--radius-card-lg); padding: var(--card-padding); }
.card.hero { background: var(--hero); color: var(--hero-foreground); border-radius: var(--radius-card-lg); box-shadow: var(--hero-lift); }
.card.hero .muted { color: var(--hero-muted); }
.card.needs { border: 2px solid var(--primary); border-radius: var(--radius-card-lg); }
.group { background: var(--card); border-radius: var(--radius-card); overflow: hidden; }
.group > .lrow + .lrow { border-top: 1px solid var(--border); }
.divider { height: 1px; background: var(--border); }

/* ── List row (Rows.kt): icon tile 40, title 15/600, sub 13 muted, chevron ── */
.lrow { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 12px 16px; }
.lrow .tile { width: 40px; height: 40px; border-radius: var(--radius-tile); background: var(--primary-tint); color: var(--primary-tint-foreground); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.lrow .tile.grey { background: var(--secondary); color: var(--foreground); }
.lrow .txt { flex: 1; min-width: 0; }
.lrow .t { font-size: 15px; line-height: 22px; font-weight: 600; }
.lrow .s { font-size: 13px; line-height: 18px; color: var(--muted-foreground); }
.lrow .val { font-size: 13px; color: var(--muted-foreground); flex: 0 0 auto; }
.lrow .chev { color: var(--muted-foreground); flex: 0 0 auto; }

/* ── Chips (Chips.kt): 36 dp pill. on = inverse (filter) or primaryTint (choice) ── */
.chip { height: 36px; padding: 0 16px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; background: var(--card); color: var(--foreground); font-size: 15px; line-height: 20px; font-weight: 500; white-space: nowrap; flex: 0 0 auto; }
.chip.on { background: var(--inverse); color: var(--inverse-foreground); }
.chip.tint { background: var(--primary-tint); color: var(--primary-tint-foreground); font-weight: 600; }
.chip.off { background: var(--muted); }
.chip.outline { background: var(--control-fill); border: 1px solid var(--border-strong); }
.chips { display: flex; gap: var(--chip-gap); overflow: hidden; }

/* ── Badges / pills ── */
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap; flex: 0 0 auto; }
.pill.tint { background: var(--primary-tint); color: var(--primary-tint-foreground); }
.pill.warn { background: var(--warning-tint); color: var(--warning-tint-foreground); }
.pill.ok { background: var(--success-tint); color: var(--success-tint-foreground); }
.pill.info { background: var(--info-tint); color: var(--info); }
.pill.bad { background: var(--destructive-tint); color: var(--destructive-tint-foreground); }
.pill.grey { background: var(--secondary); color: var(--foreground); }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--badge); color: var(--badge-foreground); font-size: 12px; line-height: 20px; font-weight: 700; text-align: center; }
.dot { width: 8px; height: 8px; border-radius: 999px; flex: 0 0 auto; }
.dot.primary { background: var(--primary); } .dot.warn { background: var(--warning-fill); } .dot.ok { background: var(--success-fill); } .dot.bad { background: var(--destructive); }
.open { color: var(--open); font-weight: 600; } .closed { color: var(--closed); font-weight: 600; }
.star { color: var(--rating); }

/* ── Buttons (Buttons.kt): primary 56 r18 lift · secondary 48 r16 · ghost 44 ── */
.btn { height: var(--button-height); padding: 0 20px; border-radius: var(--radius-tile-lg); display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; line-height: 20px; font-weight: 600; white-space: nowrap; }
.btn.primary { height: var(--button-height-lg); border-radius: var(--radius-button); background: var(--primary); color: var(--primary-foreground); font-size: 17px; font-weight: 700; box-shadow: var(--lift); }
.btn.primary.disabled { background: #E9C9B8; box-shadow: none; }
:root[data-theme="dark"] .btn.primary.disabled { background: #5A3A26; color: #8C7A6E; }
.btn.secondary { background: var(--control-fill); color: var(--foreground); border: 1px solid var(--border-strong); }
.btn.tint { background: var(--primary-tint); color: var(--primary-tint-foreground); }
.btn.ghost { height: var(--button-height-sm); border-radius: 14px; background: transparent; color: var(--foreground); }
.btn.danger { height: var(--button-height-sm); border-radius: 14px; background: var(--destructive-tint); color: var(--destructive-tint-foreground); }
.btn.link { height: auto; padding: 0; background: none; color: var(--link); font-weight: 600; }
.btn.block { width: 100%; }
.btn.sm { height: 40px; padding: 0 14px; font-size: 14px; }

/* ── Segmented tabs (Controls.kt): 40 dp track, 3 dp inset, selected = controlFill ── */
.seg { display: inline-flex; height: var(--tabs-height); padding: var(--tabs-inset, 3px); border-radius: 999px; background: var(--muted); }
.seg > span { padding: 0 16px; border-radius: 999px; display: flex; align-items: center; font-size: 15px; line-height: 20px; font-weight: 600; color: var(--muted-foreground); white-space: nowrap; }
.seg > span.on { background: var(--control-fill); color: var(--foreground); border: 1px solid var(--tab-active-border); }
.seg.sm { height: var(--tabs-height-small); }

/* ── Text field (TextField.kt): 56 r18 controlFill, 1 px input border ── */
.field { height: var(--input-height); border-radius: var(--radius-button); background: var(--control-fill); border: 1px solid var(--input); padding: 0 16px; display: flex; align-items: center; gap: 10px; font-size: 15px; }
.field .ph { color: var(--muted-foreground); }
.field.focus { border: 2px solid var(--primary); box-shadow: 0 0 0 4px rgba(185,61,11,.12); }
.field.area { height: auto; min-height: 120px; align-items: flex-start; padding: 14px 16px; }

/* ── Progress / phases (6 dp) ── */
.bar { height: var(--progress-height); border-radius: 3px; background: var(--muted); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.phases { display: flex; gap: 4px; }
.phases > div { flex: 1; }
.phases .bar.on > i { width: 100%; }
.phases .lbl { font-size: 11px; line-height: 14px; margin-top: 4px; color: var(--muted-foreground); text-align: center; white-space: nowrap; }
.phases .on .lbl { color: var(--primary); font-weight: 600; }

/* ── Avatar / logo tile ── */
.avatar { width: 56px; height: 56px; border-radius: 999px; background: var(--primary); color: var(--primary-foreground); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; flex: 0 0 auto; }
.logo { width: 40px; height: 40px; border-radius: 999px; background: var(--logo-tile); color: var(--logo-ink); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; border: 1px solid var(--border); }
.logo.sm { width: 36px; height: 36px; } .logo.lg { width: 48px; height: 48px; }
.thumb { width: 76px; height: 76px; border-radius: var(--radius-tile-lg); object-fit: cover; flex: 0 0 auto; background: var(--muted); }

/* ── Plate (PlateField.kt): mono, grey tile, "12345 | ب | 6" ── */
.plate { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: 6px; background: var(--secondary); font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.plate i { font-style: normal; color: var(--muted-foreground); }

/* ── Bottom tab bar (Bars.kt McTabBar): card, 28 dp top corners, 72 dp + nav inset, pill 56×32 primaryTint ── */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 80px; /* measured on the QA phone: 72 dp bar + the gesture inset */
  background: var(--card); border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
  display: flex; padding: 12px 8px 14px; box-shadow: var(--hero-lift);
}
.tabbar .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted-foreground); font-size: 11px; line-height: 14px; font-weight: 500; position: relative; }
.tabbar .tab .pillbg { width: var(--tab-pill-width); height: var(--tab-pill-height); border-radius: 999px; display: flex; align-items: center; justify-content: center; position: relative; }
.tabbar .tab.on { color: var(--primary-tint-foreground); font-weight: 600; }
.tabbar .tab.on .pillbg { background: var(--primary-tint); color: var(--primary); }
.tabbar .tab .count { position: absolute; top: -6px; right: -2px; }
.has-tabbar .scroll { padding-bottom: 100px; }

/* ── Action bar (bottom, one primary button): card, 28 dp corners ── */
.actionbar { position: absolute; left: 0; right: 0; bottom: 0; background: var(--card); border-radius: var(--sheet-radius) var(--sheet-radius) 0 0; padding: 12px 20px 32px; box-shadow: var(--hero-lift); }
.has-actionbar .scroll { padding-bottom: 120px; }

/* ── Bottom sheet / dialog ── */
.scrim { position: absolute; inset: 0; background: rgba(28,25,23,.45); }
:root[data-theme="dark"] .scrim { background: rgba(0,0,0,.6); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; background: var(--popover); border-radius: var(--sheet-radius) var(--sheet-radius) 0 0; padding: 8px 20px 32px; box-shadow: var(--hero-lift); }
.handle { width: 40px; height: 5px; border-radius: 3px; background: var(--handle); margin: 0 auto 12px; }
.dialog { position: absolute; left: 24px; right: 24px; top: 50%; transform: translateY(-50%); background: var(--popover); border-radius: var(--radius-card-lg); padding: 24px 20px 16px; box-shadow: var(--hero-lift); }

/* ── Toast / banners ── */
.toast { position: absolute; left: 20px; right: 20px; bottom: 112px; background: var(--inverse); color: var(--inverse-foreground); border-radius: 14px; padding: 12px 16px; font-weight: 500; }
.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-tile-lg); background: var(--secondary); color: var(--muted-foreground); font-size: 13px; line-height: 18px; }
.note .ic { width: 18px; height: 18px; margin-top: 1px; }

/* ── Timeline (Timeline.kt) ── */
.tl { display: flex; flex-direction: column; }
.tl .ev { display: flex; gap: 12px; min-height: 32px; }
.tl .ev .d { width: 12px; display: flex; flex-direction: column; align-items: center; }
.tl .ev .d .dot { margin-top: 7px; }
.tl .ev .d .ln { flex: 1; width: 1px; background: var(--border); margin-top: 4px; }
.tl .ev .d .dot.off { background: var(--border); }
.tl .ev .w { padding-bottom: 12px; font-size: 13px; line-height: 18px; }

/* ── Empty state ── */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 32px; gap: 8px; }
.empty .art { width: 96px; height: 96px; border-radius: 999px; background: var(--secondary); display: flex; align-items: center; justify-content: center; color: var(--muted-foreground); margin-bottom: 8px; }
.empty .art .ic { width: 40px; height: 40px; }

/* ── Step dots (C-03 top) ── */
.steps { display: flex; gap: 4px; align-items: center; }
.steps i { width: 6px; height: 6px; border-radius: 3px; background: var(--handle); display: block; }
.steps i.on { width: 24px; background: var(--primary); }
.steps i.done { background: var(--primary); }

/* ── RTL (Arabic): i18n.js sets dir="rtl"; flex rows mirror by themselves. Icons that point along the reading
   direction flip (the app auto-mirrors them); the status bar, numbers, plates and times stay LTR. ── */
[dir="rtl"] body { margin: 0 auto 0 0; }
[dir="rtl"] .statusbar, .plate, .mono, [dir="rtl"] .ltr { direction: ltr; }
[dir="rtl"] .ic:has(use[href="#ChevronEnd"]), [dir="rtl"] .ic:has(use[href="#ChevronStart"]),
[dir="rtl"] .ic:has(use[href="#ArrowEnd"]), [dir="rtl"] .ic:has(use[href="#ArrowStart"]),
[dir="rtl"] .ic:has(use[href="#Send"]), [dir="rtl"] .ic:has(use[href="#LogOut"]) { transform: scaleX(-1); }
[dir="rtl"] .label { letter-spacing: 0; text-transform: none; }

/* ── Small loops for the website (the app itself has none of these): map pins breathe, "your turn" dots blink.
   Transform / opacity only; nothing moves under prefers-reduced-motion. Theme switch fades. ── */
@media (prefers-reduced-motion: no-preference) {
  body, .card, .tabbar, .sheet, .chip, .field { transition: background-color 350ms ease, color 350ms ease; }
  .pin { animation: mc-breathe 3.6s ease-in-out infinite; }
  .pin:nth-of-type(2) { animation-delay: 1.2s; } .pin:nth-of-type(3) { animation-delay: 2.4s; }
  .dot.primary, .reddot { animation: mc-blink 2.4s ease-in-out infinite; }
  .tabbar .count { animation: mc-nudge 5s ease-in-out infinite; }
}
html[data-paused] * { animation-play-state: paused !important; } /* the host page pauses screens that are off-screen */
@keyframes mc-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes mc-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes mc-nudge { 0%, 88%, 100% { transform: scale(1); } 92% { transform: scale(1.25); } 96% { transform: scale(.95); } }
