:root {
  --bg: #0a0b0a;
  --bg-elev: #121412;
  --bg-card: #171917;
  --bg-deep: #060706;
  --line: #262826;
  --line-soft: #1c1e1c;
  --ink: #ebe9e3;
  --ink-dim: #a9a89f;
  --ink-faint: #6d6d66;
  --accent: #6ad4ff;
  --accent-warm: #4a9fd4;
  --accent-cool: #6ad4ff;
  --rose: #ff5a7a;
  --moss: #7bb274;
  --amber: #4a9fd4;
  --violet: #b69cff;
  /* chrome-blue identity tokens */
  --chrome-blue: #6ad4ff;
  --chrome-blue-deep: #2a6f9e;
  --chrome-silver: #c4cdd6;
  --blue-bright: #4fe0ff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Fraunces', Georgia, serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  color-scheme: dark;
}
input[type="date"], input[type="time"], input[type="datetime-local"] {
  color-scheme: dark;
}

body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.7 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

/* ============ AUTH GATE ============ */
.auth-gate {
  position: fixed; inset: 0;
  background: var(--bg-deep);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  background: #000000;
  border: 1px solid var(--line);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.auth-title {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 56px;
  line-height: 0.9;
  letter-spacing: -0.045em;
  font-variation-settings: "opsz" 144;
}
.auth-title em { color: var(--accent); font-style: italic; font-weight: 400; }
.auth-tagline {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.auth-input {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 14px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.auth-input:focus { border-color: var(--accent); }
.auth-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  font-weight: 700;
}
.auth-btn:hover { opacity: 0.85; }
.auth-error {
  color: var(--rose);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  min-height: 16px;
}
.auth-foot {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--ink-faint);
  letter-spacing: 0.12em;
  margin-top: 8px;
}

/* ============ LAYOUT ============ */
.app {
  display: grid;
  grid-template-columns: 1fr 380px;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "header header"
    "main carlos";
  min-height: 100vh;
}
.app-header { grid-area: header; }
.main-col {
  grid-area: main;
  min-width: 0;
}
.agent-col {
  grid-area: carlos;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--bg-deep);
}
/* Stylish vertical chrome-blue divider between dashboard and CARLOS panel (desktop only) */
.agent-col::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(106,212,255,0.12) 6%,
    rgba(106,212,255,0.8) 50%,
    rgba(106,212,255,0.12) 94%,
    transparent 100%);
  box-shadow: 0 0 10px rgba(106,212,255,0.5);
  pointer-events: none;
  z-index: 5;
}

/* ============ PIZAZZ / ANIMATIONS ============ */
@keyframes sectionFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.section-panel > * {
  animation: sectionFadeIn 0.35s ease-out;
}
/* Card hover lift + glow */
.card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  border-color: var(--ink-dim);
}
/* Pulsing online status dot */
@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(123,178,116,0.5); }
  50% { box-shadow: 0 0 0 4px rgba(123,178,116,0); }
}
.agent-status.online, .live-dot {
  animation: statusPulse 2s ease-in-out infinite;
}
/* Section slide-in transition */
@keyframes sectionSlideIn {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}
.section-slide-in { animation: sectionSlideIn 0.32s cubic-bezier(0.22, 1, 0.36, 1); }

/* Task flying to archive */
@keyframes taskFlyToArchive {
  0% { opacity: 1; transform: translateX(0) scale(1); }
  30% { transform: translateX(-8px) scale(1.02); }
  100% { opacity: 0; transform: translateX(120%) scale(0.85); }
}
.task-archiving {
  animation: taskFlyToArchive 0.48s cubic-bezier(0.5, 0, 0.75, 0) forwards;
  pointer-events: none;
}

/* CARLOS thinking animation — animated dots */
@keyframes thinkingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
.carlos-thinking {
  display: inline-flex;
  gap: 5px;
  padding: 8px 0;
}
.carlos-thinking span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-cool);
  animation: thinkingBounce 1.4s infinite ease-in-out both;
}
.carlos-thinking span:nth-child(1) { animation-delay: -0.32s; }
.carlos-thinking span:nth-child(2) { animation-delay: -0.16s; }
/* Button press feedback */
.btn-mini:active, .btn-primary:active, .nav-pill:active, .task-btn:active {
  transform: scale(0.96);
}
/* Stat value subtle entrance */
@keyframes statPop {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
.stat .value { animation: statPop 0.4s ease-out; }

/* Expanded-view close button — FIXED so it never scrolls away */
.chat-collapse-x {
  display: none;
  position: fixed;
  top: 32px;
  right: 36px;
  z-index: 10000;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  color: var(--accent);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.chat-collapse-x:hover { background: var(--accent); color: var(--bg); }
body.chat-expanded .chat-collapse-x { display: block; }

/* ===== MINIMIZED CARLOS PANEL (floating box, keeps mic/speaker/mini-chat) ===== */
body.carlos-minimized .agent-col {
  position: fixed;
  bottom: 20px;
  right: 20px;
  top: auto;
  left: auto;
  width: 340px;
  height: 420px;
  max-height: 70vh;
  z-index: 8500;
  border: 2px solid var(--accent-cool);
  border-radius: 8px;
  box-shadow: 0 16px 50px rgba(0,0,0,0.7), 0 0 30px rgba(106,212,255,0.12);
  background: var(--bg-deep);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* Hide bulky sections when minimized; keep head, chat, input */
body.carlos-minimized .agent-col .roster,
body.carlos-minimized .agent-col .budget,
body.carlos-minimized .agent-col .tasks,
body.carlos-minimized .agent-col .full-name {
  display: none;
}
body.carlos-minimized .agent-col .agent-col-head {
  padding: 10px 14px 8px;
}
body.carlos-minimized .agent-col .chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
body.carlos-minimized .agent-col .chat-log {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  font-size: 12px;
  padding: 10px 14px;
}
body.carlos-minimized .agent-col .chat-input-wrap { flex-shrink: 0; }
body.carlos-minimized .agent-col .chat-input { min-height: 36px; font-size: 12px; }
/* A little restore button shown when minimized */
.carlos-restore-btn {
  display: none;
  margin-top: 8px;
  background: var(--accent-cool);
  border: none;
  color: var(--bg);
  padding: 5px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 3px;
}
body.carlos-minimized .carlos-restore-btn { display: inline-block; }

/* Voice buttons in chat */
.chat-mic, .chat-speak-toggle {
  background: linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0));
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 13px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 7px;
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  white-space: nowrap;
}
.chat-mic:hover, .chat-speak-toggle:hover {
  border-color: var(--accent-cool);
  color: var(--bg);
  background: var(--accent-cool);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(106,212,255,0.3);
}
.chat-mic.listening {
  border-color: var(--rose);
  color: var(--rose);
  animation: micPulse 1.2s ease-in-out infinite;
}
.chat-speak-toggle.active {
  border-color: var(--moss);
  color: var(--moss);
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(255,90,122,0.4); }
  50% { box-shadow: 0 0 12px rgba(255,90,122,0.8); }
}

/* Expand chat button */
.chat-expand-btn {
  margin-top: 12px;
  background: transparent;
  border: 1px solid var(--accent-cool);
  color: var(--accent-cool);
  padding: 6px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
}
.chat-expand-btn:hover {
  background: var(--accent-cool);
  color: var(--bg);
}

/* Expanded chat — large floating panel bottom-right */
body.chat-expanded .agent-col {
  position: fixed;
  bottom: 24px;
  right: 24px;
  top: auto;
  left: auto;
  width: 620px;
  max-width: calc(100vw - 48px);
  height: 78vh;
  max-height: 820px;
  z-index: 9000;
  border: 2px solid var(--accent-cool);
  box-shadow: 0 24px 80px rgba(0,0,0,0.8), 0 0 40px rgba(106,212,255,0.15);
  border-radius: 4px;
  background: var(--bg-deep);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.chat-expanded .agent-col .agent-col-head { flex-shrink: 0; }
body.chat-expanded .agent-col .chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body.chat-expanded .agent-col .chat-log {
  flex: 1;
  min-height: 0;
  max-height: none;
  font-size: 15px;
}
body.chat-expanded .agent-col .chat-log .msg-body {
  font-size: 15px;
  line-height: 1.6;
}
body.chat-expanded .agent-col .chat-input-wrap { flex-shrink: 0; }
body.chat-expanded .agent-col .chat-input {
  min-height: 70px;
  font-size: 15px;
}
/* Hide roster + budget when expanded to maximize message space */
body.chat-expanded .agent-col .roster,
body.chat-expanded .agent-col .budget,
body.chat-expanded .agent-col .tasks {
  display: none;
}
/* Backdrop dim when expanded */
body.chat-expanded::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 8999;
  pointer-events: none;
}

