:root {
  --bg: #f5f6f7;
  --sidebar: #202224;
  --surface-2: #f6f7f8;
  --line: #e0e3e6;
  --text: #25282b;
  --muted: #656b72;
  --green: #187749;
  --shadow: none;
}
body.dark {
  --bg: #151617;
  --sidebar: #1b1c1e;
  --surface: #202224;
  --surface-2: #25272a;
  --line: #373a3e;
  --text: #f0f1f2;
  --muted: #afb4bb;
  --green: #51cb8d;
  --shadow: none;
}
* { letter-spacing: 0; }
.text-link { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.overview-finance-links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 4px 0 18px; font-size: 13px; }
.content input, .content select, .content textarea { border-radius: 6px; }
.content input[type="checkbox"] { accent-color: var(--green); }
.table-panel tbody tr:hover { background: var(--surface-2); }
.table-panel thead th { font-size: 11px; color: var(--muted); font-weight: 650; }
.btn { min-height: 36px; }
.content .page-head .head-note { max-width: 440px; line-height: 1.5; }
.content .page-head .head-note .text-link { display: block; }
#finance-settings { scroll-margin-top: 20px; }
.finance-workspace { --chart-receipts: #377caa; --chart-selected: #187749; }
body.dark .finance-workspace { --chart-receipts: #78afd2; --chart-selected: #51cb8d; }
.finance-workspace .table-panel { margin-top: 16px; padding-top: 8px; }
.finance-workspace .table-panel > p, .finance-workspace .finance-assumptions > ul { padding: 0 12px; line-height: 1.55; }
.finance-workspace .finance-summary {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0;
  margin: 18px 0 8px; padding: 6px 0;
}
.finance-workspace .finance-summary .metric { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.finance-workspace .finance-summary .metric small { color: var(--muted); line-height: 1.45; }
.finance-workspace .finance-forecast .finance-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.finance-workspace .form-grid--filter { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; padding: 8px 12px; }
.finance-workspace .form-grid--filter label { width: 185px; max-width: 100%; }
.receipt-overview { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; }
.receipt-overview > * { min-width: 0; }
.receipt-chart {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px;
  padding: 14px 12px 18px; align-items: end;
}
.month-bar { display: grid; grid-template-rows: 32px 130px minmax(36px, auto); gap: 7px; min-width: 0; text-align: center; border-radius: 4px; }
.month-bar-amount { align-self: end; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.35; }
.month-bar-track { position: relative; display: block; height: 130px; border-bottom: 1px solid var(--line-strong); }
.month-bar-fill { position: absolute; bottom: 0; left: 15%; right: 15%; height: var(--receipt-height, 0%); background: var(--chart-receipts); border-radius: 3px 3px 0 0; }
.month-bar-negative .month-bar-fill { background: var(--red); }
.month-bar[aria-current]:not(.month-bar-negative) .month-bar-fill { background: var(--chart-selected); }
.month-bar[aria-current] .month-bar-label { font-weight: 750; text-decoration: underline; text-underline-offset: 4px; }
.month-bar:hover { background: var(--surface-2); }
.month-bar-label { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.month-bar-label small { display: block; font-size: 11px; margin-top: 3px; }
.receipt-contributors table { min-width: 0; }
.receipt-contributors td:first-child { overflow-wrap: anywhere; }
.receipt-contributors td:last-child, .receipt-contributors th:last-child,
.receipt-ledger td:nth-child(3), .receipt-ledger th:nth-child(3) { text-align: right; white-space: nowrap; }
.receipt-contributors td .muted { display: block; font-size: 12px; }
.receipt-contributors tfoot { border-top: 2px solid var(--line); font-weight: 650; }
.receipt-ledger .table-scroll { max-height: 540px; }
.receipt-ledger thead { position: sticky; top: 0; background: var(--surface); }
.finance-renewal > summary, .finance-assumptions > summary { padding: 12px; cursor: pointer; font-weight: 650; }
.finance-renewal .custom-quick-payment { padding: 12px; }
.finance-assumptions h2 { font-size: 16px; padding: 0 12px; }
.finance-assumptions li { margin: 8px 0 8px 16px; }
.server-cost-table td:not(:first-child), .server-cost-table th:not(:first-child) { text-align: right; }
@media (max-width: 1100px) {
  .receipt-overview { grid-template-columns: 1fr; gap: 0; }
  .finance-workspace .finance-forecast .finance-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 0; }
}
@media (max-width: 600px) {
  .finance-workspace .finance-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 0; }
  .finance-workspace .finance-summary .metric:first-child { grid-column: 1 / -1; }
  .finance-workspace .finance-forecast .finance-summary .metric:first-child { grid-column: auto; }
  .finance-workspace .form-grid--filter label { flex: 1 1 160px; }
  .finance-workspace .btn { min-height: 40px; }
  .receipt-chart { gap: 5px; padding-left: 6px; padding-right: 6px; }
  .month-bar { grid-template-rows: 32px 112px minmax(36px, auto); }
  .month-bar-track { height: 112px; }
  .month-bar-amount, .month-bar-label { font-size: 11px; }
  .receipt-ledger table { min-width: 620px; }
  .server-cost-table table { min-width: 500px; }
}
.app-shell { grid-template-columns: 210px minmax(0, 1fr); }
.sidebar { padding: 20px 12px; gap: 26px; }
.content { width: 100%; max-width: 1680px; padding: 16px 24px 32px; }
.brand { gap: 10px; }
.brand-mark { background: #d7eee2; color: #21543a; }
.side-nav { gap: 4px; }
.side-nav a { font-weight: 550; border-radius: 5px; padding: 10px 12px; }
.side-nav a.active { background: #33493d; color: #e0f5e8; box-shadow: inset 3px 0 #69bd8b; }
.workspace-tabs {
  display: flex; flex-wrap: wrap; gap: 4px 20px; min-height: 38px;
  border-bottom: 1px solid var(--line); margin: 0 0 18px;
}
.workspace-tabs:empty { display: none; }
.workspace-tabs a { padding: 8px 0 10px; border-bottom: 2px solid transparent; color: var(--muted); }
.workspace-tabs a:hover { color: var(--text); }
.workspace-tabs a.active { border-bottom-color: var(--green); color: var(--text); font-weight: 650; }
.page-head { margin-bottom: 14px; gap: 12px; }
.page-head h1 { font-size: 24px; letter-spacing: 0; line-height: 1.25; overflow-wrap: anywhere; }
.eyebrow { text-transform: none; margin-bottom: 4px; font-weight: 500; }
.subline { margin: 4px 0 0; }
.btn { font-weight: 600; border-radius: 6px; white-space: normal; line-height: 1.3; }
a.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
body.dark .btn.primary { background: #278052; color: #fff; }
.content .btn.ghost { color: var(--muted); border-color: var(--line); }
.btn:hover { filter: brightness(.96); }
.btn:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.metric, .panel, .table-panel, .login-panel, .client-card { border-radius: 8px; box-shadow: none; }
.panel, .table-panel { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.panel .panel { background: transparent; border: 0; box-shadow: none; }
.metric { background: transparent; border: 0; border-left: 1px solid var(--line); padding: 8px 12px; }
.metric strong { font-size: 23px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric span, .facts dt, label span { font-weight: 600; text-transform: none; font-size: 12px; }
.section-title { background: transparent; padding: 10px 12px; }
.section-title h2, .panel-head h2 { font-size: 16px; }
.section-title, .panel-head { flex-wrap: wrap; gap: 8px; }
.table-scroll { max-width: 100%; }
th, td { font-variant-numeric: tabular-nums; }
table .btn { font-size: 12px; min-height: 30px; padding: 5px 9px; }
.dashboard-workspace .metrics { gap: 0; }
.dashboard-workspace .metrics-ops { display: none; }
.dashboard-workspace .action-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.dashboard-workspace .action-row { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 9px 12px; background: transparent; min-width: 0; }
.dashboard-workspace .action-row.critical { border-left: 3px solid var(--red); }
.dashboard-workspace .action-row.warning { border-left: 3px solid var(--amber); }
.dashboard-workspace .action-row.info { border-left: 3px solid var(--blue); }
.action-main small { white-space: normal; }
.action-badge { font-size: 11px; text-transform: none; border-radius: 4px; }
.dashboard-workspace .overview-grid { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 18px; }
.dashboard-workspace .payment-row { padding: 9px 0; }
.dashboard-workspace .finance-collapse { border-top: 1px solid var(--line); padding-top: 10px; }
.dashboard-workspace .metrics-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 6px 0 12px; }
.compact-details { margin: 12px 0; border-top: 1px solid var(--line); padding: 12px 0; }
.compact-details > summary { cursor: pointer; font-size: 14px; font-weight: 650; }
.compact-details[open] > summary { margin-bottom: 14px; }
.group-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.group-subscriptions td { vertical-align: top; }
.group-subscriptions .device-name { font-size: 15px; }
.group-subscriptions details { margin-top: 7px; }
.group-subscriptions details summary { color: var(--muted); cursor: pointer; font-size: 12px; }
.group-subscriptions details form { margin-top: 8px; }
.group-subscriptions .inline-actions input { max-width: 180px; }
.group-options { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr); }
.attach-preview { padding: 10px 12px; border-left: 3px solid var(--blue); background: var(--surface-2); margin: 10px 0; overflow-wrap: anywhere; }
.operation-feedback { padding: 10px 12px; border-left: 3px solid var(--green); }
.operation-feedback.error { border-color: var(--red); }
form[aria-busy="true"] { opacity: .75; }
.btn[disabled] { cursor: wait; }
.sidebar-footer .btn { font-size: 12px; }
.sidebar-tools { margin-top: auto; }
.sidebar-tools > summary { padding: 8px 10px; color: #c6cdca; cursor: pointer; font-size: 12px; }
.sidebar-tools[open] > summary { margin-bottom: 8px; }
.dashboard-workspace .overview-grid { grid-template-columns: minmax(0, 1fr); align-items: start; gap: 8px; }
.dashboard-workspace .overview-grid .payment-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.dashboard-workspace .payment-list .payment-row { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.dashboard-workspace .payment-list--padded { padding: 0 12px; }
.dashboard-workspace .payment-row p { margin: 3px 0; }
.public-pages-table { overflow-x: auto; }
.public-pages-table table { min-width: 680px; }
.public-file { padding: 12px 0; border-bottom: 1px solid var(--line); }
.public-file summary { cursor: pointer; overflow-wrap: anywhere; }
.public-file summary .muted { margin-left: 8px; font-size: 13px; }
.public-hash { overflow-wrap: anywhere; font-size: 12px; }
.dashboard-attention > summary { cursor: pointer; padding: 12px; color: var(--muted); }
.dashboard-attention[open] .table-scroll table { min-width: 640px; }
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 180px minmax(0, 1fr); }
  .content { padding: 14px 16px 28px; }
  .dashboard-workspace .overview-grid { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 10px 12px; gap: 10px; }
  .brand small { display: none; }
  .brand-mark { width: 28px; height: 28px; }
  .side-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
  .side-nav a { padding: 8px 4px; }
  .sidebar-footer { display: flex; flex-wrap: wrap; gap: 6px; }
  .sidebar-footer > form { flex: 1 1 100px; }
  .sidebar-footer .theme-switch { flex: 1 1 170px; }
  .content { padding: 12px; }
  .workspace-tabs { gap: 0 16px; font-size: 13px; margin-bottom: 14px; }
  .page-head h1 { font-size: 22px; }
  .dashboard-workspace .metrics-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-workspace .action-list, .group-options { grid-template-columns: 1fr; }
  .group-subscriptions table { min-width: 740px; }
  .group-head-actions { width: 100%; }
  .metric strong { font-size: 21px; }
  .dashboard-workspace .overview-grid .payment-list { grid-template-columns: 1fr; gap: 0; }
}
