/* Identidade do Espelho Vivo: TODAS as cores, fontes e espacos ficam aqui.
   Padrao = Opcao 2 (clara e seca). Escuro so quando escolhido em Ajustes. */
:root {
  color-scheme: light;
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --card: #FFFFFF;
  --raised: #F0F0F2;
  --user-bubble: #111113;
  --on-user-bubble: #FFFFFF;
  --user-code-bg: rgba(255, 255, 255, 0.16);
  --hairline: rgba(0, 0, 0, 0.08);
  --hairline-strong: rgba(0, 0, 0, 0.14);
  --soft-fill: rgba(0, 0, 0, 0.05);
  --soft-fill-hover: rgba(0, 0, 0, 0.09);
  --close-bg: rgba(0, 0, 0, 0.06);
  --switch-off: #E5E5EA;
  --switch-on: #1A7F37;
  --knob: #FFFFFF;
  --tx: #111113;
  --tx2: #5B5B63;
  --tx3: #66666E;
  --fill: #111113;
  --on-fill: #FFFFFF;
  --focus: rgba(0, 0, 0, 0.28);
  --ok: #1A7F37;
  --ok-tx: #1A7F37;
  --ok-soft: rgba(26, 127, 55, 0.12);
  --on-ok: #FFFFFF;
  --warn: #9A6700;
  --warn-tx: #9A6700;
  --bad: #CF222E;
  --bad-ios: #CF222E;
  --bad-tx: #CF222E;
  --bad-soft: rgba(207, 34, 46, 0.1);
  --on-bad: #FFFFFF;
  --code-bg: #ECECEF;
  --frame-bg: #FFFFFF;
  --scroll-thumb: rgba(0, 0, 0, 0.2);
  --chrome: #FFFFFF;
  --scrim: rgba(0, 0, 0, 0.28);
  --sheet-shadow: 0 -12px 40px rgba(0, 0, 0, 0.14);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.18);
  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.08);
  --knob-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
  --theme-color: #F5F5F7;
  --radius: 14px;
  --radius-lg: 16px;
  --app-h: 100dvh;
  --vv-top: 0px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Consolas, monospace;
  --fs-small: 13px;
  --fs-label: 14px;
  --fs-body: 16px;
  --fs-title: 17px;
  --fs-h1: 28px;
  --fw-text: 500;
  --fw-strong: 600;
  --fw-heavy: 700;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --tap: 44px;
  --voice-size: 56px;
  --avatar: 36px;
  --nav-h: 56px;
  --nav-icon: 26px;
  --content-max: 680px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121316;
  --surface: #18191D;
  --card: #1C1D22;
  --raised: #24252B;
  --user-bubble: #2A2B31;
  --on-user-bubble: #F4F4F5;
  --user-code-bg: rgba(255, 255, 255, 0.1);
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.14);
  --soft-fill: rgba(255, 255, 255, 0.06);
  --soft-fill-hover: rgba(255, 255, 255, 0.11);
  --close-bg: rgba(255, 255, 255, 0.09);
  --switch-off: #39393D;
  --switch-on: #30D158;
  --knob: #FFFFFF;
  --tx: #F4F4F5;
  --tx2: #A1A1AA;
  --tx3: #94949C;
  --fill: #F4F4F5;
  --on-fill: #121316;
  --focus: rgba(255, 255, 255, 0.34);
  --ok: #30D158;
  --ok-tx: #4ADE80;
  --ok-soft: rgba(48, 209, 88, 0.14);
  --on-ok: #052E16;
  --warn: #FFD60A;
  --warn-tx: #FCD34D;
  --bad: #FF6961;
  --bad-ios: #FF453A;
  --bad-tx: #FCA5A5;
  --bad-soft: rgba(255, 69, 58, 0.12);
  --on-bad: #FFFFFF;
  --code-bg: #0E0F12;
  --frame-bg: #FFFFFF;
  --scroll-thumb: rgba(255, 255, 255, 0.18);
  --chrome: #18191D;
  --scrim: rgba(0, 0, 0, 0.48);
  --sheet-shadow: 0 -12px 40px rgba(0, 0, 0, 0.48);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.45);
  --shadow-card: 0 18px 40px rgba(0, 0, 0, 0.22);
  --knob-shadow: 0 2px 5px rgba(0, 0, 0, 0.28);
  --theme-color: #121316;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent !important; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 999px; }
