﻿:root {
  color-scheme: dark;
  --bg: #0b101b; --sidebar: #0e1421; --panel: #111a29; --line: #232e42;
  --text: #edf2fe; --muted: #a4b0c6; --mint: #45e2c4; --purple: #a398fb;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0,1fr); }
svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 29px 17px 20px; background: var(--sidebar); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 8px 37px; font-size: 24px; font-weight: 750; letter-spacing: -.05em; }
.brand small { display: block; margin-top: 1px; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .01em; }
.mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--mint); color: #092820; }
.mark svg { width: 25px; height: 25px; }
nav { display: grid; gap: 5px; }
nav a, .sidebar-foot a { display: flex; align-items: center; gap: 12px; padding: 12px 13px; border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 600; }
nav a:hover, .sidebar-foot a:hover, nav a[aria-current], .sidebar-foot a[aria-current] { color: var(--mint); background: #142b32; }
.nav-count { margin-left: auto; padding: 1px 7px; border-radius: 9px; background: #26354b; color: var(--text); }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; }
.sidebar-foot small { display: block; margin: 10px 13px 0; color: var(--muted); }
main { min-width: 0; }
.file-preview { display: block; }
.file-preview h1 { overflow-wrap: anywhere; font-size: clamp(24px, 4vw, 34px); }
.file-preview-body .table-wrap td { min-width: 64px; max-width: 320px; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-sheet + .preview-sheet { margin-top: 24px; }
.preview-sheet h2 { margin-bottom: 10px; }
.document-paragraph { white-space: pre-wrap; overflow-wrap: anywhere; }
.file-preview-body > * + * { margin-top: 12px; }
.preview-image { display: block; max-width: 100%; height: auto; }
.preview-archive { margin: 0; padding-left: 24px; overflow-wrap: anywhere; }
.preview-archive li + li { margin-top: 6px; }
.signed-out { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 22px; }
.auth-screen { width: min(100%, 440px); }
.auth-screen .panel { padding: clamp(18px, 5vw, 32px); }
.auth-screen .brand { margin: 0 0 22px; }
.auth-screen h1 { font-size: clamp(25px, 5vw, 34px); }
.auth-screen form .button { width: 100%; }
.account-name { max-width: 250px; white-space: normal; overflow-wrap: anywhere; }
.topbar { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 clamp(18px,3vw,43px); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.context, .date { display: flex; align-items: center; gap: 9px; }
.context svg { width: 14px; height: 14px; }
.date svg { width: 17px; height: 17px; }
.context strong { color: var(--text); font-weight: 600; }
.content { max-width: 1490px; margin: auto; padding: 31px clamp(18px,3vw,43px) 44px; }
.page-head, .panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.page-head { margin-bottom: 24px; }
h1,h2,p { margin: 0; }
h1 { font-size: clamp(30px,4vw,43px); line-height: 1.13; letter-spacing: -.045em; }
h2 { font-size: 19px; letter-spacing: -.02em; }
.subtitle { margin-top: 8px; color: var(--muted); line-height: 1.45; }
.actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 13px; border: 1px solid var(--line); color: var(--text); background: #162133; border-radius: 9px; font-size: 14px; font-weight: 650; }
.button:hover { background: #23334a; }
.button.primary { background: var(--mint); color: #09231e; border-color: transparent; }
.button.primary:hover { background: #77ecd6; }
.button.danger { color: #ff9da9; }
.button:disabled { opacity: .55; cursor: wait; }
.button svg { width: 17px; height: 17px; }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 17px; }
.overview-metrics { grid-template-columns: repeat(5,minmax(0,1fr)); }
.panel, .metric { background: var(--panel); border: 1px solid var(--line); border-radius: 15px; }
.metric { padding: 15px 16px 17px; min-width: 0; }
.metric-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.icon-tile { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 9px; background: #172e39; color: var(--mint); }
.icon-tile svg { width: 17px; height: 17px; }
.metric:nth-child(2) .icon-tile { background: #262348; color: var(--purple); }
.metric:nth-child(3) .icon-tile { background: #1b2c46; color: #79b2ff; }
.metric:nth-child(4) .icon-tile { background: #362e2b; color: #ffc680; }
.metric-value { display: block; margin: 10px 0 3px; font-size: clamp(20px,2.25vw,31px); font-weight: 720; letter-spacing: -.045em; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 13px; }
.analysis-note { margin: -8px 0 15px; }
.graphs { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(295px, 1fr); gap: 16px; margin-bottom: 17px; }
.panel { min-width: 0; padding: 18px; }
.panel-head { margin-bottom: 12px; }
.panel-head .subtitle { font-size: 14px; margin-top: 5px; }
.panel + .panel.stack { margin-top: 16px; }
.chart { width: 100%; height: 234px; display: block; }
.forecast-charts, .forecast-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.forecast-charts h3 { margin: 0 0 6px; color: var(--muted); font-size: 14px; font-weight: 650; }
.forecast-more { margin-top: 12px; }
.forecast-period-totals, .forecast-period-totals .table-wrap { margin-top: 12px; }
.forecast-breakdowns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.currency-breakdowns { margin: 0; }
.currency-breakdowns h3 { margin: 0 0 8px; font-size: 15px; }
.forecast-group { min-width: 110px; max-width: 260px; white-space: normal; overflow-wrap: anywhere; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend span { display: flex; gap: 6px; align-items: center; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--swatch,var(--mint)); flex: none; }
.donut { width: 155px; height: 155px; border-radius: 50%; display: grid; place-items: center; margin: 6px auto 15px; }
.donut-center { width: 121px; height: 121px; border-radius: 50%; background: var(--panel); display: grid; align-content: center; justify-items: center; padding: 8px; text-align: center; }
.donut-center strong { font-size: 18px; }
.breakdown { display: grid; gap: 8px; }
.breakdown-row { display: grid; grid-template-columns: 12px minmax(0,1fr) auto; align-items: center; gap: 7px; font-size: 14px; color: var(--muted); }
.breakdown-row strong { color: var(--text); font-weight: 650; }
.category-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); gap: 20px; }
.category-charts h3 { margin: 0; color: var(--muted); font-size: 14px; font-weight: 650; }
.category-charts .breakdown-row span { overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
.page-size, .list-pagination { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.page-size > span { color: var(--muted); font-size: 14px; }
.list-pagination { justify-content: space-between; margin-top: 12px; }
.list-pagination .button:disabled { cursor: default; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 14px; }
th { color: var(--muted); text-align: left; font-weight: 550; background: #151f30; }
.sort-header { display: flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: inherit; font: inherit; }
.sort-header:hover, th[aria-sort] .sort-header { color: var(--mint); }
td, th { padding: 11px 10px; }
td { border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 650; }
td .meta { display: block; margin-top: 4px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
td .total-currency { display: inline; margin: 0; }
.counterparty-value { max-width: 280px; min-width: 110px; white-space: normal; overflow-wrap: anywhere; }
.status { display: inline-block; padding: 4px 8px; border-radius: 6px; color: #b3c1d9; background: #243147; }
.status.paid, .status.active { color: #74e6ce; background: #183931; }
.status.review, .status.late { color: #ffd18f; background: #3c3025; }
.status.scheduled { color: #c1baff; background: #2b2748; }
.status.issued { color: #94c6ff; background: #1f3858; }
.text-link { color: var(--mint); font-size: 14px; font-weight: 650; padding: 4px 0; background: none; border: 0; }
.text-link:hover { text-decoration: underline; }
.empty { padding: 22px 9px; text-align: center; color: var(--muted); line-height: 1.5; }
select, input { min-height: 40px; border: 1px solid #34445c; border-radius: 8px; background: #0e1727; color: var(--text); padding: 8px 10px; min-width: 0; }
select { appearance: none; padding-right: 29px; background: linear-gradient(45deg,transparent 50%,var(--muted) 50%) right 15px center/5px 5px no-repeat, linear-gradient(135deg,var(--muted) 50%,transparent 50%) right 10px center/5px 5px no-repeat, #0e1727; }
dialog { width: min(510px,calc(100% - 24px)); padding: 22px; border: 1px solid #34445c; border-radius: 15px; background: var(--panel); color: var(--text); max-height: calc(100dvh - 30px); }
dialog::backdrop { background: #050812bb; }
.fields { display: grid; gap: 12px; margin: 17px 0; }
.fields label { display: grid; gap: 5px; color: var(--muted); font-size: 14px; }
.filter-range { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 8px; }
.filter-range > p { grid-column: 1 / -1; }
.date-field { display: grid; gap: 5px; }
.date-controls { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.date-native { position: absolute; right: 0; top: 0; width: 44px; opacity: 0; pointer-events: none; }
.date-fallback .date-native { position: static; grid-column: 1 / -1; width: 100%; opacity: 1; pointer-events: auto; }
.fields .check { display: flex; align-items: center; }
.check input { min-height: auto; }
.form-error { color: #ff9da9; margin-bottom: 12px; }
dialog:has([data-history-body]) { width: min(690px, calc(100% - 24px)); }
.history-title { overflow-wrap: anywhere; }
.history-list { margin: 0; padding: 0; display: grid; gap: 12px; list-style: none; }
.history-list li { border: 1px solid var(--line); border-radius: 9px; padding: 12px; }
.history-list h3 { margin: 0 0 6px; font-size: 16px; }
.history-list .table-wrap { margin-top: 8px; }
.history-list td { white-space: normal; overflow-wrap: anywhere; max-width: 260px; }
.activity-record { padding: 0; border: 0; background: none; font: inherit; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.activity-more { margin-top: 12px; }
.toast { position: fixed; z-index: 3; right: 18px; bottom: 18px; padding: 12px 16px; max-width: min(400px,calc(100% - 36px)); border: 1px solid #36566a; border-radius: 10px; background: #182b3b; box-shadow: 0 8px 24px #0006; }
.mail-steps { padding-left: 21px; line-height: 1.8; color: var(--muted); }
code { color: #b1f4e6; overflow-wrap: anywhere; }
@media (max-width: 1160px) {
  body { grid-template-columns: 192px minmax(0,1fr); }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .overview-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 870px) {
  .graphs { grid-template-columns: minmax(0,1fr); }
  .overview-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 420px) { .filter-range { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 1050px) {
  .forecast-charts, .forecast-metrics, .forecast-breakdowns { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 670px) {
  body { display: block; }
  .sidebar { position: static; height: auto; padding: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin: 0 0 9px; font-size: 21px; }
  .mark { width: 35px; height: 35px; }
  nav { display: flex; flex-wrap: wrap; gap: 4px; }
  nav a, .sidebar-foot a { padding: 7px 8px; gap: 5px; }
  nav svg, .sidebar-foot svg { width: 16px; height: 16px; }
  .sidebar-foot { display: flex; align-items: center; padding-top: 4px; margin-top: 4px; }
  .sidebar-foot small { margin: 0 0 0 auto; }
  .topbar { min-height: 48px; }
  .content { padding-top: 20px; }
  .metrics { gap: 8px; }
  .metric, .panel { padding: 12px; }
}
