:root {
    --navy-950: #0c1d32;
    --navy-900: #10233c;
    --navy-800: #17304f;
    --navy-700: #245a8d;
    --emerald-700: #177255;
    --emerald-600: #1e8a6a;
    --emerald-100: #e4efe8;
    --sage-200: #dce7df;
    --paper: #f6f3ec;
    --card: #fffefa;
    --card-strong: #ffffff;
    --sand-100: #f3eee5;
    --sand-200: #e8e1d4;
    --sand-300: #d9cfbf;
    --ink: #12233a;
    --muted: #6a706f;
    --danger: #b44343;
    --danger-soft: #f8e7e4;
    --success-soft: #e5f2e9;
    --shadow-sm: 0 2px 6px rgba(22, 38, 57, 0.04);
    --shadow-md: 0 12px 34px rgba(22, 38, 57, 0.08);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --sidebar-width: 252px;
    --topbar-height: 78px;
    --transition: 180ms ease;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper);
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--paper);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 72% 0%, rgba(255, 255, 255, 0.8), transparent 30rem),
        var(--paper);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    color: inherit;
}

input,
select,
textarea {
    color: var(--ink);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(30, 138, 106, 0.22);
    outline-offset: 2px;
}

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

h1,
h2,
h3,
strong {
    letter-spacing: -0.025em;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(2rem, 4vw, 3.05rem);
    line-height: 1.06;
    font-weight: 680;
}

h2 {
    margin-bottom: 0;
    font-size: 1.3rem;
    line-height: 1.25;
    font-weight: 680;
}

h3 {
    margin-bottom: 6px;
    font-size: 1.06rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.icon {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    padding: 25px 16px 18px;
    overflow-y: auto;
    color: #eef5f2;
    background:
        radial-gradient(circle at 0 0, rgba(46, 132, 108, 0.2), transparent 18rem),
        linear-gradient(180deg, var(--navy-900), var(--navy-950));
}

.sidebar-header {
    display: flex;
    min-height: 62px;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0 8px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.035em;
}

.brand-mark {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid rgba(111, 205, 159, 0.65);
    border-radius: 11px;
    color: #f8fcfa;
    background: rgba(255, 255, 255, 0.03);
    box-shadow: inset 0 0 24px rgba(60, 172, 131, 0.12);
    font-weight: 600;
}

.sidebar-close {
    display: none !important;
    color: #ffffff;
}

.main-nav {
    display: grid;
    gap: 7px;
    margin-top: 34px;
}

.nav-link {
    display: flex;
    min-height: 60px;
    align-items: center;
    gap: 13px;
    padding: 11px 14px;
    border-radius: 15px;
    color: rgba(239, 247, 244, 0.78);
    transition: background var(--transition), color var(--transition), transform var(--transition);
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.065);
    transform: translateX(2px);
}

.nav-link.active {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(66, 145, 118, 0.62), rgba(66, 145, 118, 0.4));
    box-shadow: inset 0 0 0 1px rgba(151, 217, 183, 0.08);
}

.nav-link > span {
    min-width: 0;
}

.nav-link strong,
.nav-link small {
    display: block;
    letter-spacing: 0;
}

.nav-link strong {
    font-size: 0.95rem;
    font-weight: 600;
}

.nav-link small {
    margin-top: 1px;
    overflow: hidden;
    color: rgba(239, 247, 244, 0.55);
    font-size: 0.7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-link.active small {
    color: rgba(255, 255, 255, 0.72);
}

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: auto;
    padding: 18px 10px 3px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.78rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #70c69e;
    box-shadow: 0 0 0 4px rgba(112, 198, 158, 0.1);
}

.workspace {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 25;
    display: flex;
    height: var(--topbar-height);
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 clamp(20px, 3.2vw, 48px);
    border-bottom: 1px solid rgba(217, 207, 191, 0.72);
    background: rgba(246, 243, 236, 0.88);
    backdrop-filter: blur(18px);
}

.topbar-context {
    color: var(--muted);
    font-size: 0.83rem;
    font-weight: 600;
}