/* ============ MASTHEAD ============ */
header.masthead {
  border-bottom: 1px solid var(--line);
  padding: 28px 40px 22px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 32px;
  background: #000000;
  position: relative;
  overflow: hidden;
}
/* Wind-wisp speed streaks drifting across the black masthead (the "DASH" = speed) */
.masthead-wisps {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.wisp {
  position: absolute;
  height: 1px;
  width: 220px;
  background: linear-gradient(90deg, transparent 0%, rgba(196,205,214,0.32) 45%, rgba(150,210,255,0.22) 60%, transparent 100%);
  border-radius: 2px;
  filter: blur(0.5px);
  opacity: 0;
  transform: translateX(-260px);
  animation: wispDash linear infinite;
}
.wisp.w1 { top: 22%; width: 260px; animation-duration: 6s;  animation-delay: 0s;   }
.wisp.w2 { top: 38%; width: 180px; animation-duration: 4.5s; animation-delay: 1.4s; }
.wisp.w3 { top: 55%; width: 320px; animation-duration: 7s;  animation-delay: 0.8s; }
.wisp.w4 { top: 68%; width: 150px; animation-duration: 3.8s; animation-delay: 2.6s; }
.wisp.w5 { top: 80%; width: 240px; animation-duration: 5.5s; animation-delay: 3.4s; }
.wisp.w6 { top: 12%; width: 200px; animation-duration: 5s;  animation-delay: 4.2s; }
@keyframes wispDash {
  0%   { opacity: 0; transform: translateX(-280px); }
  10%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(calc(100vw + 100px)); }
}
/* Keep brand + meta above the wisps */
.masthead .brand, .masthead .masthead-meta { position: relative; z-index: 1; }
.masthead > div:not(.masthead-wisps) { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .wisp { animation: none; opacity: 0; } }
.brand {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  display: block;
}
.brand .eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 6px;
  transition: color 0.2s;
}
.brand:hover .eyebrow { color: var(--accent); }
.brand h1 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: clamp(40px, 5vw, 68px);
  line-height: 0.9;
  letter-spacing: -0.045em;
  font-variation-settings: "opsz" 144;
}
.brand h1 em { font-style: italic; color: var(--accent); font-weight: 400; }
.brand-logo {
  display: block;
  height: 120px;
  width: auto;
  max-width: 560px;
  object-fit: contain;
  object-position: left center;
  margin: 4px 0 6px;
  transition: opacity 0.2s;
}
.brand:hover .brand-logo {
  opacity: 0.88;
}
.auth-logo {
  display: block;
  margin: 4px auto 16px;
  height: 110px;
  width: auto;
  max-width: 420px;
  object-fit: contain;
}
.brand .tagline {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 10px;
}
.masthead-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-dim);
}
.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--moss);
  border-radius: 50%;
  margin-right: 6px;
  animation: pulse 2s ease-in-out infinite;
  box-shadow: 0 0 8px var(--moss);
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.logout-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-faint);
  padding: 4px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  cursor: pointer;
  margin-top: 6px;
  transition: all 0.2s;
}
.logout-btn:hover { border-color: var(--rose); color: var(--rose); }

/* ============ SECTION NAV ============ */
/* Nav Bar title — echoes the blue "Desk" in the logo, cool vibe */
.nav-bar-title {
  margin-top: 20px;
  padding: 14px 40px 4px;
  background-color: var(--bg-elev);
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-style: italic;
  font-size: 26px;
  letter-spacing: 0.01em;
  color: #4fbfff;
  text-shadow: 0 0 16px rgba(79,191,255,0.6), 0 0 4px rgba(159,224,255,0.5), 0 1px 0 rgba(0,0,0,0.5);
}
.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 8px 40px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}
.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #2a2d33 0%, #1a1c20 100%);
  border: 1px solid #3a3f47;
  color: #c4cdd6;
  padding: 11px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 7px;
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav-pill .nav-ico {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: #7da8c4; /* chrome-blue icon tint by default */
  transition: color 0.18s, transform 0.18s;
}
.nav-pill:hover {
  background: linear-gradient(135deg, #6ad4ff 0%, #3a7fb5 100%);
  border-color: #6ad4ff;
  color: #0a0e14;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(106,212,255,0.35);
}
.nav-pill:hover .nav-ico {
  color: #0a0e14; /* icon matches label on hover */
  transform: scale(1.1);
}
.nav-pill.active {
  background: linear-gradient(135deg, #e8eef3 0%, #b8c4cf 100%);
  border-color: #d8e0e8;
  color: #1a3a52;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(180,196,207,0.3);
}
.nav-pill.active .nav-ico {
  color: #2a6f9e; /* deep chrome-blue icon on the bright active chip */
}

/* ============ QUICK LAUNCH ============ */
.quick-launch {
  display: flex;
  gap: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}
.ql-btn {
  flex: 1;
  background: var(--bg-elev);
  border: none;
  padding: 14px 18px;
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.ql-btn:hover { background: var(--bg-card); color: var(--accent); }
.ql-btn .ico { font-size: 14px; }

/* ============ QUICK PROMPTS ============ */
.quick-prompts {
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.qp-label { display: flex; flex-direction: column; gap: 2px; min-width: 180px; }
.qp-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--accent);
  text-transform: uppercase;
}
.qp-hint {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 11px;
  color: var(--ink-faint);
}
.qp-controls {
  flex: 1;
  display: flex;
  gap: 8px;
  align-items: stretch;
  min-width: 280px;
}
.qp-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 9px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  outline: none;
  transition: border-color 0.2s;
}
.qp-input:focus { border-color: var(--accent); }
.qp-target {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  padding: 9px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  cursor: pointer;
  outline: none;
}
.qp-go {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 9px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  font-weight: 700;
}
.qp-go:hover { opacity: 0.85; }

/* ============ GLOBAL SEARCH ============ */
.global-search-wrap {
  padding: 14px 40px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.global-search {
  flex: 1;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 11px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  outline: none;
  transition: border-color 0.2s;
}
.global-search:focus { border-color: var(--accent); }
.global-search-btn {
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
  padding: 0 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.global-search-btn:hover {
  background: var(--bg);
  color: var(--accent);
}
.search-result:hover {
  border-color: var(--accent);
  background: var(--bg-elev);
}

/* ============ STATS STRIP ============ */
.stats {
  display: grid;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
  min-height: 90px;
}
.stat {
  padding: 22px;
  border-right: 1px solid var(--line-soft);
  transition: background 0.3s;
  cursor: pointer;
}
.stat:last-child { border-right: none; }
.stat:hover { background: var(--bg-card); }
.stat.active {
  background: var(--bg-card);
  box-shadow: inset 0 -3px 0 var(--accent);
}
.stat .label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 8px;
}
.stat .value {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 36px;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variation-settings: "opsz" 96;
}
.stat .sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-dim);
  margin-top: 6px;
  letter-spacing: 0.06em;
}

/* ============ SECTION PANEL ============ */
.section-panel { padding: 36px 40px 60px; min-height: 50vh; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 24px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-style: italic;
  font-size: 32px;
  letter-spacing: -0.02em;
}
.section-head .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.14em;
}
.section-head .actions { display: flex; gap: 8px; align-items: center; }

.btn-mini, .btn-primary, .btn-secondary, .btn-danger {
  background: linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0));
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 7px;
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.btn-mini:hover {
  border-color: var(--accent-cool);
  color: var(--bg);
  background: var(--accent-cool);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(106,212,255,0.3);
}
.btn-primary {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.btn-primary:hover {
  background: var(--accent);
  color: var(--bg);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(106,212,255,0.4);
}
.btn-secondary:hover {
  border-color: var(--ink-dim);
  color: var(--bg);
  background: var(--ink-dim);
  transform: translateY(-2px);
}
.btn-danger:hover {
  border-color: var(--rose);
  color: var(--bg);
  background: var(--rose);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255,90,122,0.35);
}
.btn-mini:active, .btn-primary:active, .btn-secondary:active, .btn-danger:active { transform: translateY(0) scale(0.97); }

