/* Techro tokens (Techro Brand Book v1.0): dark is the default, light follows the device,
   and data-theme="light" / "dark" on <html> overrides it. */
:root {
  --bg: #0B0E11; --surface: #12171B; --surface-2: #182026; --line: #233038; --line-2: #2C3B44;
  --text: #E9F1EF; --muted: #8FA3A0; --mint: #03FBC8; --mint-2: #00D4AA; --mint-ink: #03FBC8; --on-mint: #0B0E11;
  --danger: #FF6B6B; --warn: #F5A524;
  /* Tints of the brand colours for soft backgrounds (badges, banners). */
  --mint-soft: rgba(3, 251, 200, .10); --warn-soft: rgba(245, 165, 36, .12); --danger-soft: rgba(255, 107, 107, .12);
  --radius: 14px; --font: Heebo, system-ui, -apple-system, "Segoe UI", "Noto Sans Arabic", sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F4F7F6; --surface: #FFFFFF; --surface-2: #EEF3F2; --line: #DCE5E3; --line-2: #C9D6D3;
    --text: #0B0E11; --muted: #5D6B66; --mint-ink: #00A383; --danger: #D93838; --warn: #B7791F;
    --mint-soft: rgba(0, 163, 131, .10); --warn-soft: rgba(183, 121, 31, .10); --danger-soft: rgba(217, 56, 56, .08);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #F4F7F6; --surface: #FFFFFF; --surface-2: #EEF3F2; --line: #DCE5E3; --line-2: #C9D6D3;
  --text: #0B0E11; --muted: #5D6B66; --mint-ink: #00A383; --danger: #D93838; --warn: #B7791F;
  --mint-soft: rgba(0, 163, 131, .10); --warn-soft: rgba(183, 121, 31, .10); --danger-soft: rgba(217, 56, 56, .08);
  color-scheme: light;
}
/* Older names used across this stylesheet, mapped onto the brand tokens. */
:root { --border: var(--line); --faint: var(--muted); --accent: var(--mint); --accent-dark: var(--mint-ink); --accent-soft: var(--mint-soft); }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--mint-ink); }
h1 { font-size: 26px; margin: 0 0 8px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 19px; margin: 28px 0 8px; font-weight: 700; }
h3 { font-size: 16px; margin: 18px 0 6px; font-weight: 700; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
table, .num { font-variant-numeric: tabular-nums; }

/* Product wordmark: Techro-prefixed name, two-tone, Heebo 800, always left-to-right. */
.wordmark { font-weight: 800; letter-spacing: -.03em; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.wordmark span { color: var(--mint-ink); }

/* Top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); height: 60px; display: flex; align-items: center; padding: 0 20px; gap: 24px; position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-size: 20px; line-height: 1; }
.brand-icon { width: 32px; height: 32px; flex: none; display: block; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 7px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--mint-soft); color: var(--mint-ink); font-weight: 600; }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.theme-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; flex: none; }
.theme-btn:hover { background: var(--surface-2); color: var(--text); }
.theme-btn svg { width: 18px; height: 18px; }

/* Layout */
.page { max-width: 1040px; margin: 0 auto; padding: 32px 20px 64px; }
.narrow { max-width: 760px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 12px; align-items: center; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

/* Buttons & forms (inputs and buttons 10px, focus = 2px mint-2 outline) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--line-2); background: var(--surface-2); }
.btn-primary, .btn-fb { background: var(--mint); border-color: var(--mint); color: var(--on-mint); font-weight: 700; }
.btn-primary:hover, .btn-fb:hover { background: var(--mint-2); border-color: var(--mint-2); }
.btn-fb { padding: 12px 22px; font-size: 16px; }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 14px; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; margin: 2px 0 6px; }
input[type=text], input[type=email], input[type=number], select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--surface-2); color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--mint-2); outline-offset: 0; border-color: transparent; }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--mint-2); outline-offset: 2px; }
.field { margin-bottom: 16px; }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.switch input { width: 18px; height: 18px; accent-color: var(--mint-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--mint-2); }

/* Notices */
.notice { padding: 12px 14px; border-radius: 10px; background: var(--mint-soft); color: var(--text); border: 1px solid var(--line); margin-bottom: 16px; }
.notice.warn { background: var(--warn-soft); color: var(--text); border-color: transparent; }
.notice.error { background: var(--danger-soft); color: var(--text); border-color: transparent; }
.notice.warn::before, .notice.error::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; background: var(--warn); }
.notice.error::before { background: var(--danger); }

/* Badges (pills 999px). Platform badges stay neutral: no second brand colour. */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.fb, .badge.ig { color: var(--text); }
.badge.ok { background: var(--mint-soft); color: var(--mint-ink); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* The octopus (mascot): sign-in, empty states, loaders, 404. Never smaller than 48px. */
.octo { display: block; margin: 0 auto; height: auto; }
.octo-hero { width: 168px; }
.octo-empty { width: 96px; margin-bottom: 8px; }
.octo-loader { width: 64px; margin-bottom: 6px; animation: octo-bob 1.6s ease-in-out infinite; }
@keyframes octo-bob { 50% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .octo-loader { animation: none; } }

/* Landing */
.hero { max-width: 760px; margin: 0 auto; padding: 48px 20px 40px; text-align: center; }
.hero .octo-hero { margin-bottom: 8px; filter: drop-shadow(0 18px 40px rgba(3, 251, 200, .12)); }
.hero h1 { font-size: 44px; line-height: 1.12; letter-spacing: -.02em; margin-bottom: 16px; }
.hero p.lead { font-size: 18px; color: var(--muted); margin-bottom: 28px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--mint-ink); margin-bottom: 10px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 960px; margin: 24px auto 0; padding: 0 20px; }
.steps .card h3 { margin-top: 0; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--mint-soft); color: var(--mint-ink); display: grid; place-items: center; font-weight: 700; margin-bottom: 10px; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } .hero h1 { font-size: 32px; } }