::-webkit-scrollbar-button { display: none !important; width: 0; height: 0; }
::-webkit-scrollbar-corner { background: transparent !important; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
details:not([open]) > :not(summary) { display: none !important; }
svg { pointer-events: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ic { width: 20px; height: 20px; flex-shrink: 0; display: block; }
.ic-18 { width: 18px; height: 18px; }
.ic-16 { width: 16px; height: 16px; }
.ic-14 { width: 14px; height: 14px; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--tx);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

input, textarea, select {
  font-family: inherit;
  font-size: 16px;
  color: var(--tx);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 12px;
  padding: 10px 14px;
  min-height: 44px;
  width: 100%;
  outline: 2px solid transparent;
  outline-offset: 1px;
}
input::placeholder, textarea::placeholder {
  color: var(--tx3);
  opacity: 1;
}
input:focus-visible, textarea:focus-visible, select:focus-visible {
  border-color: var(--hairline-strong);
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

button {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
  outline: 2px solid transparent;
  outline-offset: 1px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 0.14s ease, opacity 0.14s ease, transform 0.12s ease;
}
button:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary, .btn-secondary, .btn-subtle, .btn-danger-soft {
  min-height: 44px;
  min-width: 44px;
  border-radius: 12px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--fill); color: var(--on-fill); }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: var(--raised); color: var(--tx); }
.btn-secondary:hover { background: var(--soft-fill-hover); }
.btn-subtle { background: transparent; color: var(--tx2); padding: 0 10px; border-radius: 10px; }
.btn-subtle:hover { color: var(--tx); background: var(--soft-fill); }
.btn-danger-soft { background: var(--bad-soft); color: var(--bad-ios); }
.btn-danger-soft:hover { opacity: 0.88; }
.mono { font-family: var(--mono); }

/* Auth */
#auth-view.auth-shell {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  gap: 14px;
  background: var(--bg);
}
.ios-banner {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
}
.ios-banner p { margin: 0; color: var(--tx); }

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-card);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.auth-brand h1 { margin: 0; font-size: 20px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
.auth-brand h2 { margin: 2px 0 0; font-size: 14px; font-weight: 500; color: var(--tx2); }
.sub { margin: 0 0 18px; color: var(--tx2); font-size: 14px; }
.section-label { margin: 0 0 12px; font-size: 15px; font-weight: 600; color: var(--tx); }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--tx2); }

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
  color: var(--tx);
  font-size: 14px;
}
.check-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  flex: 0 0 44px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  position: relative;
  box-shadow: none;
}
.check-row input[type="checkbox"]::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 11px;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1.5px solid var(--tx2);
  background: var(--surface);
}
.check-row input[type="checkbox"]:checked::before {
  border-color: var(--fill);
  background: var(--fill);
}
.check-row input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 19px;
  top: 15px;
  width: 6px;
  height: 11px;
  border-right: 2px solid var(--on-fill);
  border-bottom: 2px solid var(--on-fill);
  transform: rotate(42deg);
}

.auth-feedback {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bad-soft);
  color: var(--bad-tx);
  font-size: 14px;
}
.auth-feedback.ok { background: var(--ok-soft); color: var(--ok-tx); }
.pending-panel p { margin: 0 0 12px; font-size: 14px; color: var(--tx2); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > button { flex: 1 1 130px; }

/* App Shell & Clean iOS Header */
#app-view.app-shell {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--vv-top, 0px);
  height: var(--app-h, 100dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.topbar {
  z-index: 20;
  background: var(--chrome);
  border-bottom: 1px solid var(--hairline);
  padding: calc(4px + env(safe-area-inset-top)) 8px 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-shrink: 0;
  min-height: calc(52px + env(safe-area-inset-top));
}

.conn-dot {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--ok);
  flex: 0 0 6px;
  margin: 0 3px 0 6px;
}
.conn-dot.syncing {
  background: var(--warn);
  animation: pulseDot 1.2s ease-in-out infinite;
}

.agent-switch {
  flex: 0 1 auto;
  min-width: 0;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-1) var(--sp-2) var(--sp-1) var(--sp-1);
  border-radius: var(--radius);
  background: transparent;
  color: var(--tx);
  text-align: left;
}
@media (hover: hover) and (pointer: fine) {
  .agent-switch:hover { background: var(--soft-fill); }
}
.agent-avatar {
  width: var(--avatar);
  height: var(--avatar);
  flex: 0 0 var(--avatar);
  border-radius: 50%;
  background: var(--raised);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: var(--fw-heavy);
}
.agent-meta { display: flex; flex-direction: column; min-width: 0; }
.agent-name {
  font-size: var(--fs-title);
  font-weight: var(--fw-heavy);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-time { font-size: var(--fs-small); color: var(--tx2); line-height: 1.3; }
.agent-time:empty { display: none; }
.agent-chev { color: var(--tx2); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 0 0 auto;
}
.icon-btn {
  position: relative;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--tx2);
}
.icon-btn::before {
  content: "";
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: transparent;
  transition: background-color 0.14s ease;
}
.icon-btn:hover { color: var(--tx); }
.icon-btn:hover::before { background: var(--soft-fill-hover); }
.icon-btn > * { position: relative; z-index: 1; }

/* Circular iOS Sheet Close Button (30x30 visual, 44x44 tap target) */
.sheet-close-btn {
  position: relative;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: -7px -7px -7px 0;
  border-radius: 999px;
  background: transparent;
  color: var(--tx2);
  flex-shrink: 0;
}
.sheet-close-btn::before {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--close-bg);
  transition: background-color 0.14s ease;
}
.sheet-close-btn:hover { color: var(--tx); }
.sheet-close-btn:hover::before { background: var(--soft-fill-hover); }
.sheet-close-btn:focus-visible { outline: none; }
.sheet-close-btn:focus-visible::before {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.sheet-close-btn > * { position: relative; z-index: 1; }

/* Workspace & Messages Feed */
.workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  overflow: hidden;
}
.chat-pane {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.hud-stage-split {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.messages-feed {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 16px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.empty-state {
  margin: auto;
  padding: 24px 16px;
  text-align: center;
}
.empty-state p { margin: 0; color: var(--tx2); font-size: 14px; }

.msg {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 740px;
  margin-inline: auto;
  gap: 4px;
}
.msg.grouped { margin-top: -6px; }
.msg.user { align-items: flex-end; }
.msg.assistant { align-items: flex-start; }

.msg-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-small);
  color: var(--tx3);
  padding: 0 2px;
  line-height: 1.3;
}
.voice-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-small);
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--raised);
  border: 1px solid var(--hairline);
  color: var(--tx2);
}

