/* ==================== SoteryanCRM — Dark Terracotta Theme ==================== */
:root {
    /* Palette */
    --bg-0: #0f1012;
    --bg-1: #16181c;
    --bg-2: #1c1f24;
    --bg-3: #23272e;
    --bg-hover: #2a2e36;
    --border: #2c3038;
    --border-soft: #22262d;

    --text: #ececec;
    --text-1: #ececec;
    --text-2: #b0b4bb;
    --text-3: #7a7f88;

    /* Terracotta Accent */
    --accent: #e2725b;
    --accent-hover: #d65f45;
    --accent-soft: rgba(226, 114, 91, 0.14);
    --accent-border: rgba(226, 114, 91, 0.35);

    /* Status colors */
    --success: #4caf7d;
    --warning: #e0a458;
    --danger: #d0564b;
    --info: #4a90d9;

    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ==================== Light Theme ==================== */
body.theme-light {
    --bg-0: #f0f2f5;
    --bg-1: #ffffff;
    --bg-2: #f5f6f8;
    --bg-3: #eaecef;
    --bg-hover: #e2e5ea;
    --border: #d4d8de;
    --border-soft: #e2e5ea;

    --text: #111316;
    --text-1: #111316;
    --text-2: #4a4f5a;
    --text-3: #888d97;

    --accent: #e2725b;
    --accent-hover: #d65f45;
    --accent-soft: rgba(226, 114, 91, 0.12);
    --accent-border: rgba(226, 114, 91, 0.4);

    --shadow: 0 4px 16px rgba(0,0,0,0.10);
    --shadow-lg: 0 12px 36px rgba(0,0,0,0.14);
}

/* ==================== Global round checkbox style ==================== */
input[type="checkbox"]:not(.check-item input):not(.toggle-input) {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin: 0;
    border: 2px solid var(--accent-border);
    border-radius: 50%;
    background: transparent;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    vertical-align: middle;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
input[type="checkbox"]:not(.check-item input):not(.toggle-input)::after {
    content: '';
    width: 5px;
    height: 9px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg) translate(-1px, -1px);
    opacity: 0;
}
input[type="checkbox"]:not(.check-item input):not(.toggle-input):checked {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
input[type="checkbox"]:not(.check-item input):not(.toggle-input):checked::after {
    opacity: 1;
}
input[type="checkbox"]:not(.check-item input):not(.toggle-input):hover {
    border-color: var(--accent);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg-0);
    color: var(--text-1);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    text-rendering: optimizeLegibility;
}

html { scroll-behavior: smooth; }
body { overscroll-behavior-y: none; }

body.app-loading #authScreen,
body.app-loading #mainApp {
    visibility: hidden;
}

/* ==================== Global brand loader ==================== */
.global-loader {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--bg-0);
    animation: gl-fade-in 160ms ease both;
}
body.app-loading .global-loader,
body.loader-active .global-loader { display: flex; }
.global-loader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
}
.brand-spinner {
    position: relative;
    width: 110px;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 800px;
}
.brand-spinner-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    filter: drop-shadow(0 0 22px rgba(226,114,91,0.45));
    transform-origin: 50% 50%;
    transform-style: preserve-3d;
    backface-visibility: visible;
    animation: gl-coin-spin 1s linear infinite;
    will-change: transform;
}
.brand-spinner-ring { display: none; }
.brand-spinner-word {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: var(--text-1);
}
.brand-spinner-word span {
    color: var(--accent);
    margin-left: 3px;
}
@keyframes gl-coin-spin { from { transform: rotateY(0deg); } to { transform: rotateY(360deg); } }
@keyframes gl-fade-in { from { opacity: 0; } to { opacity: 1; } }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 18px; height: 18px; stroke-linecap: round; stroke-linejoin: round; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-hover); }

/* ==================== Layout ==================== */
.app {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
    overflow: hidden;
    transition: grid-template-columns 0.25s ease;
}
.app.sidebar-collapsed {
    grid-template-columns: 64px 1fr;
}

/* ==================== Sidebar ==================== */
.sidebar {
    background: var(--bg-1);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 22px 14px;
    overflow: hidden;
    transition: padding 0.25s ease;
    position: relative;
}
.app.sidebar-collapsed .sidebar {
    padding: 22px 10px;
    align-items: center;
}

/* ── Collapse toggle button ── */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    color: var(--text-3);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    margin-top: 4px;
}
.sidebar-toggle:hover {
    background: var(--bg-2);
    color: var(--text-1);
}
.sidebar-toggle svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}
.app.sidebar-collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}
.sidebar-toggle span {
    transition: opacity 0.15s, max-width 0.25s;
    opacity: 1;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
}
.app.sidebar-collapsed .sidebar-toggle span {
    opacity: 0;
    max-width: 0;
}
.app.sidebar-collapsed .sidebar-toggle {
    padding: 8px 0;
    justify-content: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px 18px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.14s, padding 0.25s ease, gap 0.25s ease;
    overflow: hidden;
    width: 100%;
}
.brand:hover { background: transparent; }
.app.sidebar-collapsed .brand {
    padding: 6px 4px 18px;
    gap: 0;
    justify-content: center;
    pointer-events: none;
}

.brand-text {
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.2s ease, width 0.25s ease;
    opacity: 1;
    width: auto;
}
.app.sidebar-collapsed .brand-text {
    opacity: 0;
    width: 0;
}

.brand-logo {
    width: 48px; height: 48px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent), #a04532);
    border-radius: var(--radius-sm);
    display: grid; place-items: center;
    font-weight: 800; font-size: 18px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(226, 114, 91, 0.35);
    transition: width 0.25s ease, height 0.25s ease;
}
.app.sidebar-collapsed .brand-logo {
    width: 40px;
    height: 40px;
}
.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: inherit;
}
.brand-logo-image {
    background: transparent;
    padding: 0;
    overflow: visible;
    box-shadow: none;
}

