/* Final cascade layer for GESTORA Light/Dark color modes. */
:root {
    color-scheme:light;
    --theme-bg:#f4f7fb; --theme-surface:#fff; --theme-raised:#fff; --theme-soft:#f4f8fc;
    --theme-hover:#edf5ff; --theme-text:#102f59; --theme-muted:#627b96; --theme-border:#d7e3ef;
    --theme-accent:#2f72c4; --theme-accent-strong:#173b69; --theme-accent-soft:#eaf3ff;
    --theme-focus:rgba(47,114,196,.38); --theme-shadow:0 14px 38px rgba(18,55,91,.08);
    --theme-overlay:rgba(255,255,255,.9); --theme-success-bg:#e4f7ef; --theme-success-text:#087052;
    --theme-warning-bg:#fff2da; --theme-warning-text:#8a570e; --theme-danger-bg:#fde9eb; --theme-danger-text:#a93041;
    --ink:var(--theme-text); --muted:var(--theme-muted); --surface:var(--theme-surface); --bg:var(--theme-bg);
    --line:var(--theme-border); --green:var(--theme-accent); --green2:var(--theme-accent-strong);
    --mint:var(--theme-accent-soft); --emerald:var(--theme-accent); --emerald-dark:var(--theme-accent-strong);
    --teal:#5b8fd1; --shadow:var(--theme-shadow);
}
:root[data-theme="dark"] {
    color-scheme:dark;
    --theme-bg:#101722; --theme-surface:#182231; --theme-raised:#202c3d; --theme-soft:#1d2939;
    --theme-hover:#26364a; --theme-text:#f1f5fa; --theme-muted:#bdc9d7; --theme-border:#3b4d63;
    --theme-accent:#78b0ee; --theme-accent-strong:#b4d5fa; --theme-accent-soft:#203753;
    --theme-focus:rgba(120,176,238,.42); --theme-shadow:0 14px 36px rgba(0,0,0,.22);
    --theme-overlay:rgba(22,31,45,.94); --theme-success-bg:#173f36; --theme-success-text:#8de2c3;
    --theme-warning-bg:#45341e; --theme-warning-text:#f3c77f; --theme-danger-bg:#472a33; --theme-danger-text:#ffabb8;
    --blue:#8ab7ff; --violet:#b9a5f3; --amber:#f1bd68; --rose:#ff8fa7; --cyan:#72cbe0;
}
html{font-size:16px;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}
body{line-height:1.5}
[hidden]{display:none!important}
html,body{background-color:var(--theme-bg);color:var(--theme-text)}
body{background-image:radial-gradient(circle at 77% 4%,color-mix(in srgb,var(--theme-accent) 10%,transparent),transparent 25rem),radial-gradient(circle at 34% 38%,color-mix(in srgb,var(--theme-accent) 6%,transparent),transparent 32rem)}
.panel,.metric,.profile-card,.permission-list,.auth-card,.statement-section,.catalog-row,.line-editor,.report-cover{color:var(--theme-text);background-color:var(--theme-surface);border-color:var(--theme-border)}
.panel,.metric{background:var(--theme-surface);box-shadow:var(--theme-shadow)}
.panel:hover,.metric:hover{border-color:color-mix(in srgb,var(--theme-accent) 52%,var(--theme-border))}
.sidebar{color:var(--theme-text);background:linear-gradient(180deg,var(--theme-surface),var(--theme-soft));border-color:var(--theme-border);box-shadow:8px 0 32px rgba(0,0,0,.08)}
.brand{color:var(--theme-accent-strong);border-color:var(--theme-border)}
.brand-caption,.sidebar nav a,.nav-label,.sidebar-footer{color:var(--theme-muted)}
.sidebar nav a:hover,.sidebar nav a.active{color:var(--theme-accent-strong);background:var(--theme-accent-soft);box-shadow:inset 4px 0 var(--theme-accent)}
.sidebar-footer{border-color:var(--theme-border)}
.topbar{color:var(--theme-text);background:var(--theme-overlay);border-color:var(--theme-border)}
.topbar small,.page-head p,.company-card p{color:var(--theme-muted)}
.active-company strong{color:var(--theme-text)}
.company-pill,.period-status,.active-country{color:var(--theme-accent-strong);background:var(--theme-accent-soft)}
.company-pill.selected{color:#fff;background:linear-gradient(135deg,#173b69,#3979c6)}
.theme-setting{display:flex;align-items:center;gap:7px;margin-left:auto}.theme-setting svg{color:var(--theme-muted);flex:0 0 auto}
.theme-setting select{width:auto;min-width:82px;margin:0;padding:7px 28px 7px 9px;color:var(--theme-text)!important;background-color:var(--theme-soft)!important;border-color:var(--theme-border)!important;font-size:11px;font-weight:700}
.visually-hidden{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.button{color:var(--theme-text);background:var(--theme-raised);border-color:var(--theme-border)}
.button.primary{color:#fff;background:linear-gradient(135deg,#173b69,#3979c6)}.button.light{color:var(--theme-accent-strong);background:var(--theme-raised)}
input,select,textarea,.table-select,.table-input{color:var(--theme-text)!important;background-color:var(--theme-raised)!important;border-color:var(--theme-border)!important}
input::placeholder,textarea::placeholder{color:var(--theme-muted);opacity:.8}input:focus,select:focus,textarea:focus{border-color:var(--theme-accent)!important;box-shadow:0 0 0 4px var(--theme-focus)!important}
th,table thead{color:var(--theme-muted);background:var(--theme-soft)}td,th{border-color:var(--theme-border)}
.table-panel tbody tr,.table-panel tbody tr:nth-child(even){color:var(--theme-text);background:var(--theme-surface)}
.table-panel tbody tr:nth-child(even){background:color-mix(in srgb,var(--theme-raised) 58%,var(--theme-surface))}
.table-panel tbody tr:hover,.table-panel tbody tr:nth-child(even):hover,tbody tr:hover,table tbody tr:hover{background:var(--theme-hover)}
tfoot th,tfoot td,table tfoot{background:var(--theme-soft)}
.code,.eyebrow,.nav-icon{color:var(--theme-accent)!important}
.equation,.workflow,.company-card dl,.balance-value,.assignment-note,.empty,.empty-state,.report-basis,.entry-guide{color:var(--theme-text);background:var(--theme-soft);border-color:var(--theme-border)}
.steps span,.catalog-row:hover{color:var(--theme-text);background:var(--theme-raised);border-color:var(--theme-border)}
.revenue-section,.expense-section,.profit-total{background:var(--theme-soft);border-color:var(--theme-border)}
.statement .grand-total{color:var(--theme-accent-strong);background:var(--theme-accent-soft)}.statement .subtotal{border-color:var(--theme-text)}
.badge.success,.alert.success,.balance-check.ok{color:var(--theme-success-text);background:var(--theme-success-bg)}
.badge.warning,.alert.warning,.balance-check.not-ok{color:var(--theme-warning-text);background:var(--theme-warning-bg)}
.badge.error,.alert.error,.icon-button{color:var(--theme-danger-text);background:var(--theme-danger-bg)}
:root[data-theme="dark"] .badge:not(.success):not(.warning):not(.error){color:var(--theme-text);background:var(--theme-soft)}
:root[data-theme="dark"] .type-asset{color:#a9c6ff;background:#20345a}:root[data-theme="dark"] .type-liability{color:#f3c27c;background:#49351c}:root[data-theme="dark"] .type-equity{color:#c7b7f4;background:#352c55}:root[data-theme="dark"] .type-revenue{color:#82ddbd;background:#163d35}:root[data-theme="dark"] .type-expense{color:#ffacbc;background:#4a2832}
:root[data-theme="dark"] .metric-assets{--metric-soft:#20345a}:root[data-theme="dark"] .metric-liabilities{--metric-soft:#49351c}:root[data-theme="dark"] .metric-equity{--metric-soft:#352c55}:root[data-theme="dark"] .metric-profit{--metric-soft:#163d35}
:root[data-theme="dark"] .auth-content{background:var(--theme-bg)}:root[data-theme="dark"] .reconnect-card{color:var(--theme-text);background:var(--theme-surface);border-color:var(--theme-border)}
:root[data-theme="dark"] .brand img{background:#fff;border-radius:14px;padding:6px}
:root[data-theme="dark"] .button.primary,:root[data-theme="dark"] .company-pill.selected{background:linear-gradient(135deg,#285f9d,#397fc9)}

/* Dark-mode component contract. Historical feature styles must resolve through
   semantic surfaces here instead of retaining their original light colors. */
:root[data-theme="dark"] .chart-card-featured,
:root[data-theme="dark"] .loading-card,
:root[data-theme="dark"] .capability-card,
:root[data-theme="dark"] .permission-toggle,
:root[data-theme="dark"] .compact-form,
:root[data-theme="dark"] .breakdown-table-wrap,
:root[data-theme="dark"] .explain-box,
:root[data-theme="dark"] .method-note,
:root[data-theme="dark"] .owner-note,
:root[data-theme="dark"] .error-reference,
:root[data-theme="dark"] .profitability-metrics .metric-profit:not(.is-open):not(.danger-card){
    color:var(--theme-text);background:var(--theme-raised);border-color:var(--theme-border)
}
:root[data-theme="dark"] .donut:after{background:var(--theme-raised);box-shadow:inset 0 0 0 1px var(--theme-border)}
:root[data-theme="dark"] .legend-row:hover,
:root[data-theme="dark"] .rank-row:hover{background:var(--theme-hover)}
:root[data-theme="dark"] .profit-track{background:#2c3c50}
:root[data-theme="dark"] .positive{color:#70d9b7}
:root[data-theme="dark"] .negative{color:#ff9cab}
:root[data-theme="dark"] .capability-card strong,
:root[data-theme="dark"] .capability-card small,
:root[data-theme="dark"] .explain-box strong,
:root[data-theme="dark"] .explain-box p,
:root[data-theme="dark"] .method-note,
:root[data-theme="dark"] .owner-note{color:var(--theme-text)}
:root[data-theme="dark"] .capability-card small,
:root[data-theme="dark"] .explain-box p,
:root[data-theme="dark"] .method-note{color:var(--theme-muted)}
:root[data-theme="dark"] .capability-card.supported>span{color:#91e7c8;background:#17463a}
:root[data-theme="dark"] .capability-card.not-supported>span{color:#ffd18a;background:#4b371d}
:root[data-theme="dark"] .profile-preview>img,
:root[data-theme="dark"] .profile-preview>span,
:root[data-theme="dark"] .user-avatar{color:var(--theme-accent-strong);background:var(--theme-accent-soft)}
:root[data-theme="dark"] .profile-preview p,
:root[data-theme="dark"] .permission-user p,
:root[data-theme="dark"] .permission-toggle small{color:var(--theme-muted)}
:root[data-theme="dark"] input[type="file"]::file-selector-button{color:var(--theme-text);background:var(--theme-soft);border:1px solid var(--theme-border);border-radius:6px;padding:6px 9px}
@media(max-width:1100px){.theme-setting svg{display:none}.theme-setting select{min-width:74px}}
@media(max-width:700px){
    .topbar{display:grid;grid-template-columns:40px 38px minmax(72px,1fr) auto;gap:8px;padding:12px 14px}
    .topbar .menu-button{grid-column:1}.topbar .active-company{grid-column:2;min-width:0}.active-company>div{display:none}
    .topbar .company-switch{display:none}.theme-setting{grid-column:3;margin-left:0;justify-self:start}.theme-setting select{min-width:72px;max-width:82px}
    .topbar .user-menu{grid-column:4;margin-left:0;min-width:0}.user-menu div{display:none}.user-menu form button{white-space:nowrap}
}
@media print{:root{color-scheme:light!important;--ink:#102a43;--muted:#627d82;--surface:#fff;--bg:#fff;--line:#d9e7e4}html,body,.panel,.statement-section,.report-cover,.report-basis{color:#102a43!important;background:#fff!important;box-shadow:none!important}.theme-setting{display:none!important}}

/* Sidebar: quiet labels, reusable line icons, and native disclosure groups. */
.sidebar .brand{margin-bottom:10px;padding-bottom:14px}
.sidebar nav{display:flex;flex-direction:column;gap:3px}
.sidebar nav a:not(.active){font-weight:400}
.sidebar nav a.active{font-weight:700}
.sidebar nav a .nav-icon{display:grid;place-items:center;flex:0 0 28px;width:28px;height:28px;border-radius:8px;background:transparent;box-shadow:none}
.sidebar nav a .nav-icon svg{width:19px;height:19px}
.sidebar nav a.active .nav-icon{color:var(--theme-accent-strong)!important;background:transparent;box-shadow:none}
.nav-group{min-width:0}
.nav-group summary{display:flex;align-items:center;justify-content:space-between;min-height:38px;margin-top:7px;padding:7px 12px;border-radius:8px;color:var(--theme-muted);font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;cursor:pointer;list-style:none;user-select:none}
.nav-group summary::-webkit-details-marker{display:none}
.nav-group summary:hover,.nav-group[open] summary{color:var(--theme-accent-strong);background:var(--theme-hover)}
.nav-group summary:focus-visible{outline:3px solid var(--theme-focus);outline-offset:2px}
.nav-chevron{width:8px;height:8px;flex:0 0 8px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(-45deg);transition:transform .16s ease}
.nav-group[open] .nav-chevron{transform:rotate(45deg)}
.nav-group-items{display:flex;flex-direction:column;gap:2px;padding:3px 0 5px}
@media(min-width:701px){
    .shell.sidebar-collapsed .nav-group summary{justify-content:center;padding:7px 0;font-size:12px}
    .shell.sidebar-collapsed .nav-group summary::before{content:attr(data-short)}
    .shell.sidebar-collapsed .nav-section-title,.shell.sidebar-collapsed .nav-chevron{display:none}
}
@media(max-width:1350px) and (min-width:701px){
    .shell:not(.sidebar-expanded) .nav-group summary{justify-content:center;padding:7px 0;font-size:12px}
    .shell:not(.sidebar-expanded) .nav-group summary::before{content:attr(data-short)}
    .shell:not(.sidebar-expanded) .nav-section-title,.shell:not(.sidebar-expanded) .nav-chevron{display:none}
    .shell.sidebar-expanded .nav-group summary::before{content:none}
}
@media(prefers-reduced-motion:reduce){.nav-chevron{transition:none}}

/* Compact navigation keeps every destination identifiable without letter-only headings. */
.nav-compact-label,.nav-group summary > .nav-icon{display:none}
@media(min-width:701px){
    .shell.sidebar-collapsed .sidebar nav a,
    .shell.sidebar-collapsed .nav-group summary{min-height:64px;padding:7px 3px;justify-content:center;text-align:center}
    .shell.sidebar-collapsed .sidebar nav a .nav-icon,
    .shell.sidebar-collapsed .nav-group summary > .nav-icon{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;width:100%;height:auto;flex:1 1 auto;background:transparent;box-shadow:none}
    .shell.sidebar-collapsed .nav-group summary > .nav-icon svg{width:19px;height:19px}
    .shell.sidebar-collapsed .nav-compact-label{display:block;max-width:100%;font-size:10px;font-weight:500;line-height:1.15;letter-spacing:0;text-transform:none;overflow-wrap:anywhere}
    .shell.sidebar-collapsed .sidebar nav a.active .nav-compact-label{font-weight:700}
    .shell.sidebar-collapsed .nav-group summary::before{content:none}
}
@media(max-width:1350px) and (min-width:701px){
    .shell:not(.sidebar-expanded) .sidebar nav a,
    .shell:not(.sidebar-expanded) .nav-group summary{min-height:64px;padding:7px 3px;justify-content:center;text-align:center}
    .shell:not(.sidebar-expanded) .sidebar nav a .nav-icon,
    .shell:not(.sidebar-expanded) .nav-group summary > .nav-icon{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;width:100%;height:auto;flex:1 1 auto;background:transparent;box-shadow:none}
    .shell:not(.sidebar-expanded) .nav-group summary > .nav-icon svg{width:19px;height:19px}
    .shell:not(.sidebar-expanded) .nav-compact-label{display:block;max-width:100%;font-size:10px;font-weight:500;line-height:1.15;letter-spacing:0;text-transform:none;overflow-wrap:anywhere}
    .shell:not(.sidebar-expanded) .sidebar nav a.active .nav-compact-label{font-weight:700}
    .shell:not(.sidebar-expanded) .nav-group summary::before{content:none}
}

/* In the compact rail, a framed heading and connector rail distinguish sections from links. */
@media(min-width:701px){
    .shell.sidebar-collapsed .nav-group{margin-top:10px}
    .shell.sidebar-collapsed .nav-group summary{position:relative;margin-top:0;border:1px solid var(--theme-border);background:var(--theme-soft);color:var(--theme-accent-strong);border-radius:11px}
    .shell.sidebar-collapsed .nav-group summary:hover,
    .shell.sidebar-collapsed .nav-group[open] summary{border-color:var(--theme-accent-strong);background:var(--theme-hover)}
    .shell.sidebar-collapsed .nav-group summary::after{content:"";position:absolute;top:9px;right:7px;width:6px;height:6px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(45deg)}
    .shell.sidebar-collapsed .nav-group:not([open]) summary::after{transform:rotate(-45deg)}
    .shell.sidebar-collapsed .nav-group-items{position:relative;gap:1px;margin:4px 0 0 6px;padding:4px 0 4px 7px;border-left:1.5px solid var(--theme-border)}
    .shell.sidebar-collapsed .nav-group-items a{position:relative;min-height:58px}
    .shell.sidebar-collapsed .nav-group-items a::before{content:"";position:absolute;top:50%;left:-8px;width:8px;border-top:1.5px solid var(--theme-border)}
    .shell.sidebar-collapsed .nav-group-items a.active::before{border-color:var(--theme-accent-strong)}
}
@media(max-width:1350px) and (min-width:701px){
    .shell:not(.sidebar-expanded) .nav-group{margin-top:10px}
    .shell:not(.sidebar-expanded) .nav-group summary{position:relative;margin-top:0;border:1px solid var(--theme-border);background:var(--theme-soft);color:var(--theme-accent-strong);border-radius:11px}
    .shell:not(.sidebar-expanded) .nav-group summary:hover,
    .shell:not(.sidebar-expanded) .nav-group[open] summary{border-color:var(--theme-accent-strong);background:var(--theme-hover)}
    .shell:not(.sidebar-expanded) .nav-group summary::after{content:"";position:absolute;top:9px;right:7px;width:6px;height:6px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(45deg)}
    .shell:not(.sidebar-expanded) .nav-group:not([open]) summary::after{transform:rotate(-45deg)}
    .shell:not(.sidebar-expanded) .nav-group-items{position:relative;gap:1px;margin:4px 0 0 6px;padding:4px 0 4px 7px;border-left:1.5px solid var(--theme-border)}
    .shell:not(.sidebar-expanded) .nav-group-items a{position:relative;min-height:58px}
    .shell:not(.sidebar-expanded) .nav-group-items a::before{content:"";position:absolute;top:50%;left:-8px;width:8px;border-top:1.5px solid var(--theme-border)}
    .shell:not(.sidebar-expanded) .nav-group-items a.active::before{border-color:var(--theme-accent-strong)}
}

/* Keep the expanded control beside the logo and the compact control below it. */
@media(min-width:701px){
    .shell .sidebar{padding-top:18px}
    .sidebar-header{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;flex:none;width:100%;margin-bottom:10px;padding-bottom:12px;border-bottom:1px solid var(--theme-border)}
    .sidebar-header .brand{order:-1;display:flex;align-items:flex-start;justify-content:flex-start;flex:1 1 auto;min-width:0;margin:0;padding:0;border:0}
    .sidebar-header .brand-logo{width:min(146px,100%);height:70px}
    .sidebar-header .sidebar-brand-toggle{align-self:flex-start;flex:0 0 36px;width:36px;height:36px;margin:0;border:1px solid transparent;border-radius:10px;color:var(--theme-text);background:transparent;box-shadow:none}
    .sidebar-header .sidebar-brand-toggle:hover{border-color:var(--theme-border);background:var(--theme-hover);box-shadow:none}
    .sidebar-header .sidebar-brand-toggle:focus-visible{outline:3px solid var(--theme-focus);outline-offset:2px}
    .shell.sidebar-collapsed .sidebar-header{flex-direction:column;align-items:center}
    .shell.sidebar-collapsed .sidebar-header .brand{order:-1;flex:none;justify-content:center;width:100%}
    .shell.sidebar-collapsed .sidebar-header .brand-logo{width:58px;height:58px}
    .shell.sidebar-collapsed .sidebar-header .sidebar-brand-toggle{align-self:center}
}
@media(max-width:1350px) and (min-width:701px){
    .shell:not(.sidebar-expanded) .sidebar-header{flex-direction:column;align-items:center}
    .shell:not(.sidebar-expanded) .sidebar-header .brand{order:-1;flex:none;justify-content:center;width:100%}
    .shell:not(.sidebar-expanded) .sidebar-header .brand-logo{width:58px;height:58px}
    .shell:not(.sidebar-expanded) .sidebar-header .sidebar-brand-toggle{align-self:center}
}
@media(max-width:700px){
    .sidebar-header{display:flex;justify-content:center}
    .sidebar-header .brand{margin-bottom:10px}
}

@media(min-width:701px){
    .nav-group summary[title="Configuration"] .nav-compact-label{font-size:9px;letter-spacing:-.02em}
}
