/* ============================================
   NIMBUS CRM — Modern Light SaaS Theme
   Distinctive teal + slate palette
   ============================================ */

:root {
    --c-bg:        #F6F8FB;
    --c-surface:   #FFFFFF;
    --c-border:    #E5EAF2;
    --c-text:      #0F172A;
    --c-text-soft: #475569;
    --c-text-mute: #94A3B8;

    --c-primary:        #0F766E;   /* deep teal */
    --c-primary-hover:  #115E59;
    --c-primary-soft:   #CCFBF1;
    --c-primary-100:    #F0FDFA;

    --c-accent:    #F59E0B;        /* amber accent for highlights */
    --c-info:      #2563EB;
    --c-success:   #16A34A;
    --c-warning:   #D97706;
    --c-danger:    #DC2626;

    --c-sidebar:   #0F172A;        /* slate-900 */
    --c-sidebar-hover: #1E293B;
    --c-sidebar-active: #134E4A;

    --radius:     12px;
    --radius-sm:  8px;
    --radius-lg:  16px;

    --shadow-sm:  0 1px 2px rgba(15,23,42,0.04);
    --shadow:     0 4px 12px rgba(15,23,42,0.06);
    --shadow-lg:  0 12px 32px rgba(15,23,42,0.10);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-hover); }

button { font-family: inherit; cursor: pointer; }

/* ============ App Shell ============ */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 248px;
    background: var(--c-sidebar);
    color: #CBD5E1;
    padding: 20px 14px;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 14px;
}
.sidebar-brand .logo-dot {
    width: 32px; height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, #14B8A6, #0F766E);
    display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 16px;
    box-shadow: 0 4px 12px rgba(20,184,166,0.35);
}
.sidebar-brand .brand-name {
    color: #fff; font-weight: 700; font-size: 16px; letter-spacing: -0.01em;
}
.sidebar-brand .brand-sub {
    color: #64748B; font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
}

