/* ============================================================
   PROSPECT DIGITAL CRM — Design System
   Premium SaaS: dark navy sidebar, blue accent, soft shadows
   ============================================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --primary-50: #eff6ff;
    --navy-900: #0b1220;
    --navy-800: #0f172a;
    --navy-700: #1e293b;
    --navy-600: #334155;
    --ink: #0f172a;
    --text: #1e293b;
    --text-soft: #64748b;
    --text-mute: #94a3b8;
    --bg: #f1f5f9;
    --card: #ffffff;
    --border: #e2e8f0;
    --border-soft: #eef2f7;
    --green: #16a34a;
    --green-bg: #dcfce7;
    --red: #dc2626;
    --red-bg: #fee2e2;
    --amber: #d97706;
    --amber-bg: #fef3c7;
    --orange: #ea580c;
    --orange-bg: #ffedd5;
    --violet: #7c3aed;
    --violet-bg: #ede9fe;
    --teal: #0d9488;
    --teal-bg: #ccfbf1;
    --blue-bg: #dbeafe;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .06);
    --shadow-lg: 0 10px 34px rgba(15, 23, 42, .16);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --sidebar-w: 252px;
    --topbar-h: 62px;
    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; color: var(--primary-dark); }
h1, h2, h3, h4 { color: var(--ink); margin: 0 0 8px; line-height: 1.25; }
.muted { color: var(--text-soft); }
.small { font-size: 12.5px; }
.text-right { text-align: right; }
.m-0 { margin: 0; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
code { background: #f1f5f9; padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }

/* ============================ Buttons ============================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
    font-size: 13.5px; font-weight: 600; font-family: inherit; cursor: pointer;
    transition: all .16s ease; white-space: nowrap; line-height: 1.2;
    text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, .4);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); color: #fff; transform: translateY(-1px); }
.btn-ghost { background: var(--card); border-color: var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { border-color: #cbd5e1; background: #f8fafc; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; color: #fff; }
.btn-soft { background: var(--primary-50); color: var(--primary-dark); }
.btn-soft:hover:not(:disabled) { background: var(--primary-light); color: var(--primary-dark); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 10px; border: none; background: transparent;
    color: var(--text-soft); cursor: pointer; transition: background .15s;
    font-size: 20px;
}
.icon-btn:hover { background: var(--border-soft); color: var(--text); }
.linklike {
    background: none; border: none; color: var(--primary); cursor: pointer;
    font-size: 13px; font-family: inherit; font-weight: 500; padding: 0;
}
.linklike:hover { text-decoration: underline; }

/* row action buttons */
.row-actions { display: inline-flex; gap: 4px; }
.act-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border);
    background: #fff; color: var(--text-soft); cursor: pointer; transition: all .14s;
}
.act-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-50); }
.act-btn.danger:hover { color: var(--red); border-color: var(--red); background: var(--red-bg); }

