:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --line: #d9e2ec;
    --line-soft: #e7edf4;
    --text: #101828;
    --muted: #667085;
    --sidebar: #111827;
    --sidebar-soft: #1f2937;
    --accent: #2563eb;
    --accent-soft: #dbeafe;
    --warning: #fef3c7;
    --danger: #fee2e2;
    --success: #dcfce7;
    --shadow: 0 14px 35px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    font-family: Inter, Segoe UI, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
}

a { color: inherit; }

.layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    min-height: 100vh;
    background: linear-gradient(180deg, var(--sidebar), var(--sidebar-soft));
    color: white;
    padding: 22px 18px;
    overflow-y: auto;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 6px 6px 20px;
    border-bottom: 1px solid rgba(255,255,255,.10);
    margin-bottom: 18px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(255,255,255,.12);
    font-weight: 800;
    font-size: 1.2rem;
}

.brand h2 {
    margin: 0;
    font-size: 1.25rem;
    letter-spacing: .2px;
}

.brand span {
    color: rgba(255,255,255,.66);
    font-size: .86rem;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 18px;
}

.nav-caption {
    margin: 12px 8px 5px;
    color: rgba(255,255,255,.46);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.sidebar a {
    color: rgba(255,255,255,.84);
    text-decoration: none;
    padding: 9px 10px;
    border-radius: 10px;
    font-weight: 600;
    font-size: .94rem;
}

.sidebar a:hover,
.sidebar a.active {
    color: #fff;
    background: rgba(255,255,255,.12);
}

.content {
    padding: 32px;
    max-width: 1500px;
    width: 100%;
}

h1, h2, h3 { margin-top: 0; }

h1 { font-size: clamp(2rem, 3vw, 3rem); letter-spacing: -0.04em; margin-bottom: 10px; }
h2 { font-size: 1.15rem; margin-bottom: 12px; }

.lead {
    max-width: 880px;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.55;
    margin: 0;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    padding: 18px;
    border-radius: 18px;
    box-shadow: var(--shadow);
}

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

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

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: start;
    margin-bottom: 20px;
}

.module-hero {
    background: linear-gradient(135deg, #ffffff 0%, #eef4ff 100%);
    border: 1px solid var(--line-soft);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--accent);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.status-pill,
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    border-radius: 999px;
    background: var(--accent-soft);
    color: #1e40af;
    padding: 6px 10px;
    font-size: .85rem;
    font-weight: 700;
}

.module-grid { align-items: stretch; }
.module-card { min-height: 260px; }

.module-note { margin-top: 16px; }

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

.note-grid p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.action-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.check-list,
.step-list {
    padding-left: 20px;
    margin: 0;
    color: #344054;
    line-height: 1.65;
}

.check-list li,
.step-list li { margin-bottom: 6px; }

.small { font-size: .9rem; }

.toolbar {
    display: flex;
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

.grow,
.field.grow { flex: 1; min-width: 280px; }

label {
    color: #475467;
    font-size: .88rem;
    font-weight: 700;
}

.field input,
.field select,
.field textarea {
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font: inherit;
    background: white;
}

button,
.button-link {
    border: 1px solid var(--line);
    padding: 10px 13px;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
}

button:disabled {
    cursor: not-allowed;
    color: #667085;
    background: var(--panel-soft);
}

button.primary,
.button-link.primary,
.primary {
    background: var(--sidebar);
    color: white;
    border-color: var(--sidebar);
}

button.outline { background: white; color: var(--sidebar); border-color: var(--sidebar); }
button.danger { color: #991b1b; border-color: #fecaca; background: #fff7f7; }

.message {
    padding: 12px;
    margin: 12px 0;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 12px;
    margin: 16px 0;
}

.stat strong {
    display: block;
    font-size: 1.8rem;
    letter-spacing: -.03em;
}

.stat span,
.muted { color: var(--muted); }

.customer-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.customer-row,
.project-row {
    display: flex;
    gap: 18px;
    align-items: start;
    justify-content: space-between;
}

.title {
    font-weight: 800;
    font-size: 1.08rem;
    color: var(--text);
    text-decoration: none;
}

.title:hover { color: var(--accent); }

.badges {
    display: flex;
    gap: 7px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.badge { background: #eef2f6; color: #344054; }
.badge.warn { background: var(--warning); color: #92400e; }
.badge.hot { background: var(--danger); color: #991b1b; }
.badge.success { background: var(--success); color: #166534; }

.metrics {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--muted);
    min-width: 160px;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: end;
}

.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(15, 23, 42, .48);
    display: grid;
    place-items: center;
    padding: 24px;
}

.dialog {
    width: min(760px, 100%);
    max-height: 90vh;
    overflow: auto;
}

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

.dialog-actions {
    display: flex;
    justify-content: end;
    gap: 10px;
    margin-top: 16px;
}

@media (max-width: 1000px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: static; min-height: auto; }
    .content { padding: 18px; }
    .grid, .stats, .grid-2, .note-grid { grid-template-columns: 1fr; }
    .customer-row, .project-row, .page-header { flex-direction: column; }
    .actions { justify-content: start; }
}


.hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.warning-message {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #7c2d12;
}

.warning-message p { margin: 6px 0 0; }

.warning-message details {
    margin-top: 10px;
    color: #9a3412;
}

.warning-message code {
    display: block;
    margin-top: 8px;
    white-space: pre-wrap;
    font-family: Consolas, monospace;
    font-size: .86rem;
}

.table-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.inline-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.form-section-title {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
}

.checkbox-field {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding-top: 24px;
}

.checkbox-field input { width: 18px; height: 18px; }

textarea { min-height: 96px; resize: vertical; }

.button-as-link {
    border: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    justify-content: flex-start;
}

.small-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 18px;
}

.compact-list {
    gap: 10px;
}

.mini-card {
    padding: 12px;
    box-shadow: none;
}

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

.finance-overview { align-items: stretch; }

.finance-line {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line-soft);
}

.finance-line:last-child { border-bottom: 0; }

.finance-kpi-list {
    display: grid;
    gap: 10px;
}

.finance-kpi-list div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line-soft);
}

