@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,500;8..60,600&display=swap');

:root, [data-theme="light"] {
  --bg: #f3f5f8;
  --bg-accent: #e8eef5;
  --panel: #ffffff;
  --card: #ffffff;
  --line: #e2e8f0;
  --line-soft: #eef2f7;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --accent2: #0369a1;
  --ok: #059669;
  --ok-bg: #ecfdf5;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --err: #dc2626;
  --err-bg: #fef2f2;
  --chip: #f1f5f9;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --radius: 16px;
  --radius-sm: 10px;
  --nav-w: 260px;
  --nav-bg: #0b1f2a;
  --nav-text: #e2e8f0;
  --nav-muted: #94a3b8;
  --nav-hover: rgba(255,255,255,.06);
  --nav-active: rgba(13,148,136,.22);
  --font: "Outfit", "Segoe UI", system-ui, sans-serif;
  --font-display: "Source Serif 4", Georgia, serif;
  --live: #10b981;
}

[data-theme="dark"] {
  --bg: #0b1220;
  --bg-accent: #121a2b;
  --panel: #121a2b;
  --card: #152033;
  --line: #273449;
  --line-soft: #1e2a3d;
  --text: #e8eef8;
  --muted: #93a4bd;
  --accent: #2dd4bf;
  --accent-soft: #134e4a;
  --accent2: #38bdf8;
  --ok: #34d399;
  --ok-bg: #064e3b;
  --warn: #fbbf24;
  --warn-bg: #422006;
  --err: #f87171;
  --err-bg: #450a0a;
  --chip: #1e293b;
  --shadow: 0 10px 30px rgba(0,0,0,.28);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.2);
  --nav-bg: #080e18;
  --nav-text: #e8eef8;
  --nav-muted: #7f91ab;
  --nav-hover: rgba(255,255,255,.05);
  --nav-active: rgba(45,212,191,.15);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .55rem .75rem;
}
button {
  cursor: pointer;
  background: var(--accent); color: #fff; border-color: transparent;
  font-weight: 600; transition: transform .12s ease, opacity .12s ease, box-shadow .12s ease;
}
button:hover { opacity: .92; }
button:active { transform: translateY(1px); }
button.secondary {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
button.danger { background: var(--err); color: #fff; border-color: transparent; }
button:disabled { opacity: .5; cursor: not-allowed; }
textarea { width: 100%; min-height: 90px; resize: vertical; }

.app { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }
.app.hidden { display: none !important; }

.nav {
  background: var(--nav-bg); color: var(--nav-text);
  padding: 1.1rem .85rem 1rem;
  position: sticky; top: 0; height: 100vh; overflow: auto;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.06);
}
.brand {
  display: flex; align-items: center; gap: .75rem;
  padding: .35rem .55rem 1.15rem;
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  background: linear-gradient(145deg, #14b8a6, #0f766e 55%, #0369a1);
  display: grid; place-items: center;
  box-shadow: 0 8px 20px rgba(15,118,110,.35);
  flex-shrink: 0;
}
.brand-mark svg { width: 22px; height: 22px; color: #fff; }
.brand-copy strong {
  display: block; font-size: 1.15rem; letter-spacing: .01em; color: #fff;
}
.brand-copy span { color: var(--nav-muted); font-size: .78rem; }

.nav-section {
  margin: .55rem .55rem .35rem;
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--nav-muted);
}
.nav a.item, .nav button.item {
  display: flex; align-items: center; gap: .6rem;
  width: 100%; text-align: left;
  color: var(--nav-text); background: transparent; border: 0;
  padding: .58rem .75rem; border-radius: 12px; margin-bottom: .15rem;
  font-weight: 500; box-shadow: none;
}
.nav a.item:hover, .nav button.item:hover { background: var(--nav-hover); opacity: 1; }
.nav a.item.active, .nav button.item.active {
  background: var(--nav-active); color: #fff;
}
.nav .item .ico { width: 1.1rem; opacity: .85; font-size: .95rem; }
.nav-sep { height: 1px; background: rgba(255,255,255,.08); margin: .75rem .55rem; }
.nav-foot { margin-top: auto; padding: .75rem .55rem .25rem; }
.user-menu { display: flex; flex-direction: column; gap: .45rem; }
.user-name { font-size: .82rem; color: var(--nav-muted); word-break: break-word; }
.live-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .72rem; color: var(--nav-muted); margin: 0 .55rem .65rem;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--live);
  box-shadow: 0 0 0 3px rgba(16,185,129,.2);
  animation: pulse 2s ease infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16,185,129,.15); }
  50% { box-shadow: 0 0 0 5px rgba(16,185,129,.08); }
}

