/* ============================================================
   TarrisoCRM — Design System
   Tipografía: Inter (system) + mono para datos
   Paleta: zinc neutral, sin gradientes decorativos
   ============================================================ */

:root {
    --c-bg:           #ffffff;
    --c-bg-secondary: #f9fafb;
    --c-bg-tertiary:  #f3f4f6;
    --c-border:       #e5e7eb;
    --c-border-soft:  #f3f4f6;

    --c-text:         #111827;
    --c-text-2:       #374151;
    --c-text-3:       #6b7280;
    --c-text-4:       #9ca3af;
    --c-text-inv:     #ffffff;

    --c-accent:       #18181b;
    --c-accent-hover: #27272a;
    --c-accent-light: #f4f4f5;

    --c-blue:         #2563eb;
    --c-blue-light:   #eff6ff;
    --c-green:        #16a34a;
    --c-green-light:  #f0fdf4;
    --c-amber:        #d97706;
    --c-amber-light:  #fffbeb;
    --c-red:          #dc2626;
    --c-red-light:    #fef2f2;
    --c-violet:       #7c3aed;
    --c-violet-light: #f5f3ff;

    --c-sidebar:      #18181b;
    --c-sidebar-text: rgba(255,255,255,0.7);
    --c-sidebar-active: rgba(255,255,255,0.1);
    --c-sidebar-border: rgba(255,255,255,0.08);

    --radius-sm:  4px;
    --radius:     6px;
    --radius-lg:  10px;
    --radius-xl:  14px;

    --shadow-xs:  0 1px 2px rgba(0,0,0,.04);
    --shadow-sm:  0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:  0 4px 6px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg:  0 10px 15px rgba(0,0,0,.06), 0 4px 6px rgba(0,0,0,.04);
    --shadow-xl:  0 20px 25px rgba(0,0,0,.08), 0 8px 10px rgba(0,0,0,.04);

    --sidebar-w:  228px;
    --topbar-h:   52px;

    --font:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono:  'JetBrains Mono', 'Cascadia Code', 'Fira Code', ui-monospace, monospace;

    --t-fast:     120ms cubic-bezier(.4,0,.2,1);
    --t-base:     180ms cubic-bezier(.4,0,.2,1);
    --t-slow:     260ms cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
    --c-bg:           #09090b;
    --c-bg-secondary: #111113;
    --c-bg-tertiary:  #1c1c1f;
    --c-border:       #27272a;
    --c-border-soft:  #1c1c1f;

    --c-text:         #fafafa;
    --c-text-2:       #e4e4e7;
    --c-text-3:       #a1a1aa;
    --c-text-4:       #71717a;

    --c-accent:       #fafafa;
    --c-accent-hover: #e4e4e7;
    --c-accent-light: #27272a;

    --c-blue-light:   #1e3a5f;
    --c-green-light:  #14532d;
    --c-amber-light:  #451a03;
    --c-red-light:    #450a0a;
    --c-violet-light: #2e1065;

    --c-sidebar:      #09090b;
    --c-sidebar-border: rgba(255,255,255,0.06);

    --shadow-xs:  0 1px 2px rgba(0,0,0,.3);
    --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
    --shadow-md:  0 4px 6px rgba(0,0,0,.3);
    --shadow-lg:  0 10px 15px rgba(0,0,0,.4);
    --shadow-xl:  0 20px 25px rgba(0,0,0,.5);
}

/* ====== RESET ====== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--c-bg);
    color: var(--c-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }

/* ====== LAYOUT ====== */
.crm-shell {
    display: flex;
    min-height: 100dvh;
}

/* ====== SIDEBAR ====== */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100dvh;
    background: var(--c-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 40;
    border-right: 1px solid var(--c-sidebar-border);
    transition: transform var(--t-slow);
}

.sidebar-logo {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--c-sidebar-border);
    flex-shrink: 0;
}

.sidebar-logo-mark {
    width: 26px; height: 26px;
    background: #fff;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo-mark svg { width: 14px; height: 14px; color: #18181b; }

.sidebar-logo-text {
    margin-left: 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -.01em;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
    scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section {
    padding: 0 8px;
    margin-top: 4px;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--c-sidebar-text);
    opacity: .5;
    padding: 10px 8px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 9px;
    border-radius: 6px;
    color: var(--c-sidebar-text);
    font-size: 13px;
    font-weight: 450;
    transition: background var(--t-fast), color var(--t-fast);
    cursor: pointer;
    user-select: none;
    margin-bottom: 1px;
}

.nav-item:hover {
    background: var(--c-sidebar-active);
    color: #fff;
}

.nav-item.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.nav-item svg {
    width: 15px; height: 15px;
    flex-shrink: 0;
    opacity: .7;
}

.nav-item.active svg,
.nav-item:hover svg { opacity: 1; }

.nav-badge {
    margin-left: auto;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 20px;
    line-height: 1.6;
}

.sidebar-footer {
    padding: 8px;
    border-top: 1px solid var(--c-sidebar-border);
    flex-shrink: 0;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--t-fast);
    position: relative;
}