.brand-title { font-size: 16px; font-weight: 700; letter-spacing: 0.2px; }
.brand-title span { color: var(--accent); }
.brand-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; width: 100%; overflow-y: auto; overflow-x: hidden; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, padding 0.25s ease, justify-content 0.25s ease;
    white-space: nowrap;
    overflow: hidden;
    width: 100%;
    position: relative;
}
.app.sidebar-collapsed .nav-item {
    padding: 10px 0;
    justify-content: center;
    gap: 0;
}
.nav-item span {
    overflow: hidden;
    opacity: 1;
    max-width: 200px;
    transition: opacity 0.15s ease, max-width 0.25s ease;
}
.app.sidebar-collapsed .nav-item span {
    opacity: 0;
    max-width: 0;
}
.nav-item svg { flex-shrink: 0; }

.nav-item:hover { background: var(--bg-2); color: var(--text-1); }
.app.sidebar-collapsed .nav-item:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-3);
    color: var(--text-1);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    border: 1px solid var(--border);
    z-index: 100;
    box-shadow: var(--shadow);
}

.nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
.nav-item.active svg { color: var(--accent); }

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
    width: 100%;
}
.app.sidebar-collapsed .sidebar-footer {
    display: flex;
    justify-content: center;
}
.app.sidebar-collapsed .user {
    padding: 8px 4px;
    gap: 0;
    justify-content: center;
}
.app.sidebar-collapsed .user-info,
.app.sidebar-collapsed #logoutBtn {
    display: none;
}

.user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
}
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--accent);
    display: grid; place-items: center;
    font-weight: 700; color: #fff; font-size: 13px;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-3); }

/* ==================== Main ==================== */
.main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-0);
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-0);
}
.topbar-left { min-width: 0; }

.page-title { font-size: 20px; font-weight: 700; }
.page-subtitle { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

.topbar-right { display: flex; align-items: center; gap: 12px; position: relative; }

.search {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    width: 300px;
}
.search svg { color: var(--text-3); }
.search input {
    flex: 1; background: transparent; border: none; outline: none;
    color: var(--text-1); font-size: 13px;
}
.search input::placeholder { color: var(--text-3); }
.search:focus-within { border-color: var(--accent-border); }

/* ── Notification bell + panel ───────────────────────────────── */
.notif-wrap { position: relative; }
.notif-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-2);
    position: relative;
    transition: color .12s, border-color .12s, background .12s;
}
.notif-btn:hover { color: var(--accent); border-color: var(--accent-border); background: var(--bg-hover); }
.notif-btn svg { width: 18px; height: 18px; }
.notif-badge {
    position: absolute; top: 2px; right: 2px;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-size: 10px; font-weight: 700; line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--bg-2);
}
.notif-panel {
    position: absolute; top: calc(100% + 8px); right: 0;
    width: 360px; max-height: 460px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,.4);
    z-index: 50;
    overflow: hidden;
    flex-direction: column;
}
/* Show only when explicitly opened — no !important on display, so inline
   style set from JS (or the `[hidden]` attribute) can hide it. */
.notif-panel.open { display: flex; }
.notif-panel:not(.open) { display: none; }
.notif-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-1); font-weight: 600; font-size: 14px;
}
.notif-clear {
    background: transparent; border: none;
    color: var(--text-3); font-size: 11px; cursor: pointer;
    text-transform: uppercase; letter-spacing: .5px;
}
.notif-clear:hover { color: var(--accent); }
.notif-list { overflow-y: auto; flex: 1; }
.notif-item {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
    cursor: pointer;
    transition: background .1s;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item:last-child { border-bottom: none; }
.notif-item .ni-title { font-size: 13px; font-weight: 600; color: var(--text-1); margin-bottom: 3px; }
.notif-item .ni-body  { font-size: 12px; color: var(--text-2); line-height: 1.4; }
.notif-item .ni-when  { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.notif-empty {
    padding: 28px 14px; text-align: center;
    color: var(--text-3); font-size: 12.5px;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px 40px;
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.15s;
    border: 1px solid transparent;
    white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-2); color: var(--text-1); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-3); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-2); color: var(--text-1); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-icon { padding: 8px; }

/* ==================== Cards & Stats ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 3px; background: var(--accent);
    opacity: 0.7;
}
.stat-label { color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 6px; }
.stat-delta { font-size: 12px; margin-top: 6px; color: var(--success); }
.stat-delta.down { color: var(--danger); }
.stat-icon {
    position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--accent-soft);
    display: grid; place-items: center;
    color: var(--accent);
}
.stat-icon svg { width: 22px; height: 22px; }

/* ==================== Panels ==================== */
.panel {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-soft);
}
.panel-title { font-size: 15px; font-weight: 600; }
.panel-body { padding: 16px 20px; }
.panel-body.p0 { padding: 0; }

.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* ==================== Tables ==================== */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-3);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--bg-2);
}
.table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-soft);
}
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: var(--bg-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table .row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.table-subline { font-size: 11px; color: var(--text-3); margin-top: 4px; }

.icon-action {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-3);
    background: transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}