.mobile-brand,
.mobile-menu {
    display: none !important;
}

.topbar-actions,
.heading-actions,
.button-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.year-selector select {
    min-width: 104px;
    height: 44px;
    padding: 0 36px 0 14px;
    border: 1px solid var(--sand-300);
    border-radius: 11px;
    background: var(--card);
    font-weight: 650;
    cursor: pointer;
}

.icon-button {
    display: inline-grid;
    width: 42px;
    height: 42px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 11px;
    background: transparent;
    cursor: pointer;
    transition: color var(--transition), background var(--transition), transform var(--transition);
}

.icon-button:hover {
    background: var(--sand-100);
}

.icon-button.danger {
    color: var(--danger);
}

.icon-button.danger:hover {
    background: var(--danger-soft);
}

.sensitive-toggle {
    border: 1px solid var(--sand-300);
    background: var(--card);
}

.main-content {
    width: min(100%, 1580px);
    margin: 0 auto;
    padding: 38px clamp(20px, 3.2vw, 48px) 70px;
}

.page-heading {
    display: flex;
    min-height: 108px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 28px;
}

.page-heading > div:first-child {
    max-width: 760px;
}

.page-heading p:last-child {
    margin-bottom: 0;
    color: var(--muted);
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--emerald-700);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 17px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: 0.86rem;
    font-weight: 680;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
}

.button:hover {
    transform: translateY(-1px);
}

.button .icon {
    width: 18px;
    height: 18px;
}

.button.primary {
    color: #ffffff;
    background: var(--navy-900);
    box-shadow: 0 7px 18px rgba(16, 35, 60, 0.16);
}

.button.primary:hover {
    background: var(--navy-800);
    box-shadow: 0 10px 24px rgba(16, 35, 60, 0.2);
}

.button.secondary {
    border-color: var(--sand-300);
    background: var(--card);
}

.button.secondary:hover {
    border-color: #b9ae9e;
    background: #ffffff;
}

.button.ghost {
    border-color: var(--sand-200);
    background: transparent;
}

.button.small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.76rem;
}

.panel {
    border: 1px solid var(--sand-200);
    border-radius: var(--radius-md);
    background: rgba(255, 254, 250, 0.9);
    box-shadow: var(--shadow-sm);
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 24px 18px;
}

.panel-header .eyebrow {
    margin-bottom: 5px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric-card {
    position: relative;
    display: grid;
    min-height: 164px;
    grid-template-columns: 1fr auto;
    align-content: space-between;
    gap: 12px;
    padding: 24px;
    overflow: hidden;
    border: 1px solid var(--sand-200);
    border-radius: var(--radius-md);
    background: rgba(255, 254, 250, 0.92);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.metric-card:hover {
    z-index: 1;
    border-color: #d0c5b5;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.metric-card.featured::after {
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--emerald-600);
    content: "";
}

.metric-card span {
    color: #4f575b;
    font-size: 0.86rem;
    font-weight: 600;
}

.metric-card strong {
    display: block;
    margin-top: 13px;
    font-size: clamp(1.45rem, 2.3vw, 2rem);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
}

.metric-card.featured strong,
.metric-card:nth-child(2) strong {
    color: var(--emerald-700);
}

.metric-card small {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 0.72rem;
}

.metric-icon {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 50%;
}

.metric-icon .icon {
    width: 21px;
    height: 21px;
}

.metric-icon.positive {
    color: var(--emerald-700);
    background: var(--emerald-100);
}

.metric-icon.neutral {
    color: #8a7458;
    background: var(--sand-100);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.85fr) minmax(310px, 0.85fr);
    gap: 18px;
    margin-bottom: 18px;
}

.chart-panel,
.quick-panel {
    min-height: 430px;
}

.chart {
    min-height: 330px;
    padding: 0 18px 18px;
}

.chart.compact {
    min-height: 245px;
}

