/* ==========================================================================
   PhishBoard — Premium Glassmorphism UI/UX System (v2.0)
   ========================================================================== */

:root {
    color-scheme: dark;
    /* Base Colors - Deep & Immersive */
    --bg-main: #060913; /* Very dark blue/black */
    --bg-sidebar: rgba(10, 15, 30, 0.6); 
    --bg-card: rgba(15, 23, 42, 0.4);
    --bg-surface: rgba(15, 23, 42, 0.6);
    --bg-surface-hover: rgba(30, 41, 59, 0.8);
    
    /* Neon Accents */
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.4);
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.3);
    
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.3);
    --info: #3b82f6;

    /* Borders */
    --border-light: rgba(255, 255, 255, 0.05);
    --border-medium: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(99, 102, 241, 0.5);

    /* Text */
    --text-main: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    /* Shadows */
    --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px var(--primary-glow);

    /* Typography */
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Transitions */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    color-scheme: dark;
    background-color: var(--bg-main);
    color: var(--text-main);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Global interaction-animation policy - hover-triggered transitions (color/shadow/
   transform morphs) across dozens of buttons, badges and rows caused a visible
   "flashing"/lag feeling whenever the cursor merely passed over the UI, and the modal
   open/close scale+fade added to that same feeling. Kill every transition by default,
   then explicitly re-enable it only for the few things worth animating: real links,
   domain cards, and provider cards (further below, after this rule so they win the
   cascade). Does NOT touch @keyframes animations (spinner, status-pulse dots) - those
   run independently of the cursor and aren't part of this complaint. */
*, *::before, *::after {
    transition: none !important;
}
/* The only exception left: real <a> links. Everything else - including the
   domain-card/provider-card border-color hover that used to be here - turned out to
   still read as unwanted "highlighting" in practice, so it's gone too. Hover now
   changes NOTHING anywhere in this app except native link color, full stop. */
a {
    transition: color 0.2s ease !important;
}
/* Snappy, non-transitioned press feedback for anything genuinely clickable that
   doesn't already have its own :active rule further down (.btn and .card-action-btn
   do) - a state that only appears exactly at the moment of the click itself, not
   while merely passing the cursor over it beforehand. */
.nav-item:active, .filter-pill:active, .webmail-nav-item:active, .sidebar-toggle-btn:active {
    transform: scale(0.96);
}

/* Global Image Safety & Lightbox Constraints */
img {
    max-width: 100%;
    height: auto;
}

/* Размер задаётся не в vw/vh, а «сколько осталось» внутри .lightbox-overlay: у того есть
   отступы под верхнюю панель, поэтому картинка гарантированно не уезжает под неё и не
   вылезает за экран на любом соотношении сторон. */
.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9);
}

::selection {
    background-color: #6366f1;
    color: #ffffff;
}

/* Force dark theme for native OS select options */
select option {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    padding: 8px 12px;
}
/* Only the actually-selected option gets a highlight - not hover/focus, which was
   painting every option purple as the mouse merely passed down the list. */
select option:checked {
    background-color: #4f46e5 !important;
    color: #ffffff !important;
}

/* Force dark theme for browser autofill */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-text-fill-color: #f8fafc !important;
    -webkit-box-shadow: 0 0 0px 1000px #0f172a inset !important;
    box-shadow: 0 0 0px 1000px #0f172a inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    background-image: 
        radial-gradient(ellipse at 15% 50%, rgba(99,102,241,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 30%, rgba(236,72,153,0.05) 0%, transparent 50%);
    background-attachment: fixed;
}

body.app-ready { overflow: hidden; }

/* Custom Scrollbars - Sleek and modern */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }

/* Tinted scrollbar variant used inside premium panels (was previously injected
   ad-hoc per-modal; centralized here so it applies consistently everywhere) */
.custom-scroller::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scroller::-webkit-scrollbar-track { background: transparent; }
.custom-scroller::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.3); border-radius: 10px; }

/* ==========================================================================
   Login Page (Glassmorphism + Neon)
   ========================================================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100vw;
    overflow: auto;
}

.login-card {
    background: rgba(10, 15, 30, 0.6);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg), 0 0 50px rgba(99, 102, 241, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: loginIn 0.6s var(--ease-spring);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.8;
}

@keyframes loginIn {
    0% { opacity: 0; transform: translateY(30px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card h2 {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ==========================================================================
   Main Layout & Sidebar
   ========================================================================== */
.app-layout { 
    display: flex; 
    height: 100vh; 
    width: 100vw; 
    overflow: hidden; 
}

.sidebar {
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    z-index: 20;
    transition: width 0.4s var(--ease-spring), min-width 0.4s var(--ease-spring), padding 0.4s ease;
    position: relative;
}

/* Test mode active - same red gradient/glow language as a high-priority domain card,
   applied to the whole sidebar as an impossible-to-miss warning that real complaint
   emails are currently being redirected to a test address instead of real providers. */
.sidebar.test-mode-active {
    border-right: 3px solid #f43f5e;
    background: linear-gradient(180deg, rgba(244, 63, 94, 0.16) 0%, rgba(244, 63, 94, 0.04) 40%, var(--bg-sidebar) 100%);
    box-shadow: 6px 0 24px rgba(244, 63, 94, 0.15);
}

