/* CEO feedback 2: compact, readable navigation and stable header actions. */
.shell .sidebar .nav-group summary,
.shell .sidebar .nav-group[open] summary { background:transparent; border:0; box-shadow:none; }
.shell .sidebar .nav-group[open] {
    background:var(--theme-soft); border-radius:10px;
    padding-bottom:8px; margin-bottom:8px;
}
.shell .sidebar .nav-group[open] > summary { color:var(--theme-accent-strong); }
.shell .sidebar .nav-group .nav-group-items {
    border-left:2px solid var(--theme-border);
    margin:2px 10px 0 20px; padding:2px 0 2px 10px;
}
.shell .sidebar .nav-group-items a::before { content:none; }
.shell .sidebar .nav-group > summary { justify-content:flex-start; text-align:left; }
.shell .sidebar .nav-group > summary .nav-chevron { margin-left:auto; }
@media(min-width:701px) {
    .shell.sidebar-collapsed .sidebar .nav-group > summary { justify-content:center; text-align:center; }
    .shell.sidebar-collapsed .sidebar .nav-group .nav-group-items {
        margin:2px 6px 0 10px; padding:2px 0 2px 6px;
    }
}
@media(min-width:701px) {
    .shell:not(.sidebar-collapsed) .sidebar .nav-group summary > .nav-icon {
        display:inline-flex; align-items:center; justify-content:center;
        width:20px; height:20px; flex:0 0 20px;
    }
    .shell:not(.sidebar-collapsed) .sidebar .nav-group summary > .nav-icon .nav-compact-label { display:none; }
    .shell:not(.sidebar-collapsed) .sidebar .nav-group summary { gap:10px; min-height:40px; }
    .shell:not(.sidebar-collapsed) .sidebar nav a { min-height:44px; align-items:center; gap:10px; }
    .shell:not(.sidebar-collapsed) .sidebar nav a > span:last-child {
        white-space:normal; overflow-wrap:normal; word-break:normal; line-height:1.4;
    }
}
/* Shared page headers: restrained branding, compact proportions, clear actions. */
.page-head.dashboard-hero,
.page-head.profitability-head {
    padding:24px 28px; min-height:0; gap:24px; align-items:center;
    background:linear-gradient(120deg,#173b69,#2f65ad 56%,#5b93d5);
    border:1px solid rgba(255,255,255,.16); border-radius:12px;
    box-shadow:0 2px 8px rgba(18,55,91,.03); overflow:hidden;
}
.page-head.dashboard-hero::before,.page-head.dashboard-hero::after,
.page-head.profitability-head::before,.page-head.profitability-head::after { content:none; }
.page-head.dashboard-hero h1,.page-head.profitability-head h1 {
    font-family:inherit; font-size:clamp(25px,2.3vw,32px); font-weight:650;
    line-height:1.2; letter-spacing:-.025em; margin:4px 0 8px;
    color:#fff!important;
}
.page-head.dashboard-hero .eyebrow,.page-head.profitability-head .eyebrow {
    color:#e1edff!important; text-shadow:none; margin:0;
    font-size:10px; letter-spacing:.1em;
}
.page-head.dashboard-hero > div > p:not(.eyebrow),
.page-head.profitability-head > div > p:not(.eyebrow) {
    color:#fff!important; font-size:14px; line-height:1.5;
}
.page-head.dashboard-hero .head-actions,.page-head.profitability-head .head-actions {
    display:flex; flex-wrap:wrap; gap:10px; flex-shrink:0;
}
.page-head.dashboard-hero .button,.page-head.profitability-head .button {
    background:rgba(255,255,255,.1); color:#fff;
    border:1px solid rgba(255,255,255,.5); border-radius:8px;
    box-shadow:none; font-size:13px; padding:11px 15px; text-shadow:none;
}
.page-head.dashboard-hero .button[href="/transactions/new"],
.page-head.dashboard-hero .button[href^="/companies/new"] {
    background:#fff; border-color:#fff; color:#173b69;
}
.page-head.dashboard-hero .button:hover,.page-head.profitability-head .button:hover {
    transform:none; border-color:#fff;
}
@media(max-width:1000px) {
    .page-head.dashboard-hero,.page-head.profitability-head { flex-direction:column; align-items:flex-start; padding:20px; gap:16px; }
    .page-head.dashboard-hero .head-actions,.page-head.profitability-head .head-actions { width:100%; }
}
/* Dashboard totals are read-only: keep the emphasis on the numbers, not decoration. */
.dashboard-metrics { grid-template-columns:repeat(3,minmax(0,1fr)); }
.dashboard-scope { font-size:12px; color:var(--theme-muted); line-height:1.5; }
.cash-overview { padding:20px 24px; margin-bottom:24px; }
.cash-overview-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.cash-overview-heading h2 { margin:0; font-family:inherit; font-size:18px; font-weight:600; line-height:1.4; }
.cash-details { margin-top:12px; }
.cash-details > summary {
    display:flex; align-items:center; gap:12px; cursor:pointer; padding:12px;
    border:1px solid var(--theme-border); border-radius:8px; list-style:none;
}
.cash-details > summary::-webkit-details-marker { display:none; }
.cash-details > summary::before { content:"›"; font-size:22px; color:var(--theme-accent); }
.cash-details[open] > summary::before { transform:rotate(90deg); }
.cash-details > summary:hover { border-color:var(--theme-accent); }
.cash-details > summary:focus-visible { outline:3px solid var(--theme-accent); outline-offset:2px; }
.cash-summary-copy { display:grid; gap:4px; }
.cash-summary-copy > span { font-size:13px; font-weight:600; }
.cash-summary-copy small,.cash-total small { font-size:12px; font-weight:400; color:var(--theme-muted); }
.cash-total { margin-left:auto; font-size:24px; font-variant-numeric:tabular-nums; text-align:right; overflow-wrap:anywhere; }
.cash-overview .cash-note { margin:12px 0 0; font-size:12px; line-height:1.5; color:var(--theme-muted); }
.cash-account-list { padding-top:8px; }
@media(max-width:600px) {
    .cash-overview { padding:16px; }
    .cash-overview-heading { flex-wrap:wrap; }
    .cash-total { font-size:20px; }
    .cash-total small { display:block; }
}
.cash-account-link { border:1px solid transparent; padding:14px 10px; border-radius:8px; }
.cash-account-link:hover { border-color:var(--theme-accent); background:var(--theme-soft); }
.cash-account-link:focus-visible { outline:3px solid var(--theme-accent); outline-offset:2px; }
.dashboard-metrics .metric {
    padding:24px; min-height:156px; border:1px solid var(--theme-border);
    border-radius:12px; background:var(--theme-surface);
    box-shadow:0 2px 6px rgba(18,55,91,.03); align-items:stretch;
}
.dashboard-metrics .metric::after { content:none; }
.dashboard-metrics .metric:hover {
    transform:none; border-color:var(--theme-accent);
    box-shadow:0 2px 6px rgba(18,55,91,.03);
}
.dashboard-metrics .metric > div { display:flex; flex-direction:column; gap:12px; }
.dashboard-metrics .metric span {
    font-size:13px; font-weight:600; color:var(--theme-muted); line-height:1.4;
}
.dashboard-metrics .metric strong {
    margin:0; font-family:inherit; font-size:clamp(23px,2vw,30px);
    font-weight:650; line-height:1.25; letter-spacing:-.025em;
    font-variant-numeric:tabular-nums; color:var(--theme-text); overflow-wrap:anywhere;
}
.dashboard-metrics .metric small {
    margin-top:auto; padding-top:2px; font-size:12px; line-height:1.5;
    color:var(--theme-muted);
}
.dashboard-metrics .metric.is-loss strong { color:var(--theme-danger-text); }
.dashboard-metrics button.metric { text-align:left; font:inherit; cursor:pointer; flex-direction:column; gap:14px; }
.dashboard-metrics button.metric:focus-visible { outline:3px solid var(--theme-accent); outline-offset:3px; }
.dashboard-metrics button.metric[aria-expanded="true"] { border-color:var(--theme-accent); }
.dashboard-metrics .metric .breakdown-hint { font-size:12px; color:var(--theme-accent); }
.dashboard-breakdown { margin-bottom:24px; }
.dashboard-breakdown a { text-decoration:underline; text-underline-offset:3px; }
/* Semantic label colors; totals stay neutral and readable in either theme. */
.financial-label.label-asset { --label-bg:#e8efff; --label-ink:#2856ad; }
.financial-label.label-liability { --label-bg:#fff1dc; --label-ink:#925000; }
.financial-label.label-equity { --label-bg:#efe9ff; --label-ink:#6341b3; }
.financial-label.label-revenue { --label-bg:#ddf5ed; --label-ink:#006b61; }
.financial-label.label-expense { --label-bg:#fde7ed; --label-ink:#ac2854; }
.financial-label.label-profit { --label-bg:#e7f3dd; --label-ink:#3c681d; }
.dashboard-metrics .metric .financial-label,
.performance-panel .summary-row .financial-label {
    display:inline-flex; align-self:flex-start; width:fit-content;
    padding:5px 10px; border-radius:999px; font-size:12px;
    font-weight:650; line-height:1.5; background:var(--label-bg); color:var(--label-ink);
}
:root[data-theme="dark"] .financial-label.label-asset { --label-bg:#223654; --label-ink:#b5ceff; }
:root[data-theme="dark"] .financial-label.label-liability { --label-bg:#44341e; --label-ink:#ffcf87; }
:root[data-theme="dark"] .financial-label.label-equity { --label-bg:#342b4f; --label-ink:#d4c2ff; }
:root[data-theme="dark"] .financial-label.label-revenue { --label-bg:#193d38; --label-ink:#9ee3d4; }
:root[data-theme="dark"] .financial-label.label-expense { --label-bg:#472936; --label-ink:#ffbad0; }
:root[data-theme="dark"] .financial-label.label-profit { --label-bg:#2b3b24; --label-ink:#c1dfa4; }
@media(max-width:1200px) {
    .dashboard-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media(max-width:600px) {
    .dashboard-metrics { grid-template-columns:minmax(0,1fr); gap:12px; }
    .dashboard-metrics .metric { min-height:140px; padding:20px; }
}
.company-logo { display:block; width:120px; height:64px; object-fit:contain; object-position:left center; }
/* Give company branding room without cropping wide or square logos. */
.active-company-logo {
    display:block;
    width:96px;
    height:64px;
    flex:0 0 96px;
    object-fit:contain;
    border-radius:6px;
}
.topbar .active-company > div { min-width:0; }
.operations-fields { padding:0; border:0; min-width:0; }
.operations-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 0; border-bottom:1px solid var(--theme-border); flex-wrap:wrap; }
.operations-row p { margin:4px 0; }
.partner-picker { margin-bottom:18px; }
.contact-picker-actions { display:flex; flex-wrap:wrap; gap:8px; margin:10px 0; }
.topbar { display:flex; flex-wrap:wrap; align-items:center; gap:12px; }
.topbar .active-company { flex:1 1 230px; min-width:0; }
.topbar .active-company strong { overflow-wrap:break-word; }
.topbar .company-switch { order:5; flex:1 0 100%; min-width:0; margin:0; }
.topbar .user-menu { margin-left:auto; flex:0 0 auto; }
.topbar .user-menu > div { min-width:0; max-width:150px; overflow-wrap:anywhere; }
.topbar .user-menu form { flex:none; }
.topbar .language-setting { margin-left:0; flex:none; }
.language-setting select, .language-setting button {
    box-sizing:border-box; height:36px; min-height:36px; width:auto; min-width:0;
    padding:5px 8px; font-size:12px; line-height:1.3;
}
.language-setting select { width:64px; }
.language-setting .language-preview { max-width:64px; font-size:10px; }
.language-buttons { display:flex; align-items:center; gap:8px; }
.theme-buttons { display:flex; align-items:center; gap:8px; }
.theme-buttons button {
    display:grid; place-items:center; width:40px; height:40px; padding:0;
    border-radius:0; border:0; box-shadow:none;
    color:var(--theme-muted, #63758a); background:transparent; cursor:pointer;
}
.theme-buttons button[aria-pressed="true"] {
    background:transparent; color:var(--theme-accent-strong, #173c6b);
}
.theme-buttons button[aria-pressed="true"] svg { stroke-width:2.6; }
.theme-buttons button[data-theme-choice="light"][aria-pressed="true"] {
    color:#b65a00;
}
.theme-buttons button[data-theme-choice="light"][aria-pressed="true"] circle {
    fill:#ffcf66;
}
.theme-buttons button[data-theme-choice="dark"][aria-pressed="true"] {
    color:#d5e8ff;
}
.theme-buttons button[data-theme-choice="dark"][aria-pressed="true"] path {
    fill:#d5e8ff;
}
.theme-buttons button:hover { background:transparent; box-shadow:none; }
.theme-buttons button:focus-visible {
    outline:3px solid var(--theme-focus, #3976cc); outline-offset:3px;
}
.language-setting .language-buttons button {
    min-width:48px; height:40px; padding:6px 14px; border-radius:999px;
    border:1px solid var(--theme-accent-strong, #173c6b);
    color:var(--theme-accent-strong, #173c6b); background:transparent;
    font-weight:700;
}
.language-setting .language-buttons button[aria-pressed="true"] {
    background:var(--theme-accent-strong, #173c6b); color:#fff;
}
.language-setting .language-buttons button:focus-visible {
    outline:3px solid var(--theme-focus, #3976cc); outline-offset:3px;
}
/* Keep table edges full-width while giving headings and controls breathing room. */
.panel.table-panel > h2,
.panel.table-panel > p { margin:0; padding:20px 24px; }
.panel.table-panel > .report-document-head { padding:24px; }
.panel.table-panel > .badge { margin:16px 24px; }
.panel form > .form-actions { margin-top:20px; gap:10px; }
.panel form > label + button { margin-top:12px; }
.panel td > strong + small { display:block; margin-top:4px; }
.cash-reconciliation > div {
    display:flex; justify-content:space-between; align-items:baseline;
    gap:24px; padding:12px 0;
}
.cash-reconciliation > div > strong { flex:none; font-variant-numeric:tabular-nums; }
.cash-reconciliation > .grand-total { padding:16px; }
.inventory-forms { align-items:start; }
.compact-help { margin:12px 0 20px; color:var(--theme-muted); }
.compact-help > summary {
    cursor:pointer; padding:12px 16px; border-radius:8px;
    background:var(--theme-soft); color:var(--theme-text); font-weight:600;
}
.compact-help > p { margin:12px 16px; max-width:95ch; line-height:1.6; }
.compact-help > summary:focus-visible { outline:2px solid var(--theme-accent); outline-offset:3px; }
.partner-picker { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 16px; margin-block:20px; }
.partner-picker > label { display:grid; gap:8px; align-content:start; min-width:0; }
.partner-picker > p,
.partner-picker > .compact-help,
.partner-picker > .contact-picker-actions { grid-column:1 / -1; margin:0; }
.contact-picker-actions { display:flex; flex-wrap:wrap; gap:8px; }
.cards.profitability-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.cards.profitability-metrics .metric-button {
    display:flex; flex-direction:column; align-items:flex-start; justify-content:flex-start;
    gap:12px; padding:24px; min-width:0; height:auto; min-height:155px; text-align:left;
}
.cards.profitability-metrics .metric-button > * { align-self:flex-start; max-width:100%; }
.cards.profitability-metrics .metric-button > strong {
    font-family:inherit; font-size:clamp(20px,2vw,30px); line-height:1.25;
    overflow-wrap:normal; word-break:normal;
}
.cards.profitability-metrics .metric-button::after { content:none; }
.cards.profitability-metrics .metric-link { margin-top:auto; font-size:12px; }
@media (min-width:1600px) {
    .cards.profitability-metrics { grid-template-columns:repeat(4,minmax(0,1fr)); }
}
@media (max-width:650px) {
    .partner-picker, .cards.profitability-metrics { grid-template-columns:minmax(0,1fr); }
    .panel.table-panel > h2, .panel.table-panel > p,
    .panel.table-panel > .report-document-head { padding:16px; }
}
[data-form-error]:focus { outline:2px solid var(--theme-focus); outline-offset:2px; }
[data-direction-warning] label { display:flex; align-items:flex-start; gap:10px; }
[data-direction-warning] input { width:auto; flex:none; margin-top:3px; }
@media (min-width:701px) {
    .shell.sidebar-collapsed { grid-template-columns:148px minmax(0,1fr); }
    .shell.sidebar-collapsed .sidebar { width:148px; padding-inline:10px; }
    .shell.sidebar-collapsed .content::before { left:148px; }
    .shell.sidebar-collapsed .nav-group summary,
    .shell.sidebar-collapsed .nav-group[open] summary {
        border:0; background:transparent; box-shadow:none; padding:8px 2px;
    }
    .shell.sidebar-collapsed .nav-group summary .nav-chevron { display:none; }
    .shell.sidebar-collapsed .nav-group summary::after { display:none; }
    .shell.sidebar-collapsed .nav-compact-label {
        overflow-wrap:normal; word-break:normal; white-space:normal; line-height:1.35;
    }
    .shell.sidebar-collapsed .sidebar nav a { padding-inline:4px; }
}
@media (max-width:700px) {
    .active-company-logo { width:64px; height:48px; flex-basis:64px; }
    .topbar .active-company { flex-basis:calc(100% - 60px); }
    .topbar .company-switch { order:5; }
    .topbar .user-menu { padding-left:6px; gap:6px; }
    .topbar .theme-setting { margin-left:0; }
}
