/* Nova — Vodafone-inspired visual identity: red #E60000, charcoal greys, white space, rounded shapes. */
:root {
  --red: #e60000; --red-dark: #bd0000; --red-soft: #fdeaea;
  --charcoal: #25282b; --grey-700: #4a4d4e; --grey-500: #7e7e7e; --grey-300: #bebebe; --grey-100: #f2f2f2;
  --aqua: #00b0ca; --aubergine: #9c2aa0; --spring: #a8b400; --lemon: #fecb00;
  --bg: #f4f4f4; --surface: #ffffff; --surface-2: #f2f2f2; --text: #25282b; --muted: #6a6d70; --border: #e2e2e2;
  --ok: #008a00; --ok-soft: #e6f4e6; --warn: #8a5a00; --warn-soft: #fff5d6; --err: #bd0000;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 20px rgba(0,0,0,.07);
  --radius: 14px;
  --font: "Rubik", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-ar: "Noto Kufi Arabic", "Rubik", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121314; --surface: #1c1e20; --surface-2: #26292c; --text: #f2f2f2; --muted: #a3a6a8; --border: #33373a;
    --red-soft: #3a1414; --ok-soft: #10301a; --warn-soft: #33290d; --ok: #4fce4f; --err: #ff7a7a; --warn: #f5c451;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
html[lang="ar"] body { font-family: var(--font-ar); font-size: 15px; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
a { color: var(--red); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.error { color: var(--err); margin: 8px 0 0; font-size: 14px; font-weight: 500; }

/* Brand */
.speechmark { width: 30px; height: 30px; border-radius: 50%; background: var(--red) url("favicon.svg") center/cover; flex: none; box-shadow: 0 2px 8px rgba(230,0,0,.35); }
.speechmark.big { width: 56px; height: 56px; box-shadow: 0 0 0 6px rgba(255,255,255,.18); }
.wordmark { font-weight: 800; letter-spacing: -.02em; }

.btn { border: 1.5px solid var(--border); background: var(--surface); padding: 8px 16px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: var(--grey-500); } .btn:active { transform: translateY(1px); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
.btn.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.toggle[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.badge { background: var(--red); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 6px; min-width: 18px; text-align: center; }

.lang-switch { display: inline-flex; border: 1.5px solid var(--border); border-radius: 999px; padding: 2px; background: var(--surface-2); }
.lang-switch button { border: 0; background: none; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--muted); }
.lang-switch button.active { background: var(--red); color: #fff; }
.lang-switch.compact button { padding: 3px 9px; font-size: 12px; }

/* Login: red hero + card */
.login { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { background: radial-gradient(120% 90% at 0% 0%, #ff2a2a 0%, var(--red) 45%, #a80000 100%); color: #fff; display: grid; place-items: center; padding: 48px 32px; position: relative; overflow: hidden; }
.login-hero::after { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 70px solid rgba(255,255,255,.07); inset-inline-end: -180px; bottom: -200px; }
.hero-inner { max-width: 480px; position: relative; z-index: 1; }
.logo-row { display: flex; align-items: center; gap: 12px; font-size: 30px; margin-bottom: 28px; }
.login-hero h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.1; margin: 0 0 14px; letter-spacing: -.03em; font-weight: 800; }
.login-hero p { font-size: 17px; opacity: .92; margin: 0 0 20px; }
.hero-points { list-style: none; padding: 0; margin: 0 0 28px; display: grid; gap: 10px; }
.hero-points li { padding-inline-start: 28px; position: relative; font-weight: 500; }
.hero-points li::before { content: "✓"; position: absolute; inset-inline-start: 0; width: 20px; height: 20px; border-radius: 50%; background: #fff; color: var(--red); font-size: 12px; font-weight: 800; display: grid; place-items: center; top: 2px; }
.hero-links { display: flex; gap: 18px; flex-wrap: wrap; }
.hero-links a { color: #fff; font-weight: 700; text-decoration: none; border-bottom: 2px solid rgba(255,255,255,.5); padding-bottom: 2px; }
.login-side { display: grid; place-items: center; padding: 32px 16px; }
.login-card { width: min(440px, 100%); background: var(--surface); border-radius: 22px; padding: 30px 28px; box-shadow: var(--shadow); position: relative; }
.login-card .lang-switch { position: absolute; top: 18px; inset-inline-end: 18px; }
.login-card h2 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.login-card form { margin-top: 20px; }
.login-card label { font-weight: 700; font-size: 13px; display: block; margin-bottom: 6px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface-2); text-transform: uppercase; letter-spacing: .05em; font-weight: 500; }
.row input:focus, .composer input:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.samples { margin-top: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { border: 1.5px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 500; }
.chip:hover { border-color: var(--red); color: var(--red); }
.chip small { color: var(--muted); margin-inline-start: 4px; font-weight: 400; }

/* App shell */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 16px; background: var(--surface); border-bottom: 3px solid var(--red); }
.brand { display: flex; align-items: center; gap: 9px; font-size: 19px; color: var(--text); text-decoration: none; }
.brand .tag { font-weight: 500; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.customer-chip { display: flex; flex-direction: column; align-items: flex-end; border: 0; background: var(--charcoal); color: #fff; border-radius: 12px; padding: 4px 12px; line-height: 1.2; font-size: 13px; font-weight: 700; }
.customer-chip .muted { font-size: 11px; font-weight: 500; color: var(--grey-300); }
.only-mobile { display: none; position: relative; }
.only-mobile .badge { position: absolute; top: -4px; inset-inline-end: -4px; }
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; }

/* Chat */
.chat { display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 22px max(16px, calc((100% - 780px) / 2)); display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 88%; min-width: 0; }
.msg.user { align-self: flex-end; }
.msg.user .bubble { background: var(--charcoal); color: #fff; border-end-end-radius: 4px; }
.msg.assistant { display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 8px; }
.msg.assistant::before { content: ""; width: 30px; height: 30px; border-radius: 50%; background: var(--red) url("favicon.svg") center/cover; grid-row: 1; }
.msg.assistant > * { grid-column: 2; }
.msg.assistant .bubble { background: var(--surface); border-end-start-radius: 4px; box-shadow: var(--shadow); }
.msg.event { align-self: center; max-width: 100%; }
.bubble { padding: 11px 15px; border-radius: 18px; overflow-wrap: anywhere; }
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin: 0; }
.bubble ol, .bubble ul { margin: 4px 0 8px; padding-inline-start: 22px; }
.bubble li { margin: 3px 0; }
.ptag { font-weight: 700; color: var(--red); background: var(--red-soft); border-radius: 6px; padding: 0 5px; white-space: nowrap; cursor: pointer; unicode-bidi: isolate; }
.msg-meta { display: flex; gap: 10px; align-items: center; margin-top: 4px; font-size: 12px; color: var(--muted); }
.msg.user .msg-meta { justify-content: flex-end; }
.speak { border: 0; background: none; padding: 0; color: var(--muted); display: inline-flex; }
.speak svg { width: 15px; height: 15px; }
details.steps { font-size: 12px; color: var(--muted); }
details.steps summary { cursor: pointer; list-style: none; }
details.steps summary::-webkit-details-marker { display: none; }
details.steps ul { margin: 4px 0 0; padding-inline-start: 16px; direction: ltr; text-align: start; }
.step-ok { color: var(--ok); } .step-err { color: var(--err); }
.event-pill { font-size: 12px; padding: 4px 12px; border-radius: 999px; background: var(--surface); color: var(--muted); border: 1.5px dashed var(--border); }
.cards-row { display: flex; gap: 10px; overflow-x: auto; padding: 10px 2px 6px; scroll-snap-type: x mandatory; }
.cards-row .pcard { flex: 0 0 214px; scroll-snap-align: start; }

.pcard { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 4px; transition: border-color .15s, box-shadow .15s; }
.pcard:hover { border-color: var(--red); box-shadow: var(--shadow); }
.pcard.dim { opacity: .5; }
.pcard-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.pcard .cat { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.pcard .disc { font-size: 11px; font-weight: 800; color: #fff; background: var(--red); border-radius: 6px; padding: 1px 7px; }
.pcard h4 { margin: 0; font-size: 15px; }
.pcard .meta { font-size: 12px; color: var(--muted); }
.stars { color: var(--lemon); letter-spacing: 1px; }
.pcard .why { margin: 2px 0; }
.price-row { display: flex; gap: 8px; align-items: baseline; margin-top: auto; }
.price { font-weight: 800; font-size: 18px; } .list { color: var(--muted); font-size: 13px; }
.pcard .actions { display: flex; gap: 6px; margin-top: 6px; }
.pill { display: inline-block; font-size: 11px; border-radius: 6px; padding: 1px 6px; background: var(--warn-soft); color: var(--warn); font-weight: 500; }

.checkout, .order { background: var(--surface); border: 2px solid var(--charcoal); border-radius: var(--radius); padding: 14px 16px; margin-top: 10px; }
.checkout h4, .order h4 { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.lines { width: 100%; border-collapse: collapse; font-size: 14px; }
.lines td { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.lines td:last-child { text-align: end; white-space: nowrap; }
.lines tr.total td { border: 0; font-weight: 800; padding-top: 8px; font-size: 16px; }
.checkout .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.checkout.resolved { border-color: var(--border); }
.checkout.resolved .actions { display: none; }
.order { border-color: var(--ok); background: var(--ok-soft); }
.note { font-size: 12px; color: var(--muted); margin-top: 8px; }

.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; padding: 4px max(16px, calc((100% - 780px) / 2)); }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.quick { padding: 0 max(16px, calc((100% - 780px) / 2)); margin: 0 0 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.quick .chip { white-space: nowrap; flex: none; }
.composer { display: flex; gap: 8px; align-items: center; padding: 10px max(16px, calc((100% - 780px) / 2)) max(14px, env(safe-area-inset-bottom)); }
.composer input { flex: 1; min-width: 0; padding: 13px 18px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.mic, .send { width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--surface); display: grid; place-items: center; flex: none; box-shadow: var(--shadow); }
.send { background: var(--red); border-color: var(--red); color: #fff; }
.send:hover { background: var(--red-dark); }
html[dir="rtl"] .send svg { transform: scaleX(-1); }
.mic.listening { background: var(--red); color: #fff; border-color: var(--red); animation: ring 1.4s infinite; }
.mic:disabled { opacity: .35; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(230,0,0,.45); } 100% { box-shadow: 0 0 0 14px rgba(230,0,0,0); } }

details.archived { align-self: stretch; background: var(--surface); border: 1.5px dashed var(--border); border-radius: 14px; padding: 8px 14px; }
details.archived summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); }
.arch-item { border-top: 1px solid var(--border); padding: 8px 0; display: grid; gap: 4px; justify-items: start; }
.arch-log { width: 100%; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; display: grid; gap: 6px; font-size: 13px; opacity: .85; }
.arch-msg.user { font-weight: 600; } .arch-msg p { margin: 0; } .arch-msg .ptag { font-size: 12px; }

.suggested { margin-top: 6px; }
.suggested-title { font-size: 12px; font-weight: 800; color: var(--red); text-transform: uppercase; letter-spacing: .06em; }

/* Side panel */
.panel { border-inline-start: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; gap: 2px; padding: 8px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 7px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; display: inline-flex; gap: 5px; align-items: center; }
.tabs button.active { background: var(--charcoal); color: #fff; }
.tab-body { flex: 1; overflow-y: auto; padding: 14px; }
.card-list { display: grid; gap: 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; margin: 0 0 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--red); margin: 16px 0 6px; font-weight: 800; }
.bars { display: grid; gap: 6px; font-size: 13px; }
.bar { display: grid; grid-template-columns: 70px 1fr 34px; align-items: center; gap: 8px; }
.bar span.track { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar span.fill { display: block; height: 100%; background: var(--red); border-radius: 99px; }
.tagcloud { display: flex; flex-wrap: wrap; gap: 5px; }
.tagcloud span { font-size: 12px; background: var(--surface-2); border-radius: 6px; padding: 2px 8px; }
.tagcloud span.neg { background: var(--red-soft); color: var(--red); text-decoration: line-through; }
.basket-line { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.basket-line .qty { color: var(--muted); font-size: 12px; }
.basket-total { display: flex; justify-content: space-between; font-weight: 800; padding: 12px 0; font-size: 16px; }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 24px 8px; }

/* Test lab */
.testlab { position: fixed; inset-block: 64px 12px; inset-inline-end: 12px; width: min(400px, calc(100% - 24px)); background: var(--surface); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.25); border-top: 4px solid var(--red); padding: 14px 16px; overflow-y: auto; z-index: 20; }
.testlab-head { display: flex; justify-content: space-between; align-items: center; }
.tl-group { margin: 14px 0 4px; font-size: 12px; font-weight: 800; color: var(--red); text-transform: uppercase; letter-spacing: .06em; }
.tl-step { display: block; width: 100%; text-align: start; border: 1.5px solid var(--border); background: var(--surface); border-radius: 12px; padding: 8px 10px; margin: 6px 0; }
.tl-step:hover { border-color: var(--red); }
.tl-step b { display: block; font-size: 13px; }
.tl-step span { display: block; font-size: 12px; color: var(--muted); }
.tl-step.done { border-color: var(--ok); background: var(--ok-soft); }

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 32px 20px; }
  .hero-points, .login-hero p { display: none; }
  .logo-row { margin-bottom: 12px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .panel { position: fixed; inset-block: 58px 0; inset-inline-end: 0; width: min(400px, 100%); transform: translateX(105%); transition: transform .2s; z-index: 10; box-shadow: var(--shadow); }
  html[dir="rtl"] .panel { transform: translateX(-105%); }
  .panel.open, html[dir="rtl"] .panel.open { transform: none; }
  .only-mobile { display: inline-flex; }
  .brand .tag, #voice-mode span, #testlab-btn span, #new-chat { display: none; }
  .msg { max-width: 96%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 520px) {
  .topbar { padding: 8px 10px; gap: 6px; }
  .brand .wordmark { display: none; }
  .top-actions { gap: 4px; }
  .top-actions .btn { padding: 7px 9px; }
  .customer-chip { padding: 3px 8px; font-size: 12px; }
  .lang-switch.compact button { padding: 3px 7px; }
}