.chart svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart-empty {
    display: grid;
    min-height: 280px;
    place-items: center;
    color: var(--muted);
    text-align: center;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 0 6px 12px;
    color: var(--muted);
    font-size: 0.74rem;
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.chart-legend i {
    width: 18px;
    height: 3px;
    border-radius: 3px;
}

.text-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--emerald-700);
    font-size: 0.8rem;
    font-weight: 700;
}

.text-link .icon {
    width: 16px;
    height: 16px;
    transition: transform var(--transition);
}

.text-link:hover .icon {
    transform: translateX(3px);
}

.quick-panel {
    padding-bottom: 12px;
}

.quick-card {
    display: grid;
    min-height: 93px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    margin: 0 14px 12px;
    padding: 14px;
    border: 1px solid var(--sand-200);
    border-radius: 13px;
    background: var(--card-strong);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.quick-card:hover {
    border-color: #c7bcac;
    box-shadow: var(--shadow-md);
    transform: translateX(2px);
}

.quick-card > .icon {
    width: 18px;
    color: var(--muted);
}

.quick-card strong,
.quick-card small {
    display: block;
}

.quick-card strong {
    margin-bottom: 2px;
    font-size: 0.9rem;
}

.quick-card small {
    color: var(--muted);
    font-size: 0.72rem;
}

.quick-icon {
    display: grid;
    width: 50px;
    height: 50px;
    place-items: center;
    border-radius: 13px;
    color: var(--emerald-700);
    background: var(--emerald-100);
}

.patrimony-overview {
    min-height: 320px;
}

.compact-metrics {
    display: flex;
    gap: 24px;
    color: var(--muted);
    font-size: 0.75rem;
}

.compact-metrics span,
.compact-metrics strong {
    display: block;
}

.compact-metrics strong {
    margin-top: 3px;
    color: var(--ink);
    font-size: 0.95rem;
}

.summary-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
    overflow: hidden;
    border: 1px solid var(--sand-200);
    border-radius: var(--radius-md);
    background: var(--card);
}

.summary-strip > div {
    min-width: 0;
    padding: 18px 22px;
    border-right: 1px solid var(--sand-200);
}

.summary-strip > div:last-child {
    border-right: 0;
}

.summary-strip span,
.summary-strip strong {
    display: block;
}

.editable-summary {
    position: relative;
}

.editable-summary > button {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 0;
    border: 0;
    color: var(--emerald-700);
    background: transparent;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
}

.summary-strip span {
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 0.75rem;
}

