/* ════════════════════════════════════════════════════════════
   FLUXC // BRO — Orbital Ops Console
   Mission-control bridge terminal. Dense, tactile, restrained.
   ════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  letter-spacing: 0.1px;
  -webkit-font-smoothing: antialiased;
}

/* Film-grain overlay — ~3% across whole app */
#grain-overlay {
  position: fixed; inset: 0; z-index: 9000; pointer-events: none; opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Boot reveal — one orchestrated rise on load ───────────── */
@keyframes boot-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tab-panel.active > .tab-header,
.tab-panel.active > .tab-content > * { animation: boot-rise 0.42s cubic-bezier(.2,.7,.2,1) both; }
.tab-panel.active > .tab-content > *:nth-child(1) { animation-delay: 0.04s; }
.tab-panel.active > .tab-content > *:nth-child(2) { animation-delay: 0.10s; }
.tab-panel.active > .tab-content > *:nth-child(3) { animation-delay: 0.16s; }
.tab-panel.active > .tab-content > *:nth-child(4) { animation-delay: 0.22s; }
.tab-panel.active > .tab-content > *:nth-child(5) { animation-delay: 0.28s; }
.tab-panel.active > .tab-content > *:nth-child(n+6) { animation-delay: 0.34s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.001ms !important; } }

#shell { display: flex; height: 100vh; }

/* ── Left rail ─────────────────────────────────────────────── */
#sidebar {
  width: 168px;
  background: linear-gradient(180deg, #0e1115 0%, var(--surface) 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 10px;
  gap: 1px;
  flex-shrink: 0;
}
#sidebar-logo {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--text);
  padding: 4px 8px 6px;
  margin-bottom: 14px;
  user-select: none;
  border-bottom: 1px solid var(--border);
  position: relative;
}
#sidebar-logo::after {
  content: "ORBITAL OPS";
  display: block;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 2.5px;
  color: var(--text-faint);
  margin-top: 3px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s;
  user-select: none;
  position: relative;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--surface2); color: var(--text); }
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 6px; bottom: 6px;
  width: 2px; background: var(--accent); box-shadow: var(--halo-accent); border-radius: 1px;
}
.nav-icon {
  font-size: 10px; width: 26px; height: 18px; line-height: 18px; text-align: center;
  flex-shrink: 0; font-family: var(--font-mono); color: var(--text-dim);
  letter-spacing: 0.5px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 3px; background: var(--bg);
}
.nav-item:hover .nav-icon { color: var(--text-muted); border-color: var(--text-faint); }
.nav-item.active .nav-icon { color: var(--accent); border-color: rgba(255,122,69,0.4); }
.nav-label {
  font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; text-transform: uppercase; letter-spacing: 0.8px;
}
#sidebar-bottom { margin-top: auto; }

/* Main */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* Tab Panels */
.tab-panel { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.tab-panel.active { display: flex; }

/* Header — mission readout bar */
.tab-header {
  background: linear-gradient(180deg, var(--surface) 0%, #0f1217 100%);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.tab-header-title {
  font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.4px;
  position: relative; padding-left: 14px;
}
.tab-header-title::before {
  content: "//"; position: absolute; left: 0; color: var(--accent);
  font-family: var(--font-mono); font-weight: 700; font-size: 13px;
}
.tab-header-sub { font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); letter-spacing: 0.3px; }
.tab-header-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Buttons — tactile, hairline + inset */
.btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font-body);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.btn:hover { background: var(--hover); border-color: var(--text-faint); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent); color: var(--accent-fg); border-color: var(--accent);
  font-weight: 800; box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:hover { background: #ff8a5a; border-color: #ff8a5a; }
.btn-sm { padding: 5px 10px; font-size: 10px; }

/* Filter Tabs */
.filter-tabs { display: flex; gap: 2px; background: var(--bg); padding: 3px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.filter-tab {
  padding: 4px 12px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  transition: color 0.12s, background 0.12s;
}
.filter-tab:hover { color: var(--text); }
.filter-tab.active { background: var(--surface2); color: var(--accent); }

/* Content */
.tab-content { flex: 1; overflow-y: auto; padding: 20px 24px; }
.tab-content.has-hero { padding-top: 0; }

/* News Feed */
#news-feed { display: flex; flex-direction: column; gap: 24px; }
.source-section {}
.source-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.source-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.source-name { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); }
.source-count { font-size: 11px; color: var(--text-faint); }
.news-cards { display: flex; flex-direction: column; gap: 6px; }
.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.news-card:hover { border-color: var(--text-faint); transform: translateY(-1px); }
.news-badge {
  flex-shrink: 0;
  margin-top: 1px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-red  { background: rgba(255,56,85,0.15);  color: #ff6677; }
.badge-blue { background: rgba(0,204,255,0.12); color: var(--accent); }
.badge-gray { background: var(--hover);          color: var(--text-muted); }
.news-body { flex: 1; min-width: 0; }
.news-title { font-size: 14px; font-weight: 600; margin-bottom: 3px; line-height: 1.4; }
.news-summary { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.news-meta { font-size: 11px; color: var(--text-faint); margin-top: 4px; }
.news-empty { color: var(--text-faint); font-size: 13px; padding: 32px 0; text-align: center; }

/* Telegram Split */
#tg-split { flex: 1; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.tg-panel { display: flex; flex-direction: column; overflow: hidden; }
.tg-panel-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}
#tg-feed { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--surface2); }
.tg-msg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.tg-msg-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.tg-msg-type { font-size: 11px; font-weight: 600; color: var(--accent); }
.tg-msg-time { font-size: 10px; color: var(--text-faint); }
.tg-msg-text { font-size: 12px; color: var(--text); line-height: 1.5; }
#tg-reply-panel { border-left: 1px solid var(--border); display: flex; flex-direction: column; background: var(--surface); }
#tg-reply-body { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.cmd-label { font-size: 11px; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.cmd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 4px 10px;
  background: var(--surface2);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  transition: background 0.12s, color 0.12s;
}
.chip:hover { background: var(--hover); color: var(--text); }
#tg-textarea {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font-body);
  resize: none;
  outline: none;
  line-height: 1.5;
  min-height: 80px;
}
#tg-textarea:focus { border-color: var(--accent); }
.tg-send-row { display: flex; gap: 8px; }

/* Status Bar — telemetry ribbon (scanline texture) */
#statusbar {
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #0f1217 0%, var(--surface) 100%);
  border-top: 1px solid var(--border);
  padding: 7px 20px;
  display: flex;
  gap: 18px;
  align-items: center;
  flex-shrink: 0;
}
.status-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; color: var(--text-muted);
  font-family: var(--font-mono); letter-spacing: 0.4px;
  text-transform: uppercase;
}
.status-dot-el { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.s-ok   { background: var(--ok);     box-shadow: var(--halo-ok); }
.s-warn { background: var(--warn);   box-shadow: var(--halo-warn); }
.s-crit { background: var(--danger); box-shadow: var(--halo-danger); }
#statusbar-right { margin-left: auto; font-size: 10px; color: var(--text-faint); font-family: var(--font-mono); letter-spacing: 0.4px; }

/* Home Tab */
.home-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.home-section-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.4px; color: var(--text-dim); margin-bottom: 10px; font-family: var(--font-mono); }