.bubble {
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--tx);
  font-size: 16px;
  line-height: 1.58;
}
.msg.user .bubble {
  max-width: min(84%, 560px);
  background: var(--user-bubble);
  color: var(--on-user-bubble);
  border-radius: 20px 20px 6px 20px;
  padding: 10px 15px;
  font-size: 15.5px;
  line-height: 1.48;
}
.msg.assistant .bubble {
  width: 100%;
  max-width: 68ch;
  background: transparent;
  border: 0;
  padding: 2px;
}

.bubble p { margin: 0 0 10px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble h3, .bubble h4, .bubble h5 {
  margin: 14px 0 6px;
  font-weight: 600;
  line-height: 1.32;
  color: var(--tx);
  font-style: normal;
}
.bubble h3:first-child, .bubble h4:first-child, .bubble h5:first-child { margin-top: 0; }
.bubble h3 { font-size: 17px; }
.bubble h4 { font-size: 16px; }
.bubble h5 { font-size: 15px; color: var(--tx2); }

.bubble ul, .bubble ol {
  margin: 6px 0 10px;
  padding-left: 20px;
}
.bubble li { margin: 4px 0; }
.bubble li > ul, .bubble li > ol { margin: 4px 0; }

.bubble ul.task-list {
  list-style: none;
  padding-left: 0;
}
.bubble li.task-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 6px 0;
}
.task-icon {
  margin-top: 4px;
  color: var(--tx2);
  flex-shrink: 0;
}
.task-item.done .task-icon { color: var(--ok); }
.task-item.done .task-text { color: var(--tx2); text-decoration: line-through; text-decoration-color: var(--hairline-strong); }

.bubble blockquote {
  margin: 8px 0 10px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--hairline-strong);
  color: var(--tx2);
}
.bubble hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: 12px 0;
}
.bubble a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--hairline-strong);
  text-underline-offset: 3px;
}
.bubble a:hover { text-decoration-color: var(--tx); }

.bubble code {
  font-family: var(--mono);
  font-size: 13.5px;
  background: var(--raised);
  padding: 1px 5px;
  border-radius: 5px;
}
.msg.user .bubble code { background: var(--user-code-bg); }

.code-block {
  margin: 10px 0;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--code-bg);
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 6px 0 12px;
  min-height: 44px;
  border-bottom: 1px solid var(--hairline);
  font-size: var(--fs-small);
  color: var(--tx2);
}
.code-lang {
  font-family: var(--mono);
  font-size: var(--fs-small);
  color: var(--tx2);
}
.copy-code-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 10px;
  border-radius: 10px;
  background: transparent;
  color: var(--tx2);
  font-size: var(--fs-small);
  font-weight: 600;
}
.copy-code-btn:hover { color: var(--tx); background: var(--raised); }
.code-block pre {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.48;
  color: var(--tx);
}
.code-block pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

.table-wrap {
  margin: 10px 0;
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: 10px;
}
.bubble table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.bubble th, .bubble td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
}
.bubble th { font-weight: 600; color: var(--tx2); background: var(--surface); }
.bubble tr:last-child td { border-bottom: 0; }

.file-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.file-chip {
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--tx);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.file-chip:hover { background: var(--raised); border-color: var(--hairline-strong); }

.msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: -2px;
}
.copy-msg-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: transparent;
  color: var(--tx3);
  border-radius: 10px;
}
.copy-msg-btn:hover { color: var(--tx); background: var(--raised); }
@media (hover: hover) and (pointer: fine) {
  .msg-actions { opacity: 0.25; transition: opacity 0.14s ease; }
  .msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
}

/* Backstage Dock (Hidden when idle) & Floating Jump-to-Latest */
.feed-dock {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  flex-shrink: 0;
  background: var(--bg);
}
.backstage-pill {
  min-height: 44px;
  min-width: 44px;
  max-width: calc(100% - 24px);
  padding: 0 12px;
  background: transparent;
  color: var(--tx2);
  font-size: 13px;
  font-weight: 500;
  gap: 7px;
  border-radius: 999px;
}
.backstage-pill:hover { background: var(--surface); color: var(--tx); }
.backstage-pill[aria-expanded="true"] { background: var(--raised); color: var(--tx); }
.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--tx3);
  flex-shrink: 0;
}
.pill-dot.live {
  background: var(--ok);
  animation: pulseDot 1.2s ease-in-out infinite;
}
.pill-status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pill-count { display: none; }
.pill-chev { color: var(--tx3); transition: transform 0.16s ease; }
.backstage-pill[aria-expanded="true"] .pill-chev { transform: rotate(180deg); }

