/* Noor look: white and warm-grey surfaces, slate ink, Noor red accent, Cormorant Garamond headings. */
:root {
  --bg: #f6f5f2; --panel: #ffffff; --ink: #313d41; --muted: #6b7478; --line: #e3e2dd;
  --slate: #313d41; --slate-2: #46555a; --red: #a3242a; --red-soft: #f6e7e7; --mist: #e0e2ed;
  --accent: #313d41; --accent-ink: #ffffff; --green: #2f7d4f; --amber: #b07a1e;
  --soft: #f0efeb; --shadow: 0 1px 2px rgba(49,61,65,.05), 0 8px 24px rgba(49,61,65,.07);
  --radius: 14px; font-size: 16px;
  --serif: "Cormorant Garamond", "Garamond", "Times New Roman", serif;
  --sans: "Lato", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.5; }
h1, h2, h3, .serif { font-family: var(--serif); font-weight: 600; letter-spacing: .005em; }
[dir="rtl"] { direction: rtl; }
.hidden { display: none !important; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 12px; top: 12px; z-index: 99; background: var(--panel); padding: 8px; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.muted { color: var(--muted); }
.btn { background: var(--slate); color: #fff; border: 0; border-radius: 999px; padding: 10px 20px; font-weight: 700; letter-spacing: .02em; transition: background .15s; }
.btn:hover { background: var(--slate-2); }
.btn.secondary { background: var(--soft); color: var(--ink); }
.btn-xl { padding: 16px 34px; font-size: 1.15rem; }
.btn-round { width: 54px; height: 54px; border-radius: 50%; padding: 0; font-size: 1.35rem; }
.btn-round[aria-pressed="false"] { background: var(--soft); color: var(--muted); }
.link { background: none; border: 0; color: var(--red); text-decoration: underline; padding: 4px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; }
textarea { border-radius: 12px; }
.stack { display: grid; gap: 12px; }
.logo { height: 34px; width: auto; display: block; }
.logo.lg { height: 46px; margin: 0 auto 6px; }

/* non-blocking hint (replaces pop-up windows) */
.hint { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--slate); color: #fff; padding: 12px 20px; border-radius: 999px; z-index: 60; box-shadow: var(--shadow); font-size: .95rem; }
.overlay { position: fixed; inset: 0; background: rgba(49,61,65,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.overlay-card { background: var(--panel); border-radius: 18px; padding: 32px; max-width: 640px; max-height: 80vh; overflow: auto; text-align: left; box-shadow: var(--shadow); white-space: pre-wrap; }
.overlay-card h1 { margin-top: 0; font-size: 1.6rem; }

/* sign-in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(180deg, #fff 0%, var(--bg) 55%, var(--mist) 100%); }
.signin-card { background: var(--panel); border-radius: 22px; padding: 36px 32px; width: min(440px, 100%); text-align: center; box-shadow: var(--shadow); border-top: 4px solid var(--red); }
.signin-card h1 { font-size: 2rem; margin: 6px 0 4px; }
.brand { font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.otp { position: relative; margin: 18px auto 8px; width: 300px; max-width: 100%; }
.otp input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
.otp-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp-boxes span { height: 54px; border: 2px solid var(--line); border-radius: 12px; display: grid; place-items: center; font-size: 1.6rem; font-weight: 700; font-family: var(--sans); }
.otp-boxes span.filled { border-color: var(--slate); background: var(--soft); }
.signin-card details { margin-top: 10px; color: var(--muted); font-size: .9rem; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 240px; margin: 12px auto; }
.keypad button { padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--soft); color: var(--ink); font-size: 1.2rem; }
.keypad .ok { background: var(--slate); color: #fff; }
.heard { min-height: 1.4em; color: var(--muted); font-size: .9rem; }

/* Cindy's orb */
.orb { width: 76px; height: 76px; margin: 18px auto; border-radius: 50%; background: radial-gradient(circle at 32% 30%, #6d7f85, var(--slate) 62%, #1f2729); display: grid; place-items: center; transition: transform .15s; box-shadow: 0 6px 18px rgba(49,61,65,.25); }
.orb.big { width: 104px; height: 104px; }
.orb span { width: 34%; height: 34%; border-radius: 50%; background: var(--red); opacity: .9; }
.orb.listening { animation: pulse 1.8s ease-in-out infinite; }
.orb.speaking span { animation: talk .45s ease-in-out infinite alternate; }
.orb.paused { filter: grayscale(1); opacity: .55; }
@keyframes pulse { 50% { box-shadow: 0 0 0 16px rgba(163,36,42,.10), 0 6px 18px rgba(49,61,65,.25); } }
@keyframes talk { from { transform: scale(.85); } to { transform: scale(1.35); } }

/* app shell */
.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 28px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand-btn { background: none; border: 0; padding: 0; display: flex; align-items: center; gap: 14px; color: var(--ink); }
.brand-btn .product { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; border-left: 1px solid var(--line); padding-left: 14px; }
.status-pill { display: flex; align-items: center; gap: 8px; background: var(--soft); border-radius: 999px; padding: 4px 12px; font-size: .82rem; }
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-pill.live .dot { background: var(--green); } .status-pill.paused .dot { background: var(--amber); }
.top-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.icon-btn { background: none; border: 0; border-radius: 999px; padding: 8px 14px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 1.1rem; font-weight: 600; }
.icon-btn:hover { background: var(--soft); }
.viewas { background: var(--amber); color: #fff; border-radius: 999px; padding: 4px 12px; font-size: .85rem; }
.main { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 24px; padding: 24px 28px; max-width: 1440px; margin: 0 auto; }
@media (max-width: 980px) { .main { grid-template-columns: 1fr; padding: 16px; } .side { order: -1; } .topbar { padding: 10px 16px; } .brand-btn .product { display: none; } }
.view { min-height: 60vh; }
.side { display: grid; gap: 16px; align-content: start; position: sticky; top: 84px; }
@media (max-width: 980px) { .side { position: static; } }
.agent, .transcript, .sources, .card { background: var(--panel); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.agent { text-align: center; border-top: 4px solid var(--red); }
.agent-name { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; margin: 0; }
.agent-role { color: var(--muted); font-size: .85rem; margin: 0 0 4px; }
.caption { min-height: 3em; font-family: var(--serif); font-size: 1.2rem; line-height: 1.35; margin-top: 4px; }
.interim { min-height: 1.3em; color: var(--muted); font-style: italic; font-size: .9rem; }
.mic-row { display: flex; gap: 10px; justify-content: center; align-items: center; margin: 10px 0 14px; }
.text-form { display: flex; gap: 8px; } .text-form input { flex: 1; min-width: 0; }
.transcript { max-height: 340px; overflow: auto; font-size: .92rem; display: flex; flex-direction: column; gap: 8px; }
.transcript:empty { display: none; }
.transcript .u { align-self: flex-end; background: var(--soft); border-radius: 14px 14px 4px 14px; padding: 8px 12px; max-width: 88%; }
.transcript .a { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 4px 14px 14px 14px; padding: 8px 12px; max-width: 92%; }
.sources:empty { display: none; }
.sources h3, .card h3 { margin: 0 0 8px; font-size: 1.2rem; }
.sources ol { padding-left: 20px; margin: 0; font-size: .88rem; } .sources li { margin-bottom: 6px; }
.sources a { color: var(--red); }
.notice { font-size: .78rem; color: var(--muted); text-align: center; margin: 4px 8px 0; }

/* home */
.hero { background: linear-gradient(120deg, var(--slate) 0%, #3f4d52 60%, #56656a 100%); color: #fff; border-radius: 18px; padding: 34px 34px 30px; margin-bottom: 22px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(163,36,42,.28); }
.hero h1 { font-size: 2.4rem; margin: 0 0 6px; color: #fff; position: relative; }
.hero p { margin: 0; opacity: .88; font-size: 1.05rem; max-width: 640px; position: relative; }
.hero .try { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; position: relative; }
.hero .try span { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); border-radius: 999px; padding: 6px 14px; font-size: .9rem; }
.section-title { font-size: 1.5rem; margin: 6px 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.module-card { position: relative; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); color: var(--ink); transition: transform .15s, box-shadow .15s; }
.module-card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(49,61,65,.12); }
.module-card .icon { font-size: 1.7rem; } .module-card h2 { font-size: 1.4rem; margin: 8px 0 4px; } .module-card p { color: var(--muted); margin: 0; font-size: .92rem; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .76rem; font-weight: 700; background: var(--soft); text-transform: uppercase; letter-spacing: .04em; }
.badge.new { background: var(--red); color: #fff; }
.badge.green { background: #e1f1e7; color: var(--green); } .badge.amber { background: #f8eed8; color: var(--amber); } .badge.red { background: var(--red-soft); color: var(--red); }
.hl { outline: 3px solid var(--red); outline-offset: 3px; }
.num { position: absolute; top: -10px; left: -10px; background: var(--slate); color: #fff; border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; font-size: .8rem; font-weight: 700; z-index: 3; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; } .page-head h1 { margin: 0; font-size: 2rem; }
.page-head .icon-btn { font-family: var(--sans); font-size: .9rem; background: var(--soft); }
.return-note { margin-left: auto; font-size: .82rem; color: var(--muted); }
.cards { display: grid; gap: 16px; }
.brief { border-top: 4px solid var(--slate); }
.brief-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.brief dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; margin: 12px 0 0; } .brief dt { color: var(--muted); } .brief dd { margin: 0; white-space: pre-wrap; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; } th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; } th { color: var(--muted); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.bar { height: 8px; background: var(--soft); border-radius: 6px; overflow: hidden; min-width: 80px; } .bar i { display: block; height: 100%; background: var(--slate); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--soft); border-radius: 12px; padding: 12px; } .stat b { display: block; font-size: 1.7rem; font-family: var(--serif); } .stat span { color: var(--muted); font-size: .82rem; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: var(--panel); color: var(--ink); text-align: left; width: 100%; }
.option.chosen { border-color: var(--slate); background: var(--soft); }
.option .n { font-weight: 700; color: var(--red); min-width: 22px; }
.question { margin-bottom: 18px; } .question h3 { margin: 0 0 8px; }
.empty { color: var(--muted); padding: 20px; text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; } .chip { background: var(--soft); border: 0; border-radius: 999px; padding: 6px 12px; color: var(--ink); font-size: .88rem; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--slate); color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 60; }
.done-mark { width: 56px; height: 56px; margin: 8px auto 4px; border-radius: 50%; background: var(--soft); color: var(--green); display: grid; place-items: center; font-size: 1.8rem; font-weight: 700; }
#relink-done p { margin: 8px 0; }
.small-print { font-size: .88rem; margin-bottom: 18px !important; }

/* ---------- Responsive: phones and tablets (desktop layout above is unchanged) ---------- */
img, video { max-width: 100%; }
.card, .transcript, .sources { min-width: 0; }
.card { overflow-x: auto; -webkit-overflow-scrolling: touch; }   /* wide tables scroll inside their card instead of cutting the page */
.view, .main > * { min-width: 0; }
.signin { min-height: 100dvh; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.hint, .toast { bottom: calc(22px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); text-align: center; }

/* Tablets (iPad portrait and landscape) */
@media (max-width: 1180px) and (min-width: 981px) {
  .main { grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; padding: 18px; }
}
@media (max-width: 980px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .hero { padding: 26px 22px; }
  .hero h1 { font-size: 2rem; }
}

/* Phones */
@media (max-width: 640px) {
  html { -webkit-text-size-adjust: 100%; }
  input, select, textarea { font-size: 16px; }                    /* stops iPhone zooming into fields */
  .topbar { padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
  .logo { height: 26px; }
  .status-pill { padding: 3px 9px; font-size: .75rem; }
  .top-actions { gap: 2px; }
  .icon-btn { padding: 6px 9px; font-size: 1rem; }
  #numbers-btn { display: none; }                                  /* "show numbers" still works by voice */
  .main { padding: 12px; gap: 12px; }
  .agent { padding: 14px; }
  .orb.big { width: 72px; height: 72px; margin: 8px auto; }
  .agent-name { font-size: 1.3rem; }
  .caption { font-size: 1.08rem; min-height: 2.4em; }
  .mic-row { margin: 6px 0 10px; }
  .transcript { max-height: 220px; }
  .hero { padding: 20px 18px; border-radius: 14px; margin-bottom: 16px; }
  .hero h1 { font-size: 1.65rem; }
  .hero p { font-size: .98rem; }
  .hero::after { width: 150px; height: 150px; right: -50px; top: -50px; }
  .hero .try span { font-size: .84rem; padding: 5px 11px; }
  .section-title { font-size: 1.3rem; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .module-card { padding: 16px; }
  .page-head { flex-wrap: wrap; gap: 8px; }
  .page-head h1 { font-size: 1.5rem; }
  .card { padding: 14px; }
  .brief dl { grid-template-columns: 1fr; gap: 2px; }
  .brief dt { margin-top: 8px; font-weight: 700; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  table { font-size: .84rem; }
  th, td { padding: 6px; }
  .option { padding: 10px; }
  .signin-card { padding: 26px 18px; border-radius: 18px; }
  .signin-card h1 { font-size: 1.7rem; }
  .logo.lg { height: 38px; }
  .otp-boxes span { height: 46px; font-size: 1.4rem; }
  .overlay-card { padding: 20px; }
}
@media (max-width: 380px) {
  .otp-boxes { gap: 5px; }
  .status-pill #status-text { display: none; }
}
.card, .hero, .page-head { scroll-margin-top: 76px; }

/* ---------- Focus mode: chat panel hidden, content full width, Cindy as a small floating card ---------- */
.agent { position: relative; }
.focus-btn { position: absolute; top: 10px; right: 10px; font-family: var(--sans); font-size: .8rem; font-weight: 700; padding: 5px 11px; background: var(--soft); }
body.focus-mode .main { grid-template-columns: minmax(0, 1fr); padding-bottom: 130px; }
body.focus-mode .side { position: fixed; top: auto; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 320px; z-index: 30; display: block; }
body.focus-mode .side > :not(.agent) { display: none !important; }
body.focus-mode .agent { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; grid-template-areas: "orb name btn" "orb cap mic"; align-items: center; gap: 2px 10px; padding: 10px 12px; text-align: left; box-shadow: 0 12px 32px rgba(49,61,65,.28); }
body.focus-mode .agent .orb.big { grid-area: orb; width: 46px; height: 46px; margin: 0; }
body.focus-mode .agent-name { grid-area: name; font-size: 1.05rem; }
body.focus-mode .caption { grid-area: cap; min-height: 0; font-size: .92rem; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
body.focus-mode .focus-btn { grid-area: btn; position: static; }
body.focus-mode .mic-row { grid-area: mic; margin: 0; }
body.focus-mode .mic-row .btn-round { width: 36px; height: 36px; font-size: 1rem; }
body.focus-mode .agent-role, body.focus-mode .interim, body.focus-mode .text-form { display: none; }
@media (max-width: 640px) {
  body.focus-mode .side { left: 12px; right: 12px; width: auto; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .focus-btn { top: 8px; right: 8px; }
}