.summary-strip strong {
    overflow: hidden;
    font-size: 1.22rem;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.positive-text {
    color: var(--emerald-700) !important;
}

.negative-text {
    color: var(--danger) !important;
}

.data-form {
    overflow: hidden;
}

.autosave-note {
    color: var(--muted);
    font-size: 0.72rem;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    border-top: 1px solid var(--sand-200);
    border-bottom: 1px solid var(--sand-200);
    scrollbar-color: var(--sand-300) transparent;
}

.data-table {
    width: 100%;
    min-width: 860px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.patrimony-table {
    min-width: 1160px;
}

.data-table th,
.data-table td {
    height: 58px;
    padding: 8px 12px;
    border-right: 1px solid #eee9df;
    border-bottom: 1px solid #eee9df;
    text-align: left;
    white-space: nowrap;
}

.data-table th:last-child,
.data-table td:last-child {
    border-right: 0;
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    height: 44px;
    color: #5d635f;
    background: #f2eee6;
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.data-table thead th:first-child,
.data-table tbody th,
.data-table tfoot th {
    position: sticky;
    left: 0;
    z-index: 6;
}

.data-table tbody th {
    min-width: 112px;
    background: var(--card);
    font-weight: 650;
}

.data-table tbody td {
    background: rgba(255, 255, 255, 0.66);
}

.data-table tbody tr:hover td,
.data-table tbody tr:hover th {
    background: #fcfaf5;
}

.data-table tbody tr.focused-row td,
.data-table tbody tr.focused-row th {
    background: #f2f8f4;
}

.data-table tfoot th,
.data-table tfoot td {
    height: 62px;
    border-bottom: 0;
    background: #f2eee6;
    font-weight: 750;
}

.money-field {
    position: relative;
    min-width: 116px;
}

.money-field input,
.notes-input {
    width: 100%;
    height: 38px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.money-field input {
    padding: 0 29px 0 9px;
    text-align: right;
}

.money-field span {
    position: absolute;
    top: 50%;
    right: 10px;
    color: #8b8f8d;
    transform: translateY(-50%);
    pointer-events: none;
}

.notes-input {
    min-width: 150px;
    padding: 0 9px;
}

.money-field input:hover,
.money-field input:focus,
.notes-input:hover,
.notes-input:focus {
    border-color: var(--sand-300);
    background: #ffffff;
}

.calculated-cell {
    min-width: 112px;
    font-weight: 680;
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px;
}

.form-footer > span {
    color: var(--muted);
    font-size: 0.74rem;
}

.section-block {
    margin-bottom: 34px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 15px;
}

.section-heading > span {
    color: var(--muted);
    font-size: 0.77rem;
}

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

.module-card {
    position: relative;
    display: flex;
    min-height: 250px;
    flex-direction: column;
    padding: 22px;
    overflow: hidden;
    border: 1px solid var(--sand-200);
    border-radius: var(--radius-md);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.module-card:hover {
    border-color: #cbbfae;
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.module-icon,
.project-symbol,
.settings-icon {
    display: grid;
    width: 50px;
    height: 50px;
    place-items: center;
    border-radius: 13px;
    color: var(--emerald-700);
    background: var(--emerald-100);
}

.module-card .status-pill {
    position: absolute;
    top: 22px;
    right: 22px;
}

.module-card > div {
    margin-top: 36px;
}

.module-card p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.module-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 25px;
    color: var(--emerald-700);
    font-size: 0.78rem;
    font-weight: 700;
}

.module-link .icon {
    width: 17px;
}

.module-link.as-button {
    width: 100%;
    border: 0;
    background: none;
    cursor: pointer;
}

.patrimony-module .module-icon {
    color: var(--navy-700);
    background: #e7edf3;
}

.placeholder-module {
    border-style: dashed;
    background: rgba(255, 254, 250, 0.42);
}

.placeholder-module .module-icon {
    color: #857c6f;
    background: var(--sand-100);
}

.status-pill {
    display: inline-flex;
    min-height: 25px;
    align-items: center;
    padding: 0 9px;
    border-radius: 999px;
    color: #6f6b63;
    background: var(--sand-100);
    font-size: 0.65rem;
    font-weight: 750;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.status-pill.active,
.status-pill.activo {
    color: var(--emerald-700);
    background: var(--emerald-100);
}

.status-pill.pausado {
    color: #9a613a;
    background: #f6e9de;
}

.project-card {
    --project-accent: var(--emerald-600);
    display: flex;
    min-height: 225px;
    flex-direction: column;
    padding: 20px;
    border: 1px solid var(--sand-200);
    border-top: 4px solid var(--project-accent);
    border-radius: var(--radius-md);
    background: var(--card);
    box-shadow: var(--shadow-sm);
}

.project-card-top,
.project-card footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.project-card > div:nth-child(2) {
    margin: 22px 0;
}

.project-card p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.project-card footer {
    margin-top: auto;
}

.project-symbol {
    color: var(--project-accent);
    background: color-mix(in srgb, var(--project-accent) 12%, white);
}

.muted {
    color: var(--muted);
    font-size: 0.76rem;
}

.empty-state {
    display: grid;
    min-height: 270px;
    place-items: center;
    align-content: center;
    padding: 30px;
    text-align: center;
}

.empty-state p {
    max-width: 440px;
    color: var(--muted);
}

.empty-icon {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    margin-bottom: 15px;
    border-radius: 50%;
    color: var(--emerald-700);
    background: var(--emerald-100);
}

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

.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.profile-card { overflow: hidden; }
.profile-card .stack-form { gap: 13px; }
.profile-card label small { color: var(--muted); font-weight: 500; }

.settings-card {
    display: grid;
    min-height: 245px;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 18px;
    padding: 24px;
}

.settings-card > div p:last-child {
    color: var(--muted);
    font-size: 0.82rem;
}

.settings-card > .button,
.settings-card > .button-group {
    grid-column: 1 / -1;
    align-self: end;
    justify-self: start;
}

.archive-panel { display: grid; grid-template-columns: 1.25fr .75fr; align-items: center; gap: 28px; margin-bottom: 18px; padding: 26px; }
.archive-panel p:last-child { margin-bottom: 0; color: var(--muted); font-size: .8rem; }
.archive-actions { display: grid; gap: 10px; }
.archive-actions form { width: 100%; }
.archive-button { width: 100%; justify-content: center; color: #873a36; border: 1px solid #e6bbb5; background: var(--danger-soft); }
.archive-button:hover { background: #f3d6d1; }

.import-panel {
    margin-bottom: 18px;
    overflow: hidden;
}

.import-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--sand-200);
}

.import-card {
    position: relative;
    display: flex;
    min-height: 315px;
    flex-direction: column;
    align-items: flex-start;
    padding: 26px;
}

.import-card + .import-card {
    border-left: 1px solid var(--sand-200);
}

.import-card p {
    color: var(--muted);
    font-size: 0.8rem;
}

.import-card .text-link {
    margin-top: 15px;
}

.import-number {
    position: absolute;
    top: 24px;
    right: 25px;
    color: var(--sand-300);
    font-size: 1.5rem;
    font-weight: 750;
}

.file-field {
    width: 100%;
    margin: 14px 0;
    padding: 15px;
    border: 1px dashed var(--sand-300);
    border-radius: 11px;
    background: #faf8f3;
    cursor: pointer;
}

.file-field span {
    display: block;
    margin-bottom: 7px;
    font-size: 0.76rem;
    font-weight: 650;
}

.file-field input {
    width: 100%;
    color: var(--muted);
    font-size: 0.72rem;
}

.info-banner {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin: 0 22px 22px;
    padding: 14px 16px;
    border-radius: 11px;
    color: #4f6067;
    background: #eaf0f3;
    font-size: 0.78rem;
}

.info-banner > span {
    display: grid;
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    color: #ffffff;
    background: var(--navy-700);
    font-weight: 750;
}

.info-banner p {
    margin: 1px 0 0;
}

.system-panel {
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    gap: 30px;
    padding: 26px;
}

.system-panel > div > p:last-child {
    max-width: 720px;
    margin-bottom: 0;
    color: var(--muted);
}

.health-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: #46534e;
    font-size: 0.78rem;
}

.health-list li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.health-list .icon {
    width: 17px;
    height: 17px;
    color: var(--emerald-700);
}

.app-dialog {
    width: min(92vw, 590px);
    max-height: min(82vh, 780px);
    padding: 0;
    overflow: auto;
    border: 1px solid var(--sand-200);
    border-radius: 18px;
    color: var(--ink);
    background: var(--card);
    box-shadow: 0 30px 100px rgba(9, 26, 45, 0.28);
}

.compact-dialog {
    width: min(92vw, 460px);
}

.dialog-note {
    margin: -5px 0 0;
    color: var(--muted);
    font-size: 0.72rem;
}

.app-dialog::backdrop {
    background: rgba(8, 25, 43, 0.55);
    backdrop-filter: blur(5px);
}

.dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 24px;
    border-bottom: 1px solid var(--sand-200);
}

.inline-form {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 10px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--sand-200);
}

.inline-form label span,
.stack-form label span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 650;
}

.inline-form input,
.stack-form input,
.stack-form select,
.stack-form textarea,
.install-form input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--sand-300);
    border-radius: 10px;
    background: #ffffff;
}