/* Chat */
#chat-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#chat-messages { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 72%; padding: 10px 14px; border-radius: var(--radius); font-size: 13px; line-height: 1.5; }
.chat-msg.bro { background: var(--surface); border: 1px solid var(--border); align-self: flex-start; }
.chat-msg.user { background: var(--accent); color: var(--accent-fg); align-self: flex-end; font-weight: 500; }
#chat-input-row { padding: 16px 24px; background: var(--surface); border-top: 1px solid var(--border); display: flex; gap: 8px; flex-shrink: 0; }
#chat-input { flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 13px; background: var(--surface2); color: var(--text); outline: none; }
#chat-input:focus { border-color: var(--accent); }

/* Brief */
#brief-wrap { flex: 1; display: flex; overflow: hidden; }
#brief-main { flex: 1; overflow-y: auto; padding: 24px; }
#brief-content { font-size: 13px; line-height: 1.8; color: var(--text); white-space: pre-wrap; }
#brief-sidebar { width: 200px; border-left: 1px solid var(--border); background: var(--surface); padding: 16px; display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }

/* System */
#system-wrap { flex: 1; overflow-y: auto; padding: 20px 24px; }
#module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 20px; }
.module-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; align-items: center; gap: 8px; font-size: 11px; font-family: var(--font-mono); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-dot.ok { background: var(--ok); box-shadow: var(--halo-ok); }
.status-dot.warn { background: var(--warn); box-shadow: var(--halo-warn); }
.status-dot.err { background: var(--danger); box-shadow: var(--halo-danger); }
#log-viewer { font-family: var(--font-mono); font-size: 11px; line-height: 1.7; color: var(--text-muted); white-space: pre-wrap; word-break: break-all; overflow-y: auto; padding: 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); height: 400px; }
.log-entry.error { color: var(--danger); }
.log-entry.warn { color: var(--warn); }