/* ============ CONTROLS / FILTERS ============ */
.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.filter-pills { display: flex; gap: 7px; flex-wrap: wrap; }
.pill {
  background: linear-gradient(135deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 9px 15px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.pill:hover {
  color: var(--bg);
  background: var(--accent-cool);
  border-color: var(--accent-cool);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(106,212,255,0.25);
}
.pill.active { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 700; box-shadow: 0 3px 12px rgba(106,212,255,0.3); }

/* ============ CARDS ============ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  background: transparent;
  border: none;
}
.card {
  background: var(--bg-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: background 0.25s, transform 0.18s, box-shadow 0.18s;
  min-height: 170px;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.card:hover { background: var(--bg-elev); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-cat {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.card-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid currentColor;
  border-radius: 4px;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: right;
  max-width: 50%;
  flex-shrink: 0;
  line-height: 1.35;
}
.status-live, .status-active, .status-registered, .status-registered-incontestable, .status-granted, .status-in-use, .status-renewed { color: var(--moss); }
.status-build, .status-pending, .status-filed, .status-trial, .status-evaluating { color: var(--amber); }
.status-paused, .status-cancelled, .status-archived, .status-expired, .status-abandoned, .status-opposed { color: var(--ink-faint); }
.status-planning, .status-draft, .status-common-law, .status-parked, .status-transferred { color: var(--accent-cool); }
.status-released, .status-for-sale { color: var(--violet); }
.status-error { color: var(--rose); }

.card h3 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.card p {
  font-family: 'Fraunces', serif;
  font-size: 14px;
  color: var(--ink-dim);
  line-height: 1.5;
  flex: 1;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-dim);
  letter-spacing: 0.06em;
}
.card-meta-row { display: flex; gap: 4px; }
.card-meta-label { color: var(--ink-faint); text-transform: uppercase; }
.card-meta-value { color: var(--ink-dim); }
.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-dim);
}
.card-foot a {
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.08em;
}
.card-foot a:hover { text-decoration: underline; }
.card-edit-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink-faint);
  width: 26px;
  height: 26px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card:hover .card-edit-btn { opacity: 1; }
.agent-tile .card-edit-btn { opacity: 0.55; top: 14px; right: 14px; z-index: 3; }
.agent-tile:hover .card-edit-btn { opacity: 1; }
.card-edit-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ============ MODAL ============ */
.modal {
  position: fixed; inset: 0;
  background: rgba(6,7,6,0.85);
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.modal.open { display: flex; }
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-head h3 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-style: italic;
  font-size: 22px;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--ink-faint);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}
.modal-close:hover { color: var(--accent); }
.modal-form {
  padding: 24px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--ink);
  text-transform: uppercase;
  font-weight: 500;
}
.field input, .field textarea, .field select {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 12px;
  font-family: 'Fraunces', serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
/* Priority select keeps its inline color even on focus */
.field select[name="priority"]:focus {
  border-color: inherit;
  outline: none;
}
.field textarea { resize: vertical; min-height: 80px; font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.field-hint {
  font-size: 12px;
  color: var(--ink-dim);
  margin-top: 5px;
  line-height: 1.4;
  font-family: 'Fraunces', serif;
  font-style: italic;
}
.modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  background: var(--bg-card);
  position: sticky;
  bottom: 0;
}

/* ============ DETAIL VIEW ============ */
.detail-modal {
  position: fixed; inset: 0;
  background: rgba(6,7,6,0.92);
  z-index: 4000;
  display: none;
  align-items: stretch;
  justify-content: center;
  overflow-y: auto;
}
.detail-modal.open { display: flex; }
.detail-card {
  background: var(--bg);
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.detail-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
.detail-home {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 10px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
  border-radius: 7px;
}
.detail-home:hover { opacity: 0.85; }
.detail-title-area {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.detail-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.detail-title {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.detail-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.detail-actions button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 9px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}
.detail-btn-edit:hover { border-color: var(--accent); color: var(--accent); }
.detail-btn-refresh:hover { border-color: var(--accent-cool); color: var(--accent-cool); }
.detail-btn-delete:hover { border-color: var(--rose); color: var(--rose); }
.detail-btn-close:hover { border-color: var(--ink-dim); color: var(--ink-dim); }

.detail-body {
  padding: 32px 28px 60px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.detail-section {
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 22px 24px;
}
.detail-section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.detail-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.detail-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.detail-field-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  font-weight: 500;
}
.detail-field-value {
  font-family: 'Fraunces', serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  word-break: break-word;
}
.detail-field-value.empty {
  color: var(--ink-faint);
  font-style: italic;
  font-size: 12px;
}
.detail-field-value.long {
  font-family: 'Fraunces', serif;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.detail-field-value a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
}
.detail-field-value a:hover {
  background: var(--accent);
  color: var(--bg);
}
.detail-field-status {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid currentColor;
  width: fit-content;
}

/* ============ AGENT COLUMN ============ */
.agent-col-head { padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.agent-col-head .eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.agent-col-head h2 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 32px;
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-variation-settings: "opsz" 144;
}
.agent-col-head h2 em { color: var(--accent); font-style: italic; font-weight: 400; }
.agent-col-head .full-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--ink-faint);
  margin-top: 8px;
  letter-spacing: 0.08em;
  line-height: 1.5;
}

.roster { padding: 18px 24px; border-bottom: 1px solid var(--line); }
.roster-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.agent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.agent-row:last-child { border-bottom: none; }
.agent-info { display: flex; align-items: center; gap: 10px; }
.agent-status { width: 6px; height: 6px; border-radius: 50%; }
.agent-status.online { background: var(--moss); box-shadow: 0 0 6px var(--moss); }
.agent-status.offline { background: var(--ink-faint); }
.agent-status.working { background: var(--amber); animation: pulse 1s ease-in-out infinite; }
.agent-name { color: var(--ink); }
.agent-role { font-size: 9px; color: var(--ink-faint); letter-spacing: 0.1em; text-transform: uppercase; }
.agent-ready { color: var(--moss); font-size: 9px; letter-spacing: 0.1em; }
.agent-nokey { color: var(--ink-faint); font-size: 9px; letter-spacing: 0.1em; }

.budget { padding: 16px 24px; border-bottom: 1px solid var(--line); font-family: 'JetBrains Mono', monospace; font-size: 10px; }
.budget-row { display: flex; justify-content: space-between; padding: 4px 0; color: var(--ink-dim); }
.budget-bar { height: 4px; background: var(--line); margin: 8px 0 4px; position: relative; overflow: hidden; }
.budget-fill { position: absolute; top: 0; left: 0; bottom: 0; width: 0%; background: var(--moss); transition: width 0.3s, background 0.3s; }
.budget-fill.warn { background: var(--amber); }
.budget-fill.danger { background: var(--rose); }

/* ============ CHAT ============ */
.chat { display: flex; flex-direction: column; min-height: 320px; }
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 240px;
  max-height: 45vh;
}
.msg { display: flex; flex-direction: column; gap: 4px; }
.msg-from {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.msg.carlos .msg-from { color: var(--accent); }
.msg.user .msg-from { color: var(--accent-cool); }
.msg.system .msg-from { color: var(--violet); }
.msg-body { font-family: 'Fraunces', serif; font-size: 13px; line-height: 1.5; color: var(--ink); white-space: pre-wrap; }
.msg.system .msg-body {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-dim);
  font-style: italic;
}
.routing-note {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--ink-faint);
  margin-top: 4px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
  letter-spacing: 0.06em;
}

/* ============ DATE FIELD + PRESETS ============ */
.date-input {
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  min-height: 38px;
  color-scheme: dark;
}
/* Custom calendar icon — bulletproof, doesn't rely on browser indicator */
.date-input-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.date-input-wrap input[type="date"] {
  width: 100%;
  padding-right: 38px;
}
/* Hide the native picker indicator everywhere */
.date-input-wrap input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  display: block;
  width: 38px;
  height: 100%;
  position: absolute;
  right: 0;
  top: 0;
  cursor: pointer;
  z-index: 2;
}
.date-input-wrap input[type="date"]::-webkit-inner-spin-button {
  display: none;
}
.date-input-wrap::after {
  content: "📅";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.95;
}
.date-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.date-preset-btn {
  background: var(--bg);
  color: var(--ink-dim);
  border: 1px solid var(--line);
  padding: 4px 9px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s;
}
.date-preset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.date-preset-btn.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* ============ CLEARABLE INPUTS ✕ ============ */
.clearable-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
}
.clearable-wrap input,
.clearable-wrap textarea {
  width: 100%;
  padding-right: 32px;
}
.clear-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink-faint);
  color: var(--bg);
  border: none;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background 0.15s;
}
.clear-btn:hover {
  background: var(--rose);
}
/* For textareas, place X in top-right since they can be tall */
.clearable-wrap textarea ~ .clear-btn {
  top: 8px;
  transform: none;
}

/* ============ TASK COLLABORATION MESSAGING ============ */
.msg-thread {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px 0;
  margin-bottom: 14px;
}
.msg-composer {
  border: 1px solid var(--line);
  padding: 12px;
  background: var(--bg-elev);
  transition: border-color 0.2s;
}
.msg-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.msg-status-chk {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  border: 1px solid var(--line);
  cursor: pointer;
  color: var(--ink-dim);
  transition: all 0.15s;
  user-select: none;
}
.msg-status-chk input { display: none; }
.msg-status-chk:hover {
  border-color: var(--chk-color);
  color: var(--chk-color);
}
.msg-status-chk.selected {
  border-color: var(--chk-color);
  color: var(--chk-color);
  background: color-mix(in srgb, var(--chk-color) 12%, transparent);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--chk-color);
}
.msg-text {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 12px;
  font-family: 'Fraunces', serif;
  font-size: 14px;
  outline: none;
  resize: vertical;
  min-height: 56px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.msg-composer-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}
.msg-send-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--bg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 18px;
  cursor: pointer;
  transition: all 0.15s;
}
.msg-send-btn:hover {
  background: var(--bg);
  color: var(--accent);
}
.msg-send-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Nav pill notification badge — for admin requests indicator */
.nav-pill {
  position: relative;
}
.nav-pill .pill-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #000;
  border: 2px solid #ff3d8b;
  color: #ff3d8b;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 0 8px rgba(255, 61, 139, 0.5);
  animation: pillBadgePulse 2s ease-in-out infinite;
}
@keyframes pillBadgePulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 61, 139, 0.5); }
  50% { box-shadow: 0 0 14px rgba(255, 61, 139, 0.9); }
}

/* Tasks assigned to current viewer */
.task-card.assigned-to-me {
  border-color: var(--accent-cool);
  box-shadow: 0 0 0 1px var(--accent-cool), 0 2px 10px rgba(0,0,0,0.4);
}

