/* ══════════════════════════════════════════════════════════════
   MOTRA prototype — component library + responsive shell.
   Mobile-first. Tablet centres the phone. Desktop shows the
   phone frame flanked by a screen index and screen notes.
   ══════════════════════════════════════════════════════════════ */

@import "./tokens.css";

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; background: none; border: 0; padding: 0; color: inherit; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ─── Fonts ─────────────────────────────────────────────── */
:root {
  --font-ar: "Cairo", "IBM Plex Sans Arabic", "Segoe UI", -apple-system, sans-serif;
  --font-en: "Cairo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --nav-h: 62px;
}

html {
  font-family: var(--font-ar);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--text);
  background: var(--bg);
}
[dir="ltr"] body { font-family: var(--font-en); }
body { background: var(--bg); color: var(--text); }

/* ─── Type scale ────────────────────────────────────────── */
h1 { font-size: 22px; font-weight: 800; margin: 0 0 8px; letter-spacing: -0.2px; }
h2 { font-size: 18px; font-weight: 800; margin: 0 0 8px; }
h3 { font-size: 15.5px; font-weight: 700; margin: 0 0 6px; }
h4 { font-size: 13.5px; font-weight: 700; margin: 0 0 4px; }
p  { font-size: 13.5px; margin: 0 0 10px; color: var(--text1); }
small { font-size: 11.5px; color: var(--text2); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--surface2); padding: 1px 5px; border-radius: 5px; }

/* ══════════════════════════════════════════════════════════════
   SHELL
   ══════════════════════════════════════════════════════════════ */

.stage { min-height: 100dvh; }
html, body { overflow-x: hidden; }

/* On mobile the phone IS the viewport: a fixed-height app shell so the
   app bar and bottom nav stay pinned while only .body-scroll scrolls. */
.phone {
  position: relative;
  height: 100dvh;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Fake device status bar — only shown in framed (tablet/desktop) mode */
.statusbar { display: none; }

/* App bar */
.appbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  min-height: 56px;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  z-index: 20;
  flex: none;
}
.appbar__title { font-size: 16px; font-weight: 800; margin: 0; line-height: 1.25; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar__sub { font-size: 11px; font-weight: 600; color: var(--text2); display: block; }
.iconbtn {
  width: 36px; height: 36px; flex: none;
  border-radius: 11px;
  background: var(--surface2);
  display: grid; place-items: center;
  color: var(--text1);
  transition: background .15s, transform .1s;
}
.iconbtn:hover { background: var(--border); }
.iconbtn:active { transform: scale(.94); }
.iconbtn.ghost { background: transparent; }
.iconbtn .ic { width: 18px; height: 18px; }
.appbar__actions { display: flex; gap: 6px; align-items: center; flex: none; }
.langbtn {
  height: 36px; padding: 0 11px; border-radius: 11px;
  background: var(--surface2); color: var(--text1);
  font-size: 11.5px; font-weight: 800; letter-spacing: .3px;
  display: inline-flex; align-items: center;
}
.langbtn:hover { background: var(--border); }

/* Scrollable body */
.body-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.body-scroll::-webkit-scrollbar { width: 6px; }
.body-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
.screen { padding: 14px 16px 22px; display: block; }
.screen.flush { padding: 0 0 22px; }
.has-nav .screen { padding-bottom: calc(var(--nav-h) + 24px); }

/* Bottom navigation */
.bottom-nav {
  position: absolute; inset-inline: 0; bottom: 0; z-index: 25;
  height: var(--nav-h);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: grid; justify-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 700;
  color: var(--text2);
  padding: 8px 2px;
  position: relative;
  transition: color .15s;
}
.bottom-nav a .ic { width: 21px; height: 21px; }
.bottom-nav a.is-active { color: var(--accent); }
.bottom-nav a.is-active::before {
  content: ""; position: absolute; top: 0; width: 26px; height: 3px;
  border-radius: 0 0 99px 99px; background: var(--accent);
}
.bottom-nav a:hover { color: var(--text); }
.bottom-nav a.is-active:hover { color: var(--accent); }

/* Floating action button */
.fab {
  position: absolute; inset-inline-end: 16px; bottom: calc(var(--nav-h) + 16px); z-index: 26;
  height: 50px; padding: 0 18px; border-radius: 99px;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 13.5px;
  box-shadow: 0 10px 24px rgba(253,87,2,.38);
  transition: transform .12s, box-shadow .2s;
}
.fab:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(253,87,2,.45); }
.fab:active { transform: scale(.97); }
.fab .ic { width: 18px; height: 18px; }