.icon-action svg {
    width: 16px;
    height: 16px;
}
.icon-action:hover {
    background: var(--bg-2);
    color: var(--text-1);
    transform: translateY(-1px);
}
.icon-action:focus-visible {
    outline: none;
    border-color: var(--accent-border);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.icon-action.edit:hover {
    color: var(--accent);
    border-color: var(--accent-border);
}
.icon-action.delete:hover {
    color: var(--danger);
    border-color: rgba(208, 86, 75, 0.35);
}
.icon-action.enable:hover {
    color: var(--success);
    border-color: rgba(76, 175, 125, 0.35);
}
.icon-action.disable:hover {
    color: var(--warning);
    border-color: rgba(224, 164, 88, 0.35);
}

/* ==================== Badges ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge::before {
    content: '';
    width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
}
.badge.new { background: rgba(74, 144, 217, 0.15); color: var(--info); }
.badge.progress { background: rgba(224, 164, 88, 0.15); color: var(--warning); }
.badge.won { background: rgba(76, 175, 125, 0.15); color: var(--success); }
.badge.lost { background: rgba(208, 86, 75, 0.15); color: var(--danger); }
.badge.on-hold { background: rgba(122, 127, 136, 0.2); color: var(--text-2); }

.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
}
.status-tag::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.status-tag.meeting { color: var(--accent); background: rgba(226, 114, 91, 0.12); border-color: rgba(226, 114, 91, 0.25); }
.status-tag.call { color: var(--info); background: rgba(74, 144, 217, 0.12); border-color: rgba(74, 144, 217, 0.25); }
.status-tag.deadline, .status-tag.overdue { color: var(--danger); background: rgba(208, 86, 75, 0.12); border-color: rgba(208, 86, 75, 0.25); }
.status-tag.internal, .status-tag.archive { color: var(--text-2); background: rgba(122, 127, 136, 0.16); border-color: rgba(122, 127, 136, 0.25); }
.status-tag.draft { color: var(--warning); background: rgba(224, 164, 88, 0.12); border-color: rgba(224, 164, 88, 0.25); }
.status-tag.review, .status-tag.partial { color: #f2c66d; background: rgba(242, 198, 109, 0.12); border-color: rgba(242, 198, 109, 0.25); }
.status-tag.sent { color: var(--info); background: rgba(74, 144, 217, 0.12); border-color: rgba(74, 144, 217, 0.25); }
.status-tag.signed, .status-tag.paid { color: var(--success); background: rgba(76, 175, 125, 0.12); border-color: rgba(76, 175, 125, 0.25); }
.status-tag.attended { color: var(--success); background: rgba(76, 175, 125, 0.12); border-color: rgba(76, 175, 125, 0.25); }
.status-tag.planned { color: var(--warning); background: rgba(224, 164, 88, 0.12); border-color: rgba(224, 164, 88, 0.25); }
.status-tag.ongoing { color: var(--accent); background: rgba(226, 114, 91, 0.12); border-color: rgba(226, 114, 91, 0.25); }
.status-tag.cancelled { color: var(--danger); background: rgba(208, 86, 75, 0.12); border-color: rgba(208, 86, 75, 0.25); }

.pill {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-3);
    color: var(--text-2);
}

/* ==================== Pipeline (Kanban) ==================== */
.pipeline {
    display: flex;
    flex-direction: row;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 12px;
    align-items: flex-start;
    /* keep columns from shrinking when there are many */
    flex-wrap: nowrap;
}
.pipeline-col {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    min-height: 500px;
    /* fixed width — never shrink, never grow */
    width: 280px;
    min-width: 280px;
    flex-shrink: 0;
}
.pipeline-col-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pipeline-col-title { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.pipeline-col-title::before {
    content: ''; width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent);
}
.pipeline-col[data-stage="new"] .pipeline-col-title::before { background: var(--info); }
.pipeline-col[data-stage="qualified"] .pipeline-col-title::before { background: #9c6bd1; }
.pipeline-col[data-stage="proposal"] .pipeline-col-title::before { background: var(--accent); }
.pipeline-col[data-stage="negotiation"] .pipeline-col-title::before { background: var(--warning); }
.pipeline-col[data-stage="won"] .pipeline-col-title::before { background: var(--success); }

.pipeline-col-count {
    background: var(--bg-3); color: var(--text-2);
    font-size: 11px; padding: 2px 8px; border-radius: 100px;
}
.pipeline-col-total { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.pipeline-col-body {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}
.deal-card {
    --deal-stage-color: var(--accent);
    background: var(--bg-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 12px;
    cursor: grab;
    transition: all 0.12s;
    border-left: 3px solid var(--deal-stage-color);
}
.deal-card:hover { background: var(--bg-3); border-left-color: var(--deal-stage-color); transform: translateY(-1px); }
.deal-card.dragging { opacity: 0.5; }
.deal-card[data-stage="new"] { --deal-stage-color: var(--info); }
.deal-card[data-stage="qualified"] { --deal-stage-color: #9c6bd1; }
.deal-card[data-stage="proposal"] { --deal-stage-color: var(--accent); }
.deal-card[data-stage="negotiation"] { --deal-stage-color: var(--warning); }
.deal-card[data-stage="won"] { --deal-stage-color: var(--success); }
.deal-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.deal-client { font-size: 11.5px; color: var(--text-3); margin-bottom: 8px; }
.deal-meta { display: flex; justify-content: space-between; align-items: center; }
.deal-amount { font-size: 13px; font-weight: 700; color: var(--deal-stage-color); }
.deal-date { font-size: 11px; color: var(--text-3); }
.pipeline-col.drag-over { background: var(--accent-soft); border-color: var(--accent-border); }

/* ==================== Forms ==================== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.form-grid.single { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label {
    font-size: 12px; color: var(--text-2); font-weight: 500;
}
.form-group input, .form-group textarea, .form-group select {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text-1);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    border-color: var(--accent);
}
.form-group textarea { min-height: 90px; resize: vertical; }

.form-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
}

/* ==================== Modal ==================== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-soft);
}
.modal-header h2 { font-size: 17px; font-weight: 600; }
.modal-close {
    font-size: 26px;
    color: var(--text-3);
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border-radius: 6px;
    line-height: 1;
}
.modal-close:hover { background: var(--bg-2); color: var(--text-1); }
.modal-body { padding: 22px; overflow-y: auto; }

/* ==================== Toast ==================== */
.toast-container {
    position: fixed;
    bottom: 20px; right: 20px;
    display: flex; flex-direction: column; gap: 10px;
    z-index: 200;
}
.toast {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    min-width: 260px;
    box-shadow: var(--shadow);
    animation: slideIn 0.25s ease;
    font-size: 13px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes slideIn {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ==================== Quick Add Menu ==================== */
.quick-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px;
    display: none;
    flex-direction: column;
    min-width: 220px;
    max-width: min(260px, calc(100vw - 28px));
    z-index: 50;
    box-shadow: var(--shadow);
}
.quick-menu.active { display: flex; }
.quick-menu button {
    text-align: left;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-1);
}
.quick-menu button:hover { background: var(--accent-soft); color: var(--accent); }

/* ==================== Tabs & Filters ==================== */
.filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-chip {
    padding: 7px 13px;
    border-radius: 100px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-2);
    cursor: pointer;
    font-weight: 500;
}
.filter-chip:hover { background: var(--bg-3); color: var(--text-1); }
.filter-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ==================== Calendar / Docs / Invoices ==================== */
.calendar-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.85fr) minmax(300px, 1fr);
    gap: 20px;
}
.calendar-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}
.calendar-grid-head { margin-bottom: 8px; }
.calendar-weekday {
    padding: 8px 10px;
    text-align: center;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-3);
}
.calendar-day {
    min-height: 142px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease, opacity 0.12s ease;
}
.calendar-day.muted { opacity: 0.42; }
.calendar-day:hover {
    border-color: var(--accent-border);
    transform: translateY(-1px);
}
.calendar-day.today {
    border-color: var(--accent-border);
    box-shadow: inset 0 0 0 1px rgba(226, 114, 91, 0.25);
}
.calendar-day.today .calendar-day-number { color: var(--accent); }
.calendar-day.selected {
    opacity: 1;
    border-color: var(--accent);
    background: linear-gradient(180deg, rgba(226, 114, 91, 0.16), rgba(226, 114, 91, 0.05));
}
.calendar-day.selected .calendar-day-number { color: var(--text-1); }
.calendar-day.selected.today {
    box-shadow: inset 0 0 0 2px rgba(226, 114, 91, 0.38);
}
.calendar-day-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-2);
}
.calendar-day-events {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.calendar-event-chip {
    width: 100%;
    text-align: left;
    background: var(--bg-3);
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 7px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    transition: background 0.12s ease, transform 0.12s ease;
}
.calendar-event-chip:hover {
    background: #2c3138;
    transform: translateY(-1px);
}
.calendar-event-chip span {
    font-size: 10px;
    color: var(--text-3);
}
.calendar-event-chip strong {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.calendar-event-chip.meeting { border-left-color: var(--accent); }
.calendar-event-chip.call { border-left-color: var(--info); }
.calendar-event-chip.deadline { border-left-color: var(--danger); }
.calendar-event-chip.internal { border-left-color: var(--text-3); }
.calendar-more {
    font-size: 11px;
    color: var(--text-3);
    padding-left: 2px;
}
.calendar-side-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.calendar-selected-date {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 4px;
}
.calendar-agenda-item {
    width: 100%;
    text-align: left;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 12px;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.calendar-agenda-item:hover {
    background: var(--bg-3);
    border-color: var(--accent-border);
}
.calendar-agenda-date {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
}
.calendar-agenda-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}
.calendar-agenda-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 11px;
    color: var(--text-3);
}
.empty.compact {
    padding: 28px 14px;
}
.conference-attention-list {
    display: grid;
    gap: 10px;
}
.conference-alert-card {
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(226, 114, 91, 0.08), rgba(26, 29, 34, 0.6));
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.conference-alert-card:hover {
    transform: translateY(-1px);
    border-color: var(--accent-border);
    background: linear-gradient(135deg, rgba(226, 114, 91, 0.14), rgba(26, 29, 34, 0.75));
}
.conference-cost-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 98px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(226, 114, 91, 0.14);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
}
.conference-table tbody tr,
.conference-row {
    cursor: pointer;
}
.conference-row.requires-attention {
    background: linear-gradient(90deg, rgba(226, 114, 91, 0.06), transparent 30%);
}
.conference-participant-selected td {
    background: rgba(226, 114, 91, 0.08);
}
.conference-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.conference-meta-item {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-2);
}
.conference-meta-item span {
    display: block;
    font-size: 11px;
    color: var(--text-3);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.conference-meta-item strong {
    font-size: 13px;
    font-weight: 600;
}
.conference-notes-block {
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-2);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}
.conference-notes-block p {
    margin-top: 6px;
    color: var(--text-2);
    line-height: 1.5;
}
.conference-cost-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.conference-cost-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    font-size: 12px;
}
.conference-cost-chip span {
    color: var(--text-3);
}
.conference-cost-chip strong {
    color: var(--text-1);
}
.conference-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-soft);
}
.conference-summary-row:last-child {
    border-bottom: none;
}
.attachment-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.attachment-chip {
    display: inline-flex;
    align-items: center;
    max-width: 170px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.attachment-chip:hover {
    background: var(--bg-3);
    color: var(--text-1);
}
.attachment-chip.more {
    pointer-events: none;
    background: transparent;
}
.file-upload-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    border: 1px dashed var(--accent-border);
    border-radius: var(--radius-sm);
    background: rgba(226, 114, 91, 0.06);
    cursor: pointer;
}
.file-upload-field input {
    display: none;
}
.file-upload-field span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-1);
}
.file-upload-field small {
    font-size: 11px;
    color: var(--text-3);
}
.attachment-picker-list,
.attachment-manager-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}
.attachment-section {
    margin-top: 12px;
}
.attachment-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 8px;
}
.attachment-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.attachment-name,
.attachment-link {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--text-1);
}
.attachment-link {
    text-align: left;
}
.attachment-link:hover {
    color: var(--accent);
}
.attachment-meta {
    font-size: 11px;
    color: var(--text-3);
    white-space: nowrap;
}
.attachment-remove-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-2);
}
.attachment-remove-toggle input {
    accent-color: var(--accent);
}
.attachment-empty {
    font-size: 12px;
    color: var(--text-3);
    padding: 10px 0 2px;
}

