/* ==========================================================================
   Owner dashboard theme (admin/*). The agent portal still uses admin.css.
   --accent is injected per-site from the brand color in partials/layout.php.
   ========================================================================== */

:root {
    --accent: #4F46E5;
    --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
    --accent-line: color-mix(in srgb, var(--accent) 38%, transparent);
    --accent-deep: color-mix(in srgb, var(--accent) 62%, #05050a);

    --bg: #0A0A12;
    --surface: #12121C;
    --surface-2: #181826;
    --surface-3: #202032;
    --border: #232336;
    --border-strong: #30304a;
    --text: #EDEDF5;
    --text-2: #A5A5BF;
    --text-3: #6F6F8C;

    --good: #34D399;   --good-soft: rgba(52, 211, 153, .13);
    --warn: #FBBF24;   --warn-soft: rgba(251, 191, 36, .13);
    --bad: #F87171;    --bad-soft: rgba(248, 113, 113, .13);
    --info: #60A5FA;   --info-soft: rgba(96, 165, 250, .13);

    --radius: 18px;
    --radius-sm: 10px;
    --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 12px 32px -12px rgba(0,0,0,.6);
    --glow-a: color-mix(in srgb, var(--accent) 22%, transparent);
    --glow-b: rgba(34, 211, 238, .07);
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --accent-deep: color-mix(in srgb, var(--accent) 80%, #000);
    --bg: #F4F5F9;
    --surface: #FFFFFF;
    --surface-2: #F7F8FB;
    --surface-3: #EEF0F5;
    --border: #E5E7EF;
    --border-strong: #D5D8E3;
    --text: #13141B;
    --text-2: #525770;
    --text-3: #868BA2;
    --good: #059669;   --good-soft: rgba(5, 150, 105, .1);
    --warn: #B45309;   --warn-soft: rgba(217, 119, 6, .12);
    --bad: #DC2626;    --bad-soft: rgba(220, 38, 38, .09);
    --info: #2563EB;   --info-soft: rgba(37, 99, 235, .09);
    --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px -12px rgba(16,24,40,.12);
    --glow-a: color-mix(in srgb, var(--accent) 10%, transparent);
    --glow-b: rgba(34, 211, 238, .06);
    color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
    margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5;
    background: var(--bg); color: var(--text);
    -webkit-font-smoothing: antialiased;
}
body::before {
    content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background:
        radial-gradient(900px 500px at 85% -10%, var(--glow-a), transparent 60%),
        radial-gradient(700px 400px at 10% 110%, var(--glow-b), transparent 60%);
}
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.015em; }
.i { width: 18px; height: 18px; flex-shrink: 0; }
.muted { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- App shell ---------- */
.app { position: relative; z-index: 1; display: flex; min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; height: 100vh; width: 248px; flex-shrink: 0;
    display: flex; flex-direction: column; padding: 20px 14px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(14px); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; text-decoration: none; min-height: 36px; }
.brand img { max-height: 30px; max-width: 170px; object-fit: contain; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
    font-weight: 800; font-size: 13px; color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    box-shadow: 0 6px 18px -6px var(--accent);
}
.brand-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; }
.nav-group { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: 14px 12px 5px; }
.flash.info { background: var(--info-soft); color: var(--info); }
.nav a {
    display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 11px; flex-shrink: 0;
    color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 13.5px;
    transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--text); }