.stack-form {
    display: grid;
    gap: 16px;
    padding: 24px;
}

.stack-form textarea {
    resize: vertical;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 120px;
    gap: 12px;
}

.account-list {
    display: grid;
    padding: 10px 24px 24px;
}

.account-list > div {
    display: flex;
    min-height: 65px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--sand-200);
}

.account-list strong,
.account-list small {
    display: block;
}

.account-list small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.7rem;
}

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding: 13px 15px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: 0.8rem;
}

.alert > span {
    display: inline-grid;
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    font-weight: 750;
}

.alert .icon {
    width: 15px;
}

.alert.success {
    border-color: #c8e2d2;
    color: #285941;
    background: var(--success-soft);
}

.alert.success > span {
    color: #ffffff;
    background: var(--emerald-600);
}

.alert.error {
    border-color: #eccbc6;
    color: #873a36;
    background: var(--danger-soft);
}

.alert.error > span {
    color: #ffffff;
    background: var(--danger);
}

.values-hidden .sensitive-value {
    color: transparent !important;
    font-size: 0 !important;
    user-select: none;
}

.values-hidden .sensitive-value::after {
    color: var(--ink);
    content: "••••••";
    font-size: 1rem;
    letter-spacing: 0.14em;
}

.sidebar-backdrop,
.mobile-nav {
    display: none;
}