/* ==================== Empty state ==================== */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-3);
}
.empty h3 { color: var(--text-2); margin-bottom: 8px; font-size: 15px; }
.empty p { font-size: 13px; margin-bottom: 16px; }

/* ==================== Activity feed ==================== */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-soft);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid; place-items: center;
    flex-shrink: 0;
}
.activity-content { flex: 1; }
.activity-text { font-size: 13px; }
.activity-text strong { color: var(--text-1); }
.activity-time { font-size: 11px; color: var(--text-3); margin-top: 3px; }

/* ==================== Charts ==================== */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding: 10px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar {
    width: 100%;
    background: linear-gradient(to top, var(--accent), #ff9d7a);
    border-radius: 4px 4px 0 0;
    transition: all 0.3s;
    min-height: 2px;
}
.bar:hover { filter: brightness(1.15); }
.bar-label { font-size: 11px; color: var(--text-3); }
.bar-value { font-size: 11px; color: var(--text-2); font-weight: 600; }

.donut-wrap { display: flex; align-items: center; justify-content: space-around; padding: 20px; }
.donut-legend { display: flex; flex-direction: column; gap: 10px; }
.donut-legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.donut-legend-dot { width: 10px; height: 10px; border-radius: 3px; }

/* ==================== Checkbox ==================== */
.check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13px;
    transition: background 0.12s;
}
.check-item:hover { background: var(--bg-2); }
.check-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 2px solid var(--accent-border);
    border-radius: 50%;
    background: transparent;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.check-item input[type="checkbox"]::after {
    content: '';
    width: 5px;
    height: 9px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg) translate(-1px, -1px);
    opacity: 0;
}
.check-item input[type="checkbox"]:hover {
    border-color: var(--accent);
    transform: scale(1.03);
}
.check-item input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.check-item input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(226, 114, 91, 0.18);
}
.check-item input[type="checkbox"]:checked::after {
    opacity: 1;
}
.check-item.done .check-text { color: var(--text-3); text-decoration: line-through; }
.check-text { flex: 1; }
.check-due {
    min-width: 104px;
    text-align: right;
    font-size: 11px;
    color: var(--text-3);
}
.check-due.overdue { color: var(--danger); }
.check-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
}