.nav a.active .i { color: var(--accent); }
.nav-count {
    margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 20px;
    background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.foot-row { display: flex; align-items: center; gap: 8px; }
.me-card { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-text strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text span { font-size: 11.5px; color: var(--text-3); }
.foot-actions { display: flex; gap: 2px; }

/* "Away" toggle: an agent/owner steps away and the AI covers their assigned
   chats until they come back (see includes/hours.php, conversation_needs_bot_takeover()). */
.away-btn {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font: inherit; font-size: 12.5px;
    font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.away-btn:hover { background: var(--surface-3); }
.away-btn .i { width: 15px; height: 15px; flex-shrink: 0; }
.away-btn .ib-off { display: none; }
.away-btn.is-away { background: var(--warn-soft, rgba(230,160,60,.12)); border-color: var(--warn, #e6a03c); color: var(--warn, #e6a03c); }
.away-btn.is-away .ib-on { display: none; }
.away-btn.is-away .ib-off { display: block; }
.away-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 0 28px 40px; }
.topbar {
    position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px;
    padding: 20px 0 16px; margin-bottom: 6px;
    background: linear-gradient(var(--bg) 70%, transparent);
}
.topbar h1 { font-size: 22px; font-weight: 700; }
.topbar-slot { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn.menu-btn { display: none; }
.scrim { display: none; }

/* sound alert toggle — a plain icon button matching the theme toggle beside it;
   "needs-tap" is a quiet corner dot (not a nagging color change) for the rare
   case a browser hasn't unlocked audio on this page yet. */
.sound-btn { position: relative; color: var(--text-2); }
.sound-btn .ib-off { display: none; }
.sound-btn.is-off { color: var(--text-3); }
.sound-btn.is-off .ib-on { display: none; }
.sound-btn.is-off .ib-off { display: block; }
.sound-btn.needs-tap::after {
    content: ""; position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 50%;
    background: var(--warn); border: 2px solid var(--surface);
}

/* theme toggle icon swap */
:root:not([data-theme="light"]) .show-light { display: none; }
:root[data-theme="light"] .show-dark { display: none; }

/* ---------- Primitives ---------- */
.avatar {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
    font-size: 12px; font-weight: 700; color: var(--text);
    background: var(--surface-3); border: 1px solid var(--border-strong); position: relative;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.avatar.accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); border: 2px solid var(--surface); display: inline-block; }
.dot.on { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.dot.channel-ig {
    width: 16px; height: 16px; display: grid; place-items: center; color: #fff;
    background: radial-gradient(circle at 30% 110%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
}
.dot.channel-ig .i { width: 10px; height: 10px; stroke-width: 2.5; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--border-strong);
    background: var(--surface-2); color: var(--text); font: 600 13px var(--font);
    text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .1s, filter .15s;
    white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn .i { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 8px 20px -10px var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: transparent; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
    background: transparent; border: 0; color: var(--text-2); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

.pill {
    display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 20px;
    font-size: 11px; font-weight: 650; white-space: nowrap; background: var(--surface-3); color: var(--text-2);
}
.pill .i { width: 12px; height: 12px; }
.pill.open { background: var(--info-soft); color: var(--info); }
.pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.resolved { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
:root:not([data-theme="light"]) .pill.accent { color: color-mix(in srgb, var(--accent) 55%, #fff); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12px; color: var(--text-3); }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field textarea, .field select {
    width: 100%; padding: 10px 13px; border-radius: 11px; border: 1px solid var(--border-strong);
    background: var(--surface-2); color: var(--text); font: 14px var(--font); transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.search { position: relative; }
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 36px; height: 38px; }

.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 10px 0; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
    width: 38px; height: 22px; border-radius: 22px; background: var(--surface-3); border: 1px solid var(--border-strong);
    position: relative; flex-shrink: 0; transition: background .15s; margin-top: 1px;
}
.switch .track::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s;
}
.switch input:checked + .track { background: var(--accent); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-text strong { display: block; font-size: 13.5px; font-weight: 600; }
.switch-text span { font-size: 12.5px; color: var(--text-3); }

.flash {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; margin-bottom: 16px;
    font-size: 13.5px; font-weight: 500; animation: rise .3s ease;
}
.flash.ok { background: var(--good-soft); color: var(--good); }
.flash.err { background: var(--bad-soft); color: var(--bad); }

.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .i { width: 36px; height: 36px; margin-bottom: 10px; color: var(--text-3); opacity: .7; }
.empty strong { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }

/* ---------- Bento grid ---------- */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; grid-auto-flow: dense; }
.tile {
    position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow); min-width: 0; display: flex; flex-direction: column;
    animation: rise .45s cubic-bezier(.2,.7,.2,1) both;
}
.tile:nth-child(2) { animation-delay: .03s; } .tile:nth-child(3) { animation-delay: .06s; }
.tile:nth-child(4) { animation-delay: .09s; } .tile:nth-child(5) { animation-delay: .12s; }
.tile:nth-child(6) { animation-delay: .15s; } .tile:nth-child(7) { animation-delay: .18s; }
.tile:nth-child(n+8) { animation-delay: .21s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tile, .flash { animation: none; } }

.c-3 { grid-column: span 3; } .c-4 { grid-column: span 4; } .c-5 { grid-column: span 5; }
.c-6 { grid-column: span 6; } .c-7 { grid-column: span 7; } .c-8 { grid-column: span 8; } .c-12 { grid-column: span 12; }
.r-2 { grid-row: span 2; }

.tile-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.tile-head h3 { font-size: 14px; font-weight: 650; }
.tile-head .sub { font-size: 12px; color: var(--text-3); }
.tile-head .end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.tile-link { font-size: 12.5px; font-weight: 600; color: var(--text-2); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.tile-link:hover { color: var(--accent); }
.tile-link .i { width: 14px; height: 14px; }
.tile-icon {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
    background: var(--surface-3); color: var(--text-2);
}
.tile-icon .i { width: 17px; height: 17px; }

/* hero */
.tile.hero {
    color: #fff; border: 0; overflow: hidden; justify-content: space-between; gap: 18px;
    background:
        radial-gradient(400px 220px at 100% 0%, rgba(255,255,255,.22), transparent 60%),
        linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
    box-shadow: 0 20px 44px -20px var(--accent);
}
.tile.hero::after {
    content: ""; position: absolute; right: -60px; bottom: -80px; width: 240px; height: 240px; border-radius: 50%;
    border: 36px solid rgba(255,255,255,.08); pointer-events: none;
}
.hero-eyebrow { font-size: 12.5px; font-weight: 600; opacity: .8; }
.hero h2 { font-size: 26px; font-weight: 750; line-height: 1.2; margin-top: 6px; max-width: 30ch; }
.hero p { margin: 8px 0 0; opacity: .85; font-size: 14px; max-width: 46ch; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.22); color: #fff; }
.hero .btn:hover { background: rgba(255,255,255,.26); }
.hero .btn.solid { background: #fff; color: #111; border-color: #fff; }
.hero .btn.solid:hover { background: rgba(255,255,255,.9); }

/* KPI tiles */
.kpi { justify-content: space-between; gap: 14px; text-decoration: none; transition: border-color .15s, transform .15s; }
a.kpi:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 13px; color: var(--text-2); font-weight: 550; }
.kpi-value { font-size: 36px; font-weight: 750; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.kpi.tone-info .tile-icon { background: var(--info-soft); color: var(--info); }
.kpi.tone-warn .tile-icon { background: var(--warn-soft); color: var(--warn); }
.kpi.tone-bad .tile-icon { background: var(--bad-soft); color: var(--bad); }
.kpi.tone-good .tile-icon { background: var(--good-soft); color: var(--good); }
.kpi.tone-bad.hot { border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.kpi.tone-bad.hot .kpi-value { color: var(--bad); }

/* bar chart */
.chart { flex: 1; display: flex; flex-direction: column; min-height: 200px; }
.chart-total { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.chart-total strong { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.chart-total span { font-size: 12.5px; color: var(--text-3); }
.bars { position: relative; flex: 1; display: flex; align-items: flex-end; gap: 6px; min-height: 150px; padding-bottom: 22px; }
.bars::before {
    content: ""; position: absolute; left: 0; right: 0; bottom: 22px; height: 1px; background: var(--border);
}
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; cursor: default; }
.bar-fill {
    width: 100%; max-width: 30px; min-height: 2px; border-radius: 4px 4px 0 0;
    background: color-mix(in srgb, var(--accent) 55%, var(--surface-3));
    transition: background .15s;
}
.bar.today .bar-fill { background: var(--accent); }
.bar:hover .bar-fill { background: var(--accent); filter: brightness(1.15); }
.bar-x { position: absolute; bottom: -20px;font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.bar-tip {
    position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%) translateY(4px);
    background: var(--text); color: var(--bg); padding: 5px 9px; border-radius: 8px; font-size: 11.5px; font-weight: 600;
    white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s; z-index: 2;
}
.bar-col { position: relative; width: 100%; display: flex; justify-content: center; }
.bar:hover .bar-tip { opacity: 1; transform: translateX(-50%) translateY(0); }

/* split meter (AI vs team) */
.meter { display: flex; height: 12px; border-radius: 12px; overflow: hidden; gap: 2px; background: var(--surface); margin: 6px 0 14px; }
.meter span { display: block; height: 100%; min-width: 2px; }
.meter .m-ai { background: var(--accent); border-radius: 12px 0 0 12px; }
.meter .m-team { background: var(--text-3); border-radius: 0 12px 12px 0; }
.meter .m-ai:last-child { border-radius: 12px; }
.legend { display: grid; gap: 10px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.legend-row b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.big-stat { font-size: 40px; font-weight: 750; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.big-stat small { font-size: 18px; color: var(--text-3); font-weight: 600; }

/* lists inside tiles */
.rows { display: flex; flex-direction: column; margin: 0 -10px; }
.row {
    display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px;
    text-decoration: none; color: inherit; min-width: 0; transition: background .12s;
}
a.row:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; }
.row-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.row-title span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { font-size: 12px; color: var(--text-3); flex-shrink: 0; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.wait { font-weight: 650; }
.wait.hot { color: var(--bad); }
.wait.warm { color: var(--warn); }

.stack { display: flex; }
.stack .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.stack .avatar:first-child { margin-left: 0; }

.code-box {
    font-family: var(--mono); font-size: 12px; line-height: 1.55; padding: 12px 14px; border-radius: 12px;
    background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--text-2);
    word-break: break-all; margin-bottom: 12px;
}
.code-box .tag { color: var(--accent); }
:root:not([data-theme="light"]) .code-box .tag { color: color-mix(in srgb, var(--accent) 55%, #fff); }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick a {
    display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; text-decoration: none;
    background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; transition: border-color .15s;
}
.quick a:hover { border-color: var(--accent-line); }
.quick a .i { color: var(--accent); }

/* ---------- Page panels (non-bento pages) ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-pad { padding: 20px; }
.page-intro { color: var(--text-2); margin: -4px 0 18px; max-width: 70ch; }

/* ---------- Inbox ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: inline-flex; gap: 2px; padding: 4px; border-radius: 13px; background: var(--surface); border: 1px solid var(--border); }
.tabs a {
    display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px; border-radius: 9px;
    font-size: 13px; font-weight: 600; color: var(--text-2); text-decoration: none;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.tabs .count { font-size: 11px; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tabs a.active .count { color: var(--accent); }
.toolbar .search { flex: 1; min-width: 200px; max-width: 360px; margin-left: auto; }

.inbox-list { overflow: hidden; }
.conv {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center;
    padding: 14px 18px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--border); transition: background .12s;
    position: relative;
}
.conv:last-child { border-bottom: 0; }
.conv:hover { background: var(--surface-2); }
.conv.unreplied::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.conv-top { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.conv-name { font-weight: 650; font-size: 14px; }
.conv.unreplied .conv-name::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 8px; vertical-align: middle; }
.conv-msg { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-msg .who { color: var(--text-3); }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-3); }

.live-banner {
    position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 20;
    display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-radius: 14px;
    background: var(--text); color: var(--bg); font-size: 13px; font-weight: 600; box-shadow: 0 16px 40px -12px rgba(0,0,0,.5);
    transition: opacity .2s, transform .2s;
}
.live-banner.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.live-banner .btn { height: 30px; background: var(--accent); color: #fff; border: 0; }

/* ---------- Conversation ---------- */
body.conv-page .main { height: 100vh; padding-bottom: 20px; }
.conv-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
.thread { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.thread-head .row-sub { white-space: normal; }
.status-seg { margin-left: auto; display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.status-seg button {
    height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2);
    font: 600 12.5px var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.status-seg button:hover { color: var(--text); }
.status-seg button.on[value=open] { background: var(--info-soft); color: var(--info); }
.status-seg button.on[value=pending] { background: var(--warn-soft); color: var(--warn); }
.status-seg button.on[value=resolved] { background: var(--good-soft); color: var(--good); }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 4px; }
.day-sep { align-self: center; font-size: 11.5px; font-weight: 600; color: var(--text-3); padding: 12px 0 8px; }
.msg { max-width: min(72%, 560px); display: flex; flex-direction: column; margin-top: 8px; }
.msg + .msg.same { margin-top: 0; }
.msg .bubble { padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.msg .meta { font-size: 11px; color: var(--text-3); margin: 4px 6px 0; display: flex; gap: 6px; align-items: center; }
.msg .meta .i { width: 12px; height: 12px; }
.msg.visitor { align-self: flex-start; }
.msg.visitor .bubble { background: var(--surface-3); border-bottom-left-radius: 5px; }
.msg.bot { align-self: flex-start; }
.msg.bot .bubble { background: var(--accent-soft); border: 1px solid var(--accent-line); border-bottom-left-radius: 5px; }
.msg.admin { align-self: flex-end; align-items: flex-end; }
.msg.admin .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.msg.pending-send { opacity: .6; }
.msg.failed .bubble { background: var(--bad-soft); color: var(--bad); }
.composer { border-top: 1px solid var(--border); padding: 14px; display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
    flex: 1; resize: none; max-height: 160px; min-height: 44px; padding: 11px 14px; border-radius: 13px;
    border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font: 14px/1.45 var(--font);
}
.composer textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.composer .btn { height: 44px; width: 44px; padding: 0; border-radius: 13px; }
.composer-hint { font-size: 11.5px; color: var(--text-3); padding: 0 16px 10px; margin-top: -6px; }
.handoff-note { margin: 0 14px 10px; padding: 9px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; display: flex; gap: 8px; align-items: center; }
.details { display: flex; flex-direction: column; gap: 16px; overflow-y: auto; min-height: 0; }
.details .panel { padding: 18px; }
.details h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; margin-bottom: 12px; }
.kv { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 6px 0; color: var(--text-2); min-width: 0; }
.kv .i { width: 15px; height: 15px; color: var(--text-3); }
.kv span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv b { margin-left: auto; color: var(--text); font-weight: 600; }
.profile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding-bottom: 6px; }
.profile strong { font-size: 15px; }

/* conversation: tools, menus, notes, attachments, composer */
.thread-tools { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.thread-tools .status-seg { margin-left: 6px; }
.menu-wrap { position: relative; }
.menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px; padding: 6px; border-radius: 13px;
    background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 18px 40px -12px rgba(0,0,0,.45);
}
.menu-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 6px 10px; }
.menu button, .menu a {
    display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: none;
    color: var(--text); font: 500 13px var(--font); text-align: left; text-decoration: none; cursor: pointer;
}
.menu button:hover, .menu a:hover { background: var(--surface-3); }
.menu .i { width: 15px; height: 15px; color: var(--text-3); }
.msg.note { align-self: center; max-width: min(86%, 640px); margin-top: 10px; }
.msg.note .bubble { background: var(--warn-soft); color: var(--text); border: 1px dashed color-mix(in srgb, var(--warn) 45%, transparent); border-radius: 12px; }
.msg.note .meta { justify-content: center; color: var(--warn); }
.att-img { display: block; max-width: 260px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); margin-bottom: 4px; background: var(--surface-2); }
.att-img img { display: block; width: 100%; height: auto; max-height: 280px; object-fit: cover; }
.att-file {
    display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; margin-bottom: 4px; max-width: 280px;
    background: var(--surface-3); color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600;
}
.msg.admin .att-file { background: color-mix(in srgb, var(--accent) 80%, #000); color: #fff; }
.att-file span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file small { font-weight: 500; opacity: .7; }
.book-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); margin: 4px 6px 0; }
.book-chip .i { width: 13px; height: 13px; }
.composer-wrap { border-top: 1px solid var(--border); position: relative; transition: background .15s; }
.composer-wrap.note-mode { background: var(--warn-soft); }
.composer-tabs { display: flex; align-items: center; gap: 2px; padding: 8px 12px 0; }
.composer-tabs button {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: none;
    color: var(--text-3); font: 600 12.5px var(--font); cursor: pointer;
}
.composer-tabs button .i { width: 14px; height: 14px; }
.composer-tabs button.on { background: var(--surface-3); color: var(--text); }
.composer-wrap.note-mode .composer-tabs button.on { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.composer-tip { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
kbd { font: 600 11px var(--mono); padding: 1px 5px; border-radius: 5px; background: var(--surface-3); border: 1px solid var(--border-strong); }
.composer { border-top: 0; padding: 10px 14px 14px; }
.composer .btn.icon-only { width: 40px; height: 44px; padding: 0; border-radius: 12px; }
.composer .btn.icon-only.loading { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.attach-chip { display: flex; align-items: center; gap: 8px; margin: 8px 14px 0; padding: 6px 6px 6px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; width: fit-content; max-width: calc(100% - 28px); }
.attach-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip .icon-btn { width: 26px; height: 26px; }
.canned-menu {
    position: absolute; left: 14px; right: 14px; bottom: calc(100% - 4px); z-index: 15; max-height: 300px; overflow-y: auto; padding: 6px;
    border-radius: 14px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 -12px 36px -12px rgba(0,0,0,.45);
}
.canned-menu button {
    display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px;
    background: none; color: var(--text); font: 13px var(--font); text-align: left; cursor: pointer;
}
.canned-menu button.on, .canned-menu button:hover { background: var(--accent-soft); }
.canned-menu b { color: var(--accent); font-family: var(--mono); font-size: 12.5px; }
.canned-menu small { grid-column: 1 / -1; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canned-empty { padding: 10px; font-size: 13px; color: var(--text-3); }
.summary-text { font-size: 13px; color: var(--text-2); white-space: pre-wrap; line-height: 1.5; }
.loading-text { opacity: .5; animation: pulse 1s infinite; }
.task-mini { display: flex; align-items: flex-start; gap: 9px; padding: 6px 2px; font-size: 13px; cursor: pointer; }
.task-mini input { margin-top: 3px; accent-color: var(--accent); }
.task-mini small { color: var(--text-3); }
.task-mini.done span { text-decoration: line-through; color: var(--text-3); }
.task-quick { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-top: 10px; }
.task-quick .input:first-child { grid-column: 1 / -1; }
.contact-main .task-quick { grid-template-columns: minmax(0, 1fr) 150px auto; }
.contact-main .task-quick .input:first-child { grid-column: auto; }
.task-quick .input { height: 34px; padding: 6px 10px; font-size: 13px; }
select.input { appearance: auto; height: 38px; padding: 0 10px; }
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); opacity: 0; z-index: 60; max-width: min(92vw, 460px);
    padding: 11px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 13.5px; font-weight: 600;
    box-shadow: 0 16px 40px -12px rgba(0,0,0,.5); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); color: #fff; }
dialog.modal { border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--text); width: min(560px, 94vw); box-shadow: 0 30px 80px -20px rgba(0,0,0,.6); }
dialog.modal::backdrop { background: rgba(5, 6, 12, .55); backdrop-filter: blur(3px); }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-body h3 { font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
textarea.input { resize: vertical; min-height: 70px; line-height: 1.5; }

/* tasks page */
.task-new { display: grid; grid-template-columns: minmax(0, 1fr) 150px 120px 120px auto auto; gap: 8px; align-items: center; margin-bottom: 18px; }
.task-new .task-title { min-width: 0; }
.task-group { margin-bottom: 18px; }
.task-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 0 0 8px 4px; display: flex; gap: 8px; }
.task-group.overdue h3 { color: var(--bad); }
.task-group .count { color: var(--text-3); }
.task-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: 0; }
.task-row .task-check { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.task-body { flex: 1; min-width: 0; }
.task-title-line { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.task-sub { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.task-sub a, .task-sub span { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; }
.task-sub .i { width: 13px; height: 13px; }
.task-sub a:hover { color: var(--accent); }
.due.overdue { color: var(--bad); font-weight: 600; }
.due.today { color: var(--warn); font-weight: 600; }
.task-row.done .task-t { text-decoration: line-through; color: var(--text-3); }
.task-row .btn.ghost { opacity: 0; }
.task-row:hover .btn.ghost, .task-row:focus-within .btn.ghost { opacity: 1; }
@media (max-width: 900px) {
    .task-new { grid-template-columns: 1fr 1fr; }
    .task-new .task-title { grid-column: 1 / -1; }
    .task-row .btn.ghost { opacity: 1; }
    .thread-tools .status-seg button span { display: none; }
}

/* shared bits */
.btn.icon-only { width: 38px; padding: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.switch.compact { padding: 4px 0; align-items: center; }
.list-day { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 14px 18px 6px; }
.settings-tabs { margin-bottom: 16px; flex-wrap: wrap; }
.settings-tabs a .i, .tabs a .i { width: 15px; height: 15px; }
.table-wrap { overflow-x: auto; margin: 0 -20px -20px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 10px 20px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td .avatar { display: inline-grid; vertical-align: middle; margin-right: 6px; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }

/* appointments */
.cal { --hour: 52px; overflow: hidden; border-radius: var(--radius); }
.cal-head, .cal-body { display: grid; grid-template-columns: 58px repeat(7, minmax(0, 1fr)); }
.cal-head { position: sticky; top: 0; z-index: 3; background: var(--surface); box-shadow: 0 1px 0 var(--border); }
.cal-head > div { padding: 12px 6px; text-align: center; font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }
.cal-head b { display: block; margin-top: 4px; font-size: 17px; font-weight: 700; color: var(--text); text-transform: none; letter-spacing: normal; }
.cal-head .today b { color: #fff; background: var(--accent); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; margin: 4px auto 0; box-shadow: 0 4px 10px -4px var(--accent); }
.cal-body { max-height: 68vh; overflow-y: auto; padding-top: 10px; }
/* The label for hour N sits centered on the gridline where hour N begins — the
   10px top padding above gives the very first label room so it isn't clipped
   by the scroll container's edge (this used to cut "12 am" off at the top). */
.cal-hours > div { height: var(--hour); font-size: 11px; color: var(--text-3); text-align: right; padding: 0 10px; transform: translateY(-6px); }
.cal-day { position: relative; border-left: 1px solid var(--border); height: calc(var(--hours) * var(--hour));
    background-image: linear-gradient(var(--border) 1px, transparent 1px); background-size: 100% var(--hour); }
.cal-day.today { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
.cal-open { position: absolute; left: 0; right: 0; background: color-mix(in srgb, var(--good) 6%, transparent); pointer-events: none; }
.cal-event {
    position: absolute; left: 3px; right: 3px; min-height: 16px; padding: 3px 7px; border-radius: 7px; border: 0;
    border-left: 3px solid var(--accent); text-align: left; overflow: hidden; cursor: pointer;
    background: var(--accent-soft); color: var(--text); font: 600 11.5px/1.35 var(--font); display: flex; align-items: baseline; gap: 5px;
    box-shadow: 0 2px 6px -3px rgba(0,0,0,.4); z-index: 1; transition: filter .12s, box-shadow .12s;
}
.cal-event:hover { filter: brightness(1.08); box-shadow: 0 6px 14px -5px rgba(0,0,0,.5); z-index: 2; }
.cal-event .ce-time { flex-shrink: 0; opacity: .8; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-event .ce-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event.tall { flex-direction: column; align-items: flex-start; gap: 0; }
.cal-event.st-confirmed { border-left-color: var(--good); background: var(--good-soft); }
.cal-event.st-completed { border-left-color: var(--text-3); background: var(--surface-3); color: var(--text-2); }
.cal-event.st-no_show { border-left-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.cal-event.st-cancelled { border-left-color: var(--border-strong); background: var(--surface-2); color: var(--text-3); text-decoration: line-through; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 2; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.cal-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.appt-row {
    display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 18px; border: 0; border-bottom: 1px solid var(--border);
    background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; text-decoration: none;
}
.appt-row:hover { background: var(--surface-2); }
.appt-time { display: flex; flex-direction: column; min-width: 64px; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.appt-time small { font-weight: 500; color: var(--text-3); font-size: 11.5px; }
.rows .appt-time { min-width: 48px; }
.hours-grid { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 16px; align-items: center; }
.hours-ranges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hours-ranges .input { width: 120px; height: 36px; padding: 6px 10px; }

/* contacts */
.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 10px; border-radius: 14px; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.bulk-bar .input { height: 32px; padding: 4px 10px; }
.dupes { margin-bottom: 14px; }
.dupes summary { cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; list-style: none; }
.dupes summary .i { color: var(--warn); }
.contact-table { overflow: hidden; }
.ct-head, .ct-row { display: grid; grid-template-columns: 40px minmax(200px, 2fr) minmax(0, 1fr) 100px minmax(0, 1.2fr) 60px 100px; align-items: center; gap: 10px; padding: 0 16px; }
.ct-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding-top: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.ct-head .num { text-align: right; }
.ct-row { border-bottom: 1px solid var(--border); min-height: 60px; transition: background .12s; }
.ct-row:last-child { border-bottom: 0; }
.ct-row:hover { background: var(--surface-2); }
.ct-check { display: flex; }
.ct-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.ct-main { display: flex; align-items: center; gap: 11px; text-decoration: none; min-width: 0; padding: 10px 0; }
.ct-main b { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-main small { display: block; color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.ct-cell { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-cell.num { text-align: right; font-weight: 600; color: var(--text); }
.ct-cell:empty::before { content: "—"; color: var(--text-3); }
.ct-tags { display: flex; gap: 4px; flex-wrap: wrap; white-space: normal; }
/* A little color variety so a long list of initials doesn't look like one flat
   gray wall — the hue is derived from the row's position, not random, so it's
   stable on every reload. */
.ct-main .avatar, .contact-hero .avatar { background: var(--surface-3); border-color: var(--border-strong); color: var(--text); }
.ct-row:nth-of-type(6n+1) .ct-main .avatar { background: color-mix(in srgb, #6366F1 16%, var(--surface-2)); color: #6366F1; border-color: color-mix(in srgb, #6366F1 30%, transparent); }
.ct-row:nth-of-type(6n+2) .ct-main .avatar { background: color-mix(in srgb, #EC4899 16%, var(--surface-2)); color: #EC4899; border-color: color-mix(in srgb, #EC4899 30%, transparent); }
.ct-row:nth-of-type(6n+3) .ct-main .avatar { background: color-mix(in srgb, #10B981 16%, var(--surface-2)); color: #10B981; border-color: color-mix(in srgb, #10B981 30%, transparent); }
.ct-row:nth-of-type(6n+4) .ct-main .avatar { background: color-mix(in srgb, #F59E0B 16%, var(--surface-2)); color: #F59E0B; border-color: color-mix(in srgb, #F59E0B 30%, transparent); }
.ct-row:nth-of-type(6n+5) .ct-main .avatar { background: color-mix(in srgb, #0EA5E9 16%, var(--surface-2)); color: #0EA5E9; border-color: color-mix(in srgb, #0EA5E9 30%, transparent); }
.ct-row:nth-of-type(6n+6) .ct-main .avatar { background: color-mix(in srgb, #8B5CF6 16%, var(--surface-2)); color: #8B5CF6; border-color: color-mix(in srgb, #8B5CF6 30%, transparent); }
.contact-hero { display: flex; align-items: flex-start; gap: 16px; padding: 22px; margin-bottom: 16px; flex-wrap: wrap; }
.contact-hero h2 { font-size: 19px; }
.contact-name-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-buttons { display: flex; gap: 8px; margin-left: auto; align-items: center; }
/* Status colors, reused for the hero pill/avatar ring and the list-table pill. */
.pill.status-lead, .status-lead.avatar { background: var(--info-soft); color: var(--info); }
.pill.status-customer, .status-customer.avatar { background: var(--good-soft); color: var(--good); }
.pill.status-vip, .status-vip.avatar { background: var(--accent-soft); color: var(--accent); }
.pill.status-other, .status-other.avatar { background: var(--surface-3); color: var(--text-2); }
.status-lead.avatar, .status-customer.avatar, .status-vip.avatar, .status-other.avatar { border-color: transparent; box-shadow: 0 0 0 3px var(--surface) inset, 0 0 0 1px currentColor; }
.tag-editor { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.tag-editor .tag button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 0 0 2px; opacity: .7; }
.tag-input { border: 1px dashed var(--border-strong); background: none; color: var(--text); border-radius: 20px; height: 24px; padding: 0 10px; font: 12px var(--font); width: 90px; }
.tag-input:focus { outline: none; border-color: var(--accent); width: 140px; }
.contact-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.contact-side { display: flex; flex-direction: column; gap: 16px; }
.contact-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.contact-tabs { flex-wrap: wrap; }
.custom-row { display: grid; grid-template-columns: 1fr 1.3fr; gap: 6px; margin-bottom: 6px; }
.custom-row .input { height: 36px; padding: 6px 10px; font-size: 13px; }
.note-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.note-item { padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); margin-bottom: 8px; }
.note-body { white-space: pre-wrap; font-size: 13.5px; }
.note-meta { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.link-del { border: 0; background: none; color: var(--bad); font-size: 11.5px; cursor: pointer; padding: 0; margin-left: 6px; }

/* reports */
.report-kpi .kpi-value { font-size: 30px; }
.heatmap { display: grid; grid-template-columns: 38px repeat(24, minmax(0, 1fr)); gap: 3px; align-items: center; }
.hm-h { font-size: 10px; color: var(--text-3); text-align: left; white-space: nowrap; }
.hm-d { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.hm-c { aspect-ratio: 1.4; border-radius: 4px; background: color-mix(in srgb, var(--accent) calc(var(--v) * 100%), var(--surface-3)); min-height: 12px; }

/* settings / export / activity */
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 16px; }
.hook-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.hook-add { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 4px; }
.secret { cursor: pointer; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; padding: 5px 0; }
.check-row .i { width: 16px; height: 16px; margin-top: 2px; }
.check-row.ok .i { color: var(--good); }
.check-row.bad .i { color: var(--warn); }
.check-row small { display: block; color: var(--text-3); }
.shortcut-field { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 11px; background: var(--surface-2); overflow: hidden; }
.shortcut-field span { padding: 0 4px 0 12px; font-family: var(--mono); color: var(--accent); font-weight: 700; }
.shortcut-field input { border: 0 !important; box-shadow: none !important; background: none !important; padding-left: 2px !important; font-family: var(--mono) !important; }

/* Meta / Google credential wizard (Settings -> Integrations) */
.wizard-box { border: 1px solid var(--border-strong); border-radius: 14px; padding: 4px 16px 16px; margin-bottom: 12px; background: var(--surface-2); }
.wizard-box summary { cursor: pointer; padding: 12px 0; font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 8px; list-style: none; }
.wizard-box summary::-webkit-details-marker { display: none; }
.wizard-box[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.wizard-steps { margin: 0 0 16px; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.wizard-steps li::marker { color: var(--accent); font-weight: 700; }
.copy-field { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.copy-field input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-1); color: var(--text-2); }
.copy-field .btn { flex-shrink: 0; }
.export-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.export-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.export-card { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.export-card input { position: absolute; opacity: 0; }
.export-card b { display: block; font-size: 14px; }
.export-card small { display: block; color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.export-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.export-card:has(input:checked) .tile-icon { background: var(--accent); color: #fff; }
.export-side { position: sticky; top: 84px; }
.export-side .section-head { margin-top: 4px; }
.export-side .section-head:first-child { margin-top: 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: 600 12px var(--font); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.col-fields-actions { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 12px; margin: -4px 0 8px; }
.col-fields-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; max-height: 220px; overflow-y: auto;
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px;
}
.col-field { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); padding: 4px 0; cursor: pointer; min-width: 0; }
.col-field input { flex-shrink: 0; accent-color: var(--accent); }
.col-field span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-field:has(input:checked) { color: var(--text); }
.act-toolbar { align-items: center; }
.act-filter { display: flex; align-items: center; gap: 8px; color: var(--text-3); }
.act-filter .i { width: 15px; height: 15px; flex-shrink: 0; }
.act-filter .input { width: auto; min-width: 150px; height: 36px; padding: 0 10px; }
.act-row { display: flex; align-items: center; gap: 13px; padding: 11px 18px; transition: background .12s; }
.act-row:hover { background: var(--surface-2); }
.act-row a { color: inherit; text-decoration: none; }
.act-row a:hover { color: var(--accent); }
.act-row .row-title { font-size: 13.5px; }
.act-time { font-size: 12px; color: var(--text-3); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.activity-feed .act-row + .act-row { border-top: 1px solid var(--border); }
/* One color per event category, so a mixed feed (replies, bookings, edits,
   system jobs) reads at a glance instead of as a wall of identical gray boxes. */
.act-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-3); color: var(--text-2); }
.act-icon .i { width: 16px; height: 16px; }
.act-icon.chat { background: var(--info-soft); color: var(--info); }
.act-icon.done { background: var(--good-soft); color: var(--good); }
.act-icon.note { background: var(--warn-soft); color: var(--warn); }
.act-icon.kb { background: var(--accent-soft); color: var(--accent); }
.act-icon.data { background: var(--info-soft); color: var(--info); }
.act-icon.people { background: color-mix(in srgb, #8B5CF6 16%, var(--surface-2)); color: #8B5CF6; }
.act-icon.contact { background: color-mix(in srgb, #EC4899 16%, var(--surface-2)); color: #EC4899; }
.act-icon.appt { background: color-mix(in srgb, #10B981 16%, var(--surface-2)); color: #10B981; }
.act-icon.settings { background: var(--surface-3); color: var(--text-2); }
@media (max-width: 1100px) {
    .contact-layout, .export-grid { grid-template-columns: minmax(0, 1fr); }
    .ct-head, .ct-row { grid-template-columns: 32px minmax(0, 2fr) 90px 50px; }
    .ct-head span:nth-child(3), .ct-head span:nth-child(5), .ct-head span:nth-child(7), .ct-row > :nth-child(3), .ct-row > :nth-child(5), .ct-row > :nth-child(7) { display: none; }
    .hours-grid { grid-template-columns: 1fr; }
    .export-side { position: static; }
}
@media (max-width: 640px) {
    .cal-head, .cal-body { grid-template-columns: 40px repeat(7, minmax(44px, 1fr)); }
    .cal { overflow-x: auto; }
    .heatmap { grid-template-columns: 30px repeat(24, minmax(8px, 1fr)); gap: 2px; }
    .hm-h { visibility: hidden; }
    .hero-buttons { margin-left: 0; width: 100%; }
}

/* ---------- Knowledge base ---------- */
.kb-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; align-items: start; }
.kb-form { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 14px; }
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.kb-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s; }
.kb-card:hover { border-color: var(--border-strong); }
.kb-q { font-weight: 650; font-size: 14px; display: flex; gap: 8px; }
.kb-q::before { content: "Q"; flex-shrink: 0; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--accent-soft); color: var(--accent); }
.kb-a { font-size: 13px; color: var(--text-2); white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.kb-actions { display: flex; gap: 4px; margin-top: auto; padding-top: 6px; justify-content: flex-end; }
.kb-card.editing { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.ai-error {
    display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 9px 11px; border-radius: 10px;
    background: var(--bad-soft); color: var(--bad); font-size: 12px; line-height: 1.4;
}
.ai-error .i { width: 15px; height: 15px; margin-top: 1px; }

/* suggested questions */
.kb-tabs { margin-bottom: 16px; }
.kb-tabs a .i { width: 15px; height: 15px; }
.sug-progress { display: flex; align-items: center; gap: 20px; margin-bottom: 14px; flex-wrap: wrap; }
.sug-progress > div:first-child { flex: 1; min-width: 240px; }
.sug-progress strong { font-size: 14.5px; }
.progress { width: 220px; max-width: 100%; height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 8px; background: var(--accent); transition: width .35s ease; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
    height: 30px; padding: 0 12px; border-radius: 30px; border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--text-2); font: 600 12.5px var(--font); cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--accent); border-color: transparent; color: #fff; }
.sug-list { overflow: hidden; }
.sug { border-bottom: 1px solid var(--border); transition: opacity .2s, transform .2s, background .15s; }
.sug:last-child { border-bottom: 0; }
.sug.open { background: var(--surface-2); }
.sug.leaving { opacity: 0; transform: translateX(12px); }
.sug-head { display: flex; align-items: center; gap: 16px; padding: 14px 18px; }
/* Category/frequency sits on its own line ABOVE the question — stacking
   instead of putting a variable-width pill inline before the question is
   what keeps every question starting at the same left edge. */
.sug-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sug-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 18px; }
.sug-cat { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.sug-q { font-size: 14px; font-weight: 600; line-height: 1.35; }
.sug-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn.outline-accent { background: transparent; border-color: var(--accent-line); color: var(--accent); }
.btn.outline-accent:hover { background: var(--accent-soft); border-color: var(--accent); }
:root:not([data-theme="light"]) .btn.outline-accent { color: color-mix(in srgb, var(--accent) 60%, #fff); }
.sug.open .sug-actions { visibility: hidden; }
.sug-form { padding: 0 18px 16px; display: flex; flex-direction: column; gap: 8px; }
.sug-form textarea {
    width: 100%; min-height: 76px; resize: vertical; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--text); font: 14px/1.5 var(--font);
}
.sug-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.sug-form-foot { display: flex; align-items: center; gap: 6px; }
.sug-form-foot .hint { margin-right: auto; }
.sug-skipped { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.shake { animation: shake .35s; border-color: var(--bad) !important; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (max-width: 640px) {
    .sug-head { flex-direction: column; align-items: flex-start; }
    .sug-form-foot .hint { display: none; }
}

/* ---------- Team ---------- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.member { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.member-top { display: flex; gap: 12px; align-items: center; min-width: 0; }
.member-top .row-main strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.member-stats div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.member-stats b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.member-stats span { font-size: 11px; color: var(--text-3); }
.member-foot { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-3); }
.team-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }

/* ---------- Settings ---------- */
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.settings-form { display: flex; flex-direction: column; gap: 16px; }
.section { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.section-head h3 { font-size: 15px; font-weight: 650; }
.section-head p { margin: 2px 0 0; font-size: 13px; color: var(--text-3); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field input[type=color] { width: 44px; height: 40px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--surface-2); padding: 3px; cursor: pointer; }
.color-field .input { font-family: var(--mono); text-transform: uppercase; max-width: 130px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice label { position: relative; }
.choice input { position: absolute; opacity: 0; }
.choice span {
    display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; border-radius: 11px;
    border: 1px solid var(--border-strong); background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropzone {
    display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 13px; border: 1px dashed var(--border-strong);
    background: var(--surface-2); cursor: pointer;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone img { max-height: 40px; max-width: 120px; object-fit: contain; }
.dropzone input { display: none; }
.save-bar {
    position: sticky; bottom: 16px; display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 18px;
    border-radius: 16px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px);
    border: 1px solid var(--border-strong); box-shadow: var(--shadow);
}
.save-bar span { font-size: 13px; color: var(--text-3); }
.save-bar .btn { margin-left: auto; }

.preview-wrap { position: sticky; top: 84px; }
.preview-stage {
    border-radius: var(--radius); padding: 22px; min-height: 560px; position: relative; overflow: hidden;
    background:
        repeating-linear-gradient(0deg, transparent 0 23px, var(--border) 23px 24px),
        repeating-linear-gradient(90deg, transparent 0 23px, var(--border) 23px 24px),
        var(--surface-2);
    border: 1px solid var(--border);
}
.pv-widget {
    --pv: var(--accent); width: 100%; max-width: 320px; margin-left: auto; border-radius: 16px; overflow: hidden;
    background: #fff; color: #222; box-shadow: 0 20px 44px -16px rgba(0,0,0,.45); font-size: 13px;
}
.pv-widget.dark { background: #1A1826; color: #EDEAF5; }
.pv-head { background: var(--pv); color: #fff; padding: 13px 15px; font-weight: 650; display: flex; align-items: center; gap: 9px; }
.pv-head img { height: 20px; max-width: 100px; object-fit: contain; }
.pv-body { padding: 14px; display: flex; flex-direction: column; gap: 7px; min-height: 250px; }
.pv-msg { max-width: 82%; padding: 8px 11px; border-radius: 13px; line-height: 1.4; }
.pv-msg.them { background: #F1F1F4; border-bottom-left-radius: 4px; }
.pv-widget.dark .pv-msg.them { background: #2A2638; }
.pv-msg.me { background: var(--pv); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.pv-input { display: flex; gap: 6px; padding: 10px; border-top: 1px solid #eee; }
.pv-widget.dark .pv-input { border-color: #3A3450; }
.pv-input div { flex: 1; height: 32px; border-radius: 16px; border: 1px solid #ddd; }
.pv-widget.dark .pv-input div { border-color: #3A3450; background: #241F33; }
.pv-input span { background: var(--pv); color: #fff; border-radius: 16px; padding: 0 14px; display: grid; place-items: center; font-size: 12px; }
.pv-foot { text-align: center; font-size: 10px; color: #999; padding: 5px; border-top: 1px solid #f0f0f0; }
.pv-widget.dark .pv-foot { border-color: #3A3450; }
.pv-bubble {
    position: absolute; bottom: 22px; right: 22px; width: 54px; height: 54px; border-radius: 50%;
    background: var(--pv, var(--accent)); display: grid; place-items: center; color: #fff; font-size: 22px;
    box-shadow: 0 10px 24px -8px rgba(0,0,0,.45);
}
.preview-stage.left .pv-bubble { right: auto; left: 22px; }
.preview-stage.left .pv-widget { margin-left: 0; margin-right: auto; }

/* ---------- Widget style preview (mirrors widget/frame.php + widget/loader.js) ---------- */
.pv-widget.style-glassmorphism { background: linear-gradient(160deg, color-mix(in srgb, var(--pv) 16%, #fff), #fff 60%); }
.pv-widget.dark.style-glassmorphism { background: linear-gradient(160deg, color-mix(in srgb, var(--pv) 22%, #1A1826), #1A1826 60%); }
.pv-widget.style-glassmorphism .pv-head { background: color-mix(in srgb, var(--pv) 80%, transparent); backdrop-filter: blur(10px); }
.pv-widget.style-glassmorphism .pv-msg.them { background: color-mix(in srgb, #fff 55%, transparent); backdrop-filter: blur(6px); border: 1px solid rgba(0,0,0,.06); }
.pv-widget.dark.style-glassmorphism .pv-msg.them { background: color-mix(in srgb, #fff 10%, transparent); border-color: rgba(255,255,255,.1); }
.pv-widget.style-glassmorphism .pv-msg.me { background: color-mix(in srgb, var(--pv) 82%, transparent); }
.pv-bubble.style-glassmorphism { background: color-mix(in srgb, var(--pv) 55%, transparent); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.5); box-shadow: 0 8px 24px -4px rgba(0,0,0,.25); }

.pv-widget.style-bento { border: 2px solid #e5e5ea; }
.pv-widget.dark.style-bento { border-color: #3A3450; }
.pv-widget.style-bento .pv-head { border-bottom: 2px solid color-mix(in srgb, var(--pv) 40%, black); }
.pv-widget.style-bento .pv-msg { border-radius: 10px; border: 2px solid #e5e5ea; box-shadow: 3px 3px 0 rgba(0,0,0,.1); }
.pv-widget.dark.style-bento .pv-msg { border-color: #3A3450; }
.pv-widget.style-bento .pv-input div { border-radius: 10px; border-width: 2px; }
.pv-widget.style-bento .pv-input span { border-radius: 10px; box-shadow: 3px 3px 0 color-mix(in srgb, var(--pv) 55%, black); }
.pv-bubble.style-bento { border-radius: 18px; box-shadow: 4px 4px 0 rgba(0,0,0,.22); border: 2px solid rgba(0,0,0,.15); }

.pv-widget.style-minimalist { box-shadow: 0 1px 0 #eee; }
.pv-widget.style-minimalist .pv-head { background: #fff; color: #222; border-bottom: 1px solid #eee; }
.pv-widget.dark.style-minimalist .pv-head { background: #1A1826; color: #EDEAF5; border-color: #3A3450; }
.pv-widget.style-minimalist .pv-msg { border-radius: 6px; }
.pv-widget.style-minimalist .pv-msg.them { background: transparent; border: 1px solid #eee; }
.pv-widget.dark.style-minimalist .pv-msg.them { border-color: #3A3450; }
.pv-widget.style-minimalist .pv-msg.me { background: #222; }
.pv-widget.dark.style-minimalist .pv-msg.me { background: #EDEAF5; color: #1A1826; }
.pv-widget.style-minimalist .pv-input span { background: #222; border-radius: 6px; }
.pv-bubble.style-minimalist { box-shadow: 0 1px 6px rgba(0,0,0,.15); border: 1px solid rgba(0,0,0,.08); }

.pv-widget.style-neumorphism, .pv-widget.style-neumorphism .pv-head { background: #EDEEF3; color: #333; }
.pv-widget.style-neumorphism .pv-head { box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.pv-widget.style-neumorphism .pv-msg { box-shadow: 3px 3px 7px rgba(0,0,0,.15), -3px -3px 7px rgba(255,255,255,.7); }
.pv-widget.style-neumorphism .pv-msg.them { background: #EDEEF3; }
.pv-widget.style-neumorphism .pv-input div { border: none; box-shadow: inset 2px 2px 5px rgba(0,0,0,.15), inset -2px -2px 5px rgba(255,255,255,.7); }
.pv-bubble.style-neumorphism { box-shadow: 6px 6px 14px rgba(0,0,0,.3), -4px -4px 12px rgba(255,255,255,.35); }

.pv-widget.style-vibrant .pv-head { background: linear-gradient(120deg, var(--pv), color-mix(in srgb, var(--pv) 55%, #FF3D9A)); }
.pv-widget.style-vibrant .pv-msg { border-radius: 18px; }
.pv-widget.style-vibrant .pv-msg.them { border-bottom-left-radius: 6px; }
.pv-widget.style-vibrant .pv-msg.me { border-bottom-right-radius: 6px; background: linear-gradient(120deg, var(--pv), color-mix(in srgb, var(--pv) 55%, #FF3D9A)); }
.pv-widget.style-vibrant .pv-input span { border-radius: 20px; background: linear-gradient(120deg, var(--pv), color-mix(in srgb, var(--pv) 55%, #FF3D9A)); }
.pv-bubble.style-vibrant { background: linear-gradient(135deg, var(--pv), color-mix(in srgb, var(--pv) 55%, #FF3D9A)); box-shadow: 0 10px 26px -6px color-mix(in srgb, var(--pv) 65%, transparent); }

.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.style-card {
    position: relative; display: block; border: 1.5px solid var(--border); border-radius: 12px; padding: 10px 12px;
    cursor: pointer; text-align: left; background: var(--surface-2); transition: border-color .15s, background .15s;
}
.style-card:hover { border-color: var(--accent); }
.style-card.on { border-color: var(--accent); background: var(--accent-soft); }
.style-card input { position: absolute; opacity: 0; pointer-events: none; }
.style-card strong { display: block; font-size: 13px; margin-bottom: 2px; }
.style-card span { display: block; font-size: 11.5px; color: var(--text-3); line-height: 1.35; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; position: relative; z-index: 1; }
.auth-art {
    position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; color: #fff;
    background:
        radial-gradient(600px 400px at 80% 10%, rgba(255,255,255,.18), transparent 60%),
        linear-gradient(145deg, var(--accent), var(--accent-deep) 70%, #07070d);
}
.auth-art::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .18;
    background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
    background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 60%, #000 10%, transparent 70%);
}
.auth-art h2 { font-size: 38px; line-height: 1.12; font-weight: 750; max-width: 14ch; position: relative; z-index: 1; }
.auth-art p { opacity: .8; max-width: 40ch; position: relative; z-index: 1; }
.auth-art .brand-mark { background: rgba(255,255,255,.18); box-shadow: none; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.auth-card h1 { font-size: 26px; font-weight: 750; }
.auth-card .btn { height: 44px; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
    .c-3 { grid-column: span 6; } .c-4 { grid-column: span 6; } .c-5, .c-7 { grid-column: span 12; }
    .c-8 { grid-column: span 12; } .c-6 { grid-column: span 12; }
    .r-2 { grid-row: auto; }
    .settings-layout, .team-layout { grid-template-columns: minmax(0, 1fr); }
    .preview-wrap { position: static; }
}
@media (max-width: 1100px) {
    .conv-layout { grid-template-columns: minmax(0, 1fr); }
    .details { display: none; }
    .kb-layout { grid-template-columns: minmax(0, 1fr); }
    .kb-form { position: static; }
}
@media (max-width: 860px) {
    .sidebar { position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%); transition: transform .22s ease; background: var(--surface); }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.45); }
    .icon-btn.menu-btn { display: grid; }
    .main { padding: 0 16px 32px; }
    .topbar h1 { font-size: 19px; }
    .auth { grid-template-columns: 1fr; }
    .auth-art { display: none; }
}
@media (max-width: 640px) {
    .bento { gap: 12px; }
    .c-3 { grid-column: span 6; }
    .c-4 { grid-column: span 12; }
    .tile { padding: 16px; }
    .kpi { gap: 8px; }
    .kpi-value { font-size: 28px; }
    .kpi-foot { display: none; }
    .two { grid-template-columns: 1fr; }
    .toolbar .search { max-width: none; margin-left: 0; }
    .conv { grid-template-columns: minmax(0, 1fr) auto; }
    .conv > .avatar { display: none; }
    .msg { max-width: 88%; }
    .status-seg button span { display: none; }
    .hero h2 { font-size: 22px; }
}