.main {
  padding: 1.25rem 1.5rem 2.5rem;
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(15,118,110,.08), transparent 55%),
    radial-gradient(700px 360px at -10% 0%, rgba(3,105,161,.06), transparent 50%),
    var(--bg);
  min-width: 0;
}
.topbar {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.topbar h1 {
  margin: 0; font-family: var(--font-display); font-size: 1.65rem; font-weight: 600;
}
.topbar .meta { color: var(--muted); font-size: .9rem; margin-top: .2rem; max-width: 52rem; line-height: 1.45; }
.topbar-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1rem; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.15rem; box-shadow: var(--shadow); grid-column: span 4;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.card:hover { box-shadow: 0 4px 20px rgba(15,23,42,.08); }
.card.wide { grid-column: span 8; }
.card.full { grid-column: span 12; }
.card.span6 { grid-column: span 6; }
.card.span3 { grid-column: span 3; }
.card.span4 { grid-column: span 4; }
.card.span5 { grid-column: span 5; }
.card.span7 { grid-column: span 7; }
.card h2 {
  margin: 0 0 .85rem; font-size: .78rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: .75rem; margin-bottom: .85rem;
}
.card-head h2 { margin: 0; }

.kpi { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; }
.kpi-label { color: var(--muted); font-size: .82rem; margin-top: .15rem; }
.muted { color: var(--muted); }
.tiny { font-size: .75rem; }

.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .55rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600;
  background: var(--chip); border: 1px solid var(--line); color: var(--muted);
}
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.err { background: var(--err-bg); color: var(--err); border-color: transparent; }
.badge.neutral { background: var(--chip); color: var(--muted); }
.friendly { text-transform: none !important; letter-spacing: 0 !important; }

.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td {
  text-align: left; padding: .7rem .45rem;
  border-bottom: 1px solid var(--line-soft); vertical-align: top;
}
.table th {
  color: var(--muted); font-weight: 600; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .04em;
}
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: .65rem; }
.list-item {
  padding: .75rem 0; border-bottom: 1px solid var(--line-soft);
}
.list-item:last-child { border-bottom: 0; }

.progress {
  height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden;
}
.progress > span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.progress-meta {
  display: flex; justify-content: space-between; gap: .5rem;
  font-size: .82rem; color: var(--muted); margin-bottom: .35rem;
}

.greeting {
  font-family: var(--font-display); font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  font-weight: 600; margin: 0 0 .35rem; letter-spacing: -.01em;
}
.subgreeting { color: var(--muted); margin: 0 0 1.25rem; max-width: 46rem; line-height: 1.5; }

.kpi-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: .85rem;
  margin-bottom: 1rem;
}
.kpi-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: .9rem 1rem; box-shadow: var(--shadow-sm);
}
.kpi-card .kpi { font-size: 1.45rem; }
.timeline { position: relative; padding-left: 1.1rem; }
.timeline::before {
  content: ""; position: absolute; left: .28rem; top: .2rem; bottom: .2rem;
  width: 2px; background: var(--line);
}
.tl-item { position: relative; padding: 0 0 1rem .35rem; }
.tl-item::before {
  content: ""; position: absolute; left: -1.05rem; top: .35rem;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--card);
}
.tl-time { font-size: .72rem; color: var(--muted); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: .8rem;
  background: var(--accent-soft); color: var(--accent); flex-shrink: 0;
}
.person-row { display: flex; gap: .75rem; align-items: flex-start; }
.funnel {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem;
}
.funnel-step {
  background: var(--chip); border-radius: 12px; padding: .7rem .55rem; text-align: center;
}
.funnel-step strong { display: block; font-size: 1.1rem; }
.funnel-step span { font-size: .7rem; color: var(--muted); }