/* ==================== Auth Screen ==================== */
.auth-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-0);
    z-index: 1000;
    overflow-y: auto;
    padding: 40px 20px;
}
/* Accent glow — exactly at bottom-left corner, large */
.auth-screen::before {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle at bottom left, rgba(226,114,91,0.28) 0%, rgba(226,114,91,0.12) 35%, transparent 65%);
    pointer-events: none;
    z-index: 0;
}
.auth-left {
    background: linear-gradient(135deg, #1a1d22 0%, #0f1012 100%);
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-right: 1px solid var(--border);
}
.auth-left::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, var(--accent-soft), transparent 70%);
    top: -150px; right: -150px;
    border-radius: 50%;
}
.auth-left::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(226, 114, 91, 0.08), transparent 70%);
    bottom: -100px; left: -100px;
    border-radius: 50%;
}
.auth-brand { position: relative; z-index: 1; margin-bottom: 40px; }
.brand-logo.big {
    width: 82px; height: 82px;
    font-size: 32px;
    border-radius: 15px;
    margin-bottom: 0;
}
.brand-logo.big.brand-logo-image { padding: 0; filter: drop-shadow(0 0 12px rgba(226,114,91,0.35)); }
.auth-brand h1 {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
}
.auth-brand h1 span { color: var(--accent); }
.auth-brand p {
    font-size: 15px;
    color: var(--text-2);
    max-width: 420px;
    line-height: 1.6;
}
.auth-features {
    position: relative;
    z-index: 1;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.auth-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-2);
    font-size: 14px;
}
.auth-features li::before {
    content: '✓';
    width: 22px; height: 22px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.auth-box {
    width: 100%;
    max-width: 540px;
    position: relative;
    z-index: 1;
    /* Gradient border via background-clip trick */
    background:
        linear-gradient(var(--bg-1), var(--bg-1)) padding-box,
        linear-gradient(160deg, rgba(226,114,91,0.55) 0%, rgba(226,114,91,0.08) 40%, transparent 70%) border-box;
    border: 1px solid transparent;
    border-radius: 20px;
    padding: 40px 44px;
    box-shadow:
        0 0 0 1px rgba(226,114,91,0.06),
        0 8px 32px rgba(0,0,0,0.45),
        0 24px 64px rgba(0,0,0,0.25);
}
/* Floating language switch */
.auth-lang-float {
    position: fixed;
    top: 20px;
    right: 24px;
    display: flex;
    gap: 6px;
    z-index: 10;
}
/* Brand header above login box */
.auth-brand-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 28px;
    margin-bottom: 28px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}