.finance-kpi-list div:last-child { border-bottom: 0; }

.finance-kpi-list span,
.finance-month-row span { color: var(--muted); }

.finance-ratio strong {
    display: block;
    font-size: 2.4rem;
    margin-bottom: 12px;
    letter-spacing: -0.04em;
}

.finance-bar {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--line-soft);
}

.finance-bar span {
    display: block;
    min-width: 2px;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

.finance-bar.secondary span { background: #0f766e; }

.finance-months { margin-top: 16px; }

.finance-month-grid {
    display: grid;
    gap: 12px;
}

.finance-month-row {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line-soft);
}

.finance-month-row:last-child { border-bottom: 0; }

.danger-soft {
    border-color: #fecaca;
    background: #fff7f7;
}

.danger-badge {
    background: var(--danger);
    color: #991b1b;
}

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

    .finance-month-row {
        grid-template-columns: 1fr;
    }
}


.form-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 1.25rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    max-width: 760px;
}

.login-card {
    max-width: 520px;
}

.form-grid.compact {
    display: grid;
    gap: 1rem;
}

.form-grid label {
    display: grid;
    gap: 0.35rem;
    color: #334155;
    font-weight: 650;
}

.input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    font: inherit;
}

.alert {
    margin-top: 1rem;
    border-radius: 12px;
    padding: 0.8rem 0.9rem;
}

.alert.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.actions-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    align-items: center;
}

.muted {
    color: #64748b;
}

.small-note {
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Auth UI Block 10 */
.content:has(.login-page) {
    max-width: none;
    padding: 0;
}

.login-page {
    min-height: 100vh;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(360px, 520px);
    gap: 32px;
    align-items: center;
    padding: clamp(28px, 5vw, 72px);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, .18), transparent 34%),
        linear-gradient(135deg, #f8fafc 0%, #eef4ff 48%, #f8fafc 100%);
}

.login-visual {
    max-width: 760px;
}

.login-brand-mark {
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    margin-bottom: 26px;
    border-radius: 22px;
    background: linear-gradient(135deg, #111827, #1d4ed8);
    color: white;
    font-size: 2rem;
    font-weight: 900;
    box-shadow: 0 22px 45px rgba(30, 64, 175, .22);
}

.login-visual h1 {
    font-size: clamp(3rem, 8vw, 6.5rem);
    line-height: .9;
    margin-bottom: 18px;
}

.login-feature-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.login-feature-list span {
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: 9px 12px;
    background: rgba(255, 255, 255, .72);
    color: #1e3a8a;
    font-weight: 750;
    font-size: .9rem;
}

.login-panel {
    width: 100%;
    padding: clamp(24px, 4vw, 36px);
    border-radius: 26px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .14);
}

.login-panel-header h2 {
    font-size: 2rem;
    letter-spacing: -.04em;
    margin-bottom: 8px;
}

.login-form {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

.field.full {
    min-width: 0;
}

.field.full span {
    color: #334155;
    font-weight: 800;
}

.login-form .input,
.security-card .input {
    min-height: 48px;
    border-radius: 14px;
}

.login-submit {
    width: 100%;
    min-height: 48px;
    margin-top: 4px;
}

.login-hint {
    margin: 18px 0 0;
    color: #64748b;
    font-size: .92rem;
    line-height: 1.55;
}

.form-grid.one-column,
.form-grid.compact.one-column {
    grid-template-columns: 1fr;
}

.alert.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.security-card {
    max-width: 620px;
}

@media (max-width: 900px) {
    .login-page {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .login-visual h1 {
        font-size: clamp(2.6rem, 14vw, 4rem);
    }
}

.auth-content {
    max-width: none;
    padding: 0;
    width: 100%;
}
