:root {
    --app-bg: #f6f8fb;
    --surface: #ffffff;
    --surface-soft: #f9fafc;
    --ink: #182230;
    --muted: #667085;
    --line: #e4e7ec;
    --nav: #ffffff;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #0f766e;
    --danger: #c24130;
    --warning: #b45309;
    --shadow: 0 14px 32px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--app-bg);
    color: var(--ink);
    font-family: Inter, Arial, Helvetica, sans-serif;
    font-size: 14px;
}
a { color: inherit; text-decoration: none; }
.sidebar {
    position: fixed;
    inset: 16px auto 16px 16px;
    width: 252px;
    background: var(--nav);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    box-shadow: var(--shadow);
    overflow-y: auto;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 18px;
    font-size: 16px;
    font-weight: 800;
}
.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
}
.sidebar nav { display: grid; gap: 4px; }
.sidebar a {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 9px 11px;
    border-radius: 8px;
    color: #475467;
    font-weight: 650;
}
.sidebar a:hover { background: #f2f4f7; color: var(--ink); }
.sidebar a.active {
    background: #eaf1ff;
    color: var(--primary-dark);
}
.main { margin-left: 284px; padding: 22px 24px 28px; }
.auth-main {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(180deg, #eef4ff, #f8fafc);
}
.topbar {
    min-height: 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    margin-bottom: 14px;
}
.user-pill {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 2px 0 18px;
}
.page-head h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: 0;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.panel, .auth-card, .metric {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.panel.wide { max-width: 1120px; }
.auth-card {
    width: min(440px, 100%);
    box-shadow: var(--shadow);
}
h1, h2 { margin: 0 0 14px; letter-spacing: 0; }
h2 { font-size: 16px; font-weight: 800; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 16px; }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.metric span { display: block; color: var(--muted); margin-bottom: 8px; font-weight: 650; }
.metric strong { font-size: 30px; line-height: 1; }
.crm-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.crm-metric {
    margin-bottom: 0;
}
.crm-metric em {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-style: normal;
}
.form-grid { display: grid; gap: 12px; }
.form-grid.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
}
.lead-form {
    display: grid;
    gap: 16px;
}
.lead-form .form-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.lead-form .wide-field {
    grid-column: 1 / -1;
}
.lead-form textarea {
    min-height: 130px;
}
.form-row, .inline-card {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
label { display: grid; gap: 6px; color: var(--muted); font-weight: 650; }
input, select, textarea {
    width: 100%;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
    color: var(--ink);
    min-height: 42px;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: 3px solid #dbeafe;
    border-color: var(--primary);
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    padding: 10px 14px;
    min-height: 42px;
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
}
.btn:hover { background: #f9fafb; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.success { background: #e6f6f3; color: var(--success); border-color: #b8e4dc; }
.btn.danger { background: #fff1f0; color: var(--danger); border-color: #ffc9c3; }
.btn.ghost { background: #fff; color: var(--muted); }
.btn.small { padding: 7px 10px; min-height: 34px; font-size: 12px; }
.icon-btn { font-size: 15px; }
.flash {
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
    background: #ecfdf3;
    color: #067647;
    border: 1px solid #abefc6;
}
.flash.bad { background: #fef3f2; color: var(--danger); border-color: #fecdca; }
.task, .mini-row, .comment {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 0;
    border-top: 1px solid var(--line);
}
.task:first-child, .mini-row:first-child, .comment:first-child { border-top: 0; }
.task span, .lead-card span, .rowlink span, .comment span, .client-row span {
    display: block;
    color: var(--muted);
    margin-top: 5px;
    font-size: 12px;
}
.task.completed strong { text-decoration: line-through; color: var(--muted); }
.actions { display: flex; gap: 8px; align-items: center; }
.rowlink {
    display: block;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}
.kanban {
    display: grid;
    grid-template-columns: repeat(7, minmax(240px, 1fr));
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
}
.kanban.four { grid-template-columns: repeat(4, minmax(270px, 1fr)); }
.implementation-board { grid-template-columns: repeat(7, minmax(240px, 1fr)); }
.column {
    background: #f1f4f8;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    min-height: 300px;
}
.column h2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    color: #344054;
    margin-bottom: 12px;
}
.column h2 span {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 9px;
    color: var(--muted);
    font-size: 12px;
}
.lead-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 13px;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
.lead-card:hover { border-color: #b9c7da; }
.lead-card-meta {
    color: var(--muted);
    font-size: 12px;
    margin-top: 6px;
}
.lead-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 11px;
}
.lead-card-grid div {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 9px;
}
.lead-card-grid span,
.lead-next span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 4px;
}
.lead-card-grid strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lead-next {
    margin-top: 10px;
    border-left: 3px solid #d0d5dd;
    background: #f9fafb;
    border-radius: 9px;
    padding: 9px 10px;
}
.lead-next.today { border-left-color: var(--primary); background: #eef4ff; }
.lead-next.overdue { border-left-color: var(--danger); background: #fff1f0; }
.lead-next strong {
    display: block;
    font-size: 13px;
}
.lead-next em {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}
.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}
.lead-card .date { color: var(--warning); }
.card-actions { display: grid; gap: 8px; margin-top: 11px; }
.card-actions form { margin: 0; }
.lead-card-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}
.lead-card-buttons .btn {
    width: 100%;
}
.move-form { margin-top: 10px; }
.empty-column {
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: 18px;
    color: var(--muted);
    text-align: center;
    background: rgba(255,255,255,.5);
}
.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 800;
    background: #f2f4f7;
    color: #475467;
}
.badge.hot, .badge.billing { background: #fff4de; color: var(--warning); }
.badge.warm { background: #e0f2fe; color: #0e7490; }
.badge.cold, .badge.dead { background: #f2f4f7; color: #475467; }
.badge.open { background: #eaf1ff; color: var(--primary-dark); }
.notice {
    display: grid;
    gap: 8px;
    background: #fffaeb;
    border: 1px solid #fedf89;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}
.check { display: flex; align-items: center; gap: 6px; }
.check input { width: auto; min-height: 0; }
.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.detail-grid div {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
}
.detail-grid span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.table-list { display: grid; gap: 10px; }
.client-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.5fr) auto 150px 160px minmax(160px, .8fr);
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 13px;
    background: #fff;
}
.compact-action { margin: 0; }
.lead-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 16px;
    align-items: start;
}
.lead-profile-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}
.lead-profile-head h2 {
    margin: 5px 0 0;
    font-size: 28px;
}
.lead-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.lead-info-grid div {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 12px;
}
.lead-info-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 5px;
}
.notes-panel {
    margin-top: 18px;
}
.note-item {
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 12px;
    margin-top: 10px;
    background: #fff;
}
.note-item div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
}
.note-item p {
    margin: 10px 0 0;
}
.lead-action-panel {
    position: sticky;
    top: 18px;
}
.lead-action-form {
    display: grid;
    gap: 12px;
}
.lead-action-form textarea {
    min-height: 110px;
}
.lead-decision-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}
.lead-decision-buttons form,
.lead-decision-buttons button {
    width: 100%;
}
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.section-head h2 { margin: 0; }
.employee-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.form-section {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
}
.form-section h3 {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 14px;
    font-weight: 800;
}
.form-section.full, .form-actions { grid-column: 1 / -1; }
.form-note { grid-column: 1 / -1; margin: 0; }
.employee-active { align-self: end; min-height: 42px; }
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.employee-list { display: grid; gap: 10px; }
.employee-row {
    display: grid;
    grid-template-columns: 130px minmax(220px, 1fr) minmax(180px, 1fr) auto;
    gap: 12px;
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
}
.employee-avatar {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #eaf1ff;
    color: var(--primary-dark);
    font-weight: 900;
}
.employee-main span,
.employee-row div > span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}
@media (max-width: 1100px) {
    .three, .metric-grid, .detail-grid, .crm-summary, .lead-workbench { grid-template-columns: 1fr; }
    .client-row { grid-template-columns: 1fr; }
    .employee-form { grid-template-columns: 1fr; }
    .employee-row { grid-template-columns: 1fr auto; }
    .employee-row > div { grid-column: 1 / -1; }
    .employee-row > a { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
    .sidebar {
        position: static;
        width: auto;
        margin: 12px;
        border-radius: 12px;
    }
    .main { margin-left: 0; padding: 14px; }
    .form-grid.compact { grid-template-columns: 1fr; }
    .form-section { grid-template-columns: 1fr; }
    .topbar, .task, .mini-row, .page-head {
        align-items: flex-start;
        flex-direction: column;
    }
}