/* Images */
#image-gen-root { flex: 1; overflow-y: auto; padding: 24px; }
.img-gen-wrap { max-width: 1100px; }
.img-gen-form {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 18px;
}
.img-gen-label {
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.4px; color: var(--text-dim);
  margin-bottom: 6px;
}
.img-gen-textarea {
  width: 100%; min-height: 90px; resize: vertical; box-sizing: border-box;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); padding: 10px 12px;
  font-family: var(--font-body); font-size: 13px; line-height: 1.5;
}
.img-gen-textarea:focus { outline: none; border-color: var(--accent); }
.img-gen-controls { display: flex; flex-wrap: wrap; gap: 14px; margin: 14px 0; }
.img-gen-ctrl { display: flex; flex-direction: column; min-width: 140px; }
.img-gen-select {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); padding: 7px 10px;
  font-family: var(--font-body); font-size: 13px;
}
.img-gen-select:focus { outline: none; border-color: var(--accent); }
.img-gen-btn { margin-top: 4px; }
.img-gen-status {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.3px;
  color: var(--text-muted); min-height: 16px; margin-bottom: 14px;
}
.img-gen-status.err { color: #ff6b6b; }
.img-gen-status.ok { color: var(--ok, #3fd0c9); }
.img-gen-status.loading { color: var(--accent); }
.img-gen-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.img-gen-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.img-gen-img { width: 100%; display: block; background: var(--surface2); }
.img-gen-cardbar { padding: 8px 10px; display: flex; justify-content: flex-end; }

/* ── Email Client ─────────────────────────────────────────── */
#email-client-root {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.email-client {
  display: grid;
  grid-template-columns: 190px 270px 1fr;
  flex: 1;
  overflow: hidden;
  height: 100%;
}
.email-sidebar {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}
.email-accounts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.acc-tab {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  font-family: var(--font-body);
  width: 100%;
  transition: background 0.12s, color 0.12s;
}
.acc-tab:hover { background: var(--hover); }
.acc-tab.active { background: var(--accent); color: var(--accent-fg); }
.acc-tab.active .acc-tab-email { color: var(--accent-fg); opacity: 0.7; }
.acc-tab-label { font-size: 12px; font-weight: 600; color: var(--text); }
.acc-tab.active .acc-tab-label { color: var(--accent-fg); }
.acc-tab-email { font-size: 10px; color: var(--text-dim); margin-top: 1px; font-family: var(--font-mono); }
.email-folders {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.folder-item {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s;
}
.folder-item:hover { background: var(--surface2); color: var(--text); }
.folder-item.active { background: var(--surface2); color: var(--text); font-weight: 600; }
.email-list-panel {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}
.email-search-bar {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-body);
  background: var(--surface2);
  color: var(--text);
  outline: none;
}
.input:focus { border-color: var(--accent); }
.btn-ghost {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  transition: background 0.12s, color 0.12s;
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); border-color: var(--border); }
.email-list { flex: 1; overflow-y: auto; }
.email-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: background 0.1s;
  overflow: hidden;
}
.email-item:hover { background: var(--surface2); }
.email-item.active { background: var(--accent-dim); border-left: 3px solid var(--accent); }

/* ── Read / Unread distinction (postfach feel) ───────────── */
.email-item { padding-left: 22px; }                 /* room for the unread dot */
.email-item-dot {
  position: absolute; left: 8px; top: 15px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: var(--halo-accent);
}
.email-item.read .email-item-dot { background: transparent; box-shadow: none; }
/* Unread = strong + bright. Read = muted + lighter. */
.email-item.unread .email-item-from    { font-weight: 800; color: var(--text); }
.email-item.unread .email-item-subject { font-weight: 700; color: var(--text); }
.email-item.read   .email-item-from    { font-weight: 500; color: var(--text-muted); }
.email-item.read   .email-item-subject { font-weight: 400; color: var(--text-muted); }
.email-item.read   .email-item-preview { color: var(--text-faint); }
.email-item-acct {
  font-size: 9px; font-weight: 700; font-family: var(--font-mono);
  color: var(--accent); opacity: 0.75; white-space: nowrap; flex-shrink: 0;
}
.email-item.read .email-item-acct { opacity: 0.4; }

/* Empty state with scan CTA */
.email-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 48px 20px; text-align: center;
}
.email-empty-icon { font-size: 30px; color: var(--text-faint); }
.email-empty-title { font-size: 13px; font-weight: 700; color: var(--text-muted); }
.email-empty-hint { font-size: 12px; color: var(--text-faint); margin-bottom: 6px; }

.email-item-from { font-size: 12px; font-weight: 600; color: var(--text); }
.email-item-time { font-size: 10px; color: var(--text-muted); float: right; margin-top: 1px; }
.email-item-subject {
  font-size: 12px;
  color: var(--text);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.email-item-preview {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.email-tag {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  background: var(--surface2);
  color: var(--text-muted);
  margin-top: 3px;
  margin-right: 3px;
}
.email-tag.tag-high { background: rgba(255,56,85,0.15); color: var(--danger); }
.email-pagination {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.email-preview-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}
.email-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 13px;
}
.ep-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.ep-subject { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.ep-meta { font-size: 11px; color: var(--text-muted); }
.ep-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.ep-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  background: var(--surface);
}
.attachment-pill {
  display: inline-block;
  padding: 3px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.12s;
}
.attachment-pill:hover { background: var(--border); color: var(--text); }
.reply-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.reply-modal.open { display: flex; }
.reply-modal-inner {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  width: 560px;
  max-width: 95vw;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}
.reply-to {
  font-size: 12px;
  color: var(--text-muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.reply-body {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 13px;
  font-family: var(--font-body);
  background: var(--surface2);
  color: var(--text);
  resize: vertical;
  outline: none;
  line-height: 1.5;
}
.reply-body:focus { border-color: var(--accent); }
.reply-actions { display: flex; gap: 8px; }
.loading { padding: 20px; text-align: center; font-size: 12px; color: var(--text-faint); }

/* ── Dashboard ────────────────────────────────────────────── */
.home-col { min-width: 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.15s, transform 0.1s;
}
.card:hover { border-color: var(--text-faint); }
.card-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-family: var(--font-mono);
}
.commitment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.commitment-item:last-child { border-bottom: none; }
.commitment-item:hover { color: var(--accent); }
.deadline-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface2);
  color: var(--text-muted);
  white-space: nowrap;
  border: 1px solid var(--border);
}
.deadline-badge.urgent { background: rgba(255,56,85,0.15); color: var(--danger); border-color: rgba(255,56,85,0.3); }
.kpi-row { display: flex; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-faint); }
.kpi-value { font-size: 16px; font-weight: 700; color: var(--text); font-family: var(--font-mono); }
.feed-item {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 5px 0;
  font-size: 12px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.feed-item:last-child { border-bottom: none; }
.feed-time { font-size: 10px; color: var(--text-faint); white-space: nowrap; flex-shrink: 0; }
.text-dim { color: var(--text-muted); font-size: 12px; }
.text-ok { color: var(--ok); font-size: 12px; font-weight: 600; }

/* ── Projekte Tab ─────────────────────────────────────────── */
.proj-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.proj-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.proj-card-title-group { display: flex; align-items: center; }
.proj-card-title { font-size: 16px; font-weight: 700; color: var(--text); }
.proj-links { display: flex; gap: 8px; }
.proj-link {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface2);
  transition: background 0.12s, color 0.12s;
}
.proj-link:hover { background: var(--border); color: var(--text); }
.proj-desc { font-size: 13px; color: var(--text-muted); margin: 6px 0 14px; line-height: 1.5; }
.proj-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 16px; }
.proj-col { display: flex; flex-direction: column; gap: 8px; }
.proj-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.proj-notes {
  flex: 1;
  min-height: 130px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text);
  resize: vertical;
  outline: none;
  line-height: 1.65;
}
.proj-notes:focus { border-color: var(--accent); }
.proj-goal-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.proj-goal-item:last-child { border-bottom: none; }

