/* =====================================================================
   AI Chatbot — Admin Panel Styles
   File: public/admin-assets/css/admin.css
   ===================================================================== */

:root {
    --primary: #5B5BF6;
    --primary-600: #4845E4;
    --primary-50: #EEF0FF;
    --primary-100: #E0E3FF;

    --bg: #F5F6FA;
    --surface: #FFFFFF;
    --surface-2: #F9FAFC;
    --border: #E6E8F0;
    --border-strong: #D5D9E4;

    --text: #111827;
    --text-2: #4B5563;
    --muted: #8A93A6;

    --sidebar-bg: #0E1121;
    --sidebar-text: #A3A9C2;
    --sidebar-hover: rgba(255, 255, 255, .06);
    --sidebar-active: rgba(91, 91, 246, .18);

    --green: #12B76A;   --green-50: #E7F8F0;
    --amber: #F59E0B;   --amber-50: #FEF4E2;
    --red: #EF4444;     --red-50: #FDECEC;
    --blue: #2E90FA;    --blue-50: #E8F2FF;
    --violet: #7A5AF8;  --violet-50: #F1EDFF;
    --gray-50: #F1F2F6;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .16);

    --sidebar-w: 264px;
    --topbar-h: 68px;
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
    --primary-50: rgba(91, 91, 246, .14);
    --primary-100: rgba(91, 91, 246, .24);
    --bg: #0B0D17;
    --surface: #131626;
    --surface-2: #181C2F;
    --border: #232840;
    --border-strong: #2E3452;
    --text: #EEF0F7;
    --text-2: #B4BAD0;
    --muted: #7C84A0;
    --sidebar-bg: #0A0C16;
    --green-50: rgba(18, 183, 106, .14);
    --amber-50: rgba(245, 158, 11, .14);
    --red-50: rgba(239, 68, 68, .14);
    --blue-50: rgba(46, 144, 250, .14);
    --violet-50: rgba(122, 90, 248, .16);
    --gray-50: #1C2036;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }
svg { flex-shrink: 0; }
button { font-family: inherit; }

.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 22px; height: 22px; }

/* ---------------------------------------------------------------------
   Buttons & form controls
   --------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 16px;
    border-radius: var(--radius-sm); border: 1px solid transparent;
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(72, 69, 228, .3), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--primary-600); color: #fff; }
.btn-light { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn-light:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--gray-50); color: var(--text); }
.btn-block { width: 100%; }
.btn-lg { height: 46px; font-size: 15px; }
.btn[disabled] { opacity: .7; cursor: not-allowed; }

.btn .spinner { display: none; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-label-icon { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
    cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--surface); }

.form-group { margin-bottom: 18px; }
.form-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; font-size: 13px; font-weight: 600; color: var(--text); }
.input-wrap { position: relative; }
.input-wrap > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.form-control {
    width: 100%; height: 46px; padding: 0 14px 0 42px;
    font: inherit; font-size: 14px; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    outline: none; transition: border-color .15s, box-shadow .15s;
}
.form-control::placeholder { color: var(--muted); }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-100); }
.form-control.is-invalid { border-color: var(--red); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 4px var(--red-50); }
.input-action {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
    border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer;
}
.input-action:hover { color: var(--text); background: var(--gray-50); }
.invalid-feedback { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-size: 13px; color: var(--red); }

.checkbox { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; color: var(--text-2); user-select: none; }
.checkbox input { width: 17px; height: 17px; margin: 0; accent-color: var(--primary); cursor: pointer; }

/* ---------------------------------------------------------------------
   Alerts / toasts
   --------------------------------------------------------------------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 18px; border: 1px solid; }
.alert-error { background: var(--red-50); color: #B42318; border-color: rgba(239, 68, 68, .25); }
.alert-success { background: var(--green-50); color: #067647; border-color: rgba(18, 183, 106, .25); }
[data-theme="dark"] .alert-error { color: #FDA29B; }
[data-theme="dark"] .alert-success { color: #75E0A7; }

.toast {
    position: fixed; right: 24px; bottom: 24px; z-index: 100;
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px 12px 14px; border-radius: 12px;
    background: #111827; color: #fff; box-shadow: var(--shadow-lg);
    font-size: 13.5px; font-weight: 500;
    animation: toastIn .3s ease;
}
.toast .icon { color: #32D583; }
.toast.hide { opacity: 0; transform: translateY(8px); transition: .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* =====================================================================
   LOGIN PAGE
   ===================================================================== */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1fr) 1.1fr; background: var(--surface); }
.auth-form-side { display: flex; flex-direction: column; padding: 32px 48px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); }
.brand-mark {
    width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #7C7CFF 0%, #5B5BF6 50%, #3B36D8 100%); color: #fff;
    box-shadow: 0 6px 16px -6px rgba(91, 91, 246, .7), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-mark .icon { width: 19px; height: 19px; stroke-width: 2; }
.auth-form-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 0; }
.auth-card { width: 100%; max-width: 400px; }
.auth-eyebrow { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; background: var(--primary-50); color: var(--primary); font-size: 12px; font-weight: 600; margin-bottom: 18px; }
.auth-title { font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; margin: 0 0 8px; }
.auth-subtitle { color: var(--text-2); margin: 0 0 30px; font-size: 15px; }
.auth-row { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 24px; }
.auth-foot { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12.5px; }
.auth-secure { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 22px; color: var(--muted); font-size: 12.5px; }

.auth-visual {
    position: relative; overflow: hidden; margin: 14px; border-radius: 24px;
    background:
        radial-gradient(900px 500px at 110% -10%, rgba(143, 132, 255, .55), transparent 60%),
        radial-gradient(700px 500px at -20% 110%, rgba(46, 144, 250, .35), transparent 60%),
        linear-gradient(160deg, #1B1B4B 0%, #121231 55%, #0B0B22 100%);
    color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 48px;
}
.auth-visual::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse at 60% 40%, #000 20%, transparent 75%);
}
.auth-visual > * { position: relative; }
.visual-head h2 { font-size: 30px; line-height: 1.25; letter-spacing: -.02em; margin: 0 0 12px; font-weight: 700; max-width: 460px; }
.visual-head p { margin: 0; color: rgba(255,255,255,.7); font-size: 15px; max-width: 440px; }

.chat-mock { width: 100%; max-width: 440px; margin: 36px auto; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 20px; backdrop-filter: blur(12px); box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); overflow: hidden; }
.chat-mock-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.chat-mock-head .avatar { width: 32px; height: 32px; }
.chat-mock-head strong { display: block; font-size: 13.5px; }
.chat-mock-head span { font-size: 12px; color: rgba(255,255,255,.6); display: flex; align-items: center; gap: 6px; }
.chat-mock-head .pill { margin-left: auto; }
.chat-mock-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 80%; padding: 10px 13px; border-radius: 14px; font-size: 13px; line-height: 1.45; animation: bubbleIn .5s ease both; }
.bubble.visitor { align-self: flex-end; background: #5B5BF6; border-bottom-right-radius: 4px; }
.bubble.ai { align-self: flex-start; background: rgba(255,255,255,.12); border-bottom-left-radius: 4px; }
.bubble.system { align-self: center; max-width: none; background: rgba(18, 183, 106, .18); color: #75E0A7; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 999px; display: flex; gap: 6px; align-items: center; }
.bubble .who { display: block; font-size: 11px; font-weight: 600; opacity: .7; margin-bottom: 3px; }
.bubble:nth-child(2) { animation-delay: .25s; } .bubble:nth-child(3) { animation-delay: .5s; } .bubble:nth-child(4) { animation-delay: .75s; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px); } }

