/* AgentDesk 0.1.0. Minimal, airy, one idea per screen. Brand colours come from the account through --brand and
   --accent on <html>. Light and dark follow the device. Arabic and Urdu read right to left: the layout uses logical
   properties (inline-start/end) so nothing has to be mirrored by hand. */
:root {
  --brand: #0F172A;
  --accent: #2563EB;
  --accent-ink: #FFFFFF;
  --bg: #F5F7FB;
  --surface: #FFFFFF;
  --surface-2: #F1F4F9;
  --ink: #0B1220;
  --ink-2: #334155;
  --muted: #64748B;
  --line: #E2E8F0;
  --line-2: #CBD5E1;
  --good: #047857; --good-soft: #D1FAE5;
  --warn: #B45309; --warn-soft: #FEF3C7;
  --err: #B91C1C; --err-soft: #FEE2E2;
  --info: #1D4ED8; --info-soft: #DBEAFE;
  --link: var(--accent);
  --radius: 20px;
  --radius-s: 12px;
  --shadow: 0 1px 2px rgba(11, 18, 32, .04), 0 4px 16px rgba(11, 18, 32, .05);
  --display: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0F1A; --surface: #121A2A; --surface-2: #182236; --ink: #EEF2F8; --ink-2: #C7D0DE; --muted: #93A0B5;
    --line: #243049; --line-2: #33415E; --good: #6EE7B7; --good-soft: #0F2F26; --warn: #FDBA74; --warn-soft: #3A2415;
    --err: #FCA5A5; --err-soft: #3B1A1A; --info: #93C5FD; --info-soft: #1E2A44; --link: #93C5FD; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A0F1A; --surface: #121A2A; --surface-2: #182236; --ink: #EEF2F8; --ink-2: #C7D0DE; --muted: #93A0B5;
  --line: #243049; --line-2: #33415E; --good: #6EE7B7; --good-soft: #0F2F26; --warn: #FDBA74; --warn-soft: #3A2415;
  --err: #FCA5A5; --err-soft: #3B1A1A; --info: #93C5FD; --info-soft: #1E2A44; --link: #93C5FD; --shadow: none; color-scheme: dark;
}
html[dir="rtl"] { --display: "Noto Kufi Arabic", "Inter Tight", system-ui, sans-serif; --body: "Noto Sans Arabic", "Inter", system-ui, sans-serif; }
@font-face { font-family: "Noto Sans Arabic"; font-weight: 400; src: url(fonts/noto-sans-arabic-arabic-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Noto Sans Arabic"; font-weight: 600; src: url(fonts/noto-sans-arabic-arabic-600-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Noto Sans Arabic"; font-weight: 700; src: url(fonts/noto-sans-arabic-arabic-700-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Noto Kufi Arabic"; font-weight: 700; src: url(fonts/noto-kufi-arabic-arabic-700-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Noto Kufi Arabic"; font-weight: 800; src: url(fonts/noto-kufi-arabic-arabic-800-normal.woff2) format("woff2"); font-display: swap; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--body); }
a { color: var(--link); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0 0 10px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 14px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; margin: 8px 0; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 720px; }
.muted { color: var(--muted); }
.lead { color: var(--ink-2); font-size: 16px; margin: 6px 0 0; }
.small { font-size: 13px; }
.num-big { font-family: var(--display); font-weight: 800; letter-spacing: -0.02em; }
.mt { margin-top: 16px; }
.center { text-align: center; }

/* Top bar */
.top { background: var(--brand); color: #FFF; position: sticky; top: 0; z-index: 20; }
.top-inner { display: flex; align-items: center; gap: 20px; height: 62px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #FFF; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 18px; white-space: nowrap; }
.brand img { height: 32px; width: auto; max-width: 150px; object-fit: contain; display: block; border-radius: 8px; }
.topnav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { color: rgba(255,255,255,.82); text-decoration: none; font-weight: 500; font-size: 14.5px; padding: 9px 13px; border-radius: 10px; white-space: nowrap; }
.topnav a.on { background: rgba(255,255,255,.16); color: #FFF; font-weight: 600; }
.topnav a:hover { color: #FFF; }
.top-right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: rgba(255,255,255,.85); }
.top-right form { margin: 0; }
.linklike { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; font-weight: 700; font-size: 13px; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.asbar { background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.asbar .wrap { display: flex; gap: 10px; align-items: center; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.asbar form { margin: 0; }
.testbar { background: #7C2D12; color: #FFF; font-size: 12px; text-align: center; padding: 4px; letter-spacing: .04em; }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--radius-s); border: 1px solid transparent; padding: 0 18px; min-height: 46px; font: 600 15px/1.2 var(--body); cursor: pointer; text-decoration: none; white-space: nowrap; color: var(--ink); background: var(--surface); }
.btn.primary { background: var(--brand); color: #FFF; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 38px; padding: 0 13px; font-size: 13.5px; }
.btn.big { min-height: 54px; font-size: 17px; padding: 0 26px; border-radius: 16px; }
.btn.block { width: 100%; }
.btn.danger { background: var(--err); color: #FFF; }
.btn.wa { background: #25D366; color: #073B1E; }
.btn.google { background: #FFF; color: #1F2937; border-color: var(--line-2); }
.btn svg { flex: none; }
.btn[disabled] { opacity: .5; cursor: default; }
.form { display: grid; gap: 16px; margin-top: 16px; }
.form.narrow { max-width: 460px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.form label.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; line-height: 1.4; }
.form label.check input { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=tel], input[type=url], input:not([type]), input[type=file], select, textarea {
  font: 400 16px var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-s); padding: 12px 14px; width: 100%; min-height: 48px;
}
textarea { min-height: 110px; line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 16px; display: grid; gap: 12px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }
.hint { color: var(--muted); font-size: 13px; margin: -4px 0 0; font-weight: 400; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.flash { padding: 12px 16px; border-radius: var(--radius-s); margin: 16px 0; font-size: 14px; font-weight: 500; }
.flash.ok { background: var(--good-soft); color: var(--good); }
.flash.err { background: var(--err-soft); color: var(--err); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.flash.info { background: var(--info-soft); color: var(--info); }
.checks { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; }
.checks .ok { color: var(--good); } .checks .bad { color: var(--err); }

/* Pages */
.hero { padding: 26px 0 6px; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.hero .kicker { font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); margin: 14px 0; }
.panel h2 { margin: 0 0 10px; font-size: 19px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0 0; }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); min-width: 0; }
.kpi span { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi strong { font-family: var(--display); font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.kpi em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.pills { display: flex; gap: 8px; margin: 20px 0 14px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.pills::-webkit-scrollbar { display: none; }
.pills a { flex: none; text-decoration: none; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; padding: 10px 16px; border-radius: 999px; box-shadow: var(--shadow); }
.pills a .n { color: var(--muted); font-weight: 500; margin-inline-start: 4px; }
.pills a.on { background: var(--ink); color: var(--bg); }
.pills a.on .n { color: var(--bg); opacity: .75; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: start; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 600; }
table.list td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.info { background: var(--info-soft); color: var(--info); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty h2 { color: var(--ink); margin-bottom: 6px; }

/* Cards (the inbox, advice) */
.cards { display: grid; gap: 12px; }
.card { background: var(--surface); border-radius: var(--radius); padding: 18px 20px; display: flex; gap: 16px; box-shadow: var(--shadow); }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.card-title { font-family: var(--display); font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -0.01em; line-height: 1.25; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }

/* Sign-in and public pages */
.auth-page { background: var(--bg); min-height: 100vh; display: grid; place-items: start center; padding: 28px 16px 60px; }
.auth-card { background: var(--surface); border-radius: 24px; padding: 32px 30px; box-shadow: var(--shadow); width: 100%; max-width: 440px; }
.auth-card.wide { max-width: 720px; }
.auth-card h1 { font-size: 26px; margin-bottom: 4px; }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-family: var(--display); font-weight: 800; font-size: 19px; color: var(--ink); text-decoration: none; }
.auth-logo .mark { width: 36px; height: 36px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; color: #FFF; font-size: 16px; }
.auth-foot { margin-top: 20px; font-size: 13px; color: var(--muted); text-align: center; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 6px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.lang-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.lang-row a { font-size: 12.5px; color: var(--muted); text-decoration: none; padding: 4px 8px; border-radius: 8px; }
.lang-row a.on { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.code-input { font-family: var(--display); font-size: 28px !important; letter-spacing: .3em; text-align: center; font-weight: 700; }

/* Choice cards (the client's form and the alta): big tappable tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tiles.two { grid-template-columns: 1fr 1fr; }
.tile { display: grid; gap: 4px; align-content: center; text-align: center; padding: 18px 12px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; font: 600 15px var(--body); color: var(--ink); min-height: 86px; }
.tile .ic { font-size: 26px; line-height: 1; }
.tile small { font-weight: 500; color: var(--muted); font-size: 12.5px; }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile:has(input:checked), .tile.on { border-color: var(--accent); background: var(--info-soft); }
.step-bar { display: flex; gap: 4px; margin: 0 0 20px; }
.step-bar i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.step-bar i.on { background: var(--accent); }

/* Phone frame for previews */
.phone { width: 300px; height: 600px; border-radius: 36px; border: 10px solid var(--ink); background: var(--bg); overflow: hidden; margin: 0 auto; box-shadow: var(--shadow); }
.phone iframe { width: 100%; height: 100%; border: 0; }

/* Admin nav */
.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin: 10px 0 0; }
.subnav a { text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 10px; }
.subnav a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* Responsive */
@media (max-width: 860px) {
  h1 { font-size: 26px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .form .two { grid-template-columns: 1fr; }
  .topnav { display: none; }
  .wrap { padding: 0 16px; }
  .panel { padding: 18px; border-radius: 16px; }
  .card { padding: 16px; border-radius: 16px; }
}
/* Bottom tab bar on phones (the agent lives in the phone) */
.tabbar { display: none; }
@media (max-width: 860px) {
  body.has-tabbar { padding-bottom: 72px; }
  .tabbar { display: flex; position: fixed; bottom: 0; inset-inline: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 30; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; display: grid; justify-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; padding: 4px 0; }
  .tabbar a.on { color: var(--accent); }
  .tabbar a svg { width: 24px; height: 24px; }
}
@media print { .top, .tabbar, .asbar, .testbar, .btn { display: none !important; } body { background: #FFF; } .panel, .card { box-shadow: none; border: 1px solid #DDD; } }

/* Inline code / copyable addresses */
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; background: var(--surface-2); padding: 8px 12px; border-radius: 10px; color: var(--ink); }
.prose h3 { margin: 18px 0 6px; font-size: 16px; }
.prose p { color: var(--ink-2); margin: 0 0 10px; line-height: 1.6; }
.kicker { font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