/* ============ TODAY VIEW + TASKS ============ */
/* Logo on Project cards — FIXED HEIGHT for visual consistency */
.card-logo-wrap {
  background: var(--bg);
  padding: 12px 18px;
  margin: -20px -20px 12px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 72px;          /* locked exact height */
  box-sizing: border-box;
  overflow: hidden;
}
.card-logo {
  max-width: 100%;
  max-height: 48px;      /* fits within 72px wrap with 12px padding top/bottom */
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: left center;
}

/* Viewer mode: hide all edit affordances */
body.viewer-path .auth-card {
  border-top: 3px solid #00d4ff;
}
body.viewer-path .auth-eyebrow {
  color: #00d4ff !important;
  letter-spacing: 0.22em;
}
body.viewer-path .auth-title em {
  color: #00d4ff;
}
body.viewer-path .auth-btn {
  background: #00d4ff;
  color: var(--bg);
  border-color: #00d4ff;
}
body.viewer-path .auth-btn:hover {
  background: var(--bg);
  color: #00d4ff;
}

body.viewer-mode .card-edit-btn,
body.viewer-mode .btn-primary,
body.viewer-mode .detail-btn-edit,
body.viewer-mode .detail-btn-delete {
  display: none !important;
}
body.viewer-mode .detail-actions .detail-btn-refresh,
body.viewer-mode .detail-actions .detail-btn-close {
  display: inline-block !important;
}
body.viewer-mode .task-actions {
  display: none;
}
/* Viewer DOES see today-task-actions now (for Request Ownership) */
body.viewer-mode .stat {
  cursor: default;
}
body.viewer-mode .auth-foot::after {
  content: ' · viewer';
  color: var(--accent-cool);
}

.today-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.today-date-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.today-fulldate {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 16px;
  color: var(--ink-dim);
  letter-spacing: 0.01em;
}
.today-bigclock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 42px;
  color: var(--accent);
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-top: 4px;
}
.today-tz-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.today-tz-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.today-tz-clocks {
  display: flex;
  gap: 26px;
}
.tz-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.tz-face {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 2px solid var(--ink-dim);
  box-shadow: inset 0 0 8px rgba(0,0,0,0.6);
}
.tz-hand {
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform-origin: bottom center;
  background: var(--ink);
}
.tz-hand-hour {
  width: 3.5px;
  height: 20px;
  background: var(--ink);
  transform: translateX(-50%) rotate(0deg);
  border-radius: 1px;
}
.tz-hand-min {
  width: 2.5px;
  height: 29px;
  background: var(--ink-dim);
  transform: translateX(-50%) rotate(0deg);
  border-radius: 1px;
}
.tz-hand-sec {
  width: 1.5px;
  height: 32px;
  background: var(--accent);
  transform: translateX(-50%) rotate(0deg);
}
.tz-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  background: var(--accent);
  border-radius: 50%;
}
.tz-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
  font-weight: 700;
}
.tz-digital {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 0.05em;
}

.morning-brief-panel {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-left-width: 3px;
  padding: 22px 24px;
  margin-bottom: 28px;
}
.morning-brief-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.morning-brief-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.morning-brief-stamp {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--ink-faint);
  letter-spacing: 0.12em;
}
.morning-brief-body {
  color: var(--ink);
}

.today-projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
}
.today-project-block {
  background: var(--bg-card);
  border: 1px solid var(--line);
}
.today-project-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: var(--bg-elev);
}
.today-project-title {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 18px;
  font-weight: 600;
}
.today-project-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.today-task-list {
  display: flex;
  flex-direction: column;
}
.today-task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.15s;
}
.today-task:last-child { border-bottom: none; }
.today-task:hover { background: var(--bg-elev); }
.today-task-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.today-task-priority {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.today-task-title {
  font-family: 'Fraunces', serif;
  font-size: 13px;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.today-task-due {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  white-space: nowrap;
}
.today-task-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.today-task-more {
  padding: 8px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-faint);
  text-align: center;
  letter-spacing: 0.1em;
  font-style: italic;
}

/* Task action buttons */
.task-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}
.task-btn {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 7px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.16s cubic-bezier(0.22, 1, 0.36, 1);
  white-space: nowrap;
}
.task-btn:hover {
  border-color: var(--accent-cool);
  color: var(--bg);
  background: var(--accent-cool);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(106,212,255,0.25);
}
.task-btn-agent {
  border-color: #00d4ff;
  color: #00d4ff;
}
.task-btn-agent:hover {
  background: #00d4ff;
  color: var(--bg);
}

.task-card h3 {
  font-size: 16px;
  margin: 2px 0;
}
.task-card .card-foot {
  font-size: 9px;
}

.chat-input-wrap {
  border-top: 1px solid var(--line);
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-elev);
}

.chat-prefix {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 0 2px;
}
.chat-prefix-label {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: #00d4ff;
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
}
.chat-prefix-hint {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 10px;
  color: var(--ink-faint);
}
.chat-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 12px 14px;
  font-family: 'Fraunces', serif;
  font-size: 14px;
  outline: none;
  resize: none;
  min-height: 60px;
  transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--accent); }
.chat-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.chat-send {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 11px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  font-weight: 700;
  border-radius: 7px;
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.chat-send:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(106,212,255,0.45); }
.chat-send:active { transform: translateY(0) scale(0.97); }
.chat-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.agent-selector {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  padding: 7px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  outline: none;
}

.tasks { padding: 16px 24px; border-top: 1px solid var(--line); }
.tasks-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}
.task {
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.task:last-child { border-bottom: none; }
.task-head { display: flex; justify-content: space-between; color: var(--ink); }
.task-meta { font-size: 9px; color: var(--ink-faint); letter-spacing: 0.1em; }
.task-status { font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; }
.task-status.pending { color: var(--amber); }
.task-status.working { color: var(--accent-cool); }
.task-status.done { color: var(--moss); }
.task-status.failed { color: var(--rose); }
.task-empty { font-family: 'Fraunces', serif; font-style: italic; font-size: 12px; color: var(--ink-faint); padding: 12px 0; }

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  color: var(--ink);
  padding: 12px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  z-index: 9000;
  transition: transform 0.3s;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--rose); color: var(--rose); }

/* ============ LOADING / EMPTY STATES ============ */
.loading {
  padding: 60px 20px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.empty {
  padding: 40px 20px;
  text-align: center;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-faint);
  grid-column: 1 / -1;
  background: var(--bg-card);
}