.content-tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .85rem; }
.content-tabs button {
  background: transparent; color: var(--muted); border: 1px solid transparent;
  font-weight: 600; padding: .4rem .75rem;
}
.content-tabs button.active {
  background: var(--accent-soft); color: var(--accent); border-color: transparent;
}
.content-card {
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  background: var(--panel); display: flex; flex-direction: column; height: 100%;
}
.content-thumb {
  aspect-ratio: 16/10; background: linear-gradient(135deg, var(--bg-accent), var(--accent-soft));
  display: grid; place-items: center; color: var(--muted); font-size: .8rem;
}
.content-thumb img { width: 100%; height: 100%; object-fit: cover; }
.content-body { padding: .85rem; flex: 1; display: flex; flex-direction: column; gap: .45rem; }
.cards-3 {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem;
}

.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.conn-card {
  border: 1px solid var(--line); border-radius: 16px; padding: 1.05rem;
  background: var(--card); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: .55rem; min-height: 170px;
}
.conn-ico {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700;
}
.conn-card h3 { margin: 0; font-size: 1rem; }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: .35rem;
}
.status-dot.ok { background: var(--ok); }
.status-dot.warn { background: var(--warn); }
.status-dot.err { background: var(--err); }
.status-dot.neutral { background: #94a3b8; }

.approval-card {
  border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem;
  background: var(--card); box-shadow: var(--shadow-sm);
}
.approval-preview {
  background: var(--chip); border-radius: 12px; padding: .75rem .85rem;
  white-space: pre-wrap; max-height: 9rem; overflow: auto;
  font-size: .86rem; line-height: 1.45; margin: .65rem 0;
}
.skel {
  background: linear-gradient(90deg, var(--line-soft), var(--chip), var(--line-soft));
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite;
  border-radius: 8px; height: 1rem;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.toast {
  position: fixed; right: 1rem; bottom: 1rem;
  background: var(--panel); border: 1px solid var(--line);
  color: var(--text); padding: .8rem 1rem; border-radius: 12px;
  box-shadow: var(--shadow); z-index: 50; max-width: 360px;
}
.toast.err { border-color: var(--err); background: var(--err-bg); }
.modal-back {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 40; padding: 1rem; backdrop-filter: blur(2px);
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 1.15rem; width: min(560px, 100%); box-shadow: var(--shadow);
  max-height: min(90vh, 900px); overflow: auto;
}
.modal.wide { width: min(720px, 100%); }
.wizard-steps {
  display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .85rem;
}
.wizard-steps span {
  font-size: .72rem; padding: .2rem .55rem; border-radius: 999px;
  background: var(--chip); color: var(--muted); border: 1px solid var(--line);
}
.wizard-steps span.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.wizard-steps span.done { color: var(--text); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem;
  flex-shrink: 0;
}
.pill-row { display: flex; flex-wrap: wrap; gap: .35rem; }
.pill {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .15rem .55rem; border-radius: 999px; font-size: .75rem;
  background: var(--chip); border: 1px solid var(--line); color: var(--text);
}
.pill.role { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
.pill.on { background: #dcfce7; color: #166534; border-color: transparent; }
.pill.off { background: #fee2e2; color: #991b1b; border-color: transparent; }
.user-card, .biz-card {
  display: flex; gap: .85rem; align-items: flex-start;
  padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
}
.user-card .meta-line, .biz-card .meta-line { color: var(--muted); font-size: .85rem; margin-top: .2rem; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .75rem; }
.check-grid label { display: flex; gap: .45rem; align-items: center; font-size: .9rem; }
.espo-results { max-height: 180px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.espo-results button {
  display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; background: transparent; color: var(--text); padding: .55rem .75rem; box-shadow: none;
}
.espo-results button:hover { background: var(--chip); }
.espo-results button:last-child { border-bottom: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 1.35rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filters input, .filters select { min-width: 140px; }
.preset-cards { display: grid; grid-template-columns: 1fr; gap: .5rem; }
.preset-cards label {
  border: 1px solid var(--line); border-radius: 12px; padding: .75rem; cursor: pointer;
  display: block;
}
.preset-cards label.on { border-color: var(--accent); background: var(--accent-soft); }
.hidden { display: none !important; }
.loading { color: var(--muted); }
.empty {
  color: var(--muted); font-size: .92rem; padding: 1rem .25rem;
  text-align: center; line-height: 1.45;
}
.empty-box {
  border: 1px dashed var(--line); border-radius: 14px; padding: 1.5rem 1rem;
  background: var(--chip);
}
.mobile-toggle { display: none; }

.unlock-gate {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(700px 400px at 20% 20%, rgba(15,118,110,.25), transparent),
    linear-gradient(160deg, #0b1f2a 0%, #0f766e 100%);
  padding: 1.5rem;
}
.unlock-gate.hidden { display: none; }
.unlock-card {
  width: min(420px, 100%); background: #fff; color: #0f172a;
  border-radius: 18px; padding: 1.75rem;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.unlock-card h1 { margin: 0 0 .25rem; font-family: var(--font-display); font-size: 1.85rem; }
.unlock-card input {
  width: 100%; box-sizing: border-box; margin: .75rem 0 1rem;
  padding: .75rem .9rem; border: 1px solid #cbd5e1; border-radius: 10px;
}
.unlock-card button { width: 100%; }
.btn-primary-link {
  display: block; text-align: center; margin-top: 1rem;
  padding: .8rem 1rem; background: #0f766e; color: #fff !important;
  text-decoration: none; border-radius: 10px; font-weight: 600;
}
.err-text { color: #b91c1c; font-size: .9rem; }

.theme-seg {
  display: inline-flex; border: 1px solid var(--line); border-radius: 999px;
  overflow: hidden; background: var(--panel);
}
.theme-seg button {
  border: 0; border-radius: 0; background: transparent; color: var(--muted);
  padding: .35rem .65rem; font-size: .75rem; box-shadow: none;
}
.theme-seg button.active { background: var(--accent-soft); color: var(--accent); }

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .funnel { grid-template-columns: repeat(4, 1fr); }
  .cards-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .nav {
    position: fixed; inset: 0 auto 0 0; width: min(84vw, 290px);
    transform: translateX(-105%); transition: .2s; z-index: 30;
  }
  .nav.open { transform: translateX(0); }
  .mobile-toggle { display: inline-flex; }
  .card, .card.wide, .card.span6, .card.span3, .card.span4, .card.span5, .card.span7 { grid-column: span 12; }
  .kpi-grid, .funnel, .cards-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .kpi-grid, .funnel, .cards-3 { grid-template-columns: 1fr; }
  .main { padding: 1rem; }
}

/* Floating Divine companion — frameless transparent 3D humanoid (no photo box) */
.divine-companion {
  position: fixed;
  left: 0; top: 0;
  z-index: 45;
  /* Oversized hit/view box so limbs never look cropped by a rectangle */
  width: 340px;
  height: 540px;
  pointer-events: none;
  will-change: transform;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  overflow: visible !important;
  /* Soft silhouette shadow only — not a rectangular drop-shadow plate */
  filter: drop-shadow(0 14px 18px rgba(2, 132, 199, .22));
}
.divine-companion .dc-figure { pointer-events: auto; }
.dc-aura {
  display: none; /* rectangular glow plate removed */
}
.dc-figure {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  cursor: grab;
  outline: none;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  overflow: visible !important;
  transform-origin: 50% 92%;
}
.dc-figure:active { cursor: grabbing; }
.dc-figure:focus-visible { filter: drop-shadow(0 0 0 2px var(--divine-cyan, #22d3ee)); }
.dc-char-host,
.dc-char-svg,
.dc-char-canvas {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  pointer-events: none;
  user-select: none;
}
.dc-char-host--3d {
  position: relative;
  width: 100%;
  height: 100%;
  background: transparent !important;
  overflow: visible !important;
}
.dc-char-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  background: transparent !important;
}
.dc-3d-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--accent);
  font-weight: 700;
}
.divine-companion.is-jumping .dc-figure {
  transition: none;
}
.dc-speech {
  position: absolute;
  left: 50%;
  top: -0.35rem;
  transform: translate(-50%, -100%);
  z-index: 2;
  max-width: 200px;
  padding: .35rem .65rem;
  border-radius: 12px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  box-shadow: var(--shadow-sm);
  text-align: center;
  pointer-events: none;
  backdrop-filter: blur(6px);
}
.dc-speech[hidden] { display: none !important; }

/* Controls live OFF the figure so Follow never blocks mode changes */
.dc-controls {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .28rem;
  max-width: min(420px, calc(100vw - 2rem));
  padding: .35rem .45rem;
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md, 0 10px 28px rgba(0,0,0,.18));
  backdrop-filter: blur(10px);
  pointer-events: auto;
}
.dc-controls-label {
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0 .3rem;
}
.dc-controls button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  padding: .35rem .5rem;
  border-radius: 10px;
  box-shadow: none;
  cursor: pointer;
}
.dc-controls button:hover,
.dc-controls button.active {
  background: var(--accent-soft);
  color: var(--accent);
  opacity: 1;
}

.divine-companion[data-state="NEEDS_ATTENTION"] .dc-aura,
.divine-companion[data-state="ERROR"] .dc-aura {
  background: radial-gradient(ellipse at center, rgba(251,191,36,.42), transparent 70%);
}
.divine-companion[data-state="PAUSED"] {
  filter: grayscale(.3) drop-shadow(0 12px 22px rgba(0,0,0,.22));
  opacity: .9;
}

.presence-dock {
  min-height: 140px;
  display: flex; align-items: center; justify-content: center;
}
.presence-dock-card {
  text-align: center;
  padding: .75rem 1rem;
  max-width: 260px;
  position: relative;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.presence-dock-glow {
  width: 72px; height: 72px; margin: 0 auto .5rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34,211,238,.45), transparent 70%);
  animation: pulse 2.4s ease infinite;
}
.presence-dock-card p { margin: .2rem 0; font-size: .88rem; }

@media (max-width: 700px) {
  .divine-companion { width: 250px; height: 420px; }
  .dc-controls { right: .5rem; bottom: .5rem; left: .5rem; max-width: none; }
}

/* legacy live host unused when companion floats */
.presence-live:not(.presence-dock) { min-height: 160px; }
:root, [data-theme="light"] {
  --divine-cyan: #0891b2;
  --divine-blue: #0284c7;
  --divine-glow: rgba(8, 145, 178, .35);
}
[data-theme="dark"] {
  --divine-cyan: #22d3ee;
  --divine-blue: #38bdf8;
  --divine-glow: rgba(34, 211, 238, .45);
}

.hero-divine {
  display: grid;
  grid-template-columns: 1.35fr .9fr;
  gap: 1.25rem;
  align-items: stretch;
  margin-bottom: 1.15rem;
  padding: 1.25rem 1.35rem;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(240,249,255,.88)),
    radial-gradient(600px 280px at 90% 20%, rgba(8,145,178,.12), transparent 60%);
  box-shadow: var(--shadow);
  position: relative;
  overflow: visible;
}
[data-theme="dark"] .hero-divine {
  background:
    linear-gradient(135deg, rgba(18,26,43,.95), rgba(15,32,48,.9)),
    radial-gradient(600px 280px at 85% 15%, rgba(34,211,238,.18), transparent 55%);
}
.hero-copy { min-width: 0; z-index: 1; }
.hero-copy .greeting {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.4vw, 2.05rem);
  font-weight: 600;
  margin: 0 0 .45rem;
  letter-spacing: -.01em;
}
.hero-copy .subgreeting {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.5;
  margin: 0 0 1rem;
  max-width: 36rem;
}
.divine-status-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .7rem; border-radius: 999px;
  font-size: .8rem; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid transparent;
  margin-bottom: .85rem;
}
.divine-status-chip.waiting { background: var(--chip); color: var(--muted); }
.divine-status-chip.needs { background: var(--warn-bg); color: var(--warn); }
.divine-status-chip.paused { background: var(--chip); color: var(--muted); opacity: .85; }
.divine-status-chip.error { background: var(--warn-bg); color: var(--warn); }
.divine-status-chip .pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent);
  animation: pulse 2.2s ease infinite;
}
.hero-next {
  padding: .75rem .9rem;
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  border: 1px solid var(--line-soft);
  margin-bottom: .9rem;
}
.hero-next .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.hero-next .value { margin-top: .25rem; font-weight: 600; line-height: 1.4; }
.hero-stats {
  display: flex; flex-wrap: wrap; gap: .65rem;
}
.hero-stat {
  min-width: 7.5rem;
  padding: .55rem .7rem;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.hero-stat strong { display: block; font-size: 1.15rem; }
.hero-stat span { font-size: .75rem; color: var(--muted); }

.presence-stage {
  position: relative;
  display: flex; align-items: flex-end; justify-content: center;
  min-height: 300px;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.presence-stage::before { display: none; }
.presence-stage-inner {
  position: relative;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}
.presence-live {
  position: relative;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 300px;
}
.divine-avatar {
  width: 100%;
  max-width: 300px;
  height: auto;
  display: block;
  overflow: visible;
  color: var(--muted);
  filter: drop-shadow(0 18px 40px rgba(2, 132, 199, .28));
  outline: none;
  transition: filter .25s ease;
}
.divine-avatar:focus-visible {
  filter: drop-shadow(0 18px 40px rgba(2, 132, 199, .45)) drop-shadow(0 0 0 2px var(--divine-cyan));
}
.presence-stage-inner[data-state="WORKING"] .divine-avatar {
  animation: none;
}
.presence-stage-inner[data-state="NEEDS_ATTENTION"] .dv-aura,
.presence-stage-inner[data-state="ERROR"] .dv-aura {
  fill: url(#dvAura);
}
.presence-stage-inner[data-state="PAUSED"] .divine-avatar {
  filter: grayscale(.35) drop-shadow(0 10px 24px rgba(0,0,0,.15));
  opacity: .85;
}
.presence-live-caption {
  position: absolute; left: 50%; bottom: .15rem; transform: translateX(-50%);
  z-index: 2;
  font-size: .72rem; color: var(--muted);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  padding: .28rem .65rem; border-radius: 999px; border: 1px solid var(--line-soft);
  white-space: nowrap; pointer-events: none;
}
.presence-compact {
  min-height: 96px;
  width: 96px;
  margin: 0 auto .75rem;
}
.presence-compact .presence-stage-inner { max-width: 96px; }
.presence-compact .divine-avatar { max-width: 96px; filter: drop-shadow(0 8px 18px rgba(2,132,199,.3)); }
.presence-compact .presence-live-caption,
.presence-compact .dv-hint { display: none !important; }
.signin-presence-host {
  width: 110px; height: 130px; margin: 0 auto .85rem;
}
.dv-neural {
  stroke-dasharray: 4 6;
  animation: neuralFlow 3.2s linear infinite;
}
@keyframes neuralFlow {
  to { stroke-dashoffset: -40; }
}

.quick-actions {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin-bottom: 1rem;
}
.quick-actions a, .quick-actions button {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .45rem .75rem;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 600; font-size: .82rem;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.quick-actions a:hover, .quick-actions button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--divine-cyan) 40%, var(--line));
  box-shadow: 0 6px 16px rgba(2,132,199,.12);
  opacity: 1;
}

.dash-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem;
}
.dash-toolbar .muted { font-size: .85rem; }

.dash-card {
  position: relative;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(6px);
}
.dash-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .1);
  border-color: color-mix(in srgb, var(--divine-cyan) 28%, var(--line));
}
.dash-card.pinned { border-color: color-mix(in srgb, var(--divine-blue) 45%, var(--line)); }
.dash-card.dragging { opacity: .55; transform: scale(.98); }
.dash-card.drag-over { outline: 2px dashed var(--divine-cyan); outline-offset: 2px; }
.dash-card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: .5rem; margin-bottom: .65rem;
}
.dash-card-head h2 { margin: 0; font-size: 1rem; }
.dash-card-actions { display: flex; gap: .2rem; flex-shrink: 0; }
.dash-card-actions button {
  background: transparent; color: var(--muted); border: 0; box-shadow: none;
  padding: .2rem .4rem; font-size: .78rem; border-radius: 8px;
}
.dash-card-actions button:hover { background: var(--chip); color: var(--text); opacity: 1; }
.dash-card.collapsed .dash-body { display: none; }
.dash-handle {
  cursor: grab; color: var(--muted); font-size: .85rem; padding: .15rem .25rem;
  user-select: none;
}
.dash-handle:active { cursor: grabbing; }
.needs-panel .needs-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.4rem; height: 1.4rem; padding: 0 .35rem;
  border-radius: 999px; background: var(--warn-bg); color: var(--warn);
  font-size: .75rem; font-weight: 700; margin-left: .35rem;
}
.needs-item {
  display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start;
  padding: .65rem 0; border-bottom: 1px solid var(--line-soft);
}
.needs-item:last-child { border-bottom: 0; }
.needs-tag {
  display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--divine-blue); margin-bottom: .2rem;
}
.tl-item { display: grid; grid-template-columns: 4.5rem 1fr; gap: .65rem; padding: .55rem 0; border-bottom: 1px solid var(--line-soft); }
.tl-item:last-child { border-bottom: 0; }
.tl-time { font-size: .75rem; color: var(--muted); padding-top: .15rem; }
.brand-dot {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block;
  background: #64748b; margin-right: .35rem; vertical-align: middle;
}
.brand-dot.on { background: var(--live); box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.brand-dot.off { background: #64748b; }
.nav-brand-ico {
  width: 1.15rem; height: 1.15rem; border-radius: 6px;
  background: linear-gradient(145deg, #22d3ee33, #0284c733);
  display: inline-grid; place-items: center; font-size: .65rem; font-weight: 700;
  color: #7dd3fc;
}
.brand-workspace-hero {
  display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start;
  margin-bottom: 1rem; padding: 1rem 1.15rem;
  border-radius: 18px; border: 1px solid var(--line); background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.signin-presence {
  width: 88px; height: 88px; object-fit: cover; border-radius: 50%;
  margin: 0 auto .75rem; display: block;
  box-shadow: 0 0 0 3px rgba(8,145,178,.25), 0 10px 24px rgba(2,132,199,.25);
}

@media (max-width: 980px) {
  .hero-divine { grid-template-columns: 1fr; }
  .presence-stage, .presence-live { min-height: 240px; order: -1; }
  .divine-avatar { max-width: 240px; }
  .dash-handle { display: none; }
  .dash-card[draggable] { -webkit-user-drag: none; }
}
@media (max-width: 700px) {
  .hero-stats { display: grid; grid-template-columns: 1fr 1fr; }
  .quick-actions a, .quick-actions button { flex: 1 1 auto; justify-content: center; }
}