.auth-brand-top h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.3px;
    margin-top: 14px;
    margin-bottom: 5px;
}
.auth-brand-top h1 span { color: var(--accent); }
.auth-brand-top p {
    font-size: 12px;
    color: var(--text-3);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
/* Employee / Partner mode switcher */
.auth-mode-switch {
    display: flex;
    background: var(--bg-2);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    gap: 0;
}
.auth-mode-btn {
    flex: 1;
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-3);
    border-radius: 5px;
    transition: all 0.15s;
    white-space: nowrap;
}
.auth-mode-btn.active {
    background: var(--accent);
    color: #fff;
}
.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-form h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}
.auth-sub {
    color: var(--text-3);
    font-size: 13px;
    margin-bottom: 24px;
}
.auth-form .form-group { margin-bottom: 12px; }
.auth-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 14px 0 20px;
    font-size: 12px;
}
/* ==================== Toggle Switch ==================== */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    cursor: pointer;
    user-select: none;
    gap: 16px;
}
.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-1);
}
.toggle-switch { flex-shrink: 0; position: relative; }
.toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.toggle-track {
    display: block;
    width: 44px;
    height: 24px;
    background: var(--bg-3);
    border: 1.5px solid var(--border);
    border-radius: 999px;
    transition: background 0.2s, border-color 0.2s;
    position: relative;
}
.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-3);
    transition: transform 0.2s, background 0.2s;
}
.toggle-input:checked + .toggle-track {
    background: var(--accent);
    border-color: var(--accent);
}
.toggle-input:checked + .toggle-track .toggle-thumb {
    background: #fff;
    transform: translateX(20px);
}
.toggle-row:hover .toggle-track { border-color: var(--accent); }

.check-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-2);
    cursor: pointer;
}
.check-inline input { accent-color: var(--accent); }
.btn-block { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }
.auth-error {
    background: rgba(208, 86, 75, 0.12);
    border: 1px solid rgba(208, 86, 75, 0.3);
    color: var(--danger);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    margin-top: 14px;
    display: none;
}
.auth-error.active { display: block; }
.auth-hint {
    text-align: center;
    font-size: 11.5px;
    color: var(--text-3);
    margin-top: 16px;
    padding: 10px;
    background: var(--bg-2);
    border-radius: 6px;
}

@media (max-width: 900px) {
    .auth-screen { padding: 20px 16px 40px; }
    .auth-box { max-width: 100%; padding: 28px 24px; }
}

.auth-features li::before {
    content: '\2713';
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 46px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-3);
    background: transparent;
    border: 0;
    border-radius: 8px;
    transition: color 0.18s ease, background 0.18s ease;
}

.password-toggle:hover {
    color: var(--text-1);
    background: rgba(255, 255, 255, 0.06);
}

.password-toggle svg {
    width: 16px;
    height: 16px;
}

.form-note {
    margin-top: 8px;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid rgba(226, 114, 91, 0.18);
    background:
        linear-gradient(180deg, rgba(226, 114, 91, 0.08), rgba(226, 114, 91, 0.03)),
        var(--bg-2);
    color: var(--text-2);
    font-size: 12px;
    line-height: 1.45;
}

.form-note strong {
    color: var(--text-1);
}

.auth-hint {
    font-size: 12px;
    color: var(--text-2);
    padding: 12px 14px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
        var(--bg-2);
    border-radius: 10px;
    border: 1px solid var(--border);
}

/* Hide admin-only nav items for non-admins */
body.role-employee .admin-only { display: none !important; }

/* Language Switch */
.lang-switch {
    display: flex;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}
.lang-btn {
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
    border-radius: 4px;
    letter-spacing: 0.5px;
    transition: all 0.15s;
}
.lang-btn:hover { color: var(--text-1); }
.lang-btn.active {
    background: var(--accent);
    color: #fff;
}

.auth-lang-switch {
    position: absolute;
    top: 24px;
    right: 24px;
    display: flex;
    gap: 4px;
    z-index: 2;
}
.auth-lang-btn {
    padding: 6px 12px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
    letter-spacing: 0.5px;
}
.auth-lang-btn:hover { color: var(--text-1); background: var(--bg-3); }
.auth-lang-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ==================== Responsive ==================== */

/* Tablets & smaller desktops */
@media (max-width: 1100px) {
    .search { width: 220px; }
    .topbar { padding: 16px 20px; }
    .content { padding: 20px 20px 32px; }
}