.jump-btn {
  position: absolute;
  right: 14px;
  bottom: 70px;
  z-index: 15;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--hairline-strong);
  color: var(--tx);
  box-shadow: var(--shadow-md);
}
.jump-btn::after {
  content: "";
  position: absolute;
  inset: -4px;
}
.chat-pane.has-dock .jump-btn { bottom: 112px; }
.chat-pane.has-upload .jump-btn { bottom: 116px; }
.chat-pane.has-dock.has-upload .jump-btn { bottom: 154px; }
.jump-btn:hover { background: var(--raised); }
.jump-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--on-fill);
  font-size: var(--fs-small);
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Backstage Bottom Sheet (Mobile) & Side Panel (>= 1080px) */
.backstage-scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--scrim);
}
.backstage-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  max-height: 76dvh;
  background: var(--card);
  border-top: 1px solid var(--hairline-strong);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--sheet-shadow);
  display: flex;
  flex-direction: column;
  padding: 6px 16px calc(16px + env(safe-area-inset-bottom));
  gap: 10px;
  animation: sheetIn 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-grabber {
  display: flex;
  justify-content: center;
  padding: 6px 0 2px;
  touch-action: none;
  cursor: grab;
}
.sheet-grabber span {
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: var(--hairline-strong);
}
.sheet-grabber-mobile { display: none; }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.sheet-head h2:focus { outline: none; }
.sheet-head-actions { display: flex; align-items: center; gap: 4px; }

.hud-activity-feed {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 30dvh;
  border-top: 1px solid var(--hairline);
}
.hud-empty {
  color: var(--tx2);
  font-size: 13.5px;
  padding: 14px 4px;
}
.hud-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--hairline);
}
.hud-card:last-child { border-bottom: 0; }
.hud-card-ic { color: var(--tx2); margin-top: 2px; flex-shrink: 0; }
.hud-card.subagent .hud-card-ic { color: var(--tx); }
.hud-card-main { flex: 1 1 auto; min-width: 0; }
.hud-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--tx);
}
.hud-card-ts {
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--tx3);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.hud-card-body {
  font-size: var(--fs-small);
  color: var(--tx2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.hud-terminal-live {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--code-bg);
  border: 1px solid var(--hairline);
  color: var(--tx2);
  font-size: var(--fs-small);
  line-height: 1.44;
  overflow: auto;
  white-space: pre-wrap;
  min-height: 120px;
  max-height: 30dvh;
}

.terminal-screen {
  flex: 1 1 auto;
  overflow: auto;
  margin: 0;
  padding: 14px;
  background: var(--code-bg);
  color: var(--tx);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

/* Composer (ChatGPT iOS style) + Compact Attachment Chip */
.status-toast {
  align-self: center;
  margin: 0 12px 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--raised);
  border: 1px solid var(--hairline-strong);
  color: var(--tx);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  max-width: min(92%, 440px);
  text-align: center;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}
.composer-bar {
  background: var(--chrome);
  border-top: 1px solid var(--hairline);
  padding: var(--sp-2) var(--sp-3);
  flex-shrink: 0;
}
html.kb-open .composer-bar {
  padding-bottom: 6px;
}
.composer-inner {
  max-width: 780px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.upload-preview {
  position: relative;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  max-width: min(100%, 340px);
  min-height: 36px;
  padding: 4px 6px 4px 10px;
  border-radius: 12px;
  background: var(--raised);
  border: 1px solid var(--hairline);
  overflow: hidden;
}
.upload-ic { color: var(--tx2); flex-shrink: 0; }
.upload-names {
  font-size: 13px;
  font-weight: 500;
  color: var(--tx);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.chip-close-btn {
  position: relative;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: -8px -6px -8px 0;
  border-radius: 999px;
  color: var(--tx2);
  flex-shrink: 0;
}
.chip-close-btn::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--close-bg);
}
.chip-close-btn:hover { color: var(--tx); }
.chip-close-btn > * { position: relative; z-index: 1; }
.upload-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: transparent;
}
.upload-fill { height: 100%; width: 0%; background: var(--fill); transition: width 0.12s linear; }

.composer-normal {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.composer-attach {
  position: relative;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  color: var(--tx2);
  flex-shrink: 0;
}
.composer-attach::before {
  content: "";
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--soft-fill);
  transition: background-color 0.14s ease;
}
.composer-attach:hover { color: var(--tx); }
.composer-attach:hover::before { background: var(--soft-fill-hover); }
.composer-attach > * { position: relative; z-index: 1; }

.composer-capsule {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--hairline-strong);
  border-radius: 22px;
  padding: 6px 6px 6px 14px;
  min-height: 46px;
  overflow: hidden;
  transition: border-color 0.14s ease, border-radius 0.14s ease;
}
.composer-capsule.is-multiline { border-radius: 18px; }
.composer-capsule:focus-within { border-color: var(--focus); }
#msg-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  max-height: 180px;
  box-sizing: border-box;
  resize: none;
  border: 0;
  border-radius: 0;
  padding: 6px 4px;
  line-height: 1.45;
  font-size: 16px;
  background: transparent;
  outline: none;
  overflow-y: auto;
  scroll-padding-top: 6px;
  scroll-padding-bottom: 6px;
}
#msg-input:focus-visible { outline: none; border-color: transparent; }