.visual-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.visual-feature { padding: 14px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); }
.visual-feature .icon { color: #A5A6FF; margin-bottom: 8px; }
.visual-feature strong { display: block; font-size: 13px; margin-bottom: 2px; }
.visual-feature span { font-size: 12px; color: rgba(255,255,255,.6); }

/* =====================================================================
   APP LAYOUT (sidebar + topbar)
   ===================================================================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-w);
    background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column; transition: transform .25s ease;
}
.sidebar-brand { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 20px; color: #fff; font-weight: 700; font-size: 16px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-brand small { display: block; font-size: 11px; font-weight: 500; color: var(--sidebar-text); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 12px; }
.nav-section { padding: 16px 12px 8px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #5D6482; }
.nav-section:first-child { padding-top: 4px; }
.nav-link {
    display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; margin-bottom: 2px;
    border-radius: 10px; color: var(--sidebar-text); font-weight: 500; font-size: 14px;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active { background: var(--sidebar-active); color: #fff; }
.nav-link.active .icon { color: #9B9BFF; }
.nav-link .badge { margin-left: auto; }
.nav-link.disabled { opacity: .55; }
.nav-soon { margin-left: auto; font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.07); color: #7C84A0; }

.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-user { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: 12px; }
.sidebar-user:hover { background: var(--sidebar-hover); }
.sidebar-user strong { display: block; color: #fff; font-size: 13.5px; line-height: 1.3; }
.sidebar-user span { font-size: 12px; }
.sidebar-user form { margin-left: auto; }
.sidebar-user .logout-btn { width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--sidebar-text); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.sidebar-user .logout-btn:hover { background: rgba(239, 68, 68, .15); color: #FDA29B; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
    display: flex; align-items: center; gap: 14px; padding: 0 28px;
    background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar .menu-toggle { display: none; }
.search { position: relative; flex: 1; max-width: 420px; }
.search .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; height: 40px; padding: 0 60px 0 40px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; outline: none; }
.search input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-100); }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 600 11px var(--font); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; background: var(--surface-2); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.status-toggle { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: var(--radius-sm); background: var(--green-50); color: #067647; font-weight: 600; font-size: 13px; }
[data-theme="dark"] .status-toggle { color: #75E0A7; }

.content { padding: 28px; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 4px; }
.page-subtitle { margin: 0; color: var(--text-2); }
.page-actions { display: flex; gap: 10px; }

.app-footer { padding: 18px 28px; color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; border-top: 1px solid var(--border); }

.sidebar-backdrop { display: none; }

/* ---------------------------------------------------------------------
   Components: avatar, badge, pill, card
   --------------------------------------------------------------------- */
.avatar { position: relative; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #8B8BFF, #5B5BF6); flex-shrink: 0; }
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }
.avatar .presence { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--green); border: 2px solid var(--sidebar-bg); }

.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--red); color: #fff; }
.nav-link .badge[data-live-badge]:not([hidden]) { animation: badge-pop 1.8s ease-in-out infinite; }
@keyframes badge-pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }

/* ===== Notification bell ===== */
.notif { position: relative; }
.notif-count { position: absolute; top: 3px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--surface); }
.notif-btn.wave svg { transform-origin: 50% 4px; animation: bell-swing 1.6s ease-in-out infinite; }
.notif-btn.wave .notif-count { animation: bell-pulse 1.2s ease-in-out infinite; }
@keyframes bell-swing { 0%, 60%, 100% { transform: rotate(0); } 5% { transform: rotate(14deg); } 15% { transform: rotate(-12deg); } 25% { transform: rotate(9deg); } 35% { transform: rotate(-6deg); } 45% { transform: rotate(3deg); } }
@keyframes bell-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.55); } 70% { box-shadow: 0 0 0 6px rgba(239,68,68,0); } }
.notif-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 320px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 20px 50px -18px rgba(15,23,42,.35); z-index: 60; overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.notif-head span { font-size: 12px; color: var(--text-muted); background: var(--surface-2); padding: 1px 8px; border-radius: 999px; }
.notif-list { max-height: 340px; overflow: auto; }
.notif-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); }
.notif-item:hover { background: var(--surface-2); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.notif-item-txt { flex: 1; min-width: 0; }
.notif-item-txt b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item-txt small { display: block; font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.notif-tag { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 999px; vertical-align: middle; }
.notif-tag.wait { background: #FEF3C7; color: #92400E; }
.notif-tag.ai { background: #EDE9FE; color: #5B21B6; }
.notif-empty { padding: 22px 14px; text-align: center; font-size: 13px; color: var(--text-muted); }
.notif-foot { display: block; padding: 11px 14px; text-align: center; font-size: 13px; font-weight: 600; color: var(--primary); text-decoration: none; border-top: 1px solid var(--border); }
.notif-foot:hover { background: var(--surface-2); }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.no-dot::before { display: none; }
.pill-ai { background: var(--violet-50); color: var(--violet); }
.pill-pending_agent { background: var(--amber-50); color: #B54708; }
.pill-agent { background: var(--green-50); color: #067647; }
.pill-closed { background: var(--gray-50); color: var(--muted); }
.pill-live { background: rgba(18,183,106,.18); color: #75E0A7; }
[data-theme="dark"] .pill-pending_agent { color: #FEC84B; }
[data-theme="dark"] .pill-agent { color: #75E0A7; }
.pulse::before { animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 5px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.card-title { margin: 0; font-size: 15px; font-weight: 700; }
.card-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.card-body { padding: 20px; }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat { padding: 20px; position: relative; overflow: hidden; }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.stat-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.stat-icon { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
.stat-icon.primary { background: var(--primary-50); color: var(--primary); }
.stat-icon.violet { background: var(--violet-50); color: var(--violet); }
.stat-icon.green { background: var(--green-50); color: var(--green); }
.stat-icon.amber { background: var(--amber-50); color: var(--amber); }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.stat-foot { margin-top: 10px; font-size: 12.5px; color: var(--muted); min-height: 24px; }
.stat-foot .icon { vertical-align: -3px; margin-right: 2px; }
.stat-foot b { color: var(--text-2); font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 18px; margin-bottom: 22px; }
.grid-2.wide { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); }

/* Bar chart (pure CSS) */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 230px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; }
.bar-track { flex: 1; width: 100%; max-width: 44px; display: flex; align-items: flex-end; }
.bar { width: 100%; min-height: 4px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, #8B8BFF, var(--primary)); position: relative; transition: opacity .15s; }
.bar.is-today { background: linear-gradient(180deg, #34D399, var(--green)); }
.bar:hover { opacity: .85; }
.bar-tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 700; color: var(--text); }
.bar-label { font-size: 12px; color: var(--muted); font-weight: 500; }

/* Distribution */
.dist-total { display: flex; align-items: baseline; gap: 8px; margin-bottom: 16px; }
.dist-total strong { font-size: 28px; letter-spacing: -.02em; }
.dist-total span { color: var(--muted); font-size: 13px; }
.dist-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--gray-50); gap: 3px; margin-bottom: 20px; }
.dist-bar span { display: block; height: 100%; }
.dist-list { list-style: none; margin: 0; padding: 0; }
.dist-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px dashed var(--border); font-size: 13.5px; }
.dist-list li:first-child { border-top: 0; }
.dist-list .sw { width: 10px; height: 10px; border-radius: 3px; }
.dist-list b { margin-left: auto; }

/* Table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.cell-user { display: flex; align-items: center; gap: 11px; min-width: 180px; }
.cell-user strong { display: block; font-size: 13.5px; }
.cell-user > div span { display: block; font-size: 12.5px; color: var(--muted); max-width: 210px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.site-dot { width: 8px; height: 8px; border-radius: 3px; }
.text-muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* Website list */
.site-list { list-style: none; margin: 0; padding: 6px 0; }
.site-list li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; }
.site-logo { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 14px; }
.site-list strong { display: block; font-size: 13.5px; }
.site-list div span, .site-list .count span { font-size: 12.5px; color: var(--muted); }
.site-list .count { margin-left: auto; text-align: right; }
.site-list .count b { display: block; font-size: 15px; }

/* Empty state */
.empty { text-align: center; padding: 44px 24px; }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; background: var(--primary-50); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.empty h4 { margin: 0 0 6px; font-size: 15px; }
.empty p { margin: 0 auto; max-width: 320px; color: var(--muted); font-size: 13.5px; }

/* Error page */
.error-page { min-height: 60vh; display: flex; align-items: center; justify-content: center; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1200px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2, .grid-2.wide { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
    .auth-page { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
    .auth-form-side { padding: 24px; }

    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10, 12, 22, .5); }
    .main { margin-left: 0; }
    .topbar .menu-toggle { display: inline-flex; }
}
@media (max-width: 640px) {
    .topbar { padding: 0 16px; gap: 10px; }
    .search { display: none; }
    .status-toggle span:not(.status-dot) { display: none; }
    .status-toggle { padding: 0 12px; }
    .content { padding: 20px 16px; }
    .stats { grid-template-columns: 1fr; gap: 12px; }
    .page-title { font-size: 21px; }
    .app-footer { padding: 16px; flex-direction: column; gap: 4px; }
    .auth-title { font-size: 26px; }
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); color: var(--green); animation: pulse 1.6s infinite; }

/* =====================================================================
   STEP 2 — Websites module
   ===================================================================== */
.text-right { text-align: right !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--gray-50); padding: 1px 6px; border-radius: 5px; color: var(--text); }
.req { color: var(--red); margin-left: 3px; margin-right: auto; }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #D92D20; color: #fff; }
.btn-danger[disabled] { opacity: .45; }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 9px; }
.icon-btn.is-success { color: var(--green); }
.link-btn { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 0; color: var(--primary); font: 600 12.5px var(--font); cursor: pointer; }
.link-btn:hover { color: var(--primary-600); }

/* Toolbar (filters + search) */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; background: var(--gray-50); border-radius: 10px; gap: 2px; }
.seg a { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 8px; color: var(--text-2); font-weight: 600; font-size: 13px; }
.seg a span { font-size: 11.5px; color: var(--muted); background: var(--surface); padding: 0 6px; border-radius: 999px; line-height: 18px; }
.seg a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg a.active span { background: var(--primary-50); color: var(--primary); }
.toolbar-search { position: relative; width: 280px; max-width: 100%; }
.toolbar-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar-search input { width: 100%; height: 38px; padding: 0 12px 0 36px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; outline: none; }
.toolbar-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-100); }

.row-title { display: block; font-weight: 600; font-size: 13.5px; color: var(--text); }
.row-title:hover { color: var(--primary); }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.row-actions form { margin: 0; }
.site-logo-img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--border); }
.site-logo.lg, .site-logo-img.lg { width: 52px; height: 52px; border-radius: 14px; font-size: 20px; }
.site-logo { flex-shrink: 0; }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; font-size: 13px; }
.pagination { display: flex; gap: 4px; }
.page-link { min-width: 34px; height: 34px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 13px; }
.page-link:hover { background: var(--surface-2); color: var(--text); }
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-link.disabled { opacity: .45; pointer-events: none; }