/* ============ FINANCIALS-SPECIFIC ============ */
.budget-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-bottom: 24px;
}
.budget-tile { background: var(--bg-card); padding: 20px; }
.budget-tile-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.budget-tile-value {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 28px;
  color: var(--accent);
  font-variation-settings: "opsz" 96;
}
.budget-tile-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--ink-faint);
  margin-top: 4px;
  letter-spacing: 0.08em;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main"
      "carlos";
  }
  .agent-col { position: relative; height: auto; border-top: 1px solid var(--line); }
  .agent-col::before { display: none; }
}
@media (max-width: 700px) {
  header.masthead { padding: 18px 16px 14px; grid-template-columns: 1fr; gap: 12px; }
  .masthead-meta { align-items: flex-start; flex-direction: row; flex-wrap: wrap; gap: 10px 16px; }
  .brand-logo { max-width: 200px; height: auto; }
  .section-panel { padding: 22px 16px 40px; }
  .nav-bar-title { padding: 12px 16px 4px; font-size: 17px; margin-top: 20px; }
  /* Nav: horizontal swipeable scroll on mobile instead of a huge wrapped block */
  .section-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 10px 16px;
    gap: 6px;
    scrollbar-width: thin;
  }
  .section-nav::-webkit-scrollbar { height: 4px; }
  .section-nav::-webkit-scrollbar-thumb { background: var(--chrome-blue-deep); border-radius: 2px; }
  .nav-pill { font-size: 12px; padding: 9px 13px; flex-shrink: 0; }
  .quick-launch { flex-wrap: wrap; padding: 12px 16px; }
  .ql-btn { flex: 1 1 45%; justify-content: center; }
  .quick-prompts { padding: 12px 16px; }
  .qp-controls { flex-direction: column; }
  .qp-input, .qp-target, .qp-go { width: 100%; }
  .global-search-wrap { flex-direction: column; padding: 12px 16px; }
  .global-search, .global-search-btn { width: 100%; }
  /* Stats: 4 cramped columns → 2 readable ones */
  .stats { grid-template-columns: 1fr 1fr !important; }
  .stat { padding: 16px; border-bottom: 1px solid var(--line-soft); }
  .stat .value { font-size: 26px; }
  /* Cards single column + contained, no horizontal overflow */
  .card-grid { grid-template-columns: 1fr; gap: 12px; }
  .card { min-height: auto; padding: 16px; overflow: hidden; }
  .card h3 { font-size: 18px; word-break: break-word; overflow-wrap: anywhere; }
  .card p { font-size: 14px; word-break: break-word; overflow-wrap: anywhere; }
  .card-meta-value, .card-meta-label { word-break: break-word; overflow-wrap: anywhere; }
  /* Stop anything from forcing the page wider than the screen */
  .app, .main-col, .section-panel, .agent-col { max-width: 100vw; overflow-x: hidden; }
  .section-panel * { max-width: 100%; }
  .card-logo, .card-logo-wrap img { max-width: 100%; height: auto; }
  /* Section header stacks */
  .section-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .section-head .actions { width: 100%; display: flex; gap: 8px; }
  .section-head .actions button { flex: 1; }
  h2, .section-head h2 { font-size: 22px; }
  /* Modal full-width on phone */
  .modal { width: calc(100% - 24px); max-width: 100%; margin: 12px; max-height: 90vh; }
  .modal-form { grid-template-columns: 1fr; }
  /* Today clocks wrap */
  .today-bar { grid-template-columns: 1fr; gap: 18px; }
  .today-tz-clocks { flex-wrap: wrap; justify-content: center; gap: 18px; }
  /* Detail view */
  .detail-fields { grid-template-columns: 1fr; }
  .detail-actions { flex-wrap: wrap; }
  /* News ticker stays but a bit tighter */
  .news-ticker-tag { padding: 0 12px; font-size: 10px; }
  .news-ticker-item { font-size: 13.5px; padding: 0 18px; }
  /* CARLOS panel content contained */
  .agent-col { height: auto; min-height: 50vh; }
  .agent-col, .agent-col * { max-width: 100%; }
  .chat-input, .msg, .msg-body { word-break: break-word; overflow-wrap: anywhere; }
  .msg-body { white-space: pre-wrap; }
  .chat-input-wrap, .chat-controls { flex-wrap: wrap; }
  /* Masthead: orb must not cover the logo — give brand room, shrink meta */
  header.masthead { padding-right: 70px; }
  .masthead-meta { font-size: 10px; }
  .logout-btn { padding: 6px 10px; font-size: 10px; }
  /* News popup fits screen */
  .news-popup { padding: 28px 22px 24px; }
  .news-popup-title { font-size: 20px; }
  /* Orb on mobile: small, fixed bottom-right, out of the way — no auto-move */
  .carlos-orb { width: 46px !important; height: 46px !important; top: auto !important; bottom: 84px !important; right: 12px !important; left: auto !important; opacity: 0.82; }
  .carlos-orb .orb-core { width: 34px; height: 34px; }
  .carlos-orb .orb-ring { width: 46px; height: 46px; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr !important; }
  .ql-btn { flex: 1 1 100%; }
  .brand-logo { max-width: 170px; }
  .today-tz-clocks { gap: 12px; }
  .tz-face { width: 60px; height: 60px; }
  .news-popup-actions { flex-direction: column; }
  .news-popup-btn { width: 100%; justify-content: center; }
}

/* ============ CARLOS ORB ============ */
.carlos-orb {
  position: fixed;
  top: 18px;
  right: 28px;
  bottom: auto;
  width: 78px;
  height: 78px;
  z-index: 9500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: top 0.6s cubic-bezier(0.22,1,0.36,1), left 0.6s cubic-bezier(0.22,1,0.36,1), right 0.6s cubic-bezier(0.22,1,0.36,1), bottom 0.6s cubic-bezier(0.22,1,0.36,1);
}
.orb-core {
  position: absolute;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d8e8f0 0%, #6ad4ff 40%, #2a6f9e 100%);
  box-shadow: 0 0 18px rgba(106,212,255,0.6), inset 0 0 12px rgba(255,255,255,0.4);
  animation: orbBreathe 3.2s ease-in-out infinite;
}
.orb-ring {
  position: absolute;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 2px solid rgba(106,212,255,0.5);
  animation: orbRing 3.2s ease-in-out infinite;
}
@keyframes orbBreathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 18px rgba(106,212,255,0.5), inset 0 0 12px rgba(255,255,255,0.4); }
  50% { transform: scale(1.08); box-shadow: 0 0 28px rgba(106,212,255,0.85), inset 0 0 14px rgba(255,255,255,0.55); }
}
@keyframes orbRing {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 0.15; }
}
/* Thinking — faster, brighter */
.carlos-orb.thinking .orb-core { animation: orbBreathe 0.9s ease-in-out infinite; }
.carlos-orb.thinking .orb-ring { animation: orbRing 0.9s ease-in-out infinite; border-color: var(--accent); }
/* Speaking — rippling rings */
.carlos-orb.speaking .orb-core {
  animation: orbBreathe 0.6s ease-in-out infinite;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #ffd27a 45%, #c8821e 100%);
}
.carlos-orb.speaking .orb-ring {
  animation: orbRing 0.6s ease-in-out infinite;
  border-color: var(--accent-warm);
}
.carlos-orb:hover .orb-core { transform: scale(1.12); }
/* Orb is always visible — shows time-of-day color + thinking/speaking states */

/* Orb position set above (top-right) */

/* Time-of-day orb colors (applied to .orb-core gradient when idle) */
.carlos-orb.tod-morning .orb-core {
  background: radial-gradient(circle at 35% 30%, #eaf6ff 0%, #8fd0ff 40%, #3a7fb5 100%);
}
.carlos-orb.tod-latemorning .orb-core {
  background: radial-gradient(circle at 35% 30%, #e6f7e6 0%, #7bd47e 40%, #2e8a4a 100%);
}
.carlos-orb.tod-afternoon .orb-core {
  background: radial-gradient(circle at 35% 30%, #e0f4ff 0%, #4fc3e8 40%, #2a7a9e 100%);
}
.carlos-orb.tod-evening .orb-core {
  background: radial-gradient(circle at 35% 30%, #f0f0f2 0%, #c2c2c8 40%, #8a8a92 100%);
}
.carlos-orb.tod-night .orb-core {
  background: radial-gradient(circle at 35% 30%, #9a9aa2 0%, #55555c 40%, #2a2a30 100%);
}

/* ===== BEDTIME REMINDER OVERLAY ===== */
.bedtime-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 11000;
  background: rgba(8,8,12,0.92);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
}
.bedtime-overlay.show { display: flex; animation: sectionFadeIn 0.5s ease-out; }
.bedtime-card {
  max-width: 460px;
  margin: 24px;
  background: var(--bg-deep);
  border: 2px solid var(--accent-cool);
  border-radius: 14px;
  padding: 36px 34px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8), 0 0 50px rgba(106,212,255,0.2);
}
.bedtime-card .moon { font-size: 44px; margin-bottom: 12px; }
.bedtime-card h2 {
  color: var(--accent-cool);
  font-size: 20px;
  margin: 0 0 16px;
}
.bedtime-card p {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
  margin: 0 0 24px;
}
.bedtime-card button {
  background: var(--accent-cool);
  border: none;
  color: var(--bg);
  padding: 12px 28px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.bedtime-card button:hover { background: var(--accent); transform: scale(1.03); }

/* ============ BRIGHT/PULSING BLUE EMPHASIS ============ */
@keyframes bluePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79,224,255,0.5); }
  50% { box-shadow: 0 0 14px 2px rgba(79,224,255,0.85); }
}
@keyframes blueGlowText {
  0%, 100% { color: var(--chrome-blue); text-shadow: 0 0 4px rgba(106,212,255,0.3); }
  50% { color: var(--blue-bright); text-shadow: 0 0 10px rgba(79,224,255,0.7); }
}
/* Utility: items that need to grab attention */
.emphasis-pulse { animation: bluePulse 2s ease-in-out infinite; }
.emphasis-glow { animation: blueGlowText 2.4s ease-in-out infinite; }
/* Urgent priority cards/badges get the bright pulsing blue treatment */
.card-status.priority-urgent,
.card-cat.priority-urgent { 
  color: var(--blue-bright) !important;
  border-color: var(--blue-bright) !important;
  animation: bluePulse 2s ease-in-out infinite;
}
/* Past-due / urgent deadline text glows */
.deadline-urgent { animation: blueGlowText 2.4s ease-in-out infinite; }
/* Primary action buttons get a subtle bright-blue resting glow */
.btn-primary { box-shadow: 0 0 0 0 rgba(106,212,255,0); }
.btn-primary:hover { box-shadow: 0 6px 18px rgba(79,224,255,0.5); }

/* Section title icon — matches nav, chrome-blue, aligned with the heading */
.section-head h2 {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.section-title-ico {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  color: var(--accent);
  vertical-align: middle;
}

/* ============ PROJECT-WIDE READABILITY BUMP ============ */
/* Nudge up the small, hard-to-read text across the app */
body { font-size: 16px; }
.card h3 { font-size: 17px; }
.card p, .card-meta-value, .card-meta-label { font-size: 13.5px; }
.card-cat, .card-status { font-size: 11px; }
.stat .label { font-size: 12px; }
.stat .value { font-size: 30px; }
.stat .sub { font-size: 11px; }
.detail-field-label { font-size: 12px; }
.detail-field-value { font-size: 15px; }
.detail-section-title { font-size: 13px; }
.field label { font-size: 13px; }
.field input, .field textarea, .field select { font-size: 15px; }
.field-hint { font-size: 12px; }
.msg-body { font-size: 14.5px; }
.msg-from { font-size: 10px; }
.num, .section-head .num { font-size: 13px; }
.eyebrow, .brand .eyebrow { font-size: 11px; }
.tagline { font-size: 13px; }
.empty { font-size: 15px; }
h2, .section-head h2 { font-size: 26px; }
.morning-brief-eyebrow { font-size: 11px; }
.agent-name { font-size: 13px; }
.agent-role { font-size: 11px; }
.budget-tile-label { font-size: 11px; }
.budget-tile-value { font-size: 20px; }
.budget-tile-sub { font-size: 11px; }

/* ============ v3.50 READABILITY + CLOCK PROTECTION + ORANGE CLEANUP ============ */
/* Quick Dispatch / Quick Launch area */
.ql-btn { font-size: 12px; }
.ql-btn .ico { font-size: 16px; }
.quick-prompts label, .qp-label { font-size: 12px; }
.qp-input { font-size: 14px; }
/* Global search */
.global-search { font-size: 14px; }
.global-search-btn { font-size: 12px; }
.global-search::placeholder { font-size: 14px; }
/* CARLOS panel internal labels */
.roster-title, .tasks-title, .budget-title { font-size: 11px; }
.chat-input { font-size: 14px; }
.chat-input::placeholder { font-size: 14px; }
.msg.system .msg-body { font-size: 13.5px; }
.agent-col-head .eyebrow { font-size: 11px; }
.agent-col-head h2 { font-size: 22px; }
.full-name { font-size: 12px; }
/* Task queue text */
.task-head, .task-meta { font-size: 12px; }
.task-status { font-size: 10px; }

/* Protect the timezone clocks — ensure they always display */
.today-tz-block { display: flex !important; }
.today-tz-clocks { display: flex !important; }
.tz-clock { display: flex !important; }
.tz-face { display: block !important; }

/* ============ NEWS TICKER (Fox News RSS) ============ */
.news-ticker {
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, #0a0e14 0%, #11161f 100%);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid #1a2230;
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
}
.news-ticker-tag {
  flex-shrink: 0;
  background: linear-gradient(135deg, #6ad4ff 0%, #2a6f9e 100%);
  color: #06121c;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  z-index: 2;
  box-shadow: 4px 0 12px rgba(0,0,0,0.5);
}
.news-ticker-viewport {
  flex: 1;
  overflow: hidden;
  height: 100%;
  position: relative;
}
.news-ticker-track {
  display: inline-flex;
  align-items: center;
  height: 100%;
  white-space: nowrap;
  will-change: transform;
  animation: tickerScroll linear infinite;
}
.news-ticker-track.paused { animation-play-state: paused; }
@keyframes tickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.news-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 26px;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 14.5px;
  color: var(--chrome-silver);
  cursor: pointer;
  border-right: 1px solid #1f2935;
  height: 100%;
  transition: background 0.15s, color 0.15s;
}
.news-ticker-item::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chrome-blue);
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(106,212,255,0.7);
}
.news-ticker-item:hover {
  background: var(--chrome-blue);
  color: #06121c;
}
.news-ticker-item:hover::before { background: #06121c; box-shadow: none; }
.news-ticker-loading {
  padding: 0 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-dim);
  line-height: 40px;
}