code {
    padding: 2px 5px;
    border-radius: 5px;
    color: #4e554f;
    background: var(--sand-100);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78em;
}

.install-body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 30px;
    background:
        radial-gradient(circle at 20% 0%, rgba(30, 138, 106, 0.17), transparent 27rem),
        var(--navy-950);
}

.access-body { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(circle at 12% 0%, rgba(30,138,106,.2), transparent 27rem), var(--navy-950); }
.access-shell { width: min(100%, 580px); }
.access-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; color: #fff; }
.access-brand span { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 11px; background: var(--emerald-600); font-size: .8rem; font-weight: 800; }
.access-card, .portal-card { padding: clamp(28px, 7vw, 52px); border-radius: var(--radius-lg); background: var(--card); box-shadow: 0 30px 100px rgba(0,0,0,.28); }
.access-card > p:not(.eyebrow), .portal-card > p:not(.eyebrow) { color: var(--muted); }
.access-form { display: grid; gap: 15px; margin-top: 25px; }
.access-form label { color: var(--muted); font-size: .76rem; font-weight: 650; }
.access-form input { display: block; width: 100%; min-height: 46px; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--sand-300); border-radius: 10px; background: #fff; }
.access-error { padding: 10px 12px; border-radius: 9px; color: #873a36; background: var(--danger-soft); font-size: .8rem; }
.portal-top { display: flex; align-items: center; justify-content: space-between; }
.portal-logout, .logout-form button { border: 0; color: inherit; background: transparent; cursor: pointer; font: inherit; }
.portal-logout { color: rgba(255,255,255,.78); font-size: .78rem; }
.portal-module { display: flex; align-items: center; gap: 16px; margin-top: 28px; padding: 18px; border: 1px solid var(--sand-200); border-radius: 14px; background: #fff; transition: transform var(--transition), box-shadow var(--transition); }
.portal-module:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.portal-module > span { display: grid; width: 45px; height: 45px; place-items: center; border-radius: 12px; color: var(--emerald-700); background: var(--emerald-100); font-weight: 800; }
.portal-module div { display: grid; gap: 2px; }
.portal-module small { color: var(--muted); font-size: .75rem; }
.portal-module b { margin-left: auto; color: var(--emerald-700); font-size: 1.25rem; }
.logout-form { margin-left: auto; }
.logout-form button { color: rgba(255,255,255,.7); font-size: .72rem; }

.install-shell {
    width: min(100%, 780px);
}

.install-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    color: #ffffff;
}

.install-brand strong,
.install-brand span {
    display: block;
}

.install-brand > div > span {
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.74rem;
}

.install-card {
    padding: clamp(25px, 5vw, 48px);
    border-radius: var(--radius-lg);
    background: var(--card);
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.28);
}

.install-card > p:not(.eyebrow, .install-note) {
    color: var(--muted);
}

.install-form {
    display: grid;
    grid-template-columns: 1fr 140px;
    gap: 16px;
    margin-top: 25px;
}

.install-form label {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 650;
}

.install-form input {
    display: block;
    margin-top: 6px;
}

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