/* NeXus Overlay */
#nexus-overlay { display: none; position: fixed; inset: 0; background: var(--bg); z-index: 500; flex-direction: column; }
#nexus-overlay.visible { display: flex; }
#nexus-overlay > div:first-child { background: var(--surface) !important; border-bottom-color: var(--border) !important; }
#nexus-overlay > div:first-child > span { color: var(--accent) !important; letter-spacing: 3px; }
#nexus-overlay > div:first-child .btn { color: var(--text-muted); border-color: var(--border); background: var(--surface2); }
#nexus-overlay > div:first-child .btn:hover { color: var(--accent); border-color: var(--accent); }
#nexus-detail { background: var(--surface) !important; border-left-color: var(--border) !important; color: var(--data) !important; font-family: var(--font-mono) !important; }
#nexus-detail pre { color: var(--text-muted) !important; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }

/* Login Overlay */
#login-overlay { display: none; position: fixed; inset: 0; background: var(--bg); z-index: 9999; align-items: center; justify-content: center; }
#login-overlay.active { display: flex; }
.login-box { text-align: center; max-width: 320px; width: 100%; padding: 28px 30px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; }
.login-box::before { content: ""; position: absolute; top: -1px; left: 24px; right: 24px; height: 2px; background: var(--accent); box-shadow: var(--halo-accent); border-radius: 1px; }
.login-logo { font-size: 44px; font-weight: 800; color: var(--text); letter-spacing: 0.12em; margin-bottom: 2px; }
.login-logo::after { content: "ORBITAL OPS // AUTH"; display: block; font-family: var(--font-mono); font-size: 9px; font-weight: 500; letter-spacing: 2px; color: var(--text-faint); margin-bottom: 24px; }
.login-input { width: 100%; box-sizing: border-box; padding: 12px; background: var(--surface2); border: 1px solid var(--border); color: var(--text); font-family: var(--font-body); font-size: 14px; border-radius: var(--radius-sm); margin-bottom: 8px; outline: none; }
.login-input:focus { border-color: var(--accent); }
#login-error { margin-top: 8px; color: var(--danger); font-size: 12px; font-family: var(--font-mono); }