/* Article popup */
.news-popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 11500;
  background: rgba(6,10,16,0.85);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
}
.news-popup-overlay.show { display: flex; animation: sectionFadeIn 0.3s ease-out; }
.news-popup {
  position: relative;
  max-width: 560px;
  width: calc(100% - 48px);
  margin: 24px;
  background: var(--bg-deep);
  border: 2px solid var(--chrome-blue);
  border-radius: 14px;
  padding: 36px 34px 30px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8), 0 0 50px rgba(106,212,255,0.18);
}
.news-popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--chrome-blue);
  color: var(--chrome-blue);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.news-popup-close:hover { background: var(--chrome-blue); color: var(--bg); }
.news-popup-source {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--chrome-blue);
  margin-bottom: 12px;
}
.news-popup-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 24px;
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 14px;
}
.news-popup-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 18px;
}
.news-popup-note {
  font-size: 13px;
  color: var(--ink-faint);
  font-style: italic;
  margin: 0 0 22px;
}
.news-popup-actions { display: flex; gap: 12px; }
.news-popup-btn {
  padding: 11px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: all 0.15s;
}
.news-popup-btn.primary {
  background: var(--chrome-blue);
  border-color: var(--chrome-blue);
  color: var(--bg);
  font-weight: 700;
}
.news-popup-btn.primary:hover { box-shadow: 0 6px 18px rgba(106,212,255,0.5); transform: translateY(-2px); }
.news-popup-btn:hover { border-color: var(--chrome-blue); color: var(--chrome-blue); }
@media (prefers-reduced-motion: reduce) { .news-ticker-track { animation-duration: 0s !important; } }

/* FOX text mark on news ticker tag */
.fox-mark {
  font-family: 'Arial Black', 'Helvetica Neue', sans-serif;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.02em;
  margin-right: 4px;
  color: #06121c;
}

/* ============ STOCKS TICKER (Finnhub) ============ */
.stocks-ticker {
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, #11161f 0%, #0a0e14 100%);
  border-bottom: 1px solid var(--line);
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
}
.stocks-ticker-tag {
  flex-shrink: 0;
  background: linear-gradient(135deg, #e8eef3 0%, #b8c4cf 100%);
  color: #1a3a52;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  z-index: 2;
  cursor: pointer;
  box-shadow: 4px 0 12px rgba(0,0,0,0.5);
}
.stocks-ticker-viewport { flex: 1; overflow: hidden; height: 100%; position: relative; }
.stocks-ticker-track {
  display: inline-flex;
  align-items: center;
  height: 100%;
  white-space: nowrap;
  will-change: transform;
  animation: stocksScroll linear infinite;
}
.stocks-ticker-track.paused { animation-play-state: paused; }
/* Scrolls left-to-right (opposite of news ticker) */
@keyframes stocksScroll {
  0%   { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}
.stock-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 22px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  cursor: pointer;
  border-right: 1px solid #1f2935;
  height: 100%;
  color: var(--chrome-silver);
}
.stock-item:hover { background: rgba(106,212,255,0.12); }
.stock-item .sym { font-weight: 700; color: #e8eef3; }
.stock-item .price { color: var(--chrome-silver); }
.stock-item .chg-up { color: var(--moss); }
.stock-item .chg-down { color: var(--rose); }
.stocks-lookup-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-left: 1px solid #1f2935;
  color: var(--chrome-blue);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 0 14px;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}
.stocks-lookup-btn:hover { background: rgba(106,212,255,0.12); }

/* Stock lookup popup */
.stock-popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 11500;
  background: rgba(6,10,16,0.85);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
}
.stock-popup-overlay.show { display: flex; animation: sectionFadeIn 0.3s ease-out; }
.stock-popup {
  position: relative;
  max-width: 480px;
  width: calc(100% - 48px);
  margin: 24px;
  background: var(--bg-deep);
  border: 2px solid var(--chrome-silver);
  border-radius: 14px;
  padding: 34px 30px 28px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8), 0 0 50px rgba(196,205,214,0.12);
}
.stock-popup-source {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--chrome-silver);
  margin-bottom: 16px;
}
.stock-lookup-inputrow { display: flex; gap: 10px; margin-bottom: 18px; }
.stock-lookup-inputrow input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 11px 14px;
  border-radius: 7px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
}
.stock-lookup-inputrow input:focus { border-color: var(--chrome-blue); outline: none; }
.stock-result { min-height: 40px; }
.stock-result .sr-name { font-family: 'Fraunces', serif; font-size: 22px; color: var(--ink); margin-bottom: 2px; }
.stock-result .sr-sym { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--ink-dim); margin-bottom: 16px; }
.stock-result .sr-price { font-family: 'JetBrains Mono', monospace; font-size: 34px; font-weight: 700; color: var(--ink); }
.stock-result .sr-chg { font-family: 'JetBrains Mono', monospace; font-size: 15px; margin: 4px 0 18px; }
.stock-result .sr-chg.up { color: var(--moss); }
.stock-result .sr-chg.down { color: var(--rose); }
.stock-result .sr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.stock-result .sr-cell { display: flex; justify-content: space-between; font-family: 'JetBrains Mono', monospace; font-size: 13px; border-bottom: 1px solid var(--line-soft); padding-bottom: 6px; }
.stock-result .sr-cell .k { color: var(--ink-dim); }
.stock-result .sr-cell .v { color: var(--ink); }
.stock-result .sr-err { color: var(--rose); font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.stock-result .sr-loading { color: var(--ink-dim); font-family: 'JetBrains Mono', monospace; font-size: 13px; }
@media (max-width: 700px) {
  .stocks-ticker-tag { padding: 0 12px; font-size: 10px; }
  .stocks-lookup-btn { padding: 0 10px; font-size: 10px; }
  .stock-item { font-size: 12px; padding: 0 16px; }
  .stock-result .sr-grid { grid-template-columns: 1fr; }
}

/* ============ v3.59 LARGER READABLE FONTS ============ */
/* News ticker */
.news-ticker { height: 46px; min-height: 46px; max-height: 46px; }
.news-ticker-item { font-size: 16px; }
.news-ticker-tag { font-size: 13px; }
/* Stocks ticker */
.stocks-ticker { height: 44px; min-height: 44px; max-height: 44px; }
.stock-item { font-size: 15px; }
.stocks-ticker-tag { font-size: 13px; }
.stocks-lookup-btn { font-size: 13px; }
/* Stock lookup popup */
.stock-popup-source { font-size: 12px; }
.stock-lookup-inputrow input { font-size: 16px; }
.stock-result .sr-name { font-size: 26px; }
.stock-result .sr-sym { font-size: 13px; }
.stock-result .sr-price { font-size: 40px; }
.stock-result .sr-chg { font-size: 17px; }
.stock-result .sr-cell { font-size: 15px; }
/* News popup */
.news-popup-title { font-size: 26px; }
.news-popup-date { font-size: 13px; }
.news-popup-note { font-size: 14px; }
.news-popup-btn { font-size: 13px; }

/* ============ CHROME-BLUE SECTION DIVIDERS (landing-page style) ============ */
/* A thin, glowing chrome-blue gradient rule used to separate major zones */
.chrome-divider,
.nav-bar-title,
.section-nav,
.quick-launch,
.global-search-wrap,
.stats {
  position: relative;
}
/* Reusable pseudo-divider: a centered gradient line that fades at the edges */
.nav-bar-title::before,
.section-nav::after,
.quick-launch::after,
.global-search-wrap::after {
  content: '';
  position: absolute;
  left: 40px;
  right: 40px;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(106,212,255,0.15) 8%,
    rgba(106,212,255,0.85) 50%,
    rgba(106,212,255,0.15) 92%,
    transparent 100%);
  box-shadow: 0 0 8px rgba(106,212,255,0.5);
  border-radius: 2px;
  pointer-events: none;
}
/* 1. Between stocks ticker and Nav Bar (top of Nav Bar title) */
.nav-bar-title::before { top: 0; }
.nav-bar-title { margin-top: 22px; padding-top: 18px; }
/* 2. Between Nav Bar and content below it (bottom of nav) */
.section-nav::after { bottom: 0; }
/* 3. Between Quick Dispatch and Search (bottom of quick-launch) */
.quick-launch::after { bottom: 0; }
/* 4. Between Search and Counters (bottom of search wrap) */
.global-search-wrap::after { bottom: 0; }

