
:root {
  /* Supabase-inspired palette (NuestraRX) */
  --deep: #171717; --elec: #22C55E; --cream: #FCFCFC;
  --sage: #8B8B8B; --forest: #0C0C0C; --gold: #C99A3A;
  --lora: 'Inter', system-ui, -apple-system, sans-serif;
  --out: 'Inter', system-ui, -apple-system, sans-serif;
  --logo: 'Lora', Georgia, serif;
  --mono: 'Geist Mono', 'Source Code Pro', ui-monospace, monospace;
  /* Supabase studio dark surfaces */
  --bg: #161616;
  --surface: #1C1C1C;
  --surface2: #232323;
  --surface3: #2A2A2A;
  --border: #2E2E2E;
  --border-strong: #3A3A3A;
  --text: #EDEDED;
  --muted: #8B8B8B;
  --accent: #22C55E;
  --accent2: #16A34A;
  --ok: #22C55E;
  --error: #F87171;
  --warn: #F5A623;
  --info: #3E9FCF;
  --sidebar-w: 224px;
  --header-h: 60px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Inter', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
pre, code { font-family: var(--mono); font-size: 12px; }

/* ---- Login ---- */
#login-screen {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: #161616;
  background-image:
    radial-gradient(70% 50% at 50% -8%, rgba(34,197,94,0.12), transparent 60%),
    radial-gradient(60% 60% at 50% 120%, rgba(34,197,94,0.05), transparent 55%),
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: auto, auto, 38px 38px, 38px 38px;
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 40px 36px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-family: var(--logo); font-size: 26px; color: var(--text); display: inline-flex; align-items: baseline; gap: 1px; line-height: 1; }
.login-logo .logo-nuestra { font-weight: 400; color: var(--text); font-family: var(--logo); line-height: 1; }
.login-logo .logo-rx { font-weight: 700; color: var(--elec); font-family: var(--logo); font-size: 28px; line-height: 1; }
.login-logo p { color: var(--muted); font-size: 12px; margin-top: 6px; letter-spacing: 0.5px; text-transform: uppercase; }
/* Password toggle */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 40px; width: 100%; }
.pw-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); padding: 4px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: color 0.2s; line-height: 1;
}
.pw-toggle:hover { color: var(--text); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input {
  width: 100%; padding: 10px 12px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text);
  font-size: 14px; transition: border-color 0.2s;
}
.form-group input:focus { outline: none; border-color: var(--accent); }
.btn-primary {
  width: 100%; padding: 11px; background: var(--accent); color: #062013;
  border: none; border-radius: 8px; font-size: 14px; font-weight: 600;
  transition: background 0.2s; margin-top: 8px;
}
.btn-primary:hover { background: var(--accent2); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.login-error { color: var(--error); font-size: 13px; text-align: center; margin-top: 12px; min-height: 20px; }

/* ---- App Layout ---- */
#app-screen { display: none; height: 100vh; flex-direction: column; }
#app-screen.visible { display: flex; }

/* Header */
.header {
  height: var(--header-h); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 12px; flex-shrink: 0;
  position: relative; z-index: 10;
}
.header-logo { font-family: var(--logo); font-size: 18px; color: var(--text); display: inline-flex; align-items: baseline; gap: 1px; }
.header-logo span { color: var(--text); font-weight: 400; line-height: 1; }
.header-logo .logo-rx { font-weight: 700; color: var(--elec); font-family: var(--logo); font-size: 20px; line-height: 1; }
.header-sep { width: 1px; height: 20px; background: var(--border); }
.header-title { color: var(--muted); font-size: 13px; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
@media (max-width: 640px) { .header-right { gap: 10px; } }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px;
  background: var(--surface2); border-radius: 20px; border: 1px solid var(--border);
}
.user-chip .role-badge {
  font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.role-badge.ceo { background: rgba(34,197,94,0.16); color: var(--accent); }
.role-badge.cto { background: rgba(62,159,207,0.18); color: var(--info); }
.role-badge.agency { background: rgba(148,163,184,0.18); color: #94a3b8; }
.role-badge.partner { background: rgba(168,85,247,0.16); color: #c084fc; }
.btn-logout {
  background: none; border: 1px solid var(--border); color: var(--muted);
  padding: 5px 12px; border-radius: 6px; font-size: 12px; transition: all 0.2s;
}
.btn-logout:hover { border-color: var(--error); color: var(--error); }

/* Body layout */
.app-body { display: flex; flex: 1; overflow: hidden; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto; flex-shrink: 0;
}
.sidebar-section { padding: 8px 0; }
.sidebar-section-label {
  font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.8px; padding: 8px 16px 4px;
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  cursor: pointer; border-radius: 0; transition: background 0.15s, color 0.15s; color: var(--muted);
  font-size: 13px; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(34,197,94,0.10); color: var(--accent); font-weight: 500; }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; border-radius: 0 2px 2px 0; background: var(--accent); }
.nav-item .icon { width: 18px; text-align: center; flex-shrink: 0; color: inherit; font-size: 12px; display:inline-flex; align-items:center; justify-content:center; }
.nav-item .icon svg { width:16px; height:16px; display:block; }
.nav-item .badge {
  margin-left: auto; font-size: 10px; padding: 1px 6px;
  background: var(--surface3); border-radius: 10px; color: var(--muted);
}
.nav-item.active .badge { background: rgba(34,197,94,0.18); color: var(--accent); }
.nav-sub { padding-left: 12px; }
.nav-sub .nav-item { font-size: 12px; }

/* Main content */
.main-content {
  flex: 1; overflow-y: auto; padding: 24px;
  background: var(--bg);
}

/* Cards */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px;
}
.stat-card .stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; }
.stat-card .stat-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.stat-card.ok .stat-value { color: var(--ok); }
.stat-card.error .stat-value { color: var(--error); }
.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.info .stat-value { color: var(--info); }

/* ---- Command Center (home hero) ---- */
.cmd-hero {
  position: relative; overflow: hidden;
  border: 1px solid var(--border); border-radius: 14px;
  padding: 30px 32px 28px;
  margin-bottom: 22px;
  background:
    radial-gradient(900px 280px at 90% -50%, rgba(34,197,94,0.10), transparent 70%),
    linear-gradient(180deg, var(--surface2) 0%, var(--surface) 100%);
}
.cmd-hero.att {
  background:
    radial-gradient(1100px 320px at 88% -40%, rgba(168,130,48,0.18), transparent 70%),
    linear-gradient(180deg, var(--surface2) 0%, var(--surface) 100%);
}
.cmd-status { display: flex; align-items: center; gap: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); margin-bottom: 14px; flex-wrap: wrap; }
.cmd-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(34,197,94,0.6); animation: cmdPulse 2.2s infinite; }
.cmd-dot.att { background: var(--warn); box-shadow: 0 0 0 0 rgba(168,130,48,0.6); }
@keyframes cmdPulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.55); } 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.cmd-live { color: var(--accent); font-weight: 600; }
.cmd-hero.att .cmd-live { color: var(--warn); }
.cmd-sep { opacity: 0.4; }
.cmd-clock { margin-left: auto; color: var(--muted); letter-spacing: 0.6px; }
.cmd-greeting { font-family: var(--lora); font-size: 36px; line-height: 1.08; font-weight: 700; letter-spacing: -0.8px; margin: 4px 0 8px; }
.cmd-greeting .accent { color: var(--accent); }
.cmd-sub { color: var(--muted); font-size: 13.5px; max-width: 640px; margin-bottom: 20px; }
.cmd-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cmd-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 9px; cursor: pointer;
  font-family: var(--out); font-size: 13px; font-weight: 500;
  background: var(--surface3); border: 1px solid var(--border); color: var(--text);
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.cmd-btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.cmd-btn.primary { background: var(--accent); border-color: var(--accent); color: #04140A; font-weight: 600; }
.cmd-btn.primary:hover { background: var(--accent2); }
.cmd-btn svg { flex-shrink: 0; }

.pulse-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 4px; }
.pulse-card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 13px;
  padding: 16px 18px 8px; min-height: 132px;
  transition: border-color .15s ease, transform .12s ease;
}
.pulse-card:hover { border-color: rgba(34,197,94,0.45); transform: translateY(-1px); }
.pulse-top { display: flex; align-items: center; justify-content: space-between; }
.pulse-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.pulse-value { font-size: 32px; font-weight: 700; line-height: 1.1; margin-top: 6px; }
.pulse-value.okc { color: var(--ok); }
.pulse-value.warnc { color: var(--warn); }
.pulse-value.accentc { color: var(--accent); }
.pulse-unit { font-size: 16px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.pulse-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.pulse-spark { margin: 8px -18px -8px; opacity: 0.95; }
.pulse-spark .spark { display: block; }
.pulse-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }

/* ---- Business KPI strip (home) ---- */
.biz-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px;
  margin: 0 0 18px; padding: 4px;
  border: 1px solid var(--border); border-radius: 13px;
  background: linear-gradient(180deg, rgba(34,197,94,0.05), transparent);
}
.biz-kpi {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 14px; border-radius: 10px; cursor: pointer;
  transition: background .15s ease;
}
.biz-kpi:hover { background: var(--surface2); }
.biz-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.biz-value { font-size: 26px; font-weight: 700; line-height: 1.15; }
.biz-value.accentc { color: var(--accent); }
.biz-value.okc { color: var(--ok); }
.biz-sub { font-size: 10.5px; color: var(--muted); }
.biz-spark { margin-top: 4px; height: 30px; }
.biz-spark .spark { display: block; }

/* ---- Generic panels / bars / segments (Growth, Storage) ---- */
.page-sub { color: var(--muted); font-size: 13px; margin: -8px 0 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 14px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: 16px 18px; }
.panel-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 12px; }
.bar-list { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) 62px; align-items: center; gap: 10px; }
.bar-list.wide .bar-row { grid-template-columns: 150px 1fr 120px; }
.bar-list.wide .bar-val { white-space: nowrap; }
.bar-list.wide-key .bar-row { grid-template-columns: 180px 1fr 42px; }
.growth-sel { padding: 8px 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 13px; cursor: pointer; }
.bar-key { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 8px; background: var(--surface3); border-radius: 5px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 5px; transition: width .4s ease; }
.bar-val { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.seg-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface3); }
.seg-bar .seg { height: 100%; transition: width .4s ease; }
.seg-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--muted); }
.seg-legend .dotc { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  text-align: center; padding: 48px 24px; color: var(--muted);
  border: 1px dashed var(--border); border-radius: 14px; background: var(--surface);
}
.empty-state p { font-size: 13.5px; max-width: 420px; }
.empty-state .cfg-hint { font-family: var(--mono); font-size: 11px; color: var(--accent); background: var(--surface3); padding: 6px 10px; border-radius: 6px; }
.empty-state .cfg-reason { font-size: 11px; color: var(--warn); }