.sidebar.collapsed { 
    width: 76px; 
    min-width: 76px; 
    max-width: 76px; 
    padding: 1rem 0.5rem; 
}

.sidebar.collapsed .sidebar-header div,
.sidebar.collapsed .sidebar-nav span,
.sidebar.collapsed .sidebar-footer div,
.sidebar.collapsed .sidebar-title-text,
.sidebar.collapsed #workspace-select,
.sidebar.collapsed #sidebar-boards-list span.truncate,
.sidebar.collapsed #sidebar-boards-list span.column-count,
.sidebar.collapsed #sidebar-boards-list .board-row-actions,
.sidebar.collapsed #msk-clock { display: none !important; }

.sidebar.collapsed .sidebar-header { justify-content: center; margin-bottom: 1.5rem; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0.75rem 0; margin-bottom: 0.25rem; }
.sidebar.collapsed .sidebar-footer { justify-content: center; }

.sidebar-toggle-btn { 
    position: absolute; 
    top: 24px; 
    right: -14px; 
    width: 28px; 
    height: 28px; 
    background: var(--bg-surface-hover); 
    color: white; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border: 1px solid var(--border-medium); 
    cursor: pointer; 
    z-index: 30; 
    transition: all 0.3s var(--ease-spring); 
    box-shadow: var(--shadow-sm);
}
.sidebar.collapsed .sidebar-toggle-btn {
    transform: scale(1) rotate(180deg);
}

.sidebar-header { display: flex; align-items: center; gap: 0.75rem; padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border-light); }
.logo-icon { 
    width: 40px; 
    height: 40px; 
    background: linear-gradient(135deg, #6366f1, #d946ef); 
    border-radius: var(--radius-sm); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: 800; 
    font-size: 1.25rem; 
    color: white; 
    box-shadow: var(--shadow-glow); 
    flex-shrink: 0; 
}
.sidebar-nav { display: flex; flex-direction: column; gap: 0.35rem; }
.nav-item { 
    display: flex; 
    align-items: center; 
    gap: 0.75rem; 
    padding: 0.65rem 0.85rem; 
    color: var(--text-secondary); 
    text-decoration: none; 
    font-size: 0.9rem; 
    font-weight: 500; 
    border-radius: var(--radius-sm); 
    transition: all 0.25s ease; 
    cursor: pointer; 
    border-left: 2px solid transparent;
}
.nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, transparent 100%);
    color: #a5b4fc; 
    font-weight: 600; 
    border-left: 2px solid var(--primary); 
}
.sidebar-footer { padding-top: 1rem; border-top: 1px solid var(--border-light); margin-top: auto; }

/* ==========================================================================
   Toolbar & Main Area
   ========================================================================== */
.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.toolbar { 
    height: 70px; 
    min-height: 70px; 
    background: transparent; 
    border-bottom: 1px solid var(--border-light); 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 0 1.5rem; 
    z-index: 10; 
    flex-shrink: 0; 
}
.toolbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.search-bar { position: relative; display: flex; align-items: center; }
.search-bar svg { position: absolute; left: 1rem; color: var(--text-muted); pointer-events: none; }
.search-bar input { 
    padding-left: 2.5rem; 
    width: 250px; 
    height: 40px; 
    background: rgba(255,255,255,0.03); 
    border: 1px solid var(--border-light); 
    border-radius: 20px; 
    color: var(--text-main); 
    font-size: 0.85rem; 
    transition: all 0.3s var(--ease-smooth);
}
.search-bar input:focus { 
    outline: none; 
    border-color: var(--primary); 
    width: 320px; 
    background: rgba(255,255,255,0.06);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* ==========================================================================
   Kanban Board
   ========================================================================== */
.board-wrapper { flex: 1; height: 100%; width: 100%; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.board-header-bar { padding: 1rem 1.5rem; flex-shrink: 0; }
.board-canvas { position: relative; flex: 1; height: 100%; width: 100%; overflow: hidden; }
.board-scroll-container { 
    position: absolute; top: 0; right: 0; bottom: 0; left: 0; 
    overflow-x: auto; overflow-y: hidden; 
    padding: 0 1.5rem 1.5rem 1.5rem; 
}
.board { 
    display: flex; align-items: flex-start; gap: 1.25rem; 
    height: 100%; box-sizing: border-box; width: max-content; min-width: 100%; 
}

/* Board Columns (Stages) */
.board-column { 
    width: 320px; 
    height: 100%; 
    background: rgba(15, 20, 35, 0.5); 
    backdrop-filter: blur(12px); 
    border: 1px solid var(--border-medium); 
    border-radius: var(--radius-lg); 
    display: flex; flex-direction: column; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.3); 
    flex-shrink: 0; 
    transition: width 0.3s var(--ease-spring), opacity 0.3s ease; 
    overflow: hidden; 
}
.board-column.collapsed { width: 56px; overflow: hidden; opacity: 0.8; }
.board-column.collapsed .column-header { flex-direction: column; padding: 1rem 0.5rem; align-items: center; text-align: center; }
.board-column.collapsed .column-title { writing-mode: vertical-rl; transform: rotate(180deg); margin-top: 1rem; font-size: 0.8rem; letter-spacing: 0.1em; }
.board-column.collapsed .column-body { display: none; }

.column-header {
    padding: 1rem 1.25rem;
    display: flex; flex-direction: column; gap: 0.55rem;
    border-bottom: 1px solid var(--border-light);
    background: rgba(255,255,255,0.02);
    cursor: pointer;
}
.column-header-top { display: flex; align-items: center; justify-content: space-between; }
.column-title { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.95rem; }
.column-search-wrap { position: relative; display: flex; align-items: center; cursor: text; }
.column-search-wrap svg { position: absolute; left: 0.6rem; color: var(--text-muted); pointer-events: none; opacity: 0.6; }
.column-search-input {
    width: 100%;
    height: 28px;
    padding: 0 0.6rem 0 1.75rem;
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.75rem;
}
.column-search-input:focus {
    outline: none;
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.14);
    color: var(--text-main);
}
.column-search-input::placeholder { color: var(--text-muted); opacity: 0.7; }
.column-count { 
    background: rgba(255, 255, 255, 0.06); 
    color: var(--text-secondary); 
    padding: 0.15rem 0.5rem; 
    border-radius: 12px; 
    font-size: 0.75rem; 
    font-weight: 700; 
}
.column-body { flex: 1; overflow-y: auto; padding: 0.85rem; display: flex; flex-direction: column; gap: 0.85rem; }
.column-body.drag-over { 
    background: rgba(99, 102, 241, 0.05); 
    border: 2px dashed var(--primary); 
    border-radius: var(--radius-md); 
}