.sidebar-nav { list-style: none; padding: 0; margin: 0; flex: 1; overflow-y: auto; }
.sidebar-nav .nav-section {
    color: #64748B;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 14px 12px 6px;
    font-weight: 600;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: #CBD5E1;
    font-weight: 500;
    font-size: 13.5px;
    margin-bottom: 2px;
}
.sidebar-nav a:hover { background: var(--c-sidebar-hover); color: #fff; }
.sidebar-nav a.active {
    background: var(--c-sidebar-active);
    color: #5EEAD4;
}
.sidebar-nav a i { width: 16px; text-align: center; opacity: 0.9; }

.sidebar-foot {
    padding: 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
    color: #94A3B8;
    font-size: 12px;
}
.sidebar-foot strong { color: #fff; display: block; }

/* ============ Main ============ */
.main {
    flex: 1;
    margin-left: 248px;
    min-width: 0;
}

.topbar {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar h1 {
    font-size: 18px; margin: 0; font-weight: 700;
    letter-spacing: -0.01em;
}
.topbar .crumbs { color: var(--c-text-mute); font-size: 12px; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px 6px 6px;
    border-radius: 999px;
    background: var(--c-primary-100);
    color: var(--c-primary);
    font-weight: 600;
    font-size: 13px;
}
.user-chip .avatar {
    width: 28px; height: 28px;
    background: var(--c-primary);
    color: #fff;
    border-radius: 999px;
    display: grid; place-items: center;
    font-size: 12px; font-weight: 700;
}
.menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 16px;
    color: var(--c-text);
}

.content { padding: 28px; }

/* ============ Cards ============ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    overflow: hidden;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card .label {
    color: var(--c-text-soft);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 8px;
}
.stat-card .value {
    font-size: 28px; font-weight: 700; letter-spacing: -0.02em;
    color: var(--c-text);
}
.stat-card .icon-wrap {
    position: absolute; top: 14px; right: 14px;
    width: 36px; height: 36px;
    border-radius: 10px;
    display: grid; place-items: center;
    background: var(--c-primary-100);
    color: var(--c-primary);
    font-size: 15px;
}
.stat-card.accent .icon-wrap { background: #FEF3C7; color: var(--c-warning); }
.stat-card.info .icon-wrap   { background: #DBEAFE; color: var(--c-info); }
.stat-card.success .icon-wrap{ background: #DCFCE7; color: var(--c-success); }
.stat-card.danger .icon-wrap { background: #FEE2E2; color: var(--c-danger); }

/* ============ Generic card ============ */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.card-header h3 { margin: 0; font-size: 15px; font-weight: 700; }
.card-body { padding: 16px 20px; }
.card-body.tight { padding: 0; }

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.15s ease;
    background: var(--c-surface);
    color: var(--c-text);
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-hover); color: #fff; }
.btn-outline { border-color: var(--c-border); color: var(--c-text); }
.btn-outline:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; color: #fff; }
.btn-ghost { background: transparent; color: var(--c-text-soft); }
.btn-ghost:hover { background: var(--c-bg); color: var(--c-text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ============ Forms ============ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
    font-size: 12px; font-weight: 600;
    color: var(--c-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.form-control, select.form-control, textarea.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    color: var(--c-text);
    font-size: 13.5px;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(15,118,110,0.12);
}
textarea.form-control { min-height: 90px; resize: vertical; }
.form-error { color: var(--c-danger); font-size: 12px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }

/* ============ Tables ============ */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.table th, .table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--c-border);
    vertical-align: middle;
}
.table th {
    font-weight: 600;
    color: var(--c-text-soft);
    background: #F8FAFC;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.table tbody tr:hover { background: #FAFBFD; }
.table .actions { display: flex; gap: 6px; }

/* ============ Badges ============ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}
.b-new           { background: #DBEAFE; color: #1D4ED8; }
.b-contacted     { background: #E0E7FF; color: #4338CA; }
.b-follow-up     { background: #FEF3C7; color: #B45309; }
.b-interested    { background: #CCFBF1; color: #0F766E; }
.b-not-interested{ background: #FEE2E2; color: #B91C1C; }
.b-converted     { background: #DCFCE7; color: #15803D; }
.b-lost          { background: #F1F5F9; color: #475569; }
.b-pending       { background: #FEF3C7; color: #B45309; }
.b-in-progress   { background: #DBEAFE; color: #1D4ED8; }
.b-completed     { background: #DCFCE7; color: #15803D; }
.b-missed        { background: #FEE2E2; color: #B91C1C; }
.b-high          { background: #FEE2E2; color: #B91C1C; }
.b-medium        { background: #FEF3C7; color: #B45309; }
.b-low           { background: #F1F5F9; color: #475569; }
.b-active        { background: #DCFCE7; color: #15803D; }
.b-inactive      { background: #F1F5F9; color: #64748B; }

/* ============ Filters Row ============ */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 20px;
    background: #F8FAFC;
    border-bottom: 1px solid var(--c-border);
    border-radius: var(--radius) var(--radius) 0 0;
}
.filters .form-control { padding: 7px 10px; font-size: 13px; }
.filters .grow { flex: 1; min-width: 200px; }

/* ============ Empty / Loading ============ */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--c-text-mute);
}
.empty i { font-size: 36px; color: var(--c-text-mute); display: block; margin-bottom: 12px; }
.empty h4 { margin: 0 0 6px; color: var(--c-text); font-size: 16px; }
.empty p { margin: 0; font-size: 13px; }

/* ============ Toast / Alerts ============ */
.toast-stack { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--c-surface);
    border-left: 4px solid var(--c-primary);
    padding: 12px 16px 12px 14px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.25s ease;
}
.toast.success { border-color: var(--c-success); }
.toast.error   { border-color: var(--c-danger); }
.toast i { color: var(--c-success); }
.toast.error i { color: var(--c-danger); }
@keyframes slideIn {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* ============ Modal ============ */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(15,23,42,0.45);
    display: none; align-items: center; justify-content: center; z-index: 9000;
    backdrop-filter: blur(2px);
}
.modal-backdrop.show { display: flex; }
.modal {
    background: var(--c-surface);
    border-radius: var(--radius);
    width: min(440px, 90vw);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--c-border); font-weight: 700; }
.modal-body { padding: 18px 20px; color: var(--c-text-soft); }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--c-border); display: flex; gap: 8px; justify-content: flex-end; }

