:root {
  color-scheme: dark;
  /* Theme channels — flipped per theme so every overlay/blur adapts from one switch. */
  --ov-rgb: 255 255 255;     /* overlays (cards, borders, hovers) */
  --blur-rgb: 10 10 10;      /* translucent sticky/nav backgrounds */
  --bg: #0a0a0a;
  --bg-elev: #1a1a1a;
  --bg-card: rgb(var(--ov-rgb) / 0.04);
  --text: #f5f5f0;
  --text-muted: rgba(245, 245, 240, 0.6);
  --text-faint: rgba(245, 245, 240, 0.35);
  --gold: #d4af37;
  --gold-soft: rgba(212, 175, 55, 0.14);
  --border: rgb(var(--ov-rgb) / 0.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Light theme — set via <html data-theme="light"> (JS resolves System/Light/Dark).
   --bg-card and --border auto-adapt because they reference --ov-rgb. Gold drops to
   the darker shade so it stays readable on a light background. */
:root[data-theme="light"] {
  color-scheme: light;
  --ov-rgb: 20 18 15;        /* overlays become subtle warm-dark tints */
  --blur-rgb: 247 246 242;   /* sticky/nav backgrounds become light */
  --bg: #f7f6f2;
  --bg-elev: #ffffff;
  --text: #1a1815;
  --text-muted: rgba(26, 24, 21, 0.64);
  --text-faint: rgba(26, 24, 21, 0.42);
  --gold: #8f6f2b;
  --gold-soft: rgba(143, 111, 43, 0.13);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

body { padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); }

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ============== Login screen ============== */
.login {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 1.5rem;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.brand { text-align: center; margin-bottom: 1rem; }
.brand-mark {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 4.5rem;
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0;
  display: inline-block;
  position: relative;
}
.brand-mark::after {
  content: '';
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 0.12em;
  height: 2px;
  background: var(--gold);
}
.brand-sub {
  margin: 0.85rem 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-muted);
}

label {
  display: block;
  font-size: 0.8rem;
  margin: 1.25rem 0 0.5rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

input[type=email], input[type=text] {
  width: 100%;
  padding: 1rem 1.1rem;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 1rem;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s, background 0.15s;
}
input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgb(var(--ov-rgb) / 0.06);
}

button {
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
}
button:active { transform: scale(0.98); }
button.primary { background: var(--text); color: var(--bg); margin-top: 1.25rem; }
button.secondary {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
button:disabled { opacity: 0.4; cursor: not-allowed; }

.pill {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 500;
}
.pill-center { display: block; text-align: center; max-width: max-content; margin: 0 auto 1.25rem; }

.helper {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.8rem;
  margin-top: 1rem;
}

/* ============== Install onboarding modal ============== */
.install-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 8, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  padding-top: calc(var(--safe-top) + 1rem);
  padding-bottom: calc(var(--safe-bottom) + 1.25rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.install-header { text-align: center; margin-bottom: 1.5rem; }
.install-header .pill { margin-bottom: 0.75rem; }
.install-header h2 {
  margin: 0.5rem 0 0.5rem;
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}
.install-header p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
  font-size: 0.95rem;
}

.install-step {
  margin: 1rem 0;
  padding: 1.25rem;
  background: var(--bg-card);
  border-radius: 18px;
  border: 1px solid var(--border);
}
.install-step-head { display: flex; align-items: center; gap: 0.75rem; }
.install-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.install-step-title { font-weight: 500; font-size: 1.05rem; }
.install-step-detail {
  margin: 0.6rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.install-mock {
  margin: 0.85rem 0 0;
  background: #181818;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.install-mock svg { max-width: 100%; height: auto; }

.install-actions { margin-top: 1rem; }
.install-actions button + button { margin-top: 0.75rem; }

.install-tip {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  background: var(--gold-soft);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.5;
}
.install-tip strong { color: var(--gold); font-weight: 600; }

/* ============== Auth flow extras ============== */
.screen-h2 {
  margin: 1.5rem 0 0.75rem;
  font-weight: 400;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
}
.screen-p {
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

.error-msg {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: rgba(220, 60, 60, 0.12);
  border: 1px solid rgba(220, 60, 60, 0.3);
  border-radius: 12px;
  color: #ff9a9a;
  font-size: 0.9rem;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85em;
  background: rgb(var(--ov-rgb) / 0.06);
  padding: 0.1em 0.4em;
  border-radius: 4px;
}

.step-banner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  background: var(--gold-soft);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 14px;
  margin: 1rem 0;
}
.check {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}
.check-large { width: 56px; height: 56px; font-size: 1.8rem; margin: 0 auto 1.25rem; }
.step-title { font-weight: 500; }
.step-sub { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.1rem; }

.warning-banner {
  padding: 1rem 1.15rem;
  background: rgba(220, 60, 60, 0.1);
  border: 1px solid rgba(220, 60, 60, 0.35);
  border-radius: 14px;
  margin: 1rem 0;
  color: var(--text);
  line-height: 1.5;
  font-size: 0.9rem;
}
.warning-banner strong { color: #ffb6b6; letter-spacing: 0.02em; }

.recovery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 1rem 0 1.25rem;
}
.recovery-code {
  position: relative;
  padding: 0.65rem 0.85rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-align: center;
}
.recovery-idx {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 0.65rem;
  color: var(--text-faint);
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
@media (max-width: 380px) {
  .recovery-grid { grid-template-columns: 1fr; }
}

.welcome-card {
  text-align: center;
  margin: 2rem 0;
  padding: 2rem 1rem;
}

/* ============== Chat ============== */
.chat-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  padding-top: calc(var(--safe-top) + 0.85rem);
  border-bottom: 1px solid var(--border);
  background: rgb(var(--blur-rgb) / 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.chat-brand { display: flex; align-items: center; gap: 0.75rem; }
.brand-mark-sm {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  position: relative;
}
.brand-mark-sm::after {
  content: '';
  position: absolute;
  left: 8%; right: 8%; bottom: 0.05em;
  height: 1.5px;
  background: var(--gold);
}
.chat-tag {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-left: 0.5rem;
  border-left: 1px solid var(--border);
}
.iconbtn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: transparent;
  color: var(--gold);
  border: 1px solid rgba(212, 175, 55, 0.3);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.iconbtn:hover {
  color: #e8c659;
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.08);
}

.chat-stream {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.25rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.chat-stream::-webkit-scrollbar { width: 6px; }
.chat-stream::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.chat-empty {
  margin: auto;
  text-align: center;
  padding: 1rem;
  max-width: 420px;
}
.chat-empty-h {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 300;
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}
.chat-empty-p {
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}

.bubble {
  display: flex;
  max-width: 100%;
}
.bubble-body {
  padding: 0.7rem 1rem;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 0.95rem;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  max-width: min(85%, 580px);
}
.bubble-user {
  justify-content: flex-end;
}
.bubble-user .bubble-body {
  background: var(--text);
  color: var(--bg);
  border-bottom-right-radius: 6px;
}
.bubble-assistant {
  justify-content: flex-start;
}
.bubble-assistant .bubble-body {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}
.bubble-error .bubble-body {
  background: rgba(220, 60, 60, 0.12);
  border: 1px solid rgba(220, 60, 60, 0.3);
  color: #ff9a9a;
  font-size: 0.85rem;
}

/* Markdown links + auto-linked URLs in chat bubbles. Subtle gold; underline
   on hover only, so dense paragraphs don't look cluttered. */
.bubble-body a {
  color: var(--gold, #d4af37);
  text-decoration: none;
  border-bottom: 1px dotted rgba(212, 175, 55, 0.4);
  word-break: break-word;
}
.bubble-body a:hover {
  color: #e8c659;
  border-bottom-color: var(--gold, #d4af37);
}
.bubble-body code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.86em;
  background: rgb(var(--ov-rgb) / 0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

.typing .bubble-body {
  padding: 0.85rem 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.dot {
  width: 7px; height: 7px;
  background: var(--text-faint);
  border-radius: 50%;
  display: inline-block;
  animation: typing-bounce 1.4s infinite ease-in-out;
}
.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  padding-bottom: calc(var(--safe-bottom) + 0.75rem);
  border-top: 1px solid var(--border);
  background: rgb(var(--blur-rgb) / 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.chat-composer textarea {
  flex: 1;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  resize: none;
  line-height: 1.4;
  -webkit-appearance: none;
  max-height: 220px;
  min-height: 44px;
}
.chat-composer textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: rgb(var(--ov-rgb) / 0.06);
}
.composer-send {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  border: none;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}
.composer-send:active { transform: scale(0.93); }
.composer-send:disabled { opacity: 0.35; cursor: not-allowed; }

.chat-actions { display: flex; align-items: center; gap: 0.6rem; }
.google-status {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile (portrait phones): stack the header into two rows so all 4 action
   buttons (+ ✓ ⚙ ⏻) fit without horizontal overflow. Row 1 is brand +
   tenant tag; row 2 is the action menu bar. The google-status badge sits
   on the action row, anchored left, with the buttons aligned right. */
@media (max-width: 600px) {
  .chat-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.75rem 1rem;
    padding-top: calc(var(--safe-top) + 0.75rem);
  }
  .chat-brand {
    justify-content: flex-start;
  }
  .chat-actions {
    width: 100%;
    justify-content: flex-end;
    gap: 0.5rem;
  }
  .google-status {
    margin-right: auto;
    max-width: 50%;
  }
  /* Tighten the chat-tag if the tenant name is long so the brand row stays
     on one line. */
  .chat-tag {
    max-width: 60vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.connect-block {
  margin: 0.5rem auto 1.5rem;
  padding: 1.25rem 1.25rem 1.35rem;
  background: var(--gold-soft);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 16px;
  max-width: 580px;
  width: 100%;
}
.connect-h {
  font-weight: 500;
  font-size: 1.05rem;
  margin: 0 0 0.35rem;
  color: var(--text);
}
.connect-p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 1rem;
}
.connect-block .primary {
  margin-top: 0;
  background: var(--gold);
  color: var(--bg);
}
.connect-fine {
  color: var(--text-faint);
  font-size: 0.75rem;
  margin: 0.75rem 0 0;
  line-height: 1.4;
}

/* ============== Attachments ============== */
.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}
.composer-attach {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg-elev);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.composer-attach:active { transform: scale(0.93); }
.composer-attach:hover { color: var(--text); border-color: var(--text-muted); }

.staged-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 0 0.55rem;
}
.staged-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.55rem 0.4rem 0.7rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
  max-width: 240px;
}
.staged-icon { font-size: 0.9rem; line-height: 1; }
.staged-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
}
.staged-status { color: var(--text-muted); font-size: 0.7rem; }
.staged-status.err { color: #ff9a9a; }
.staged-x {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-faint);
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}
.staged-x:hover { color: var(--text); background: rgb(var(--ov-rgb) / 0.06); }

.bubble-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}
.att-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  background: rgb(var(--ov-rgb) / 0.08);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  font-size: 0.8rem;
  max-width: 220px;
}
.bubble-user .att-chip {
  background: rgba(0,0,0,0.12);
  color: var(--bg);
}
.att-chip { cursor: pointer; }
.att-chip:hover { background: rgb(var(--ov-rgb) / 0.12); }

/* In-app attachment viewer modal. Full-screen on small screens, large
   centered card on desktop. Provides the close button + download link
   the chromeless PWA webview doesn't. */
.att-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
}
.att-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.9rem;
  background: rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid rgb(var(--ov-rgb) / 0.08);
  padding-top: max(0.6rem, env(safe-area-inset-top));
}
.att-viewer-title {
  color: var(--text, #f5f5f0);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  max-width: 60vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.att-viewer-actions { display: flex; gap: 0.4rem; }
/* Strip iOS Safari's native button styling so width/height/border-radius
   are honored consistently. Without -webkit-appearance:none, iOS imposes
   its own minimum touch-target padding which makes one button rectangular
   and the other circular. box-sizing:border-box keeps the border inside
   the declared dimensions. */
.att-viewer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  max-width: 40px;
  min-height: 40px;
  max-height: 40px;
  box-sizing: border-box;
  background: rgb(var(--ov-rgb) / 0.08);
  border: 1px solid rgb(var(--ov-rgb) / 0.12);
  border-radius: 50%;
  color: var(--text, #f5f5f0);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 40px;
  line-height: 1;
}
.att-viewer-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}
.att-viewer-btn:hover { background: rgb(var(--ov-rgb) / 0.16); }
.att-viewer-download { color: var(--gold, #d4af37); }
.att-viewer-download:hover { background: rgba(212, 175, 55, 0.16); }
.att-viewer-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
}
.att-viewer-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.att-viewer-image {
  max-width: 100%;
  max-height: 100%;
  display: block;
}
.att-viewer-fallback {
  color: var(--text-muted, rgba(245,245,240,0.62));
  text-align: center;
  padding: 2rem 1.5rem;
}
.att-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
}
.att-size { opacity: 0.6; font-size: 0.72rem; }

.chat-stream.dragover {
  background: rgba(212, 175, 55, 0.06);
  outline: 2px dashed rgba(212, 175, 55, 0.5);
  outline-offset: -8px;
}

/* ============== Settings view ============== */
.settings-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}
.settings-body {
  padding: 1.25rem 1.25rem calc(var(--safe-bottom) + 2rem);
  overflow-y: auto;
}
.settings-section {
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.settings-body label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 1rem 0 0.4rem;
  display: block;
}
.settings-body input[type=text],
.settings-body input[type=email],
.settings-body select,
.settings-body textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  -webkit-appearance: none;
  appearance: none;
}
.settings-body select { background-image: none; padding-right: 1rem; }
.settings-body input:focus, .settings-body textarea:focus, .settings-body select:focus {
  outline: none; border-color: var(--gold);
}
.settings-body input:disabled, .settings-body textarea:disabled, .settings-body select:disabled {
  opacity: 0.6; cursor: not-allowed;
}
.helper-small {
  color: var(--text-faint);
  font-size: 0.78rem;
  margin: 0.4rem 0 0;
  line-height: 1.4;
}
.check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 1rem;
  margin-top: 0.5rem;
}
.alias-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.alias-row input { flex: 1; min-width: 0; }
.alias-row button { white-space: nowrap; }

.push-status {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.92rem;
  margin: 0.5rem 0 0.4rem;
  line-height: 1.5;
}
.push-status-ok    { background: var(--gold-soft, rgba(212,175,55,0.14)); border: 1px solid rgba(212,175,55,0.3); }
.push-status-info  { background: rgb(var(--ov-rgb) / 0.04); border: 1px solid rgb(var(--ov-rgb) / 0.08); }
.push-status-warn  { background: rgba(220,80,80,0.10); border: 1px solid rgba(220,80,80,0.30); }
.push-status-detail { color: var(--text-dim, rgba(245,245,240,0.62)); font-size: 0.86rem; margin-top: 0.2rem; }
@media (max-width: 480px) { .check-grid { grid-template-columns: 1fr; } }
.check-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  padding: 0.5rem 0.7rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}
.check-cell input[type=checkbox] {
  accent-color: var(--gold);
  width: 16px; height: 16px;
}
#f-save { margin-top: 2rem; }
.settings-status {
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
}
.settings-status.ok { background: var(--gold-soft); color: var(--text); border: 1px solid rgba(212,175,55,0.3); }
.settings-status.err { background: rgba(220,60,60,0.12); color: #ff9a9a; border: 1px solid rgba(220,60,60,0.3); }

/* ============== Approval cards (trust framework) ============== */

.approval-card {
  margin-top: 0.85rem;
  padding: 0.8rem 0.95rem;
  border-radius: 12px;
  border: 1px solid rgb(var(--ov-rgb) / 0.08);
  background: rgb(var(--ov-rgb) / 0.025);
  font-size: 0.92rem;
}
.approval-card.tier-yellow { border-color: rgba(212,175,55,0.45); background: rgba(212,175,55,0.06); }
.approval-card.tier-red    { border-color: rgba(220,80,80,0.55); background: rgba(220,80,80,0.06); }
.approval-card.tier-green  { border-color: rgba(80,200,120,0.45); background: rgba(80,200,120,0.05); }

.approval-loading { color: var(--text-dim, #888); font-style: italic; }

.approval-header {
  display: flex; justify-content: space-between; gap: 0.5rem;
  font-size: 0.78rem; opacity: 0.85; margin-bottom: 0.4rem;
}
.approval-tier-pill {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.approval-byline {
  font-size: 0.82rem;
  font-style: italic;
  opacity: 0.62;
  margin-bottom: 0.4rem;
  letter-spacing: 0.01em;
}
.approval-summary { margin-bottom: 0.15rem; }
.approval-recipient { font-size: 0.86rem; opacity: 0.75; margin-bottom: 0.5rem; }
.approval-from {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0 0.5rem;
  padding: 0.5rem 0.7rem;
  background: rgb(var(--ov-rgb) / 0.03);
  border: 1px solid rgb(var(--ov-rgb) / 0.06);
  border-radius: 6px;
  font-size: 0.86rem;
}
.approval-from-text { opacity: 0.85; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 0.84rem; }
.approval-from-mode { opacity: 0.55; font-style: italic; font-family: inherit; }
.appr-from-toggle {
  background: transparent;
  border: 1px solid var(--gold, #d4af37);
  color: var(--gold, #d4af37);
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.appr-from-toggle:hover { background: rgba(212,175,55,0.1); }
.appr-from-toggle:disabled { opacity: 0.5; cursor: not-allowed; }

.approval-body, .approval-reasoning {
  margin: 0.35rem 0;
  font-size: 0.85rem;
}
.approval-body pre, .approval-reasoning pre {
  margin: 0.4rem 0 0;
  padding: 0.55rem 0.7rem;
  background: rgba(0,0,0,0.25);
  border-radius: 7px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
  line-height: 1.4;
}
.approval-body summary, .approval-reasoning summary {
  cursor: pointer;
  opacity: 0.8;
  user-select: none;
}

.approval-state {
  margin-top: 0.55rem;
  padding: 0.4rem 0.6rem;
  border-radius: 7px;
  font-size: 0.86rem;
}
.approval-state-done     { background: rgba(80,200,120,0.12); color: #a8e8b8; }
.approval-state-rejected { background: rgba(220,80,80,0.12);  color: #f5a8a8; }

.approval-buttons {
  margin-top: 0.7rem;
  display: flex; flex-wrap: wrap; gap: 0.45rem;
}
.appr-btn {
  border: 1px solid rgb(var(--ov-rgb) / 0.12);
  background: rgb(var(--ov-rgb) / 0.04);
  color: var(--text, #eee);
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  font-size: 0.86rem;
  cursor: pointer;
}
.appr-btn:hover:not(:disabled) { background: rgb(var(--ov-rgb) / 0.08); }
.appr-btn:disabled { opacity: 0.55; cursor: default; }
.appr-approve { background: rgba(80,200,120,0.15); border-color: rgba(80,200,120,0.4); }
.appr-reject  { background: rgba(220,80,80,0.12);  border-color: rgba(220,80,80,0.35); }
.appr-pattern { font-size: 0.82rem; opacity: 0.92; }

.approval-reject-panel {
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px dashed rgb(var(--ov-rgb) / 0.1);
}
.approval-reject-label { font-size: 0.82rem; opacity: 0.75; margin-bottom: 0.4rem; }
.approval-reject-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.5rem; }
.reject-chip {
  border: 1px solid rgb(var(--ov-rgb) / 0.12);
  background: rgb(var(--ov-rgb) / 0.03);
  color: var(--text, #eee);
  padding: 0.32rem 0.62rem;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
}
.reject-chip.selected { background: rgba(212,175,55,0.18); border-color: rgba(212,175,55,0.45); }
.approval-reject-note {
  display: block;
  width: 100%;
  margin: 0.4rem 0 0.55rem;
  padding: 0.4rem 0.55rem;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgb(var(--ov-rgb) / 0.1);
  border-radius: 7px;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 2.2em;
}
.approval-reject-actions { display: flex; gap: 0.4rem; justify-content: flex-end; }

.approval-error {
  color: #f5a8a8;
  font-size: 0.85rem;
}

/* ============== Auto-execute modal ============== */

.auto-exec-modal {
  position: fixed; inset: 0;
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.auto-exec-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
}
.auto-exec-panel {
  position: relative;
  max-width: 640px;
  width: calc(100% - 2rem);
  max-height: 80vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--bg, #111);
  border: 1px solid rgb(var(--ov-rgb) / 0.1);
  border-radius: 14px;
  padding: 1rem 1.1rem;
}
.auto-exec-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.7rem;
}
.auto-exec-head h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.auto-exec-list { overflow-y: auto; padding-right: 0.2rem; }
.auto-exec-empty { opacity: 0.6; padding: 1rem 0.5rem; text-align: center; }
.auto-exec-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 0.8rem;
  padding: 0.55rem 0;
  border-bottom: 1px dashed rgb(var(--ov-rgb) / 0.07);
}
.auto-exec-when { grid-column: 1 / 3; font-size: 0.78rem; opacity: 0.55; }
.auto-exec-summary { font-size: 0.92rem; }
.auto-exec-icon { margin-right: 0.4rem; opacity: 0.85; }
.auto-exec-contact { opacity: 0.7; margin-left: 0.3rem; }
.auto-exec-actions { display: flex; align-items: center; }
.auto-exec-revert {
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 7px;
  border: 1px solid rgba(220,80,80,0.4);
  background: rgba(220,80,80,0.1);
  color: var(--text);
  cursor: pointer;
}
.auto-exec-revert:hover:not(:disabled) { background: rgba(220,80,80,0.2); }
.auto-exec-revert.reverted { opacity: 0.5; cursor: default; }
.auto-exec-reverted { font-size: 0.8rem; opacity: 0.6; }
.auto-exec-note { font-size: 0.78rem; opacity: 0.7; margin-top: 0.3rem; }

/* Edit & approve panel — moat for diff capture */
.approval-edit-panel {
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px dashed rgb(var(--ov-rgb) / 0.1);
}
.approval-edit-label {
  font-size: 0.82rem;
  opacity: 0.75;
  margin-bottom: 0.55rem;
}
.approval-edit-field {
  display: block;
  margin-bottom: 0.55rem;
}
.approval-edit-field span {
  display: block;
  font-size: 0.78rem;
  opacity: 0.75;
  margin-bottom: 0.25rem;
}
.approval-edit-field input,
.approval-edit-field textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgb(var(--ov-rgb) / 0.12);
  border-radius: 7px;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  resize: vertical;
}
.approval-edit-field textarea {
  min-height: 6rem;
  line-height: 1.45;
}
.approval-edit-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}
.appr-edit-confirm { background: rgba(212,175,55,0.22); border-color: rgba(212,175,55,0.5); }

/* ============== Brand lockup (login / empty state) ============== */
.brand-lockup {
  display: block;
  margin: 0 auto;
  max-width: 420px;
  width: 85%;
  height: auto;
}
.chat-empty-lockup {
  display: block;
  margin: 0 auto 1.2rem;
  max-width: 220px;
  width: 55%;
  height: auto;
  opacity: 0.95;
}

/* ============== Static legal footer ============== */
/* Lives outside #app — always rendered, always visible to crawlers.
   Positioned fixed at the bottom so it doesn't fight with the auth/chat
   layout. Low-contrast so it doesn't pull focus from product chrome. */
.legal-footer {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--safe-bottom, 0px) + 0.5rem);
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: rgba(245, 245, 240, 0.32);
  pointer-events: none;
  z-index: 1;
}
.legal-footer a {
  color: rgba(245, 245, 240, 0.55);
  text-decoration: none;
  pointer-events: auto;
  padding: 0.25rem 0.4rem;
}
.legal-footer a:hover { color: var(--gold); }
.legal-footer span { padding: 0 0.15rem; }

/* Hide the footer once the user is inside the chat workspace — it'd compete
   with the composer. Privacy is still accessible via direct URL. */
body:has(.chat-shell) .legal-footer,
body:has(.install-modal:not([hidden])) .legal-footer { display: none; }

/* ============== Connected accounts (settings) ============== */
.conn-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 0.5rem;
}
.conn-info { flex: 1; min-width: 0; }
.conn-provider {
  font-weight: 500;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}
.conn-gold { color: var(--gold); }
.conn-detail {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}
.conn-row button {
  width: auto;
  padding: 0.55rem 1rem;
  margin: 0;
  font-size: 0.88rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.conn-row button.secondary.danger {
  color: #f5a8a8;
  border-color: rgba(220, 80, 80, 0.35);
  background: rgba(220, 80, 80, 0.06);
}
.conn-row button.secondary.danger:hover:not(:disabled) {
  background: rgba(220, 80, 80, 0.15);
  border-color: rgba(220, 80, 80, 0.55);
}
@media (max-width: 540px) {
  .conn-row { flex-direction: column; align-items: stretch; gap: 0.7rem; }
  .conn-row button { width: 100%; }
}

/* ============== Multi-account connected list ============== */
.conn-row { margin-bottom: 0.55rem; }
.conn-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
  align-items: center;
}
.conn-primary-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.12rem 0.5rem;
  background: var(--gold-soft);
  color: var(--gold);
  border-radius: 999px;
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  font-weight: 600;
  vertical-align: middle;
}
.conn-set-primary {
  font-size: 0.82rem;
  padding: 0.45rem 0.75rem;
}
.conn-add {
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
}
.conn-add:hover { color: var(--text); border-color: var(--text-muted); }
@media (max-width: 540px) {
  .conn-actions { width: 100%; }
  .conn-actions button { flex: 1; }
}

/* Provider section label for multi-provider connected accounts */
.conn-provider-section { margin-bottom: 1.25rem; }
.conn-provider-label {
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 0.4rem;
}

/* ============================================================
   Cockpit — left module nav · center canvas · chat rail
   ============================================================ */
.cockpit {
  display: grid;
  grid-template-columns: 220px 1fr minmax(340px, 420px);
  height: 100vh;
  height: 100dvh;
  width: 100%;
}
.cockpit-nav {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem 0.75rem;
  padding-top: calc(var(--safe-top) + 1rem);
  background: rgb(var(--blur-rgb) / 0.6);
}
.cockpit-brand {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.5rem;
  padding: 0 0.6rem;
}
.cockpit-nav-items { display: flex; flex-direction: column; gap: 0.25rem; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
}
.nav-item:hover { background: var(--bg-card); color: var(--text); }
.nav-item.active { background: var(--gold-soft); color: var(--gold); }
.nav-glyph { width: 1.4rem; text-align: center; font-size: 1rem; }

.cockpit-canvas { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.cockpit-chat { border-left: 1px solid var(--border); overflow: hidden; display: flex; }
.cockpit-chat .chat-shell { max-width: none; height: 100%; margin: 0; }

/* Chat rail header was built for a 760px chat — make it fit the narrow rail so
   the Settings/Sign-out icons don't overflow off-screen. Tenant tag + Google
   status are hidden here (both still reachable: tenant in nav, Google in Settings). */
.cockpit-chat .chat-header { padding-left: 0.85rem; padding-right: 0.55rem; gap: 0.4rem; }
.cockpit-chat .chat-brand { min-width: 0; flex: 1 1 auto; overflow: hidden; }
.cockpit-chat .brand-mark-sm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cockpit-chat .chat-tag { display: none; }
.cockpit-chat .google-status { display: none; }
.cockpit-chat .chat-actions { flex: 0 0 auto; gap: 0.2rem; }
.cockpit-chat .iconbtn { width: 32px; height: 32px; font-size: 1.05rem; }

/* Left-nav footer: Settings + Sign out pinned to the bottom of the rail */
.cockpit-nav-footer { margin-top: auto; display: flex; flex-direction: column; gap: 0.25rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.nav-action {
  display: flex; align-items: center; gap: 0.75rem; width: 100%;
  padding: 0.6rem 0.7rem; border: none; border-radius: 10px;
  background: transparent; color: var(--text-muted);
  font-size: 0.95rem; text-align: left; cursor: pointer;
}
.nav-action:hover { background: var(--bg-card); color: var(--text); }
.nav-action .nav-glyph { width: 1.4rem; text-align: center; font-size: 1rem; }

/* Canvas views */
.view-pad {
  padding: 1.75rem 2rem;
  padding-top: calc(var(--safe-top) + 1.75rem);
  max-width: 840px;
}
.view-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 2rem;
  font-weight: 400;
  margin: 0 0 0.25rem;
}
.view-sub { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 1.5rem; }
.view-loading, .view-error { padding: 2.5rem 2rem; color: var(--text-muted); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem;
}
.stat-num { font-size: 1.8rem; font-weight: 300; color: var(--gold); }
.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
}
.panel-alert { border-color: rgba(212, 175, 55, 0.4); }
.panel-soft { color: var(--text-muted); }
.panel-title { font-size: 0.95rem; font-weight: 600; margin: 0 0 0.75rem; }
.panel-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.panel-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.panel-list li:last-child { border-bottom: none; padding-bottom: 0; }
.li-main { font-size: 0.9rem; }
.li-sub { font-size: 0.75rem; color: var(--text-muted); }
.panel-empty { color: var(--text-faint); font-size: 0.85rem; margin: 0; }

/* Open-loops close + multi-select controls */
.panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.loops-head-left { display: flex; align-items: center; gap: 0.6rem; }
.loops-head-actions { display: flex; align-items: center; gap: 0.85rem; }
.panel-list li.loop-row { flex-direction: row; align-items: center; gap: 0.6rem; }
.loop-text { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.loop-check, .loop-check-all { flex-shrink: 0; width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; margin: 0; }
.loop-close {
  width: 26px; height: 26px; flex-shrink: 0; padding: 0;
  border-radius: 50%; border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); font-size: 0.8rem; line-height: 1; cursor: pointer;
}
.loop-close:hover { color: #ff8a8a; border-color: rgba(255, 138, 138, 0.45); }

/* "Review & approve in chat" — injected approval block in the chat stream */
.approvals-injected { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.5rem; }
.approvals-intro { font-size: 0.82rem; color: var(--text-muted); padding: 0 0.25rem; }

.tier-badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-left: 0.4rem;
}
.tier-T1, .tier-RED { color: #ff8a8a; border-color: rgba(255, 138, 138, 0.4); }
.tier-T2, .tier-YELLOW { color: var(--gold); border-color: rgba(212, 175, 55, 0.4); }
.tier-GREEN { color: #8ae0a0; border-color: rgba(138, 224, 160, 0.4); }

.link-btn { background: none; border: none; color: var(--gold); cursor: pointer; font-size: 0.85rem; padding: 0.35rem 0; }

.roster-search, .ns-text, .ns-due {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
}
.roster-search { width: 100%; margin-bottom: 1rem; }
.ns-text { width: 100%; }
.roster-list { display: flex; flex-direction: column; gap: 0.4rem; }
.roster-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  color: var(--text);
  cursor: pointer;
}
.roster-row:hover { border-color: rgba(212, 175, 55, 0.3); }
.roster-name { font-size: 0.92rem; }
.roster-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 55%;
}
.ns-row { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.6rem; flex-wrap: wrap; }
.ns-status { font-size: 0.8rem; color: var(--text-muted); }

/* Mobile: nav becomes a bottom bar; chat is a full-screen tab */
@media (max-width: 880px) {
  .cockpit { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .cockpit-canvas { grid-row: 1; }
  .cockpit-nav {
    grid-row: 2;
    flex-direction: row;
    gap: 0;
    border-right: none;
    border-top: 1px solid var(--border);
    padding: 0.4rem;
    padding-bottom: calc(var(--safe-bottom) + 0.4rem);
    position: sticky;
    bottom: 0;
    background: rgb(var(--blur-rgb) / 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  .cockpit-brand { display: none; }
  .cockpit-nav-footer { display: none; }
  .cockpit-nav-items { flex-direction: row; justify-content: space-around; width: 100%; gap: 0; }
  .nav-item { flex-direction: column; gap: 0.15rem; padding: 0.35rem 0.25rem; }
  .nav-label { font-size: 0.6rem; }
  .nav-glyph { font-size: 1.2rem; }
  .cockpit-chat { display: none; }
  .cockpit[data-view="chat"] .cockpit-canvas { display: none; }
  .cockpit[data-view="chat"] .cockpit-chat { display: flex; grid-row: 1; border-left: none; }
  .view-pad { padding: 1.25rem 1.1rem; padding-top: calc(var(--safe-top) + 1.25rem); }
}

/* Rollouts / campaigns */
.view-head-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.view-head-row .view-title { margin: 0; }
button.primary.sm { margin: 0; padding: 0.45rem 0.9rem; font-size: 0.85rem; border-radius: 9px; }
.inline-form { margin-bottom: 1rem; }

.campaign-list { display: flex; flex-direction: column; gap: 0.7rem; }
.campaign-row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.95rem 1.1rem;
  color: var(--text);
  cursor: pointer;
}
.campaign-row:hover { border-color: rgba(212, 175, 55, 0.3); }
.campaign-row-top { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.campaign-name { font-size: 0.98rem; }
.campaign-meta { font-size: 0.75rem; color: var(--text-muted); }
.campaign-status {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.12rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.status-active { color: #8ae0a0; border-color: rgba(138, 224, 160, 0.4); }
.status-planning { color: var(--gold); border-color: rgba(212, 175, 55, 0.4); }
.status-completed { color: var(--text-muted); }
.status-paused, .status-cancelled { color: #ff8a8a; border-color: rgba(255, 138, 138, 0.4); }

.progress { height: 5px; background: var(--bg-elev); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--gold); border-radius: 3px; transition: width 0.3s; }

.deliverable-list { display: flex; flex-direction: column; }
.deliverable-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.deliverable-row:last-child { border-bottom: none; }
.deliverable-row.is-done .deliverable-title { text-decoration: line-through; color: var(--text-muted); }
.deliverable-main { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; min-width: 0; }
.deliverable-title { font-size: 0.9rem; }
.deliverable-meta { font-size: 0.74rem; color: var(--text-muted); }
.deliverable-status {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
}

/* Access tokens (settings) */
.tokens-block { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
}
.token-info { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.token-name { font-size: 0.9rem; }
.token-meta { font-size: 0.72rem; color: var(--text-muted); }
.token-meta code { font-size: 0.72rem; color: var(--gold); }
.token-mint { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.token-mint input[type="text"] { flex: 1; min-width: 180px; }
.token-reveal {
  background: var(--gold-soft);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 10px;
  padding: 0.85rem;
  margin-top: 0.5rem;
}
.token-reveal-warn { margin: 0 0 0.5rem; font-size: 0.82rem; color: var(--gold); }
.token-secret {
  display: block;
  word-break: break-all;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  font-size: 0.8rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

/* Integrations source badge (Bookings / Back Office views) */
.source-badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}
.agent-tag {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  vertical-align: middle;
}
.integ-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 0.4rem 0 0.9rem; }
.integ-row input[type="text"], .integ-row input[type="url"], .integ-row input[type="password"] { flex: 1; min-width: 160px; }

/* Appearance — segmented System / Light / Dark toggle */
.theme-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 0.4rem; }
.theme-opt {
  width: auto; padding: 0.5rem 1.1rem; border: none; border-right: 1px solid var(--border);
  border-radius: 0; background: transparent; color: var(--text-muted);
  font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.theme-opt:last-child { border-right: none; }
.theme-opt:hover { color: var(--text); }
.theme-opt.active { background: var(--gold-soft); color: var(--gold); }

/* Small inline buttons (override the global full-width button) */
button.sm { width: auto; margin: 0; padding: 0.42rem 0.9rem; font-size: 0.83rem; border-radius: 9px; }

/* Meeting-notes connect panel */
.notes-provider {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.85rem 1rem; margin-bottom: 0.6rem;
}
.notes-provider-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.notes-provider-name { font-size: 0.95rem; }
.notes-status { font-size: 0.66rem; color: var(--gold); text-transform: uppercase; letter-spacing: 0.08em; }
.notes-recipe { margin-top: 0.75rem; }
.recipe-steps { margin: 0.4rem 0 0.4rem; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.45rem; }
.recipe-steps li { font-size: 0.85rem; line-height: 1.5; }
.recipe-steps code { font-size: 0.78rem; }
