:root {
    --bg: #f3f5f8;
    --surface: #ffffff;
    --surface-soft: #f7f9fb;
    --surface-hover: #f0f3f6;
    --sidebar: #0d1513;
    --sidebar-text: #aab7b2;
    --sidebar-border: rgba(255, 255, 255, .07);
    --text: #17201e;
    --text-soft: #6d7975;
    --border: #e3e8e6;
    --brand: #36c66a;
    --brand-dark: #25a955;
    --brand-soft: rgba(54, 198, 106, .13);
    --blue: #4c8dff;
    --purple: #9b6dff;
    --orange: #f59d47;
    --cyan: #35b8bd;
    --shadow: 0 8px 26px rgba(19, 33, 29, .06);
    --radius: 16px;
}

[data-theme="dark"] {
    --bg: #0c1211;
    --surface: #121a18;
    --surface-soft: #17211e;
    --surface-hover: #1b2723;
    --sidebar: #0a100f;
    --sidebar-text: #92a09b;
    --sidebar-border: rgba(255, 255, 255, .07);
    --text: #eef5f2;
    --text-soft: #8f9d98;
    --border: #22302c;
    --brand-soft: rgba(54, 198, 106, .12);
    --shadow: 0 12px 34px rgba(0, 0, 0, .18);
}

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

html { scroll-behavior: smooth; }

body {
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    transition: background .25s ease, color .25s ease;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: flex;
    width: 250px;
    flex-direction: column;
    overflow-y: auto;
    background: var(--sidebar);
    border-right: 1px solid var(--sidebar-border);
    transition: transform .28s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 78px;
    padding: 0 22px;
    border-bottom: 1px solid var(--sidebar-border);
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    color: #07110c;
    background: var(--brand);
    border-radius: 11px;
    box-shadow: 0 7px 20px rgba(54, 198, 106, .2);
}

