:root {
  --bg: #f6f7f9; --card: #ffffff; --text: #1d2330; --muted: #5d6676; --line: #e1e5eb;
  --accent: #1f6feb; --accent-text: #ffffff; --ok: #1a7f37; --bad: #c62828; --wait: #9a6700;
  color-scheme: light dark;
}

/* Contextual HUMAN AHEAD 3D assistant. It is isolated from page layout and never
   reserves content space, so a slow or failed model load cannot cause layout shift. */
.ha-assistant {
  --ha-safe-bottom: max(22px, env(safe-area-inset-bottom));
  position: fixed;
  z-index: 250;
  inset-block-end: var(--ha-safe-bottom);
  left: 22px;
  display: grid;
  align-items: end;
  justify-items: start;
  pointer-events: none;
}

[dir="ltr"] .ha-assistant { justify-items: start; }

.ha-assistant__launcher {
  position: relative;
  width: 148px;
  height: 166px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 46% 46% 42% 42%;
  background: transparent;
  box-shadow: none;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  isolation: isolate;
}

.ha-assistant--dragging .ha-assistant__launcher { cursor: grabbing; }
.ha-assistant--dragging .ha-assistant__launcher,
.ha-assistant--dragging .ha-assistant__launcher:hover { transform: none; }

.ha-assistant__launcher:hover,
.ha-assistant__launcher:focus-visible {
  transform: translateY(-3px);
  box-shadow: none;
  outline: 2px solid #ff4c4c;
  outline-offset: 4px;
}

.ha-assistant__visual,
.ha-assistant__canvas,
.ha-assistant__fallback {
  display: block;
  width: 100%;
  height: 100%;
}

.ha-assistant__visual { filter: drop-shadow(0 14px 17px rgba(0, 0, 0, .7)); }
.ha-assistant__visual,
.ha-assistant__canvas,
.ha-assistant__fallback { pointer-events: auto; cursor: grab; }
.ha-assistant__visual,
.ha-assistant__canvas,
.ha-assistant__fallback { touch-action: none; user-select: none; -webkit-user-drag: none; }
.ha-assistant__fallback { object-fit: cover; object-position: 50% 35%; border-radius: 48%; }
.ha-assistant:not(.ha-assistant--fallback) .ha-assistant__fallback { display: none; }

.ha-assistant__badge {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-end: 4px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 50%;
  color: #fff;
  background: #e51f28;
  font: 800 16px/1 system-ui, sans-serif;
  box-shadow: 0 0 18px rgba(255, 32, 42, .7);
}