/* Kanban Cards (Domains) */
.domain-card { 
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%) !important; 
    backdrop-filter: blur(8px);
    border: 1px solid rgba(51, 65, 85, 0.6) !important; 
    border-top: 1px solid rgba(148, 163, 184, 0.25) !important; 
    border-radius: var(--radius-md); 
    padding: 1rem; 
    cursor: default; 
    position: relative;
    user-select: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}
.domain-card:active {
    /* Click-moment only, gone the instant the mouse is released - no :hover here
       anymore, that was still reading as unwanted highlighting. */
    border-color: rgba(99, 102, 241, 0.45) !important;
    border-top-color: rgba(129, 140, 248, 0.6) !important;
}
.domain-card.dragging {
    transform: translateY(-4px) scale(1.02) !important;
    cursor: grabbing !important;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.6), 0 0 25px rgba(99, 102, 241, 0.3);
    z-index: 50;
    opacity: 0.9;
}
.domain-card.selected { border-color: var(--primary); background: rgba(99, 102, 241, 0.15); box-shadow: 0 0 0 1px var(--primary); }

/* Priority Card Gradient Accent & Glow Styles */
.domain-card.priority-high {
    border-color: rgba(244, 63, 94, 0.45) !important;
    border-top: 3px solid #f43f5e !important;
    background: linear-gradient(180deg, rgba(244, 63, 94, 0.14) 0%, rgba(244, 63, 94, 0.02) 40%, rgba(25, 30, 45, 0.85) 100%) !important;
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.domain-card.priority-medium {
    border-color: rgba(245, 158, 11, 0.45) !important;
    border-top: 3px solid #f59e0b !important;
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.14) 0%, rgba(245, 158, 11, 0.02) 40%, rgba(25, 30, 45, 0.85) 100%) !important;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

/* "Just clicked the domain link" marker - same gradient/glow treatment as priority,
   just green, and placed after the priority rules so it wins when both apply (you just
   checked a high-priority domain - which state you're tracking right now matters more
   in the moment than the priority color). Added/removed via Board.markVisited(). */
.domain-card.visited-recently {
    border-color: rgba(16, 185, 129, 0.5) !important;
    border-top: 3px solid #10b981 !important;
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.16) 0%, rgba(16, 185, 129, 0.02) 40%, rgba(25, 30, 45, 0.85) 100%) !important;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}
/* Provider completeness (Settings > Providers) - a real card, same visual language
   as .domain-card (blurred dark gradient body, soft shadow, glowing top border) with
   the same red/yellow/green top border/glow as card priority. */
.provider-card {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%) !important;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(51, 65, 85, 0.6) !important;
    border-radius: var(--radius-md);
    padding: 0.9rem;
    position: relative;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}
.provider-card-red {
    border-color: rgba(244, 63, 94, 0.45) !important;
    border-top: 3px solid #f43f5e !important;
    background: linear-gradient(180deg, rgba(244, 63, 94, 0.14) 0%, rgba(244, 63, 94, 0.02) 40%, rgba(25, 30, 45, 0.85) 100%) !important;
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}
.provider-card-yellow {
    border-color: rgba(245, 158, 11, 0.45) !important;
    border-top: 3px solid #f59e0b !important;
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.14) 0%, rgba(245, 158, 11, 0.02) 40%, rgba(25, 30, 45, 0.85) 100%) !important;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}
.provider-card-green {
    border-color: rgba(16, 185, 129, 0.5) !important;
    border-top: 3px solid #10b981 !important;
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.16) 0%, rgba(16, 185, 129, 0.02) 40%, rgba(25, 30, 45, 0.85) 100%) !important;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