/* Activity Feed */
.activity-feed-section { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 20px; }
.activity-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-icon { font-size: 14px; min-width: 20px; margin-top: 1px; }
.activity-body { flex: 1; min-width: 0; }
.activity-summary { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-meta { font-size: 11px; margin-top: 2px; }

/* ── Posteingang ──────────────────────────────────────────── */
.pi-layout { display: flex; gap: 0; height: calc(100vh - 56px); overflow: hidden; }
.pi-sidebar { width: 340px; min-width: 260px; display: flex; flex-direction: column; border-right: 1px solid var(--border); }
.pi-filters { display: flex; flex-direction: column; gap: 0; border-bottom: 1px solid var(--border); }
.pi-filter-group { padding: 8px 12px 6px; border-bottom: 1px solid var(--border); }
.pi-filter-group:last-child { border-bottom: none; }
.pi-filter-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim); margin-bottom: 5px; }
.pi-filter-row { display: flex; flex-wrap: wrap; gap: 4px; }
.pi-filter-sep { display: none; }
.pi-list { flex: 1; overflow-y: auto; }
.pi-row { display: grid; grid-template-columns: 20px 70px 1fr auto 36px 60px; gap: 6px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.pi-row:hover { background: var(--hover); }
.pi-row.active { background: var(--accent-dim); color: var(--accent); border-left: 2px solid var(--accent); }
.pi-row.active .pi-badge { background: rgba(0,204,255,0.2); color: var(--accent); }
.pi-row-icon { font-size: 14px; }
.pi-row-proj { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-row.active .pi-row-proj { color: rgba(255,255,255,0.7); }
.pi-row-from { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-row-preview { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.pi-row.active .pi-row-preview { color: rgba(255,255,255,0.7); }
.pi-row-time { font-size: 11px; color: var(--text-dim); text-align: right; }
.pi-badge { font-size: 10px; padding: 2px 6px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.pi-badge-new       { background: rgba(0,204,255,0.12);  color: var(--accent); }
.pi-badge-escalated { background: rgba(245,160,32,0.15); color: var(--warn); }
.pi-badge-replied   { background: rgba(0,224,122,0.12);  color: var(--ok); }
.pi-badge-archived,.pi-badge-read { background: var(--hover); color: var(--text-dim); }
.pi-empty { padding: 32px 16px; text-align: center; color: var(--text-dim); font-size: 13px; }
.pi-detail { flex: 1; overflow-y: auto; padding: 24px; }
.pi-detail-header { margin-bottom: 16px; }
.pi-detail-from { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.pi-detail-meta { font-size: 12px; color: var(--text-dim); }
.pi-detail-subject { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.pi-detail-body { font-size: 14px; line-height: 1.6; white-space: pre-wrap; background: var(--hover); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.pi-draft-box { background: rgba(0,224,122,0.06); border: 1px solid rgba(0,224,122,0.2); border-radius: 8px; padding: 14px; margin-bottom: 14px; }
.pi-draft-label { font-size: 11px; font-weight: 600; color: var(--ok); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .5px; }
.pi-draft-text { width: 100%; min-height: 80px; border: 1px solid var(--border); border-radius: 6px; padding: 8px; font-size: 13px; resize: vertical; background: var(--surface2); color: var(--text); font-family: var(--font-body); }
.pi-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pi-btn { padding: 7px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; cursor: pointer; }
.pi-btn:hover { background: var(--hover); }
.pi-btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.pi-btn-primary:hover { opacity: .9; }

/* Home msg-count block */
.home-msg-block { margin-top: 10px; }
.home-msg-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.home-msg-row span { font-weight: 600; }
.home-msg-link { display: inline-block; margin-top: 6px; font-size: 12px; color: var(--accent); cursor: pointer; text-decoration: underline; }

/* ── Bro Orb ──────────────────────────────────────────────── */
.bro-orb {
  position: fixed; bottom: 24px; right: 24px;
  width: 54px; height: 54px; border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #ff9a6a, #b8431d);
  box-shadow: 0 0 18px rgba(255,122,69,0.35), inset 0 1px 2px rgba(255,255,255,0.25);
  border: 1px solid rgba(255,122,69,0.5);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  z-index: 9999; user-select: none; transition: box-shadow 0.3s;
}
.bro-orb.idle    { animation: bro-pulse 3.4s ease-in-out infinite; }
.bro-orb.loading { animation: bro-spin  0.8s linear infinite; }
.bro-orb.speaking { animation: bro-wave 0.4s ease-in-out infinite alternate; box-shadow: 0 0 34px rgba(255,122,69,0.7); }
@keyframes bro-pulse { 0%,100%{box-shadow:0 0 16px rgba(255,122,69,0.3)} 50%{box-shadow:0 0 28px rgba(255,122,69,0.55)} }
@keyframes bro-wave  { from{transform:scale(1.0)} to{transform:scale(1.12)} }
@keyframes bro-spin  { to{transform:rotate(360deg)} }
.bro-orb-stop { display: none; color: #fff; font-size: 20px; line-height: 1; pointer-events: none; }

/* ── Voice Orb (Siri-style, interactive, Home top) ─────────────── */
.voice-orb-panel {
  display: flex; align-items: center; gap: 22px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 22px; margin-bottom: 18px;
}
.voice-orb {
  position: relative; flex: 0 0 auto;
  width: 84px; height: 84px; border-radius: 50%;
  cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: center;
  outline: none;
}
.voice-orb:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.voice-orb-core {
  position: absolute; inset: 14px; border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, #ffb38a 0%, #ff7a45 38%, #b8431d 78%),
    radial-gradient(circle at 70% 75%, rgba(63,208,201,0.55), transparent 60%);
  box-shadow: inset 0 1px 3px rgba(255,255,255,0.25), 0 0 16px rgba(255,122,69,0.30);
  transition: transform 0.25s ease, box-shadow 0.3s ease;
}
.voice-orb-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(63,208,201,0.35);
  box-shadow: 0 0 0 1px rgba(255,122,69,0.10);
  opacity: 0.7;
}

/* States */
.voice-orb.idle .voice-orb-core { animation: vo-breathe 3.6s ease-in-out infinite; }
.voice-orb.idle .voice-orb-ring { animation: vo-ring 3.6s ease-in-out infinite; }

.voice-orb.listening .voice-orb-core {
  animation: vo-listen 0.9s ease-in-out infinite;
  background:
    radial-gradient(circle at 34% 30%, #ffd0b0 0%, #ff7a45 40%, #b8431d 80%),
    radial-gradient(circle at 70% 75%, rgba(63,208,201,0.75), transparent 58%);
  /* reagiert live auf den Eingangspegel (--vo-level 0..1, von voice-orb.js gesetzt) */
  box-shadow: inset 0 1px 3px rgba(255,255,255,0.3),
    0 0 calc(20px + var(--vo-level, 0) * 34px) rgba(255,122,69, calc(0.45 + var(--vo-level, 0) * 0.5));
}
.voice-orb.listening .voice-orb-ring { animation: vo-ring-fast 1.1s ease-in-out infinite; border-color: rgba(255,122,69,0.6); }

.voice-orb.thinking .voice-orb-core { animation: vo-shimmer 1.4s linear infinite; }
.voice-orb.thinking .voice-orb-ring {
  animation: vo-spin 0.9s linear infinite;
  border: 2px solid transparent; border-top-color: var(--ok); border-right-color: rgba(63,208,201,0.4);
}

.voice-orb.speaking .voice-orb-core {
  animation: vo-speak 0.42s ease-in-out infinite alternate;
  box-shadow: inset 0 1px 3px rgba(255,255,255,0.3), 0 0 30px rgba(63,208,201,0.55), 0 0 16px rgba(255,122,69,0.4);
}
.voice-orb.speaking .voice-orb-ring { animation: vo-ring-fast 0.6s ease-in-out infinite; border-color: rgba(63,208,201,0.7); }

@keyframes vo-breathe  { 0%,100%{ transform: scale(1.0); }   50%{ transform: scale(1.05); } }
@keyframes vo-ring     { 0%,100%{ transform: scale(1.0); opacity:0.55; } 50%{ transform: scale(1.08); opacity:0.85; } }
@keyframes vo-ring-fast{ 0%,100%{ transform: scale(1.0); opacity:0.5; }  50%{ transform: scale(1.14); opacity:0.95; } }
@keyframes vo-listen   { 0%,100%{ transform: scale(1.0); }   50%{ transform: scale(1.12); } }
@keyframes vo-speak    { from{ transform: scale(1.0); } to{ transform: scale(1.1); } }
@keyframes vo-spin     { to{ transform: rotate(360deg); } }
@keyframes vo-shimmer  { 0%{ filter: brightness(1); } 50%{ filter: brightness(1.4); } 100%{ filter: brightness(1); } }

.voice-orb-side { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.voice-orb-status {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-dim); font-family: var(--font-data);
}
.voice-orb-line {
  font-size: 13px; line-height: 1.5; color: var(--text);
  white-space: pre-wrap; word-break: break-word; display: none;
}
.voice-orb-line.show { display: block; }
.voice-orb-you { color: var(--text-muted); }
.voice-orb-you::before { content: 'du: '; color: var(--accent); font-weight: 600; }
.voice-orb-bro::before { content: 'Bro: '; color: var(--ok); font-weight: 600; }
.voice-orb-hint { font-size: 12px; color: var(--warn, #e8a33d); display: none; }
.voice-orb-hint.show { display: block; }

/* Mic device selector */
.voice-mic-row { display: flex; align-items: center; gap: 8px; margin: 2px 0; }
.voice-mic-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-dim); font-family: var(--font-data); flex: 0 0 auto;
}
.voice-mic-select {
  flex: 1 1 auto; min-width: 0; max-width: 320px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text); background: var(--surface2, #12151a);
  border: 1px solid var(--border); border-radius: var(--radius-sm, 4px);
  padding: 4px 8px; outline: none; cursor: pointer;
}
.voice-mic-select:focus { border-color: var(--accent); }

/* Live input-level meter */
.voice-level {
  height: 4px; border-radius: 2px; overflow: hidden;
  background: var(--bg, #0e1115); border: 1px solid var(--border);
  margin: 4px 0 2px; opacity: 0.35; transition: opacity 0.2s ease;
}
.voice-level.active { opacity: 1; }
.voice-level-fill {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, #ff7a45 0%, #3fd0c9 100%);
  transition: width 0.06s linear;
}

/* Home stats bar */
.home-stats-bar {
  display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap;
}
.home-stat-pill {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 100px;
}
.home-stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); }
.home-stat-val { font-size: 18px; font-family: var(--font-data); font-weight: 700; color: var(--text); }

/* Live Revenue widget (Orbital dark) */
.rev-widget {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 18px;
}
.rev-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.rev-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim); font-weight: 700; }
.rev-freshness { font-size: 11px; color: var(--text-dim); flex: 1; }
.rev-refresh { padding: 2px 9px; line-height: 1; }
.rev-totals { display: flex; gap: 28px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.rev-total-block { display: flex; flex-direction: column; gap: 2px; }
.rev-total-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); }
.rev-total-val { font-size: 22px; font-family: var(--font-data); font-weight: 700; color: var(--accent); }
.rev-sources { display: flex; flex-direction: column; gap: 7px; }
.rev-source-row { display: flex; align-items: center; gap: 9px; }
.rev-source-label { font-size: 13px; color: var(--text); flex: 1; }
.rev-source-amount { font-size: 13px; font-family: var(--font-data); color: var(--text); }

/* Home main grid */
.home-main-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.home-left-col, .home-right-col { display: flex; flex-direction: column; gap: 4px; }
.home-right-col #activity-feed-list { max-height: 300px; overflow-y: auto; }

/* Compact project chips */
.home-projects-compact { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.home-proj-chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; cursor: pointer; min-width: 120px; transition: border-color 0.15s;
}
.home-proj-chip:hover { border-color: var(--accent); }

/* Project goal form */
.proj-goal-form {
  display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; align-items: center;
}
.proj-goal-input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 8px; font-size: 12px; color: var(--text); flex: 1; min-width: 80px;
}
.proj-goal-input:focus { outline: none; border-color: var(--accent); }

/* Sidebar separator */
.nav-separator { height: 1px; background: var(--border); margin: 6px 12px; }
.nav-group-label {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-faint);
  padding: 2px 10px 4px;
  user-select: none;
}

/* ── Fabrik Layout (Content + Ads) ───────────────────────── */
.fabrik-layout { display: grid; grid-template-columns: 340px 1fr; gap: 20px; height: calc(100vh - 100px); }
.fabrik-form-col { overflow-y: auto; }
.fabrik-results-col { overflow-y: auto; }
.fabrik-form-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.fabrik-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 6px; }
.fabrik-select, .fabrik-input {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; font-size: 13px; color: var(--text); box-sizing: border-box;
}
.fabrik-select:focus, .fabrik-input:focus { outline: none; border-color: var(--accent); }
.fabrik-textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; font-size: 13px; color: var(--text); min-height: 90px; resize: vertical;
  font-family: inherit; box-sizing: border-box;
}
.fabrik-textarea:focus { outline: none; border-color: var(--accent); }
.fabrik-radio-group { display: flex; gap: 16px; }
.fabrik-radio-group label { font-size: 13px; display: flex; align-items: center; gap: 5px; cursor: pointer; }
.fabrik-qty-row { display: flex; align-items: center; gap: 10px; margin-bottom: 0; }
.qty-btn { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; width: 28px; height: 28px; cursor: pointer; font-size: 16px; color: var(--text); display: flex; align-items: center; justify-content: center; }
.qty-btn:hover { border-color: var(--accent); }
.qty-val { font-size: 20px; font-family: var(--font-data); font-weight: 700; min-width: 30px; text-align: center; }
.fabrik-generate-btn {
  width: 100%; margin-top: 18px; background: var(--accent); color: var(--bg);
  border: none; border-radius: 6px; padding: 12px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s;
}
.fabrik-generate-btn:hover { opacity: 0.85; }
.fabrik-generate-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.fabrik-section-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 12px; }