.user-card:hover { background: var(--c-sidebar-active); }

.user-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-info { flex: 1; min-width: 0; }

.user-name {
    font-size: 12.5px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: var(--c-sidebar-text);
    opacity: .6;
}

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

/* ====== TOPBAR ====== */
.topbar {
    height: var(--topbar-h);
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    background: var(--c-bg);
    position: sticky;
    top: 0;
    z-index: 30;
    flex-shrink: 0;
}

.topbar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text);
    flex: 1;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--c-bg-secondary);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 6px 10px;
    width: 220px;
    transition: border-color var(--t-fast), width var(--t-base);
}

.topbar-search:focus-within {
    border-color: var(--c-accent);
    width: 280px;
}

.topbar-search svg { width: 13px; height: 13px; color: var(--c-text-3); flex-shrink: 0; }

.topbar-search input {
    border: none;
    background: transparent;
    font-size: 13px;
    color: var(--c-text);
    width: 100%;
    outline: none;
}

.topbar-search input::placeholder { color: var(--c-text-4); }

.topbar-actions { display: flex; align-items: center; gap: 4px; }

/* ====== PAGE ====== */
.page {
    flex: 1;
    padding: 20px 24px;
    display: none;
}
.page.active { display: block; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -.02em;
    color: var(--c-text);
}

.page-subtitle {
    font-size: 13px;
    color: var(--c-text-3);
    margin-top: 2px;
}

/* ====== BUTTONS ====== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 14px;
    height: 32px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
    white-space: nowrap;
    user-select: none;
    line-height: 1;
}

.btn svg { width: 13px; height: 13px; flex-shrink: 0; }

.btn-primary {
    background: var(--c-accent);
    color: var(--c-text-inv);
    border-color: var(--c-accent);
}
.btn-primary:hover { background: var(--c-accent-hover); border-color: var(--c-accent-hover); }

.btn-secondary {
    background: var(--c-bg);
    color: var(--c-text-2);
    border-color: var(--c-border);
}
.btn-secondary:hover { background: var(--c-bg-secondary); }

.btn-ghost {
    background: transparent;
    color: var(--c-text-3);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--c-bg-secondary); color: var(--c-text); }

.btn-danger {
    background: var(--c-red);
    color: #fff;
    border-color: var(--c-red);
}
.btn-danger:hover { opacity: .88; }

.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 38px; padding: 0 18px; font-size: 14px; }
.btn-icon { width: 32px; padding: 0; }
.btn-icon.btn-sm { width: 26px; }
.btn:disabled { opacity: .45; pointer-events: none; }

/* ====== CARDS ====== */
.card {
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--c-border-soft);
    gap: 8px;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text);
}

.card-body { padding: 16px; }

.card-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--c-border-soft);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

/* ====== STATS GRID ====== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    box-shadow: var(--shadow-xs);
}

.stat-label {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--c-text-3);
    letter-spacing: .01em;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.03em;
    color: var(--c-text);
    margin: 3px 0 4px;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.stat-delta {
    font-size: 11.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 3px;
}
.stat-delta.up   { color: var(--c-green); }
.stat-delta.down { color: var(--c-red); }

/* ====== TABLE ====== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--c-border);
    box-shadow: var(--shadow-xs);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: var(--c-bg-secondary);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--c-text-3);
    padding: 9px 14px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--c-border);
}

tbody td {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--c-text-2);
    border-bottom: 1px solid var(--c-border-soft);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr { transition: background var(--t-fast); }
tbody tr:hover { background: var(--c-bg-secondary); }

.td-main { font-weight: 500; color: var(--c-text); }
.td-link { color: var(--c-blue); font-weight: 500; cursor: pointer; }
.td-link:hover { text-decoration: underline; }
.td-mono { font-family: var(--font-mono); font-size: 12px; }

/* ====== BADGES ====== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .01em;
    white-space: nowrap;
}

.badge-dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-neutral { background: var(--c-bg-tertiary); color: var(--c-text-3); }
.badge-blue    { background: var(--c-blue-light);  color: var(--c-blue);   }
.badge-green   { background: var(--c-green-light); color: var(--c-green);  }
.badge-amber   { background: var(--c-amber-light); color: var(--c-amber);  }
.badge-red     { background: var(--c-red-light);   color: var(--c-red);    }
.badge-violet  { background: var(--c-violet-light);color: var(--c-violet); }

/* ====== FORMS ====== */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 550;
    color: var(--c-text-2);
    margin-bottom: 5px;
}