/* Type filter as a pill/icon segmented control instead of a <select> dropdown. */
.filter-pill {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(51, 65, 85, 0.7);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.filter-pill.active {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.7);
    color: #c7d2fe;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

/* Explicit Cursors & Hover Feedback for Inner Card Elements */
.domain-card a {
    cursor: pointer !important;
    transition: color 0.15s ease;
}
.domain-card a:hover {
    color: #818cf8 !important;
    text-decoration: underline !important;
}

.domain-card button,
.domain-card input[type="checkbox"],
.domain-card .card-checkbox {
    cursor: pointer !important;
}

.card-providers-block > div.cursor-pointer {
    cursor: pointer !important;
}

.card-notes-block {
    cursor: text !important;
}

.domain-card [onclick*="showAssignDropdown"] {
    cursor: pointer !important;
}

.card-priority { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-top-left-radius: var(--radius-md); border-bottom-left-radius: var(--radius-md); }
.priority-low { background: var(--text-muted); }

/* Compact card mode (per-stage toggle: Settings -> Stages -> "Вид карточек") - for
   columns like "Входящие"/"На проверке" where the only action needed is opening the
   link, so many more fit on screen at once instead of the full detail card. */
.domain-card.domain-card-compact {
    padding: 0.45rem 0.6rem !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: default;
}
.domain-card.domain-card-compact .card-priority {
    position: static;
    width: 6px;
    height: 18px;
    border-radius: 3px;
    flex-shrink: 0;
}
.card-domain-link-compact {
    flex: 1;
    min-width: 0;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--text-main);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s ease;
}
.card-domain-link-compact:hover {
    color: #818cf8;
    text-decoration: underline;
}

/* Premium Action Buttons (Vector Tiles) */
.card-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(51, 65, 85, 0.8);
    color: #94a3b8;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.card-action-btn:active {
    transform: scale(0.95);
}
.priority-medium { background: var(--warning); box-shadow: 0 0 8px rgba(245,158,11,0.4); }
.priority-high { background: var(--danger); box-shadow: 0 0 12px rgba(239,68,68,0.6); }
.card-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.6rem; }

/* Badges */
.badge { 
    font-size: 0.65rem; font-weight: 600; padding: 0.2rem 0.5rem; 
    border-radius: 6px; display: inline-flex; align-items: center; gap: 0.25rem; 
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; 
    letter-spacing: 0.02em; text-transform: uppercase;
}
.badge-blue { background: rgba(59, 130, 246, 0.15); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-purple { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-orange { background: rgba(249, 115, 22, 0.15); color: #fdba74; border: 1px solid rgba(249, 115, 22, 0.3); }
.badge-green { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-emerald { background: rgba(5, 150, 105, 0.15); color: #34d399; border: 1px solid rgba(5, 150, 105, 0.3); }
.badge-gray { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }
.badge-red { background: rgba(244, 63, 94, 0.18); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.4); }

/* Floating Batch Action Bar */
.batch-bar { 
    position: fixed; bottom: 2rem; left: 55%; 
    transform: translateX(-50%) translateY(120px); 
    background: rgba(10, 15, 30, 0.95); backdrop-filter: blur(20px); 
    border: 1px solid rgba(99,102,241,0.4); 
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(99,102,241,0.2); 
    padding: 0.75rem 1.5rem; border-radius: 40px; 
    display: flex; align-items: center; gap: 1rem; z-index: 100; 
    transition: transform 0.4s var(--ease-spring); 
}
.batch-bar.visible { transform: translateX(-50%) translateY(0); }

/* Side Drawer Panel Backdrop */
.sidebar-panel-overlay { 
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); 
    z-index: 90; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; 
}
.sidebar-panel-overlay.open { opacity: 1; pointer-events: auto; }
.sidebar-panel { 
    position: fixed; top: 0; right: -560px; width: 540px; height: 100vh; 
    background: rgba(10, 15, 25, 0.95); backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-light); 
    box-shadow: -15px 0 50px rgba(0, 0, 0, 0.8); z-index: 95; 
    transition: right 0.4s var(--ease-spring); display: flex; flex-direction: column; 
}
.sidebar-panel.open { right: 0; }

/* ==========================================================================
   Modals & Overlays
   ========================================================================== */
.modal-overlay {
    position: fixed; inset: 0;
    /* No backdrop-filter - it's an ancestor of every <select> in every modal, and
       that's what was making them flicker open/closed/open on every single click. */
    background: rgba(0, 0, 0, 0.75);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; opacity: 0; pointer-events: none;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
    /* No backdrop-filter at all now (was blur(25px), then blur(10px)) - a native
       <select> inside a blurred ancestor reliably flickers open/closed/open on every
       single click on Windows Chrome, not just occasionally. The background here is
       95% opaque already, so dropping the blur barely changes how it looks. */
    background: rgba(15, 20, 35, 0.98);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px rgba(0,0,0,0.8), 0 0 40px rgba(99,102,241,0.05);
    width: 92%; max-width: 600px; max-height: 90vh;
    overflow-y: auto;
}

/* Image/PDF lightbox - its own overlay (see components.js Lightbox), not a Modal.open()
   call, specifically so it renders above whatever else is open (the domain detail
   panel included) instead of sharing the same z-index and stacking underneath it. */
.lightbox-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    /* Отступы задают доступную область: сверху больше - под панель с именем файла.
       Содержимое меряется от этой области, а не от экрана, поэтому ничего не может
       вылезти за край, какой бы формы ни была картинка. */
    padding: 4.5rem 1.5rem 1.5rem;
    z-index: 1500; opacity: 0; pointer-events: none;
}
.lightbox-overlay.open { opacity: 1; pointer-events: auto; }
.lightbox-topbar {
    position: absolute; top: 0; left: 0; right: 0;
    padding: 1rem 1.5rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 100%);
}
.lightbox-filename { color: var(--text-secondary); font-size: 0.8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-body {
    display: flex; align-items: center; justify-content: center;
    /* Занимает всю доступную область (её задают отступы .lightbox-overlay), а не растёт
       под содержимое - иначе высота 100% у PDF-просмотра схлопывается в ноль, а большая
       картинка растягивает контейнер за пределы экрана. */
    flex: 1 1 auto;
    width: 100%;
    min-height: 0; min-width: 0;   /* без этого flex-элемент отказывается сжиматься */
    overflow: hidden;
    cursor: zoom-out;
}
.lightbox-iframe {
    width: 100%; height: 100%;
    max-width: 1100px;
    border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.15); background: #fff;
}

