/* =========================================
   LogicTech Digital — Maroon / Copper Theme
   ========================================= */

:root {
    /* LogicTech Digital — Burgundy + Warm Champagne + Charcoal */
    --bg: #0d0709;
    --surface: #181014;
    --surface-raised: #241820;
    --border: rgba(139, 26, 43, 0.20);
    --border-light: rgba(200, 169, 124, 0.28);
    --text: #eee2e4;
    --text-muted: #9c848a;
    --text-dim: #5f4a4f;
    --accent: #8b1a2b;         /* burgundy */
    --accent-2: #c8a97c;        /* warm champagne */
    --accent-hover: #a3223a;
    --accent-glow: rgba(139, 26, 43, 0.35);
    --green: #10b981;
    --red: #ef4444;
    --yellow: #d1a86b;
    --portal-accent: #8b1a2b;
    --portal-accent-2: #c8a97c;
}

body.portal-billing { --portal-accent: #8b1a2b; --portal-accent-2: #c8a97c; }
body.portal-design  { --portal-accent: #a3223a; --portal-accent-2: #d4b990; }
body.portal-energy  { --portal-accent: #7a1a24; --portal-accent-2: #c8a97c; }
body.portal-ebook   { --portal-accent: #b03248; --portal-accent-2: #d4b990; }
body.portal-manager { --portal-accent: #8b1a2b; --portal-accent-2: #c8a97c; }

/* Animated background orb positions */
@property --ob1x { syntax: '<percentage>'; initial-value: 15%; inherits: false; }
@property --ob1y { syntax: '<percentage>'; initial-value: 40%; inherits: false; }
@property --ob2x { syntax: '<percentage>'; initial-value: 85%; inherits: false; }
@property --ob2y { syntax: '<percentage>'; initial-value: 10%; inherits: false; }
@property --ob3x { syntax: '<percentage>'; initial-value: 60%; inherits: false; }
@property --ob3y { syntax: '<percentage>'; initial-value: 80%; inherits: false; }

@keyframes orb-move {
    0%   { --ob1x: 15%; --ob1y: 40%; --ob2x: 85%; --ob2y: 10%; --ob3x: 60%; --ob3y: 80%; }
    20%  { --ob1x: 28%; --ob1y: 55%; --ob2x: 72%; --ob2y: 28%; --ob3x: 45%; --ob3y: 65%; }
    40%  { --ob1x: 8%;  --ob1y: 70%; --ob2x: 92%; --ob2y: 8%;  --ob3x: 70%; --ob3y: 50%; }
    60%  { --ob1x: 40%; --ob1y: 25%; --ob2x: 55%; --ob2y: 40%; --ob3x: 30%; --ob3y: 85%; }
    80%  { --ob1x: 20%; --ob1y: 60%; --ob2x: 80%; --ob2y: 22%; --ob3x: 65%; --ob3y: 70%; }
    100% { --ob1x: 15%; --ob1y: 40%; --ob2x: 85%; --ob2y: 10%; --ob3x: 60%; --ob3y: 80%; }
}

body {
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse at var(--ob1x) var(--ob1y), rgba(139,26,43,0.10) 0%, transparent 55%),
        radial-gradient(ellipse at var(--ob2x) var(--ob2y), rgba(139,26,43,0.07) 0%, transparent 50%),
        radial-gradient(ellipse at var(--ob3x) var(--ob3y), rgba(139,26,43,0.05) 0%, transparent 45%);
    background-attachment: fixed;
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    animation: orb-move 30s ease-in-out infinite alternate;
}

/* --- Portal Navbar --- */
.twh-nav {
    background: rgba(12,4,7, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 2px 30px rgba(139,26,43, 0.08);
    overflow: visible;
}
/* Accent gradient bar: only after login (body has data-page-type) and only on desktop. */
body[data-page-type] .twh-nav::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, #8b1a2b, #8b1a2b, #06b6d4, #8b1a2b, #8b1a2b);
    background-size: 300% 100%;
    animation: nav-gradient-slide 5s linear infinite;
    z-index: 1;
}
@keyframes nav-gradient-slide {
    0%   { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}
.twh-nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.twh-nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.twh-nav-brand img { height: 32px; }
.twh-nav-divider { width: 1px; height: 20px; background: var(--border-light); }
.twh-nav-title { font-weight: 700; font-size: 15px; color: var(--text); }
.twh-nav-sub { font-size: 12px; color: var(--text-dim); }
.twh-nav-right { display: flex; align-items: center; gap: 12px; }
.twh-nav-badge {
    font-size: 12px; font-weight: 600;
    color: #c53a52;
    background: rgba(139,26,43, 0.12);
    border: 1px solid rgba(139,26,43, 0.3);
    padding: 3px 12px; border-radius: 20px;
}
.twh-nav-signout {
    font-size: 12px; color: var(--text-muted);
    background: none; border: 1px solid var(--border);
    padding: 5px 14px; border-radius: 8px; cursor: pointer;
    transition: all 0.15s;
}
.twh-nav-signout:hover { color: var(--text); border-color: var(--border-light); }

/* --- Auth Gate --- */
#auth-gate {
    position: fixed; inset: 0;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 30% 50%, rgba(139,26,43,0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 20%, rgba(139,26,43,0.08) 0%, transparent 45%);
    z-index: 9999; display: flex; align-items: center; justify-content: center;
}
.auth-card {
    background: linear-gradient(145deg, #170a10, #141445);
    border: 1px solid rgba(139,26,43, 0.25);
    border-radius: 20px; padding: 40px; width: 100%; max-width: 360px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.7), 0 0 50px rgba(139,26,43,0.12);
    position: relative;
}
.auth-card::before { display: none; }
.auth-logo { height: 48px; display: block; margin: 0 auto 12px; }
.auth-title { font-size: 20px; font-weight: 800; color: var(--text); text-align: center; }
.auth-sub {
    font-size: 11px; color: var(--text-dim); text-align: center;
    text-transform: uppercase; letter-spacing: 1.5px;
    margin-top: 4px; margin-bottom: 28px;
}
.auth-btn {
    width: 100%;
    background: linear-gradient(135deg, #8b1a2b, #8b1a2b);
    color: white; font-weight: 700; font-size: 15px;
    padding: 12px; border-radius: 10px; border: none; cursor: pointer;
    transition: all 0.2s; margin-top: 4px;
    box-shadow: 0 4px 20px rgba(139,26,43,0.4);
}
.auth-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 6px 28px rgba(139,26,43,0.55);
    transform: translateY(-1px);
}
.auth-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* --- Card & Container --- */
.card-hover { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -8px rgba(139,26,43,0.3);
    border-color: var(--accent);
}

/* --- Input Fields --- */
.input-field {
    width: 100%;
    background-color: rgba(255,255,255,0.04) !important;
    border: 1px solid var(--border-light);
    border-radius: 10px; padding: 0.75rem 1rem;
    color: var(--text) !important; font-size: 1rem;
    outline: none; transition: all 0.2s ease-in-out; appearance: none;
}
.input-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background-color: rgba(255,255,255,0.07) !important;
}
.input-field::placeholder { color: var(--text-dim); }

/* Select Arrow Fix */
select.input-field {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%234a4a90' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center; background-repeat: no-repeat;
    background-size: 1.5em 1.5em; padding-right: 2.5rem;
}

/* Dark color scheme for native date/time pickers and select dropdowns */
input[type="date"],
input[type="time"],
input[type="datetime-local"] { color-scheme: dark; }
select { color-scheme: dark; }
select option {
    background-color: #170a10;
    color: #f2e6e8;
}

/* Autofill Fix */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #170a10 inset !important;
    -webkit-text-fill-color: var(--text) !important;
    caret-color: white;
    transition: background-color 5000s ease-in-out 0s;
}

/* --- TOAST NOTIFICATION --- */
.toast {
    visibility: hidden; min-width: 250px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff; text-align: center; border-radius: 10px;
    padding: 16px; position: fixed; z-index: 100; left: 50%; top: 30px;
    transform: translateX(-50%); font-size: 17px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    opacity: 0; transition: opacity 0.3s, top 0.3s;
}
.toast.show { visibility: visible; opacity: 1; top: 50px; }
.toast.error { background: linear-gradient(135deg, #ef4444, #dc2626); }

/* --- PENDING CARD STYLES --- */
.pending-card {
    background: linear-gradient(145deg, #170a10, #111135);
    border: 1px solid var(--border);
    border-radius: 1rem; padding: 1.5rem;
    display: flex; flex-direction: column; gap: 1rem;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.pending-card:hover {
    transform: scale(1.01);
    border-color: rgba(139,26,43,0.4);
    box-shadow: 0 0 20px rgba(139,26,43,0.1);
}

/* --- CHAT WIDGET STYLES --- */
#chatMessages {
    overflow-y: auto; max-height: 20rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(139,26,43,0.3) transparent;
}
#chatMessages::-webkit-scrollbar { width: 4px; }
#chatMessages::-webkit-scrollbar-track { background: transparent; }
#chatMessages::-webkit-scrollbar-thumb {
    background: rgba(139,26,43,0.3); border-radius: 2px;
}

/* --- TABLE EDITABLE CELLS --- */
td[contenteditable="true"]:hover {
    background-color: rgba(139,26,43,0.08); cursor: text; border-radius: 4px;
}
td[contenteditable="true"]:focus {
    background-color: rgba(139,26,43,0.15); outline: 2px solid var(--accent);
}

/* --- ANIMATIONS --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in-up { animation: fadeInUp 0.3s ease-out forwards; }
.fade-in { animation: fadeInUp 0.25s ease-out; }

/* --- @MENTION DROPDOWN --- */
#mention-dropdown {
    position: absolute; bottom: 100%; left: 0; right: 0;
    background: linear-gradient(145deg, #170a10, #141445);
    border: 1px solid rgba(139,26,43,0.3);
    border-radius: 10px; max-height: 180px; overflow-y: auto;
    z-index: 100; box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
    margin-bottom: 4px;
}
#mention-dropdown .mention-item {
    padding: 8px 14px; cursor: pointer; font-size: 13px;
    color: var(--text-muted); transition: background 0.1s;
}
#mention-dropdown .mention-item:hover {
    background: rgba(139,26,43,0.15); color: var(--text);
}

/* =========================================
   GRADIENT TAILWIND OVERRIDES
   ========================================= */

/* Body backgrounds */
.bg-slate-900  { background-color: var(--bg) !important; }
.bg-slate-800  { background-color: var(--surface) !important; }
.bg-slate-800\/50 { background-color: rgba(23,10,16,0.5) !important; }
.bg-slate-900\/90 { background-color: rgba(12,4,7,0.92) !important; }
.bg-slate-900\/50 { background-color: rgba(12,4,7,0.5) !important; }
.bg-slate-900\/30 { background-color: rgba(12,4,7,0.3) !important; }
.bg-slate-700\/50 { background-color: rgba(36,16,26,0.5) !important; }
.bg-slate-700\/30 { background-color: rgba(36,16,26,0.3) !important; }

/* Borders */
.border-slate-700 { border-color: var(--border) !important; }
.border-slate-600 { border-color: var(--border-light) !important; }
.divide-slate-700 > * { border-color: var(--border) !important; }
.divide-slate-800 > * { border-color: rgba(139,26,43,0.08) !important; }

/* Text */
.text-slate-400 { color: var(--text-muted) !important; }
.text-slate-300 { color: #b09099 !important; }
.text-slate-500 { color: var(--text-dim) !important; }
.text-white     { color: var(--text) !important; }

/* Blue / Accent overrides */
.bg-blue-600 { background-color: var(--accent) !important; }
.bg-blue-700 { background-color: #7a1a24 !important; }
.bg-blue-500 { background-color: #8b1a2b !important; }
.hover\:bg-blue-500:hover,
.hover\:bg-blue-600:hover { background-color: var(--accent-hover) !important; }
.border-blue-500 { border-color: var(--accent) !important; }
.focus\:border-blue-500:focus { border-color: var(--accent) !important; }
.text-blue-400 { color: #8b1a2b !important; }
.text-blue-300 { color: #c53a52 !important; }
.shadow-blue-500\/30,
.shadow-blue-500\/20 { --tw-shadow-color: rgba(139,26,43,0.3) !important; }

/* Input overrides for Tailwind form elements */
.bg-slate-900.border { background-color: rgba(255,255,255,0.04) !important; }

/* Landing page gradient */
.from-blue-400  { --tw-gradient-from: #8b1a2b !important; }
.to-purple-500  { --tw-gradient-to: #8b1a2b !important; }

/* Manager nav specific */
.manager-nav {
    background: rgba(12,4,7, 0.95);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 40;
    box-shadow: 0 2px 30px rgba(139,26,43,0.08);
    padding-top: 2px;
    background-image: linear-gradient(90deg, rgba(139,26,43,1) 0%, rgba(139,26,43,1) 50%, rgba(139,26,43,1) 100%);
    background-size: 100% 2px;
    background-repeat: no-repeat;
    background-position: top;
}

/* --- AGENT PORTAL ANALYSIS TABS --- */
.agent-tab-bar {
    position: sticky; top: 57px; z-index: 30;
    background: rgba(9,9,11,0.97);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(63,63,70,0.7);
}
.agent-tab-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 16px; border-radius: 8px;
    font-size: 13px; font-weight: 600;
    color: #71717a; border: 1px solid transparent;
    cursor: pointer; background: transparent;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.agent-tab-btn:hover { color: #e4e4e7; background: rgba(255,255,255,0.05); }
.agent-tab-active {
    color: #c53a52 !important;
    background: rgba(139,26,43,0.12) !important;
    border-color: rgba(139,26,43,0.3) !important;
}
.game-sub-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 14px; border-radius: 8px; font-size: 12px; font-weight: 700;
    color: #71717a; border: 1px solid rgba(63,63,70,0.6);
    cursor: pointer; background: rgba(39,39,42,0.6);
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.game-sub-btn:hover { color: #e4e4e7; background: rgba(255,255,255,0.07); border-color: rgba(139,26,43,0.3); }
.game-sub-active {
    color: #c53a52 !important;
    background: rgba(139,26,43,0.14) !important;
    border-color: rgba(139,26,43,0.4) !important;
}

/* Toast notification (professional) */
#toast-container {
    position: fixed; bottom: 80px; right: 20px;
    z-index: 10000; display: flex; flex-direction: column; gap: 10px;
    pointer-events: none;
}
.toast-message {
    display: flex; align-items: flex-start; gap: 12px;
    background: linear-gradient(145deg, #170a10, #24101a);
    border: 1px solid rgba(139,26,43,0.25);
    border-radius: 14px; padding: 14px 16px;
    color: #f2e6e8; font-size: 13px;
    min-width: 260px; max-width: 340px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    pointer-events: all;
    animation: toastSlideIn 0.3s cubic-bezier(0.4,0,0.2,1) forwards;
}
.toast-success { border-color: rgba(16,185,129,0.35); }
.toast-error   { border-color: rgba(239,68,68,0.35); }
.toast-content { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.toast-title   { font-weight: 700; font-size: 13px; }
.toast-body    { color: #b09099; font-size: 12px; }
.toast-close   { color: #6d4d55; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
.toast-close:hover { color: #f2e6e8; }
@keyframes toastSlideIn  { from { opacity:0; transform:translateY(12px) scale(0.97); } to { opacity:1; transform:translateY(0) scale(1); } }
@keyframes toastSlideOut { from { opacity:1; transform:translateY(0) scale(1); } to { opacity:0; transform:translateY(8px) scale(0.96); } }

/* =========================================
   ENHANCED CARD EFFECTS
   ========================================= */

/* Glowing hover on all main surface cards */
.bg-slate-800 {
    transition: box-shadow 0.3s ease, border-color 0.3s ease !important;
}
.bg-slate-800:hover {
    box-shadow: 0 0 0 1px rgba(139,26,43,0.15), 0 20px 50px rgba(0,0,0,0.45) !important;
}

/* Stat number glow pulse */
@keyframes stat-glow {
    0%, 100% { text-shadow: 0 0 12px currentColor; }
    50%       { text-shadow: 0 0 28px currentColor, 0 0 8px currentColor; }
}
.text-green-400 { animation: stat-glow 4s ease-in-out infinite; }
.text-blue-400  { animation: stat-glow 4s ease-in-out infinite 1s; }
.text-yellow-400 { animation: stat-glow 4s ease-in-out infinite 2s; }

/* ==========================================================
   BURGUNDY-COERCE — force stray Tailwind palettes into brand
   ========================================================== */
/* Blues → burgundy */
.text-blue-400, .text-blue-300, .text-blue-200 { color: #d4998a !important; }
.text-blue-500 { color: #8b1a2b !important; }
.bg-blue-500, .bg-blue-600, .bg-blue-700 { background-color: #8b1a2b !important; }
.border-blue-500, .border-blue-600 { border-color: #8b1a2b !important; }
.from-blue-400 { --tw-gradient-from: #c8a97c !important; }
.to-blue-500,  .to-blue-600  { --tw-gradient-to:   #8b1a2b !important; }

/* Greens → champagne (dashboards) */
.text-green-400, .text-emerald-400 { color: #c8a97c !important; }
.text-green-300, .text-emerald-300 { color: #d4b990 !important; }
.text-green-500, .text-emerald-500 { color: #b09068 !important; }
.bg-green-500, .bg-emerald-500, .bg-green-600, .bg-emerald-600 { background-color: #8b1a2b !important; }
.border-green-500, .border-emerald-500 { border-color: #c8a97c !important; }
.from-green-500, .from-emerald-500 { --tw-gradient-from: #c8a97c !important; }
.to-green-500,   .to-emerald-500   { --tw-gradient-to:   #8b1a2b !important; }

/* Yellows → warm champagne (keep gold-ish accent for warmth) */
.text-yellow-400, .text-amber-400 { color: #d4b990 !important; }
.text-yellow-300, .text-amber-300 { color: #e2c9a5 !important; }
.text-yellow-500, .text-amber-500 { color: #c8a97c !important; }
.bg-yellow-500, .bg-amber-500, .bg-yellow-600, .bg-amber-600 { background-color: #c8a97c !important; color:#1a0a0e !important; }

/* Fuchsia / pink / violet stat colors → deep rose */
.text-fuchsia-400, .text-pink-400, .text-violet-400 { color: #c53a52 !important; }
.text-fuchsia-500, .text-pink-500 { color: #8b1a2b !important; }
.bg-fuchsia-500, .bg-pink-500 { background-color: #8b1a2b !important; }

/* Orange → deep burgundy so nothing screams */
.text-orange-400, .text-orange-500 { color: #a3223a !important; }
.bg-orange-500, .bg-orange-600 { background-color: #7a1a24 !important; }

/* Stagger entrance helpers */
@keyframes staggerIn {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.stagger-1 { animation: staggerIn 0.4s cubic-bezier(0.4,0,0.2,1) 0.05s backwards; }
.stagger-2 { animation: staggerIn 0.4s cubic-bezier(0.4,0,0.2,1) 0.10s backwards; }
.stagger-3 { animation: staggerIn 0.4s cubic-bezier(0.4,0,0.2,1) 0.15s backwards; }
.stagger-4 { animation: staggerIn 0.4s cubic-bezier(0.4,0,0.2,1) 0.20s backwards; }
.stagger-5 { animation: staggerIn 0.4s cubic-bezier(0.4,0,0.2,1) 0.25s backwards; }

/* Auth card entrance */
.auth-card {
    animation: staggerIn 0.5s cubic-bezier(0.34,1.36,0.64,1) forwards;
}

/* Shimmer loading skeleton */
@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
.skeleton {
    background: linear-gradient(90deg,
        rgba(255,255,255,0.03) 0%,
        rgba(255,255,255,0.07) 50%,
        rgba(255,255,255,0.03) 100%);
    background-size: 800px 100%;
    animation: shimmer 1.8s ease-in-out infinite;
    border-radius: 6px;
}

/* Nav gradient line enhanced — faster pulse */
@keyframes nav-gradient-slide {
    0%   { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* Button press micro-interaction */
button:active:not(:disabled) { transform: scale(0.97) !important; }

/* Input focus ring pulse */
@keyframes focus-ring {
    0%   { box-shadow: 0 0 0 3px var(--accent-glow); }
    50%  { box-shadow: 0 0 0 5px rgba(139,26,43,0.12); }
    100% { box-shadow: 0 0 0 3px var(--accent-glow); }
}
.input-field:focus {
    animation: focus-ring 2s ease-in-out infinite;
}

/* =========================================
   MOBILE RESPONSIVE
   ========================================= */

/* Tables always have horizontal scroll on narrow screens */
.overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(139,26,43,0.25) transparent;
}

/* Agent analysis tab bar — horizontal scroll on mobile */
.agent-tab-bar > div {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap !important;
}
.agent-tab-bar > div::-webkit-scrollbar { display: none; }
.agent-tab-btn { white-space: nowrap; }

@media (max-width: 768px) {
    /* Nav */
    .twh-nav-sub  { display: none !important; }
    .twh-nav-inner { padding: 10px 14px; gap: 8px; }

    /* Auth card */
    .auth-card { margin: 16px; padding: 28px 20px; max-width: calc(100vw - 32px); }

    /* Big stat numbers */
    .text-4xl { font-size: 2rem !important; }
    .text-3xl { font-size: 1.5rem !important; }

    /* Form grids stack */
    .grid.md\:grid-cols-2 { grid-template-columns: 1fr !important; }

    /* Toast full width */
    #toast-container { right: 10px; left: 10px; bottom: 75px; }
    .toast-message   { min-width: unset; max-width: 100%; }

    /* Chat widget full width */
    #chatWindow {
        left: 8px !important; right: 8px !important;
        width: auto !important; bottom: 76px !important;
    }
    #chatToggleBtn { bottom: 14px !important; left: 14px !important; }

    /* Reduce padding */
    .p-8  { padding: 18px !important; }
    .p-10 { padding: 20px !important; }

    /* Manager stats grid — force 1 col */
    #viewStats .grid { grid-template-columns: 1fr !important; }

    /* Performance list — 1 col */
    #agentPerformanceList { grid-template-columns: 1fr !important; }

    /* Pending sub-tab buttons wrap */
    #viewPending .flex.gap-4 { flex-wrap: wrap; gap: 8px !important; }

    /* Manager nav — scrollable row */
    .manager-nav-row {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .manager-nav-row::-webkit-scrollbar { display: none; }
    .manager-nav-row button { white-space: nowrap !important; }

    /* Analysis charts */
    canvas { max-width: 100% !important; }

    /* Table min-width for content */
    .overflow-x-auto table { min-width: 520px; }

    /* Landing page hero */
    .text-5xl { font-size: 2.2rem !important; }
    .text-6xl { font-size: 2.5rem !important; }
}

/* =========================================
   THEMES
   ========================================= */
:root[data-theme="dark"] {
    --bg: #0a0a0a; --surface: #111111; --surface-raised: #1a1a1a;
    --border: rgba(255,255,255,0.07); --border-light: rgba(255,255,255,0.12);
    --text: #f0f0f0; --text-muted: #888888; --text-dim: #555555;
}
:root[data-theme="dark"] body {
    background-image: radial-gradient(ellipse at 20% 30%, rgba(139,26,43,0.06) 0%, transparent 50%);
    animation: none;
}
:root[data-theme="dark"] .bg-slate-800 { background-color: #111111 !important; }
:root[data-theme="dark"] .bg-slate-900 { background-color: #0a0a0a !important; }
:root[data-theme="dark"] .bg-slate-900\/90 { background-color: rgba(10,10,10,0.93) !important; }
:root[data-theme="dark"] .twh-nav { background: rgba(10,10,10,0.96) !important; }

:root[data-theme="light"] {
    --bg: #f3f4ff; --surface: #ffffff; --surface-raised: #eef0ff;
    --border: rgba(139,26,43,0.15); --border-light: rgba(139,26,43,0.3);
    --text: #111827; --text-muted: #4b5563; --text-dim: #9ca3af;
    --accent-glow: rgba(139,26,43,0.1);
}
:root[data-theme="light"] body {
    background-image: radial-gradient(ellipse at 15% 40%, rgba(139,26,43,0.07) 0%, transparent 55%),
                      radial-gradient(ellipse at 85% 10%, rgba(139,26,43,0.05) 0%, transparent 50%);
    animation: none;
}
:root[data-theme="light"] .bg-slate-800  { background-color: #ffffff !important; }
:root[data-theme="light"] .bg-slate-900  { background-color: #f8f8ff !important; }
:root[data-theme="light"] .bg-slate-800\/50 { background-color: rgba(255,255,255,0.7) !important; }
:root[data-theme="light"] .bg-slate-900\/90 { background-color: rgba(248,248,255,0.95) !important; }
:root[data-theme="light"] .text-white    { color: #111827 !important; }
:root[data-theme="light"] .text-slate-400 { color: #6b7280 !important; }
:root[data-theme="light"] .text-slate-300 { color: #374151 !important; }
:root[data-theme="light"] .text-slate-500 { color: #9ca3af !important; }
:root[data-theme="light"] .border-slate-700 { border-color: rgba(139,26,43,0.15) !important; }
:root[data-theme="light"] .border-slate-600 { border-color: rgba(139,26,43,0.25) !important; }
:root[data-theme="light"] .bg-zinc-950  { background-color: #f3f4ff !important; }
:root[data-theme="light"] .bg-zinc-800  { background-color: #ffffff !important; }
:root[data-theme="light"] .text-zinc-200 { color: #111827 !important; }
:root[data-theme="light"] .bg-slate-700 { background-color: #eef0ff !important; }
:root[data-theme="light"] .twh-nav { background: rgba(255,255,255,0.95) !important; }
:root[data-theme="light"] .pending-card { background: linear-gradient(145deg,#fff,#f8f8ff) !important; }
:root[data-theme="light"] .auth-card    { background: linear-gradient(145deg,#fff,#eef0ff) !important; }
:root[data-theme="light"] #chatWindow   { background: #ffffff !important; }
:root[data-theme="light"] .bg-slate-800.border { border-color: rgba(139,26,43,0.2) !important; }

/* =========================================
   NIGHT WIDGET — THEME AWARE + MOBILE
   ========================================= */
#night-widget {
    background: linear-gradient(135deg,#7a1a24,#8b1a2b);
    border-color: rgba(139,26,43,0.4);
    color: white;
    cursor: default;
    /* Exclude width/height/top/left so native resize and drag stay 1:1. */
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s, opacity 0.3s;
    user-select: none;
    resize: both;
    overflow: hidden;
    min-width: 180px;
    min-height: 90px;
    max-width: 640px;
    max-height: 80vh;
    will-change: width, height;
}
/* Mobile: lock widget down, drop drag/resize/big mode + perf hogs (transitions, gradients, pulse). */
@media (max-width: 768px) {
    #night-widget {
        position: fixed !important;
        top: 64px !important;
        right: 8px !important;
        left: auto !important;
        bottom: auto !important;
        width: 150px !important;
        height: auto !important;
        min-width: 0 !important;
        min-height: 0 !important;
        max-width: 150px !important;
        max-height: 60vh !important;
        padding: 8px !important;
        border-radius: 12px !important;
        resize: none !important;
        transition: none !important;
        background: #7a1a24 !important; /* solid — no gradient repaint */
        will-change: auto;
        overflow-y: auto;
    }
    #night-widget::after { display: none !important; }
    #night-widget.nw-pulse { animation: none !important; }
    #night-widget #nw-header { font-size: 10px !important; margin-bottom: 4px !important; }
    #night-widget .nw-value { font-size: 18px !important; margin-bottom: 6px !important; }
    #night-widget .nw-select { font-size: 11px !important; padding: 4px 8px !important; }
    #night-widget .nw-breakdown { font-size: 10px !important; }
    #night-widget.nw-collapsed {
        max-height: 60px !important;
        overflow: hidden !important;
    }
    #night-widget.nw-collapsed .nw-value { font-size: 14px !important; margin-bottom: 0 !important; }
    #night-widget.nw-big {
        width: 92vw !important;
        max-width: 92vw !important;
        height: 70vh !important;
        max-height: 70vh !important;
        top: 5vh !important;
        left: 4vw !important;
        right: auto !important;
    }
}
/* Energy gauge fully removed; defensive hide for any cached injected node. */
#energy-core, #core-tooltip { display: none !important; }
/* Theme settings widget removed; hide any stale injection. */
#settings-btn, #settings-panel { display: none !important; }

/* Mobile: hide the gradient accent bar entirely + kill animations. */
@media (max-width: 768px) {
    body[data-page-type] .twh-nav::before { display: none !important; }
    /* Activity ticker (scrolling marquee) is constant repaint on mobile — hide. */
    #activityTicker { display: none !important; }
    /* Manager broadcast banner — keep but no animation. */
    #broadcast-banner { animation: none !important; }
    /* Shimmer skeletons → static, no animation. */
    .skeleton { animation: none !important; }
}
/* Inner content scales down gracefully when widget shrinks. */
#night-widget .nw-value { line-height: 1; }
/* Custom resize indicator in bottom-right so users see the handle. */
#night-widget::after {
    content: "";
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 12px;
    height: 12px;
    pointer-events: none;
    background:
        linear-gradient(135deg, transparent 0 50%, rgba(255,255,255,0.5) 50% 60%, transparent 60% 70%, rgba(255,255,255,0.5) 70% 80%, transparent 80% 90%, rgba(255,255,255,0.5) 90% 100%);
    border-bottom-right-radius: 0.75rem;
}
#night-widget.nw-collapsed { resize: none; min-height: 0; }
#night-widget.nw-collapsed::after { display: none; }
/* Collapse hides sparkline/top-agent. */
#night-widget.nw-collapsed .nw-spark,
#night-widget.nw-collapsed .nw-top-agent { display: none !important; }

#night-widget .nw-value { transition: text-shadow 0.3s; }

/* Sparkline canvas — keep crisp on HiDPI without CSS scaling */
#night-widget .nw-spark { display: block; height: 36px; }

/* Top agent tag */
#night-widget .nw-top-agent {
    color: #fde68a;
    background: rgba(255,255,255,0.12);
}

/* Pulse on new charged lead */
@keyframes nwPulse {
    0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.6), 0 12px 32px rgba(0,0,0,0.4); }
    50%  { box-shadow: 0 0 0 14px rgba(34,197,94,0.0), 0 12px 32px rgba(0,0,0,0.4); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.0), 0 12px 32px rgba(0,0,0,0.4); }
}
#night-widget.nw-pulse { animation: nwPulse 1.2s ease-out; }
#night-widget.nw-pulse .nw-value { text-shadow: 0 0 12px rgba(134,239,172,0.95); }

/* Idle fade — pure opacity transition, GPU friendly */
#night-widget.nw-idle { opacity: 0.35; }
#night-widget.nw-idle:hover { opacity: 1; }

/* Big mode — projector / huddle view */
#night-widget.nw-big {
    width: min(70vw, 800px) !important;
    height: min(60vh, 600px) !important;
    top: 10vh !important; left: 15vw !important;
    right: auto !important; bottom: auto !important;
    resize: none;
}
#night-widget.nw-big .nw-value { font-size: 4rem; }
#night-widget.nw-big .nw-spark { height: 64px; }

/* Lock — disables resize and drag visually */
#night-widget.nw-locked { resize: none; cursor: default; }
#night-widget.nw-locked::after { display: none; }

/* === Mobile responsive baseline === */
@media (max-width: 640px) {
    .twh-shell-body { padding: 14px 12px 80px; }
    #activityTicker { margin-left: 8px; margin-right: 8px; }
    #shiftSummaryContent { grid-template-columns: repeat(2, 1fr) !important; }
    #pendingSubTabs { padding: 4px; }
    #pendingSubTabs .pending-pill { padding: 6px 8px; font-size: 11px; }
    #deployPill { display: none; }
    .pending-card { font-size: 12px; }
    .pending-card h3 { font-size: 14px !important; }
    #bulkBar { left: 8px !important; right: 8px !important; transform: none !important; }
    /* Modals fit narrow screens */
    #hotkeyPalette > div, #declineModal > div { margin-left: 8px; margin-right: 8px; }
}
@media (max-width: 480px) {
    .twh-shell-top { padding: 8px 12px !important; }
    .twh-shell-title { font-size: 14px !important; }
    .twh-bar-out { padding: 4px 8px !important; font-size: 11px !important; }
}

/* === Manager portal enhancements === */
@keyframes tickerScroll {
    from { transform: translateX(100%); }
    to   { transform: translateX(-100%); }
}
#activityTicker .tick-charged { color: #6ee7b7; }
#activityTicker .tick-declined { color: #fca5a5; }
#activityTicker .tick-edited { color: #fbbf24; }
#activityTicker .tick-sep { color: #475569; margin: 0 14px; }

/* Heatmap */
.heatmap { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 12px; gap: 3px; }
.heatmap-cell { width: 12px; height: 12px; border-radius: 3px; background: rgba(139,26,43,0.10); cursor: pointer; transition: outline 0.1s; }
.heatmap-cell:hover { outline: 1px solid rgba(255,255,255,0.6); }
.heatmap-cell[data-level="1"] { background: rgba(139,26,43,0.30); }
.heatmap-cell[data-level="2"] { background: rgba(139,26,43,0.55); }
.heatmap-cell[data-level="3"] { background: rgba(139,26,43,0.85); }
.heatmap-cell[data-level="4"] { background: rgba(167,139,250,1); }

/* Pinned pending card glow */
.pending-card.is-pinned { border-color: rgba(251,191,36,0.7) !important; box-shadow: 0 0 0 1px rgba(251,191,36,0.4), 0 8px 24px rgba(251,191,36,0.15); }

/* Bulk-selected card */
.pending-card.is-bulk { outline: 2px solid rgba(16,185,129,0.7); outline-offset: -2px; }

/* Hotkey result row */
.hk-row { padding: 8px 12px; border-bottom: 1px solid rgba(51,65,85,0.4); cursor: pointer; display: flex; gap: 8px; align-items: center; }
.hk-row.hk-active { background: rgba(139,26,43,0.18); }
.hk-row:hover { background: rgba(139,26,43,0.12); }

/* Per-dept gradient */
#night-widget.nw-dept-billing          { background: linear-gradient(135deg,#7a1a24,#8b1a2b); border-color: rgba(139,26,43,0.45); }
#night-widget.nw-dept-energy           { background: linear-gradient(135deg,#0891b2,#06b6d4); border-color: rgba(34,211,238,0.45); }
#night-widget.nw-dept-design           { background: linear-gradient(135deg,#7c3aed,#a3223a); border-color: rgba(167,139,250,0.45); }
#night-widget.nw-dept-ebook            { background: linear-gradient(135deg,#d97706,#fbbf24); border-color: rgba(251,191,36,0.45); }
#night-widget.nw-dept-outsource_center { background: linear-gradient(135deg,#b45309,#f59e0b); border-color: rgba(251,191,36,0.45); }
#night-widget.nw-dept-outsource2       { background: linear-gradient(135deg,#a16207,#d97706); border-color: rgba(250,204,21,0.45); }
#night-widget.nw-dept-outsource3       { background: linear-gradient(135deg,#854d0e,#facc15); border-color: rgba(253,224,71,0.45); }
#night-widget.nw-collapsed #nw-expanded { display: none !important; }
#night-widget.nw-collapsed .nw-value    { margin-bottom: 0 !important; }
#night-widget .nw-label  { color: rgba(255,255,255,0.65); font-size:10px; }
#night-widget .nw-value  { color: white; }
#night-widget .nw-select { color: white; background: rgba(255,255,255,0.15) !important; }
#night-widget .nw-breakdown { color: rgba(255,255,255,0.85); border-color: rgba(255,255,255,0.15); }

:root[data-theme="dark"] #night-widget {
    background: linear-gradient(135deg,#141445,#1e1e5a);
    border-color: rgba(139,26,43,0.4); color: #f2e6e8;
}
:root[data-theme="dark"] #night-widget .nw-label  { color: rgba(200,200,255,0.55); }
:root[data-theme="dark"] #night-widget .nw-value  { color: #c53a52; }
:root[data-theme="dark"] #night-widget .nw-select { color: #f2e6e8; }
:root[data-theme="dark"] #night-widget .nw-breakdown { color: #b09099; border-color: rgba(139,26,43,0.2); }

:root[data-theme="light"] #night-widget {
    background: linear-gradient(135deg,#8b1a2b,#8b1a2b);
    border-color: rgba(139,26,43,0.3); color: white;
}
:root[data-theme="light"] #night-widget .nw-label  { color: rgba(255,255,255,0.7); }
:root[data-theme="light"] #night-widget .nw-value  { color: white; }
:root[data-theme="light"] #night-widget .nw-select { color: white; background: rgba(255,255,255,0.15) !important; }
:root[data-theme="light"] #night-widget .nw-breakdown { color: rgba(255,255,255,0.85); border-color: rgba(255,255,255,0.2); }

/* =========================================
   PARALLAX ORBS
   ========================================= */
.px-orb {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    will-change: transform;
}
.px-orb-1 {
    width: 700px; height: 700px;
    top: -250px; left: -180px;
    background: radial-gradient(circle at center, rgba(139,26,43,0.22) 0%, transparent 68%);
    filter: blur(55px);
}
.px-orb-2 {
    width: 550px; height: 550px;
    bottom: -180px; right: -120px;
    background: radial-gradient(circle at center, rgba(139,26,43,0.18) 0%, transparent 65%);
    filter: blur(50px);
}
.px-orb-3 {
    width: 350px; height: 350px;
    top: 40vh; left: 60vw;
    background: radial-gradient(circle at center, rgba(167,139,250,0.14) 0%, transparent 60%);
    filter: blur(45px);
}

/* =========================================
   SCROLL REVEAL — 3D rise + left/right fly-in
   ========================================= */
.sr { opacity: 0; }
.sr.sr-in { animation: sr-rise 0.7s cubic-bezier(0.22,1,0.36,1) both; }
@keyframes sr-rise {
    from { opacity: 0; transform: perspective(700px) rotateX(7deg) translateY(30px); }
    to   { opacity: 1; transform: perspective(700px) rotateX(0deg) translateY(0); }
}

.sr-left { opacity: 0; }
.sr-left.sr-in { animation: sr-fly-left 0.65s cubic-bezier(0.22,1,0.36,1) both; }
@keyframes sr-fly-left {
    from { opacity: 0; transform: translateX(-36px); }
    to   { opacity: 1; transform: translateX(0); }
}

.sr-right { opacity: 0; }
.sr-right.sr-in { animation: sr-fly-right 0.65s cubic-bezier(0.22,1,0.36,1) both; }
@keyframes sr-fly-right {
    from { opacity: 0; transform: translateX(36px); }
    to   { opacity: 1; transform: translateX(0); }
}

.sr-d1 { animation-delay: 0.06s !important; }
.sr-d2 { animation-delay: 0.13s !important; }
.sr-d3 { animation-delay: 0.20s !important; }
.sr-d4 { animation-delay: 0.27s !important; }
.sr-d5 { animation-delay: 0.34s !important; }

/* =========================================
   SCROLL PROGRESS BAR
   ========================================= */
#scroll-progress {
    position: fixed; top: 0; left: 0; z-index: 99999;
    height: 3px; width: 0%;
    background: linear-gradient(90deg, #7a1a24, #8b1a2b, #a3223a);
    box-shadow: 0 0 8px rgba(139,26,43,0.6);
    transition: width 0.12s linear;
    pointer-events: none;
}

@media (max-width: 768px) {
    #night-widget {
        min-width: 100px !important; padding: 7px 10px !important;
        top: 62px !important; right: 5px !important;
    }
    #night-widget .nw-value { font-size: 1.1rem !important; }
    #night-widget .nw-label { font-size: 9px !important; }
    #nw-expanded { display: none; }
    #night-widget:not(.nw-collapsed) #nw-expanded { display: block !important; }
}

/* =========================================
   BROADCAST BANNER
   ========================================= */
#broadcast-banner {
    display: none;
    position: fixed; top: 0; left: 0; right: 0; z-index: 99999;
    padding: 13px 20px;
    background: linear-gradient(135deg,#8b1a2b,#8b1a2b);
    color: white; font-weight: 700; font-size: 14px;
    box-shadow: 0 4px 24px rgba(139,26,43,0.5);
    animation: toastSlideIn 0.3s ease-out;
}
#broadcast-banner.bcast-show { display: flex; align-items: center; justify-content: center; gap: 10px; }
#broadcast-banner .bcast-close { cursor: pointer; opacity: 0.7; padding: 0 8px; font-size: 16px; }
#broadcast-banner .bcast-close:hover { opacity: 1; }

/* =========================================
   SETTINGS PANEL (theme + sound)
   ========================================= */
#settings-btn {
    position: fixed; bottom: 20px; right: 20px; z-index: 9998;
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(139,26,43,0.15); border: 1px solid rgba(139,26,43,0.3);
    cursor: pointer; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; backdrop-filter: blur(8px); color: var(--text);
}
#settings-btn:hover { background: rgba(139,26,43,0.3); transform: scale(1.08) rotate(30deg); }
#settings-panel {
    display: none; position: fixed;
    bottom: 74px; right: 12px; z-index: 9999;
    background: linear-gradient(145deg,#170a10,#141445);
    border: 1px solid rgba(139,26,43,0.3);
    border-radius: 16px; padding: 16px 18px; min-width: 230px;
    box-shadow: 0 16px 56px rgba(0,0,0,0.7); backdrop-filter: blur(16px);
    animation: toastSlideIn 0.2s ease-out;
}
#settings-panel.sp-show { display: block; }
:root[data-theme="light"] #settings-panel { background: linear-gradient(145deg,#fff,#eef0ff); border-color: rgba(139,26,43,0.25); }
.sp-label { font-size: 10px; font-weight: 800; color: #6d4d55; text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 8px; }
.sp-row   { display: flex; gap: 6px; margin-bottom: 14px; }
.sp-opt {
    flex: 1; padding: 6px 4px; border-radius: 8px; cursor: pointer;
    border: 1px solid rgba(139,26,43,0.2); background: rgba(139,26,43,0.07);
    color: var(--text-muted); font-size: 11px; font-weight: 700; text-align: center;
    transition: all 0.15s;
}
.sp-opt:hover { background: rgba(139,26,43,0.2); color: var(--text); }
.sp-opt.sp-active { background: rgba(139,26,43,0.25); color: #c53a52; border-color: rgba(139,26,43,0.5); }

/* =========================================
   SHIFT COUNTDOWN
   ========================================= */
#shift-countdown {
    font-size: 11px; font-weight: 800;
    font-family: ui-monospace, monospace;
    padding: 3px 10px; border-radius: 20px;
    background: rgba(139,26,43,0.12); border: 1px solid rgba(139,26,43,0.3);
    color: #c53a52; display: none;
    transition: all 0.3s;
}
#shift-countdown.sc-show  { display: inline-block; }
#shift-countdown.sc-urgent { background: rgba(239,68,68,0.15) !important; border-color: rgba(239,68,68,0.4) !important; color: #fca5a5 !important; }

@media (max-width: 480px) {
    .twh-nav-brand img { height: 26px; }
    .twh-nav-title     { font-size: 13px; }
    .auth-card         { padding: 22px 16px; }
    .auth-btn          { font-size: 14px; }

    /* Stack pending sub-tabs */
    #viewPending .flex.items-center.gap-6 { flex-direction: column; align-items: flex-start; gap: 12px !important; }
}

/* Particle field canvas removed — kept the selector as display:none so any
   stale cached HTML/JS that still injects #twh-particles is invisible. */
#twh-particles { display: none !important; }

/* =========================================
   3D EXTRUDED TEXT
   ========================================= */
.twh-3d-text {
    text-shadow:
        0 1px 0 rgba(139,26,43,0.65),
        0 2px 0 rgba(139,26,43,0.45),
        0 3px 0 rgba(139,26,43,0.28),
        0 4px 0 rgba(139,26,43,0.15),
        0 5px 0 rgba(139,26,43,0.08),
        0 8px 20px rgba(0,0,0,0.55);
}

/* =========================================
   SUBMIT BUTTON RIPPLE
   ========================================= */
.twh-ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: twh-ripple-out 0.65s ease-out forwards;
    background: rgba(255,255,255,0.28);
    pointer-events: none;
}
@keyframes twh-ripple-out {
    to { transform: scale(4); opacity: 0; }
}

/* =========================================
   ANALYSIS TABLE — ROW SCROLL EFFECTS
   ========================================= */
tbody tr.tbl-row-reveal {
    opacity: 0;
    transition: opacity 0.52s ease, transform 0.52s cubic-bezier(0.22,1,0.36,1),
                background 0.18s ease, box-shadow 0.18s ease;
}
tbody tr.tbl-row-reveal.from-left  { transform: translateX(-34px) perspective(600px) rotateY(-7deg); }
tbody tr.tbl-row-reveal.from-right { transform: translateX(34px)  perspective(600px) rotateY(7deg); }
tbody tr.tbl-row-reveal.visible    { opacity: 1; transform: translateX(0) perspective(600px) rotateY(0); }
tbody tr.tbl-row-reveal:hover      {
    background: rgba(139,26,43,0.09) !important;
    box-shadow: inset 4px 0 0 rgba(139,26,43,0.6);
    transform: translateX(4px) scale(1.004) !important;
}

/* Scan-line sweep across table on load */
.tbl-scan-wrap { position: relative; }
.tbl-scan-line {
    position: absolute; left: 0; right: 0; top: 0;
    height: 2px; pointer-events: none; z-index: 20;
    background: linear-gradient(90deg, transparent 0%, rgba(139,26,43,0.85) 35%,
                rgba(167,139,250,1) 50%, rgba(139,26,43,0.85) 65%, transparent 100%);
    box-shadow: 0 0 14px 2px rgba(139,26,43,0.5);
    animation: tbl-scan 1.9s cubic-bezier(0.4,0,0.6,1) forwards;
}
@keyframes tbl-scan {
    0%   { top: 0%;   opacity: 1; }
    88%  { top: 100%; opacity: 0.9; }
    100% { top: 100%; opacity: 0; }
}

/* Analysis stat cards — 3D hover lift */
.analysis-stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    cursor: default;
}
.analysis-stat-card:hover {
    transform: perspective(700px) rotateX(-5deg) translateY(-5px) scale(1.035) !important;
    box-shadow: 0 18px 44px rgba(139,26,43,0.28), 0 0 0 1px rgba(139,26,43,0.35) !important;
}

/* =========================================
   CARD TILT — extended to index + manager cards
   ========================================= */
.twh-tilt {
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.twh-tilt:hover { outline: none; }

/* =========================================
   TWH MODAL — custom alert/confirm popup
   ========================================= */
.twh-modal-backdrop {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(12,4,7, 0.78);
    backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.18s ease;
    padding: 16px;
}
.twh-modal-backdrop.show { opacity: 1; pointer-events: auto; }
.twh-modal-card {
    background: linear-gradient(145deg, #170a10, #141445);
    border: 1px solid rgba(139,26,43,0.35);
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(139,26,43,0.15);
    width: 100%; max-width: 420px;
    transform: translateY(14px) scale(0.96);
    transition: transform 0.22s cubic-bezier(0.22,1,0.36,1);
    overflow: hidden;
    color: #e5e7ff;
}
.twh-modal-backdrop.show .twh-modal-card { transform: translateY(0) scale(1); }
.twh-modal-head {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 22px 14px;
    border-bottom: 1px solid rgba(139,26,43,0.18);
}
.twh-modal-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 800;
    flex-shrink: 0;
}
.twh-modal-icon.info    { background: rgba(139,26,43,0.18);  color: #c53a52; }
.twh-modal-icon.success { background: rgba(34,197,94,0.18);   color: #4ade80; }
.twh-modal-icon.warning { background: rgba(251,191,36,0.18);  color: #fbbf24; }
.twh-modal-icon.error   { background: rgba(239,68,68,0.18);   color: #f87171; }
.twh-modal-icon.confirm { background: rgba(168,85,247,0.18);  color: #c084fc; }
.twh-modal-title {
    font-size: 15px; font-weight: 700;
    color: #f2e6e8;
}
.twh-modal-body {
    padding: 16px 22px 20px;
    font-size: 14px; line-height: 1.55;
    color: #cdd0e8;
    white-space: pre-wrap;
    max-height: 50vh; overflow-y: auto;
}
.twh-modal-foot {
    display: flex; gap: 10px; justify-content: flex-end;
    padding: 12px 20px 18px;
    background: rgba(12,4,7,0.4);
    border-top: 1px solid rgba(139,26,43,0.12);
}
.twh-modal-btn {
    padding: 9px 18px; font-size: 13px; font-weight: 700;
    border-radius: 9px; border: none; cursor: pointer;
    transition: filter 0.15s ease, transform 0.1s ease;
    min-width: 82px;
}
.twh-modal-btn:hover { filter: brightness(1.12); }
.twh-modal-btn:active { transform: scale(0.97); }
.twh-modal-btn.primary {
    background: linear-gradient(135deg, #8b1a2b, #8b1a2b);
    color: #fff;
}
.twh-modal-btn.danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
}
.twh-modal-btn.ghost {
    background: rgba(255,255,255,0.06);
    color: #cbd5e1;
    border: 1px solid rgba(255,255,255,0.1);
}

/* =========================================
   TWH-BAR — Agent portal single-row navbar
   ========================================= */
.twh-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 18px;
    background: rgba(12,4,7, 0.92);
    border-bottom: 1px solid rgba(139,26,43, 0.18);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 2px 30px rgba(139,26,43, 0.08);
}
.twh-bar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--portal-accent), var(--portal-accent-2), #06b6d4, var(--portal-accent-2), var(--portal-accent));
    background-size: 300% 100%;
    animation: nav-gradient-slide 5s linear infinite;
    z-index: 1;
}
.twh-bar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 14px;
    color: #fff;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}
.twh-bar-logo {
    width: 26px; height: 26px;
    border-radius: 7px;
    background: linear-gradient(135deg, var(--portal-accent), var(--portal-accent-2));
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.twh-bar-logo img { width: 22px; height: 22px; object-fit: contain; }
.twh-bar-divider { width: 1px; height: 16px; background: rgba(139,26,43, 0.3); }
.twh-bar-portal { font-size: 13px; color: var(--portal-accent); font-weight: 700; }
.twh-bar-tabs {
    display: flex;
    gap: 4px;
    flex: 1;
    margin-left: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}
.twh-bar-tabs::-webkit-scrollbar { display: none; }
.twh-bar-tab {
    padding: 7px 13px;
    border-radius: 8px;
    font-size: 12px;
    color: #b09099;
    font-weight: 600;
    border: 1px solid transparent;
    background: transparent;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.twh-bar-tab:hover { color: #cbd5e1; background: rgba(139,26,43, 0.06); }
.twh-bar-tab.active,
.twh-bar-tab.agent-tab-active {
    color: #fff;
    background: linear-gradient(135deg, var(--portal-accent), var(--portal-accent-2));
    border-color: transparent;
    box-shadow: 0 6px 18px rgba(139,26,43, 0.32);
}
.twh-bar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.twh-bar-badge {
    font-size: 11px;
    padding: 5px 11px;
    border-radius: 14px;
    background: rgba(139,26,43, 0.14);
    border: 1px solid rgba(139,26,43, 0.35);
    color: var(--portal-accent);
    font-weight: 700;
    display: flex; align-items: center; gap: 6px;
}
.twh-bar-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--portal-accent);
    box-shadow: 0 0 8px var(--portal-accent);
}
.twh-bar-out {
    font-size: 11px;
    color: #b09099;
    padding: 5px 12px;
    border-radius: 7px;
    border: 1px solid #1f1f3a;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
}
.twh-bar-out:hover { color: #fff; border-color: #3f3f5a; }

@media (max-width: 640px) {
    .twh-bar { padding: 9px 12px; gap: 8px; }
    .twh-bar-portal { font-size: 12px; }
    .twh-bar-tab { padding: 6px 10px; font-size: 11px; }
    .twh-bar-badge { padding: 4px 8px; font-size: 10px; }
}

/* =========================================
   TWH-SIDEBAR — Manager portal left rail
   ========================================= */
.twh-shell { display: flex; min-height: 100vh; }
.twh-sidebar {
    width: 208px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #08082b 0%, #0a0a26 100%);
    border-right: 1px solid rgba(139,26,43, 0.18);
    padding: 18px 12px 88px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: width 0.2s ease;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 50;
}
.twh-sidebar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--portal-accent), var(--portal-accent-2), #06b6d4, var(--portal-accent-2), var(--portal-accent));
    background-size: 300% 100%;
    animation: nav-gradient-slide 5s linear infinite;
}
.twh-sidebar.collapsed { width: 64px; }
.twh-sidebar.collapsed .twh-side-label,
.twh-sidebar.collapsed .twh-side-cat,
.twh-sidebar.collapsed .twh-side-brand-text { display: none; }
.twh-sidebar.collapsed .twh-side-item { justify-content: center; padding: 10px 0; }
.twh-sidebar.collapsed .twh-side-brand { justify-content: center; padding: 0 0 14px; }

.twh-side-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 4px 8px 16px;
    border-bottom: 1px solid rgba(154, 28, 43, 0.18);
    margin-bottom: 10px;
}
.twh-side-brand-logo {
    width: 36px; height: 36px;
    background: transparent;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.twh-side-brand-logo img { width: 36px; height: 36px; object-fit: contain; }
.twh-side-brand-text { font-weight: 800; font-size: 13px; color: #fff; line-height: 1.2; }
.twh-side-brand-text .twh-side-brand-sub { font-size: 10px; color: #c9a9a9; font-weight: 500; display: block; }
.twh-side-cat {
    font-size: 9px;
    letter-spacing: 1.8px;
    color: #6d4d55;
    text-transform: uppercase;
    padding: 12px 10px 4px;
    font-weight: 700;
}
.twh-side-cat.money { color: #d97706; }
.twh-side-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: #b09099;
    font-size: 12.5px;
    font-weight: 600;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    width: 100%;
}
.twh-side-item:hover { background: rgba(139,26,43, 0.07); color: #cbd5e1; }
.twh-side-item.active {
    background: linear-gradient(135deg, rgba(139,26,43, 0.22), rgba(139,26,43, 0.16));
    color: #fff;
    box-shadow: inset 3px 0 0 #c53a52;
}
.twh-side-ico { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.twh-side-item.active .twh-side-ico { opacity: 1; }

.twh-side-toggle {
    padding: 9px 10px;
    margin-top: 4px;
    border-radius: 7px;
    background: rgba(139,26,43, 0.08);
    border: 1px solid rgba(139,26,43, 0.18);
    color: #c53a52;
    font-size: 11px;
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    justify-content: center;
    transition: all 0.15s;
    width: 100%;
    flex-shrink: 0;
}
.twh-side-toggle:hover { background: rgba(139,26,43, 0.16); }
.twh-sidebar.collapsed .twh-side-toggle { padding: 9px 0; }

.twh-shell-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.twh-shell-top {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 22px;
    background: rgba(12,4,7, 0.92);
    border-bottom: 1px solid rgba(139,26,43, 0.12);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}
.twh-shell-title { font-size: 14px; color: #cbd5e1; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.twh-shell-crumb { color: #6d4d55; font-weight: 500; }
.twh-shell-actions { display: flex; align-items: center; gap: 10px; }
.twh-shell-body { flex: 1; padding: 22px 22px 96px; }
.twh-shell-drawer-btn { display: none; }

@media (max-width: 768px) {
    .twh-shell-drawer-btn {
        display: inline-flex; align-items: center; justify-content: center;
        width: 34px; height: 34px;
        border-radius: 7px; border: 1px solid rgba(139,26,43, 0.25);
        background: transparent; color: #c53a52; cursor: pointer;
        margin-right: 10px;
    }
    .twh-sidebar {
        position: fixed; top: 0; left: 0; bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .twh-sidebar.open { transform: translateX(0); }
    .twh-sidebar.collapsed { width: 208px; }
    .twh-sidebar-backdrop {
        position: fixed; inset: 0;
        background: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(2px);
        z-index: 49;
        display: none;
    }
    .twh-sidebar-backdrop.show { display: block; }
}

/* =========================================
   Pending sub-tab pills
   ========================================= */
.pending-pill {
    color: #94a3b8;
    background: transparent;
    border: 1px solid transparent;
    letter-spacing: 0.01em;
}
.pending-pill:hover {
    color: #f8fafc;
    background: rgba(51, 65, 85, 0.45);
}
.pending-pill.is-active {
    color: #fff;
    background: linear-gradient(135deg, rgba(139,26,43,0.18), rgba(139,26,43,0.18));
    border-color: rgba(148, 163, 184, 0.25);
    box-shadow: 0 4px 14px -6px rgba(139,26,43, 0.5), inset 0 1px 0 rgba(255,255,255,0.08);
}
.pending-pill.is-active[data-accent="blue"]   { background: linear-gradient(135deg, rgba(59,130,246,0.22), rgba(37,99,235,0.18)); border-color: rgba(96,165,250,0.4); box-shadow: 0 4px 14px -6px rgba(59,130,246,0.55); }
.pending-pill.is-active[data-accent="cyan"]   { background: linear-gradient(135deg, rgba(34,211,238,0.22), rgba(139,26,43,0.18)); border-color: rgba(103,232,249,0.4); box-shadow: 0 4px 14px -6px rgba(34,211,238,0.55); }
.pending-pill.is-active[data-accent="purple"] { background: linear-gradient(135deg, rgba(167,139,250,0.22), rgba(139,26,43,0.18)); border-color: rgba(196,181,253,0.4); box-shadow: 0 4px 14px -6px rgba(167,139,250,0.55); }
.pending-pill.is-active[data-accent="amber"]  { background: linear-gradient(135deg, rgba(251,191,36,0.22), rgba(245,158,11,0.18)); border-color: rgba(252,211,77,0.4); box-shadow: 0 4px 14px -6px rgba(251,191,36,0.55); }
.pending-pill.is-active[data-accent="white"]  { background: linear-gradient(135deg, rgba(255,255,255,0.16), rgba(255,255,255,0.08)); border-color: rgba(255,255,255,0.35); box-shadow: 0 4px 14px -6px rgba(255,255,255,0.4); }
.pending-pill.is-active .pending-pill-badge,
.pending-pill.is-active > span:last-child {
    background: rgba(15, 23, 42, 0.6);
    color: #fff;
}
.pending-pill > span:last-child.has-count {
    background: rgba(239, 68, 68, 0.85);
    color: #fff;
}