/* Page head extras */
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.back-link:hover { color: var(--text); }
.title-row { display: flex; align-items: center; gap: 14px; }
.title-row .page-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ext-link { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); }
.ext-link:hover { color: var(--primary); }
.head-stats { display: flex; gap: 10px; }
.head-stats div { padding: 10px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); min-width: 110px; }
.head-stats b { display: block; font-size: 20px; letter-spacing: -.01em; }
.head-stats span { font-size: 12px; color: var(--muted); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border: 0; background: none; color: var(--text-2); font: 600 13.5px var(--font); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-danger.active { color: var(--red); border-bottom-color: var(--red); }
.tab-danger { margin-left: auto; }

/* Form layout */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.input {
    width: 100%; min-height: 42px; padding: 9px 12px;
    font: inherit; font-size: 14px; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    outline: none; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--muted); }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-100); }
.input.is-invalid { border-color: var(--red); }
textarea.input { resize: vertical; line-height: 1.55; }
textarea.input.mono { font-size: 13px; }
select.input { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238A93A6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; cursor: pointer; }
.input-group { display: flex; }
.input-addon { display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--surface-2); color: var(--muted); font-size: 13.5px; }
.input-group .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.form-hint { margin-top: 7px; font-size: 12.5px; color: var(--muted); }
.counter { font-weight: 500; font-size: 12px; color: var(--muted); }

/* Switches */
.switch-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; cursor: pointer; }
.switch-list .switch-row + .switch-row { border-top: 1px solid var(--border); }
.switch-row.boxed { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 20px; background: var(--surface-2); }
.switch-row strong { display: block; font-size: 14px; }
.switch-row span { font-size: 12.5px; color: var(--muted); }
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch-slider { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: background .2s; }
.switch-slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-slider { box-shadow: 0 0 0 4px var(--primary-100); }

/* Choice cards */
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.choice-grid.two { grid-template-columns: repeat(2, 1fr); }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice-body { display: block; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 12px; transition: border-color .15s, background .15s, box-shadow .15s; }
.choice-body strong { display: block; font-size: 13.5px; }
.choice-body span { font-size: 12px; color: var(--muted); }
.choice:hover .choice-body { border-color: var(--primary); }
.choice input:checked + .choice-body { border-color: var(--primary); background: var(--primary-50); box-shadow: 0 0 0 1px var(--primary); }
.choice input:focus-visible + .choice-body { box-shadow: 0 0 0 4px var(--primary-100); }