/* ---- Closing reports (Reports screen) ---- */
.rep-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 11px; margin: 12px 0 4px; }
.rep-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; position: relative; overflow: hidden; }
.rep-kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: .85; }
.rep-kpi .k-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.rep-kpi .k-value { font-size: 23px; font-weight: 700; margin-top: 5px; line-height: 1; font-variant-numeric: tabular-nums; }
.rep-kpi .k-sub { font-size: 11px; color: var(--muted); margin-top: 5px; }
.rep-insight { background: var(--surface2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 11px; padding: 12px 15px; margin: 12px 0; font-size: 13px; line-height: 1.55; color: var(--text); }
.rep-insight b { font-weight: 700; }
.rep-funnel { display: flex; flex-direction: column; gap: 9px; }
.rep-fstep { display: grid; grid-template-columns: 150px 1fr 104px; align-items: center; gap: 11px; }
.rep-ftrack { height: 30px; background: var(--surface3); border-radius: 7px; overflow: hidden; }
.rep-fbar { height: 100%; border-radius: 7px; display: flex; align-items: center; padding: 0 10px; color: #06120d; font-weight: 700; font-size: 13px; min-width: 34px; box-sizing: border-box; transition: width .5s ease; }
.rep-flabel { font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-fpct { font-size: 11.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.rep-seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.rep-segcard { border: 1px solid var(--border); border-radius: 11px; padding: 13px 15px; background: var(--surface2); }
.rep-segcard .s-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.rep-segcard .s-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 4px 0; border-bottom: 1px solid var(--surface3); }
.rep-segcard .s-row:last-child { border-bottom: 0; }
.rep-segcard .s-row span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }
.rep-day { margin-top: 10px; }
.rep-day > summary { list-style: none; cursor: pointer; }
.rep-day > summary::-webkit-details-marker { display: none; }
.rep-daysum { font-size: 11px; color: var(--muted); display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.rep-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--surface3); color: var(--muted); }
/* diagnostic vocabulary */
.rep-verdict { background: linear-gradient(135deg, var(--surface2), var(--surface)); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 14px; padding: 16px 20px; margin: 12px 0; }
.rep-verdict .v-text { font-size: 15px; line-height: 1.6; color: var(--text); }
.rep-flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; margin-top: 14px; }
.rep-flow-node { min-width: 0; background: var(--surface3); border-radius: 10px; padding: 10px 12px; text-align: center; }
.rep-flow-node .fn-val { font-size: 20px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.rep-flow-node .fn-label { font-size: 10px; color: var(--muted); margin-top: 5px; text-transform: uppercase; letter-spacing: .4px; }
.rep-flow-node .fn-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.rep-flow-arrow { display: none; }
.rep-delta { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 20px; margin-left: 6px; vertical-align: middle; font-variant-numeric: tabular-nums; }
.rep-cards3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.rep-incident { border: 1px solid var(--border); border-left: 3px solid #D6336C; border-radius: 11px; padding: 12px 14px; background: var(--surface2); }
.rep-incident.ok { border-left-color: #22C55E; }
.rep-incident .i-head { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.rep-incident .i-num { font-size: 22px; font-weight: 800; line-height: 1; margin: 6px 0 2px; }
.rep-incident .i-leads { font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.rep-incident .i-leads a { color: var(--accent); cursor: pointer; }
.rep-autopsy { display: grid; grid-template-columns: repeat(auto-fit, minmax(335px, 1fr)); gap: 13px; }
.rep-acard { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface2); cursor: pointer; transition: border-color .15s; }
.rep-acard:hover { border-color: var(--accent); }
.rep-acard .a-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 8px; }
.rep-acard .a-name { font-weight: 700; font-size: 14px; }
.rep-acard .a-line { font-size: 12.5px; line-height: 1.5; margin: 4px 0; }
.rep-acard .a-quote { font-style: italic; color: var(--muted); border-left: 2px solid var(--surface3); padding-left: 9px; margin: 8px 0; font-size: 12.5px; line-height: 1.5; }
.rep-acard .a-fix { color: #22C55E; }
.rep-acard .a-act { color: var(--accent); }
.rep-bar2 { margin-bottom: 10px; }
.rep-bar2-top { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 4px; }
.rep-bar2-top .b2-val { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rep-plan { display: flex; flex-direction: column; gap: 9px; }
.rep-plan-item { display: flex; gap: 11px; align-items: flex-start; padding: 11px 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface2); }
.rep-plan-num { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #06120d; font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.rep-plan-body { font-size: 13px; line-height: 1.45; }
.rep-plan-body .pl-why { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
/* mobile: keep the closing diagnosis readable on a phone */
@media (max-width: 640px) {
  .section-header { flex-wrap: wrap; }
  .rep-flow-arrow { display: none; }
  .rep-flow-node { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .rep-autopsy, .rep-cards3, .rep-seg { grid-template-columns: 1fr; }
  .rep-fstep { grid-template-columns: 1fr; gap: 4px; }
  .rep-kpis { grid-template-columns: repeat(2, 1fr); }
  .rep-kpi .k-value { font-size: 19px; }
  .rep-daystrip { flex-wrap: wrap; gap: 8px 4px; }
  .rep-daychip { flex: 1 0 13% !important; min-width: 40px; }
  .rep-daychip > div:not(:last-child) { font-size: 13px !important; line-height: 1.15 !important; }
  .rep-daychip > div:last-child { font-size: 9px !important; }
  .rep-verdict { padding: 13px 14px; }
  .rep-verdict .v-text { font-size: 13.5px; line-height: 1.5; }
  .rep-flow-node { padding: 9px 8px; }
  .rep-flow-node .fn-val { font-size: 17px; }
}

.meta-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(24,119,242,0.12), rgba(24,119,242,0.03));
}
.meta-hero.warn {
  border-color: rgba(245,158,11,0.55);
  background: linear-gradient(180deg, rgba(245,158,11,0.16), rgba(245,158,11,0.05));
}
.meta-hero.ok {
  border-color: rgba(34,197,94,0.45);
  background: linear-gradient(180deg, rgba(34,197,94,0.14), rgba(34,197,94,0.04));
}
.meta-hero-main { display: flex; align-items: flex-start; gap: 10px; }
.meta-hero-main i { font-size: 16px; margin-top: 2px; color: #7ab8ff; }
.meta-hero.warn .meta-hero-main i { color: var(--warn); }
.meta-hero.ok .meta-hero-main i { color: var(--ok); }
.meta-hero-title { font-size: 13px; font-weight: 700; line-height: 1.25; }
.meta-hero-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.meta-hero-chip {
  font-size: 11px;
  color: var(--text);
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.16);
  border-radius: 999px;
  padding: 4px 9px;
  white-space: nowrap;
}

.meta-alert {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(245,158,11,0.5);
  background: rgba(245,158,11,0.12);
}
.meta-alert-head { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--warn); font-size: 13px; }
.meta-alert-copy { margin-top: 8px; color: var(--text); font-size: 12.5px; line-height: 1.5; }
.meta-alert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 10px; }
.meta-alert-item { background: rgba(0,0,0,0.14); border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; }
.meta-alert-k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.meta-alert-v { font-size: 12px; color: var(--text); word-break: break-word; }

/* ---- Competitive intelligence ---- */
.chip { display: inline-flex; align-items: center; font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 7px; background: var(--surface3); color: var(--text); border: 1px solid var(--border); }
.chip.muted { color: var(--muted); }
.intel-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.intel-list { margin: 0; padding-left: 18px; }
.intel-list li { font-size: 12.5px; color: var(--text); margin: 3px 0; }
.intel-comp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.intel-url { font-size: 12px; color: var(--info); text-decoration: none; }
.intel-url:hover { text-decoration: underline; }
.intel-threat { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; }
.intel-threat-ring { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; }
.intel-threat-ring::after { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface); }
.intel-threat-num { position: relative; z-index: 1; font-size: 16px; font-weight: 700; }
.intel-threat-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.intel-callout { font-size: 12.5px; padding: 9px 12px; border-radius: 8px; margin-top: 10px; line-height: 1.45; }
.intel-callout.ok { background: rgba(34,197,94,0.1); color: var(--text); border-left: 3px solid var(--ok); }
.intel-callout.warn { background: rgba(245,158,11,0.1); color: var(--text); border-left: 3px solid var(--warn); }
.intel-findings { display: flex; flex-direction: column; gap: 6px; }
.intel-finding { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 12.5px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.intel-finding-type { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 5px; background: var(--surface3); color: var(--muted); flex-shrink: 0; }
.intel-finding-type.gap { background: rgba(239,68,68,0.15); color: var(--error); }
.intel-finding-type.stack { background: rgba(56,189,248,0.15); color: var(--info); }
.intel-finding-type.scale { background: rgba(245,158,11,0.15); color: var(--warn); }
.intel-finding-sum { flex: 1; color: var(--text); min-width: 200px; }
.intel-finding-ts { font-size: 11px; color: var(--muted); flex-shrink: 0; }

/* ---- Workflows ---- */
.wf-card { margin-bottom: 14px; }
.wf-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.wf-titlewrap { flex: 1; min-width: 0; }
.wf-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.wf-last { font-size: 11px; color: var(--muted); }
.wf-rate { text-align: center; flex-shrink: 0; }
.wf-rate-num { font-size: 22px; font-weight: 700; line-height: 1; }
.wf-rate-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.wf-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 12px 0; padding: 10px; background: var(--surface2); border-radius: 8px; }
.wf-step { font-size: 11.5px; color: var(--text); background: var(--surface3); padding: 3px 9px; border-radius: 6px; }
.wf-arrow { color: var(--muted); font-size: 12px; margin: 0 1px; }
.wf-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; margin: 4px 0 12px; }
.wf-stat { display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--surface2); border-radius: 8px; text-align: center; }
.wf-stat-v { font-size: 15px; font-weight: 700; color: var(--text); }
.wf-stat-l { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.wf-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.wf-timeline { display: flex; gap: 3px; align-items: center; }
.wf-tick { width: 9px; height: 18px; border-radius: 3px; display: inline-block; }

/* ---- Unified monitor ---- */
.mon-comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.mon-comp { background: var(--panel, #11201b); border: 1px solid var(--border, #1e3a30); border-radius: 10px; padding: 12px 14px; }
.mon-comp-top { display: flex; align-items: center; gap: 8px; }
.mon-comp-ico { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.mon-comp-name { font-weight: 600; font-size: 13px; flex: 1; }
.mon-comp-detail { margin-top: 6px; font-size: 11px; color: var(--muted); }

/* ---- Lead row + detail overlay ---- */
.lead-row { transition: background .12s ease; }
.lead-row:hover { background: var(--surface2); }
.lead-row-arrow { float: right; margin-left: 8px; opacity: 0; color: var(--accent); transition: opacity .12s ease; font-size: 11px; }
.lead-row:hover .lead-row-arrow { opacity: 1; }
.lead-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 14px; }
.lead-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.lead-kv { background: var(--surface2); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.lead-kv span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.lead-kv strong { display: block; color: var(--text); font-size: 13px; overflow-wrap: anywhere; }
.lead-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.lead-actions .cmd-btn { text-decoration: none; }
/* AWSales conversation overlay header: action buttons hug the right, clearing the absolute close button. */
.lead-cmd-actions { margin-left: auto; margin-right: 36px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.lead-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.lead-photo { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface3); aspect-ratio: 3/4; cursor: pointer; }
.lead-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s ease; }
.lead-photo:hover img { transform: scale(1.04); }
.lead-photo-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 8px; font-size: 11px; color: #fff; background: linear-gradient(180deg, transparent, rgba(0,0,0,0.75)); }
.lead-photo.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); cursor: default; }
.lead-photo.empty i { font-size: 22px; opacity: 0.6; }
.lead-photo.empty span { font-size: 12px; }
.lead-photo.empty small { font-size: 10px; color: var(--warn); }
.lead-photo.status { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text); cursor: default; }
.lead-photo.status i { font-size: 22px; }
.lead-photo.status span { font-size: 12px; }
.lead-photo.status small.ok { font-size: 10px; color: var(--ok); }
.photos-note { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; font-size: 11px; color: var(--muted); line-height: 1.5; }
.photos-note i { margin-top: 2px; color: var(--accent); }
.lead-guardrail { display: flex; align-items: center; gap: 8px; margin-top: 20px; padding: 10px 12px; border-radius: 8px; background: var(--surface3); color: var(--muted); font-size: 11.5px; }
.lead-guardrail i { color: var(--accent); }
.lead-note { display: flex; align-items: flex-start; gap: 8px; margin-top: 4px; padding: 9px 12px; border-radius: 8px; background: rgba(168,130,48,0.1); color: var(--warn); font-size: 11.5px; line-height: 1.5; }
.lead-note i { margin-top: 2px; }
.lightbox { background: rgba(0,0,0,0.86); }
.lightbox-inner { max-width: 92vw; max-height: 92vh; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lightbox-inner img { max-width: 92vw; max-height: 86vh; border-radius: 8px; object-fit: contain; }
.lightbox-cap { color: #fff; font-size: 13px; opacity: 0.85; }

@media (max-width: 640px) {
  .cmd-greeting { font-size: 28px; }
  .cmd-hero { padding: 22px 18px; }
  .cmd-clock { margin-left: 0; width: 100%; }
}

/* Section header */
.section-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.section-header h2 { font-size: 18px; font-weight: 600; }
.section-header .count { font-size: 12px; color: var(--muted); padding: 2px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }

/* Agent cards grid */
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.agent-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; cursor: pointer; transition: all 0.2s;
}
.agent-card:hover { border-color: var(--accent); background: var(--surface2); }
.agent-card .agent-name { font-size: 15px; font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.agent-card .agent-id {
  font-size: 10px; padding: 2px 7px; border-radius: 10px; font-weight: 600;
  text-transform: uppercase;
}
.agent-id.main { background: rgba(34,197,94,0.18); color: var(--accent); }
.agent-id.cos { background: rgba(62,159,207,0.18); color: var(--info); }
.agent-id.com { background: rgba(34,197,94,0.2); color: var(--ok); }
.agent-id.cco { background: rgba(245,158,11,0.2); color: var(--warn); }
.agent-card .agent-desc { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 12px; }
.agent-stats { display: flex; gap: 12px; }
.agent-stat { font-size: 11px; color: var(--muted); }
.agent-stat strong { color: var(--text); }

/* Agent detail */
.agent-detail-header { margin-bottom: 20px; }
.agent-detail-header h2 { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
/* ---- Agent icon picker dropdown ---- */
.aip-trigger { display:inline-flex; align-items:center; gap:6px; padding:4px 10px 4px 8px;
  border:1px solid var(--border); border-radius:6px; background:var(--surface);
  color:var(--muted); font-size:12px; cursor:pointer; transition:border-color .15s; user-select:none; }
.aip-trigger:hover { border-color:var(--elec); color:var(--text); }
.aip-trigger i { font-size:13px; }
.aip-trigger svg { flex-shrink:0; }
.aip-dropdown { position:absolute; z-index:200; margin-top:4px;
  background:var(--surface); border:1px solid var(--border); border-radius:8px;
  padding:10px; display:none; box-shadow:0 8px 24px rgba(0,0,0,.4); }
.aip-dropdown.open { display:block; }
.aip-grid { display:grid; grid-template-columns:repeat(5,28px); gap:5px; }
.aip-icon { width:28px; height:28px; border-radius:6px; border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center; cursor:pointer;
  color:var(--muted); font-size:12px; transition:all .15s; }
.aip-icon:hover { border-color:var(--elec); color:var(--elec); }
.aip-icon.active { border-color:var(--elec); background:rgba(34,197,94,.12); color:var(--elec); }
.agent-icon-picker { position:relative; display:inline-block; margin-top:10px; }
.back-btn {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 6px 12px; border-radius: 6px; font-size: 12px; margin-bottom: 16px;
  display: inline-flex; align-items: center; gap: 6px;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab {
  padding: 8px 14px; font-size: 13px; color: var(--muted); cursor: pointer;
  border: none; background: none; border-bottom: 2px solid transparent;
  transition: all 0.15s; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

/* Markdown viewer */
.md-viewer {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px 24px; line-height: 1.7; max-width: 900px;
}
.md-viewer h1, .md-viewer h2, .md-viewer h3, .md-viewer h4 { margin: 16px 0 8px; font-weight: 600; }
.md-viewer h1 { font-size: 20px; color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.md-viewer h2 { font-size: 17px; color: var(--text); }
.md-viewer h3 { font-size: 15px; color: var(--info); }
.md-viewer p { margin: 8px 0; color: var(--text); }
.md-viewer ul, .md-viewer ol { margin: 8px 0 8px 20px; }
.md-viewer li { margin: 4px 0; color: var(--text); }
.md-viewer code { background: var(--surface3); padding: 2px 5px; border-radius: 4px; font-size: 12px; }
.md-viewer pre { background: var(--surface3); padding: 12px; border-radius: 8px; overflow-x: auto; margin: 12px 0; }
.md-viewer pre code { background: none; padding: 0; }
.md-viewer blockquote { border-left: 3px solid var(--accent); padding: 4px 12px; color: var(--muted); background: var(--surface2); border-radius: 0 6px 6px 0; margin: 8px 0; }
.md-viewer strong { font-weight: 600; color: #fff; }
.md-viewer em { color: var(--info); font-style: italic; }
.md-viewer table { border-collapse: collapse; width: 100%; margin: 12px 0; }
.md-viewer th, .md-viewer td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.md-viewer th { background: var(--surface2); font-weight: 600; font-size: 12px; }
.md-viewer tr:nth-child(even) td { background: rgba(255,255,255,0.02); }
.md-viewer hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.md-viewer a { color: var(--accent); }

/* Crons table */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted);
  background: var(--surface2); border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.data-table th, .data-table td { white-space: nowrap; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.data-table tr { cursor: pointer; }
#l360-table tbody { counter-reset: l360row; }
#l360-table tbody tr { counter-increment: l360row; }
#l360-table td.rownum::before { content: counter(l360row); }
.data-table .rownum { width: 30px; min-width: 30px; text-align: right; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; background: var(--surface2); padding-right: 8px; padding-left: 8px; }
/* CRM table: frozen header (top) + frozen row-number + Name columns (left) inside a scroll box. */
.table-wrap:has(#l360-table) { max-height: 72vh; overflow: auto; }
#l360-table thead th { position: sticky; top: 0; z-index: 2; }
#l360-table tbody td.rownum { position: sticky; left: 0; z-index: 1; }
#l360-table thead th.rownum { left: 0; z-index: 3; }
/* Freeze the Name column (2nd) right after the row-number gutter. */
#l360-table tbody td:nth-child(2) { position: sticky; left: 30px; z-index: 1; background: var(--bg); }
#l360-table thead th:nth-child(2) { position: sticky; left: 30px; z-index: 3; }
#l360-table tr:hover td:nth-child(2) { background: var(--surface2); }
#l360-table th[data-sk] { cursor: pointer; user-select: none; }
#cust-table th[data-sk] { cursor: pointer; user-select: none; }
.l360-ar { font-size: 10px; margin-left: 3px; }

/* Status badge */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px;
}
.badge.ok { background: rgba(34,197,94,0.15); color: var(--ok); }
.badge.error { background: rgba(239,68,68,0.15); color: var(--error); }
.badge.warn { background: rgba(245,158,11,0.15); color: var(--warn); }
.badge.info { background: rgba(56,189,248,0.15); color: var(--info); }
.badge.muted { background: var(--surface3); color: var(--muted); }
.badge.enabled { background: rgba(34,197,94,0.1); color: var(--ok); }
.badge.disabled { background: var(--surface3); color: var(--muted); }

/* Dot indicator */
.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot.ok { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot.error { background: var(--error); box-shadow: 0 0 6px var(--error); }
.dot.warn { background: var(--warn); }
.dot.muted { background: var(--muted); }

/* Activity feed */
.activity-feed { display: flex; flex-direction: column; gap: 2px; }
.activity-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  font-size: 12px;
}
.activity-item .time { color: var(--muted); flex-shrink: 0; width: 90px; font-size: 11px; padding-top: 1px; }
.activity-item .job-name { font-weight: 500; color: var(--accent); flex-shrink: 0; width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-item .ev-type { flex-shrink: 0; }
.activity-item .ev-data { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

/* File list */
.file-list { display: flex; flex-direction: column; gap: 2px; }
.file-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; transition: all 0.15s;
}
.file-item:hover { border-color: var(--accent); background: var(--surface2); }
.file-item .file-name { font-size: 13px; flex: 1; }
.file-item .file-meta { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.file-item .file-icon { font-size: 16px; flex-shrink: 0; }

/* Detail modal / overlay */
.detail-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px;
  overflow-y: auto;
}
.detail-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  width: 100%; max-width: 840px; min-height: 300px; padding: 24px;
  position: relative;
}
.detail-close {
  position: absolute; top: 16px; right: 16px; background: var(--surface2);
  border: 1px solid var(--border); color: var(--muted); width: 28px; height: 28px;
  border-radius: 50%; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.detail-close:hover { color: var(--text); border-color: var(--text); }

/* Cron detail */
.cron-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.info-item { background: var(--surface2); border-radius: 8px; padding: 10px 12px; }
.info-item .info-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.info-item .info-value { font-size: 13px; font-weight: 500; word-break: break-all; }

/* Runs timeline */
.runs-timeline { display: flex; flex-direction: column; gap: 4px; max-height: 400px; overflow-y: auto; }
.run-event {
  padding: 6px 10px; background: var(--surface2); border-radius: 6px;
  font-size: 11px; display: flex; gap: 10px;
}
.run-event .run-ts { color: var(--muted); flex-shrink: 0; width: 80px; }
.run-event .run-type { font-weight: 600; flex-shrink: 0; width: 100px; }
.run-event .run-data { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

/* Hamburger (mobile only) */
.hamburger {
  display: none; background: none; border: 1px solid var(--border); color: var(--text);
  width: 34px; height: 34px; border-radius: 6px; font-size: 16px;
  align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 49;
}
/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--muted); }
.loading::after { content: ''; display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin-left: 8px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 40px; color: var(--muted); font-size: 13px; }


/* ---- Agents sub-nav collapse ---- */
.nav-sub { overflow: hidden; transition: max-height .22s ease, opacity .22s ease; max-height: 300px; opacity: 1; }
.nav-sub.collapsed { max-height: 0; opacity: 0; pointer-events: none; }
.agents-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.agents-toggle svg.chevron { transition: transform .22s ease; }
.agents-toggle.open svg.chevron { transform: rotate(180deg); }
/* ---- Mobile ---- */
@media (max-width: 640px) {
  .login-card { padding: 28px 20px; transform: translateY(-6vh); }
  .hamburger { display: flex; }
  .header-sep, .header-title { display: none; }
  .user-chip .user-name-text { display: none; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: -240px; z-index: 50;
    transition: left 0.25s ease; box-shadow: none; width: 220px;
  }
  .sidebar.open { left: 0; box-shadow: 4px 0 24px rgba(0,0,0,0.6); }
  .sidebar-overlay.open { display: block; }
  .main-content { padding: 16px 12px; overflow-x: hidden; }
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .agents-grid { grid-template-columns: 1fr; }
  .activity-item .ev-data { display: none; }
  .activity-item .job-name { width: 140px; }
  .cron-info-grid { grid-template-columns: 1fr; }
  /* Bottom-sheet sized to the DYNAMIC viewport (dvh): with plain vh the panel
     was taller than the visible area when the iOS Safari toolbar is shown, so
     its top (lead-head + close button) hid behind the toolbar. dvh shrinks with
     the toolbar, keeping the header on screen. */
  .detail-overlay { padding: 0; align-items: flex-end; height: 100dvh; }
  .detail-panel { border-radius: 14px 14px 0 0; max-height: 88dvh; overflow-y: auto; overflow-x: hidden; padding: 18px 14px calc(18px + env(safe-area-inset-bottom, 0px)); }
  /* Mobile: name (left) and status badges (right) SIDE BY SIDE, not stacked.
     Name flexes and wraps; the badges column hugs the right (its inline
     padding-right:36px clears the absolute close button). */
  .detail-panel .lead-head { padding-right: 0; gap: 10px; }
  .detail-panel .lead-head > div { min-width: 0; }
  .detail-panel .lead-head > div:first-child { flex: 1 1 auto; }
  .detail-panel .lead-head > div:last-child { flex: 0 0 auto; }
  /* AWSales overlay (lh-cmd) has 4 action buttons that don't fit beside the name
     on a phone: stack instead. Name on its own row (clearing the absolute close
     button), buttons wrap left-aligned in a full-width row below, no overlap. */
  .detail-panel .lead-head.lh-cmd { flex-direction: column; align-items: stretch; }
  .detail-panel .lead-head.lh-cmd > div:first-child { padding-right: 40px; }
  .detail-panel .lead-head.lh-cmd .lead-cmd-actions { margin-left: 0; margin-right: 0; justify-content: flex-start; }
  .lead-actions { flex-wrap: wrap; }
  .lead-photos { grid-template-columns: 1fr 1fr; }
  .ld-form-grid { grid-template-columns: 1fr; }
  /* Tables scroll horizontally on mobile (table-wrap overflow-x) instead of hiding columns. */
}
.error-msg { color: var(--error); padding: 12px; background: rgba(239,68,68,0.1); border-radius: 8px; margin: 8px 0; }

/* Prompt preview */
.prompt-pre {
  background: var(--surface3); border-radius: 8px; padding: 14px;
  white-space: pre-wrap; word-break: break-word; color: var(--text);
  font-size: 12px; line-height: 1.6; max-height: 300px; overflow-y: auto;
}

/* Deliverables agent label */
.agent-label {
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 10px; margin-right: 4px;
}

/* ---- NRX Language Toggle ---- */
.lang-toggle {
  display: inline-flex; background: rgba(34,197,94,.08);
  border: 1px solid rgba(34,197,94,.2); border-radius: 100px; padding: 3px;
}
.lang-btn {
  background: transparent; border: none;
  font-family: 'Geist Mono', monospace; font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 5px 10px; border-radius: 100px;
  cursor: pointer; transition: all .18s ease; line-height: 1;
}
.lang-btn.active { background: var(--accent); color: var(--forest); }
.lang-btn:not(.active):hover { color: var(--elec); }
@media (max-width: 640px) {
  .lang-toggle { padding: 2px; }
  .lang-btn { font-size: 10px; padding: 4px 8px; }
}

/* ---- Planner / Roadmap Page ---- */
.planner-page { max-width: 100%; }
.planner-header { display:flex; align-items:center; gap:10px; margin-bottom:24px; }
.planner-title { font-family: var(--lora); font-size: 22px; font-weight:600; color: var(--text); }
/* alternador cards/lista do Workspace */
.rm-view-toggle { margin-left:auto; display:flex; gap:4px; }
.rm-view-btn { border:1px solid var(--border); background:var(--surface); color:var(--muted);
  border-radius:6px; padding:5px 10px; cursor:pointer; font-size:12px; }
.rm-view-btn:hover { color:var(--elec); border-color:var(--elec); }
.rm-view-btn.sel { color:var(--elec); border-color:var(--elec); background:rgba(34,197,94,.10); }
/* listagem de roadmaps */
.rm-lrows { display:flex; flex-direction:column; border:1px solid var(--border); border-radius:10px; overflow:hidden; }
.rm-lrow { position:relative; display:flex; align-items:center; gap:12px; padding:13px 16px;
  background:var(--surface); border-bottom:1px solid var(--border); cursor:pointer; }
.rm-lrow:last-child { border-bottom:none; }
.rm-lrow:hover { background:rgba(34,197,94,.05); }
.rm-lrow-fill { position:absolute; left:0; top:0; bottom:0; width:0; pointer-events:none;
  background:linear-gradient(90deg, rgba(34,197,94,.16), rgba(34,197,94,.04)); transition:width .35s ease; }
.rm-lrow > *:not(.rm-lrow-fill) { position:relative; }
.rm-lrow-icon { color:var(--elec); font-size:15px; width:20px; text-align:center; flex-shrink:0; }
.rm-lrow-title { font-size:13px; font-weight:600; color:var(--text); flex:1; min-width:0;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rm-lrow-agents { display:flex; gap:4px; flex-shrink:0; }
.rm-lrow-stats { font-size:11px; color:var(--muted); font-family:var(--mono); flex-shrink:0; }
.rm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin-bottom: 8px;
}
.rm-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px; cursor: pointer;
  transition: border-color .2s, transform .15s;
}
.rm-card:hover { border-color: var(--elec); transform: translateY(-2px); }
.rm-card-icon { font-size: 20px; margin-bottom: 8px; color: var(--elec); }
.rm-card-title { font-weight: 700; font-size: 14px; color: var(--text); margin-bottom: 10px; }
.rm-card-bar-outer { height: 4px; background: var(--border); border-radius: 2px; margin-bottom: 6px; overflow: hidden; }
.rm-card-bar-inner { height: 100%; background: var(--ok); border-radius: 2px; transition: width .4s; }
.rm-card-stats { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.rm-new-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent; border: 1px dashed var(--border);
  border-radius: 10px; padding: 16px 18px; cursor: pointer;
  color: var(--muted); font-size: 13px; width: 100%;
  transition: border-color .2s, color .2s;
}
.rm-new-btn:hover { border-color: var(--elec); color: var(--elec); }
.rm-back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 12px; cursor: pointer;
  background: none; border: none; margin-bottom: 16px; padding: 0;
}
.rm-back:hover { color: var(--text); }
.rm-detail-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rm-detail-title { font-family: var(--lora); font-size: 20px; font-weight: 600; color: var(--text); }
.rm-title-edit-btn { background:none; border:none; color:var(--muted); cursor:pointer; padding:4px 6px; border-radius:4px; font-size:12px; line-height:1; }
.rm-title-edit-btn:hover { color:var(--elec); background:rgba(34,197,94,.08); }
.rm-context-btn { background:none; border:none; color:var(--muted); cursor:pointer; padding:4px 6px; border-radius:4px; font-size:12px; line-height:1; }
.rm-context-btn:hover { color:var(--elec); background:rgba(34,197,94,.08); }
.rm-ring-wrap { position:relative; display:inline-flex; align-items:center; justify-content:center; }
.rm-ring-svg-cnt { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:38px; height:38px; pointer-events:none; opacity:0; transition:opacity .3s; }
.rm-ring-wrap.rm-ring-running .rm-ring-svg-cnt, .rm-ring-wrap.rm-ring-done .rm-ring-svg-cnt { opacity:1; }
.rm-progress-ring { width:38px; height:38px; }
.rm-ring-bg { fill:none; stroke:rgba(34,197,94,.12); stroke-width:2; }
.rm-ring-fill { fill:none; stroke:var(--elec); stroke-width:2; stroke-linecap:round; stroke-dasharray:100.53; stroke-dashoffset:100.53; transform-box:fill-box; transform-origin:center; }
@keyframes rm-ring-spin { to { transform:rotate(360deg); } }
.rm-ring-wrap.rm-ring-running .rm-ring-fill { stroke-dashoffset:75; animation:rm-ring-spin 1.2s linear infinite; }
.rm-ring-wrap.rm-ring-done .rm-ring-fill { stroke-dashoffset:0; transition:stroke-dashoffset .6s ease; }
.rm-title-input { font-family:var(--lora); font-size:20px; font-weight:600; color:var(--text); background:transparent; border:none; border-bottom:2px solid var(--elec); outline:none; min-width:200px; }
.rm-overall-bar-outer { height: 6px; background: var(--border); border-radius: 3px; margin-bottom: 6px; overflow: hidden; }
.rm-overall-bar-inner { height: 100%; background: var(--ok); border-radius: 3px; transition: width .4s; }
.rm-overall-label { font-size: 11px; color: var(--muted); font-family: var(--mono); margin-bottom: 20px; }
.rm-steps-wrap { position: relative; padding-left: 30px; }
.rm-steps-list {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: visible;
}
.rm-step-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  outline: none; transition: background .12s;
}
.rm-step-item:first-child { border-radius: 10px 10px 0 0; }
.rm-step-item:last-child { border-radius: 0 0 10px 10px; border-bottom: none; }
.rm-step-item.rm-step-task { cursor: pointer; }
.rm-step-item.rm-step-task:hover { background: rgba(34,197,94,.04); }
.rm-step-item.rm-step-task:focus { background: rgba(34,197,94,.06); }
.rm-step-item.rm-step-heading {
  cursor: pointer;
  background: rgba(26,78,46,.10);
  padding-top: 11px; padding-bottom: 11px;
}
.rm-step-item.rm-step-heading:hover { background: rgba(26,78,46,.16); }
.rm-step-num {
  position: absolute; left: -34px; top: 50%; transform: translateY(-50%);
  width: 28px; text-align: center;
  font-size: 11px; color: var(--muted); font-family: var(--mono);
}
.rm-step-heading .rm-step-num { color: var(--sage); }
.rm-sec-chevron { margin-left: auto; font-size: 10px; color: var(--muted); flex-shrink: 0; transition: transform .2s; }
.rm-step-item.rm-step-heading.collapsed .rm-sec-chevron { transform: rotate(-90deg); }
.rm-step-item.rm-sec-hidden { display: none !important; }
/* barra de progresso no fundo da linha de secao */
.rm-sec-fill { position:absolute; left:0; top:0; bottom:0; width:0; border-radius:inherit;
  background:linear-gradient(90deg, rgba(34,197,94,.22), rgba(34,197,94,.05));
  pointer-events:none; transition:width .35s ease; }
.rm-step-heading .rm-step-text, .rm-step-heading .rm-step-actions,
.rm-step-heading .rm-sec-chevron, .rm-sec-stats { position:relative; }
.rm-sec-stats { font-size:10px; color:var(--muted); font-family:var(--mono); flex-shrink:0; margin-left:8px; }
/* troca de icone do roadmap */
.rm-icon-btn { cursor:pointer; }
.rm-icon-btn:hover { opacity:.75; }
.rm-icon-grid { display:grid; grid-template-columns:repeat(8,1fr); gap:6px; }
.rm-icon-opt { width:38px; height:34px; border-radius:6px; border:1px solid var(--border); background:var(--surface2); color:var(--text); cursor:pointer; font-size:14px; }
.rm-icon-opt:hover { border-color:var(--elec); color:var(--elec); }
.rm-icon-opt.sel { border-color:var(--elec); background:rgba(34,197,94,.12); color:var(--elec); }
.rm-checkbox {
  flex-shrink: 0; width: 16px; height: 16px; border-radius: 3px;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.rm-step-item.done .rm-checkbox { background: var(--ok); border-color: var(--ok); }
.rm-checkbox-icon { font-size: 8px; color: #fff; opacity: 0; transition: opacity .15s; }
.rm-step-item.done .rm-checkbox-icon { opacity: 1; }
.rm-step-text { font-size: 13px; line-height: 1.45; color: var(--text); flex: 1; }
.rm-step-heading .rm-step-text { font-weight: 700; color: var(--text); }
.rm-step-item.done .rm-step-text { text-decoration: line-through; color: var(--muted); }
.rm-step-actions { display: none; gap: 3px; flex-shrink: 0; align-items: center; }
.rm-step-item.rm-step-task .rm-expand-ind { color:var(--muted); font-size:10px; opacity:0; transition:opacity .15s; margin-left:4px; }
.rm-step-item.rm-step-task:hover .rm-expand-ind { opacity:0.6; }
.rm-step-item.rm-step-task.expanded .rm-expand-ind { opacity:1; transform:rotate(90deg); }
.rm-step-detail-row { list-style:none; padding:0; margin:0; background:var(--surface); border-bottom:1px solid var(--border); display:none; }
.rm-step-detail-row.open { display:block; }
.rm-detail-panel { padding:14px 18px 16px 50px; display:grid; grid-template-columns:1fr 1fr; gap:14px 20px; }
.rm-detail-col { min-width:0; }
.rm-detail-col h4 { font-size:10px; text-transform:uppercase; letter-spacing:.6px; color:var(--muted); margin:0 0 6px; font-weight:600; }
.rm-detail-notes { width:100%; box-sizing:border-box; min-height:80px; background:var(--bg); border:1px solid var(--border); border-radius:6px; padding:8px 10px; color:var(--text); font-family:var(--mono); font-size:12px; resize:vertical; outline:none; }
.rm-detail-notes:focus { border-color:var(--elec); }
.rm-detail-files { list-style:none; padding:0; margin:0 0 6px; display:flex; flex-direction:column; gap:4px; }
.rm-detail-file { display:flex; align-items:center; gap:6px; padding:5px 8px; background:var(--bg); border:1px solid var(--border); border-radius:5px; font-size:11px; }
.rm-detail-file a { color:var(--elec); text-decoration:none; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rm-detail-file a:hover { text-decoration:underline; }
.rm-detail-file .rm-file-size { color:var(--muted); font-size:10px; }
.rm-detail-file .rm-file-del { background:none; border:none; color:var(--muted); cursor:pointer; padding:2px 4px; font-size:10px; }
.rm-detail-file .rm-file-del:hover { color:#ef4444; }
.rm-upload-btn { display:inline-flex; align-items:center; gap:5px; padding:5px 10px; background:transparent; border:1px dashed var(--border); border-radius:5px; color:var(--muted); cursor:pointer; font-size:11px; transition:all .15s; }
.rm-upload-btn:hover { border-color:var(--elec); color:var(--elec); }
.rm-detail-history { max-height:160px; overflow-y:auto; }
.rm-detail-history-item { padding:6px 0; border-bottom:1px solid var(--border); font-size:11px; }
.rm-detail-history-item:last-child { border-bottom:none; }
.rm-detail-history-item .rm-dh-meta { color:var(--muted); font-size:10px; margin-bottom:2px; }
.rm-detail-history-item .rm-dh-note { color:var(--text); line-height:1.4; }
.rm-detail-empty { color:var(--muted); font-size:11px; font-style:italic; }
.rm-detail-actions { grid-column:1/-1; display:flex; gap:8px; align-items:center; }
.rm-detail-status { font-size:11px; color:var(--muted); }
.rm-detail-status.saved { color:var(--elec); }
@media (max-width:768px){ .rm-detail-panel { grid-template-columns:1fr; padding-left:18px; } }

.rm-step-item:hover .rm-step-actions { display: flex; }
.rm-step-action-btn { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 10px; padding: 2px 5px; border-radius: 3px; line-height: 1; }
.rm-step-action-btn:hover { color: var(--elec); background: rgba(34,197,94,.1); }
.rm-step-inline-input {
  flex: 1; background: transparent; border: none;
  border-bottom: 1.5px solid var(--elec);
  color: var(--text); font-size: 13px; padding: 2px 0; outline: none; min-width: 0;
  font-family: inherit;
}
.rm-step-heading .rm-step-inline-input { font-weight: 700; }
.rm-inline-add-row { background: rgba(34,197,94,.03); }
.rm-inline-add-row:last-child { border-radius: 0 0 10px 10px; border-bottom: none; }
.rm-activity-feed { margin-top: 20px; }
.rm-activity-title { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 8px; }
.rm-activity-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); }
.rm-activity-item:last-child { border-bottom: none; }
.rm-activity-badge { flex-shrink: 0; padding: 2px 7px; border-radius: 20px; font-size: 9px; font-weight: 700; margin-top: 1px; }
.rm-activity-body { flex: 1; min-width: 0; }
.rm-activity-task { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-activity-note { font-size: 11px; color: var(--muted); margin-top: 2px; }
.rm-activity-ts { flex-shrink: 0; font-size: 10px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.rm-activity-done { color: var(--ok); }
.rm-activity-note-icon { color: var(--info); }
.rm-activity-undone { color: var(--warn); }
.rm-step-item.rm-last-visible { border-radius: 0 0 10px 10px !important; border-bottom: none !important; }
.rm-agent-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.rm-agent-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; cursor: default; }
.rm-agent-badge i { font-size: 9px; opacity: 0.75; }
.rm-agent-rm-btn { background: none; border: none; cursor: pointer; opacity: 0.5; padding: 0 0 0 3px; font-size: 10px; line-height: 1; color: inherit; }
.rm-agent-rm-btn:hover { opacity: 1; }
.rm-agent-assign-btn { font-size: 11px; padding: 3px 10px; border-radius: 20px; border: 1px dashed var(--border); background: none; color: var(--muted); cursor: pointer; }
.rm-agent-assign-btn:hover { border-color: var(--elec); color: var(--elec); }
.rm-card-agents { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }

/* === Floating chat widget === */
/* Small + translucent at rest so it never hides page content; solid on hover. */
#ops-chat-fab { position:fixed; bottom:14px; right:14px; width:38px; height:38px; border-radius:50%;
  background:linear-gradient(135deg, var(--elec) 0%, #16a34a 100%); color:#fff; border:none; cursor:pointer;
  box-shadow:0 3px 12px rgba(0,0,0,.3), 0 0 0 1px rgba(255,255,255,.06) inset;
  display:flex; align-items:center; justify-content:center; font-size:15px; z-index:9999;
  opacity:.45;
  transition:transform .15s ease, box-shadow .15s ease, opacity .15s ease; }
#ops-chat-fab:hover { transform:scale(1.1); opacity:1; box-shadow:0 8px 22px rgba(0,0,0,.5); }
#ops-chat-fab.hidden { display:none; }
/* Agency portal: external partners see ONLY their performance, no internal nav/chat. */
body.agency-portal #sidebar { display:none !important; }
body.agency-portal #main-content { margin-left:0 !important; max-width:100% !important; width:auto !important; }
body.agency-portal #ops-chat-fab, body.agency-portal #ops-chat-panel { display:none !important; }
/* Read-only AWSales partner: full operator UI but no agent chat (writes/agents are 403 server-side). */
body.partner #ops-chat-fab, body.partner #ops-chat-panel { display:none !important; }
body:not(.authed) #ops-chat-fab, body:not(.authed) #ops-chat-panel { display:none !important; }
#ops-chat-panel { position:fixed; bottom:22px; right:22px; width:380px; height:560px; max-height:78vh;
  background:var(--surface); border:1px solid var(--border); border-radius:14px; z-index:9999;
  box-shadow:0 18px 50px rgba(0,0,0,.55); display:none; flex-direction:column; overflow:hidden;
  font-family:var(--ui-font, system-ui); }
#ops-chat-panel.open { display:flex; }
.ops-chat-header { display:flex; align-items:center; gap:6px; padding:8px 10px;
  background:linear-gradient(180deg, rgba(22,163,74,.08), rgba(255,255,255,.02)); border-bottom:1px solid var(--border);
  backdrop-filter:saturate(140%); }
.ops-chat-title { font-size:12px; font-weight:600; color:var(--text); display:inline-flex; align-items:center; gap:6px;
  letter-spacing:.2px; white-space:nowrap; background:transparent; border:1px solid transparent; cursor:pointer;
  padding:3px 8px; border-radius:6px; font-family:inherit; transition:all .15s ease; }
.ops-chat-title:hover { background:rgba(255,255,255,.04); border-color:var(--border); }
.ops-chat-title .ops-chat-dot { width:7px; height:7px; border-radius:50%; background:#16a34a;
  box-shadow:0 0 0 2px rgba(22,163,74,.18); animation:opspulse 2.4s ease-in-out infinite; transition:background .2s; }
.ops-chat-title.is-fast .ops-chat-dot { background:#fbbf24; box-shadow:0 0 0 2px rgba(251,191,36,.18); }
.ops-chat-title.is-fast { color:#fde68a; }
@keyframes opspulse { 0%,100%{filter:brightness(1)} 50%{filter:brightness(1.4)} }
.ops-chat-sel-group { margin-left:auto; display:flex; align-items:center; gap:0;
  background:var(--bg); border:1px solid var(--border); border-radius:6px; overflow:hidden; }
.ops-chat-sel-group select { background:#0a0a0a; border:none; color:var(--text); font-size:11px;
  padding:4px 6px; cursor:pointer; outline:none; max-width:118px; appearance:none;
  color-scheme:dark;
  background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);
  background-position:calc(100% - 10px) 50%,calc(100% - 6px) 50%; background-size:4px 4px,4px 4px; background-repeat:no-repeat;
  padding-right:18px; }
.ops-chat-sel-group select:hover { color:var(--elec); }
.ops-chat-sel-group select + select { border-left:1px solid var(--border); }
.ops-chat-sel-group select option { background:#0a0a0a; color:var(--text); }
.ops-chat-sel-group select option:checked { background:#16a34a; color:#fff; }
.ops-chat-icon-btn { width:24px; height:24px; display:inline-flex; align-items:center; justify-content:center;
  background:transparent; border:1px solid transparent; color:var(--muted); cursor:pointer; padding:0;
  border-radius:6px; font-size:13px; line-height:1; transition:all .12s ease; }
.ops-chat-icon-btn:hover { color:var(--text); background:rgba(255,255,255,.06); border-color:var(--border); }
.ops-chat-icon-btn.danger:hover { color:#fff; background:rgba(220,38,38,.7); border-color:rgba(220,38,38,.8); }

.ops-chat-body { flex:1; overflow-y:auto; padding:12px; display:flex; flex-direction:column; gap:10px;
  background:var(--bg); }
.ops-chat-msg { max-width:88%; padding:8px 11px; border-radius:10px; font-size:13px; line-height:1.45;
  white-space:pre-wrap; word-wrap:break-word; }
.ops-chat-msg.user { align-self:flex-end; background:var(--elec); color:#fff; border-bottom-right-radius:3px; }
.ops-chat-msg.agent { align-self:flex-start; background:var(--surface); color:var(--text);
  border:1px solid var(--border); border-bottom-left-radius:3px; }
.ops-chat-msg.system { align-self:center; background:transparent; color:var(--muted); font-size:11px;
  font-style:italic; padding:2px 6px; }
.ops-chat-msg .meta { display:block; font-size:10px; opacity:.7; margin-top:3px; }
.ops-chat-typing { align-self:flex-start; color:var(--muted); font-size:12px; padding:4px 8px; }
.ops-chat-typing::after { content:''; display:inline-block; width:4px; height:4px; border-radius:50%;
  background:currentColor; animation:opsdot 1.2s infinite; margin-left:4px; }
@keyframes opsdot { 0%,100%{opacity:.3} 50%{opacity:1} }
.ops-chat-input-wrap { border-top:1px solid var(--border); padding:8px; display:flex; gap:6px;
  background:var(--surface); }
.ops-chat-input { flex:1; resize:none; min-height:34px; max-height:120px; padding:8px 10px;
  background:var(--bg); border:1px solid var(--border); border-radius:8px; color:var(--text);
  font-size:13px; font-family:inherit; outline:none; }
.ops-chat-input:focus { border-color:var(--elec); }
.ops-chat-send { background:var(--elec); color:#fff; border:none; border-radius:8px; padding:0 14px;
  cursor:pointer; font-size:13px; font-weight:600; }
.ops-chat-send:disabled { opacity:.5; cursor:not-allowed; }


.ops-chat-msg{overflow-wrap:anywhere;word-break:break-word}
.ops-chat-msg pre.ops-chat-code{background:#0a0a0a;border:1px solid var(--border);border-radius:6px;padding:8px;margin:6px 0;font-size:11px;line-height:1.35;white-space:pre;overflow-x:auto;max-width:100%;color:#d4d4d4;font-family:ui-monospace,Menlo,monospace}
.ops-chat-msg pre.ops-chat-code::-webkit-scrollbar{height:6px}
.ops-chat-msg pre.ops-chat-code::-webkit-scrollbar-thumb{background:#333;border-radius:3px}
.ops-chat-msg code{background:#0a0a0a;border:1px solid var(--border);border-radius:3px;padding:1px 4px;font-size:11px;color:#d4d4d4;font-family:ui-monospace,Menlo,monospace}
.ops-chat-msg strong{color:#fff;font-weight:700}
.ops-chat-msg em{font-style:italic}
.ops-chat-msg a{color:var(--elec);text-decoration:underline}

.ops-chat-msg{position:relative}
.ops-chat-msg .meta{display:flex;gap:6px;align-items:center;font-size:10px;opacity:.7;margin-top:4px}
.ops-chat-msg .meta-model{font-size:9px;opacity:.85;background:rgba(255,255,255,.06);border:1px solid var(--border);padding:0 5px;border-radius:3px}
.ops-chat-footer .meta-dur{font-size:9px;opacity:.7;color:var(--muted);margin-left:4px}
.ops-chat-msg .msg-meta{margin-top:4px;font-size:10px;color:var(--muted)}

/* Skills toolbar (NuestraRX bridge) */
.ops-chat-skills { display:flex; gap:4px; padding:6px 8px; background:rgba(0,0,0,.18);
  border-bottom:1px solid var(--border); flex-wrap:wrap; align-items:center; }
.ops-chat-skills .ops-skills-label { font-size:10px; color:var(--muted); margin-right:4px;
  letter-spacing:.4px; text-transform:uppercase; }
.ops-chat-skill-btn { background:rgba(22,163,74,.12); color:#86efac;
  border:1px solid rgba(22,163,74,.3); border-radius:5px; font-size:10px; padding:3px 8px;
  cursor:pointer; font-weight:600; letter-spacing:.2px; transition:all .12s ease; font-family:inherit; }
.ops-chat-skill-btn:hover { background:rgba(22,163,74,.24); color:#bbf7d0; border-color:rgba(22,163,74,.5); }
.ops-chat-skill-btn:disabled { opacity:.4; cursor:wait; }
.ops-chat-msg .msg-meta__summary{cursor:pointer;list-style:none;display:inline-flex;align-items:center;gap:4px;opacity:.75;user-select:none}
.ops-chat-msg .msg-meta__summary::-webkit-details-marker{display:none}
.ops-chat-msg .msg-meta[open] .msg-meta__summary-icon{transform:rotate(90deg)}
.ops-chat-msg .msg-meta__summary-icon{display:inline-block;transition:transform .15s ease;font-size:9px}
.ops-chat-msg .msg-meta__details{display:inline-flex;flex-wrap:wrap;gap:6px;margin-left:8px;align-items:center}
.ops-chat-msg .msg-meta__tokens,.ops-chat-msg .msg-meta__cache,.ops-chat-msg .msg-meta__ctx,.ops-chat-msg .msg-meta__model{background:rgba(255,255,255,.04);border:1px solid var(--border);border-radius:3px;padding:0 5px;font-size:9px}
.ops-chat-msg .msg-meta__model{color:var(--elec)}
.chat-copy-btn{position:absolute;top:-10px;right:-10px;z-index:2;background:var(--surface);border:1px solid var(--border);color:var(--muted);width:24px;height:24px;border-radius:50%;cursor:pointer;display:none;align-items:center;justify-content:center;font-size:10px;padding:0;box-shadow:0 2px 6px rgba(0,0,0,.4)}
.ops-chat-row.agent{position:relative}
.ops-chat-row.agent:hover .chat-copy-btn{display:inline-flex}
.chat-copy-btn:hover{color:var(--text);border-color:var(--elec)}
.chat-copy-btn .chat-copy-btn__check{display:none}
.chat-copy-btn.copied{color:#16a34a;border-color:#16a34a}
.chat-copy-btn.copied .fa-copy{display:none}
.chat-copy-btn.copied .chat-copy-btn__check{display:inline}
.ops-chat-row{display:flex;flex-direction:column;max-width:88%;gap:3px}
.ops-chat-row.user{align-self:flex-end;align-items:flex-end}
.ops-chat-row.agent{align-self:flex-start;align-items:flex-start;width:88%}
.ops-chat-row.system{align-self:center}
.ops-chat-row .ops-chat-msg{max-width:100%}
.ops-chat-footer{display:flex;align-items:center;gap:6px;flex-wrap:wrap;padding:0 4px;width:100%;box-sizing:border-box}
.ops-chat-footer .meta-model{font-size:9px;opacity:.85;background:rgba(255,255,255,.06);border:1px solid var(--border);padding:0 5px;border-radius:3px;color:var(--elec)}