/* Connect */
.page-list { list-style: none; padding: 0; margin: 0; }
.page-item { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; cursor: pointer; }
.page-item:hover { border-color: var(--mint-2); }
.page-item input { width: 20px; height: 20px; accent-color: var(--mint-2); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); object-fit: cover; flex: none; display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; }

/* Inbox */
.inbox { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 60px); }
.inbox > * { min-width: 0; }
.inbox-side { border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.inbox-filters { padding: 12px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.tabs { display: flex; gap: 4px; }
.tabs button { flex: 1; padding: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; font: inherit; font-size: 13px; cursor: pointer; color: var(--muted); }
.tabs button:hover { background: var(--surface-2); color: var(--text); }
.tabs button.active { background: var(--mint); color: var(--on-mint); border-color: var(--mint); font-weight: 700; }
.conv-list { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--mint-soft); box-shadow: inset 3px 0 0 var(--mint-2); }
.conv-main { min-width: 0; flex: 1; }
.conv-top { display: flex; gap: 6px; align-items: center; }
.conv-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.conv-time { font-size: 12px; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.conv-preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-tags { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--mint); flex: none; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); margin-top: 4px; }
.thread { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.thread-head { padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.thread-head .title { font-weight: 700; }
.thread-banner { padding: 10px 18px; font-size: 14px; border-bottom: 1px solid var(--line); }
.thread-banner.ai-on { background: var(--mint-soft); color: var(--text); }
.thread-banner.ai-off { background: var(--warn-soft); color: var(--text); }
.messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 68%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; font-size: 15px; }
.msg.in { background: var(--surface); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.out { background: var(--mint); color: var(--on-mint); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.out.human { background: var(--line-2); color: var(--text); }
.msg.failed { background: var(--danger-soft); color: var(--text); border: 1px solid var(--danger); }
.msg.system { align-self: center; background: transparent; color: var(--muted); font-size: 13px; }
.msg-meta { font-size: 11px; margin-top: 4px; opacity: .72; }
.msg.in .msg-meta { color: var(--muted); opacity: 1; }
.composer { padding: 12px 18px 16px; background: var(--surface); border-top: 1px solid var(--line); }
.composer form { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { min-height: 44px; max-height: 160px; height: 44px; }
.composer .note { font-size: 12px; color: var(--muted); margin-top: 6px; }
@media (max-width: 860px) { .inbox { grid-template-columns: 1fr; } .inbox.has-thread .inbox-side { display: none; } .inbox:not(.has-thread) .thread { display: none; } .msg { max-width: 85%; } }

/* Settings */
.settings-layout { display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start; }
@media (max-width: 980px) { .settings-layout { grid-template-columns: minmax(0, 1fr); } }
.sticky { position: sticky; top: 80px; }
.play-msgs { height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; }
.play-msgs .msg { max-width: 85%; font-size: 14px; }
.action-note { font-size: 12px; align-self: center; background: var(--surface); border: 1px dashed var(--line-2); padding: 4px 8px; border-radius: 10px; color: var(--muted); }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; color: var(--muted); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }

/* Legal pages */
.legal h2 { margin-top: 32px; }
.legal li { margin-bottom: 6px; }
footer.site { text-align: center; padding: 28px 20px; color: var(--muted); font-size: 13px; }
footer.site .credit { display: block; margin-top: 8px; font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; }
footer.site .credit a { margin: 0; color: var(--muted); text-decoration: none; }
footer.site .credit a:hover { color: var(--mint-ink); }
footer.site a { color: var(--muted); margin: 0 8px; }

[dir=auto] { unicode-bidi: plaintext; }

.brand { white-space: nowrap; }
#backBtn { display: none; }
@media (max-width: 860px) { #backBtn { display: inline-flex; } }
@media (max-width: 640px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .brand .wordmark, .who-name { display: none; }
  .nav { overflow-x: auto; }
  .nav a { padding: 6px 8px; }
}

/* Caption mode (?captions=on) for the Meta App Review screen recording */
:root { --cap-h: 84px; }
body.has-captions { padding-bottom: var(--cap-h); }
body.has-captions .inbox { height: calc(100vh - 60px - var(--cap-h)); }
.caption-bar { position: fixed; left: 0; right: 0; bottom: 0; min-height: var(--cap-h); z-index: 50; display: flex; align-items: center; gap: 14px; padding: 12px 24px; background: rgba(17, 24, 39, 0.94); color: #fff; font-size: 16px; line-height: 1.45; box-sizing: border-box; }
.caption-step { flex: none; padding: 4px 10px; border-radius: 999px; background: #facc15; color: #111827; font-weight: 700; font-size: 13px; white-space: nowrap; }
.caption-text { flex: 1; }
@media (max-width: 860px) { :root { --cap-h: 120px; } .caption-bar { font-size: 14px; padding: 10px 14px; flex-direction: column; align-items: flex-start; gap: 6px; } }

/* Business documents (settings page) */
.settings-main { display: grid; gap: 24px; min-width: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.doc-upload { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 12px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--bg); }
.doc-upload label.btn { cursor: pointer; }
.doc-upload:focus-within { border-color: var(--mint-2); }
.doc-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.doc-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.doc-empty { color: var(--muted); font-size: 14px; padding: 6px 2px; }
.doc-icon { width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--mint-soft); color: var(--mint-ink); display: grid; place-items: center; font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.doc-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-note { margin-top: 6px; font-size: 13px; color: var(--warn); }
.doc-note.error { color: var(--danger); }
.doc-text { margin-top: 12px; }
.doc-text textarea { width: 100%; }
.switch.small { font-size: 13px; color: var(--muted); }
.switch.small input { width: 16px; height: 16px; }
.spinner { width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
@media (max-width: 760px) { .doc-actions { width: 100%; justify-content: flex-start !important; } .doc-item > .row { flex-wrap: wrap; } }

/* ---------- AI ON/OFF switch, schedule and alerts ---------- */
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; vertical-align: 1px; }
.pill-on { background: var(--accent-soft); color: var(--accent-dark); }
.pill-rest { background: var(--warn-soft); color: var(--warn); }
.pill-off { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.agent-head { display: flex; align-items: flex-start; gap: 16px; }
.agent-detail { margin: 0; color: var(--muted); font-size: 14px; }
.toggle { display: inline-flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px; cursor: pointer; font: inherit; font-weight: 700; color: var(--muted); border-radius: 999px; }
.toggle:focus-visible { outline: 2px solid var(--mint-2); outline-offset: 2px; }
.toggle:disabled { opacity: .6; cursor: progress; }
.toggle-track { position: relative; width: 52px; height: 30px; border-radius: 999px; background: var(--line-2); transition: background .15s ease; flex: none; }
.toggle-thumb { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s ease; }
.toggle.on .toggle-track { background: var(--mint); }
.toggle.on .toggle-thumb { background: var(--on-mint); }
.toggle.on .toggle-thumb { transform: translateX(22px); }
.toggle.on .toggle-text { color: var(--accent-dark); }
.toggle-text { min-width: 30px; text-align: left; }
.toggle-sm .toggle-track { width: 38px; height: 22px; }
.toggle-sm .toggle-thumb { width: 16px; height: 16px; }
.toggle-sm.on .toggle-thumb { transform: translateX(16px); }
@media (prefers-reduced-motion: reduce) { .toggle-track, .toggle-thumb { transition: none; } }
.mode-list { display: grid; gap: 6px; }
.mode { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.mode:has(input:checked) { border-color: var(--mint-2); background: var(--mint-soft); }
.mode input { margin-top: 4px; accent-color: var(--accent); flex: none; }
.mode .hint { display: block; margin: 2px 0 0; }
.schedule { margin-top: 12px; }
.schedule.is-off { opacity: .5; }
.sched-table { border-collapse: collapse; width: 100%; max-width: 460px; }
.sched-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 8px 4px 0; }
.sched-table td { padding: 3px 8px 3px 0; }
.sched-table select { width: 100%; padding: 5px 8px; }
.sched-table tr.day-off select { opacity: .45; }
.sched-table .day { display: flex; align-items: center; gap: 8px; font-weight: 500; white-space: nowrap; }
.sched-table .day input { width: 16px; height: 16px; accent-color: var(--accent); }
.alert-state { font-size: 14px; }
.device-list { list-style: none; padding: 0; margin: 8px 0 0; }
.agent-rows { display: grid; gap: 4px; max-height: 168px; overflow: auto; }
.agent-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.agent-row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.agent-row-name { font-size: 13px; font-weight: 600; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-row-name:hover { text-decoration: underline; }
.alerts-nudge { display: grid; gap: 6px; font-size: 13px; padding: 8px 10px; border-radius: 10px; background: var(--warn-soft); color: var(--text); }
[hidden] { display: none !important; }
.request-banner { display: flex; align-items: center; gap: 10px; padding: 10px 18px; background: var(--danger-soft); color: var(--text); border-bottom: 1px solid var(--line); font-size: 14px; }
.request-banner strong { color: var(--danger); }
.request-text { flex: 1; min-width: 0; }
@media (max-width: 520px) {
  .sched-table select { padding: 5px 4px; font-size: 14px; }
  .sched-table .day { font-size: 14px; }
  .agent-head { flex-direction: column-reverse; gap: 8px; }
}
.sched-table { table-layout: fixed; }
.sched-table th:first-child { width: 40%; }
@media (max-width: 520px) { .card { padding-left: 14px; padding-right: 14px; } .sched-table .day { white-space: normal; } }
.sched-table { background: none; border: 0; border-radius: 0; overflow: visible; }
.sched-table th { background: none; text-transform: none; letter-spacing: 0; font-size: 12px; }
.sched-table td { border-bottom: 0; }