/* Tag input */
.tag-input { display: flex; flex-wrap: wrap; gap: 6px; min-height: 44px; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: text; }
.tag-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-100); }
.tag-input input { flex: 1; min-width: 160px; border: 0; outline: none; background: transparent; font: inherit; color: var(--text); padding: 4px; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 6px 0 10px; border-radius: 8px; background: var(--amber-50); color: #B54708; font-size: 13px; font-weight: 600; }
[data-theme="dark"] .tag { color: #FEC84B; }
.tag button { display: inline-flex; border: 0; background: none; color: inherit; cursor: pointer; padding: 2px; border-radius: 5px; opacity: .7; }
.tag button:hover { opacity: 1; background: rgba(0,0,0,.06); }

/* Color field */
.color-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-field input[type="color"] { width: 42px; height: 42px; padding: 3px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); cursor: pointer; }
.color-field .input { width: 120px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; }
.swatch:hover { transform: scale(1.08); }

/* Upload */
.upload-row { display: flex; align-items: center; gap: 16px; }
.upload-preview { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; overflow: hidden; flex-shrink: 0; }
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-btn { cursor: pointer; }

/* Help card */
.help-card { position: sticky; top: calc(var(--topbar-h) + 20px); padding: 20px; border-radius: var(--radius); background: linear-gradient(180deg, var(--primary-50), var(--surface) 70%); border: 1px solid var(--border); }
.help-icon { width: 40px; height: 40px; border-radius: 11px; background: var(--surface); color: var(--primary); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); margin-bottom: 12px; }
.help-card h4 { margin: 0 0 10px; font-size: 14.5px; }
.help-steps, .help-list { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.help-steps li, .help-list li { margin-bottom: 8px; }
.help-note { display: flex; gap: 8px; margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--amber-50); color: #93370D; font-size: 12.5px; }
[data-theme="dark"] .help-note { color: #FEC84B; }

/* Save bar */
.save-bar { position: sticky; bottom: 16px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); box-shadow: var(--shadow-lg); font-size: 13px; }
.save-bar-actions { display: flex; gap: 10px; }

/* Install */
.code-block { margin: 0; padding: 16px 18px; border-radius: 12px; background: #0E1121; color: #C7CBF5; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }
.key-field { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-2); }
.key-field > .icon { color: var(--muted); }
.key-field .input { border: 0; background: transparent; box-shadow: none !important; padding-left: 4px; min-height: 36px; }
.inline-warning { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; padding: 14px 16px; border-radius: 12px; border: 1px dashed var(--border-strong); }
.inline-warning strong { display: block; font-size: 13.5px; }
.inline-warning span { font-size: 12.5px; color: var(--muted); }
.inline-warning form { margin: 0; }

/* Danger */
.danger-card { border-color: rgba(239, 68, 68, .35); }
.danger-card .card-head { background: var(--red-50); border-radius: var(--radius) var(--radius) 0 0; }
.danger-row { display: flex; gap: 10px; max-width: 520px; }

/* Widget preview */
.widget-preview { position: sticky; top: calc(var(--topbar-h) + 20px); padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.wp-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }
.wp-stage { position: relative; height: 470px; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; gap: 12px;
    background-color: var(--surface-2); background-image: radial-gradient(var(--border-strong) 1px, transparent 1px); background-size: 16px 16px; }
.wp-stage.is-left { align-items: flex-start; }
.wp-window { width: 100%; max-width: 270px; border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 18px 40px -12px rgba(16, 24, 40, .3); color: #111827; }
.wp-head { display: flex; align-items: center; gap: 10px; padding: 14px; background: var(--wc); color: #fff; }
.wp-head strong { display: block; font-size: 13.5px; }
.wp-head span { font-size: 11.5px; opacity: .85; }
.wp-avatar { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; overflow: hidden; flex-shrink: 0; }
.wp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.wp-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; background: #F7F8FB; min-height: 180px; }
.wp-msg { max-width: 85%; padding: 8px 11px; border-radius: 12px; font-size: 12.5px; line-height: 1.45; }
.wp-msg.bot { background: #fff; border: 1px solid #E6E8F0; border-bottom-left-radius: 4px; align-self: flex-start; }
.wp-msg.me { background: var(--wc); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.wp-typing { display: flex; gap: 3px; padding: 10px 12px; background: #fff; border: 1px solid #E6E8F0; border-radius: 12px; align-self: flex-start; }
.wp-typing i { width: 6px; height: 6px; border-radius: 50%; background: #98A2B3; animation: blink 1.2s infinite; }
.wp-typing i:nth-child(2) { animation-delay: .2s; } .wp-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.wp-input { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-top: 1px solid #E6E8F0; font-size: 12.5px; color: #98A2B3; background: #fff; }
.wp-input b { width: 28px; height: 28px; border-radius: 8px; background: var(--wc); color: #fff; display: flex; align-items: center; justify-content: center; }
.wp-launcher { width: 52px; height: 52px; border-radius: 50%; background: var(--wc); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 24px -8px var(--wc); }
.wp-launcher .icon { width: 24px; height: 24px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 12, 22, .55); backdrop-filter: blur(2px); animation: fadeIn .15s; }
.modal-card { position: relative; width: 100%; max-width: 420px; padding: 24px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-lg); animation: popIn .18s ease; }
.modal-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--red-50); color: var(--red); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.modal-title { margin: 0 0 6px; font-size: 17px; }
.modal-text { margin: 0 0 22px; color: var(--text-2); font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(6px); } }

.toast-error .icon { color: #F97066; }

@media (max-width: 1100px) {
    .form-layout { grid-template-columns: 1fr; }
    .help-card, .widget-preview { position: static; }
    .head-stats { display: none; }
}
@media (max-width: 640px) {
    .form-row, .choice-grid, .choice-grid.two { grid-template-columns: 1fr; }
    .toolbar-search { width: 100%; }
    .save-bar { flex-direction: column; align-items: stretch; }
    .save-bar > .text-muted { display: none; }
    .save-bar-actions .btn { flex: 1; }
    .danger-row, .inline-warning { flex-direction: column; align-items: stretch; }
    .title-row .site-logo.lg, .title-row .site-logo-img.lg { display: none; }
}

/* =====================================================================
   STEP 3 — Agents / Team + Profile
   ===================================================================== */
.sidebar-user-link { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; color: inherit; }
.sidebar-user-link:hover { color: inherit; }
.sidebar-user-link strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar.role-super_admin { background: linear-gradient(135deg, #8B8BFF, #4845E4); }
.avatar.role-website_manager { background: linear-gradient(135deg, #53B1FD, #1570EF); }
.avatar.role-agent { background: linear-gradient(135deg, #32D583, #039855); }
.avatar.is-inactive { filter: grayscale(1); opacity: .55; }
.avatar .presence.off { background: #98A2B3; }
.table .avatar .presence { border-color: var(--surface); }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.avatar.lg .presence { width: 14px; height: 14px; }

.pill-role-super_admin { background: var(--primary-50); color: var(--primary); }
.pill-role-website_manager { background: var(--blue-50); color: #175CD3; }
.pill-role-agent { background: var(--green-50); color: #067647; }
[data-theme="dark"] .pill-role-website_manager { color: #84CAFF; }
[data-theme="dark"] .pill-role-agent { color: #75E0A7; }

.status-text { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.status-text i { width: 8px; height: 8px; border-radius: 50%; background: #98A2B3; }
.status-text.online i { background: var(--green); box-shadow: 0 0 0 3px var(--green-50); }
.status-text.inactive { color: var(--muted); }
.status-text.inactive i { background: var(--red); }

.chip-list { display: flex; flex-wrap: wrap; gap: 5px; max-width: 280px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 7px; background: var(--gray-50); font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.chip .site-dot { width: 7px; height: 7px; }

.load { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.load-bar { width: 56px; height: 6px; border-radius: 999px; background: var(--gray-50); overflow: hidden; }
.load-bar span { display: block; height: 100%; border-radius: 999px; background: var(--green); }
.load-bar span.warn { background: var(--amber); }
.load-bar span.full { background: var(--red); }

.role-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.role-grid .choice-body .icon { margin-bottom: 6px; color: var(--primary); }
.choice.is-disabled { pointer-events: none; opacity: .6; }

.site-check-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.site-check { position: relative; cursor: pointer; }
.site-check input { position: absolute; opacity: 0; }
.site-check-body { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 11px; transition: border-color .15s, background .15s; }
.site-check-body .site-logo { width: 30px; height: 30px; border-radius: 8px; font-size: 12px; }
.site-check-body .meta { min-width: 0; }
.site-check-body .meta strong { display: block; font-size: 13.5px; line-height: 1.3; }
.site-check-body .meta > span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-check-body .check { margin-left: auto; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); display: flex; align-items: center; justify-content: center; color: transparent; flex-shrink: 0; }
.site-check input:checked + .site-check-body { border-color: var(--primary); background: var(--primary-50); }
.site-check input:checked + .site-check-body .check { background: var(--primary); border-color: var(--primary); color: #fff; }
.site-check input:focus-visible + .site-check-body { box-shadow: 0 0 0 4px var(--primary-100); }
.section-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 11px; background: var(--primary-50); color: var(--text-2); font-size: 13px; }
.section-note .icon { color: var(--primary); margin-top: 1px; }

.pw-strength { display: flex; gap: 4px; margin-top: 8px; }
.pw-strength span { flex: 1; height: 4px; border-radius: 999px; background: var(--gray-50); transition: background .2s; }
.pw-strength[data-level="1"] span:nth-child(-n+1) { background: var(--red); }
.pw-strength[data-level="2"] span:nth-child(-n+2) { background: var(--amber); }
.pw-strength[data-level="3"] span:nth-child(-n+3) { background: #84CC16; }
.pw-strength[data-level="4"] span:nth-child(-n+4) { background: var(--green); }
.input-wrap .input { padding-right: 44px; }

.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head h2 { margin: 0 0 4px; font-size: 18px; }
.meta-list { list-style: none; margin: 16px 0 0; padding: 0; font-size: 13px; }
.meta-list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px dashed var(--border); }
.meta-list li span { color: var(--muted); }
.stack { display: grid; gap: 18px; }

@media (max-width: 640px) {
    .role-grid, .site-check-list { grid-template-columns: 1fr; }
}
.toolbar-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.input.input-sm { min-height: 38px; height: 38px; padding-top: 0; padding-bottom: 0; width: auto; min-width: 150px; }
@media (max-width: 640px) { .toolbar-filters { width: 100%; } .toolbar-filters .input-sm { width: 100%; } }

/* =====================================================================
   STEP 4 — Settings
   ===================================================================== */
.form-actions { display: flex; justify-content: flex-end; }
.btn .spinner.dark { border-color: var(--border-strong); border-top-color: var(--text); }

.test-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.test-result { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 500; }
.test-result.ok { background: var(--green-50); color: #067647; }
.test-result.err { background: var(--red-50); color: #B42318; }
.test-result.warn { background: var(--amber-50); color: #93370D; }
[data-theme="dark"] .test-result.ok { color: #75E0A7; }
[data-theme="dark"] .test-result.err { color: #FDA29B; }
[data-theme="dark"] .test-result.warn { color: #FEC84B; }

.model-list { display: grid; gap: 8px; }
.model-body { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.model-body > span:first-child { min-width: 0; }
.model-body code { flex-shrink: 0; }

.pg-window { height: 340px; overflow-y: auto; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.pg-empty { margin: auto; text-align: center; color: var(--muted); font-size: 13px; max-width: 300px; }
.pg-msg { max-width: 80%; padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.pg-msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.pg-msg.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.pg-msg.err { align-self: stretch; max-width: none; background: var(--red-50); color: #B42318; font-size: 13px; }
[data-theme="dark"] .pg-msg.err { color: #FDA29B; }
.pg-msg .who { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.pg-meta { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.pg-meta span { font-size: 11px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 1px 7px; border-radius: 999px; }
.pg-meta span.handoff { color: #B54708; background: var(--amber-50); border-color: transparent; font-weight: 600; }
.pg-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.pg-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.pg-typing i:nth-child(2) { animation-delay: .2s; } .pg-typing i:nth-child(3) { animation-delay: .4s; }
.pg-input { display: flex; gap: 8px; margin-top: 12px; }
.pg-input .btn { width: 46px; padding: 0; height: 42px; }
.model-body > span:first-child { color: var(--text); font-size: 14px; }
.model-body > span:first-child > span { display: block; font-size: 12px; color: var(--muted); }
.input-addon { white-space: nowrap; }

/* =====================================================================
   STEP 6 — Live Chats
   ===================================================================== */
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; gap: 6px; }
.lc-msg { position: relative; }
.lc-msg-actions { display: none; gap: 6px; margin-top: 4px; }
.lc-msg.ours .lc-msg-actions { justify-content: flex-end; }
.lc-msg:hover .lc-msg-actions, .lc-msg-actions:hover { display: flex; }
.lc-msg-act { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); font-size: 11px; padding: 3px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.lc-msg-act:hover { background: var(--surface-2, #f3f4f6); color: var(--text); border-color: var(--primary); }
.lc-bubble.lc-deleted { font-style: italic; color: var(--text-muted); background: transparent; border: 1px dashed var(--border-strong); }
.lc-block { margin-top: 10px; }
.lc-block-on { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--red-50, #FEF3F2); color: #B42318; border: 1px solid #FECDCA; border-radius: 10px; padding: 8px 10px; font-size: 12.5px; margin-bottom: 8px; }
.lc-block-on span { flex: 1; min-width: 120px; }
.lc-block-on em { font-style: normal; color: #7A271A; }
.lc-block-on .btn { flex-shrink: 0; }
.btn-danger-soft { color: #B42318; }
.btn-danger-soft:hover { background: var(--red-50); color: #B42318; }
[data-theme="dark"] .btn-danger-soft, [data-theme="dark"] .btn-danger-soft:hover { color: #FDA29B; }
.toast-error { background: #7A271A; }

.lc { display: grid; grid-template-columns: 340px minmax(0, 1fr) 290px; height: calc(100vh - var(--topbar-h) - 32px); min-height: 520px;
      background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

/* ---- list ---- */
.lc-list { display: flex; flex-direction: column; border-right: 1px solid var(--border); min-height: 0; }
.lc-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 10px; }
.lc-list-head h1 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.lc-list-head .input-sm { min-width: 0; width: 140px; height: 32px; min-height: 32px; font-size: 12.5px; }
.lc-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.lc-tabs::-webkit-scrollbar { display: none; }
.lc-tabs button { display: inline-flex; align-items: center; gap: 5px; height: 38px; padding: 0 7px; border: 0; background: none; color: var(--text-2); font: 600 12.5px var(--font); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.lc-tabs button:hover { color: var(--text); }
.lc-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.lc-tabs span { font-size: 11px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--gray-50); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; }
.lc-tabs span.warn:not(.zero) { background: var(--amber); color: #fff; }
.lc-search { position: relative; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.lc-search .icon { position: absolute; left: 24px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.lc-search input { width: 100%; height: 36px; padding: 0 12px 0 34px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; outline: none; }
.lc-search input:focus { border-color: var(--primary); background: var(--surface); }
.lc-items { flex: 1; overflow-y: auto; }
.lc-item { display: flex; gap: 11px; width: 100%; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; cursor: pointer; font: inherit; color: var(--text); border-left: 3px solid transparent; }
.lc-item:hover { background: var(--surface-2); }
.lc-item.active { background: var(--primary-50); border-left-color: var(--primary); }
.lc-item.waiting { border-left-color: var(--amber); }
.lc-item.waiting.active { border-left-color: var(--primary); }
.lc-item .avatar .presence { border-color: var(--surface); }
.lc-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lc-item-top { display: flex; justify-content: space-between; gap: 8px; }
.lc-item-top b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-item-top time { font-size: 11.5px; color: var(--muted); flex-shrink: 0; }
.lc-item-preview { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-item-meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.lc-item-meta .site-dot { width: 7px; height: 7px; }
.lc-item-meta .pill { height: 19px; font-size: 10.5px; padding: 0 7px; }
.lc-item-meta .badge { margin-left: auto; }
.lc-list-empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.lc-loading { display: flex; justify-content: center; padding: 30px; }
.lc-loading .spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }

/* ---- chat ---- */
.lc-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface-2); }
.lc-empty { margin: auto; text-align: center; padding: 30px; max-width: 320px; }
.lc-empty h4 { margin: 0 0 6px; font-size: 15px; }
.lc-empty p { margin: 0; color: var(--muted); font-size: 13.5px; }
.lc-chat-inner { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.lc-chat-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.lc-back { display: none; }
.lc-chat-title { flex: 1 1 220px; min-width: 0; }
.lc-chat-title strong { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-chat-title > span { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.lc-chat-title .pill { height: 20px; font-size: 11px; }
.lc-online { color: var(--green); font-weight: 600; }
.lc-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.lc-assign .input-sm { min-width: 0; width: 140px; height: 34px; min-height: 34px; font-size: 13px; }
.lc-info-toggle { display: none; }

.lc-banner { padding: 10px 16px; font-size: 13px; border-bottom: 1px solid var(--border); }
.lc-banner.info { background: var(--violet-50); color: var(--text-2); }
.lc-banner.warn { background: var(--amber-50); color: #93370D; }
.lc-banner.muted { background: var(--gray-50); color: var(--muted); }
[data-theme="dark"] .lc-banner.warn { color: #FEC84B; }

.lc-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.lc-msg { display: flex; flex-direction: column; max-width: 72%; margin-top: 8px; }
.lc-msg.theirs { align-self: flex-start; align-items: flex-start; }
.lc-msg.ours { align-self: flex-end; align-items: flex-end; }
.lc-msg-name { font-size: 11.5px; font-weight: 600; color: var(--muted); margin: 0 4px 3px; }
.lc-auto { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; background: var(--gray-50); padding: 1px 5px; border-radius: 4px; }
.lc-bubble { padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.lc-msg.theirs .lc-bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.lc-msg.ai .lc-bubble { background: var(--violet-50); color: var(--text); border-bottom-right-radius: 5px; }
.lc-msg.agent .lc-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 5px; }
.lc-msg.agent .lc-bubble a { color: #fff; }
.lc-msg time { font-size: 10.5px; color: var(--muted); margin: 3px 4px 0; }
.lc-msg.sending { opacity: .6; }
.lc-msg.failed .lc-bubble { background: var(--red); }
.lc-sys { align-self: center; display: flex; align-items: center; gap: 8px; margin: 12px 0; font-size: 12px; color: var(--muted); }
.lc-sys span { background: var(--surface); border: 1px solid var(--border); padding: 4px 12px; border-radius: 999px; }
.lc-sys time { font-size: 10.5px; }

.lc-composer { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 12px 16px 10px; background: var(--surface); border-top: 1px solid var(--border); }
.lc-composer textarea { flex: 1; min-height: 44px; max-height: 160px; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; line-height: 1.45; resize: none; outline: none; }
.lc-composer textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-100); }
.lc-composer textarea:disabled { background: var(--gray-50); cursor: not-allowed; }
.lc-composer .btn { width: 44px; height: 44px; padding: 0; border-radius: 12px; }
.lc-hint { width: 100%; font-size: 11.5px; color: var(--muted); }

/* ---- info ---- */
.lc-info { border-left: 1px solid var(--border); overflow-y: auto; min-height: 0; }
.lc-info[hidden] { display: block !important; visibility: hidden; }
.lc-info-card { padding: 18px 16px; border-bottom: 1px solid var(--border); }
.lc-info-card h4 { margin: 0 0 10px; font-size: 13.5px; }
.lc-visitor-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.lc-visitor-head strong { display: block; font-size: 15px; }
.lc-visitor-head span { font-size: 12.5px; color: var(--muted); }
.lc-visitor-form { display: grid; gap: 8px; }
.lc-visitor-form label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.lc-visitor-form .input-sm { width: 100%; min-width: 0; height: 34px; min-height: 34px; font-size: 13px; }
.lc-info .meta-list { margin: 0; }
.lc-info .meta-list li { font-size: 12.5px; }
.lc-info .meta-list b { font-weight: 500; text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.lc-note-form { display: grid; gap: 8px; margin-bottom: 12px; }
.lc-note-form textarea { font-size: 13px; min-height: 60px; }
.lc-note-form .btn { justify-self: end; }
.lc-note { padding: 10px 12px; border-radius: 10px; background: var(--amber-50); margin-bottom: 8px; }
.lc-note p { margin: 0 0 4px; font-size: 13px; white-space: pre-wrap; color: var(--text); }
.lc-note span { font-size: 11px; color: var(--muted); }

/* ---- responsive ---- */
@media (max-width: 1280px) {
    .lc { grid-template-columns: 300px minmax(0, 1fr); }
    .lc-info { position: fixed; right: 0; top: var(--topbar-h); bottom: 0; width: 320px; z-index: 45; background: var(--surface); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .2s; }
    .lc--info-open .lc-info { transform: none; }
    .lc-info-toggle { display: inline-flex; }
}
@media (max-width: 900px) {
    .lc { grid-template-columns: 1fr; height: calc(100vh - var(--topbar-h) - 32px); }
    .lc-chat { display: none; }
    .lc--chat-open .lc-list { display: none; }
    .lc--chat-open .lc-chat { display: flex; }
    .lc-back { display: inline-flex; }
    .lc-actions .btn-sm { padding: 0 9px; }
    .lc-msg { max-width: 88%; }
    .lc-hint { display: none; }
}
@media (max-width: 640px) {
    .content { padding: 10px !important; }
    .lc-chat-head { flex-wrap: wrap; }
    .lc-actions { width: 100%; justify-content: flex-start; }
    .lc-info { width: 100%; }
}
.table tr.row-link { cursor: pointer; }
.lc-typing { align-self: flex-start; display: flex; align-items: center; gap: 4px; margin-top: 8px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; border-bottom-left-radius: 5px; }
.lc-typing span { font-size: 12px; color: var(--muted); margin-right: 4px; }
.lc-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.lc-typing i:nth-child(3) { animation-delay: .2s; } .lc-typing i:nth-child(4) { animation-delay: .4s; }
.flag { display: inline-block; width: 20px; height: 15px; border-radius: 3px; object-fit: cover; vertical-align: -2px; margin-right: 6px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); flex-shrink: 0; }
.lc-item-top b .flag { width: 18px; height: 13px; margin-right: 5px; }
.lc-chat-title > span .flag { margin-right: 2px; }
.flag-code { display: inline-flex; align-items: center; justify-content: center; height: 15px; padding: 0 4px; margin-right: 6px; border-radius: 3px; background: var(--gray-50); color: var(--text-2); font-size: 9.5px; font-weight: 700; letter-spacing: .03em; vertical-align: 1px; }

/* ---- Step 6c: VPN badge, viewing page ---- */
.lc-item-top .lc-item-name { display: flex; align-items: center; gap: 0; min-width: 0; }
.lc-item-top .lc-item-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lc-item-top .lc-item-name .flag { width: 18px; height: 13px; margin-right: 6px; }
.lc-item-top .lc-item-name .flag-code { margin-right: 6px; }
.vpn-badge { display: inline-flex; align-items: center; height: 17px; padding: 0 5px; margin-left: 6px; border-radius: 4px; background: var(--red); color: #fff; font-size: 9.5px; font-weight: 800; letter-spacing: .05em; flex-shrink: 0; cursor: help; }
.ok-badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; background: var(--green-50); color: #067647; font-size: 11px; font-weight: 700; }
.vpn-reason { font-size: 11.5px; color: var(--text-2); white-space: normal; }
.lc-info .meta-list li b:has(.vpn-badge) { white-space: normal; max-width: 170px; text-align: right; }
.lc-viewing { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border); font-size: 12.5px; min-width: 0; }
.lc-viewing-label { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; font-weight: 600; color: var(--text-2); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.lc-viewing a { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--primary); }
.lc-viewing a b { color: var(--text); font-weight: 600; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; box-shadow: 0 0 0 3px var(--green-50); }

/* =====================================================================
   Step 7: Chat History + Reports
   ===================================================================== */
.text-warn { color: #B54708; font-weight: 600; }
[data-theme="dark"] .text-warn { color: #FEC84B; }
.hint-line { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); }
.empty.compact { padding: 28px 16px; }

/* ---- History: filters ---- */
.filters-card { padding: 16px 18px; margin-bottom: 18px; }
.filters-grid { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; }
.filters-grid .filter-search { width: 100%; }
.filter-field { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.filter-field .input.input-sm { min-width: 140px; }
.filter-field input[type="date"].input-sm { min-width: 0; width: 150px; }
.filter-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; min-height: 38px; align-items: center; }
.filter-actions { display: flex; gap: 8px; margin-left: auto; align-items: center; }

/* ---- History: table ---- */
.history-table td { padding-top: 12px; padding-bottom: 12px; }
.history-table .cell-user strong.name-line { display: flex; align-items: center; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-table .cell-user > div > span { display: block; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-user > div strong .vpn-badge { display: inline-flex; color: #fff; font-size: 9.5px; max-width: none; overflow: visible; }
.cell-user > div strong .flag-code { display: inline-flex; color: var(--text-2); font-size: 9.5px; max-width: none; }
.cell-user > div strong .pill { display: inline-flex; font-size: 11px; max-width: none; margin-left: 6px; vertical-align: 1px; }
.history-subject { color: var(--text-2); font-size: 13px; min-width: 180px; max-width: 300px; }
.nowrap { white-space: nowrap; }

/* ---- History: transcript page ---- */
.history-layout { grid-template-columns: minmax(0, 1fr) 340px; }
.transcript { overflow: hidden; }
.transcript-body { max-height: none; overflow: visible; background: var(--surface-2); }
.day-sep { width: 100%; justify-content: center; }
.day-sep span { font-weight: 600; }
.side-title { margin: 0 0 4px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.meta-list.compact { margin-top: 8px; }
.meta-list.compact li { font-size: 12.5px; padding: 8px 0; }
.meta-list.compact li b { font-weight: 500; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.meta-list li.wrap { flex-direction: column; gap: 3px; }
.meta-list li.wrap b { text-align: left; }
.timeline { list-style: none; margin: 10px 0 0; padding: 0 0 0 16px; border-left: 2px solid var(--border); display: grid; gap: 14px; }
.timeline li { position: relative; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.timeline li small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.title-row .avatar.lg { flex-shrink: 0; }

@media print {
    .sidebar, .topbar, .app-footer, .page-actions, .back-link, .toast { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    .card { box-shadow: none !important; break-inside: avoid; }
    .history-layout { grid-template-columns: 1fr 260px; }
    .lc-msg { break-inside: avoid; }
    body { background: #fff; }
}
@media (max-width: 1100px) { .history-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
    .filter-field, .filter-field .input.input-sm, .filter-field input[type="date"].input-sm { width: 100%; }
    .filter-actions { width: 100%; justify-content: flex-end; }
}

/* ---- Reports ---- */
:root {
    --chart-ai: #7A5AF8;
    --chart-human: #12B76A;
}
[data-theme="dark"] {
    --chart-ai: #6E4FE8;
    --chart-human: #0E9F5E;
}
.report-filters { align-items: center; flex-wrap: wrap; }
.stat-value small { font-size: 18px; font-weight: 600; margin-left: 1px; color: var(--text-2); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; margin-right: 4px; }
.delta.up { color: #067647; }
.delta.down { color: #B42318; }
[data-theme="dark"] .delta.up { color: #75E0A7; }
[data-theme="dark"] .delta.down { color: #FDA29B; }
.report-card { margin-bottom: 22px; }
.grid-2.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.sw-ai { background: var(--chart-ai); }
.sw-human { background: var(--chart-human); }

.rchart { position: relative; height: 260px; padding-left: 34px; }
.rchart-grid { position: absolute; left: 34px; right: 0; top: 0; bottom: 24px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.rchart-grid span { position: relative; border-top: 1px dashed var(--border); height: 0; }
.rchart-grid span:last-child { border-top: 1px solid var(--border-strong); }
.rchart-grid span::before { content: attr(data-v); position: absolute; left: -34px; width: 26px; text-align: right; top: -6px; font-size: 11px; color: var(--muted); line-height: 1; }
.rchart-bars { position: relative; height: 100%; display: flex; align-items: stretch; gap: 6px; }
.rchart-bars.dense { gap: 2px; }
.rbar { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; outline: none; cursor: default; }
.rbar-track { flex: 1; min-height: 0; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.rbar-stack { width: 100%; max-width: 28px; display: flex; flex-direction: column; gap: 2px; border-radius: 4px 4px 0 0; overflow: hidden; transition: opacity .12s; }
.rbar-stack span { display: block; min-height: 2px; }
.seg-ai { background: var(--chart-ai); }
.seg-human { background: var(--chart-human); }
.rbar-label { height: 24px; line-height: 24px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: visible; }
.rchart-bars:has(.rbar.hover) .rbar:not(.hover) .rbar-stack { opacity: .45; }
.rbar:focus-visible .rbar-stack { outline: 2px solid var(--primary); outline-offset: 2px; }

.rtip { position: absolute; z-index: 5; transform: translateX(-50%); min-width: 150px; padding: 9px 11px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 12px; color: var(--text-2); pointer-events: none; display: grid; gap: 4px; }
.rtip b { color: var(--text); font-size: 12.5px; }
.rtip span { display: flex; align-items: center; gap: 6px; }
.rtip em { margin-left: auto; padding-left: 12px; font-style: normal; font-weight: 700; color: var(--text); }
.rtip .rtip-total { border-top: 1px solid var(--border); padding-top: 4px; margin-top: 2px; }

.table-toggle { margin-top: 14px; }
.table-toggle summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--primary); width: max-content; }
.table-toggle .table-wrap { margin-top: 10px; max-height: 300px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.table-sm th { padding: 9px 14px; }
.table-sm td { padding: 10px 14px; font-size: 13px; }

.heat { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; }
.heat-cell { position: relative; height: 46px; border-radius: 5px; background: var(--gray-50); overflow: hidden; outline: none; }
.heat-fill { position: absolute; inset: 0; background: var(--chart-ai); opacity: var(--a, 0); }
.heat-cell:hover, .heat-cell:focus-visible { box-shadow: 0 0 0 2px var(--text); }
.heat-axis { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--muted); }
.heat-scale { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 14px; font-size: 11px; color: var(--muted); }
.heat-scale i { width: 90px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--chart-ai) 12%, transparent), var(--chart-ai)); }

.dayparts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.daypart { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); display: grid; gap: 2px; min-width: 0; }
.daypart span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.daypart b { font-size: 20px; letter-spacing: -.01em; }
.daypart small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 13px; }
.hbar-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 6px; }
.hbar-name { display: inline-flex; align-items: center; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.hbar-top b { font-weight: 600; white-space: nowrap; }
.hbar-top b small { font-weight: 500; color: var(--muted); margin-left: 4px; }
.hbar { height: 8px; border-radius: 4px; background: var(--gray-50); overflow: hidden; }
.hbar span { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.vpn-badge.inline { margin: 0 2px 0 0; vertical-align: 1px; }

.load { display: flex; align-items: center; gap: 10px; }
.load-bar { width: 90px; height: 6px; border-radius: 3px; background: var(--gray-50); overflow: hidden; }
.load-bar span { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.load-bar.full span { background: var(--amber); }
.load small { font-size: 12px; color: var(--muted); white-space: nowrap; }

@media (max-width: 1200px) { .grid-2.even { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
    .rchart { height: 220px; }
    .rchart-bars { gap: 2px; }
    .heat-cell { height: 34px; border-radius: 3px; }
    .heat { gap: 2px; }
    .dayparts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-filters { width: 100%; }
    .report-filters form, .report-filters select { width: 100%; }
}

/* =====================================================================
   3D packaging box (settings side panel)
   ===================================================================== */
.box3d-card { position: sticky; top: calc(var(--topbar-h) + 20px); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden;
    background: radial-gradient(120% 80% at 50% 0%, var(--primary-50), var(--surface) 70%); }
.box3d-scene { --w: 150px; --h: 96px; --d: 110px; --t: 9s;
    position: relative; height: 300px; display: flex; align-items: center; justify-content: center; perspective: 900px; perspective-origin: 50% 30%; }
.box3d-tilt { position: relative; z-index: 1; transform-style: preserve-3d; transform: rotateX(-24deg) translateY(38px); }
.box3d { position: relative; width: var(--w); height: var(--h); transform-style: preserve-3d; animation: b3-spin 20s linear infinite; }
.b3-face { position: absolute; top: 0; left: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: #5A3413; text-align: center; box-shadow: inset 0 0 0 1px rgba(90, 52, 19, .18); }
.b3-front { width: var(--w); height: var(--h); transform: translateZ(calc(var(--d) / 2));
    background: linear-gradient(180deg, #D3A067, #C28C53); }
.b3-back { width: var(--w); height: var(--h); transform: rotateY(180deg) translateZ(calc(var(--d) / 2));
    background: linear-gradient(180deg, #C9955C, #B98249); }
.b3-right { width: var(--d); height: var(--h); left: calc((var(--w) - var(--d)) / 2); transform: rotateY(90deg) translateZ(calc(var(--w) / 2));
    background: linear-gradient(180deg, #C08A51, #AE7841); }
.b3-left { width: var(--d); height: var(--h); left: calc((var(--w) - var(--d)) / 2); transform: rotateY(-90deg) translateZ(calc(var(--w) / 2));
    background: linear-gradient(180deg, #BD874E, #A9743E); }
.b3-floor { width: var(--w); height: var(--d); top: calc((var(--h) - var(--d)) / 2); transform: rotateX(90deg) translateZ(calc(var(--h) / -2));
    background: #8E5F30; box-shadow: inset 0 0 26px rgba(40, 20, 5, .55); }
.b3-front, .b3-back, .b3-left, .b3-right, .b3-in { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.b3-in { background: linear-gradient(180deg, #A87542, #8E5F30); box-shadow: inset 0 0 18px rgba(40, 20, 5, .35); }
.b3-in-front { width: var(--w); height: var(--h); transform: rotateY(180deg) translateZ(calc(var(--d) / -2 + 1px)); }
.b3-in-back  { width: var(--w); height: var(--h); transform: translateZ(calc(var(--d) / -2 + 1px)); }
.b3-in-right { width: var(--d); height: var(--h); left: calc((var(--w) - var(--d)) / 2); transform: rotateY(-90deg) translateZ(calc(var(--w) / -2 + 1px)); }
.b3-in-left  { width: var(--d); height: var(--h); left: calc((var(--w) - var(--d)) / 2); transform: rotateY(90deg) translateZ(calc(var(--w) / -2 + 1px)); }
.b3-hinge { position: absolute; top: 0; left: 0; width: var(--w); height: 0; transform-style: preserve-3d; transform-origin: 50% 0;
    transform: translateZ(calc(var(--d) / -2)) rotateX(90deg); animation: b3-lid var(--t) ease-in-out infinite; }
.b3-lid { position: absolute; top: 0; left: -2px; width: calc(var(--w) + 4px); height: calc(var(--d) + 3px); border-radius: 0 0 3px 3px;
    background: linear-gradient(180deg, #D9A970, #CD9960); box-shadow: inset 0 0 0 1px rgba(90, 52, 19, .2), inset 0 -6px 10px rgba(90, 52, 19, .12); }
.b3-tape { position: absolute; top: 0; bottom: 0; left: 50%; width: 30px; transform: translateX(-50%); background: rgba(245, 222, 170, .55); border-left: 1px dashed rgba(90,52,19,.18); border-right: 1px dashed rgba(90,52,19,.18); }
.b3-logo { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: #5A3413; color: #E8C48E; }
.b3-logo .icon { width: 18px; height: 18px; }
.b3-front b { font-size: 11.5px; font-weight: 800; letter-spacing: .02em; max-width: 90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b3-face small { font-size: 8.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .75; }
.b3-arrows { font-size: 22px; font-weight: 800; letter-spacing: -4px; line-height: 1; }
.b3-barcode { width: 64px; height: 26px; background: repeating-linear-gradient(90deg, #5A3413 0 2px, transparent 2px 4px, #5A3413 4px 5px, transparent 5px 8px); opacity: .7; }

.box3d-shadow { position: absolute; z-index: 0; left: 50%; bottom: 40px; width: 190px; height: 26px; transform: translateX(-50%); border-radius: 50%;
    background: radial-gradient(closest-side, rgba(16, 24, 40, .28), transparent); filter: blur(2px); animation: b3-shadow 20s linear infinite; }
[data-theme="dark"] .box3d-shadow { background: radial-gradient(closest-side, rgba(0, 0, 0, .6), transparent); }

.box3d-sparkles { position: absolute; left: 50%; top: 100px; width: 0; height: 0; pointer-events: none; z-index: 2; }
.box3d-sparkles i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); opacity: 0; animation: b3-spark var(--t) ease-out infinite; }
.box3d-sparkles i:nth-child(1) { --x: -46px; --y: -34px; }
.box3d-sparkles i:nth-child(2) { --x: 42px;  --y: -40px; background: var(--amber); width: 6px; height: 6px; animation-delay: .15s; }
.box3d-sparkles i:nth-child(3) { --x: -8px;  --y: -58px; background: var(--green); animation-delay: .3s; }
.box3d-sparkles i:nth-child(4) { --x: 64px;  --y: -10px; width: 5px; height: 5px; animation-delay: .45s; }
.box3d-sparkles i:nth-child(5) { --x: -66px; --y: -6px; background: var(--amber); width: 5px; height: 5px; animation-delay: .6s; }

.box3d-caption { padding: 0 20px 20px; text-align: center; }
.box3d-caption strong { display: block; font-size: 14.5px; margin-bottom: 4px; }
.box3d-caption span { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

@keyframes b3-spin { from { transform: rotateY(0deg); } to { transform: rotateY(360deg); } }
@keyframes b3-lid {
    0%, 30%   { transform: translateZ(calc(var(--d) / -2)) rotateX(90deg); }
    46%, 74%  { transform: translateZ(calc(var(--d) / -2)) rotateX(205deg); }
    90%, 100% { transform: translateZ(calc(var(--d) / -2)) rotateX(90deg); }
}
@keyframes b3-spark {
    0%, 44%   { opacity: 0; transform: translate(0, 20px) scale(.4); }
    54%       { opacity: 1; }
    72%       { opacity: 0; transform: translate(var(--x), var(--y)) scale(1); }
    100%      { opacity: 0; transform: translate(var(--x), var(--y)) scale(1); }
}
@keyframes b3-shadow { 0%, 50%, 100% { width: 190px; } 25%, 75% { width: 160px; } }

@media (prefers-reduced-motion: reduce) {
    .box3d, .b3-hinge, .box3d-sparkles i, .box3d-shadow { animation: none; }
    .box3d { transform: rotateY(-32deg); }
}
@media (max-width: 1100px) {
    .box3d-card { position: static; }
    .box3d-scene { height: 270px; }
}

/* =====================================================================
   Step 8: Quote requests, files, rating
   ===================================================================== */
.pill-quote { background: var(--amber-50); color: #B54708; }
[data-theme="dark"] .pill-quote { color: #FEC84B; }
.lc-item-meta .pill-quote { height: 18px; padding: 0 6px; font-size: 10.5px; }
.lc-stars-sm { font-size: 11px; font-weight: 700; color: #B54708; }
[data-theme="dark"] .lc-stars-sm { color: #FEC84B; }

.lc-composer .lc-attach { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border-strong); flex-shrink: 0; }
.lc-composer .lc-attach:disabled { opacity: .45; cursor: not-allowed; }

.lc-file-img { display: block; padding: 4px !important; background: var(--surface) !important; border: 1px solid var(--border); line-height: 0; }
.lc-file-img img { max-width: 260px; max-height: 240px; border-radius: 12px; object-fit: cover; display: block; }
.lc-file { display: flex !important; align-items: center; gap: 10px; min-width: 200px; text-decoration: none; }
.lc-msg.theirs .lc-file { color: var(--text); }
.lc-file-ext { width: 40px; height: 44px; border-radius: 8px; background: var(--gray-50); color: var(--text-2); display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 800; letter-spacing: .03em; flex-shrink: 0; }
.lc-msg.agent .lc-file-ext { background: rgba(255,255,255,.2); color: #fff; }
.lc-file-meta { min-width: 0; }
.lc-file-meta b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.lc-file-meta small { font-size: 12px; opacity: .75; }

.lc-quote { background: var(--surface) !important; border: 1px solid var(--border) !important; border-left: 4px solid var(--amber) !important; white-space: normal !important; min-width: 240px; }
.lc-quote-h { font-weight: 700; margin-bottom: 6px; }
.lc-quote dl, .quote-dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 13px; }
.lc-quote dt, .quote-dl dt { color: var(--muted); }
.lc-quote dd, .quote-dl dd { margin: 0; overflow-wrap: anywhere; }

.lc-quote-card + .lc-quote-card { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.lc-quote-card .meta-list { margin: 0; }
.lc-quote-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.lc-quote-status .input.input-sm { min-width: 0; width: 150px; height: 34px; min-height: 34px; }
.lc-info-card h4 .icon { vertical-align: -3px; margin-right: 4px; color: var(--amber); }

.lc-stars, .stars-inline { display: inline-flex; align-items: center; gap: 1px; font-size: 18px; line-height: 1; color: var(--border-strong); }
.lc-stars .on, .stars-inline .on { color: #F59E0B; }
.lc-stars b { font-size: 13px; margin-left: 8px; color: var(--text); }
.stars-inline { font-size: 14px; }
.lc-rating-comment { margin: 8px 0 0; font-size: 13px; color: var(--text-2); font-style: italic; }
.stats.stats-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1400px) { .stats.stats-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .stats.stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .stats.stats-5 { grid-template-columns: 1fr; } }
.stat-foot a { color: inherit; } .stat-foot a:hover b { color: var(--primary); }
.quote-side .side-title .icon { vertical-align: -3px; color: var(--amber); }
.history-subject .pill-quote { height: 20px; padding: 0 7px; font-size: 11px; margin-right: 4px; vertical-align: 1px; }
.history-subject .stars-inline { margin-right: 6px; font-size: 12px; vertical-align: 0; }
.limits-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
@media (max-width: 640px) { .limits-grid { grid-template-columns: 1fr; } }

/* ---- Quote Requests page ---- */
.quotes-head { flex-wrap: wrap; }
.quotes-tabs { flex-wrap: wrap; }
.quotes-table td { vertical-align: top; }
.quotes-table tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.quotes-table .cell-user > div > span { display: block; max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quotes-table .cell-user strong.name-line { display: flex; align-items: center; }
.q-main { font-size: 14px; } .q-main b { font-weight: 700; }
.q-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.q-notes { font-size: 12.5px; color: var(--text-2); font-style: italic; margin-top: 4px; max-width: 280px; }
.q-status.input.input-sm { min-width: 130px; height: 34px; min-height: 34px; font-weight: 600; }
.q-status-new { background-color: var(--amber-50); color: #B54708; }
.q-status-contacted { background-color: var(--blue-50); color: #175CD3; }
.q-status-quoted { background-color: var(--violet-50); color: var(--violet); }
.q-status-won { background-color: var(--green-50); color: #067647; }
.q-status-lost { background-color: var(--gray-50); color: var(--muted); }
.quotes-table .icon-btn { display: inline-flex; }
.quotes-table td:nth-child(2) { min-width: 210px; }
.quotes-table td:first-child { min-width: 210px; }
.quotes-table .q-sub .site-tag { font-size: 12px; }
.quotes-table .q-sub, .quotes-table .q-main { white-space: normal; }

/* =====================================================================
   3D Mockups
   ===================================================================== */
.lc-mockup { display: flex !important; align-items: center; gap: 12px; min-width: 240px; background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--border); text-decoration: none; }
.lc-mockup:hover { border-color: var(--primary); }
.lc-mockup-cube { position: relative; width: 48px; height: 48px; flex-shrink: 0; border-radius: 10px; background: var(--surface-2); }
.lc-mockup-cube i { position: absolute; inset: 6px; }
.lc-mockup-cube i:nth-child(1) { background: color-mix(in srgb, var(--mc) 82%, #fff); clip-path: polygon(50% 0, 100% 25%, 50% 50%, 0 25%); }
.lc-mockup-cube i:nth-child(2) { background: color-mix(in srgb, var(--mc) 94%, #000); clip-path: polygon(0 25%, 50% 50%, 50% 100%, 0 75%); }
.lc-mockup-cube i:nth-child(3) { background: color-mix(in srgb, var(--mc) 76%, #000); clip-path: polygon(100% 25%, 50% 50%, 50% 100%, 100% 75%); }
.lc-mockup-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; white-space: normal; }
.lc-mockup-txt b { font-size: 13.5px; }
.lc-mockup-txt small { font-size: 12px; color: var(--muted); }
.lc-mockup-txt em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--primary); }
.lc-color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; box-shadow: 0 0 0 1px var(--border-strong); }
.lc-logo-thumb { max-width: 90px; max-height: 44px; border-radius: 6px; border: 1px solid var(--border); background: #fff; object-fit: contain; }

.mk-modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; }
.mk-modal[hidden] { display: none !important; }
.mk-backdrop { position: absolute; inset: 0; background: rgba(10, 12, 22, .55); backdrop-filter: blur(3px); }
.mk-card { position: relative; width: min(1080px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.mk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.mk-head h3 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.mk-head h3 .icon { color: var(--amber); }
.mk-head p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.mk-body { display: grid; grid-template-columns: 380px minmax(0, 1fr); min-height: 0; flex: 1; }
.mk-form { padding: 18px 22px; overflow-y: auto; display: grid; gap: 14px; align-content: start; border-right: 1px solid var(--border); }
.mk-field { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); min-width: 0; }
.mk-field .input.input-sm { width: 100%; min-width: 0; }
.mk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mk-dims { display: grid; grid-template-columns: 1fr 1fr 1fr 70px; gap: 6px; }
.mk-colors { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mk-colors button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; padding: 0; }
.mk-colors button.on { box-shadow: 0 0 0 2px var(--primary); }
.mk-custom { width: 28px; height: 28px; border-radius: 50%; padding: 2px; cursor: pointer; display: inline-flex; box-shadow: 0 0 0 1px var(--border-strong); background: conic-gradient(from 90deg, #ff0000, #ff8a00, #ffe600, #14ff00, #00e0ff, #0026ff, #d500ff, #ff0000); }
.mk-custom input[type=color] { width: 100%; height: 100%; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.mk-custom input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.mk-custom input[type=color]::-webkit-color-swatch { border: 2px solid var(--surface); border-radius: 50%; }
.mk-hex { width: 92px; text-transform: uppercase; }
.mk-logos { display: flex; flex-wrap: wrap; gap: 8px; }
.mk-logo { width: 64px; height: 48px; border-radius: 10px; border: 1px solid var(--border-strong); background: #fff; cursor: pointer; padding: 4px; display: flex; align-items: center; justify-content: center; }
.mk-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.mk-logo.none { font-size: 11px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.mk-logo.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-100); }
.mk-upload { justify-self: start; cursor: pointer; margin-top: 4px; }
.mk-preview { position: relative; min-height: 460px; background: radial-gradient(120% 90% at 50% 38%, #FFFFFF 0%, #EEF1F6 60%, #DDE3EC 100%); }
.mk-preview iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.mk-preview-note { position: absolute; top: 12px; left: 14px; font-size: 11.5px; font-weight: 600; color: #64748B; background: rgba(255,255,255,.8); padding: 4px 10px; border-radius: 999px; pointer-events: none; }
.mk-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--border); font-size: 12.5px; }
.mk-foot > div { display: flex; gap: 8px; }
@media (max-width: 900px) {
    .mk-modal { padding: 0; }
    .mk-card { max-height: 100vh; height: 100vh; border-radius: 0; }
    .mk-body { grid-template-columns: 1fr; overflow-y: auto; }
    .mk-form { border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; }
    .mk-preview { min-height: 360px; }
    .mk-foot > span { display: none; }
}