.form-label .req { color: var(--c-red); margin-left: 2px; }

.form-control {
    display: block;
    width: 100%;
    padding: 7px 10px;
    font-size: 13px;
    color: var(--c-text);
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
    outline: none;
    line-height: 1.4;
}

.form-control::placeholder { color: var(--c-text-4); }

.form-control:focus {
    border-color: var(--c-text);
    box-shadow: 0 0 0 3px rgba(17,24,39,.06);
}

.form-control:disabled { background: var(--c-bg-tertiary); color: var(--c-text-3); cursor: not-allowed; }

textarea.form-control { resize: vertical; min-height: 80px; }

select.form-control {
    appearance: none;
    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='%236b7280' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 30px;
}

.form-hint { font-size: 11.5px; color: var(--c-text-3); margin-top: 4px; }
.form-error { font-size: 11.5px; color: var(--c-red); margin-top: 4px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Checkbox */
.checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--c-text-2);
    user-select: none;
}

.checkbox-wrap input[type="checkbox"] {
    width: 15px; height: 15px;
    accent-color: var(--c-accent);
    cursor: pointer;
    flex-shrink: 0;
}

/* ====== MODAL ====== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-base);
    backdrop-filter: blur(2px);
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    transform: translateY(8px) scale(.98);
    transition: transform var(--t-base);
}

.modal-backdrop.open .modal { transform: translateY(0) scale(1); }

.modal-lg { max-width: 720px; }
.modal-xl { max-width: 920px; }

.modal-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--c-border-soft);
    gap: 10px;
    flex-shrink: 0;
}

.modal-title { font-size: 15px; font-weight: 650; flex: 1; letter-spacing: -.015em; }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--c-border-soft);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

/* ====== KANBAN ====== */
.kanban {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 16px;
    align-items: flex-start;
    min-height: calc(100dvh - var(--topbar-h) - 100px);
}

.kanban::-webkit-scrollbar { height: 5px; }
.kanban::-webkit-scrollbar-track { background: var(--c-border-soft); border-radius: 3px; }
.kanban::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 3px; }

.kanban-col {
    flex-shrink: 0;
    width: 272px;
    background: var(--c-bg-secondary);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - var(--topbar-h) - 100px);
}

.kanban-col-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--c-border);
    gap: 7px;
    flex-shrink: 0;
}

.kanban-col-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.kanban-col-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--c-text);
    flex: 1;
}

.kanban-col-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--c-text-3);
    background: var(--c-bg-tertiary);
    padding: 1px 6px;
    border-radius: 20px;
}

.kanban-cards {
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kanban-card {
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 10px 12px;
    cursor: pointer;
    transition: box-shadow var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
    box-shadow: var(--shadow-xs);
}

.kanban-card:hover {
    border-color: var(--c-text-4);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.kanban-card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--c-text);
    margin-bottom: 6px;
    line-height: 1.35;
}

.kanban-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.kanban-card-company {
    font-size: 11.5px;
    color: var(--c-text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-card-value {
    font-size: 12px;
    font-weight: 650;
    color: var(--c-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ====== TABS ====== */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--c-border);
    gap: 0;
    margin-bottom: 20px;
}

.tab-item {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--c-text-3);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--t-fast), border-color var(--t-fast);
    white-space: nowrap;
}

.tab-item:hover { color: var(--c-text); }
.tab-item.active { color: var(--c-text); border-color: var(--c-text); }

/* ====== EMPTY STATE ====== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--c-text-3);
}

.empty-icon {
    width: 42px; height: 42px;
    background: var(--c-bg-tertiary);
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}

.empty-icon svg { width: 20px; height: 20px; opacity: .5; }

.empty-title { font-size: 14px; font-weight: 600; color: var(--c-text-2); margin-bottom: 4px; }
.empty-desc  { font-size: 13px; color: var(--c-text-3); margin-bottom: 14px; max-width: 300px; }

/* ====== DROPDOWN ====== */
.dropdown { position: relative; display: inline-block; }

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 50;
    padding: 4px;
    opacity: 0;
    transform: translateY(-4px) scale(.97);
    pointer-events: none;
    transition: opacity var(--t-fast), transform var(--t-fast);
}