.composer-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin: -4px 0;
}
.btn-send, .mic-btn {
  position: relative;
  width: 40px;
  height: 44px;
  min-width: 40px;
  min-height: 44px;
  border-radius: 999px;
  padding: 0;
  flex-shrink: 0;
  animation: popIn 0.12s ease-out;
}
.btn-send { color: var(--on-fill); }
.btn-send::before {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--fill);
  transition: opacity 0.14s ease;
}
.btn-send:hover::before { opacity: 0.9; }
.btn-send > * { position: relative; z-index: 1; }

.mic-btn {
  color: var(--tx2);
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.mic-btn::before {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: transparent;
  transition: background-color 0.14s ease;
}
.mic-btn:hover { color: var(--tx); }
.mic-btn:hover::before { background: var(--soft-fill-hover); }
.mic-btn.recording { color: var(--on-bad); }
.mic-btn.recording::before { background: var(--bad); }
.mic-btn > * { position: relative; z-index: 1; }

/* Voice Bar (ChatGPT style cumulative dictation) */
.voice-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--hairline-strong);
  border-radius: 24px;
  padding: 4px 6px;
}
.voice-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.voice-rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--bad);
  flex-shrink: 0;
  animation: pulseDot 1s ease-in-out infinite;
}
.voice-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--tx);
  font-weight: 600;
  white-space: nowrap;
}
.voice-timer { font-size: 14px; font-weight: 700; min-width: 36px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.voice-wave { flex: 1 1 56px; min-width: 48px; width: 100%; height: 34px; border-radius: 8px; background: transparent; }
.voice-hint {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--fs-small);
  color: var(--tx2);
  white-space: nowrap;
  flex-shrink: 0;
}
.voice-lock-tip { margin: 0; font-size: var(--fs-small); color: var(--warn-tx); }
.voice-locked-actions { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.voice-ctl-btn, .voice-confirm-btn {
  position: relative;
  width: var(--tap);
  height: var(--tap);
  min-width: var(--tap);
  min-height: var(--tap);
  border-radius: 999px;
  padding: 0;
  flex-shrink: 0;
}
.voice-discard { background: var(--soft-fill); color: var(--tx2); }
.voice-discard:hover { background: var(--bad-soft); color: var(--bad-ios); }
.voice-pause { background: var(--soft-fill); color: var(--tx); }
.voice-pause:hover { background: var(--soft-fill-hover); }
.voice-confirm-btn { background: var(--fill); color: var(--on-fill); }
.voice-confirm-btn:hover { opacity: 0.9; }

/* Portals & iOS Settings Bottom Sheets */
.portals-pane {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--card);
  display: flex;
  flex-direction: column;
  padding: calc(10px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  gap: 10px;
  overflow-y: auto;
}
.portals-head, .stage-bar, .dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-shrink: 0; }
.portals-head h2, .stage-bar h3, .dlg-head h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.dlg-head h2:focus { outline: none; }
.stage-bar h3 { font-size: 15px; font-weight: 600; }
.portals-list { display: flex; flex-wrap: wrap; gap: 8px; }
.portals-list > button { max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.portal-pill {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--soft-fill);
  color: var(--tx2);
  font-size: 13px;
  font-weight: 600;
}
.portal-pill:hover { background: var(--soft-fill-hover); color: var(--tx); }
.portal-pill.active { background: var(--fill); color: var(--on-fill); }
.portal-stage { display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; min-height: 0; }
.stage-controls { display: flex; gap: 4px; flex-wrap: wrap; }
.portal-frame { width: 100%; flex: 1 1 420px; border: 1px solid var(--hairline); border-radius: 14px; background: var(--frame-bg); }
.shot-wrap { border: 1px solid var(--hairline); border-radius: 14px; overflow: hidden; background: var(--code-bg); }
.portal-shot { width: 100%; height: auto; display: block; cursor: crosshair; }
.portal-type-row { display: flex; gap: 8px; }
.portal-type-row button { flex-shrink: 0; }

.modal-dlg {
  border: 1px solid var(--hairline-strong);
  border-radius: 20px;
  background: var(--card);
  color: var(--tx);
  width: min(460px, calc(100vw - 24px));
  max-height: 85dvh;
  padding: 18px 20px;
  box-shadow: var(--shadow-lg);
}
.modal-dlg::backdrop {
  background: var(--scrim);
}
.modal-dlg.sheet-dlg[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dlg-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 14px;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
.dlg-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}
.more-agent-item {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--tx);
  justify-content: space-between;
  font-size: 15px;
  font-weight: 500;
  flex-shrink: 0;
}
.more-agent-item:hover { background: var(--raised); }
.more-agent-item.active {
  background: var(--raised);
  border-color: var(--hairline-strong);
  font-weight: 600;
}
.more-agent-status { font-size: 13px; color: var(--tx2); font-weight: 500; }
.more-agent-item.active .more-agent-status { color: var(--ok-tx); font-weight: 600; }