.ha-assistant__dialog {
  position: absolute;
  inset-block-end: 132px;
  inset-inline-start: 112px;
  width: min(360px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid rgba(255, 71, 71, .72);
  border-radius: 16px;
  color: #f8f9fb;
  background: linear-gradient(145deg, rgba(22, 26, 31, .98), rgba(6, 8, 10, .98));
  box-shadow: 0 18px 55px rgba(0, 0, 0, .75), 0 0 22px rgba(238, 35, 44, .18);
  pointer-events: auto;
}

[dir="ltr"] .ha-assistant__dialog { inset-inline-start: auto; inset-inline-end: 112px; }
.ha-assistant__dialog[hidden] { display: none; }
.ha-assistant__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ha-assistant__title { margin: 0; color: #ff4048; font-size: 1.2rem; }
.ha-assistant__close { width: 36px; min-width: 36px; min-height: 36px; padding: 0; font-size: 1.5rem; }
.ha-assistant__intro,
.ha-assistant__context { margin: 12px 0; color: #d1d8e2; line-height: 1.55; }
.ha-assistant__context { color: #fff; }
.ha-assistant__actions { display: grid; gap: 8px; margin-block: 14px; }
.ha-assistant__action { min-height: 42px; text-align: start; }
.ha-assistant__mute,
.ha-assistant__disable { margin-inline-end: 8px; min-height: 38px; padding: 7px 10px; font-size: .88rem; }

@media (max-width: 767px) {
  .ha-assistant {
    --ha-safe-bottom: calc(82px + env(safe-area-inset-bottom));
    left: 12px;
  }
  .ha-assistant__launcher { width: 86px; height: 92px; }
  .ha-assistant__canvas { border-radius: 48%; }
  .ha-assistant__fallback { border: 2px solid rgba(255, 71, 71, .7); }
  .ha-assistant__badge { width: 22px; height: 22px; inset-block-start: -2px; inset-inline-end: -2px; font-size: 13px; }
  .ha-assistant__dialog,
  [dir="ltr"] .ha-assistant__dialog {
    position: fixed;
    inset-inline: 10px;
    inset-block-end: calc(78px + env(safe-area-inset-bottom));
    width: auto;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    border-radius: 18px 18px 8px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ha-assistant *, .ha-assistant *::before, .ha-assistant *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition-duration: .01ms !important;
  }
}

@media (forced-colors: active) {
  .ha-assistant__dialog,
  .ha-assistant__fallback,
  .ha-assistant__badge { border: 2px solid CanvasText; }
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11151c; --card: #1a2029; --text: #e6e9ef; --muted: #9aa4b2; --line: #2b3340;
          --accent: #4c8dff; --ok: #3fb950; --bad: #f85149; --wait: #d29922; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Arial, sans-serif; }
[hidden] { display: none !important; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px;
       padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.avatar-small { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.avatar { display: block; width: 120px; height: 120px; margin: 0 auto 16px; border-radius: 50%;
          object-fit: cover; border: 3px solid var(--card); box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
.account { display: flex; align-items: center; gap: 10px; }
.pill { font-size: 13px; color: var(--muted); }
main { max-width: 760px; margin: 0 auto; padding: 16px; }
.owner-nav { position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; overflow-x: auto;
  padding: 8px; margin: 0 0 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.owner-nav .nav-tab { flex: 1 0 auto; min-width: max-content; }
.owner-nav .nav-tab[aria-current="page"] { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.nav-hidden { display: none !important; }
.consciousness-nav { position: fixed; top: 76px; left: max(12px, calc((100vw - 760px) / 2 - 220px));
  width: 200px; display: grid; gap: 8px; padding: 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.12); }
.consciousness-nav strong { padding: 2px 8px 8px; }
.consciousness-nav button { text-align: right; }
.consciousness-nav button[aria-current="page"] { color: var(--accent); border-color: var(--accent); font-weight: 700; }
.section-label { margin: 0 0 12px; color: var(--accent); font-size: 18px; font-weight: 700; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.hero { text-align: center; padding: 40px 16px; }
.hero#signed-out { background: linear-gradient(145deg, rgba(21,23,26,.82), rgba(9,11,13,.72));
  backdrop-filter: blur(8px); }
.hero h1 { margin: 0 0 20px; font-size: 26px; }
.hero #create-agent { margin-inline-start: 8px; }
.onboarding { max-width: 560px; margin: 24px auto; }
.onboarding form { display: grid; gap: 12px; margin-top: 18px; }
.connect-ai-clients { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
.connect-ai-client { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.connect-ai-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.connect-ai-heading h3 { margin: 0; }
.connect-ai-status { flex: 0 0 auto; padding: 3px 9px; border-radius: 999px; color: var(--wait); background: color-mix(in srgb, var(--wait) 12%, transparent); font-size: 12px; font-weight: 700; }
.connect-ai-status[data-state="connected"] { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.connect-ai-status[data-state="failed"] { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.connect-command { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin: 10px 0; }
.connect-command code { min-width: 0; padding: 9px; overflow-x: auto; white-space: nowrap; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.agent-profile form { display: grid; gap: 12px; }
.agent-profile .avatar, .onboarding .avatar { object-fit: contain; }
.agents-workspace { direction: ltr; display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 16px;
  align-items: start; margin-bottom: 16px; }
.agents-sidebar { direction: rtl; position: sticky; top: 72px; display: grid; gap: 8px; padding: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.agents-sidebar strong { padding: 2px 8px 8px; }
.agents-sidebar button { text-align: right; }
.agents-sidebar button[aria-current="page"] { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.agents-content { direction: rtl; min-width: 0; margin: 0; }
.agent-view h2 { margin-top: 0; }
.section-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.section-heading h2, .section-heading p { margin-top: 0; }
.agent-view form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.agent-form-wide { grid-column: 1 / -1; }
.agent-icon-picker { display: flex; align-items: center; gap: 14px; margin: 14px 0; padding: 14px;
  background: var(--bg); border-radius: 12px; }
.agent-icon-picker label { flex: 1; margin: 0; }
.agent-icon-preview { width: 58px; height: 58px; display: grid; place-items: center; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 50%; background: var(--card); font-size: 30px; }
.agent-empty { padding: 34px 16px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }
.agent-empty > span { font-size: 44px; }
.agent-empty h3 { margin-bottom: 0; }
.agent-list { display: grid; gap: 8px; margin: 12px 0 18px; }
.agent-list-item { width: 100%; display: grid; grid-template-columns: 44px 1fr 24px;
  align-items: center; gap: 12px; padding: 12px 14px; color: var(--text); text-align: start;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.agent-list-item:hover, .agent-list-item[aria-current="true"] { border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
.agent-list-avatar { width: 40px; height: 40px; display: grid; place-items: center; object-fit: cover;
  border-radius: 50%; background: var(--bg); font-size: 24px; }
.agent-list-text { display: grid; min-width: 0; }
.agent-list-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-list-text small { color: var(--muted); }
.agent-last-run { margin-top: 3px; }
.agent-status { width: 12px; height: 12px; justify-self: center; border-radius: 50%; background: var(--muted);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--muted) 18%, transparent); }
.agent-status.active { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.agent-status.error { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 18%, transparent); }
.profile-avatar-settings { display: grid; grid-template-columns: auto 1fr; gap: 12px 18px; align-items: center; }
.profile-avatar-settings .avatar { width: 96px; height: 96px; margin: 0; grid-row: 1 / 3; }
.profile-avatar-settings label { margin: 0; }
.vault-status-list { display: grid; gap: 8px; margin: 14px 0; }
.vault-status-row { display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.vault-status-row > span:first-child { display: grid; min-width: 0; }
.vault-status-row small { color: var(--muted); }
.vault-key-state { flex: 0 0 auto; padding: 3px 9px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.vault-key-state.configured { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.vault-key-state.missing { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.private-chat-turns { padding: 0; list-style: none; display: grid; gap: 12px; max-height: 55vh; overflow-y: auto; }
.private-chat-turn { padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.private-chat-turn.user { margin-inline-end: 24px; }
.private-chat-turn.assistant { margin-inline-start: 24px; }
.private-chat-turn p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; }
.private-chat form { display: grid; gap: 12px; }
.intro { margin: 0 0 12px; color: var(--muted); }
.hero p { margin: 0 0 20px; color: var(--muted); }
button { font: inherit; border: 0; border-radius: 8px; padding: 10px 18px; cursor: pointer;
         background: var(--accent); color: var(--accent-text); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); padding: 6px 12px; }
label { display: block; font-weight: 600; margin-bottom: 8px; }
textarea { width: 100%; font: inherit; color: var(--text); background: var(--bg);
           border: 1px solid var(--line); border-radius: 8px; padding: 10px; resize: vertical; }
input[type="number"] { width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
input[type="search"], input[type="text"], input[type="date"], select, .medical-form input:not([type="hidden"]) {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.medical-notice { margin: 14px 0 0; padding: 12px; color: var(--wait); border: 1px solid var(--wait); border-radius: 8px; }
.medical-filter { display: grid; grid-template-columns: 2fr 1fr auto; gap: 10px; align-items: end; margin: 14px 0; }
.medical-upload { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end;
  margin: 14px 0; padding: 14px; background: var(--bg); border-radius: 10px; }
.medical-dropzone { min-height: 110px; display: flex; flex-direction: column; justify-content: center;
  align-items: center; gap: 8px; padding: 18px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: 10px; transition: border-color .15s, background .15s; }
.medical-dropzone:hover, .medical-dropzone:focus-visible, .medical-dropzone.dragging {
  border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); outline: none; }
.medical-dropzone span { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.medical-upload-status { margin: 0; color: var(--accent); font-weight: 600; }
.medical-upload-status::before { content: ""; display: inline-block; width: .8em; height: .8em;
  margin-inline-end: .55em; border: 2px solid currentColor; border-inline-start-color: transparent;
  border-radius: 50%; animation: medical-spin .8s linear infinite; }
@keyframes medical-spin { to { transform: rotate(360deg); } }
.medical-auto-save { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.medical-auto-save input { width: auto; }
.medical-preview { width: min(1000px, 94vw); height: min(850px, 92vh); padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); }
.medical-preview::backdrop { background: rgb(15 23 42 / .72); }
.medical-preview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.medical-preview iframe { width: 100%; height: calc(100% - 52px); border: 1px solid var(--line); border-radius: 8px; background: white; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.medical-review { margin: 14px 0; padding: 14px; border: 1px solid var(--accent); border-radius: 10px; }
.medical-result { display: grid; grid-template-columns: auto minmax(170px, 2fr) minmax(80px, .7fr)
  minmax(90px, .8fr) minmax(110px, 1fr) minmax(90px, .8fr); gap: 8px; align-items: end;
  margin-bottom: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.medical-result label { margin: 0; font-size: 13px; }
.medical-result > label:first-child { align-self: center; display: grid; place-items: center; }
.medical-result > label:first-child input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.medical-result input { min-width: 0; padding: 6px; }
.medical-filter label, .medical-form label { margin: 0; }
.medical-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
  margin: 14px 0; padding: 14px; background: var(--bg); border-radius: 10px; }
.medical-wide { grid-column: 1 / -1; }
.medical-timeline { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; }
.medical-record { padding: 12px; border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); border-radius: 8px; }
.limits-form { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 10px; align-items: end; margin: 12px 0; }
.budget-form { display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: 10px; align-items: end; margin: 12px 0; }
.budget-form label { margin: 0; }
.settings-divider { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.settings-note { margin-bottom: 0; }
@media (max-width: 680px) {
  .connect-ai-clients { grid-template-columns: 1fr; }
  .agents-workspace { grid-template-columns: 1fr; }
  .agents-sidebar { position: static; display: flex; overflow-x: auto; }
  .agents-sidebar strong { display: none; }
  .agents-sidebar button { flex: 1 0 auto; text-align: center; }
  .agent-view form { grid-template-columns: 1fr; }
  .agent-form-wide { grid-column: auto; }
  .section-heading { display: grid; }
  .profile-avatar-settings { grid-template-columns: 1fr; }
  .profile-avatar-settings .avatar { grid-row: auto; }
}
.admin-accounts { list-style: none; padding: 0; margin: 14px 0 22px; display: grid; gap: 12px; }
.admin-account { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
  padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.admin-account-heading { grid-column: 1 / -1; display: flex; justify-content: space-between;
  align-items: baseline; gap: 12px; min-width: 0; }
.admin-account-heading .muted { overflow-wrap: anywhere; text-align: end; }
.admin-account label { margin: 0; min-width: 0; }
.admin-account input, .admin-account select { width: 100%; min-width: 0; padding: 8px; }
.admin-account-action { display: flex; align-items: end; }
.admin-account-action button { width: 100%; }
.admin-flag-form { display: grid; grid-template-columns: 2fr 1fr 2fr auto auto; gap: 10px; align-items: end; }
.admin-flag-form label { margin: 0; }
.limits-form label { margin: 0; font-size: 14px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; }
.muted { color: var(--muted); font-size: 14px; margin: 0; }
.list-head { display: flex; justify-content: space-between; align-items: center; }
.list-head h2 { font-size: 18px; margin: 8px 0; }
.tasks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.task { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.task-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.status { font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; }
.eta-live { font-variant-numeric: tabular-nums; white-space: nowrap; }
.status[data-status="succeeded"] { color: var(--ok); }
.status[data-status="failed"], .status[data-status="cancelled"] { color: var(--bad); }
.status[data-status="queued"], .status[data-status="running"] { color: var(--wait); }
.mode { color: var(--muted); }
.cost { color: var(--muted); font-variant-numeric: tabular-nums; border-bottom: 1px dotted currentColor; cursor: help; }
.spend { font-size: 14px; font-weight: 400; color: var(--muted); }
.usage-summary { margin: -2px 0 10px; font-variant-numeric: tabular-nums; }
.when { color: var(--muted); margin-inline-start: auto; }
.description { margin: 8px 0 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-body { margin-top: 6px; }
.task-title { cursor: pointer; font-weight: 600; overflow-wrap: anywhere; }
.task-title .number { color: var(--muted); font-variant-numeric: tabular-nums; margin-inline-end: 4px; }
.task-body[open] .short { display: none; }
.task-progress { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.progress-events { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; }
.progress-events li { display: grid; grid-template-columns: 8px minmax(90px, auto) 1fr auto; gap: 7px; align-items: center; font-size: 13px; }
.progress-events li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--wait); }
.progress-events li[data-status="succeeded"]::before { background: var(--ok); }
.progress-events li[data-status="failed"]::before { background: var(--bad); }
.progress-stage { font-weight: 600; }
.progress-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-note { margin: 6px 0 0; }
.summary { white-space: pre-wrap; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.history-summary { margin: 0 0 12px; }
.pr { color: var(--accent); font-weight: 600; }
.message { margin: 0 0 16px; padding: 10px 14px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); }
.message.error { border-color: var(--bad); color: var(--bad); }
@media (max-width: 560px) {
  .row, .list-head { flex-direction: column; align-items: stretch; }
  .buttons { flex-wrap: wrap; }
  .buttons > * { flex: 1 1 auto; }
  .limits-form { grid-template-columns: 1fr; }
  .budget-form { grid-template-columns: 1fr; }
  .admin-flag-form { grid-template-columns: 1fr; }
  .admin-account { grid-template-columns: 1fr; }
  .admin-account-heading { grid-column: auto; flex-direction: column; align-items: stretch; }
  .admin-account-heading .muted { text-align: start; }
  .owner-nav { margin-inline: -8px; border-radius: 8px; }
  .consciousness-nav { position: static; width: 100%; margin: 0 0 16px; grid-template-columns: 1fr 1fr; }
  .consciousness-nav strong { grid-column: 1 / -1; }
  .medical-filter, .medical-form, .medical-upload { grid-template-columns: 1fr; }
  .medical-result { grid-template-columns: auto minmax(0, 2fr) minmax(68px, .7fr); }
  .medical-result > label:nth-child(n+4) { grid-column: span 1; }
  .medical-wide { grid-column: auto; }
}
.approve, .retry { padding: 6px 14px; }
.buttons { display: flex; gap: 8px; }
.buttons > * { flex: 1; white-space: nowrap; }
button.voice { padding: 10px 14px; font-variant-numeric: tabular-nums; }
button.voice[aria-pressed="true"] { border-color: var(--bad); color: var(--bad); }
button.big { font-size: 18px; padding: 14px 26px; }
.visitor-talk { margin: 0 0 20px; }
.visitor-talk p { margin: 12px auto 0; max-width: 460px; font-size: 14px; }
.talk-panel { position: fixed; z-index: 34; inset: auto 24px 24px; width: min(920px, calc(100vw - 48px));
  max-height: 190px; margin-inline: auto; padding: 12px 16px; overflow: hidden; border-color: var(--accent);
  box-shadow: 0 18px 48px rgba(0,0,0,.72), 0 0 22px rgba(255,59,48,.14); }
.talk-panel > .row { min-height: 38px; gap: 10px; }
.talk-panel #talk-status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.talk-panel #talk-timer { margin-inline-start: auto; white-space: nowrap; }
.talk-panel #talk-end { flex: 0 0 auto; min-height: 36px; padding: 6px 12px; }
.captions { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; max-height: 104px; overflow: hidden; }
.captions li { display: -webkit-box; min-width: 0; max-height: 48px; padding: 4px 8px; overflow: hidden;
  border-radius: 7px; background: var(--bg); white-space: normal; overflow-wrap: anywhere;
  line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.captions li[data-role="assistant"] { border-inline-start: 3px solid var(--accent); }
.captions li[data-role="user"] { border-inline-start: 3px solid var(--muted); }
.block { margin-top: 14px; }
.block summary { cursor: pointer; font-weight: 600; }
.plain { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.memory { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(170px, 220px) auto;
  gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.memory-text { min-width: 0; overflow-wrap: break-word; white-space: pre-wrap; }
.memory .kind { font-size: 12px; }
.memory select.visibility { width: 100%; min-width: 0; }
.memory button { padding: 2px 10px; font-size: 13px; }
.memory button.visibility[data-public="true"] { color: var(--ok); border-color: var(--ok); }
.memory-form { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.memory-form textarea { flex: 1; }
label.inline { display: flex; gap: 4px; align-items: center; font-weight: 400; margin: 0; white-space: nowrap; }
.conversation { padding: 8px 0; border-bottom: 1px solid var(--line); }
.conversation .notes { margin: 4px 0; }
.score { font-weight: 700; color: var(--ok); }
.amir-badge { font-size: 13px; font-weight: 700; color: var(--accent-text); background: var(--ok);
              padding: 3px 10px; border-radius: 999px; }
body.amir-mode .bar { border-bottom: 3px solid var(--ok); }
body.amir-mode .amir-card { border-color: var(--ok); }
.buttons.wrap { flex-wrap: wrap; }
.buttons.wrap > * { flex: 0 1 auto; }
.consciousness-auth { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.consciousness-auth p { margin: 0; }
@media (max-width: 767px) { .consciousness-auth { align-items: stretch; flex-direction: column; } }
.voice-capture { margin-top: 12px; padding: 12px; border-radius: 8px; background: var(--bg); }
.phrase { font-size: 24px; font-weight: 700; margin: 6px 0 10px; }
.privacy { padding-inline-start: 18px; margin: 8px 0; }
.locked { margin: 0 0 10px; }
button.danger { color: var(--bad); border-color: var(--bad); }
@media (max-width: 560px) {
  .memory-form { flex-direction: column; align-items: stretch; }
  .memory { grid-template-columns: minmax(0, 1fr) auto; }
  .memory-text { grid-column: 1 / -1; }
  .memory select.visibility { grid-column: 1; }
}
.site-footer { max-width: 760px; margin: 0 auto; padding: 8px 16px 20px; text-align: center;
               color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.app-version { font-variant-numeric: tabular-nums; }

/* HUMANAHEAD.AI responsive shell */
:root {
  --bg: #050506; --card: #15171a; --text: #f7f8fa; --muted: #a7adb7; --line: #2b2f35;
  --accent: #ff3b30; --accent-text: #fff; --ok: #22c55e; --bad: #ef4444; --wait: #f59e0b;
  --surface-top: #090a0c; --surface-main: #0d0e10; --surface-hover: #1b1e22;
  --accent-bright: #ff5b54; --accent-deep: #c9221a; --line-strong: #454b55;
  --panel-gradient: linear-gradient(145deg, rgba(21,23,26,.98), rgba(9,11,13,.98));
  --panel-shadow: 0 18px 42px rgba(0,0,0,.34), inset 0 1px rgba(255,255,255,.035);
  --focus-ring: 0 0 0 3px rgba(255,59,48,.28), 0 0 0 5px rgba(255,255,255,.72);
  color-scheme: dark;
}
html { background: var(--bg); scroll-behavior: smooth; }
html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
body { position: relative; isolation: isolate; min-height: 100vh; padding-top: 72px; background: var(--bg); }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background:
    linear-gradient(rgba(5,5,6,.12), rgba(5,5,6,.26)),
    url('/web/humanahead-background-red-grid.png?v=2') center center / cover no-repeat;
  opacity: 1; }
body::after { display: none; }
.bar { position: fixed; inset: 0 0 auto; z-index: 40; height: 72px; padding: 0 32px;
  background: rgba(7,9,11,.92); border-bottom: 1px solid rgba(255,59,48,.34);
  box-shadow: 0 10px 32px rgba(0,0,0,.48), 0 1px 16px rgba(255,59,48,.08); backdrop-filter: blur(16px); }
.brand { direction: ltr; letter-spacing: .02em; font-size: clamp(18px, 2vw, 25px); }
.brand-logo { display: block; width: clamp(190px, 18vw, 300px); height: 54px; object-fit: contain; object-position: center; }
.page-context { display: grid; justify-items: center; line-height: 1.15; }
.page-context .eyebrow { color: var(--muted); font-size: 11px; letter-spacing: .12em; }
.account { direction: rtl; }
.bar .pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border: 1px solid rgba(34,197,94,.5);
  border-radius: 999px; color: #86efac; background: rgba(34,197,94,.12); }
.bar .pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.nav-toggle { display: none; font-size: 24px; }
.language-toggle { min-height: 38px; padding: 6px 13px; direction: ltr; font-weight: 700; white-space: nowrap; }
main { width: min(100%, 1680px); max-width: none; margin: 0 auto; padding: 20px 32px 34px; }
#signed-in { padding-top: 136px; }
.owner-nav { position: fixed; z-index: 35; inset: 72px 0 auto; height: 64px; display: flex; justify-content: center;
  gap: 0; overflow-x: auto; padding: 0 20px; margin: 0; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; background: rgba(9,10,12,.98); }
.primary-nav-heading, .nav-collapse { display: none; }
.owner-nav .nav-tab { position: relative; flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  min-width: auto; min-height: 64px; padding: 0 24px; border: 0; border-inline-start: 1px solid var(--line); border-radius: 0;
  color: var(--text); background: transparent; }
.owner-nav .nav-tab span { color: var(--muted); font-size: 22px; }
.interface-icon { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 5px currentColor); }
.sprite-icon { display: block !important; width: 34px !important; height: 34px !important; flex: 0 0 34px;
  background-image: url('/web/humanahead-icon-sheet.png'); background-repeat: no-repeat; background-size: 400% 300%;
  border-radius: 8px; filter: drop-shadow(0 0 6px rgba(255,45,53,.5)); }
.sprite-icon[data-sprite-icon="chat"] { background-position: 0 0; }
.sprite-icon[data-sprite-icon="agents"] { background-position: 33.333% 0; }
.sprite-icon[data-sprite-icon="services"], .sprite-icon[data-sprite-icon="admin"] { background-position: 66.667% 0; }
.sprite-icon[data-sprite-icon="permissions"] { background-position: 100% 0; }
.sprite-icon[data-sprite-icon="settings"] { background-position: 0 50%; }
.sprite-icon[data-sprite-icon="development"] { background-position: 33.333% 50%; }
.sprite-icon[data-sprite-icon="consciousness"] { background-position: 0 100%; }
.sprite-icon[data-sprite-icon="privacy"] { background-position: 33.333% 100%; }
.owner-nav .nav-tab b { font-weight: 600; }
.owner-nav .nav-tab:hover { background: var(--surface-hover); }
.owner-nav .nav-tab[aria-current="page"] { color: var(--text); background: rgba(255,59,48,.12); }
.owner-nav .nav-tab[aria-current="page"]::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: var(--accent); }
.owner-nav .nav-tab[aria-current="page"] span { color: var(--accent); }
.section-nav { position: fixed; z-index: 34; inset: 136px 0 auto; height: 68px; display: flex; align-items: center; gap: 12px;
  overflow-x: auto; padding: 10px 32px; background: rgba(13,14,16,.97); border-bottom: 1px solid var(--line); }
.section-nav::before { content: attr(aria-label); margin-inline-end: 8px; color: var(--text); font-weight: 800; }
.section-nav button { flex: 0 0 auto; min-height: 44px; padding: 8px 20px; border-radius: 8px; }
.section-nav button[aria-current="page"] { color: var(--text); border-color: var(--accent); background: rgba(255,59,48,.12);
  box-shadow: inset 3px 0 0 var(--accent); }
.agents-workspace { display: block; }
.agents-sidebar { display: none; }
.card, .task, .agent-list-item, .medical-record { background: var(--panel-gradient);
  border-color: var(--line-strong); box-shadow: var(--panel-shadow); }
.card:hover { border-color: #565d68; }
button { position: relative; isolation: isolate; min-height: 44px; overflow: hidden; border: 1px solid #ff625a;
  background: linear-gradient(180deg, var(--accent-bright), #e52920 58%, var(--accent-deep));
  box-shadow: inset 0 1px rgba(255,255,255,.18), 0 8px 24px rgba(255,30,24,.2);
  transition: transform .18s ease, border-color .18s ease, background-color .18s ease, box-shadow .18s ease, color .18s ease, filter .18s ease; }
button::before { content: ""; position: absolute; z-index: -1; inset: 0;
  background: linear-gradient(115deg, transparent 20%, rgba(255,255,255,.18), transparent 65%);
  transform: translateX(-125%); transition: transform .45s ease; }
button:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: inset 0 1px rgba(255,255,255,.22), 0 10px 28px rgba(255,30,24,.27); }
button:hover::before { transform: translateX(125%); }
button:active { transform: translateY(0) scale(.985); }
button.ghost { color: var(--text); background: linear-gradient(180deg, #151a20, #0b0e12); border-color: var(--line-strong);
  box-shadow: inset 0 1px rgba(255,255,255,.055), 0 8px 18px rgba(0,0,0,.22); }
button.ghost:hover { border-color: var(--accent); background: linear-gradient(180deg, #1b1518, #0d0e11); box-shadow: 0 0 18px rgba(255,45,53,.14); }
button:disabled { transform: none; box-shadow: none; filter: grayscale(.5); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid #fff; outline-offset: 3px; border-color: var(--accent); box-shadow: var(--focus-ring); }
input[type="search"], input[type="text"], input[type="date"], input[type="number"], select, textarea,
.medical-form input:not([type="hidden"]) { background: #090a0c; border-color: #454b55; }
.message { position: sticky; top: 214px; z-index: 20; background: #15171a; }
.site-footer { max-width: 1680px; padding-bottom: 28px; }
.mobile-nav { display: none; }
.nav-backdrop { position: fixed; inset: 0; z-index: 37; background: rgba(0,0,0,.72); }
.dashboard { width: auto; max-width: none; margin-inline: 0; display: grid; gap: 16px; }
.dashboard-hero { position: relative; min-height: 190px; display: grid; align-content: center; justify-items: center;
  padding: 20px 2px; overflow: hidden; text-align: center; }
.dashboard-hero::after { content: ""; position: absolute; inset: 0 47% 0 0; pointer-events: none; opacity: .7;
  background: radial-gradient(circle at 20% 50%, rgba(255,59,48,.28), transparent 18%),
    repeating-linear-gradient(155deg, transparent 0 24px, rgba(255,59,48,.11) 25px 26px, transparent 27px 48px);
  mask-image: linear-gradient(to left, #000, transparent); }
.dashboard-breadcrumb { color: var(--muted); margin: 0 0 10px; }
.dashboard-hero h1 { position: relative; z-index: 1; margin: 0; font-size: clamp(28px, 2.6vw, 40px); line-height: 1.12; }
.dashboard-hero h1 #dashboard-owner-name { color: var(--accent); }
.dashboard-greeting { color: var(--text); }
.dashboard-hero > p:not(.dashboard-breadcrumb) { position: relative; z-index: 1; margin: 8px 0 16px; color: var(--muted); font-size: clamp(15px, 1.1vw, 18px); }
.dashboard-actions { position: relative; z-index: 1; display: flex; gap: 14px; }
.dashboard-actions button { min-width: 190px; min-height: 46px; font-size: 14px; font-weight: 800; }
.dashboard-actions button:not(.ghost) { border-color: #ff7a74; background: linear-gradient(180deg, #ff5148, #eb2118 58%, #b9120c);
  box-shadow: inset 0 1px rgba(255,255,255,.3), 0 0 0 1px rgba(255,59,48,.2), 0 10px 28px rgba(255,32,24,.34), 0 0 24px rgba(255,32,24,.18); }
.dashboard-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.dashboard-stat { min-height: 94px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: 14px; color: var(--text); text-align: start; background: linear-gradient(145deg, #17191d, #0d0f11);
  border: 1px solid #454b55; box-shadow: inset -1px -1px 0 rgba(255,59,48,.6), 0 12px 30px rgba(0,0,0,.24); }
.dashboard-stat:hover { border-color: var(--accent); background: var(--surface-hover); }
.dashboard-stat > span:nth-child(2) { display: grid; gap: 5px; }
.dashboard-stat b { font-size: 14px; }
.dashboard-stat strong { font-size: 18px; }
.dashboard-stat i { color: var(--muted); font-size: 28px; font-style: normal; }
.dashboard-ok { color: #4ade80; }
.stat-icon { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid rgba(255,59,48,.55);
  border-radius: 50%; color: var(--accent); background: rgba(255,59,48,.08); font-size: 22px; }
.stat-icon.success { color: #4ade80; border-color: rgba(34,197,94,.65); background: rgba(34,197,94,.1); }
.dashboard-lower { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 18px; }
.dashboard-panel { padding: 16px; background: linear-gradient(145deg, #15171a, #0c0e10); border: 1px solid #454b55;
  border-radius: 14px; box-shadow: inset -1px -1px 0 rgba(255,59,48,.5); }
.dashboard-panel h2 { margin: 0 0 12px; font-size: 21px; }
.dashboard-activity { list-style: none; padding: 0; margin: 0; }
.dashboard-activity li { display: grid; grid-template-columns: 72px minmax(0, 1fr) 14px; gap: 14px; align-items: center;
  min-height: 50px; border-top: 1px solid var(--line); }
.dashboard-activity time { color: var(--muted); font-variant-numeric: tabular-nums; }
.dashboard-activity span { display: grid; }
.dashboard-activity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.dashboard-activity small { display: none; }
.dashboard-activity i { width: 10px; height: 10px; border-radius: 50%; background: #737b87; }
.dashboard-activity i[data-status="running"], .dashboard-activity i[data-status="queued"] { background: var(--accent); }
.dashboard-activity i[data-status="succeeded"] { background: var(--ok); }
.dashboard-quick { display: grid; gap: 10px; }
.dashboard-quick button { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 12px; min-height: 66px;
  padding: 10px 16px; color: var(--text); text-align: start; background: #111317; border: 1px solid #454b55; box-shadow: none; }
.dashboard-quick button span { color: var(--accent); font-size: 25px; }
.dashboard-quick button i { color: var(--muted); font-size: 25px; font-style: normal; }

/* Desktop depth screens follow the approved double-rail reference: primary navigation
   at the far right, contextual navigation beside it, and the working canvas on the left. */
@media (min-width: 1200px) {
  :root { --primary-rail: 220px; --secondary-rail: 250px; --rail-gap: 14px; }
  main { padding: 20px 28px 34px; }
  #signed-in { padding-top: 0; }
  #signed-in > :not(.owner-nav):not(.section-nav) {
    margin-right: calc(var(--primary-rail) + var(--secondary-rail) + (var(--rail-gap) * 2));
  }
  .owner-nav {
    inset: 86px 14px 14px auto; width: var(--primary-rail); height: auto;
    display: grid; align-content: start; justify-content: stretch; gap: 8px;
    overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: 12px;
    background: linear-gradient(180deg, rgba(14,17,20,.98), rgba(7,9,11,.98));
    box-shadow: inset -1px -1px 0 rgba(255,59,48,.3), 0 20px 48px rgba(0,0,0,.38); backdrop-filter: blur(14px);
  }
  .primary-nav-heading { display: flex; align-items: center; gap: 10px; padding: 8px 9px 14px; }
  .primary-nav-heading span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
    color: #fff; background: var(--accent); font-weight: 900; }
  .primary-nav-heading strong { font-size: 13px; direction: ltr; }
  .owner-nav .nav-tab {
    width: 100%; min-height: 64px; justify-content: flex-start; padding: 0 16px;
    border: 1px solid #343941; border-radius: 9px; background: linear-gradient(135deg, #11161b, #090c0f 76%);
    box-shadow: inset 0 1px rgba(255,255,255,.035), 0 10px 24px rgba(0,0,0,.22);
  }
  .owner-nav .nav-tab:hover { border-color: rgba(255,59,48,.78); background: linear-gradient(135deg, #211014, #0b0d10 76%); }
  .owner-nav .nav-tab span { width: 30px; text-align: center; }
  .owner-nav .nav-tab[aria-current="page"] {
    color: #fff; border-color: var(--accent); background: radial-gradient(circle at 18% 50%, rgba(255,59,48,.3), transparent 52%), linear-gradient(90deg, #2b0d12, #12080b 72%);
    box-shadow: inset 0 0 20px rgba(255,59,48,.2), 0 0 14px rgba(255,59,48,.48), 0 14px 32px rgba(0,0,0,.35);
  }
  .owner-nav .nav-tab[aria-current="page"]::after { inset: 8px auto 8px -1px; width: 3px; height: auto; }
  .section-nav {
    inset: 86px calc(var(--primary-rail) + 28px) 14px auto; width: var(--secondary-rail); height: auto;
    display: grid; align-content: start; gap: 9px; overflow: auto; padding: 14px 10px;
    border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(180deg, rgba(15,19,23,.98), rgba(7,10,12,.98));
    box-shadow: inset 0 1px rgba(255,255,255,.035), 0 20px 48px rgba(0,0,0,.32); backdrop-filter: blur(14px);
  }
  .section-nav::before { margin: 0; padding: 5px 8px 12px; font-size: 20px; }
  .section-nav button { width: 100%; min-height: 66px; padding: 10px 15px; text-align: right;
    white-space: normal; line-height: 1.35; background: linear-gradient(135deg, #11161b, #090c0f 76%); border-color: #37404a;
    box-shadow: inset 0 1px rgba(255,255,255,.04), 0 10px 24px rgba(0,0,0,.24); }
  .section-nav button:hover { border-color: var(--accent); background: linear-gradient(135deg, #211014, #0b0d10 76%); box-shadow: 0 0 18px rgba(255,45,53,.18); }
  .section-nav button[aria-current="page"] {
    color: #ff8b8f; border-color: var(--accent);
    background: radial-gradient(circle at 20% 50%, rgba(255,30,42,.28), transparent 50%), linear-gradient(90deg, #2b0d12, #12080b 72%);
    box-shadow: inset 3px 0 0 var(--accent), 0 0 14px rgba(255,25,35,.52), 0 14px 30px rgba(0,0,0,.34);
  }
  .consciousness-nav { display: none !important; }
  .message { top: 86px; }
  .talk-panel { left: 28px; right: calc(var(--primary-rail) + var(--secondary-rail) + (var(--rail-gap) * 2) + 28px);
    width: auto; margin: 0; }
  html[dir="ltr"] #signed-in > :not(.owner-nav):not(.section-nav) {
    margin-right: 0; margin-left: calc(var(--primary-rail) + var(--secondary-rail) + (var(--rail-gap) * 2));
  }
  html[dir="ltr"] .owner-nav { inset: 86px auto 14px 14px; }
  html[dir="ltr"] .talk-panel { right: 28px; left: calc(var(--primary-rail) + var(--secondary-rail) + (var(--rail-gap) * 2) + 28px); }
  html[dir="ltr"] .section-nav { inset: 86px auto 14px calc(var(--primary-rail) + 28px); }
  html[dir="ltr"] .section-nav button { text-align: left; }
  html[dir="ltr"] .owner-nav .nav-tab[aria-current="page"]::after { inset: 8px -1px 8px auto; }
}

@media (min-width: 1200px) and (max-width: 1499px) {
  :root { --primary-rail: 196px; --secondary-rail: 220px; --rail-gap: 10px; }
  .owner-nav .nav-tab { min-height: 56px; padding-inline: 12px; }
  .dashboard-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1199px) and (min-width: 768px) {
  .owner-nav .nav-tab { padding-inline: 14px; }
  .owner-nav .nav-tab b { display: none; }
  .owner-nav .nav-tab span { font-size: 24px; }
  .dashboard-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  body { padding-top: 72px; padding-bottom: calc(76px + env(safe-area-inset-bottom)); overflow-x: hidden;
    background-attachment: scroll; }
  body::before { background-position: center, 18% center; }
  .bar { height: 72px; padding: 0 16px; border-bottom-color: rgba(255,59,48,.65); }
  .brand { min-width: 0; font-size: 17px; }
  .brand-logo { width: clamp(132px, 38vw, 190px); height: 44px; }
  .language-toggle { min-height: 38px; padding-inline: 10px; font-size: 13px; }
  .brand-mark { width: 28px; height: 28px; }
  .page-context, .account > :not(#sign-out) { display: none !important; }
  .account #sign-out { display: none; }
  .nav-toggle { display: inline-grid; place-items: center; width: 44px; padding: 0; }
  main { width: 100%; padding: 12px 14px 24px; }
  #signed-in { padding-top: 64px; }
  .owner-nav { position: fixed; z-index: 39; inset: 0 0 0 auto; width: min(86vw, 350px); height: 100dvh;
    display: grid; align-content: start; gap: 6px; padding: calc(18px + env(safe-area-inset-top)) 14px 20px;
    overflow-y: auto; transform: translateX(105%); transition: transform .2s ease; border-inline-start: 1px solid rgba(255,59,48,.42);
    background: linear-gradient(180deg, rgba(13,16,19,.99), rgba(5,6,8,.99)); box-shadow: -18px 0 44px rgba(0,0,0,.52); }
  body.nav-open .owner-nav { transform: translateX(0); }
  .primary-nav-heading { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
  .primary-nav-heading span { display: grid; place-items: center; width: 34px; height: 34px; color: #fff; background: var(--accent); border-radius: 9px; }
  .owner-nav .nav-tab { width: 100%; min-height: 50px; justify-content: flex-start; padding: 0 14px; border: 1px solid transparent; border-radius: 9px; }
  .owner-nav .nav-tab b { display: inline; }
  .owner-nav .nav-tab[aria-current="page"]::after { inset: 8px auto 8px 0; width: 3px; height: auto; }
  .nav-collapse { display: none; }
  .section-nav { inset: 72px 0 auto; height: 64px; gap: 8px; padding: 9px 14px; }
  .section-nav::before { display: none; }
  .section-nav button { min-height: 44px; padding-inline: 16px; }
  .message { top: 142px; }
  .talk-panel { z-index: 38; inset: 82px 12px auto; width: auto; max-height: 174px; padding: 10px 12px; }
  .card { padding: 15px; border-radius: 14px; }
  .dashboard { gap: 16px; }
  .dashboard-hero { min-height: auto; padding: 26px 2px 8px; }
  .dashboard-hero::after { inset: 0 20% 0 0; opacity: .38; }
  .dashboard-hero h1 { font-size: clamp(30px, 8.5vw, 42px); }
  .dashboard-hero > p:not(.dashboard-breadcrumb) { font-size: 16px; }
  .dashboard-actions { width: 100%; display: grid; }
  .dashboard-actions button { width: 100%; min-width: 0; min-height: 58px; }
  .dashboard-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .dashboard-stat { min-height: 132px; grid-template-columns: 48px 1fr; gap: 10px; padding: 14px; }
  .dashboard-stat i { display: none; }
  .dashboard-stat b { font-size: 14px; }
  .dashboard-stat strong { font-size: 18px; }
  .stat-icon { width: 48px; height: 48px; font-size: 22px; }
  .dashboard-lower { grid-template-columns: 1fr; }
  .dashboard-panel { padding: 16px; }
  .dashboard-activity li { grid-template-columns: 54px 1fr 10px; gap: 10px; }
  .dashboard-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-quick button { grid-template-columns: 1fr; justify-items: start; min-height: 118px; padding: 12px; }
  .dashboard-quick button i { display: none; }
  .agents-workspace { display: block; }
  .agents-sidebar { display: none; }
  .mobile-nav { position: fixed; z-index: 36; inset: auto 0 0; height: calc(70px + env(safe-area-inset-bottom));
    display: grid !important; grid-template-columns: repeat(4, 1fr); padding: 5px 6px env(safe-area-inset-bottom);
    background: rgba(7,9,11,.97); border-top: 1px solid rgba(255,59,48,.4); box-shadow: 0 -10px 30px rgba(0,0,0,.5); backdrop-filter: blur(16px); }
  .mobile-nav button { display: grid; place-items: center; gap: 1px; min-width: 0; min-height: 58px; padding: 4px;
    color: var(--muted); background: transparent; border: 1px solid transparent; box-shadow: none; }
  .mobile-nav button span { font-size: 22px; line-height: 1; }
  .mobile-nav button b { font-size: 12px; }
  .mobile-nav button[aria-current="page"] { color: #ff6963; border-color: rgba(255,59,48,.65); background: linear-gradient(180deg, rgba(255,59,48,.18), rgba(126,18,14,.15)); box-shadow: inset 0 0 18px rgba(255,59,48,.1); }
  .site-footer { padding-bottom: 90px; }
}

/* Narrow phones (including iPhone 15 portrait): every dashboard region owns no
   intrinsic width, so long API text cannot widen the viewport. */
@media (max-width: 430px) {
  main { max-width: 100vw; padding-inline: 12px; }
  #signed-in, .dashboard, .dashboard-hero, .dashboard-stats, .dashboard-lower,
  .dashboard-panel, .dashboard-activity, .dashboard-activity li { min-width: 0; max-width: 100%; }
  .dashboard-hero { padding-top: 18px; }
  .dashboard-actions { gap: 10px; }
  .dashboard-actions button { min-height: 52px; padding-inline: 12px; }
  .dashboard-stats { grid-template-columns: 1fr; gap: 10px; }
  .dashboard-stat { min-height: 92px; grid-template-columns: 46px minmax(0, 1fr); padding: 12px 14px; }
  .dashboard-stat > span:nth-child(2), .dashboard-stat b, .dashboard-stat strong { min-width: 0; overflow-wrap: anywhere; }
  .dashboard-lower { gap: 12px; }
  .dashboard-panel { width: 100%; padding: 14px; overflow: hidden; }
  .dashboard-panel h2 { font-size: 22px; }
  .dashboard-activity li { grid-template-columns: 52px minmax(0, 1fr) 10px; gap: 8px; }
  .dashboard-activity strong { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dashboard-quick { grid-template-columns: 1fr 1fr; gap: 8px; }
  .dashboard-quick button { min-width: 0; min-height: 94px; overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
@media (forced-colors: active) {
  button, button.ghost, .owner-nav .nav-tab, .section-nav button { border: 1px solid ButtonText; box-shadow: none; }
  .owner-nav .nav-tab[aria-current="page"], .section-nav button[aria-current="page"] { border-width: 3px; }
}
@media (prefers-contrast: more) {
  :root { --line: #737b87; --muted: #d0d4db; }
  .card, .task { border-width: 2px; }
}