/* Content result cards */
.fabrik-results-grid { display: flex; flex-direction: column; gap: 12px; }
.cf-result-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.cf-result-text { font-size: 13px; line-height: 1.6; margin-bottom: 10px; white-space: pre-wrap; }
.cf-result-footer { display: flex; align-items: center; justify-content: space-between; }

/* ── Tools & MCPs ────────────────────────────────────────── */
#tools-grid { display: flex; flex-direction: column; gap: 20px; max-width: 800px; }
.tools-section { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.tools-cat-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.tools-cat-icon { font-size: 10px; background: var(--accent); color: var(--bg); padding: 2px 6px; border-radius: 3px; font-weight: 700; letter-spacing: 0.5px; }
.tools-list { padding: 4px 0; }
.tool-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.tool-row:last-child { border-bottom: none; }
.tool-info { flex: 1; min-width: 0; }
.tool-name { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.tool-desc { font-size: 11px; color: var(--text-dim); line-height: 1.4; }
.tool-meta { flex-shrink: 0; margin-left: 12px; }
.tool-status-badge { font-size: 11px; font-weight: 500; }
.tools-cat-icon { font-family: var(--font-mono); }

/* ════════════════════════════════════════════════════════════
   Dark-theme overrides for tabs that carry inline light styles
   (Models / Social / Blog). These tabs were authored with inline
   #fff / #f8fafc / #5b4ef5 colors; re-skin them via id-scoped
   !important so no markup/ids change.
   ════════════════════════════════════════════════════════════ */

/* Persona / stats / health / filter strips */
#md-persona-tabs { border-bottom: 1px solid var(--border) !important; padding: 12px 24px 0 !important; }
#md-stats-strip {
  background: var(--surface) !important; border-bottom: 1px solid var(--border) !important;
  color: var(--text-muted) !important; font-family: var(--font-mono) !important;
}
#md-stats-strip > div { background: var(--surface2) !important; border: 1px solid var(--border) !important; border-radius: var(--radius-sm); padding: 8px 10px; color: var(--text); }
#md-health-strip { background: var(--bg) !important; border-bottom: 1px solid var(--border) !important; color: var(--text-muted) !important; font-family: var(--font-mono) !important; }
#md-filters { border-bottom: 1px solid var(--border) !important; }
#md-stats-strip strong, #md-health-strip strong { color: var(--text) !important; }

/* Native selects across inline-styled tabs */
#md-status-filter, #md-category-filter,
#sp-filter-project, #sp-filter-status {
  background: var(--surface2) !important; border: 1px solid var(--border) !important;
  color: var(--text) !important; border-radius: var(--radius-sm) !important;
  font-family: var(--font-body) !important;
}