/* ==========================================================================
   Вложения: миниатюры «как в мессенджере»
   ==========================================================================
   Везде и всегда маленькие. Нажатие на саму картинку открывает её крупно, крестик
   в правом верхнем углу удаляет. Никаких панелей поверх картинки по наведению -
   раньше кнопки просмотра и удаления вылезали слоем на всю миниатюру и попасть по
   ним было неудобно. */
.att-thumb {
    position: relative;
    width: 84px; height: 84px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-elevated, #0f172a);
    border: 1px solid var(--border-medium, #334155);
    flex-shrink: 0;
}
.att-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.att-thumb-file {
    width: 100%; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 4px; cursor: pointer;
    font-size: 9px; line-height: 1.2; text-align: center; color: var(--text-secondary);
    word-break: break-all;
}
/* Крестик всегда виден: на сенсорном экране наведения не существует, а угадывать,
   где спрятана кнопка удаления, неудобно и на мыши. */
.att-thumb-del {
    position: absolute; top: 3px; right: 3px;
    width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(2, 6, 23, 0.78);
    color: #fca5a5;
    font-size: 13px; line-height: 1; font-weight: 700;
    cursor: pointer;
    border: 1px solid rgba(148, 163, 184, 0.25);
}
.att-thumb-del:active { transform: scale(0.9); }
.att-thumb-name {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 2px 4px;
    font-size: 8px; line-height: 1.25;
    color: #e2e8f0;
    background: linear-gradient(0deg, rgba(2,6,23,0.85) 0%, transparent 100%);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    pointer-events: none;
}

/* Bare modal: content supplies its own card chrome (border/radius/shadow), so the
   default modal padding/background/border would double it up. Used for fullscreen
   workspaces and self-contained cards (lightbox, batch-send preview, etc). */
.modal.modal-bare {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    /* Bare content manages its own scrolling (e.g. the mass-send modal has its own
       inner overflow-y-auto body) - the outer .modal's own overflow-y: auto is then a
       second, redundant scroll container wrapping the first. A <select> deep inside
       nested scroll containers is a known source of popup-positioning glitches in
       Chromium (recalculates against the wrong one, briefly closes and reopens). */
    overflow: visible;
}
.modal.modal-bare > .modal-body { padding: 0; }

/* Fullscreen Domain Workspace Modal */
.modal-fullscreen-domain {
    width: 95vw !important;
    max-width: 1440px !important;
    height: 88vh !important;
    max-height: 900px !important;
    border-radius: 20px !important;
    border: 1px solid rgba(99, 102, 241, 0.25) !important;
    background: rgba(8, 12, 24, 0.96) !important;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.85), 0 0 60px rgba(99, 102, 241, 0.15) !important;
    overflow: hidden !important;
}

/* 2026 Webmail 3-Column Layout */
.webmail-workspace {
    display: flex;
    flex-direction: row;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: #060913;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.webmail-nav-sidebar {
    width: 210px;
    flex-shrink: 0;
    background: rgba(12, 17, 33, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.webmail-thread-list {
    width: 360px;
    flex-shrink: 0;
    background: rgba(10, 14, 28, 0.9);
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.webmail-reader-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(8, 11, 22, 0.95);
    overflow: hidden;
}
.webmail-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
}
.webmail-nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    font-weight: 600;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}
.modal-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.7;
}
.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.modal-body {
    padding: 1.5rem;
}

/* ==========================================================================
   Buttons, Forms & Inputs
   ========================================================================== */