/* ══════════════════════════════════════════════════════════════
   BREAKPOINTS
   ══════════════════════════════════════════════════════════════ */

/* Tablet and up — centre the phone with device chrome. */
@media (min-width: 641px) {
  body {
    background:
      radial-gradient(1200px 600px at 20% -10%, rgba(253,87,2,.10), transparent 60%),
      linear-gradient(135deg, #F3F5FA 0%, #E7ECF4 100%);
    min-height: 100dvh;
  }
  [data-theme="dark"] body {
    background:
      radial-gradient(1200px 600px at 20% -10%, rgba(253,87,2,.16), transparent 60%),
      linear-gradient(135deg, #0A101B 0%, #101A2B 100%);
  }
  .stage { display: grid; place-items: center; padding: 32px 20px; }
  .phone {
    width: 400px; max-width: 100%;
    height: min(840px, calc(100dvh - 64px));
    border-radius: 38px;
    box-shadow: var(--shadow-lg), 0 0 0 9px #10192b, 0 0 0 10px rgba(255,255,255,.10);
  }
  .statusbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 22px 4px; font-size: 11.5px; font-weight: 800;
    color: var(--text); flex: none; letter-spacing: .2px; direction: ltr;
  }
  .statusbar .sb-right { display: flex; gap: 5px; align-items: center; opacity: .85; }
  .phone::after {
    content: ""; position: absolute; z-index: 40;
    bottom: 7px; left: 50%; transform: translateX(-50%);
    width: 120px; height: 4px; border-radius: 99px;
    background: color-mix(in srgb, var(--text) 30%, transparent);
    pointer-events: none;
  }
  .has-nav .bottom-nav { bottom: 12px; }
  .has-nav .screen { padding-bottom: calc(var(--nav-h) + 36px); }
  .fab { bottom: calc(var(--nav-h) + 28px); }
}

/* Desktop — phone frame plus index + notes panels. */
@media (min-width: 1025px) {
  .stage {
    display: grid;
    grid-template-columns: 268px auto 300px;
    gap: 34px;
    align-items: center;
    justify-content: center;
    padding: 30px 26px;
  }
}
@media (min-width: 1400px) {
  .stage { grid-template-columns: 300px auto 340px; gap: 44px; }
}

/* Side panels */
.side-panel { display: none; }
@media (min-width: 1025px) {
  .side-panel {
    display: flex; flex-direction: column;
    max-height: min(840px, calc(100dvh - 60px));
    color: var(--text1);
  }
  .side-panel__head { flex: none; padding: 0 4px 12px; }
  .side-panel__body { overflow-y: auto; padding: 0 4px 4px; scrollbar-width: thin; }
  .side-panel__body::-webkit-scrollbar { width: 6px; }
  .side-panel__body::-webkit-scrollbar-thumb { background: rgba(120,135,160,.4); border-radius: 99px; }
}
.brandline { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.brandline .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 900; font-size: 17px; box-shadow: 0 6px 16px rgba(253,87,2,.35); }
.brandline b { font-size: 15px; font-weight: 800; letter-spacing: .3px; }

.navgroup { margin-bottom: 14px; }
.navgroup__label {
  font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text2); opacity: .8; padding: 0 8px 6px; display: block;
}
.navlink {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 9px;
  font-size: 12.5px; font-weight: 600; color: var(--text1);
  transition: background .13s, color .13s;
}
.navlink:hover { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
.navlink.is-active { background: var(--accent); color: #fff; font-weight: 800; box-shadow: 0 5px 14px rgba(253,87,2,.32); }
.navlink .dot { width: 5px; height: 5px; border-radius: 99px; background: currentColor; opacity: .45; flex: none; }
.navlink.is-active .dot { opacity: 1; }

.notes-card {
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 14px; padding: 14px; margin-bottom: 12px;
  backdrop-filter: blur(8px);
}
.notes-card h4 { font-size: 11px; letter-spacing: .8px; text-transform: uppercase; color: var(--text2); margin-bottom: 8px; }
.notes-card p { font-size: 12.5px; margin: 0; color: var(--text1); }
.notes-card ul { display: grid; gap: 6px; }
.notes-card li { font-size: 12px; color: var(--text1); display: flex; gap: 7px; line-height: 1.5; }
.notes-card li::before { content: "\25B8"; color: var(--accent); flex: none; }

/* ══════════════════════════════════════════════════════════════
   COMPONENTS
   ══════════════════════════════════════════════════════════════ */

/* Layout helpers */
.stack   { display: grid; gap: 12px; }
.stack.sm{ gap: 8px; }
.stack.lg{ gap: 18px; }
.row     { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.row.wrap{ flex-wrap: wrap; }
.spacer  { flex: 1; }
.grid2   { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3   { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid4   { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.text-muted { color: var(--text2); }
.text-accent{ color: var(--accent); }
.text-success{ color: var(--success); }
.text-error { color: var(--error); }
.text-center{ text-align: center; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.hairline { height: 1px; background: var(--border); margin: 4px 0; border: 0; }

/* Section header */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 0 10px; }
.sec-head:first-child { margin-top: 4px; }
.sec-head h3 { margin: 0; }
.sec-head a { font-size: 12px; font-weight: 700; color: var(--accent); }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.card.pad-sm { padding: 11px; }
.card.tap { transition: border-color .15s, transform .1s, box-shadow .15s; display: block; }
.card.tap:hover { border-color: var(--border2); box-shadow: var(--shadow-sm); }
.card.tap:active { transform: scale(.995); }
.card.accent { background: var(--accent-tint); border-color: var(--accent-tint-bd); }
.card.flat { border-color: var(--border-soft); background: var(--surface3); }

/* Hero / brand gradient block */
.hero {
  border-radius: var(--radius-xl);
  padding: 18px;
  color: #fff;
  background: linear-gradient(135deg, #FD5702 0%, #F97316 45%, #FB923C 100%);
  box-shadow: 0 12px 28px rgba(253,87,2,.30);
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset-inline-end: -30px; top: -40px;
  width: 150px; height: 150px; border-radius: 50%;
  background: rgba(255,255,255,.14);
}
.hero h2, .hero h3, .hero p, .hero small, .hero b { color: #fff; position: relative; }
.hero p { opacity: .92; }

/* Brand lockup — the same mark on every auth screen */
.auth-brand { display: grid; justify-items: center; gap: 9px; padding: 4px 0 18px; }
.auth-brand__mark {
  width: 62px; height: 62px; border-radius: 19px;
  background: linear-gradient(135deg, #FD5702 0%, #FB923C 100%);
  color: #fff; display: grid; place-items: center;
  font-size: 29px; font-weight: 900; letter-spacing: -1px;
  box-shadow: 0 10px 26px rgba(253,87,2,.34);
}
.auth-brand__word { font-size: 17px; font-weight: 800; letter-spacing: .6px; color: var(--accent); line-height: 1; }
.auth-brand__tag  { font-size: 11.5px; color: var(--text2); font-weight: 600; margin-top: -3px; }
.auth-brand.lg { gap: 11px; padding: 22px 0 8px; }
.auth-brand.lg .auth-brand__mark { width: 88px; height: 88px; border-radius: 26px; font-size: 40px; box-shadow: 0 14px 34px rgba(253,87,2,.38); }
.auth-brand.lg .auth-brand__word { font-size: 32px; letter-spacing: .5px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 18px;
  border-radius: var(--radius-md);
  font-weight: 800; font-size: 14px;
  transition: filter .15s, transform .1s, background .15s, border-color .15s;
  text-align: center;
}
.btn .ic { width: 18px; height: 18px; }
.btn:active { transform: scale(.985); }
.btn-primary   { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(253,87,2,.28); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--border2); }
.btn-outline   { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover { background: var(--accent-tint); }
.btn-ghost     { background: transparent; color: var(--text1); font-weight: 700; }
.btn-ghost:hover { background: var(--surface2); }
.btn-danger    { background: var(--error-tint); color: var(--error); border: 1px solid color-mix(in srgb, var(--error) 30%, transparent); }
.btn-block     { display: flex; width: 100%; }
.btn-sm        { min-height: 38px; padding: 8px 14px; font-size: 12.5px; border-radius: 10px; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

/* Sticky action bar at the bottom of a screen */
.action-bar {
  position: sticky; bottom: 0; z-index: 15;
  margin: 18px -16px -22px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: grid; gap: 8px;
}
.action-bar.split { grid-template-columns: 1fr 1fr; }

/* Chips / badges */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 800;
  background: var(--surface2); color: var(--text1);
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip .ic { width: 12px; height: 12px; }
.chip.accent  { background: var(--accent-tint);  color: var(--accent);  border-color: var(--accent-tint-bd); }
.chip.success { background: var(--success-tint); color: var(--success); }
.chip.error   { background: var(--error-tint);   color: var(--error); }
.chip.warning { background: var(--warning-tint); color: #B45309; }
[data-theme="dark"] .chip.warning { color: var(--warning); }
.chip.info    { background: var(--info-tint);    color: var(--info); }
.chip.outline { background: transparent; border-color: var(--border2); color: var(--text2); }
.chip.lg { padding: 6px 13px; font-size: 12px; }

.badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px; background: var(--error); color: #fff;
  font-size: 10.5px; font-weight: 800;
  display: inline-grid; place-items: center;
}
.bottom-nav .badge { position: absolute; top: 4px; inset-inline-end: 22%; }

/* Selectable chip row (filters) */
.chiprow { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px; margin: 0 -16px; scrollbar-width: none; }
.chiprow::-webkit-scrollbar { display: none; }
.chiprow .chip { cursor: pointer; padding: 7px 14px; font-size: 12px; border: 1px solid var(--border); }
.chiprow .chip.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Tabs */
.tabs {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface2); border-radius: 12px; padding: 4px; gap: 4px;
}
.tabs button {
  padding: 9px 6px; border-radius: 9px;
  font-size: 12.5px; font-weight: 800; color: var(--text2);
  transition: background .15s, color .15s, box-shadow .15s;
}
.tabs button.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .tabs button.is-on { background: var(--border); color: #fff; }

/* Underline tabs */
.utabs { display: flex; gap: 18px; border-bottom: 1px solid var(--border); margin: 0 -16px 14px; padding: 0 16px; }
.utabs button { padding: 10px 0 11px; font-size: 13.5px; font-weight: 700; color: var(--text2); position: relative; }
.utabs button.is-on { color: var(--accent); }
.utabs button.is-on::after { content: ""; position: absolute; inset-inline: 0; bottom: -1px; height: 2.5px; border-radius: 3px 3px 0 0; background: var(--accent); }

/* List rows */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-soft);
  transition: background .13s;
  min-height: 58px;
}
.list-item:last-child { border-bottom: 0; }
a.list-item:hover, button.list-item:hover { background: var(--surface3); }
.list-item__main { flex: 1; min-width: 0; }
.list-item__main b { display: block; font-size: 13.5px; font-weight: 700; }
.list-item__main span { display: block; font-size: 11.5px; color: var(--text2); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Components nested inside a list row keep their own display + type. */
.list-item__main .row    { display: flex; overflow: visible; white-space: normal; }
.list-item__main .rating { display: inline-flex; overflow: visible; font-size: 12px; color: var(--text1); }
.list-item__main .chip   { display: inline-flex; overflow: visible; font-size: 11px; }
.list-item__main .stars  { display: inline-flex; overflow: visible; }
.list-item__main .rating .ic, .list-item__main .stars .ic { margin-top: 0; }

.list-item .ic-chev { width: 16px; height: 16px; color: var(--text2); flex: none; }
button.list-item { width: 100%; text-align: start; }

/* Leading icon tile */
.tile {
  width: 40px; height: 40px; flex: none;
  border-radius: 12px; display: grid; place-items: center;
  background: var(--surface2); color: var(--text1);
}
.tile .ic { width: 19px; height: 19px; }
.tile.accent  { background: var(--accent-tint);  color: var(--accent); }
.tile.success { background: var(--success-tint); color: var(--success); }
.tile.error   { background: var(--error-tint);   color: var(--error); }
.tile.info    { background: var(--info-tint);    color: var(--info); }
.tile.warning { background: var(--warning-tint); color: #B45309; }
[data-theme="dark"] .tile.warning { color: var(--warning); }
.tile.lg { width: 48px; height: 48px; border-radius: 14px; }
.tile.lg .ic { width: 23px; height: 23px; }

/* Avatar */
.avatar {
  width: 42px; height: 42px; flex: none; border-radius: 50%;
  background: linear-gradient(135deg, #FD5702, #FB923C);
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; letter-spacing: .3px;
}
.avatar.sm { width: 34px; height: 34px; font-size: 12.5px; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.avatar.blue  { background: linear-gradient(135deg, #2563EB, #60A5FA); }
.avatar.green { background: linear-gradient(135deg, #177A3E, #34D399); }
.avatar.slate { background: linear-gradient(135deg, #475569, #94A3B8); }

/* Service tiles grid */
.svc {
  display: grid; justify-items: center; gap: 7px;
  padding: 12px 6px;
  border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border);
  transition: border-color .15s, transform .1s, box-shadow .15s;
}
.svc:hover { border-color: var(--accent-tint-bd); box-shadow: var(--shadow-sm); }
.svc:active { transform: scale(.97); }
.svc .tile { width: 38px; height: 38px; }
.svc span { font-size: 11px; font-weight: 700; text-align: center; line-height: 1.25; color: var(--text1); }

/* Stat block */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; }
.stat b { display: block; font-size: 19px; font-weight: 800; letter-spacing: -.4px; }
.stat span { display: block; font-size: 11px; color: var(--text2); font-weight: 600; margin-top: 1px; }
.stat .ic { width: 16px; height: 16px; }

/* Form fields */
.field { display: block; margin-bottom: 12px; }
.field > label, .flabel {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--text1); margin-bottom: 6px;
}
.field .req { color: var(--error); }
.input, .select, .textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 14px; font-weight: 600;
  min-height: 48px;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--text2); font-weight: 500; opacity: .85; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text2) 50%), linear-gradient(135deg, var(--text2) 50%, transparent 50%);
  background-position: calc(100% - 19px) 21px, calc(100% - 14px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-inline-end: 36px;
}
[dir="rtl"] .select { background-position: 14px 21px, 19px 21px; padding-inline-end: 14px; padding-inline-start: 36px; }
.field-hint { font-size: 11px; color: var(--text2); margin-top: 5px; display: block; }
.field-error { font-size: 11px; color: var(--error); margin-top: 5px; display: block; font-weight: 600; }

/* Input with leading affix (e.g. phone country code) */
.input-group { display: flex; gap: 8px; }
.affix {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 0 13px; min-height: 48px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-md); font-weight: 800; font-size: 14px;
  direction: ltr;
}
.input-group .input { flex: 1; }

/* Search bar */
.searchbar {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 13px; padding: 0 13px; min-height: 46px;
}
.searchbar .ic { width: 17px; height: 17px; color: var(--text2); flex: none; }
.searchbar input { flex: 1; background: none; border: 0; outline: none; font-size: 13.5px; font-weight: 600; min-width: 0; }

/* OTP boxes */
.otp { display: flex; gap: 10px; justify-content: center; direction: ltr; }
.otp input {
  width: 52px; height: 60px; text-align: center;
  font-size: 24px; font-weight: 800;
  border: 1.5px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.otp input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.otp input.filled { border-color: var(--accent); background: var(--accent-tint); }

/* Toggle switch */
.switch { position: relative; width: 46px; height: 27px; flex: none; display: inline-block; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.switch i {
  position: absolute; inset: 0; border-radius: 99px;
  background: var(--border2); transition: background .2s;
}
.switch i::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 21px; height: 21px; border-radius: 50%; background: #fff;
  transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(19px); }
[dir="rtl"] .switch input:checked + i::after { transform: translateX(-19px); }

/* Radio / choice cards */
.choice {
  display: flex; align-items: center; gap: 11px;
  padding: 13px; border-radius: 13px;
  background: var(--surface); border: 1.5px solid var(--border);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.choice:hover { border-color: var(--border2); }
.choice.is-on { border-color: var(--accent); background: var(--accent-tint); }
.choice__main { flex: 1; min-width: 0; }
.choice__main b { display: block; font-size: 13.5px; font-weight: 700; }
.choice__main span { display: block; font-size: 11.5px; color: var(--text2); }
.radio-dot {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  border: 2px solid var(--border2); display: grid; place-items: center;
  transition: border-color .15s;
}
.choice.is-on .radio-dot { border-color: var(--accent); }
.choice.is-on .radio-dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* Rating */
.rating { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 800; color: var(--text1); direction: ltr; }
.rating .ic { width: 13px; height: 13px; color: #F59E0B; }
.stars { display: inline-flex; gap: 2px; }
.stars .ic { width: 14px; height: 14px; color: var(--border2); }
.stars .ic.on { color: #F59E0B; }

/* Progress */
.progress { height: 7px; border-radius: 99px; background: var(--surface2); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s; }
.progress.success i { background: var(--success); }

/* Step indicator */
.steps { display: flex; align-items: center; gap: 6px; }
.steps i { height: 4px; flex: 1; border-radius: 99px; background: var(--surface2); }
.steps i.done { background: var(--accent); }

/* Timeline */
.timeline { display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 26px 1fr; gap: 12px; }
.tl-mark { display: flex; flex-direction: column; align-items: center; }
.tl-dot {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: var(--surface2); color: var(--text2);
  display: grid; place-items: center; border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.tl-dot .ic { width: 12px; height: 12px; }
.tl-item.done .tl-dot { background: var(--success); color: #fff; box-shadow: 0 0 0 1px var(--success); }
.tl-item.current .tl-dot { background: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-tint); }
.tl-line { width: 2px; flex: 1; min-height: 24px; background: var(--border); border-radius: 2px; margin: 3px 0; }
.tl-item.done .tl-line { background: var(--success); }
.tl-body { padding-bottom: 16px; }
.tl-body b { display: block; font-size: 13.5px; font-weight: 700; }
.tl-body span { display: block; font-size: 11.5px; color: var(--text2); margin-top: 1px; }
.tl-item:last-child .tl-body { padding-bottom: 0; }

/* Key/value rows (receipts, summaries) */
.kv { display: grid; gap: 9px; }
.kv > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13px; }
.kv > div > span:first-child { color: var(--text2); font-weight: 600; }
.kv > div > span:last-child  { font-weight: 700; text-align: end; }
.kv .total { padding-top: 9px; border-top: 1px dashed var(--border); font-size: 15px; }
.kv .total span:last-child { color: var(--accent); font-weight: 800; font-size: 17px; }

/* Money */
.money { font-weight: 800; letter-spacing: -.2px; }
.money i { font-style: normal; font-size: .72em; font-weight: 700; color: var(--text2); margin-inline-start: 2px; }

/* Notice / callout */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px; border-radius: 12px;
  font-size: 12px; font-weight: 600; line-height: 1.5;
  background: var(--info-tint); color: var(--info);
  border: 1px solid color-mix(in srgb, var(--info) 22%, transparent);
}
.notice .ic { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.notice.success { background: var(--success-tint); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.notice.warning { background: var(--warning-tint); color: #92400E; border-color: color-mix(in srgb, var(--warning) 32%, transparent); }
[data-theme="dark"] .notice.warning { color: var(--warning); }
.notice.error   { background: var(--error-tint);   color: var(--error);   border-color: color-mix(in srgb, var(--error) 25%, transparent); }
.notice.accent  { background: var(--accent-tint);  color: var(--accent);  border-color: var(--accent-tint-bd); }

/* Empty state */
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 46px 24px; }
.empty .tile { width: 62px; height: 62px; border-radius: 20px; }
.empty .tile .ic { width: 28px; height: 28px; }
.empty h3 { margin: 0; }
.empty p { margin: 0; font-size: 13px; max-width: 260px; }

/* Accordion */
.acc { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; }
.acc + .acc { margin-top: 9px; }
.acc summary {
  list-style: none; cursor: pointer;
  padding: 14px; font-size: 13.5px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary .ic { width: 16px; height: 16px; color: var(--text2); flex: none; transition: transform .2s; margin-inline-start: auto; }
.acc[open] summary .ic { transform: rotate(180deg); }
.acc[open] summary { color: var(--accent); }
.acc__body { padding: 12px 14px 14px; font-size: 13px; color: var(--text1); line-height: 1.65; border-top: 1px solid var(--border-soft); }

/* Map placeholder */
.mapbox {
  height: 160px; border-radius: 14px; position: relative; overflow: hidden;
  border: 1px solid var(--border);
  background:
    repeating-linear-gradient(0deg, transparent 0 22px, color-mix(in srgb, var(--text) 6%, transparent) 22px 23px),
    repeating-linear-gradient(90deg, transparent 0 22px, color-mix(in srgb, var(--text) 6%, transparent) 22px 23px),
    var(--surface3);
}
.mapbox::before {
  content: ""; position: absolute; top: 50%; left: 50%; width: 62%; height: 8px;
  transform: translate(-50%,-50%) rotate(-24deg);
  background: color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 99px;
}
.mapbox .pin {
  position: absolute; top: 48%; left: 50%; transform: translate(-50%,-100%) rotate(-45deg);
  width: 30px; height: 30px; border-radius: 50% 50% 50% 0;
  background: var(--accent);
  box-shadow: 0 6px 14px rgba(253,87,2,.45);
  display: grid; place-items: center;
}
.mapbox .pin::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.mapbox .mlabel {
  position: absolute; inset-inline: 10px; bottom: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 11px; font-size: 11.5px; font-weight: 700;
  display: flex; align-items: center; gap: 7px;
}

/* Photo upload tiles */
.uploads { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.upload {
  aspect-ratio: 1; border-radius: 13px;
  border: 1.5px dashed var(--border2); background: var(--surface3);
  display: grid; place-items: center; align-content: center; gap: 4px; color: var(--text2);
  font-size: 10.5px; font-weight: 700; text-align: center;
  transition: border-color .15s, color .15s;
}
.upload:hover { border-color: var(--accent); color: var(--accent); }
.upload .ic { width: 20px; height: 20px; }
.upload.filled {
  border-style: solid; border-color: var(--border);
  background: linear-gradient(135deg, #64748B, #94A3B8);
  color: #fff;
}
.upload.filled .ic { width: 24px; height: 24px; opacity: .9; }

/* Chat bubbles */
.bubbles { display: grid; gap: 10px; }
.bubble { max-width: 78%; padding: 10px 13px; border-radius: 16px; font-size: 13px; line-height: 1.55; }
.bubble time { display: block; font-size: 10px; opacity: .7; margin-top: 3px; font-weight: 600; }
.bubble.them { background: var(--surface2); color: var(--text); border-start-start-radius: 5px; justify-self: start; }
.bubble.me   { background: var(--accent); color: #fff; border-start-end-radius: 5px; justify-self: end; }
.chat-day { text-align: center; font-size: 10.5px; font-weight: 700; color: var(--text2); margin: 6px 0; }
.composer {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); background: var(--bg);
  position: sticky; bottom: 0; margin: 14px -16px -22px;
}
.composer input { flex: 1; background: var(--surface2); border: 1px solid var(--border); border-radius: 99px; padding: 11px 16px; font-size: 13.5px; outline: none; min-width: 0; }
.composer .send { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.composer .send .ic { width: 18px; height: 18px; }

/* Quote comparison card */
.quote { border: 1.5px solid var(--border); border-radius: 16px; background: var(--surface); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.quote:hover { border-color: var(--border2); box-shadow: var(--shadow-sm); }
.quote.best { border-color: var(--accent); box-shadow: 0 6px 20px rgba(253,87,2,.15); }
.quote__flag { background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 800; padding: 5px 12px; text-align: center; letter-spacing: .3px; }
.quote__body { padding: 13px 14px; }
.quote__foot { display: flex; gap: 8px; padding: 0 14px 13px; }
.quote__foot .btn { flex: 1; }
.qmeta { display: flex; gap: 16px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.qmeta > div { display: grid; gap: 1px; }
.qmeta b { font-size: 12.5px; font-weight: 800; }
.qmeta span { font-size: 10.5px; color: var(--text2); font-weight: 600; }

/* Divider with label */
.divider { display: flex; align-items: center; gap: 12px; color: var(--text2); font-size: 11.5px; font-weight: 700; margin: 4px 0; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--border); }

/* Icons */
.ic { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.fill { fill: currentColor; stroke: none; }
[dir="rtl"] .mirror { transform: scaleX(-1); }

/* Cover header (profiles) */
.cover {
  margin: -14px -16px 0;
  padding: 22px 16px 18px;
  background: linear-gradient(135deg, #FD5702 0%, #F97316 55%, #FB923C 100%);
  color: #fff; position: relative; overflow: hidden;
}
.cover::after { content: ""; position: absolute; inset-inline-end: -40px; bottom: -60px; width: 170px; height: 170px; border-radius: 50%; background: rgba(255,255,255,.12); }
.cover > * { position: relative; z-index: 1; }
.cover .avatar { border: 3px solid rgba(255,255,255,.9); background: rgba(255,255,255,.22); }
.cover h2 { color: #fff; margin: 0; }
.cover small, .cover p, .cover .rating { color: rgba(255,255,255,.92); }
.cover .rating .ic { color: #FFE08A; }
.cover-stats { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin-top: 16px; background: rgba(255,255,255,.16); border-radius: 14px; padding: 10px 4px; }
.cover-stats > div { text-align: center; }
.cover-stats b { display: block; font-size: 16px; font-weight: 800; }
.cover-stats span { display: block; font-size: 10.5px; opacity: .9; font-weight: 600; }

/* Balance card */
.balance {
  border-radius: 20px; padding: 18px;
  background: linear-gradient(135deg, #16202F 0%, #23344B 60%, #16202F 100%);
  color: #fff; position: relative; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.balance::after { content: ""; position: absolute; inset-inline-end: -50px; top: -50px; width: 170px; height: 170px; border-radius: 50%; background: radial-gradient(circle, rgba(253,87,2,.55), transparent 70%); }
.balance > * { position: relative; z-index: 1; }
.balance small { display: block; color: rgba(255,255,255,.72); font-weight: 700; }
.balance .amt { font-size: 33px; font-weight: 800; letter-spacing: -1px; margin: 4px 0 2px; direction: ltr; display: inline-block; }
.balance .amt i { font-style: normal; font-size: 15px; font-weight: 700; opacity: .8; margin-inline-start: 4px; }

/* Screen gallery (index page) */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 11px; }
.gcard {
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  padding: 13px; display: grid; gap: 6px; align-content: start;
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.gcard:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.gcard b { font-size: 13px; font-weight: 700; }
.gcard span { font-size: 10.5px; color: var(--text2); font-family: ui-monospace, monospace; direction: ltr; }
.gnum { font-size: 10px; font-weight: 800; color: var(--accent); background: var(--accent-tint); border-radius: 6px; padding: 1px 6px; justify-self: start; direction: ltr; }

/* Animation */
@keyframes fadeup { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.screen > * { animation: fadeup .3s ease both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Print */
@media print { .side-panel, .bottom-nav, .appbar__actions { display: none !important; } }

/* Toast (prototype-only feedback) */
.motra-toast {
  position: fixed; z-index: 999;
  left: 50%; bottom: 34px; transform: translate(-50%, 14px);
  background: #16202F; color: #fff;
  padding: 11px 18px; border-radius: 99px;
  font-size: 12.5px; font-weight: 700; font-family: var(--font-ar);
  box-shadow: 0 12px 30px rgba(0,0,0,.30);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: 84vw; text-align: center;
}
.motra-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
[data-theme="dark"] .motra-toast { background: #F1F5F9; color: #16202F; }