.dropdown-menu.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--c-text-2);
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
    white-space: nowrap;
}

.dropdown-item:hover { background: var(--c-bg-secondary); color: var(--c-text); }
.dropdown-item.danger:hover { background: var(--c-red-light); color: var(--c-red); }
.dropdown-item svg { width: 13px; height: 13px; flex-shrink: 0; opacity: .6; }
.dropdown-sep { height: 1px; background: var(--c-border-soft); margin: 4px 0; }

/* ====== TOAST ====== */
.toast-stack {
    position: fixed;
    bottom: 20px; right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--c-text);
    color: var(--c-bg);
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toast-in var(--t-base) both;
    max-width: 320px;
}

.toast.toast-error   { background: var(--c-red);   color: #fff; }
.toast.toast-success { background: #16a34a;         color: #fff; }
.toast.toast-warning { background: var(--c-amber);  color: #fff; }

.toast svg { width: 15px; height: 15px; flex-shrink: 0; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ====== AVATAR ====== */
.avatar {
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}
.avatar-xs  { width: 20px; height: 20px; font-size: 9px; }
.avatar-sm  { width: 26px; height: 26px; font-size: 11px; }
.avatar-md  { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg  { width: 40px; height: 40px; font-size: 15px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ====== PROGRESS ====== */
.progress {
    height: 4px;
    background: var(--c-bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--c-accent);
    border-radius: 4px;
    transition: width .4s ease;
}

/* ====== DIVIDER ====== */
.divider {
    height: 1px;
    background: var(--c-border);
    margin: 16px 0;
}

/* ====== ICON BUTTON ====== */
.icon-btn {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: transparent;
    color: var(--c-text-3);
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
    flex-shrink: 0;
}

.icon-btn:hover { background: var(--c-bg-secondary); color: var(--c-text); }
.icon-btn svg { width: 15px; height: 15px; }

/* ====== SPINNER ====== */
.spinner {
    width: 16px; height: 16px;
    border: 2px solid var(--c-border);
    border-top-color: var(--c-text);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ====== ALERT ====== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    border: 1px solid;
}

.alert svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.alert-blue   { background: var(--c-blue-light);  border-color: #bfdbfe; color: #1e40af; }
.alert-green  { background: var(--c-green-light); border-color: #bbf7d0; color: #14532d; }
.alert-amber  { background: var(--c-amber-light); border-color: #fde68a; color: #78350f; }
.alert-red    { background: var(--c-red-light);   border-color: #fecaca; color: #7f1d1d; }

/* ====== FILTER BAR ====== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.filter-bar .form-control {
    width: auto;
    min-width: 140px;
}

/* ====== PAGINATION ====== */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    padding: 12px 0 0;
}

.page-btn {
    min-width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
    border: 1px solid var(--c-border);
    background: var(--c-bg);
    font-size: 12.5px;
    color: var(--c-text-3);
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
    padding: 0 6px;
}

.page-btn:hover { background: var(--c-bg-secondary); color: var(--c-text); }
.page-btn.active { background: var(--c-accent); color: var(--c-text-inv); border-color: var(--c-accent); }
.page-btn:disabled { opacity: .4; pointer-events: none; }

/* ====== DETAIL PANEL ====== */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.detail-item {}
.detail-item-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--c-text-3);
    margin-bottom: 3px;
}
.detail-item-value {
    font-size: 13px;
    color: var(--c-text);
    font-weight: 450;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 900px) {
    :root { --sidebar-w: 0px; }

    .sidebar {
        transform: translateX(-100%);
        width: 220px;
        z-index: 50;
    }

    .sidebar.open { transform: translateX(0); }

    .crm-main { margin-left: 0; }

    .topbar { padding: 0 14px; }

    .topbar-search { display: none; }

    .page { padding: 14px 14px; }

    .form-row { grid-template-columns: 1fr; }

    .detail-grid { grid-template-columns: 1fr; }

    .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr; }
    .kanban-col { width: 240px; }
}

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-text-4); }

/* ====== FOCUS VISIBLE ====== */
:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 2px; }

/* ====== SELECTION ====== */
::selection { background: var(--c-accent); color: var(--c-text-inv); }

/* ====== PRINT ====== */
@media print {
    .sidebar, .topbar, .btn, .filter-bar { display: none !important; }
    .crm-main { margin-left: 0 !important; }
    .page { display: block !important; }
}