/* Inline-styled action buttons → tactile dark
   (covers Models scan/reload/post-all, Social generate/reload,
    Blog load — all authored as inline-styled <button>) */
#tab-models .tab-header-right button,
#tab-social .tab-header-right button,
#tab-blog .tab-header-right button,
#md-filters button {
  background: var(--surface2) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  transition: background 0.12s, transform 0.06s;
}
#tab-models .tab-header-right button:hover,
#tab-social .tab-header-right button:hover,
#tab-blog .tab-header-right button:hover,
#md-filters button:hover { background: var(--hover) !important; }
#tab-models .tab-header-right button:active,
#tab-social .tab-header-right button:active,
#tab-blog .tab-header-right button:active,
#md-filters button:active { transform: translateY(1px); }
/* Primary-intent inline buttons (post-all, generate) get the warm flare */
#md-filters button[onclick*="postAllPlatforms"],
#tab-social .tab-header-right button[onclick*="spGenerate"] {
  background: var(--accent) !important; color: var(--accent-fg) !important; border-color: var(--accent) !important;
}

/* Social + Blog grids: stat lines & dividers */
#sp-stats { color: var(--text-muted) !important; border-bottom: 1px solid var(--border) !important; font-family: var(--font-mono) !important; }

/* ── Social post cards (#sp-grid .sp-card) ───────────────── */
.sp-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.sp-card:hover {
  border-color: var(--text-faint);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Header row — single tidy flex line, no absolute overlap */
.sp-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.sp-head-left  { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sp-head-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.sp-chip {
  font-size: 10px; font-weight: 800; line-height: 1;
  padding: 3px 8px; border-radius: 20px;
  color: #04121f; background: var(--chip, var(--text-dim));
  text-transform: capitalize; white-space: nowrap;
}
.sp-platform {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.6px;
  color: var(--text-muted); text-transform: uppercase;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-glyph {
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  color: var(--text); background: var(--hover);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 2px 4px; line-height: 1;
}
.sp-date {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-dim); white-space: nowrap;
}
.sp-date--sched { color: var(--accent); }
.sp-status {
  font-size: 10px; font-weight: 800; line-height: 1;
  padding: 3px 8px; border-radius: 20px;
  color: #04121f; background: var(--st, var(--text-dim));
  white-space: nowrap;
}

/* Body row — thumbnail left, text right */
.sp-body-row { display: flex; gap: 12px; padding: 12px; align-items: flex-start; }
.sp-thumb {
  flex-shrink: 0; width: 96px; height: 96px;
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface2); border: 1px solid var(--border);
  position: relative;
}
.sp-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Placeholder for missing / broken images */
.sp-thumb--empty::after,
.sp-thumb--broken::after {
  content: ""; position: absolute; inset: 0;
  background:
    repeating-linear-gradient(45deg, transparent 0 7px, rgba(255,255,255,0.025) 7px 14px),
    var(--surface2);
}
.sp-thumb--empty::before,
.sp-thumb--broken::before {
  content: "IMG"; position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: 1px; color: var(--text-faint);
}

.sp-text {
  flex: 1; min-width: 0;
  font-size: 12px; line-height: 1.5; color: var(--text);
  white-space: pre-wrap; word-break: break-word; cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;
  overflow: hidden;
}
.sp-text[data-expanded="1"] { -webkit-line-clamp: unset; overflow: visible; }
.sp-more { color: var(--text-muted); font-size: 11px; }

/* Actions footer — tactile dark buttons */
.sp-actions {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--border); background: var(--surface2);
}
.sp-btn {
  padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 700; cursor: pointer;
  font-family: var(--font-body); line-height: 1;
  border: 1px solid var(--border);
  transition: background 0.12s, transform 0.06s, border-color 0.12s;
}
.sp-btn:active { transform: translateY(1px); }
.sp-btn--approve { flex: 1; background: #5b9dff; color: #04121f; border-color: #5b9dff; }
.sp-btn--approve:hover { background: #74acff; }
.sp-btn--post { flex: 1; background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.sp-btn--post:hover { filter: brightness(1.08); }
.sp-btn--reject { background: var(--surface); color: var(--text-muted); }
.sp-btn--reject:hover { background: var(--hover); color: var(--danger); border-color: var(--danger); }

/* Models persona-btn emoji tabs sit in #md-persona-tabs — keep readable */
#md-persona-tabs .md-persona-btn { font-size: 12px; }

/* Brief sidebar (uses var tokens already) — coordinate label polish */
#brief-sidebar { font-family: var(--font-body); }

/* ── Side panel (detail drawer) ──────────────────────────── */
.side-panel-overlay {
  display: none; position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,0.5); justify-content: flex-end;
}
.side-panel-overlay.open { display: flex; }
.side-panel {
  width: 380px; max-width: 92vw; height: 100%;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  animation: side-panel-in 0.22s cubic-bezier(.2,.7,.2,1);
}
@keyframes side-panel-in { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.side-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface) 0%, #0f1217 100%); flex-shrink: 0;
}
.side-panel-title {
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--text);
}
.side-panel-body { flex: 1; overflow-y: auto; padding: 18px; color: var(--text); font-size: 13px; line-height: 1.6; }
.side-panel-body .card-title { color: var(--text-dim); }