/* ============================ Spinner ============================ */
.spinner {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
    animation: spin .7s linear infinite; display: inline-block;
}
.spinner.dark { border-color: rgba(37, 99, 235, .25); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================ Alerts ============================ */
.alert {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px;
    margin-bottom: 14px; border: 1px solid transparent;
}
.alert svg { flex-shrink: 0; margin-top: 1px; }
.alert-error { background: var(--red-bg); color: #991b1b; border-color: #fecaca; }
.alert-success { background: var(--green-bg); color: #166534; border-color: #bbf7d0; }
.alert-warning { background: var(--amber-bg); color: #92400e; border-color: #fde68a; }
.alert-info { background: var(--blue-bg); color: #1e40af; border-color: #bfdbfe; }

/* ============================ Badges ============================ */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
    letter-spacing: .2px; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-new { background: var(--blue-bg); color: #1e40af; }
.badge-contacted { background: var(--teal-bg); color: #0f766e; }
.badge-qualified { background: var(--violet-bg); color: #6d28d9; }
.badge-proposal { background: var(--amber-bg); color: #b45309; }
.badge-negotiation { background: var(--orange-bg); color: #c2410c; }
.badge-won, .badge-completed { background: var(--green-bg); color: #15803d; }
.badge-lost { background: var(--red-bg); color: #b91c1c; }
.badge-pending { background: #f1f5f9; color: #475569; }
.badge-p-low { background: #f1f5f9; color: #64748b; }
.badge-p-medium { background: var(--blue-bg); color: #1d4ed8; }
.badge-p-high { background: var(--orange-bg); color: #c2410c; }
.badge-p-urgent { background: var(--red-bg); color: #b91c1c; }
.badge-role-admin { background: var(--violet-bg); color: #6d28d9; }
.badge-role-manager { background: var(--blue-bg); color: #1d4ed8; }
.badge-role-employee { background: var(--teal-bg); color: #0f766e; }
.badge-role-viewer { background: #f1f5f9; color: #64748b; }
.badge-status-active { background: var(--green-bg); color: #15803d; }
.badge-status-disabled { background: var(--red-bg); color: #b91c1c; }

/* ============================ Forms ============================ */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.form-group label .req { color: var(--red); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="date"], input[type="datetime-local"], input[type="search"],
input[type="url"], select, textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
    font-size: 13.5px; font-family: inherit; color: var(--text); background: #fff;
    transition: border-color .15s, box-shadow .15s; outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
input::placeholder, textarea::placeholder { color: var(--text-mute); }
textarea { resize: vertical; min-height: 84px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2364748b' d='m12 15-5-5h10l-5 5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.hint { display: block; color: var(--text-mute); font-size: 11.5px; margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; color: var(--text-soft); }
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* ============================ Layout ============================ */
.layout { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 22px 26px 30px; max-width: 1560px; width: 100%; margin: 0 auto; }
.app-footer { padding: 14px 26px; color: var(--text-mute); font-size: 12px; text-align: center; }

/* ============================ Sidebar ============================ */
.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    background: linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 100%);
    color: #cbd5e1; display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; z-index: 60;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 18px; border-bottom: 1px solid rgba(255, 255, 255, .07);
    min-height: var(--topbar-h);
}
.brand-logo { display: inline-flex; flex-shrink: 0; }
.brand-text {
    font-weight: 800; font-size: 13.5px; letter-spacing: .6px; color: #fff;
    display: flex; flex-direction: column; line-height: 1.15;
}
.brand-sub { font-size: 10px; letter-spacing: 4px; color: #60a5fa; font-weight: 700; }
.sidebar-close { display: none; color: #94a3b8; margin-left: auto; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9.5px 12px; border-radius: 10px; color: #94a3b8;
    font-size: 13.5px; font-weight: 500; margin-bottom: 2px;
    transition: all .15s ease; position: relative;
}
.nav-item svg { flex-shrink: 0; opacity: .8; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #e2e8f0; }
.nav-item.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, .25), rgba(37, 99, 235, .08));
    color: #fff; font-weight: 600;
}
.nav-item.active::before {
    content: ''; position: absolute; left: -10px; top: 7px; bottom: 7px;
    width: 3.5px; border-radius: 0 4px 4px 0; background: var(--primary);
}
.nav-item.active svg { opacity: 1; color: #60a5fa; }
.sidebar-bottom { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .07); }
.side-profile { display: flex; align-items: center; gap: 10px; padding: 6px 8px; margin-bottom: 6px; }
.side-profile-meta { display: flex; flex-direction: column; min-width: 0; }
.side-profile-name { color: #f1f5f9; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-profile-role { color: #64748b; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.side-logout {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px;
    border-radius: 10px; color: #f87171; font-size: 13px; font-weight: 600;
    transition: background .15s;
}
.side-logout:hover { background: rgba(248, 113, 113, .12); color: #fca5a5; }
.sidebar-backdrop { display: none; }

.avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--violet));
    color: #fff; font-weight: 700; font-size: 13px;
    display: inline-flex; align-items: center; justify-content: center;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

/* ============================ Topbar ============================ */
.topbar {
    height: var(--topbar-h); background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px; padding: 0 22px;
    position: sticky; top: 0; z-index: 50;
}
.hamburger { display: none; }
.page-title { font-size: 17px; font-weight: 700; margin: 0; white-space: nowrap; }
.topbar-search { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.topbar-search > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-mute); pointer-events: none; }
.topbar-search input {
    padding: 8px 14px 8px 38px; border-radius: 999px;
    background: var(--bg); border-color: transparent; font-size: 13px;
}
.topbar-search input:focus { background: #fff; border-color: var(--primary); }
.search-results {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); max-height: 420px; overflow-y: auto; z-index: 100;
    padding: 6px;
}
.sr-group { padding: 6px 10px 3px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text-mute); }
.sr-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.sr-item:hover { background: var(--primary-50); }
.sr-item .sr-title { font-weight: 600; font-size: 13px; }
.sr-item .sr-sub { font-size: 11.5px; color: var(--text-soft); }
.sr-empty { padding: 16px; text-align: center; color: var(--text-mute); font-size: 13px; }

.topbar-right { display: flex; align-items: center; gap: 6px; }
.notif-wrap, .profile-wrap { position: relative; }
.notif-badge {
    position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px;
    background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
    border-radius: 999px; display: flex; align-items: center; justify-content: center;
    padding: 0 4px; border: 2px solid #fff;
}
.notif-panel {
    position: absolute; right: 0; top: calc(100% + 10px); width: 340px;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); z-index: 110; overflow: hidden;
}
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.notif-item:hover { background: #f8fafc; }
.notif-item .ni-ico { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.ni-red { background: var(--red-bg); } .ni-orange { background: var(--orange-bg); }
.ni-blue { background: var(--blue-bg); } .ni-green { background: var(--green-bg); }
.notif-item .ni-title { font-weight: 600; color: var(--ink); }
.notif-item .ni-sub { color: var(--text-soft); font-size: 11.5px; }
.notif-empty { padding: 26px 14px; text-align: center; color: var(--text-mute); font-size: 13px; }

.profile-btn {
    display: flex; align-items: center; gap: 9px; padding: 5px 10px;
    background: none; border: 1px solid transparent; border-radius: 999px; cursor: pointer;
    font-family: inherit;
}
.profile-btn:hover { background: var(--border-soft); }
.profile-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.profile-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.profile-role { font-size: 10.5px; color: var(--text-soft); }
.profile-menu {
    position: absolute; right: 0; top: calc(100% + 10px); width: 200px;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 6px; z-index: 110;
}
.profile-menu a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--text); font-size: 13.5px; font-weight: 500; }
.profile-menu a:hover { background: var(--border-soft); }
.profile-menu .menu-danger { color: var(--red); }
.profile-menu .menu-danger:hover { background: var(--red-bg); }
.menu-sep { height: 1px; background: var(--border-soft); margin: 5px 8px; }

/* ============================ Cards & KPI ============================ */
.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 18px; margin-bottom: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.card-head .sub { color: var(--text-soft); font-size: 12.5px; margin-top: 2px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--kpi-color, var(--primary)); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--text-soft); text-transform: uppercase; letter-spacing: .5px; }
.kpi-ico { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 17px; background: color-mix(in srgb, var(--kpi-color, var(--primary)) 12%, #fff); }
.kpi-value { font-size: 24px; font-weight: 800; color: var(--ink); letter-spacing: -.3px; }
.kpi-sub { font-size: 11.5px; color: var(--text-mute); margin-top: 3px; }
.kpi-sub .up { color: var(--green); font-weight: 600; }
.kpi-sub .down { color: var(--red); font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 18px; }
.grid-2 .card, .grid-3 .card, .grid-2-1 .card, .grid-1-2 .card { margin-bottom: 18px; }

/* ============================ Tables ============================ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
    text-align: left; padding: 11px 14px; background: #f8fafc;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
    color: var(--text-soft); border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #f8fafc; }
table.data .t-main { font-weight: 600; color: var(--ink); }
table.data .t-sub { font-size: 11.5px; color: var(--text-soft); }
table.data th a { color: inherit; }
table.data th.sorted a { color: var(--primary); }

/* task row visual indicators */
tr.task-overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
tr.task-today td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
tr.task-upcoming td:first-child { box-shadow: inset 3px 0 0 #eab308; }
tr.task-completed td:first-child { box-shadow: inset 3px 0 0 var(--green); }
tr.task-completed .t-main { text-decoration: line-through; color: var(--text-soft); }

/* ============================ Toolbar / filters ============================ */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.toolbar input[type="search"], .toolbar input[type="text"], .toolbar select {
    width: auto; min-width: 150px; padding: 8px 12px; font-size: 13px;
}
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 20px; }
.page-head .sub { color: var(--text-soft); font-size: 13px; }

/* pagination */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 16px 0 4px; flex-wrap: wrap; }
.pagination a, .pagination span.pg-cur {
    min-width: 34px; height: 34px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px; border: 1px solid var(--border); background: #fff; color: var(--text);
    font-size: 13px; font-weight: 600;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination span.pg-cur { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .pg-dots { border: none; background: none; color: var(--text-mute); }

/* ============================ Empty state ============================ */
.empty-state { text-align: center; padding: 52px 20px; }
.empty-state .es-ico {
    width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 14px;
    background: var(--primary-50); color: var(--primary);
    display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.empty-state h3 { font-size: 16px; margin-bottom: 6px; }
.empty-state p { color: var(--text-soft); font-size: 13.5px; max-width: 380px; margin: 0 auto 18px; }

/* ============================ Modals ============================ */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(11, 18, 32, .55);
    backdrop-filter: blur(3px); z-index: 200;
    display: flex; align-items: center; justify-content: center; padding: 18px;
    animation: fadeIn .16s ease;
}
.modal-overlay[hidden] { display: none; }
.modal {
    background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 560px;
    box-shadow: var(--shadow-lg); animation: popIn .18s ease;
    max-height: calc(100vh - 36px); display: flex; flex-direction: column;
}
.modal.modal-sm { max-width: 420px; }
.modal.modal-lg { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-soft); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-x { background: none; border: none; font-size: 24px; line-height: 1; color: var(--text-mute); cursor: pointer; padding: 2px 6px; border-radius: 8px; }
.modal-x:hover { background: var(--border-soft); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border-soft); display: flex; justify-content: flex-end; gap: 10px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* confirm dialog */
.confirm-ico { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 12px; background: var(--red-bg); }
.confirm-ico.warn { background: var(--amber-bg); }

/* ============================ Toasts ============================ */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 500; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
    display: flex; align-items: flex-start; gap: 10px;
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: 13px 15px; font-size: 13.5px; border-left: 4px solid var(--primary);
    animation: slideIn .25s ease; min-width: 260px;
}
.toast .t-ico { font-size: 16px; line-height: 1.3; }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--amber); }
.toast.info { border-left-color: var(--primary); }
.toast.out { animation: slideOut .25s ease forwards; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } }
@keyframes slideOut { to { opacity: 0; transform: translateX(30px); } }

/* ============================ Tabs ============================ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab {
    padding: 10px 16px; font-size: 13.5px; font-weight: 600; color: var(--text-soft);
    border-bottom: 2.5px solid transparent; cursor: pointer; white-space: nowrap;
    background: none; border-top: none; border-left: none; border-right: none; font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn .2s ease; }

/* ============================ Kanban / Pipeline ============================ */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.kanban-col {
    background: #eef2f7; border-radius: var(--radius); min-width: 250px; width: 250px;
    flex-shrink: 0; display: flex; flex-direction: column; max-height: calc(100vh - 210px);
    border: 1px solid var(--border);
}
.kanban-col-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; font-size: 12.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; color: var(--text-soft); border-bottom: 1px solid var(--border);
}
.kanban-col-head .kc-count {
    background: #fff; border: 1px solid var(--border); border-radius: 999px;
    font-size: 11px; padding: 1px 8px; color: var(--text-soft);
}
.kanban-col-head .kc-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 7px; }
.kanban-col-body { padding: 10px; overflow-y: auto; flex: 1; min-height: 120px; }
.kanban-col.drag-over .kanban-col-body { background: var(--primary-50); border-radius: 0 0 var(--radius) var(--radius); outline: 2px dashed var(--primary); outline-offset: -4px; }
.kanban-col-total { padding: 8px 14px; font-size: 12px; font-weight: 700; color: var(--text-soft); border-top: 1px solid var(--border); }
.kcard {
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    padding: 12px; margin-bottom: 10px; cursor: grab; box-shadow: var(--shadow-sm);
    transition: box-shadow .15s, transform .15s;
}
.kcard:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kcard.dragging { opacity: .45; transform: rotate(2deg); }
.kcard .kc-title { font-weight: 700; font-size: 13.5px; color: var(--ink); margin-bottom: 3px; }
.kcard .kc-company { font-size: 12px; color: var(--text-soft); margin-bottom: 8px; }
.kcard .kc-value { font-weight: 800; color: var(--primary-dark); font-size: 13.5px; }
.kcard .kc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.kcard .kc-owner { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-soft); }
.kcard .kc-follow { font-size: 11px; color: var(--text-mute); }
.kcard .kc-follow.due { color: var(--orange); font-weight: 600; }

/* ============================ Calendar ============================ */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-title { font-size: 16px; font-weight: 800; color: var(--ink); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.cal-dow { padding: 9px 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-soft); background: #f8fafc; border-bottom: 1px solid var(--border); }
.cal-day {
    min-height: 104px; border-right: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft);
    padding: 7px 8px; cursor: pointer; transition: background .12s; position: relative; background: #fff;
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: var(--primary-50); }
.cal-day.other { background: #fafbfc; color: var(--text-mute); }
.cal-day.today .cal-num { background: var(--primary); color: #fff; }
.cal-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%; font-size: 12.5px; font-weight: 600; margin-bottom: 4px;
}
.cal-event {
    display: block; font-size: 11px; padding: 2.5px 7px; border-radius: 6px;
    margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    border-left: 3px solid;
}
.cal-event.ev-task { background: var(--blue-bg); border-color: var(--primary); color: #1e40af; }
.cal-event.ev-followup { background: var(--amber-bg); border-color: var(--amber); color: #92400e; }
.cal-event.ev-deal { background: var(--violet-bg); border-color: var(--violet); color: #6d28d9; }
.cal-event.ev-overdue { background: var(--red-bg); border-color: var(--red); color: #b91c1c; }
.cal-more { font-size: 10.5px; color: var(--primary); font-weight: 600; padding-left: 4px; }

.cal-week { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-week-row { display: flex; border-bottom: 1px solid var(--border-soft); }
.cal-week-row:last-child { border-bottom: none; }
.cal-week-date { width: 150px; flex-shrink: 0; padding: 12px 14px; font-weight: 600; font-size: 13px; border-right: 1px solid var(--border-soft); background: #f8fafc; }
.cal-week-date.today { background: var(--primary-50); color: var(--primary-dark); }
.cal-week-events { flex: 1; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.cal-week-empty { color: var(--text-mute); font-size: 12.5px; padding: 4px; }

/* ============================ Timeline ============================ */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
    position: absolute; left: -26px; top: 2px; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; border: 2px solid var(--primary); display: flex; align-items: center; justify-content: center;
    font-size: 9px; color: var(--primary);
}
.tl-dot.green { border-color: var(--green); color: var(--green); }
.tl-dot.red { border-color: var(--red); color: var(--red); }
.tl-dot.amber { border-color: var(--amber); color: var(--amber); }
.tl-title { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.tl-meta { font-size: 11.5px; color: var(--text-mute); margin-top: 1px; }
.tl-details { font-size: 13px; color: var(--text-soft); margin-top: 4px; background: #f8fafc; border-radius: 8px; padding: 8px 11px; }

/* ============================ Detail pages ============================ */
.detail-head {
    background: linear-gradient(120deg, var(--navy-800), var(--navy-700));
    border-radius: var(--radius-lg); color: #fff; padding: 22px 24px; margin-bottom: 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.detail-head h2 { color: #fff; font-size: 21px; margin: 0 0 4px; }
.detail-head .dh-sub { color: #94a3b8; font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; }
.detail-head .dh-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-head .btn-ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #e2e8f0; }
.detail-head .btn-ghost:hover { background: rgba(255,255,255,.16); }
.detail-head .btn-danger { background: #dc2626; border-color: transparent; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.info-item .ii-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-mute); margin-bottom: 3px; }
.info-item .ii-value { font-size: 14px; font-weight: 600; color: var(--ink); word-break: break-word; }

/* ============================ Charts ============================ */
.chart-box { position: relative; width: 100%; }
.chart-box canvas { width: 100%; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 10px; }
.legend .lg-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-soft); }
.legend .lg-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* list rows (recent leads etc.) */
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border-soft); }
.list-row:last-child { border-bottom: none; }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-title { font-weight: 600; font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .lr-sub { font-size: 11.5px; color: var(--text-soft); }
.list-row .lr-right { text-align: right; flex-shrink: 0; }

/* progress bar */
.progress { height: 7px; border-radius: 99px; background: var(--border-soft); overflow: hidden; }
.progress .bar { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), #60a5fa); }

/* ============================ LOGIN PAGE ============================ */
.login-body {
    background: radial-gradient(1200px 700px at 80% -10%, rgba(37, 99, 235, .18), transparent 60%),
                linear-gradient(135deg, var(--navy-900) 0%, var(--navy-800) 55%, #16223c 100%);
    min-height: 100vh; color: var(--text);
}
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-brand { display: flex; flex-direction: column; justify-content: space-between; padding: 46px 54px; color: #cbd5e1; }
.login-brand .brand-text { font-size: 15px; }
.brand-lg { display: inline-flex; align-items: center; gap: 12px; }
.login-headline { color: #fff; font-size: 36px; font-weight: 800; letter-spacing: -.5px; line-height: 1.18; margin: 64px 0 14px; }
.login-sub { color: #94a3b8; font-size: 15.5px; max-width: 430px; }
.login-points { list-style: none; padding: 0; margin: 34px 0 0; display: grid; gap: 13px; }
.login-points li { display: flex; align-items: center; gap: 12px; font-size: 14px; color: #cbd5e1; }
.lp-ico {
    width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    background: rgba(37, 99, 235, .18); border: 1px solid rgba(96, 165, 250, .25); font-size: 16px;
}
.login-brand-footer { color: #475569; font-size: 12.5px; }

.login-main { display: flex; align-items: center; justify-content: center; padding: 30px; }
.login-card {
    width: 100%; max-width: 430px; background: rgba(255, 255, 255, .97);
    border: 1px solid rgba(255, 255, 255, .5); border-radius: 20px;
    box-shadow: 0 24px 70px rgba(2, 6, 23, .55); padding: 34px 32px 26px;
    backdrop-filter: blur(12px);
}
.login-card.shake { animation: shake .4s ease; }
@keyframes shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-6px); }
    40%, 60% { transform: translateX(6px); }
}
.login-card-head { margin-bottom: 20px; }
.login-card-head h2 { font-size: 23px; margin-bottom: 4px; }
.login-card-head p { color: var(--text-soft); font-size: 13.5px; margin: 0; }
.input-icon { position: relative; }
.input-icon > svg:first-child { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-mute); pointer-events: none; }
.input-icon input { padding-left: 40px; padding-right: 42px; }
.pw-toggle {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-mute); cursor: pointer; padding: 6px; border-radius: 8px;
    display: inline-flex;
}
.pw-toggle:hover { color: var(--primary); background: var(--primary-50); }
.pw-toggle .ico-eye-off { display: none; }
.pw-toggle.on .ico-eye { display: none; }
.pw-toggle.on .ico-eye-off { display: block; }
.caps-warning {
    display: flex; align-items: center; gap: 6px; color: var(--amber);
    font-size: 12px; font-weight: 600; margin-top: 6px;
}
.caps-warning[hidden] { display: none; }
.login-row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 18px; }
.login-foot { text-align: center; color: var(--text-mute); font-size: 11.5px; margin: 18px 0 0; }

/* ============================ SETUP PAGE ============================ */
.setup-body {
    background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
    min-height: 100vh; padding: 34px 16px;
}
.setup-wrap { max-width: 760px; margin: 0 auto; }
.setup-card {
    background: #fff; border-radius: 20px; box-shadow: 0 24px 70px rgba(2, 6, 23, .5);
    padding: 34px;
}
.setup-head { text-align: center; margin-bottom: 22px; }
.setup-head h1 { font-size: 21px; letter-spacing: .4px; margin: 12px 0 4px; }
.setup-head h1 span { color: var(--primary); }
.setup-head p { color: var(--text-soft); margin: 0; font-size: 13.5px; }
.setup-section { font-size: 14px; margin: 24px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-soft); }
.check-list { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 8px; }
.check-list li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; padding: 9px 12px; border-radius: 10px; background: #f8fafc; border: 1px solid var(--border-soft); }
.check-list .ck { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; }
.check-list li.ok .ck { background: var(--green); }
.check-list li.bad .ck { background: var(--red); }
.check-list .ck-info { margin-left: auto; color: var(--text-mute); font-size: 11.5px; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setup-steps { padding-left: 20px; font-size: 13.5px; line-height: 2; }
.setup-note { text-align: center; color: var(--text-mute); font-size: 11.5px; margin-top: 14px; }

/* ============================ Error pages ============================ */
.error-body { background: linear-gradient(135deg, var(--navy-900), var(--navy-700)); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.error-wrap { width: 100%; max-width: 480px; }
.error-card { background: #fff; border-radius: 20px; padding: 42px 34px; text-align: center; box-shadow: 0 24px 70px rgba(2, 6, 23, .5); }
.error-code { font-size: 56px; font-weight: 800; color: var(--primary); letter-spacing: -2px; }
.error-card h1 { font-size: 20px; }
.error-card p { color: var(--text-soft); font-size: 13.5px; }
.error-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }

/* ============================ Utilities ============================ */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.w-100 { width: 100%; }
.money { font-weight: 700; font-variant-numeric: tabular-nums; }

/* tooltips */
[data-tip] { position: relative; }
[data-tip]:hover::after {
    content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    background: var(--navy-800); color: #fff; font-size: 11px; padding: 5px 9px; border-radius: 7px;
    white-space: nowrap; z-index: 300; pointer-events: none;
}

/* skeleton loading */
.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #e2e8f0 50%, #eef2f7 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================ Responsive ============================ */
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; height: 100vh;
        transform: translateX(-105%); transition: transform .25s ease;
        box-shadow: none;
    }
    body.sidebar-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(11,18,32,.5); z-index: 55; }
    .sidebar-close { display: inline-flex; }
    .hamburger { display: inline-flex; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .profile-meta { display: none; }
}
@media (max-width: 720px) {
    .content { padding: 14px 12px 24px; }
    .topbar { padding: 0 12px; gap: 8px; }
    .page-title { font-size: 15px; max-width: 32vw; overflow: hidden; text-overflow: ellipsis; }
    .topbar-search { max-width: none; }
    .topbar-search input { padding: 7px 12px 7px 34px; }
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kpi { padding: 13px 14px; }
    .kpi-value { font-size: 19px; }
    .grid-2, .grid-3, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .detail-head { padding: 18px; }
    .toolbar input[type="search"], .toolbar input[type="text"], .toolbar select { min-width: 0; width: 100%; }
    .toolbar { display: grid; grid-template-columns: 1fr 1fr; }
    .toolbar .spacer { display: none; }
    .toolbar > .btn { grid-column: 1 / -1; }
    .cal-day { min-height: 74px; padding: 4px 5px; }
    .cal-event { font-size: 9.5px; padding: 1.5px 4px; }
    .cal-week-row { flex-direction: column; }
    .cal-week-date { width: 100%; border-right: none; border-bottom: 1px solid var(--border-soft); }
    .notif-panel { width: calc(100vw - 30px); right: -60px; }
    table.data { font-size: 12.5px; }
    table.data th, table.data td { padding: 9px 10px; }
    .modal { max-width: 100%; }
    .login-card { padding: 26px 20px; }
}

/* ============================ Print ============================ */
@media print {
    .sidebar, .topbar, .toolbar, .app-footer, .toast-container, .btn, .pagination, .no-print { display: none !important; }
    body { background: #fff; }
    .content { padding: 0; max-width: none; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
    .table-wrap { overflow: visible; border: none; }
    table.data th { background: #eee; }
}