/* ============ Auth ============ */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--c-bg);
}
.auth-pane {
    padding: 48px;
    display: flex; flex-direction: column; justify-content: center;
}
.auth-side {
    background: linear-gradient(135deg, #0F766E 0%, #134E4A 100%);
    color: #fff;
    padding: 56px;
    display: flex; flex-direction: column; justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.auth-side::before {
    content: '';
    position: absolute;
    top: -120px; right: -120px;
    width: 360px; height: 360px;
    background: radial-gradient(circle, rgba(94,234,212,0.35) 0%, transparent 70%);
    border-radius: 50%;
}
.auth-side::after {
    content: '';
    position: absolute;
    bottom: -140px; left: -80px;
    width: 320px; height: 320px;
    background: radial-gradient(circle, rgba(245,158,11,0.25) 0%, transparent 70%);
    border-radius: 50%;
}
.auth-side > * { position: relative; z-index: 1; }
.auth-side h2 {
    font-size: 30px; font-weight: 700; line-height: 1.2;
    letter-spacing: -0.02em; margin: 0 0 12px;
}
.auth-side p { color: #99F6E4; font-size: 14px; max-width: 380px; }
.auth-side .stat-row { display: flex; gap: 28px; margin-top: 28px; }
.auth-side .stat-row div { font-size: 24px; font-weight: 700; }
.auth-side .stat-row div span { display: block; font-size: 11px; font-weight: 500; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }

.auth-form { max-width: 380px; width: 100%; margin: 0 auto; }
.auth-form h1 { font-size: 26px; margin: 0 0 8px; letter-spacing: -0.02em; }
.auth-form p.sub { color: var(--c-text-soft); margin-bottom: 28px; }

.demo-creds {
    margin-top: 22px; padding: 14px;
    background: var(--c-primary-100);
    border: 1px dashed var(--c-primary);
    border-radius: var(--radius-sm);
    font-size: 12px; color: var(--c-primary);
}
.demo-creds strong { display: block; margin-bottom: 6px; }
.demo-creds code { background: rgba(15,118,110,0.1); padding: 1px 6px; border-radius: 4px; }

/* ============ Pagination ============ */
.pagination {
    display: flex; gap: 4px;
    list-style: none; padding: 14px 20px; margin: 0;
    justify-content: center;
}
.pagination li a, .pagination li span {
    display: inline-block;
    padding: 6px 11px;
    border-radius: 6px;
    color: var(--c-text-soft);
    text-decoration: none;
    font-size: 13px;
}
.pagination li.active span { background: var(--c-primary); color: #fff; }
.pagination li a:hover { background: var(--c-primary-100); color: var(--c-primary); }

/* ============ Charts (custom bar) ============ */
.bar-chart { display: flex; gap: 10px; align-items: flex-end; height: 180px; padding-top: 18px; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar-chart .bar {
    width: 100%; max-width: 38px;
    background: linear-gradient(180deg, #14B8A6, #0F766E);
    border-radius: 6px 6px 2px 2px;
    transition: opacity 0.2s ease;
    min-height: 3px;
}
.bar-chart .bar:hover { opacity: 0.8; }
.bar-chart .bar-label { font-size: 11px; color: var(--c-text-mute); }
.bar-chart .bar-value { font-size: 11px; color: var(--c-text); font-weight: 600; }

.donut-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.donut-item {
    padding: 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: #FAFBFD;
}
.donut-item .num { font-size: 22px; font-weight: 700; color: var(--c-text); }
.donut-item .lbl { font-size: 11px; color: var(--c-text-soft); text-transform: capitalize; margin-top: 4px; }

/* ============ Mobile ============ */
@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .content { padding: 18px; }
    .topbar { padding: 12px 18px; }
}
@media (max-width: 600px) {
    .stat-card .value { font-size: 22px; }
    .topbar h1 { font-size: 15px; }
    .table th, .table td { padding: 10px 12px; font-size: 12.5px; }
}

/* ============ Misc ============ */
.text-mute { color: var(--c-text-mute); }
.text-soft { color: var(--c-text-soft); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }
.hidden { display: none !important; }