.btn { 
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; 
    padding: 0.55rem 1.1rem; font-size: 0.875rem; font-weight: 600; 
    border-radius: var(--radius-md); border: none; cursor: pointer; 
    transition: all 0.2s var(--ease-spring); user-select: none; white-space: nowrap; 
}
.btn:active { transform: scale(0.95); }
.btn-primary { background: linear-gradient(135deg, var(--primary), #818cf8); color: white; box-shadow: 0 4px 15px rgba(99,102,241,0.3); }
.btn-ghost {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}
.btn-ghost:active { transform: translateY(0) scale(0.96); }
.btn-ghost.active,
.btn-ghost.text-primary {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.18) 0%, rgba(99, 102, 241, 0.05) 100%);
    border-color: rgba(99, 102, 241, 0.35);
    color: #a5b4fc;
}
.btn-danger { background: linear-gradient(135deg, #ef4444, #f87171); color: white; box-shadow: 0 4px 15px rgba(239,68,68,0.3); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.775rem; border-radius: var(--radius-sm); }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.7rem; border-radius: 6px; }
.btn-icon { padding: 0.4rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.form-label { color: var(--text-secondary); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 0.5rem; line-height: 1.4; }
.form-input, .form-select {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-medium);
    color: var(--text-main);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    padding: 0.6rem 1rem; font-size: 0.9rem;
    width: 100%;
}
.form-input:focus, .form-select:focus {
    border-color: var(--primary);
    outline: none;
    background: rgba(99,102,241,0.05);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    cursor: pointer;
    /* Many call sites pair .form-select with a later-defined utility (e.g. .p-2)
       that resets shorthand padding and would push text under the arrow icon. */
    padding-right: 2.25rem !important;
}
.form-textarea { width: 100%; min-height: 180px; resize: vertical; font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.6; padding: 1rem; background: rgba(0,0,0,0.2); border: 1px solid var(--border-medium); color: var(--text-main); border-radius: var(--radius-md); transition: all 0.3s ease; }
.form-textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; display: flex; flex-direction: column; gap: 0.6rem; z-index: 2000; }
.toast { 
    background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(10px);
    border: 1px solid var(--border-medium); 
    padding: 0.85rem 1.25rem; border-radius: var(--radius-lg); 
    box-shadow: 0 15px 35px rgba(0,0,0,0.5); font-size: 0.875rem; 
    font-weight: 500;
    display: flex; align-items: center; gap: 0.6rem; 
    animation: toastIn 0.4s var(--ease-spring) forwards; 
    opacity: 0; transform: translateX(50px) scale(0.9);
}
.toast.show { opacity: 1; transform: translateX(0) scale(1); }
@keyframes toastIn { 
    to { opacity: 1; transform: translateX(0) scale(1); } 
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-info { border-left: 3px solid var(--primary); }
.toast svg { flex-shrink: 0; }
.toast-success svg { color: var(--success); }
.toast-error svg { color: var(--danger); }
.toast-info svg { color: var(--primary); }

/* Spinner */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.1); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ==========================================================================
   UTILITY CLASSES (Tailwind-like)
   ========================================================================== */

/* Grid System */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.col-span-4 { grid-column: span 4 / span 4; }
.col-span-6 { grid-column: span 6 / span 6; }
.col-span-8 { grid-column: span 8 / span 8; }
.col-span-12 { grid-column: span 12 / span 12; }

/* Display & Flex */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.inline-block { display: inline-block; }
.block { display: block; }
.hidden { display: none !important; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0, .shrink-0 { flex-shrink: 0; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }

/* Spacing */
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.p-1 { padding: 0.25rem; }
.p-1\.5 { padding: 0.375rem; }
.p-2 { padding: 0.5rem; }
.p-2\.5 { padding: 0.625rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.pt-1 { padding-top: 0.25rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-2\.5 { padding-top: 0.625rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-4 { padding-bottom: 1rem; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }

.m-0 { margin: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-1\.5 { margin-bottom: 0.375rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-1\.5 { margin-top: 0.375rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.ml-0\.5 { margin-left: 0.125rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-auto { margin-left: auto; }
.mr-1 { margin-right: 0.25rem; }
.mr-1\.5 { margin-right: 0.375rem; }
.mr-2 { margin-right: 0.5rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Sizing */
.w-full { width: 100%; }
.w-3 { width: 0.75rem; }
.w-4 { width: 1rem; }
.w-6 { width: 1.5rem; }
.w-24 { width: 6rem; }
.w-32 { width: 8rem; }
.w-56 { width: 14rem; }
.w-64 { width: 16rem; }
.w-72 { width: 18rem; }
.h-full { height: 100%; }
.h-px { height: 1px; }
.h-3 { height: 0.75rem; }
.h-4 { height: 1rem; }
.h-6 { height: 1.5rem; }
.h-24 { height: 6rem; }
.min-w-0 { min-width: 0; }
.min-h-0 { min-height: 0; }
.max-h-40 { max-height: 10rem; }
.max-h-60 { max-height: 15rem; }
.max-h-96 { max-height: 24rem; }
.max-h-\[800px\] { max-height: 800px; }
.max-h-\[850px\] { max-height: 850px; }
.h-\[85vh\] { height: 85vh; }
.h-\[88vh\] { height: 88vh; }

/* Tailwind в проекте НЕ подключён - весь этот раздел написан руками. Поэтому класс с
   произвольным значением работает только если он здесь объявлен: пропущенный молча
   ничего не делает, и элемент остаётся без ограничения размера. Именно так окно выбора
   вложений уезжало за нижний край экрана - у него стояли max-h-[42vh] и w-[92vw],
   которых в CSS не существовало. Добавляя такой класс в разметку, добавляй его и сюда. */
.max-h-\[85vh\] { max-height: 85vh; }
.w-\[92vw\] { width: 92vw; }
.max-w-\[170px\] { max-width: 170px; }
/* Тоже отсутствовали: окна с max-w-* растягивались на всю ширину экрана, потому что
   ограничение не существовало и работал только w-[92vw]. */
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-xl { max-width: 36rem; }

.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-x-hidden { overflow-x: hidden; }
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.z-10 { z-index: 10; }

/* Typography */
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }
.font-mono { font-family: var(--font-mono); }
.font-sans { font-family: var(--font-family); }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.italic { font-style: italic; }

.text-\[10px\] { font-size: 10px; line-height: 1.2; }
.text-\[11px\] { font-size: 11px; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-pre-wrap { white-space: pre-wrap; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }

.text-white { color: #ffffff; }
.text-slate-100 { color: #f8fafc; }
.text-slate-200 { color: #e2e8f0; }
.text-slate-300 { color: #cbd5e1; }
.text-slate-400 { color: #94a3b8; }
.text-slate-500 { color: #64748b; }
.text-slate-600 { color: #475569; }
.text-indigo-200 { color: #c7d2fe; }
.text-indigo-300 { color: #a5b4fc; }
.text-indigo-400 { color: #818cf8; }
.text-indigo-500 { color: #6366f1; }
.text-green-300 { color: #6ee7b7; }
.text-green-400 { color: #34d399; }
.text-emerald-300 { color: #6ee7b7; }
.text-emerald-400 { color: #34d399; }
.text-red-400 { color: #f87171; }
.text-red-500 { color: #ef4444; }
.text-orange-300 { color: #fdba74; }
.text-orange-400 { color: #fb923c; }
.text-amber-300 { color: #fcd34d; }
.text-amber-400 { color: #fbbf24; }
.text-purple-300 { color: #d8b4fe; }
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }

/* Backgrounds & Borders */
.bg-transparent { background-color: transparent; }
.bg-slate-700 { background-color: #334155; }
.bg-slate-800 { background-color: #1e293b; }
.bg-slate-900 { background-color: #0f172a; }
.bg-slate-950 { background-color: #020617; }
.bg-\[\#0a0f18\] { background-color: #0a0f18; }
.bg-indigo-600 { background-color: #4f46e5; }
.bg-emerald-600 { background-color: #059669; }
.bg-orange-600 { background-color: #ea580c; }

/* Alpha Backgrounds */
.bg-slate-800\/30 { background-color: rgba(30,41,59,0.3); }
.bg-slate-800\/40 { background-color: rgba(30,41,59,0.4); }
.bg-slate-800\/80 { background-color: rgba(30,41,59,0.8); }
.bg-slate-900\/50 { background-color: rgba(15,23,42,0.5); }
.bg-slate-900\/70 { background-color: rgba(15,23,42,0.7); }
.bg-slate-900\/90 { background-color: rgba(15,23,42,0.9); }
.bg-slate-900\/95 { background-color: rgba(15,23,42,0.95); }
.bg-slate-950\/40 { background-color: rgba(2,6,23,0.4); }
.bg-slate-950\/50 { background-color: rgba(2,6,23,0.5); }
.bg-slate-950\/60 { background-color: rgba(2,6,23,0.6); }
.bg-slate-950\/80 { background-color: rgba(2,6,23,0.8); }

.bg-indigo-900\/20 { background-color: rgba(49, 46, 129, 0.2); }
.bg-indigo-900\/30 { background-color: rgba(49, 46, 129, 0.3); }
.bg-indigo-900\/50 { background-color: rgba(49, 46, 129, 0.5); }
.bg-indigo-950\/20 { background-color: rgba(30, 27, 75, 0.2); }
.bg-indigo-950\/50 { background-color: rgba(30, 27, 75, 0.5); }
.bg-indigo-950\/60 { background-color: rgba(30, 27, 75, 0.6); }
.bg-indigo-600\/90 { background-color: rgba(79, 70, 229, 0.9); }

.bg-orange-900\/30 { background-color: rgba(124, 45, 18, 0.3); }
.bg-orange-950\/10 { background-color: rgba(67, 20, 7, 0.1); }
.bg-orange-950\/40 { background-color: rgba(67, 20, 7, 0.4); }
.bg-orange-950\/50 { background-color: rgba(67, 20, 7, 0.5); }

.bg-emerald-900\/30 { background-color: rgba(6, 78, 59, 0.3); }
.bg-emerald-950\/40 { background-color: rgba(2, 44, 34, 0.4); }
.bg-emerald-950\/50 { background-color: rgba(2, 44, 34, 0.5); }

.bg-purple-900\/40 { background-color: rgba(88, 28, 135, 0.4); }
.bg-purple-800\/50 { background-color: rgba(107, 33, 168, 0.5); }

.border { border-style: solid; border-width: 1px; }
.border-t { border-top-style: solid; border-top-width: 1px; }
.border-b { border-bottom-style: solid; border-bottom-width: 1px; }
.border-r { border-right-style: solid; border-right-width: 1px; }

.border-slate-600 { border-color: #475569; }
.border-slate-700 { border-color: #334155; }
.border-slate-800 { border-color: #1e293b; }

.border-slate-700\/50 { border-color: rgba(51,65,85,0.5); }
.border-slate-800\/50 { border-color: rgba(30,41,59,0.5); }
.border-slate-800\/60 { border-color: rgba(30,41,59,0.6); }

.border-indigo-500 { border-color: #6366f1; }
.border-indigo-700\/50 { border-color: rgba(67, 56, 202, 0.5); }
.border-indigo-900\/50 { border-color: rgba(49, 46, 129, 0.5); }
.border-indigo-500\/30 { border-color: rgba(99, 102, 241, 0.3); }

.border-orange-700\/50 { border-color: rgba(194, 65, 12, 0.5); }
.border-orange-800\/50 { border-color: rgba(154, 52, 18, 0.5); }

.border-emerald-500 { border-color: #10b981; }
.border-emerald-700\/50 { border-color: rgba(4, 120, 87, 0.5); }
.border-emerald-800\/50 { border-color: rgba(6, 95, 70, 0.5); }

.border-purple-700\/50 { border-color: rgba(126, 34, 206, 0.5); }

.rounded { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius-md); }
.rounded-xl { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }

/* Shadows */
.shadow { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); }
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }
.shadow-inner { box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06); }

.shadow-indigo-600\/20 { box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.2); }
.shadow-\[0_0_10px_rgba\(16\,185\,129\,0\.1\)\] { box-shadow: 0 0 10px rgba(16,185,129,0.1); }
.shadow-\[0_0_15px_rgba\(194\,65\,12\,0\.1\)\] { box-shadow: 0 0 15px rgba(194,65,12,0.1); }
.shadow-\[0_0_15px_rgba\(79\,70\,229\,0\.3\)\] { box-shadow: 0 0 15px rgba(79,70,229,0.3); }

/* Focus (keyboard/click, not mouse-pass-by - left alone) */
.focus\:border-indigo-500:focus { border-color: #6366f1; }
.focus\:ring-1:focus { box-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); }
.focus\:ring-indigo-500:focus { --tw-ring-color: #6366f1; }

.disabled\:opacity-50:disabled { opacity: 0.5; }
.disabled\:cursor-not-allowed:disabled { cursor: not-allowed; }

/* Was hover-revealed (.group:hover .group-hover\:*) - always shown now instead, so
   the action buttons underneath don't disappear/reappear as the cursor passes by.
   !important because .opacity-0 (below, same specificity) is defined after this in
   the file and would otherwise win and hide these permanently. */
.group-hover\:opacity-100 { opacity: 1 !important; pointer-events: auto !important; }
.group-hover\:flex { display: flex !important; }

/* FX */
.transition-all { transition: all 0.3s var(--ease-spring); }
.transition-opacity { transition: opacity 0.3s ease; }
.transition-colors { transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease; }
.backdrop-blur { backdrop-filter: blur(12px); }
.backdrop-blur-sm { backdrop-filter: blur(4px); }
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }
.space-y-2 > * + * { margin-top: 0.5rem; }
/* Was missing entirely - every modal form using "space-y-3" (dozens across the app)
   had zero gap between field groups as a result, which is most of what made forms
   look cramped/jumbled. */
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.divide-y > * + * { border-top-width: 1px; }
.divide-slate-800 > * + * { border-color: #1e293b; }

/* Responsive basics */
@media (min-width: 640px) {
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sm\:flex-row { flex-direction: row; }
    .sm\:items-center { align-items: center; }
    .sm\:w-auto { width: auto; }
    .sm\:inline { display: inline; }
    .sm\:flex { display: flex; }
    .sm\:flex-none { flex: none; }
    .sm\:text-2xl { font-size: 1.5rem; }
    .sm\:text-sm { font-size: 0.875rem; }
    .sm\:text-left { text-align: left; }
    .sm\:p-6 { padding: 1.5rem; }
}
@media (min-width: 1024px) {
    .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
    .xl\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; font-size: 0.85rem; }
thead tr:first-child th:first-child { border-top-left-radius: var(--radius-md); }
thead tr:first-child th:last-child { border-top-right-radius: var(--radius-md); }
th {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(8px);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-medium);
}
td { padding: 0.85rem 1rem; border-bottom: 1px solid rgba(255, 255, 255, 0.05); color: var(--text-main); word-break: break-word; overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: none; }

/* Additional utilities for avatars and boards */
.ring-2 { box-shadow: 0 0 0 2px var(--tw-ring-color); }
.ring-slate-800 { --tw-ring-color: #1e293b; }
.border-dashed { border-style: dashed !important; }
.opacity-0 { opacity: 0; pointer-events: none; }
.transition-opacity { transition: opacity 0.2s ease; }

@keyframes pulse-emerald-glow {
    0%, 100% {
        box-shadow: 0 0 6px rgba(16, 185, 129, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
        border-color: rgba(52, 211, 153, 0.5);
    }
    50% {
        box-shadow: 0 0 14px rgba(16, 185, 129, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.2);
        border-color: rgba(110, 231, 183, 0.9);
    }
}

.animate-pulse-glow {
    animation: pulse-emerald-glow 1.8s infinite ease-in-out;
}

.inbound-reply-banner {
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.85) 0%, rgba(4, 47, 38, 0.95) 100%);
    border: 1px solid rgba(52, 211, 153, 0.5);
    margin-top: 8px !important;
    margin-bottom: 8px !important;
    padding: 6px 10px !important;
    border-radius: 8px !important;
}

.domain-card.has-inbound-reply {
    border-top: 2px solid #10b981 !important;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}