/* Tablets / small screens */
@media (max-width: 900px) {
    html, body {
        font-size: 14px;
        -webkit-text-size-adjust: 100%;
    }

    .app {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: 100dvh;
    }

    /* Sidebar becomes sticky horizontal nav bar */
    .sidebar {
        position: sticky;
        top: 0;
        z-index: 30;
        display: block;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 10px 10px 8px;
        padding-top: max(10px, env(safe-area-inset-top));
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
        background: rgba(22, 24, 28, 0.96);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    .brand,
    .sidebar-footer { display: none; }
    .nav {
        flex-direction: row;
        gap: 6px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav::-webkit-scrollbar { display: none; }
    .nav-item {
        flex: 0 0 auto;
        background: var(--bg-2);
        border: 1px solid var(--border);
        padding: 9px 12px;
        font-size: 13px;
        min-height: 40px;
        white-space: nowrap;
    }
    .nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

    /* Topbar */
    .topbar {
        padding: 14px 16px;
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
    }
    .topbar-left { width: 100%; order: 1; }
    .topbar-right {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
        order: 2;
    }
    .search {
        order: 3;
        width: 100%;
        flex: 1 1 100%;
        padding: 10px 12px;
    }
    .search input { font-size: 15px; }
    #quickAddBtn { margin-left: auto; min-height: 40px; }
    .lang-switch { padding: 3px; }
    .lang-btn { padding: 6px 10px; font-size: 11px; min-height: 28px; }

    /* Content */
    .content {
        padding: 16px 14px 28px;
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
        padding-bottom: max(28px, env(safe-area-inset-bottom));
    }

    /* Stats & panels */
    .stats-grid { grid-template-columns: 1fr; gap: 12px; margin-bottom: 18px; }
    .stat-card { padding: 16px 18px; }
    .stat-value { font-size: 24px; }
    .stat-icon { width: 36px; height: 36px; right: 14px; }
    .stat-icon svg { width: 18px; height: 18px; }

    .panel { margin-bottom: 16px; }
    .panel-header {
        padding: 14px 16px;
        gap: 10px;
        flex-wrap: wrap;
        align-items: flex-start;
    }
    .panel-title { font-size: 14px; }
    .panel-body { padding: 14px 16px; }
    .panel-body.p0 {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Pipeline - horizontal scroll with snap */
    .pipeline {
        gap: 10px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 12px;
    }
    .pipeline-col {
        width: 82vw;
        min-width: 82vw;
        scroll-snap-align: start;
        min-height: 380px;
    }
    .pipeline-col-header { padding: 12px 14px; }

    /* Tables */
    .table { min-width: 600px; }
    .table th, .table td { padding: 11px 13px; }

    /* Conference */
    .conference-alert-card,
    .conference-summary-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .conference-cost-pill { min-width: auto; }
    .conference-meta-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .conference-meta-item { padding: 10px 12px; }

    /* Grids */
    .grid-2 { grid-template-columns: 1fr; gap: 16px; }
    .form-grid { grid-template-columns: 1fr; gap: 12px; }

    /* Calendar */
    .calendar-layout { grid-template-columns: 1fr; gap: 16px; }
    .calendar-toolbar { flex-wrap: wrap; }
    .calendar-grid { gap: 6px; }
    .calendar-day { min-height: 110px; padding: 8px; }
    .calendar-agenda-item { grid-template-columns: 1fr; padding: 12px; }
    .calendar-agenda-date { font-size: 11.5px; }

    /* Attachments */
    .attachment-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
        padding: 10px;
    }
    .attachment-row .attachment-meta { grid-column: 1 / -1; }
    .attachment-chip { max-width: 100%; }

    /* Forms */
    .form-actions {
        flex-wrap: wrap;
        justify-content: stretch;
        gap: 8px;
    }
    .form-actions .btn {
        flex: 1 1 100%;
        justify-content: center;
        padding: 11px 14px;
        min-height: 44px;
    }

    /* Modal - bottom sheet on mobile */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    .modal {
        max-height: 94vh;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        width: 100%;
    }
    .modal-header {
        padding: 14px 18px;
        position: sticky;
        top: 0;
        background: var(--bg-1);
        z-index: 2;
    }
    .modal-header h2 { font-size: 16px; }
    .modal-body {
        padding: 16px 18px 24px;
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }
    .modal-close { width: 36px; height: 36px; font-size: 24px; }

    /* Toast */
    .toast-container {
        bottom: 12px;
        right: 12px;
        left: 12px;
    }
    .toast {
        min-width: auto;
        width: 100%;
    }

    /* Quick menu */
    .quick-menu {
        top: calc(100% + 6px);
        right: 0;
        min-width: 200px;
    }
    .quick-menu button {
        padding: 10px 12px;
        min-height: 40px;
        font-size: 13.5px;
    }

    /* Buttons - touch-friendly */
    .btn { min-height: 40px; padding: 10px 14px; }
    .btn-sm { min-height: 34px; padding: 7px 11px; }
    .btn-icon { min-width: 40px; min-height: 40px; }
    .icon-action { width: 38px; height: 38px; }
    .icon-action svg { width: 17px; height: 17px; }

    /* Activity */
    .activity-item { padding: 12px 14px; gap: 10px; }
    .activity-dot { width: 30px; height: 30px; }

    /* Filter chips - scrollable */
    .filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        margin-bottom: 14px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .filters::-webkit-scrollbar { display: none; }
    .filter-chip {
        flex-shrink: 0;
        padding: 8px 12px;
        min-height: 34px;
    }

    /* Row actions - less cramped */
    .table .row-actions {
        justify-content: flex-start;
        gap: 4px;
    }

    /* Bar chart */
    .bar-chart { height: 160px; gap: 6px; }
    .bar-label, .bar-value { font-size: 10px; }

    /* Donut */
    .donut-wrap { padding: 16px; gap: 16px; flex-wrap: wrap; justify-content: center; }

    /* Check items */
    .check-item { padding: 12px 14px; }
    .check-due { min-width: auto; font-size: 10.5px; }
}

/* Phones */
@media (max-width: 640px) {
    .page-title { font-size: 17px; }
    .page-subtitle { font-size: 11.5px; }

    /* Prevent iOS zoom on input focus — must be 16px+ */
    .form-group input,
    .form-group textarea,
    .form-group select,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    input[type="search"],
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"],
    textarea,
    select { font-size: 16px; }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 12px 13px;
        border-radius: 8px;
    }

    /* Calendar smaller */
    .calendar-grid { gap: 3px; }
    .calendar-day {
        min-height: 78px;
        padding: 5px;
        gap: 4px;
        border-radius: 6px;
    }
    .calendar-day-number { font-size: 11px; }
    .calendar-day-events { gap: 3px; }
    .calendar-event-chip {
        padding: 4px 5px;
        border-left-width: 2px;
        border-radius: 5px;
    }
    .calendar-event-chip strong { font-size: 10px; }
    .calendar-event-chip span { display: none; }
    .calendar-weekday { padding: 6px 4px; font-size: 10px; }
    .calendar-more { font-size: 10px; }

    /* Conference meta single column */
    .conference-meta-grid { grid-template-columns: 1fr; }

    /* Quick menu full-width */
    .quick-menu {
        position: fixed;
        top: auto;
        bottom: 12px;
        left: 12px;
        right: 12px;
        min-width: auto;
        max-width: none;
        padding: 8px;
        border-radius: var(--radius);
        box-shadow: var(--shadow-lg);
    }
    .quick-menu button {
        padding: 12px 14px;
        min-height: 44px;
        font-size: 14px;
    }

    /* Pipeline - one card visible at a time */
    .pipeline-col { width: 90vw; min-width: 90vw; }

    /* Stats compact */
    .stat-value { font-size: 22px; }
    .stat-card { padding: 14px 16px; }
    .stat-icon { width: 32px; height: 32px; border-radius: 8px; }
    .stat-icon svg { width: 16px; height: 16px; }

    /* Table smaller */
    .table th, .table td { padding: 10px 12px; font-size: 12.5px; }
    .table th { font-size: 10.5px; }
    .table-subline { font-size: 10.5px; }

    /* Deal cards */
    .deal-card { padding: 10px; }
    .deal-title { font-size: 12.5px; }

    /* Badges smaller */
    .badge, .status-tag { padding: 3px 7px; font-size: 10px; }

    /* Bar chart */
    .bar-chart { height: 140px; padding: 6px 0; }
}

/* Small phones (iPhone SE etc.) */
@media (max-width: 380px) {
    html, body { font-size: 13px; }

    .topbar { padding: 12px 12px; }
    .page-title { font-size: 16px; }
    .page-subtitle { display: none; }

    .nav-item { padding: 8px 10px; font-size: 12px; }
    .nav-item svg { width: 15px; height: 15px; }

    .btn { padding: 9px 12px; font-size: 12.5px; }
    #quickAddBtn span { display: none; }
    #quickAddBtn { padding: 10px; min-width: 40px; }

    .lang-btn { padding: 5px 8px; font-size: 10px; }

    .content { padding: 14px 12px 24px; }

    .stat-label { font-size: 11px; }
    .stat-value { font-size: 20px; }

    .panel-header { padding: 12px 14px; }
    .panel-body { padding: 12px 14px; }

    .calendar-day { min-height: 64px; padding: 4px; }
}

/* Landscape on phones — reclaim vertical space */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
    .sidebar { padding: 6px 10px; }
    .nav-item { padding: 7px 10px; min-height: 34px; }
    .topbar { padding: 10px 14px; }
    .topbar-left h1 { font-size: 16px; }
    .topbar-left .page-subtitle { display: none; }
    .content { padding: 12px 14px 20px; }
}

