/* One navigation layout across all pages; overrides legacy horizontal headers. */
:root { --navigation-width: 272px; --header-height: 76px; }
html, body { overflow-x: clip; }
.skip-content { position: fixed; top: 8px; right: 8px; z-index: 300; padding: 12px; background: var(--surface); color: var(--ink); transform: translateY(-160%); }
.skip-content:focus { transform: none; }
.app-header { z-index: 100; }
.app-header .header-inner { height: var(--header-height); min-height: var(--header-height); max-width: none; padding: 10px 24px; gap: 12px; flex-wrap: nowrap; align-items: center; }
.header-inner .header-brand { flex: 1 1 auto; min-width: 0; gap: 10px; }
.header-inner .header-brand div { display: block; min-width: 0; }
.header-brand strong { font-size: 17px; }
.header-brand-logo, .header-brand > span { flex: 0 0 44px; width: 44px; height: 44px; }
.header-inner .theme-toggle, .header-inner .alert-menu > summary, .header-inner .mobile-nav-toggle { width: 44px; height: 44px; flex: 0 0 44px; }
.header-inner .theme-toggle, .header-inner .alert-menu { order: initial; flex-shrink: 0; }
.header-inner .mobile-nav-toggle { display: none; order: initial; }
.navigation-panel { position: fixed; top: var(--header-height); right: 0; bottom: 0; width: var(--navigation-width); padding: 20px 14px; padding-bottom: max(20px, env(safe-area-inset-bottom)); background: #142843; color: #edf3ff; border-left: 1px solid #ffffff14; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #637b9e transparent; z-index: 102; }
.navigation-heading { padding: 0 12px 16px; margin-bottom: 10px; border-bottom: 1px solid #ffffff20; }
.navigation-heading span { display: block; font-size: 12px; font-weight: 800; color: #b6c8e1; }
.navigation-heading small { display: block; margin-top: 5px; color: #91a8c8; }
.navigation-heading label { display: block; font-size: 12px; margin-bottom: 6px; color: #c8d7ec; }
.navigation-heading select { width: 100%; min-height: 44px; border: 1px solid #647a99; border-radius: 8px; padding: 7px; background: #142843; color: #fff; font-size: 16px; cursor: pointer; }
.navigation-panel .top-nav { display: flex; flex-direction: column; align-items: stretch; gap: 5px; width: 100%; max-height: none; overflow: visible; padding: 0; border: 0; }
.navigation-panel .nav-group { width: 100%; }
.navigation-panel .top-nav > a, .navigation-panel summary { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 46px; padding: 12px; color: #dce7f7; font-size: 14px; line-height: 1.6; white-space: normal; overflow-wrap: anywhere; border-radius: 10px; }
.navigation-panel summary::after { content: '⌄'; margin-inline-start: 10px; }
.navigation-panel details[open] > summary::after { transform: rotate(180deg); }
.navigation-panel .top-nav a:hover, .navigation-panel summary:hover { background: #ffffff12; color: white; }
.navigation-panel .top-nav a.active, .navigation-panel .top-nav a[aria-current="page"] { color: #fff; background: #32548b; box-shadow: inset -3px 0 #92b5ff; }
.navigation-panel .nav-dropdown { position: static !important; inset: auto !important; min-width: 0; width: 100%; max-height: none; margin: 4px 0 8px; padding: 4px; border: 0; border-inline-start: 2px solid #49617f; border-radius: 0 0 10px 10px; background: #ffffff06; box-shadow: none; }
.navigation-panel .nav-dropdown a, .navigation-panel .nav-dropdown button { min-height: 44px; padding: 10px 14px; color: #dce7f7; font-size: 14px; white-space: normal; overflow-wrap: anywhere; }
.navigation-panel .user-menu { display: block; width: 100%; margin: 22px 0 0; padding-top: 12px; border-top: 1px solid #ffffff20; }
.app-main { margin-right: var(--navigation-width) !important; min-width: 0; min-height: calc(100dvh - var(--header-height)); }
.content-wrap { width: 100%; max-width: 1680px; }
.nav-backdrop { display: none; }
.alert-dropdown { max-width: calc(100vw - 24px); max-height: calc(100dvh - var(--header-height) - 12px); overflow-y: auto; }
.alert-list { max-height: none; }
.page-head > *, .section-heading > *, .dashboard-hero > *, .hero-actions, .account-balance > div, .server-overview > div { min-width: 0; }
.page-head, .section-heading, .dashboard-hero, .hero-actions { flex-wrap: wrap; }
.page-head p, .card-panel h2, .card-panel h3, .metric strong, .account-balance strong, .summary-strip, .alert-item { overflow-wrap: anywhere; }
pre { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
fieldset { min-width: 0; }
.actions > *, .server-card, .server-card .actions, .server-card details { min-width: 0; max-width: 100%; }
.server-card .actions { flex-wrap: wrap; }
.server-card details[open] { flex-basis: 100%; }
.table-scroll-hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.table-scrollable:focus-visible { outline-offset: -3px; }

@media (max-width: 1199px) {
  .app-main { margin-right: 0 !important; }
  .header-inner .mobile-nav-toggle { display: grid; }
  .navigation-panel { display: none; width: min(320px, calc(100vw - 44px)); }
  .mobile-nav-open .navigation-panel { display: block; }
  .mobile-nav-open .nav-backdrop { display: block; position: fixed; inset: var(--header-height) 0 0; background: #07132480; border: 0; padding: 0; z-index: 101; cursor: pointer; }
  body.mobile-nav-active { overflow: hidden; }
  .app-header .alert-dropdown { position: fixed; top: var(--header-height); left: 12px; right: auto; width: min(400px, calc(100vw - 24px)); }
}
@media (min-width: 1200px) and (max-width: 1500px) {
  .dashboard-grid, .charts-grid, .two-col { grid-template-columns: minmax(0, 1fr); }
  .dashboard-metrics, .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  :root { --header-height: 68px; }
  .app-header .header-inner { gap: 6px; padding: 8px 10px; padding-inline: max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-left)); }
  .header-brand strong { font-size: 13px; }
  .header-brand small { font-size: 9px; }
  .header-brand-logo, .header-brand > span { width: 36px; height: 36px; flex-basis: 36px; }
  .header-inner .header-brand { gap: 6px; }
  .dashboard-metrics, .metric-grid, .customer-kpis, .account-balance-grid { grid-template-columns: minmax(0, 1fr); }
  .form-control, .form-select, input:not([type=checkbox]):not([type=radio]):not([type=hidden]), textarea, select { min-width: 0; max-width: 100%; font-size: 16px; }
  .btn, .table-actions button, .table-actions a { min-height: 44px; white-space: normal; }
  .actions > form, .form-actions > *, .table-actions > form { max-width: 100%; }
  .mobile-card-table > tbody > tr > td { grid-template-columns: minmax(76px, 32%) minmax(0, 1fr); gap: 8px; overflow-wrap: anywhere; }
  .mobile-card-table > tbody > tr > td > .mobile-cell-value { min-width: 0; }
  .mobile-card-table .mobile-cell-value > form, .mobile-card-table .mobile-cell-value > div { max-width: 100%; }
  .mobile-card-table .payable-actions, .mobile-card-table .payment-box { width: 100%; min-width: 0; }
  .mobile-card-table .payable-actions .actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .mobile-card-table .payable-actions .actions > *, .mobile-card-table .payable-actions button { width: 100%; }
  .permission-row label { overflow-wrap: anywhere; }
}
@media print {
  .navigation-panel, .nav-backdrop, .skip-content { display: none !important; }
  .app-main { margin: 0 !important; }
}

/* Match the compact Farida navigation: one header row or an expanding icon rail. */
.account-name { padding: 10px 12px; font-weight: 700; color: #fff; overflow-wrap: anywhere; }
.navigation-panel .navigation-heading { padding: 10px 12px 16px; margin: 0 0 8px; border-bottom: 1px solid #ffffff20; }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 20px; width: 20px; height: 20px; color: #82c7ff; }
.nav-icon svg { width: 18px; height: 18px; }
.nav-label { min-width: 0; }
.navigation-panel .top-nav > a, .navigation-panel summary { justify-content: flex-start; gap: 8px; transition: background .15s ease,color .15s ease; }
.navigation-panel summary::after { margin-inline-start: auto; }
.navigation-panel { background: linear-gradient(180deg,#03152d 0%,#052a5b 54%,#061a36 100%); }
.navigation-panel .top-nav a:hover, .navigation-panel summary:hover { background: linear-gradient(135deg,#1479ff,#008ac0); }
.navigation-panel :is(a,summary,select):focus-visible { outline: 2px solid #7dd3fc; outline-offset: -2px; }
.nav-scroll { display: none; }
.navigation-layout-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 0 0 auto; min-width: 44px; height: 44px; padding: 0 10px; border: 1px solid #ffffff24; border-radius: 10px; background: #ffffff0c; color: #edf6ff; font-size: 12px; white-space: nowrap; }
.navigation-layout-toggle svg { flex: 0 0 20px; }
.navigation-layout-toggle:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }
.expense-recorded-at { margin-top: 6px; font-size: 11px; }
:root[data-navigation="top"] .app-main { margin-right: 0 !important; }
@media (min-width: 1200px) {
  :root { --header-height: 60px; --navigation-width: 56px; }
  .app-header .header-inner { padding: 8px 14px; gap: 8px; }
  .header-inner .header-brand { order: 0; }
  .header-inner .navigation-panel { order: 1; }
  .header-inner .navigation-layout-toggle { order: 2; }
  .header-inner .theme-toggle { order: 2; }
  .header-inner .alert-menu { order: 3; }
  :root[data-navigation="top"] .header-inner .header-brand { flex: 0 0 auto; }
  :root[data-navigation="top"] .header-brand strong { font-size: 14px; }
  :root[data-navigation="top"] .header-brand div { display: none; }
  :root[data-navigation="top"] .navigation-panel { position: static; width: auto; min-width: 0; flex: 1 1 auto; display: flex; align-items: center; flex-wrap: nowrap; gap: 4px; padding: 0; overflow: visible; border: 0; background: transparent; }
  :root[data-navigation="top"] .navigation-panel .top-nav { flex: 1 1 auto; min-width: 0; width: auto; flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: flex-start; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  :root[data-navigation="top"] .top-nav::-webkit-scrollbar { display: none; }
  :root[data-navigation="top"] .navigation-panel .nav-group,
  :root[data-navigation="top"] .navigation-panel .top-nav > a { width: auto; flex: 0 0 auto; }
  :root[data-navigation="top"] .navigation-panel .top-nav > a,
  :root[data-navigation="top"] .navigation-panel summary { padding: 6px 5px; font-size: 14px; gap: 4px; min-height: 44px; white-space: nowrap; }
  :root[data-navigation="top"] .navigation-panel summary::after { margin-inline-start: 3px; }
  :root[data-navigation="top"] .navigation-panel .user-menu { width: auto; flex: 0 0 auto; border: 0; margin: 0; padding: 0; }
  :root[data-navigation="top"] .navigation-panel .nav-dropdown { position: fixed !important; inset: auto !important; left: var(--menu-left,12px) !important; top: var(--menu-top,68px) !important; width: var(--menu-width,300px); max-height: max(100px,calc(100dvh - var(--menu-top,68px) - 12px)); overflow-y: auto; background: #08213d; padding: 8px; border: 1px solid #234976; border-radius: 12px; box-shadow: 0 16px 40px #02081766; }
  :root[data-navigation="top"] .navigation-panel.has-overflow .nav-scroll { display: grid; place-items: center; width: 28px; min-height: 44px; flex: 0 0 28px; padding: 0; border: 1px solid #ffffff24; background: #ffffff0c; color: #edf6ff; border-radius: 8px; }
  .nav-scroll:disabled { opacity: .35; }
  :root[data-navigation="side"] .navigation-panel { width: var(--navigation-width); padding: 10px 6px; transition: width .2s ease,box-shadow .2s ease; }
  :root[data-navigation="side"] .navigation-panel:is(:hover,:focus-within) { width: clamp(260px,20vw,308px); box-shadow: -18px 0 40px #02081766; }
  :root[data-navigation="side"] .navigation-panel .top-nav > a,
  :root[data-navigation="side"] .navigation-panel summary { min-height: 44px; padding: 7px; gap: 10px; flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
  :root[data-navigation="side"] .nav-icon { width: 30px; height: 30px; flex-basis: 30px; border-radius: 9px; background: #1479ff2e; border: 1px solid #1479ff45; }
  :root[data-navigation="side"] .navigation-panel:not(:hover):not(:focus-within) .nav-label,
  :root[data-navigation="side"] .navigation-panel:not(:hover):not(:focus-within) summary::after { visibility: hidden; }
  :root[data-navigation="side"] .navigation-panel:not(:hover):not(:focus-within) .nav-dropdown { display: none; }
  :root[data-navigation="side"] .navigation-panel .nav-label { flex-shrink: 0; }
  :root[data-navigation="side"] .navigation-panel .user-menu { margin-top: 10px; padding-top: 10px; }
  :root[data-navigation="side"] .navigation-panel:is(:hover,:focus-within) .top-nav > a { white-space: normal; }
  :root[data-navigation="side"] .navigation-panel:is(:hover,:focus-within) .nav-label { flex-shrink: 1; }
  :root[data-theme="light"] .app-header { background: #fff; color: #334155; border-bottom-color: #dce4ef; box-shadow: 0 4px 16px #182d481c; }
  :root[data-theme="light"] .header-brand { color: #18334f; }
  :root[data-theme="light"] .header-brand small { color: #64748b; }
  :root[data-theme="light"] .header-inner :is(.theme-toggle,.alert-menu>summary) { background: #f5f8fc; color: #2563eb; border-color: #d3deed; }
  :root[data-theme="light"] .navigation-layout-toggle { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
  :root[data-theme="light"][data-navigation="top"] .navigation-panel :is(.top-nav>a,summary,.nav-dropdown a,.nav-dropdown button,.account-name) { color: #334155; }
  :root[data-theme="light"][data-navigation="top"] .navigation-panel :is(.top-nav>a,summary,.nav-dropdown a,.nav-dropdown button):hover { background: #e7f0ff; color: #1d4ed8; }
  :root[data-theme="light"][data-navigation="top"] .navigation-panel .top-nav a.active { background: #dce9ff; color: #174bc0; box-shadow: none; }
  :root[data-theme="light"][data-navigation="top"] .navigation-panel .nav-dropdown { background: #fff; border-color: #b4cdf1; box-shadow: 0 12px 28px #16375d26; }
  :root[data-theme="light"][data-navigation="top"] .navigation-heading { border-color: #e0e8f2; }
  :root[data-theme="light"][data-navigation="top"] .navigation-heading label { color: #475569; }
  :root[data-theme="light"][data-navigation="top"] .navigation-heading select { background: #f8fafc; color: #334155; border-color: #cbd5e1; }
  :root[data-theme="light"][data-navigation="top"] .navigation-panel .nav-scroll { background: #eff6ff; border-color: #cadcf7; color: #2563eb; }
}
@media (min-width: 1200px) and (max-width: 1699px) {
  .navigation-layout-toggle { padding-inline: 8px; width: 44px; }
  .navigation-layout-toggle [data-layout-label] { display: none; }
  :root[data-navigation="top"] .navigation-panel .top-nav > a,
  :root[data-navigation="top"] .navigation-panel summary { font-size: 13px; padding-inline: 3px; gap: 3px; }
  :root[data-navigation="top"] .nav-icon { width: 16px; flex-basis: 16px; }
  :root[data-navigation="top"] .nav-icon svg { width: 16px; height: 16px; }
}
@media (max-width: 1199px) {
  .navigation-layout-toggle { padding: 0; width: 44px; }
  .navigation-layout-toggle [data-layout-label] { display: none; }
}
@media (max-width: 480px) { .header-inner .header-brand div { display: none; } }
@media (prefers-reduced-motion: reduce) { .navigation-panel { transition: none !important; } }
@media (max-width: 1199px) {
  :root[data-navigation="top"] .navigation-panel { width: 100%; bottom: auto; max-height: calc(75dvh - var(--header-height)); border-bottom: 1px solid #49617f; }
}