.settings-group {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  overflow: hidden;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--hairline);
}
.setting-row:last-child { border-bottom: 0; }
.setting-check-row { cursor: pointer; }
.setting-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--tx);
  line-height: 1.35;
  flex: 1 1 auto;
}

.seg-control {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 999px;
  background: var(--soft-fill);
  min-height: 44px;
  gap: 2px;
  flex-shrink: 0;
}
.seg-opt {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tx2);
  transition: background-color 0.14s ease, color 0.14s ease;
}
.seg-opt.active {
  background: var(--card);
  color: var(--tx);
  box-shadow: var(--shadow-sm);
}

.ios-switch-btn,
input.ios-switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 52px;
  height: 44px;
  min-width: 52px;
  min-height: 44px;
  flex: 0 0 52px;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}
.ios-switch-btn::before,
input.ios-switch::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 7px;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: var(--switch-off);
  transition: background-color 0.18s ease;
}
.ios-switch-btn::after,
input.ios-switch::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 9px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--knob);
  box-shadow: var(--knob-shadow);
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ios-switch-btn.on::before,
input.ios-switch:checked::before {
  background: var(--switch-on);
}
.ios-switch-btn.on::after,
input.ios-switch:checked::after {
  transform: translateX(20px);
}

.devices-section h3 {
  margin: 0 0 8px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tx2);
}
.devices-list {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  overflow: hidden;
}
.device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
}
.device-row:last-child { border-bottom: 0; }
.device-info { min-width: 0; }
.device-name { font-size: 14.5px; font-weight: 600; }
.device-sub { font-size: var(--fs-small); color: var(--tx2); margin-top: 1px; }
.device-actions { display: flex; gap: 6px; flex-wrap: nowrap; }

.dlg-footer { margin-top: 2px; }
.btn-logout {
  width: 100%;
  height: 46px;
  min-height: 46px;
  border-radius: 13px;
  background: var(--bad-soft);
  color: var(--bad-ios);
  font-size: 15px;
  font-weight: 600;
}
.btn-logout:hover { opacity: 0.9; }

/* Canais (lista de envios) */
.radar-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.radar-now-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.radar-now-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.radar-now-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--tx2);
}
.radar-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--tx3);
  flex-shrink: 0;
}
.radar-dot.live {
  background: var(--ok);
  animation: pulseDot 1.2s ease-in-out infinite;
}
.radar-updated {
  font-size: var(--fs-small);
  color: var(--tx3);
  font-variant-numeric: tabular-nums;
}
.radar-now-state {
  font-size: 15px;
  font-weight: 600;
  color: var(--tx);
  line-height: 1.35;
}
.radar-now-meta {
  font-size: 13px;
  color: var(--tx2);
  line-height: 1.35;
}
.radar-seg {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border-radius: 999px;
  background: var(--soft-fill);
  flex-shrink: 0;
}
.radar-seg-btn {
  min-height: 44px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--tx2);
  gap: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.radar-seg-btn:hover { color: var(--tx); }
.radar-seg-btn.active {
  background: var(--card);
  color: var(--tx);
  box-shadow: var(--shadow-sm);
}
.radar-seg-cnt {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.radar-seg-btn.has-alert:not(.active) .radar-seg-cnt { color: var(--warn-tx); }
.radar-list-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}
.radar-subnote {
  font-size: var(--fs-small);
  color: var(--tx2);
  padding: 0 4px;
}
.radar-day-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.radar-day-title {
  font-size: var(--fs-small);
  font-weight: 700;
  color: var(--tx2);
  padding: 0 4px;
}
.radar-items-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  overflow: hidden;
}
.radar-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
}
.radar-item:last-child { border-bottom: 0; }
.radar-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.radar-ch-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.radar-item-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.radar-time {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--tx2);
  font-variant-numeric: tabular-nums;
}
.radar-pill {
  font-size: var(--fs-small);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--soft-fill);
  color: var(--tx2);
  white-space: nowrap;
  flex-shrink: 0;
}
.radar-item-pedem .radar-ch-name {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.35;
  color: var(--tx);
}
.radar-unlock-btn {
  background: var(--fill);
  color: var(--on-fill);
  margin-top: 6px;
}
.radar-unlock-btn:hover { opacity: 0.9; background: var(--fill); }