/* Touch devices — remove hover effects that look stuck */
@media (hover: none) and (pointer: coarse) {
    .nav-item:hover { background: var(--bg-2); color: var(--text-2); }
    .deal-card:hover { transform: none; }
    .calendar-day:hover { transform: none; }
    .calendar-event-chip:hover { transform: none; }
    .conference-alert-card:hover { transform: none; }
    .icon-action:hover { transform: none; }
    .btn-primary:hover { background: var(--accent); }
    .table tbody tr:hover { background: transparent; }

    /* Better active feedback on touch */
    .btn:active { transform: scale(0.97); }
    .nav-item:active { background: var(--accent-soft); color: var(--accent); }
    .filter-chip:active { background: var(--bg-3); }
    .deal-card:active { background: var(--bg-3); }
    .icon-action:active { background: var(--bg-2); color: var(--text-1); }
    .calendar-day:active { background: var(--bg-3); }
}

/* Auth screen mobile polish */
@media (max-width: 900px) {
    .auth-lang-float { top: max(16px, env(safe-area-inset-top)); right: 16px; }
    .auth-box { max-width: 100%; padding: 28px 20px; border-radius: 16px; }
    .auth-form h2 { font-size: 20px; }
    .auth-sub { font-size: 12.5px; margin-bottom: 20px; }
    .auth-mode-switch { margin-bottom: 20px; }
    .auth-mode-btn { padding: 12px 10px; min-height: 42px; }
    .btn-block { padding: 13px; min-height: 46px; }
}

@media (max-width: 640px) {
    .auth-form input { font-size: 16px; padding: 12px 13px; }
    .password-field input { padding-right: 48px; }
    .password-toggle { width: 36px; height: 36px; }
}

/* ── Settings Cards ─────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.settings-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 22px 20px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color .18s, background .18s, transform .15s;
  position: relative;
  overflow: hidden;
  font-family: inherit;
}

.settings-card:hover {
  border-color: var(--accent);
  background: var(--bg-2);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(232,97,42,.12);
}

.settings-card:hover .settings-card-arrow { opacity: 1; transform: translateY(-50%) translateX(0); }
.settings-card:hover .settings-card-icon  { background: var(--accent); }
.settings-card:hover .settings-card-icon svg { stroke: white; }

.settings-card-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--accent-light, rgba(232,97,42,.12));
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .18s;
  flex-shrink: 0;
}

.settings-card-icon svg {
  stroke: var(--accent);
  transition: stroke .18s;
}

.settings-card-body { flex: 1; }

.settings-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.settings-card-sub {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}

.settings-card-arrow {
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%) translateX(4px);
  opacity: 0;
  transition: opacity .18s, transform .18s;
  color: var(--accent);
}