/* Remove the old plain borders that these dividers replace, to avoid doubling */
.section-nav { border-bottom: none; }
.global-search-wrap { border-bottom: none; }
.quick-launch { border-bottom: none; }

@media (max-width: 700px) {
  .nav-bar-title::before,
  .section-nav::after,
  .quick-launch::after,
  .global-search-wrap::after { left: 16px; right: 16px; }
}

/* ============ AGENT TILES ============ */
.agent-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}
.agent-tile {
  position: relative;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-elev) 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.agent-tile:hover {
  transform: translateY(-3px);
  border-color: var(--accent-cool);
  box-shadow: 0 10px 30px rgba(106,212,255,0.18);
}
.agent-tile.has-workspace { border-left: 3px solid var(--accent-cool); }
.agent-tile-avatar {
  font-size: 40px;
  line-height: 1;
}
.agent-tile-body { display: flex; flex-direction: column; gap: 5px; }
.agent-tile-name {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}
.agent-tile-tagline { font-size: 13.5px; color: var(--ink-dim); line-height: 1.4; }
.agent-tile-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.agent-tile-engine {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-cool);
  border: 1px solid var(--accent-cool);
  border-radius: 4px;
  padding: 2px 7px;
}
.agent-tile-open {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-top: auto;
  padding-top: 8px;
}

/* ============ CUBIE WORKSPACE ============ */
.cubie-header {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.cubie-header .detail-home { flex-shrink: 0; }
.cubie-title { display: flex; align-items: center; gap: 14px; flex: 1; }
.cubie-avatar { font-size: 44px; line-height: 1; }
.cubie-header .actions { display: flex; gap: 8px; flex-shrink: 0; }
.cubie-howto {
  background: rgba(106,212,255,0.07);
  border: 1px solid rgba(106,212,255,0.25);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-dim);
  margin-bottom: 20px;
}
.cubie-howto strong { color: var(--accent-cool); }
@media (max-width: 700px) {
  .cubie-header { flex-direction: column; align-items: flex-start; }
  .cubie-header .actions { width: 100%; }
  .cubie-header .actions button { flex: 1; }
  .agent-tile-grid { grid-template-columns: 1fr; }
}

/* Agent avatar images (logo instead of emoji) */
.agent-avatar-img {
  display: block;
  object-fit: contain;
  border-radius: 8px;
}
.agent-avatar-img.tile {
  width: 100%;
  height: 150px;
  max-height: 150px;
  background: transparent;
  padding: 0;
  margin: 0;
  object-fit: contain;
  object-position: center;
  mix-blend-mode: screen;
}
.agent-tile-avatar {
  width: 100%;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.agent-avatar-img.workspace {
  max-width: 420px;
  width: 100%;
  max-height: 150px;
  background: transparent;
  padding: 4px 8px;
  object-fit: contain;
  mix-blend-mode: screen;
}
.agent-tile-avatar:has(.agent-avatar-img) { font-size: 0; width: 100%; }

/* Cubie card action buttons (QR + copy + post) */
.card-qr-btn, .card-copy-btn, .card-post-btn, .card-broch-btn {
  position: absolute;
  bottom: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--accent-cool);
  width: 28px; height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  z-index: 2;
  transition: all 0.15s;
}
.card-broch-btn { right: 140px; bottom: 12px; }
.card-post-btn { right: 108px; }
.card-qr-btn { right: 76px; }
.card-copy-btn { right: 44px; }
.card-qr-btn:hover, .card-copy-btn:hover, .card-post-btn:hover, .card-broch-btn:hover { border-color: var(--accent-cool); background: var(--accent-cool); color: var(--bg); }

/* QR / bookmarklet popups (reuse stock-popup styling) */
.qr-popup-overlay {
  display: none; position: fixed; inset: 0; z-index: 11500;
  background: rgba(6,10,16,0.85); backdrop-filter: blur(6px);
  align-items: center; justify-content: center;
}
.qr-popup-overlay.show { display: flex; animation: sectionFadeIn 0.3s ease-out; }
.qr-popup {
  position: relative; max-width: 420px; width: calc(100% - 48px); margin: 24px;
  background: var(--bg-deep); border: 2px solid var(--chrome-blue);
  border-radius: 14px; padding: 34px 30px 28px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8), 0 0 50px rgba(106,212,255,0.15);
}

/* Cubie notifications */
.cubie-notifs {
  background: rgba(182,156,255,0.07);
  border: 1px solid rgba(182,156,255,0.3);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
}
.cubie-notifs-title {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--violet); margin-bottom: 10px;
}
.cubie-notif-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft); cursor: pointer;
  font-size: 14px;
}
.cubie-notif-item:last-child { border-bottom: none; }
.cubie-notif-item:hover { color: var(--accent-cool); }
.cubie-notif-actions { display: flex; gap: 6px; flex-shrink: 0; }
.cubie-notif-actions button {
  border: 1px solid var(--line); background: transparent; cursor: pointer;
  border-radius: 5px; padding: 4px 10px; font-size: 12px; font-family: 'JetBrains Mono', monospace;
}
.cubie-notif-yes { color: var(--moss); border-color: var(--moss) !important; }
.cubie-notif-no { color: var(--rose); border-color: var(--rose) !important; }

/* Smaller, thinner trademark mark next to names */
.tm-mark {
  font-size: 0.5em;
  font-weight: 400;
  vertical-align: super;
  opacity: 0.8;
  margin-left: 1px;
}

/* Inline X clear button on date fields */
.date-input-wrap { position: relative; display: flex; align-items: center; }
.date-clear-x {
  background: transparent;
  border: none;
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  margin-left: 4px;
  border-radius: 5px;
  transition: all 0.15s;
}
.date-clear-x:hover { color: var(--rose); background: rgba(255,90,122,0.12); }