.install-icon {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    margin-bottom: 22px;
    border-radius: 50%;
    font-size: 1.5rem;
}

.install-icon.success {
    color: #ffffff;
    background: var(--emerald-600);
}

.install-note {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 0.7rem;
}

.mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 50;
    height: 67px;
    align-items: center;
    justify-content: space-around;
    padding: 5px 7px max(5px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--sand-200);
    background: rgba(255, 254, 250, 0.95);
    backdrop-filter: blur(16px);
}

.mobile-nav a {
    display: grid;
    min-width: 52px;
    place-items: center;
    gap: 2px;
    color: #7b807d;
    font-size: 0.59rem;
    font-weight: 650;
}

.mobile-nav a.active {
    color: var(--emerald-700);
}

.mobile-nav .icon {
    width: 21px;
    height: 21px;
}

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

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

    .quick-panel {
        min-height: 0;
    }

    .module-grid,
    .project-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 920px) {
    :root {
        --sidebar-width: 228px;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 220ms ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: inline-grid !important;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 35;
        background: rgba(8, 25, 43, 0.52);
        backdrop-filter: blur(3px);
    }

    .sidebar.open + .sidebar-backdrop {
        display: block;
    }

    .workspace {
        margin-left: 0;
    }

    .mobile-menu {
        display: inline-grid !important;
    }

    .topbar {
        padding-inline: 20px;
    }

    .topbar-context {
        margin-right: auto;
    }

    .desktop-context {
        display: none;
    }

    .mobile-brand {
        display: inline !important;
        color: var(--ink);
        font-size: 1rem;
        font-weight: 720;
    }

    .main-content {
        padding: 30px 20px 95px;
    }

    .system-panel {
        grid-template-columns: 1fr;
    }

    .archive-panel { grid-template-columns: 1fr; }

    .mobile-nav {
        display: flex;
    }
}

@media (max-width: 700px) {
    h1 {
        font-size: 2.15rem;
    }

    .topbar {
        height: 66px;
    }

    .topbar-actions {
        gap: 6px;
    }

    .year-selector select {
        min-width: 84px;
        height: 40px;
    }

    .icon-button {
        width: 40px;
        height: 40px;
    }

    .page-heading {
        min-height: 0;
        flex-direction: column;
        gap: 18px;
        margin-bottom: 24px;
    }

    .heading-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .heading-actions .button {
        flex: 1 1 auto;
    }

    .metric-grid,
    .summary-strip,
    .settings-grid,
    .profile-grid,
    .import-grid,
    .module-grid,
    .project-grid {
        grid-template-columns: 1fr;
    }

    .metric-card {
        min-height: 142px;
    }

    .summary-strip > div {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 15px;
        padding: 15px 18px;
        border-right: 0;
        border-bottom: 1px solid var(--sand-200);
    }

    .summary-strip > div:last-child {
        border-bottom: 0;
    }

    .summary-strip span {
        margin-bottom: 0;
    }

    .summary-strip strong {
        font-size: 1rem;
    }

    .panel-header,
    .form-footer,
    .system-panel {
        padding: 18px;
    }

    .panel-header {
        flex-direction: column;
    }

    .compact-metrics {
        width: 100%;
        justify-content: space-between;
    }

    .chart {
        min-height: 260px;
        padding-inline: 9px;
    }

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

    .form-footer .button {
        width: 100%;
    }

    .import-card + .import-card {
        border-top: 1px solid var(--sand-200);
        border-left: 0;
    }

    .settings-card {
        min-height: 220px;
    }

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

    .account-list > div {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 0;
    }

    .install-body {
        padding: 18px;
    }

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

    .install-form label,
    .install-form .full {
        grid-column: 1;
    }
}

@media (max-width: 430px) {
    .main-content {
        padding-inline: 14px;
    }

    .topbar {
        padding-inline: 12px;
    }

    .sensitive-toggle {
        display: none;
    }

    .metric-grid {
        gap: 10px;
    }

    .metric-card {
        padding: 19px;
    }

    .module-card {
        min-height: 230px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