.modal-dlg.remote-unlock-dlg {
  width: min(640px, calc(100vw - 24px));
  max-height: 90dvh;
}
.remote-unlock-head-info { min-width: 0; }
.remote-unlock-sub {
  font-size: var(--fs-small);
  color: var(--tx2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.remote-unlock-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.remote-unlock-native {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
}
.remote-unlock-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.remote-unlock-url {
  font-size: var(--fs-small);
  color: var(--tx2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.remote-unlock-status {
  font-size: 13px;
  color: var(--tx2);
  text-align: center;
  padding: 6px 8px;
}
.remote-unlock-status.err { color: var(--bad-tx); }
.remote-shot-wrap { flex: 0 0 auto; }
.remote-unlock-status.ok { color: var(--ok-tx); }
.remote-zoom-wrap { position: relative; flex: 0 0 auto; }
.remote-zoom-img { position: absolute; max-width: none; display: block; cursor: crosshair; touch-action: manipulation; }
.remote-zoom-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 600; color: var(--tx); }
.shot-wrap.stale { opacity: 0.4; filter: grayscale(1); }
.remote-unlock-hint { margin: 0; font-size: 13px; color: var(--tx2); text-align: center; }
.remote-paste-btn { width: 100%; min-height: 46px; flex-shrink: 0; }
#remote-unlock-input { flex: 1 1 auto; min-width: 0; min-height: 44px; font-size: 16px; }
.remote-finish-btn {
  width: 100%;
  min-height: 46px;
  background: var(--ok);
  color: var(--on-ok);
  border-radius: 12px;
  flex-shrink: 0;
}
.remote-unlock-iframe-wrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 480px;
}
.remote-unlock-frame {
  width: 100%;
  flex: 1 1 auto;
  min-height: 480px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--bg);
}
.radar-pill.live {
  background: var(--ok-soft);
  color: var(--ok-tx);
}
.radar-pill.warn {
  background: var(--bad-soft);
  color: var(--bad-tx);
}
.radar-video-title {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--tx);
  line-height: 1.4;
  word-break: break-word;
}
.radar-item-sub {
  font-size: 13px;
  color: var(--tx2);
  line-height: 1.38;
}
.radar-open-link {
  align-self: flex-start;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--raised);
  color: var(--tx);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.radar-open-link:hover { background: var(--soft-fill-hover); }
