:root {
    --navy: #092747;
    --blue: #1269a8;
    --gold: #f3a421;
    --green: #25a45a;
    --red: #c2410c;
    --bg: #f5f8fb;
    --surface: #ffffff;
    --line: #dbe6ef;
    --muted: #64748b;
    --text: #122033;
    --radius: 8px;
    --shadow: 0 16px 42px rgba(9, 39, 71, .10);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #f7fbff, #eaf5fb 48%, #ffffff);
}
.auth-card {
    width: min(100%, 440px);
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 26px;
}
.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    color: #fff;
    background: linear-gradient(135deg, var(--navy), var(--blue));
    font-weight: 800;
}
.brand strong, .brand span { display: block; }
.brand span { color: var(--muted); font-size: .86rem; }
.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field label { font-weight: 700; color: var(--navy); }
.field input, .field textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    background: #fff;
}
.checkbox { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.btn {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: var(--radius);
    padding: 11px 16px;
    cursor: pointer;
    font-weight: 800;
}
.btn-primary { color: #fff; background: var(--navy); }
.btn-secondary { color: var(--navy); background: #eaf5fb; }
.btn-full { width: 100%; }
.error { color: var(--red); font-size: .9rem; margin-top: 8px; }
.notice { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; background: #eefaf2; color: #166534; }
.notice-error { background: #fff1f0; color: #b42318; }
.secure-note { color: var(--muted); font-size: .9rem; margin-top: 18px; }
.public-flow {
    width: min(100%, 1120px);
}
.public-card {
    width: min(100%, 560px);
}
.public-card.wide {
    width: 100%;
}
.inline-form {
    display: inline-flex;
    margin: 0;
}
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px;
    color: #dbeafe;
    background: #061d35;
}
.sidebar .brand { margin-bottom: 28px; color: #fff; }
.nav-list { display: grid; gap: 8px; }
.nav-list a, .logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: var(--radius);
    color: #dbeafe;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
}
.nav-list a:hover, .logout-btn:hover { background: rgba(255,255,255,.1); }
.main {
    min-width: 0;
}
.topbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,.9);
    backdrop-filter: blur(14px);
}
.content { padding: 28px; }
.page-title h1 { margin: 0 0 4px; color: var(--navy); font-size: clamp(1.7rem, 4vw, 2.3rem); }
.page-title p { margin: 0; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 24px 0; }
.dashboard-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    background: var(--surface);
    box-shadow: 0 10px 26px rgba(9, 39, 71, .06);
}
.stat strong { display: block; color: var(--navy); font-size: 2rem; }
.stat span { color: var(--muted); font-weight: 700; }
.section-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin: 26px 0 12px;
}
.section-head.compact { margin: 0 0 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--navy); font-size: .86rem; }
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 9px;
    background: #edf6ff;
    color: var(--blue);
    font-size: .78rem;
    font-weight: 800;
}
.badge.active { background: #eafaf0; color: #166534; }
.badge.planned { background: #fff7df; color: #8a5700; }
.badge.danger { background: #fff1f0; color: #b42318; }
.empty { color: var(--muted); padding: 28px; text-align: center; }
.settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}
.form-wide { grid-column: 1 / -1; }
.field small { color: var(--muted); }
.filter-bar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(180px, .45fr) minmax(160px, .35fr) auto auto;
    gap: 12px;
    align-items: end;
    margin: 24px 0;
}
.filter-bar .field { margin: 0; }
.field select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    background: #fff;
}
.entry-table select,
.entry-table input {
    width: 100%;
    min-width: 150px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px;
    background: #fff;
}
.table-link {
    color: var(--blue);
    font-weight: 800;
}
.pagination { margin-top: 16px; }
.phase-list {
    display: grid;
    gap: 12px;
}
.phase-card {
    display: grid;
    grid-template-columns: minmax(220px, .45fr) 1fr;
    gap: 16px;
    align-items: center;
    box-shadow: none;
}
.phase-card.done { border-left: 5px solid var(--green); }
.phase-card.current { border-left: 5px solid var(--gold); }
.phase-card.next { border-left: 5px solid var(--line); }
.phase-card h3,
.module-card h3 { margin: 10px 0 0; color: var(--navy); }
.phase-card p,
.module-card p { margin: 0; color: var(--muted); }
.module-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pdv-panel {
    border-top: 5px solid var(--gold);
}
@media (max-width: 880px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; }
    .stats, .dashboard-stats, .settings-grid, .filter-bar, .form-grid, .phase-card, .module-grid { grid-template-columns: 1fr; }
    .topbar, .content { padding-inline: 16px; }
}