.brand-mark svg { width: 22px; height: 22px; stroke-width: 2; }
.brand strong { display: block; color: #f7fbf9; font-size: 16px; line-height: 1.2; }
.brand span { color: #7f918a; font-size: 11px; letter-spacing: .04em; }

.nav-menu { flex: 1; padding: 14px 12px; }
.nav-label { padding: 18px 12px 8px; color: #5e7069; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 43px;
    margin: 2px 0;
    padding: 0 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 10px;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; }
.nav-item:hover { color: #e9f2ee; background: rgba(255, 255, 255, .055); transform: translateX(2px); }
.nav-item.active { color: #fff; background: rgba(54, 198, 106, .14); }
.nav-item.active::before { position: absolute; left: 0; width: 3px; height: 20px; background: var(--brand); border-radius: 0 4px 4px 0; content: ""; }
.nav-item.active svg { color: var(--brand); }
.nav-badge { margin-left: auto; min-width: 20px; padding: 1px 6px; color: #09140e; background: var(--brand); border-radius: 20px; font-size: 10px; font-weight: 700; text-align: center; }

.sidebar-footer { padding: 10px 12px 14px; border-top: 1px solid var(--sidebar-border); }
.user-card { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 12px 8px 2px; }
.avatar { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; color: #092013; background: linear-gradient(145deg, #58df87, #28b85c); border-radius: 50%; font-size: 11px; font-weight: 800; }
.user-info { min-width: 0; flex: 1; }
.user-info strong, .user-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-info strong { color: #e9f2ef; font-size: 12px; }
.user-info span { color: #6f817a; font-size: 10px; }
.sidebar .icon-button { color: #6f817a; border-color: transparent; }

.main-content { min-height: 100vh; margin-left: 250px; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; height: 78px; padding: 0 32px; background: color-mix(in srgb, var(--bg) 90%, transparent); border-bottom: 1px solid var(--border); backdrop-filter: blur(16px); }
.search-box { display: flex; align-items: center; gap: 10px; width: min(520px, 46vw); height: 42px; padding: 0 13px; color: var(--text-soft); background: var(--surface); border: 1px solid var(--border); border-radius: 11px; transition: border .2s, box-shadow .2s; }
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-box svg { width: 17px; height: 17px; }
.search-box input { width: 100%; color: var(--text); background: transparent; border: 0; outline: 0; }
.search-box input::placeholder { color: var(--text-soft); }
.search-box kbd { padding: 2px 7px; color: var(--text-soft); background: var(--surface-soft); border: 1px solid var(--border); border-radius: 5px; font-family: inherit; font-size: 10px; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }

.icon-button, .primary-button, .secondary-button, .text-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    border: 0;
    transition: transform .18s, background .18s, border .18s;
}

.icon-button { position: relative; width: 40px; height: 40px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.icon-button:hover { background: var(--surface-hover); transform: translateY(-1px); }
.icon-button.compact { width: 32px; height: 32px; background: transparent; }
.icon-button.compact svg { width: 17px; }
.notification-dot { position: absolute; top: 9px; right: 9px; width: 6px; height: 6px; background: var(--orange); border: 2px solid var(--surface); border-radius: 50%; }
.primary-button, .secondary-button { height: 42px; padding: 0 16px; border-radius: 10px; font-weight: 650; }
.primary-button { color: #07130b; background: var(--brand); box-shadow: 0 6px 15px rgba(54, 198, 106, .15); }
.primary-button:hover { background: var(--brand-dark); transform: translateY(-1px); }
.primary-button svg, .secondary-button svg { width: 17px; height: 17px; stroke-width: 2.2; }
.secondary-button { color: var(--text); background: var(--surface); border: 1px solid var(--border); }
.secondary-button:hover { background: var(--surface-hover); }
.text-button { padding: 0; color: var(--brand); background: transparent; font-size: 12px; font-weight: 700; }
.menu-button, .mobile-primary { display: none; }
.sun-icon { display: none; }
[data-theme="light"] .sun-icon { display: block; }
[data-theme="light"] .moon-icon { display: none; }

.page-shell { max-width: 1600px; margin: 0 auto; padding: 31px 32px 45px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 27px; animation: rise .45s ease both; }
.eyebrow { margin-bottom: 5px; color: var(--brand) !important; font-size: 11px !important; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.page-heading h1 { margin-bottom: 4px; font-size: clamp(25px, 3vw, 32px); line-height: 1.25; letter-spacing: -.025em; }
.page-heading p { color: var(--text-soft); font-size: 13px; }
.heading-actions { display: flex; gap: 9px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 17px; }
.stat-card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-card { min-width: 0; padding: 19px 20px; animation: rise .5s ease both; }
.stat-card:nth-child(2) { animation-delay: .05s; }
.stat-card:nth-child(3) { animation-delay: .1s; }
.stat-card:nth-child(4) { animation-delay: .15s; }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.stat-icon, .quick-icon { display: grid; place-items: center; border-radius: 10px; }
.stat-icon { width: 38px; height: 38px; }
.stat-icon svg { width: 18px; height: 18px; }
.green { color: var(--brand); background: rgba(54, 198, 106, .12); }
.blue { color: var(--blue); background: rgba(76, 141, 255, .12); }
.purple { color: var(--purple); background: rgba(155, 109, 255, .12); }
.orange { color: var(--orange); background: rgba(245, 157, 71, .12); }
.cyan { color: var(--cyan); background: rgba(53, 184, 189, .12); }
.trend { padding: 3px 7px; border-radius: 6px; font-size: 10px; font-weight: 700; }
.trend.positive { color: var(--brand); background: var(--brand-soft); }
.trend.neutral { color: var(--text-soft); background: var(--surface-soft); }
.stat-card > p { margin-bottom: 1px; color: var(--text-soft); font-size: 12px; }
.stat-card > strong { display: block; overflow: hidden; margin-bottom: 2px; font-size: clamp(23px, 2.5vw, 28px); letter-spacing: -.03em; text-overflow: ellipsis; }
.stat-note { color: var(--text-soft); font-size: 10px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(285px, .85fr); gap: 17px; }
.panel { min-height: 255px; padding: 20px; animation: rise .5s .12s ease both; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 21px; }
.panel-header h2 { font-size: 15px; letter-spacing: -.01em; }
.panel-header p { margin-top: 2px; color: var(--text-soft); font-size: 10px; }
.panel-header > a { display: flex; align-items: center; gap: 2px; color: var(--brand); font-size: 11px; font-weight: 700; text-decoration: none; }
.panel-header > a svg { width: 14px; height: 14px; }

.pipeline-track { display: grid; grid-template-columns: repeat(5, 1fr); gap: 15px; }
.stage-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; font-size: 10px; }
.stage-heading span { display: flex; align-items: center; gap: 6px; color: var(--text-soft); white-space: nowrap; }
.stage-heading strong { font-size: 12px; }
.stage-dot { width: 6px; height: 6px; border-radius: 50%; }
.stage-dot.green, .stage-bar span.green { background: var(--brand); }
.stage-dot.cyan, .stage-bar span.cyan { background: var(--cyan); }
.stage-dot.blue, .stage-bar span.blue { background: var(--blue); }
.stage-dot.purple, .stage-bar span.purple { background: var(--purple); }
.stage-dot.orange, .stage-bar span.orange { background: var(--orange); }
.stage-bar { height: 5px; overflow: hidden; background: var(--surface-soft); border-radius: 10px; }
.stage-bar span { display: block; min-width: 4px; height: 100%; border-radius: inherit; }

.quick-actions { display: grid; gap: 7px; }
.quick-actions button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px; color: var(--text); text-align: left; cursor: pointer; background: transparent; border: 0; border-radius: 10px; transition: background .18s; }
.quick-actions button:hover { background: var(--surface-soft); }
.quick-icon { width: 34px; height: 34px; flex: 0 0 auto; }
.quick-icon svg { width: 16px; height: 16px; }
.quick-actions button > span:nth-child(2) { flex: 1; }
.quick-actions strong, .quick-actions small { display: block; }
.quick-actions strong { font-size: 11px; }
.quick-actions small { margin-top: 1px; color: var(--text-soft); font-size: 9px; }
.quick-actions .chevron { width: 15px; height: 15px; color: var(--text-soft); }

.empty-state { display: flex; min-height: 155px; flex-direction: column; align-items: center; justify-content: center; padding: 16px; text-align: center; }
.empty-icon { display: grid; width: 42px; height: 42px; margin-bottom: 11px; place-items: center; color: var(--brand); background: var(--brand-soft); border-radius: 50%; }
.empty-icon svg { width: 19px; height: 19px; }
.empty-state strong { font-size: 12px; }
.empty-state p { max-width: 280px; margin: 4px 0 11px; color: var(--text-soft); font-size: 10px; }
.compact-empty { min-height: auto; flex-direction: row; justify-content: flex-start; gap: 12px; margin-top: 21px; padding: 12px 14px; background: var(--surface-soft); border: 1px dashed var(--border); border-radius: 11px; text-align: left; }
.compact-empty .empty-icon { width: 34px; height: 34px; margin: 0; flex: 0 0 auto; }
.compact-empty > div:nth-child(2) { flex: 1; }
.compact-empty p { max-width: none; margin: 1px 0 0; }

.task-list, .activity-list { display: grid; }
.task-row, .activity-row { display: flex; align-items: center; gap: 11px; padding: 11px 3px; border-bottom: 1px solid var(--border); }
.task-row:last-child, .activity-row:last-child { border-bottom: 0; }
.task-check { width: 17px; height: 17px; flex: 0 0 auto; border: 1px solid var(--border); border-radius: 5px; }
.task-row div, .activity-row div { flex: 1; }
.task-row strong, .task-row small { display: block; }
.task-row strong { font-size: 11px; }
.task-row small, .task-row time, .activity-row time { color: var(--text-soft); font-size: 9px; }
.activity-dot { width: 7px; height: 7px; flex: 0 0 auto; background: var(--brand); border-radius: 50%; box-shadow: 0 0 0 5px var(--brand-soft); }
.activity-row p { font-size: 11px; }

.mobile-overlay { display: none; }

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

@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 780px) {
    .sidebar { transform: translateX(-100%); box-shadow: 20px 0 50px rgba(0, 0, 0, .25); }
    .sidebar.open { transform: translateX(0); }
    .mobile-overlay.open { position: fixed; inset: 0; z-index: 35; display: block; background: rgba(0, 0, 0, .52); backdrop-filter: blur(2px); }
    .main-content { margin-left: 0; }
    .topbar { height: 66px; padding: 0 17px; }
    .menu-button { display: inline-flex; }
    .search-box { width: 100%; }
    .search-box kbd, .topbar-actions .primary-button { display: none; }
    .page-shell { padding: 23px 17px 35px; }
    .page-heading { align-items: flex-start; }
    .heading-actions .secondary-button { display: none; }
    .mobile-primary { display: inline-flex; }
}

@media (max-width: 560px) {
    .topbar-actions { gap: 6px; }
    .notification-button { display: none; }
    .page-heading { display: block; }
    .heading-actions { margin-top: 15px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 15px; }
    .stat-note { display: none; }
    .pipeline-track { grid-template-columns: 1fr; }
    .pipeline-stage { display: grid; grid-template-columns: 100px 1fr; align-items: center; gap: 9px; }
    .stage-heading { margin-bottom: 0; }
    .quick-actions { grid-template-columns: 1fr; }
    .compact-empty { align-items: flex-start; }
    .compact-empty .text-button { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
/* Clients module */
.button-link {
    text-decoration: none;
}

.clients-heading {
    align-items: center;
}

.clients-panel {
    min-height: 430px;
    padding: 0;
    overflow: hidden;
}

.clients-toolbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.client-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(520px, 100%);
    height: 42px;
    padding: 0 13px;
    color: var(--text-soft);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.client-search:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.client-search svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
}

.client-search input {
    width: 100%;
    color: var(--text);
    background: transparent;
    border: 0;
    outline: 0;
}

.client-search input::placeholder {
    color: var(--text-soft);
}

.clear-search {
    color: var(--brand);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
}

.client-total {
    margin-left: auto;
    color: var(--text-soft);
    font-size: 12px;
    white-space: nowrap;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.clients-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.clients-table th {
    padding: 13px 18px;
    color: var(--text-soft);
    background: var(--surface-soft);
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.clients-table td {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    vertical-align: middle;
}

.clients-table tbody tr {
    transition: background .18s ease;
}

.clients-table tbody tr:hover {
    background: var(--surface-soft);
}

.clients-table tbody tr:last-child td {
    border-bottom: 0;
}

.client-identity {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 180px;
}

.client-avatar {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    place-items: center;
    color: var(--brand);
    background: var(--brand-soft);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 800;
}

.client-identity strong,
.client-identity small,
.contact-details span,
.contact-details small {
    display: block;
}

.client-identity strong {
    font-size: 12px;
}

.client-identity small,
.contact-details small {
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 9px;
}

.contact-details {
    min-width: 170px;
}

.contact-details span {
    font-size: 11px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    color: var(--text-soft);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 9px;
    font-weight: 750;
    white-space: nowrap;
}

.status-active,
.status-approved,
.status-funded {
    color: var(--brand);
    background: var(--brand-soft);
    border-color: rgba(54, 198, 106, .22);
}

.status-application {
    color: var(--blue);
    background: rgba(76, 141, 255, .12);
    border-color: rgba(76, 141, 255, .22);
}

.status-inactive,
.status-archived {
    opacity: .7;
}

.table-action {
    text-align: right;
}

.edit-client-button {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    padding: 0 11px;
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    text-decoration: none;
    transition: background .18s, border .18s;
}

.edit-client-button:hover {
    color: var(--brand);
    background: var(--brand-soft);
    border-color: rgba(54, 198, 106, .25);
}

.clients-empty-state {
    display: flex;
    min-height: 340px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

.clients-empty-state strong {
    font-size: 14px;
}

.clients-empty-state p {
    max-width: 360px;
    margin: 5px 0 16px;
    color: var(--text-soft);
    font-size: 11px;
}

/* Client form */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-bottom: 12px;
    color: var(--brand);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
}

.back-link svg {
    width: 15px;
    height: 15px;
}

.client-form {
    display: grid;
    gap: 17px;
}

.form-panel {
    min-height: auto;
    padding: 24px;
}

.form-section-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.form-section-heading h2 {
    font-size: 15px;
}

.form-section-heading p {
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 10px;
}

.form-section-icon {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    color: var(--brand);
    background: var(--brand-soft);
    border-radius: 10px;
}

.form-section-icon svg {
    width: 18px;
    height: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 19px;
}

.form-group {
    display: grid;
    gap: 7px;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-group label {
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
}

.form-group label span {
    color: #ef6464;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: 0;
    transition: border .18s, box-shadow .18s;
}

.form-group input,
.form-group select {
    height: 43px;
    padding: 0 12px;
}

.form-group textarea {
    min-height: 125px;
    padding: 12px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-soft);
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 4px 0 20px;
}

.form-actions-right {
    display: flex;
    gap: 9px;
    margin-left: auto;
}

.danger-button {
    display: inline-flex;
    height: 42px;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    color: #ef6464;
    cursor: pointer;
    background: rgba(239, 100, 100, .08);
    border: 1px solid rgba(239, 100, 100, .2);
    border-radius: 10px;
    font-weight: 700;
}

.danger-button:hover {
    background: rgba(239, 100, 100, .15);
}

.success-message {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 17px;
    padding: 12px 15px;
    color: var(--brand);
    background: var(--brand-soft);
    border: 1px solid rgba(54, 198, 106, .22);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.success-message svg {
    width: 17px;
    height: 17px;
}

@media (max-width: 700px) {
    .clients-heading {
        display: flex;
    }

    .clients-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .client-total {
        margin-left: 0;
    }

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

    .form-group-full {
        grid-column: auto;
    }

    .form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .form-actions-right {
        width: 100%;
        margin-left: 0;
    }

    .form-actions-right > * {
        flex: 1;
    }

    .danger-button {
        width: 100%;
    }
}

/* Mortgage Applications module */
.applications-table td {
    white-space: nowrap;
}

.application-number {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 170px;
}

.application-number strong,
.application-number small {
    display: block;
}

.application-number strong {
    font-size: 12px;
}

.application-number small {
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 9px;
}

.application-icon {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    place-items: center;
    color: var(--blue);
    background: rgba(76, 141, 255, .12);
    border-radius: 10px;
}

.application-icon svg {
    width: 17px;
    height: 17px;
}

.mortgage-amount {
    color: var(--text);
    font-weight: 750;
}

.stage-new-lead {
    color: var(--brand);
    background: var(--brand-soft);
    border-color: rgba(54, 198, 106, .22);
}

.stage-documents {
    color: var(--cyan);
    background: rgba(53, 184, 189, .12);
    border-color: rgba(53, 184, 189, .22);
}

.stage-submitted {
    color: var(--blue);
    background: rgba(76, 141, 255, .12);
    border-color: rgba(76, 141, 255, .22);
}

.stage-approved {
    color: var(--purple);
    background: rgba(155, 109, 255, .12);
    border-color: rgba(155, 109, 255, .22);
}

.stage-funded {
    color: var(--orange);
    background: rgba(245, 157, 71, .12);
    border-color: rgba(245, 157, 71, .22);
}

.application-warning {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 17px;
    padding: 16px 18px;
    color: var(--orange);
    background: rgba(245, 157, 71, .09);
    border: 1px solid rgba(245, 157, 71, .22);
    border-radius: 12px;
}

.application-warning strong {
    font-size: 12px;
}

.application-warning p {
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 10px;
}

.money-input {
    position: relative;
}

.money-input > span {
    position: absolute;
    top: 50%;
    left: 13px;
    z-index: 1;
    color: var(--text-soft);
    font-weight: 700;
    transform: translateY(-50%);
}

.money-input input {
    padding-left: 29px;
}

.primary-button:disabled,
.form-group input:disabled,
.form-group select:disabled {
    cursor: not-allowed;
    opacity: .5;
}

@media (max-width: 700px) {
    .application-warning {
        align-items: stretch;
        flex-direction: column;
    }
}

/* Kanban Pipeline module */
.pipeline-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
    padding: 13px 16px;
    color: var(--text-soft);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.pipeline-summary > div {
    display: flex;
    align-items: center;
    gap: 9px;
}

.pipeline-summary span,
.pipeline-summary p {
    font-size: 10px;
}

.pipeline-summary strong {
    display: grid;
    min-width: 24px;
    height: 24px;
    place-items: center;
    color: var(--brand);
    background: var(--brand-soft);
    border-radius: 7px;
    font-size: 11px;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(5, minmax(265px, 1fr));
    gap: 13px;
    padding-bottom: 15px;
    overflow-x: auto;
}

.kanban-column {
    min-width: 265px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.kanban-column-header {
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
}

.kanban-stage-title {
    display: flex;
    align-items: center;
    gap: 9px;
}

.kanban-stage-title h2 {
    font-size: 12px;
}

.kanban-stage-title span {
    display: block;
    margin-top: 1px;
    color: var(--text-soft);
    font-size: 9px;
}

.kanban-count {
    display: grid;
    min-width: 25px;
    height: 25px;
    padding: 0 7px;
    place-items: center;
    color: var(--text-soft);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 10px;
    font-weight: 750;
}

.kanban-dropzone {
    min-height: 500px;
    padding: 10px;
    transition: background .18s, box-shadow .18s;
}

.kanban-dropzone.drag-over {
    background: var(--brand-soft);
    box-shadow: inset 0 0 0 2px rgba(54, 198, 106, .3);
}

.mortgage-card {
    margin-bottom: 10px;
    padding: 13px;
    cursor: grab;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 11px;
    box-shadow: 0 5px 16px rgba(0, 0, 0, .08);
    transition: transform .18s, border .18s, opacity .18s;
}

.mortgage-card:hover {
    border-color: rgba(54, 198, 106, .3);
    transform: translateY(-2px);
}

.mortgage-card.dragging {
    cursor: grabbing;
    opacity: .45;
    transform: rotate(2deg) scale(.98);
}

.mortgage-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.application-reference {
    color: var(--brand);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
}

.drag-handle {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    color: var(--text-soft);
}

.drag-handle svg {
    width: 15px;
    height: 15px;
}

.mortgage-client {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 13px;
}

.mortgage-client .client-avatar {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    font-size: 9px;
}

.mortgage-client strong,
.mortgage-client small {
    display: block;
}

.mortgage-client strong {
    font-size: 11px;
}

.mortgage-client small {
    max-width: 155px;
    overflow: hidden;
    margin-top: 1px;
    color: var(--text-soft);
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mortgage-card-amount {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    padding: 9px;
    background: var(--surface-soft);
    border-radius: 8px;
}

.mortgage-card-amount span {
    color: var(--text-soft);
    font-size: 8px;
}

.mortgage-card-amount strong {
    font-size: 13px;
}

.mortgage-card-detail {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: 8px 2px;
    color: var(--text-soft);
    font-size: 8px;
}

.mortgage-card-detail svg {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
}

.mortgage-card-detail span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mortgage-card-footer {
    margin-top: 11px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.mortgage-card-footer a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--brand);
    font-size: 9px;
    font-weight: 750;
    text-decoration: none;
}

.mortgage-card-footer svg {
    width: 13px;
    height: 13px;
}

.kanban-empty {
    display: flex;
    min-height: 120px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: var(--text-soft);
    border: 1px dashed var(--border);
    border-radius: 9px;
    font-size: 9px;
}

.kanban-empty svg {
    width: 18px;
    height: 18px;
}

.kanban-dropzone:has(.mortgage-card) .kanban-empty {
    display: none;
}

.pipeline-toast {
    position: fixed;
    right: 25px;
    bottom: 25px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 13px 16px;
    color: #07130b;
    background: var(--brand);
    border-radius: 10px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, .25);
    font-size: 11px;
    font-weight: 750;
    opacity: 0;
    pointer-events: none;
    transform: translateY(15px);
    transition: opacity .25s, transform .25s;
}

.pipeline-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.pipeline-toast.error {
    color: white;
    background: #d94f4f;
}

.pipeline-toast svg {
    width: 17px;
    height: 17px;
}

@media (max-width: 780px) {
    .pipeline-summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .kanban-dropzone {
        min-height: 350px;
    }
}

/* Document Checklist module */
.document-application-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
    padding: 20px;
}

.document-application-card {
    padding: 18px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 13px;
    transition: border .18s, transform .18s;
}

.document-application-card:hover {
    border-color: rgba(54, 198, 106, .3);
    transform: translateY(-2px);
}

.document-card-header {
    display: flex;
    align-items: center;
    gap: 11px;
}

.document-card-header > div:nth-child(2) {
    min-width: 0;
    flex: 1;
}

.document-card-header span {
    color: var(--brand);
    font-size: 8px;
    font-weight: 800;
}

.document-card-header h2 {
    overflow: hidden;
    margin-top: 2px;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.checklist-complete-badge {
    padding: 4px 8px;
    color: var(--brand) !important;
    background: var(--brand-soft);
    border-radius: 20px;
}

.document-property {
    overflow: hidden;
    margin: 14px 0;
    color: var(--text-soft);
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-progress-heading,
.document-progress-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.document-progress-heading {
    margin-bottom: 8px;
}

.document-progress-heading span,
.document-progress-footer > span:first-child {
    color: var(--text-soft);
    font-size: 8px;
}

.document-progress-heading strong {
    font-size: 9px;
}

.document-progress-track {
    height: 6px;
    overflow: hidden;
    background: var(--surface);
    border-radius: 10px;
}

.document-progress-track span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--brand-dark), var(--brand));
    border-radius: inherit;
    transition: width .35s ease;
}

.document-progress-track.large {
    height: 8px;
}

.document-progress-footer {
    margin-top: 9px;
}

.open-checklist-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 36px;
    margin-top: 15px;
    color: var(--brand);
    background: var(--brand-soft);
    border-radius: 9px;
    font-size: 9px;
    font-weight: 750;
    text-decoration: none;
}

.open-checklist-button svg {
    width: 13px;
    height: 13px;
}

.checklist-progress-panel {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 17px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.checklist-progress-circle {
    display: grid;
    width: 82px;
    height: 82px;
    flex: 0 0 auto;
    place-content: center;
    text-align: center;
    background: var(--brand-soft);
    border: 6px solid rgba(54, 198, 106, .2);
    border-radius: 50%;
}

.checklist-progress-circle strong {
    display: block;
    color: var(--brand);
    font-size: 18px;
}

.checklist-progress-circle span {
    color: var(--text-soft);
    font-size: 8px;
    text-transform: uppercase;
}

.checklist-progress-content {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 13px 20px;
    width: 100%;
}

.checklist-progress-content h2 {
    font-size: 14px;
}

.checklist-progress-content p {
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 9px;
}

.checklist-progress-content > strong {
    align-self: center;
    color: var(--brand);
    font-size: 11px;
}

.checklist-progress-content .document-progress-track {
    grid-column: 1 / -1;
}

.checklist-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
    gap: 17px;
}

.checklist-main {
    display: grid;
    gap: 14px;
}

.checklist-category,
.add-document-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.checklist-category > header {
    padding: 16px 18px;
    background: var(--surface-soft);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
}

.checklist-category > header h2 {
    font-size: 13px;
}

.checklist-category > header span {
    color: var(--text-soft);
    font-size: 9px;
}

.checklist-items {
    padding: 0 17px;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 66px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    transition: opacity .18s;
}

.checklist-item:last-child {
    border-bottom: 0;
}

.checklist-item.received {
    opacity: .72;
}

.document-toggle {
    display: grid;
    width: 25px;
    height: 25px;
    flex: 0 0 auto;
    place-items: center;
    color: transparent;
    cursor: pointer;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 7px;
    transition: background .18s, border .18s, color .18s;
}

.document-toggle:hover {
    border-color: var(--brand);
}

.document-toggle svg {
    width: 14px;
    height: 14px;
}

.checklist-item.received .document-toggle {
    color: #07130b;
    background: var(--brand);
    border-color: var(--brand);
}

.checklist-item-content {
    min-width: 0;
    flex: 1;
}

.checklist-item-content strong,
.checklist-item-content span {
    display: block;
}

.checklist-item-content strong {
    font-size: 11px;
}

.received-status {
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 8px;
}

.checklist-item.received .received-status {
    color: var(--brand);
}

.document-note {
    margin-top: 7px;
    padding: 7px 9px;
    color: var(--text-soft);
    background: var(--surface-soft);
    border-radius: 7px;
    font-size: 8px;
}

.checklist-item-actions {
    display: flex;
    align-items: flex-start;
    gap: 7px;
}

.notes-details {
    position: relative;
}

.notes-details summary {
    padding: 5px 8px;
    color: var(--text-soft);
    cursor: pointer;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 8px;
    font-weight: 700;
    list-style: none;
}

.notes-details summary::-webkit-details-marker {
    display: none;
}

.notes-details form {
    position: absolute;
    top: 32px;
    right: 0;
    z-index: 20;
    width: 240px;
    padding: 11px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 14px 35px rgba(0, 0, 0, .25);
}

.notes-details textarea {
    width: 100%;
    margin-bottom: 8px;
    padding: 9px;
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 7px;
    outline: 0;
    resize: vertical;
}

.delete-item-button {
    display: grid;
    width: 27px;
    height: 27px;
    place-items: center;
    color: #ef6464;
    cursor: pointer;
    background: rgba(239, 100, 100, .08);
    border: 0;
    border-radius: 7px;
}

.delete-item-button svg {
    width: 13px;
    height: 13px;
}

.add-document-panel {
    position: sticky;
    top: 96px;
    padding: 18px;
}

.add-document-panel form {
    display: grid;
    gap: 15px;
}

.add-document-panel .primary-button {
    width: 100%;
    margin-top: 3px;
}

@media (max-width: 1100px) {
    .document-application-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .checklist-layout {
        grid-template-columns: 1fr;
    }

    .add-document-panel {
        position: static;
    }
}

@media (max-width: 650px) {
    .document-application-grid {
        grid-template-columns: 1fr;
    }

    .checklist-progress-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .checklist-progress-content {
        grid-template-columns: 1fr;
    }

    .checklist-progress-content .document-progress-track {
        grid-column: auto;
    }

    .checklist-item {
        flex-wrap: wrap;
    }

    .checklist-item-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Tasks module */
.tasks-panel {
    min-height: 430px;
    padding: 0;
    overflow: hidden;
}

.task-filter-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 17px 20px;
    border-bottom: 1px solid var(--border);
}

.task-filter-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.task-filter-tabs a {
    padding: 6px 10px;
    color: var(--text-soft);
    border-radius: 7px;
    font-size: 9px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.task-filter-tabs a:hover {
    color: var(--text);
}

.task-filter-tabs a.active {
    color: #07130b;
    background: var(--brand);
}

.task-filter-bar .client-search {
    width: min(360px, 100%);
    margin-left: auto;
}

.task-filter-bar .client-total {
    margin-left: 0;
}

.task-page-list {
    padding: 0 20px;
}

.task-page-item {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 76px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
    transition: opacity .18s, background .18s;
}

.task-page-item:last-child {
    border-bottom: 0;
}

.task-page-item.completed {
    opacity: .6;
}

.task-page-item.completed .task-title-row strong {
    text-decoration: line-through;
}

.task-toggle {
    display: grid;
    width: 27px;
    height: 27px;
    flex: 0 0 auto;
    place-items: center;
    color: transparent;
    cursor: pointer;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: background .18s, border .18s, color .18s;
}

.task-toggle:hover {
    border-color: var(--brand);
}

.task-toggle svg {
    width: 15px;
    height: 15px;
}

.task-page-item.completed .task-toggle {
    color: #07130b;
    background: var(--brand);
    border-color: var(--brand);
}

.task-page-content {
    min-width: 0;
    flex: 1;
}

.task-title-row {
    display: flex;
    align-items: center;
    gap: 9px;
}

.task-title-row strong {
    font-size: 12px;
}

.priority-badge {
    padding: 3px 7px;
    border-radius: 20px;
    font-size: 8px;
    font-weight: 800;
}

.priority-high {
    color: #ef6464;
    background: rgba(239, 100, 100, .12);
}

.priority-medium {
    color: var(--orange);
    background: rgba(245, 157, 71, .12);
}

.priority-low {
    color: var(--blue);
    background: rgba(76, 141, 255, .12);
}

.task-metadata {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 6px;
}

.task-metadata span {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-soft);
    font-size: 8px;
}

.task-metadata svg {
    width: 12px;
    height: 12px;
}

.task-form {
    max-width: 1000px;
}

@media (max-width: 1000px) {
    .task-filter-bar {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .task-filter-bar .client-search {
        order: 3;
        width: 100%;
        margin-left: 0;
    }

    .task-filter-tabs {
        overflow-x: auto;
    }
}

@media (max-width: 600px) {
    .task-filter-bar {
        flex-direction: column;
    }

    .task-page-item {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .task-page-item > .edit-client-button {
        margin-left: 40px;
    }

    .task-metadata {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }
}

/* Secure sign-in */
.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 50% 0%, rgba(47, 203, 113, .12), transparent 34rem),
        var(--bg);
}

.login-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(100%, 440px);
    padding: 42px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
}

.login-brand-mark {
    display: grid;
    width: 52px;
    height: 52px;
    margin-bottom: 26px;
    place-items: center;
    border-radius: 15px;
    color: #05130c;
    background: var(--brand);
    box-shadow: 0 10px 28px rgba(47, 203, 113, .24);
}

.login-brand-mark svg {
    width: 26px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.login-card .eyebrow {
    margin: 0 0 8px;
    color: var(--brand);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .11em;
}

.login-card h1 {
    margin: 0;
    color: var(--text);
    font-size: clamp(30px, 7vw, 40px);
}

.login-subtitle {
    margin: 10px 0 28px;
    color: var(--text-soft);
}

.login-error {
    margin-bottom: 20px;
    padding: 12px 14px;
    border: 1px solid rgba(239, 100, 100, .3);
    border-radius: 10px;
    color: #ff8585;
    background: rgba(239, 100, 100, .09);
    font-size: 12px;
}

.login-form {
    display: grid;
    gap: 10px;
}

.login-form label {
    margin-top: 8px;
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
}

.login-form input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    color: var(--text);
    background: var(--surface-soft);
}

.login-form input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(47, 203, 113, .12);
}

.login-button {
    width: 100%;
    height: 48px;
    margin-top: 16px;
    justify-content: center;
}

.login-security {
    margin: 22px 0 0;
    color: var(--text-soft);
    font-size: 10px;
    text-align: center;
}

.logout-form {
    margin-left: auto;
}

@media (max-width: 520px) {
    .login-card {
        padding: 30px 24px;
    }
}

/* Calendar module */
.calendar-summary {
    display: flex;
    align-items: center;
    gap: 28px;
    margin-bottom: 16px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
}

.calendar-summary > div {
    display: flex;
    align-items: baseline;
    gap: 9px;
}

.calendar-summary span,
.calendar-summary p {
    color: var(--text-soft);
    font-size: 10px;
}

.calendar-summary strong {
    color: var(--brand);
    font-size: 18px;
}

.calendar-summary p {
    margin-left: auto;
}

.calendar-panel {
    overflow: hidden;
}

.calendar-toolbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
    padding: 17px 20px;
    border-bottom: 1px solid var(--border);
}

.calendar-toolbar h2 {
    font-size: 18px;
    text-align: center;
}

.calendar-navigation {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-navigation .secondary-button {
    min-height: 38px;
    padding: 0 14px;
}

.calendar-task-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    justify-self: end;
    color: var(--brand);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
}

.calendar-task-link svg {
    width: 14px;
    height: 14px;
}

.calendar-scroll {
    overflow-x: auto;
}

.calendar-grid {
    display: grid;
    min-width: 920px;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
    color: var(--text-soft);
    background: var(--surface-soft);
    border-bottom: 1px solid var(--border);
}

.calendar-weekdays div {
    padding: 10px 12px;
    border-right: 1px solid var(--border);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.calendar-weekdays div:last-child {
    border-right: 0;
}

.calendar-day {
    min-height: 142px;
    padding: 9px;
    overflow: hidden;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.calendar-day:nth-child(7n) {
    border-right: 0;
}

.calendar-day.outside-month {
    background: color-mix(in srgb, var(--surface-soft) 75%, transparent);
}

.calendar-day.outside-month .calendar-day-number,
.calendar-day.outside-month .calendar-events {
    opacity: .42;
}

.calendar-day.today {
    box-shadow: inset 0 0 0 1px var(--brand);
    background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface));
}

.calendar-day-number {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
}

.calendar-day-number svg {
    width: 14px;
    height: 14px;
    opacity: 0;
    color: var(--brand);
    transition: opacity .16s ease;
}

.calendar-day:hover .calendar-day-number svg,
.calendar-day-number:focus svg {
    opacity: 1;
}

.calendar-day.today .calendar-day-number span {
    display: grid;
    width: 25px;
    height: 25px;
    place-items: center;
    border-radius: 50%;
    color: #06130c;
    background: var(--brand);
}

.calendar-events {
    display: grid;
    gap: 5px;
}

.calendar-event {
    display: grid;
    grid-template-columns: 5px minmax(0, 1fr);
    align-items: center;
    column-gap: 6px;
    padding: 6px 7px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--text);
    background: var(--surface-soft);
    text-decoration: none;
    transition: border-color .16s ease, transform .16s ease;
}

.calendar-event:hover {
    border-color: var(--border);
    transform: translateY(-1px);
}

.calendar-event-dot {
    width: 5px;
    height: 5px;
    grid-row: 1 / span 2;
    border-radius: 50%;
    background: var(--blue);
}

.calendar-event.priority-high .calendar-event-dot {
    background: #ef6464;
}

.calendar-event.priority-medium .calendar-event-dot {
    background: var(--orange);
}

.calendar-event.priority-low .calendar-event-dot {
    background: var(--blue);
}

.calendar-event-text {
    overflow: hidden;
    font-size: 9px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event small {
    overflow: hidden;
    color: var(--text-soft);
    font-size: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event.completed {
    opacity: .5;
}

.calendar-event.completed .calendar-event-text {
    text-decoration: line-through;
}

.calendar-more {
    padding-left: 7px;
    color: var(--brand);
    font-size: 8px;
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 760px) {
    .calendar-summary {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 10px 22px;
    }

    .calendar-summary p {
        width: 100%;
        margin-left: 0;
    }

    .calendar-toolbar {
        grid-template-columns: 1fr auto;
    }

    .calendar-toolbar h2 {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .calendar-navigation {
        grid-column: 1;
        grid-row: 2;
    }

    .calendar-task-link {
        grid-column: 2;
        grid-row: 2;
    }
}

/* Reports module */

.reports-closing-panel {
    grid-column: 1 / -1;
}

@media print {
    .sidebar,
    .topbar,
    .mobile-overlay,
    .page-heading button {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .page-shell {
        padding: 20px !important;
    }

    body,
    .main-content {
        background: #ffffff !important;
        color: #111111 !important;
    }

    .panel,
    .stat-card {
        break-inside: avoid;
        border: 1px solid #cccccc !important;
        box-shadow: none !important;
    }
}

/* Realtor and Lender performance sections */

.relationship-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.relationship-stat {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 125px;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--surface-soft);
}

.relationship-stat small {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.relationship-stat strong {
    color: var(--text-primary);
    font-size: 25px;
    line-height: 1.2;
}

.relationship-stat span {
    color: var(--text-muted);
    font-size: 12px;
}

.relationship-applications {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.relationship-applications-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.relationship-applications-heading h3 {
    margin: 0 0 5px;
    font-size: 16px;
}

.relationship-applications-heading p {
    margin: 0;
    color: var(--text-muted);
    font-size: 12px;
}

.relationship-empty {
    margin-top: 24px;
    padding: 28px;
    text-align: center;
    border: 1px dashed var(--border-color);
    border-radius: 14px;
    background: var(--surface-soft);
}

.relationship-empty strong {
    display: block;
    margin-bottom: 6px;
}

.relationship-empty p {
    margin: 0;
    color: var(--text-muted);
    font-size: 12px;
}

.application-relationships {
    display: flex;
    min-width: 165px;
    flex-direction: column;
    gap: 8px;
}

.application-relationships div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.application-relationships small {
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.application-relationships strong,
.application-relationships span {
    font-size: 12px;
}

@media (max-width: 900px) {
    .relationship-stat-grid {
        grid-template-columns: 1fr;
    }
}

/* Notification bell and dropdown */

.notification-menu {
    position: relative;
}

.notification-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border: 2px solid var(--page-background);
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
}

.notification-panel[hidden],
.notification-count[hidden] {
    display: none;
}

.notification-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 1000;
    width: 390px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.35);
}

.notification-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px;
    border-bottom: 1px solid var(--border-color);
}

.notification-panel-header div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.notification-panel-header strong {
    font-size: 15px;
}

.notification-panel-header span {
    color: var(--text-muted);
    font-size: 11px;
}

.notification-close {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.notification-close:hover {
    color: var(--text-primary);
    background: var(--surface-soft);
}

.notification-list {
    max-height: 430px;
    overflow-y: auto;
}

.notification-item {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.18s ease;
}

.notification-item:last-child {
    border-bottom: 0;
}

.notification-item:hover {
    background: var(--surface-soft);
}

.notification-indicator {
    width: 9px;
    height: 9px;
    margin-top: 5px;
    border-radius: 50%;
    background: #3b82f6;
}

.notification-item.urgent .notification-indicator {
    background: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

.notification-item.warning .notification-indicator {
    background: #f59e0b;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12);
}

.notification-item.info .notification-indicator {
    background: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.notification-content {
    min-width: 0;
}

.notification-content strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.notification-content p {
    margin: 0 0 6px;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-content time {
    color: var(--text-muted);
    font-size: 10px;
}

.notification-empty,
.notification-loading,
.notification-error {
    padding: 42px 20px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}

.notification-error {
    color: #ef4444;
}

@media (max-width: 600px) {
    .notification-panel {
        position: fixed;
        top: 72px;
        right: 12px;
        left: 12px;
        width: auto;
    }
}