.radar-empty {
  padding: 24px 12px;
  text-align: center;
  font-size: 14px;
  color: var(--tx2);
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.88); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes sheetIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (max-width: 719px) {
  .sheet-grabber-mobile { display: flex; }
  .modal-dlg.sheet-dlg {
    margin: auto 0 0;
    width: 100%;
    max-width: 100%;
    max-height: 88dvh;
    border: 0;
    border-top: 1px solid var(--hairline-strong);
    border-radius: 22px 22px 0 0;
    padding: 6px 18px calc(18px + env(safe-area-inset-bottom));
    box-shadow: var(--sheet-shadow);
    animation: sheetIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .portals-pane {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    height: 88dvh;
    max-height: 88dvh;
    border-top: 1px solid var(--hairline-strong);
    border-radius: 22px 22px 0 0;
    box-shadow: var(--sheet-shadow);
    padding: 6px 18px calc(18px + env(safe-area-inset-bottom));
    animation: sheetIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
}

@media (max-width: 374px) {
  .topbar { padding-inline: 6px; gap: 4px; }
  .conn-dot { margin: 0 2px 0 4px; }
}

@media (min-width: 720px) {
  .topbar { padding: 6px 16px; gap: 12px; }
  .messages-feed { padding: 20px 24px 14px; }
}

@media (min-width: 1080px) {
  .backstage-scrim { display: none !important; }
  .backstage-sheet {
    position: static;
    width: 400px;
    max-height: none;
    flex-shrink: 0;
    border-top: 0;
    border-left: 1px solid var(--hairline);
    border-radius: 0;
    box-shadow: none;
    padding: 12px 14px;
    animation: none;
  }
  .hud-stage-split { flex-direction: row; }
  .sheet-grabber { display: none; }
  .hud-activity-feed { max-height: 44dvh; }
  .hud-terminal-live { flex: 1 1 auto; max-height: none; }

  body.split-mode .portals-pane {
    position: static;
    width: 440px;
    flex-shrink: 0;
    border-left: 1px solid var(--hairline);
    padding: 12px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Lote 1: botao de voz grande, areas e barra fixa embaixo */
.composer-normal { align-items: flex-end; }
.mic-btn.voice-big {
  width: var(--voice-size);
  height: var(--voice-size);
  min-width: var(--voice-size);
  min-height: var(--voice-size);
  margin-bottom: -5px;
  color: var(--on-fill);
}
.mic-btn.voice-big::before { width: var(--voice-size); height: var(--voice-size); background: var(--fill); }
.mic-btn.voice-big:hover { color: var(--on-fill); }
.mic-btn.voice-big:hover::before { background: var(--fill); opacity: 0.9; }
.mic-btn.voice-big.recording::before { background: var(--bad); }
.mic-btn.voice-big .ic { width: 24px; height: 24px; }

#app-view[data-area="canais"] .topbar,
#app-view[data-area="canais"] .workspace,
#app-view[data-area="resolver"] .topbar,
#app-view[data-area="resolver"] .workspace { display: none; }

.area-view {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-top: env(safe-area-inset-top);
}
.area-head, .area-body {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
}
.area-head { padding: var(--sp-4) var(--sp-4) var(--sp-2); }
.area-head h1 {
  margin: 0;
  font-size: var(--fs-h1);
  font-weight: var(--fw-heavy);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.area-sub { margin: var(--sp-1) 0 0; color: var(--tx2); font-size: 15px; }
.area-body { padding: var(--sp-2) var(--sp-4) var(--sp-5); }
.area-view .radar-body { padding: var(--sp-2) var(--sp-4) var(--sp-5); max-height: none; overflow: visible; }

/* Canais (lote 2): situação no topo + listas de hoje */
.canais-aviso {
  margin: 0 0 var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  background: var(--raised);
  color: var(--warn-tx);
  font-size: var(--fs-label);
  font-weight: var(--fw-strong);
}
.situacao { margin: var(--sp-1) 0 var(--sp-4); padding: var(--sp-4); border-radius: var(--radius-lg); background: var(--card); }
.situacao-frase { margin: 0; font-size: 19px; font-weight: var(--fw-strong); line-height: 1.35; }
.situacao-sub { margin: 6px 0 0; color: var(--tx2); font-size: 15px; }
.situacao-trava {
  display: block;
  width: 100%;
  min-height: var(--tap);
  margin: 6px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--warn-tx);
  font: inherit;
  font-size: 15px;
  font-weight: var(--fw-strong);
  text-align: left;
  white-space: normal;
  line-height: 1.4;
  cursor: pointer;
}
.nums { display: flex; gap: var(--sp-2); margin-top: 14px; }
.num { flex: 1; min-width: 0; padding: 10px var(--sp-3); border-radius: var(--radius); background: var(--raised); }
.num b { display: block; font-size: 22px; font-weight: var(--fw-heavy); line-height: 1.1; }
.num span { font-size: var(--fs-small); color: var(--tx2); }
.grupo { margin: 0 0 18px; }
.grupo h2 {
  margin: 0 var(--sp-1) var(--sp-2);
  font-size: var(--fs-small);
  font-weight: var(--fw-strong);
  color: var(--tx2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lista { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.lista .item {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-3) 14px;
  min-height: 60px;
  border-top: 1px solid var(--hairline);
  color: var(--tx);
  text-decoration: none;
}
.lista .item:first-child { border-top: 0; }
.lista .item-vazio { color: var(--tx2); font-size: 15px; }
.lista .hora { width: 48px; flex: none; font-weight: var(--fw-heavy); font-size: 15px; }
.lista .it { flex: 1; min-width: 0; }
.lista .it b, .lista .it span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista .it b { font-size: 15px; font-weight: var(--fw-strong); }
.lista .it span { font-size: var(--fs-small); color: var(--tx2); }
.lista .tag { flex: none; font-size: var(--fs-small); font-weight: var(--fw-strong); }
.lista .tag.ok { color: var(--ok-tx); }
.lista .tag.warn { color: var(--warn-tx); }
.lista .mais {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: var(--sp-3);
  border: 0;
  border-top: 1px solid var(--hairline);
  background: transparent;
  color: var(--tx);
  font: inherit;
  font-size: 15px;
  font-weight: var(--fw-strong);
  text-decoration: underline;
  cursor: pointer;
}

.trava-card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
}
.trava-imp { font-size: var(--fs-small); font-weight: var(--fw-strong); color: var(--bad); }
.trava-imp.calmo { color: var(--tx2); }
.trava-motivo {
  margin: 6px 0 var(--sp-1);
  font-size: var(--fs-title);
  font-weight: var(--fw-strong);
  line-height: 1.35;
}
.trava-canais { margin: 0; font-size: var(--fs-label); color: var(--tx2); }
.trava-btn { width: 100%; min-height: 48px; margin-top: var(--sp-3); }
.trava-outros { margin: var(--sp-2) var(--sp-1) 0; font-size: var(--fs-label); color: var(--tx2); }

.setting-link {
  width: 100%;
  background: transparent;
  color: var(--tx);
  text-align: left;
  min-height: var(--tap);
}

.bottom-nav {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-2) calc(var(--sp-1) + env(safe-area-inset-bottom));
  background: var(--chrome);
  border-top: 1px solid var(--hairline);
  z-index: 20;
}
html.kb-open .bottom-nav { display: none; }
/* iPhone em tela cheia: a página (848) cortava a barra que já ia até a borda (896) */
html.ios-cheia, html.ios-cheia body { height: var(--app-h); min-height: var(--app-h); }
.nav-btn {
  position: relative;
  flex: 1 1 0;
  max-width: 200px;
  min-height: var(--nav-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  color: var(--tx2);
  font-size: var(--fs-small);
  font-weight: var(--fw-strong);
  border-radius: var(--radius);
}
.nav-btn.active { color: var(--tx); }
.nav-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.nav-ic { width: var(--nav-icon); height: var(--nav-icon); }
.nav-badge {
  position: absolute;
  top: 2px;
  left: calc(50% + 6px);
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--bad);
  color: var(--on-bad);
  font-size: var(--fs-small);
  font-weight: var(--fw-heavy);
  line-height: 20px;
  text-align: center;
}

/* Lote 4: entrar com Face ID */
.passkey-login { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.btn-passkey { width: 100%; min-height: 52px; font-size: 17px; }
.passkey-or { margin: 0; text-align: center; color: var(--tx2); font-size: 14px; }
#passkey-section .btn-passkey { margin: 6px 0 10px; }
.more-agent-item.closed { opacity: 0.55; }
.more-agent-item.closed .more-agent-status { color: var(--tx3); font-weight: 500; }
.devices-subhead { margin: 0; padding: 12px 14px 4px; font-size: var(--fs-small); color: var(--tx2); }