/* Post-to-FB helper popup */
.post-step { display: flex; gap: 12px; margin-bottom: 18px; }
.post-step-num {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-cool); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; font-family: 'JetBrains Mono', monospace;
}
.post-step-content { flex: 1; font-size: 14px; color: var(--ink-dim); line-height: 1.5; }
.post-step-content strong { color: var(--ink); }
.post-text-preview {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; margin: 8px 0;
  font-size: 12px; color: var(--ink); white-space: pre-wrap;
  max-height: 140px; overflow-y: auto; font-family: 'JetBrains Mono', monospace;
}
.post-photo-strip { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.post-photo {
  position: relative; width: 72px; height: 72px; border-radius: 8px;
  overflow: hidden; border: 1px solid var(--line); cursor: pointer; display: block;
}
.post-photo img { width: 100%; height: 100%; object-fit: cover; }
.post-photo-dl {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(106,212,255,0.9); color: var(--bg);
  font-size: 11px; text-align: center; padding: 2px; font-weight: 700;
}
.post-photo:hover .post-photo-dl { background: var(--accent); }

/* Post-helper per-field rows with copy buttons */
.post-field-row { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; }
.post-field-val {
  flex: 1; background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 7px; padding: 8px 12px; font-size: 14px; color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
}
.post-field-val.long { white-space: pre-wrap; max-height: 120px; overflow-y: auto; font-size: 12px; }
.post-copy-btn { flex-shrink: 0; min-width: 38px; }

/* Approval badge on inventory cards */
.approved-badge {
  position: absolute; top: 12px; left: 12px;
  background: var(--moss); color: #0a1f0e;
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; padding: 3px 8px; border-radius: 5px; z-index: 3;
  box-shadow: 0 2px 8px rgba(123,178,116,0.4);
}
.card-approved { box-shadow: 0 0 0 1px rgba(123,178,116,0.3), 0 8px 24px rgba(123,178,116,0.12); }

/* Brochure button (5th card button) */
.card-broch-btn {
  position: absolute; bottom: 12px; right: 140px;
  background: var(--bg-elev); border: 1px solid var(--line); color: var(--accent-cool);
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 13px; z-index: 2;
  transition: all 0.15s;
}
.card-broch-btn:hover { border-color: var(--accent-cool); background: var(--accent-cool); color: var(--bg); }

/* Brochure popup */
.brochure-popup {
  position: relative; max-width: 600px; width: calc(100% - 48px); margin: 24px;
  max-height: 90vh; overflow-y: auto;
  background: var(--bg-deep); border: 2px solid var(--chrome-blue);
  border-radius: 14px; padding: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8);
}
.brochure-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.brochure-actions { display: flex; gap: 6px; }
.brochure {
  background: #fff; color: #1a1a1a; border-radius: 10px; padding: 28px;
  font-family: Georgia, serif;
}
.brochure-header { border-bottom: 2px solid #1a3a52; padding-bottom: 12px; margin-bottom: 18px; }
.brochure-brand { font-size: 30px; font-weight: bold; color: #1a3a52; }
.brochure-sub { color: #666; font-size: 14px; margin-top: 2px; }
.brochure-photos { margin-bottom: 18px; }
.brochure-photo-main img { width: 100%; border-radius: 8px; max-height: 300px; object-fit: cover; }
.brochure-photo-thumbs { display: flex; gap: 8px; margin-top: 8px; }
.brochure-photo-thumbs img { width: 80px; height: 80px; object-fit: cover; border-radius: 6px; }
.brochure-nophoto { background: #f0f0f0; color: #999; padding: 30px; text-align: center; border-radius: 8px; margin-bottom: 18px; }
.brochure-title { font-size: 26px; margin: 12px 0 10px; color: #1a1a1a; }
.brochure-pricerow { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.brochure-price { font-size: 26px; font-weight: bold; color: #2a7a3a; }
.brochure-cond, .brochure-qty { color: #555; font-size: 15px; }
.brochure-desc { line-height: 1.6; font-size: 15px; white-space: pre-wrap; margin-bottom: 18px; }
.brochure [contenteditable="true"] { outline: 2px dashed #6ad4ff; outline-offset: 3px; border-radius: 4px; }
.brochure-footer { border-top: 1px solid #ddd; padding-top: 12px; color: #888; font-size: 13px; }
.brochure-contact { margin-top: 4px; }

/* Cubie inventory card: action buttons clustered bottom-right, below price */
.cubie-inv-card { padding-bottom: 52px; position: relative; }
.cubie-inv-card .card-edit-btn {
  position: absolute; top: auto; bottom: 12px; right: 12px;
  opacity: 0.7;
}
.cubie-inv-card:hover .card-edit-btn { opacity: 1; }
/* Lift the price/footer up so it sits above the button row */
.cubie-inv-card .card-foot { margin-bottom: 6px; }
/* The approved badge stays top-left, status stays top — only action buttons move down */

/* Post popup — editable fields + photo cells with copy/download */
.post-cid-hint { font-size: 12px; color: var(--ink-dim); font-weight: 400; }
.post-cid-hint code { background: var(--bg-card); padding: 2px 6px; border-radius: 4px; color: var(--accent-cool); }
.post-field-input {
  flex: 1; background: var(--bg-card); border: 1px solid var(--line); color: var(--ink);
  border-radius: 7px; padding: 8px 12px; font-size: 14px; font-family: 'JetBrains Mono', monospace;
}
.post-field-input.long { min-height: 90px; white-space: pre-wrap; resize: vertical; }
.post-field-input:focus { border-color: var(--accent-cool); outline: none; }
.post-field-actions { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.post-field-btn {
  background: var(--bg-elev); border: 1px solid var(--line); color: var(--accent-cool);
  width: 32px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 13px; transition: all 0.15s;
}
.post-field-btn:hover { border-color: var(--accent-cool); background: var(--accent-cool); color: var(--bg); }
.post-photo-cell { position: relative; width: 84px; }
.post-photo-cell img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.post-photo-btns { display: flex; gap: 4px; margin-top: 4px; justify-content: center; }
.post-photo-btn {
  flex: 1; text-align: center; background: var(--bg-elev); border: 1px solid var(--line);
  color: var(--accent-cool); border-radius: 5px; cursor: pointer; font-size: 12px; padding: 3px 0;
  text-decoration: none; display: block;
}
.post-photo-btn:hover { border-color: var(--accent-cool); background: var(--accent-cool); color: var(--bg); }

/* ============ BROCHURE DELUXE ============ */
.brochure-deluxe { background: #fff; color: #1a1a1a; border-radius: 12px; overflow: hidden; font-family: Georgia, 'Times New Roman', serif; }
.brochure-hero { position: relative; background: linear-gradient(135deg, #1a3a52, #0d2438); overflow: hidden; min-height: 160px; }
.brochure-hero-img { width: 100%; max-height: 320px; object-fit: cover; display: block; opacity: 0.92; }
.brochure-hero-noimg { height: 200px; display: flex; align-items: center; justify-content: center; font-size: 64px; opacity: 0.5; }
.brochure-hero-overlay { position: absolute; top: 18px; left: 22px; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.7); }
.brochure-hero-overlay .brochure-brand { font-size: 32px; font-weight: bold; color: #fff; }
.brochure-hero-overlay .brochure-sub { font-size: 14px; opacity: 0.92; color: #fff; }
.brochure-price-badge { position: absolute; bottom: 18px; right: 22px; background: #2a7a3a; color: #fff; font-size: 28px; font-weight: bold; padding: 8px 20px; border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.35); }
.brochure-bodywrap { padding: 26px 30px; }
.brochure-deluxe .brochure-title { font-size: 28px; margin: 0 0 12px; color: #1a1a1a; }
.brochure-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.brochure-chip { background: #eef2f5; color: #1a3a52; padding: 5px 13px; border-radius: 20px; font-size: 13px; font-family: -apple-system, sans-serif; }
.brochure-deluxe .brochure-desc { line-height: 1.7; font-size: 15px; white-space: pre-wrap; margin-bottom: 20px; color: #2a2a2a; }
.brochure-gallery-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: #999; margin: 16px 0 8px; font-family: -apple-system, sans-serif; }
.brochure-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.brochure-gallery img { width: 100%; height: 110px; object-fit: cover; border-radius: 8px; }
.brochure-docs { display: flex; flex-wrap: wrap; gap: 8px; }
.brochure-doc { color: #1a3a52; text-decoration: none; border: 1px solid #cfd6dd; padding: 7px 13px; border-radius: 8px; font-family: -apple-system, sans-serif; font-size: 13px; }
.brochure-doc:hover { background: #eef2f5; }
.brochure-deluxe .brochure-footer { margin-top: 26px; border-top: 2px solid #1a3a52; padding-top: 12px; color: #666; font-size: 13px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.brochure-footer-brand { font-weight: bold; color: #1a3a52; }
.brochure-deluxe [contenteditable="true"] { outline: 2px dashed #6ad4ff; outline-offset: 3px; border-radius: 4px; }

/* ============ DOCSMD WORKSPACE ============ */
.docsmd-wf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.docsmd-wf-card {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-elev) 100%);
  border: 1px solid var(--line); border-radius: 12px; padding: 16px; cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.docsmd-wf-card:hover { transform: translateY(-2px); border-color: var(--violet); box-shadow: 0 8px 24px rgba(182,156,255,0.15); }
.docsmd-wf-icon { font-size: 30px; flex-shrink: 0; }
.docsmd-wf-body { flex: 1; min-width: 0; }
.docsmd-wf-name { font-family: 'Fraunces', serif; font-size: 17px; color: var(--ink); margin-bottom: 3px; }
.docsmd-wf-desc { font-size: 13px; color: var(--ink-dim); line-height: 1.4; }
.docsmd-wf-status {
  flex-shrink: 0; font-family: 'JetBrains Mono', monospace; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.06em; border: 1px solid; border-radius: 5px; padding: 3px 8px; align-self: flex-start;
}
.section-subhead { font-family: 'Fraunces', serif; font-size: 20px; color: var(--ink); margin-bottom: 12px; }
@media (max-width: 700px) { .docsmd-wf-grid { grid-template-columns: 1fr; } }
