
:root {
  color-scheme: light;
  --bg: #f6f7fb; --sidebar: #f2f2fa; --surface: #fff; --ink: #171f32;
  --muted: #5f6b80; --line: #e5e8f1; --blue: #066ad8; --blue-dark: #0759ba;
  --blue-soft: #eaf3ff; --navy: #10264c; --green: #087858; --green-soft: #e7f7f0;
  --amber: #9a4d08; --amber-soft: #fff2e4; --red: #a92d43; --red-soft: #ffedf0;
  --radius: 16px;
  font: 15px/1.45 Inter, "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p, ul, dl, dd { margin: 0; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
:focus-visible { outline: 3px solid #4b94ed; outline-offset: 3px; }
[hidden] { display: none !important; }
.icon { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.shell { display: grid; grid-template-columns: 222px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; align-self: start; min-width: 0; height: 100dvh; overflow: auto; display: flex; flex-direction: column; padding: 0 15px 13px; background: linear-gradient(155deg,#eff2fc,var(--sidebar) 55%,#f3eff8); color: #30313a; border-right: 1px solid #e2e3eb; }
.brand { display: flex; align-items: center; gap: 10px; padding: 15px 7px 0; margin: 0 0 20px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; flex: none; background: linear-gradient(140deg,#77aaff,#2776ee); border-radius: 9px; box-shadow: 0 2px 5px #2764e333; }
.brand-mark svg { display: block; width: 24px; height: 24px; }
.brand-mark svg path { fill: #fff; }
.brand strong, .brand small, .profile strong, .profile small { display: block; }
.brand strong { font-size: 15px; font-weight: 600; letter-spacing: -.4px; }
.brand small, .profile small { color: var(--muted); font-size: 12px; }
.brand small { margin-top: 3px; font-size: 10px; }
.nav { display: grid; gap: 8px; }
.nav-group summary { padding: 9px 8px; color: #626471; cursor: pointer; text-transform: uppercase; letter-spacing: .09em; font-size: 10px; font-weight: 550; }
.nav-group nav { display: grid; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 9px; min-height: 37px; padding: 8px 10px; border-radius: 8px; color: inherit; font-size: 13px; font-weight: 520; }
.nav a .icon { width: 17px; height: 17px; color: #517db6; }
.nav a:hover, .nav a[aria-current] { background: #e2e6f2; color: #22548f; }
.sidebar-footer { margin-top: auto; padding-top: 20px; }
.sidebar-footer .profile { padding: 9px 8px; border-radius: 9px; background: #ffffff8c; border: 1px solid #e2e3eb; }
.sidebar-footer .profile-copy { display: block; min-width: 0; overflow-wrap: anywhere; }
.workspace { min-width: 0; }
.topbar { min-height: 68px; padding: 9px clamp(16px, 2.8vw, 38px); display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.crumb, .profile { display: flex; align-items: center; gap: 9px; }
.crumb { font-size: 13px; color: var(--muted); }
.crumb strong { color: var(--ink); }
.crumb .icon { width: 13px; height: 13px; }
.profile { font-size: 12px; line-height: 1.35; }
.avatar { display: grid; place-items: center; width: 35px; height: 35px; background: #eaf2ff; color: #174f9f; border-radius: 50%; font-weight: 800; flex: none; }
.mobile-menu { display: none !important; }
main { max-width: 1550px; margin: 0 auto; padding: 29px clamp(16px, 2.8vw, 38px) 39px; }
.heading, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.heading { margin-bottom: 22px; }
h1 { font-size: clamp(27px, 3vw, 39px); letter-spacing: -.05em; line-height: 1.13; }
.heading p, .section-head p { color: var(--muted); font-size: 13px; margin-top: 5px; }
.heading-actions, .actions, .legend { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.btn, .text-btn, .icon-btn, .period { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border: 1px solid var(--line); border-radius: 9px; padding: 7px 12px; background: var(--surface); font-size: 13px; font-weight: 680; white-space: nowrap; cursor: pointer; }
.btn:hover, .icon-btn:hover, .period:hover { background: #f0f5ff; border-color: #c9d9ef; }
.btn .icon, .text-btn .icon, .period .icon { width: 16px; height: 16px; }
.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.period { padding: 0 9px 0 11px; color: #36455e; }
.period select { appearance: none; outline-offset: 0; border: 0; background: transparent; color: inherit; padding: 8px 18px 8px 0; margin-right: -18px; max-width: 100%; font-weight: inherit; }
.period .icon:last-child { width: 13px; pointer-events: none; }
.text-btn { padding: 4px 0; min-height: 32px; border: 0; background: transparent; color: var(--blue-dark); }
.text-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { width: 40px; padding: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; box-shadow: 0 2px 4px #172a5205; }
.summary { display: grid; grid-template-columns: 1.43fr 1fr 1fr; gap: 15px; }
.metric, .balance { min-height: 148px; padding: 17px 19px; position: relative; }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #485771; font-size: 13px; font-weight: 670; }
.tile { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; flex: none; background: var(--blue-soft); color: var(--blue-dark); }
.tile .icon { width: 17px; height: 17px; }
.tile.income { color: var(--green); background: var(--green-soft); }
.tile.expense { color: var(--amber); background: var(--amber-soft); }
.tile.payroll { color: #6042a6; background: #f0eaff; }
.amount { display: block; font-size: clamp(20px, 2.05vw, 30px); letter-spacing: -.047em; font-weight: 780; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric .amount { margin: 7px 0 2px; }
.metric .text-btn { min-height: 25px; text-align: left; white-space: normal; font-size: 12px; }
.balance { isolation: isolate; overflow: hidden; background: linear-gradient(112deg, #102143, #153771 72%, #1b4c96); color: #fff; border-color: #203f72; }
.balance::before, .balance::after { content: ""; position: absolute; z-index: -1; width: 185px; height: 185px; right: -65px; bottom: -91px; border: 1px solid #83b6fc42; border-radius: 38px; transform: rotate(40deg); pointer-events: none; }
.balance::after { right: -33px; bottom: -116px; width: 228px; height: 228px; }
.balance .metric-top, .balance small { color: #d9e8ff; }
.balance .amount { font-size: clamp(24px, 2.55vw, 39px); margin: 4px 0 2px; }
.balance .icon-btn { width: 34px; min-height: 34px; color: #fff; border-color: #a4c8ff50; background: #7faeff1e; }
.balance .icon-btn:hover { background: #7faeff42; }
.quick { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 11px; margin: 15px 0; }
.quick a { display: flex; align-items: center; min-width: 0; min-height: 58px; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 12px; font-weight: 720; }
.quick a > .icon { margin-left: auto; width: 13px; height: 13px; color: #7384a0; }
.quick a .tile { width: 31px; height: 31px; border-radius: 8px; }
.quick a:hover { border-color: #b9d5f7; background: #f8fbff; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 15px; align-items: start; }
.dashboard-grid + .dashboard-grid { margin-top: 15px; }
.panel { padding: 17px 18px; }
.section-head { align-items: flex-start; }
.section-head h2 { font-size: 17px; letter-spacing: -.025em; line-height: 1.25; }
.section-head .text-btn { margin-top: -5px; }
.legend { margin-top: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.key.in, .bar.in { background: #2276de; }
.key.out, .bar.out { background: #f0a456; }
.chart-wrap { --plot-height: 138px; display: grid; grid-template-columns: 39px minmax(0,1fr); gap: 6px; margin-top: 10px; }
.axis { display: flex; flex-direction: column; height: var(--plot-height); justify-content: space-between; align-items: flex-end; font-size: 10px; color: var(--muted); text-align: right; }
.plot { position: relative; display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 3px; }
.gridlines { position: absolute; inset: 5px 0 0; height: calc(var(--plot-height) - 5px); display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.gridlines i { border-top: 1px dashed #dee5ef; }
.gridlines i:last-child { border-top-style: solid; }
.plot-cell { position: relative; min-width: 0; display: grid; gap: 5px; justify-items: stretch; background: transparent; border: 0; padding: 0; color: var(--muted); font-size: 11px; }
.plot-cell:hover, .plot-cell:focus-visible { background: #eaf3ffaa; border-radius: 8px; }
.bars { display: flex; align-items: flex-end; justify-content: center; gap: clamp(3px, .6vw, 8px); height: var(--plot-height); padding-top: 5px; }
.bar { width: clamp(8px, 1.6vw, 23px); height: var(--height); border-radius: 5px 5px 0 0; }
.plot-cell[aria-pressed="true"] { color: #105bb8; font-weight: 780; }
.plot-cell[aria-pressed="true"] .bar.in { background: #175bc3; }
.list { list-style: none; padding: 0; margin-top: 11px; }
.list li + li { border-top: 1px solid #edf0f5; }
.row-button { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 54px; padding: 7px 0; border: 0; background: transparent; text-align: left; }
.row-button:hover .row-title { color: var(--blue-dark); text-decoration: underline; }
.row-button .tile { width: 33px; height: 33px; }
.row-copy { display: grid; gap: 2px; min-width: 0; flex: 1; }
.row-title { font-size: 12px; font-weight: 740; overflow-wrap: anywhere; }
.row-sub { color: var(--muted); font-size: 11px; }
.row-value { white-space: nowrap; font-weight: 740; font-variant-numeric: tabular-nums; font-size: 12px; }
.pos { color: var(--green); }
.date-tile { display: grid; align-content: center; justify-items: center; width: 37px; height: 37px; flex: none; border: 1px solid #edf0f5; border-radius: 9px; background: #f7f9fd; line-height: 1.05; color: #314866; }
.date-tile b { font-size: 15px; }
.date-tile span { font-size: 9px; text-transform: uppercase; margin-top: 2px; }
.agenda .row-value { text-align: right; }
.agenda .pill { display: table; margin: 2px 0 0 auto; }
.pill { display: inline-block; border-radius: 100px; padding: 2px 7px; color: var(--amber); background: var(--amber-soft); font-size: 10px; font-weight: 740; white-space: nowrap; }
.pill.done { color: var(--green); background: var(--green-soft); }
.pill.late { color: var(--red); background: var(--red-soft); }
.empty { color: var(--muted); font-size: 13px; padding: 20px 0; }
.costs { display: grid; gap: 12px; margin-top: 16px; }
.cost-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 5px 8px; align-items: center; font-size: 12px; }
.cost-name { font-weight: 700; color: #34445e; overflow-wrap: anywhere; }
.cost-name .key { margin-right: 7px; }
.cost-value { font-weight: 730; font-variant-numeric: tabular-nums; }
.track { height: 6px; grid-column: 1/-1; background: #edf1f8; border-radius: 10px; overflow: hidden; }
.track span { display: block; height: 100%; border-radius: inherit; }
.page-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; margin-bottom: 15px; }
.page-metrics .metric { min-height: 110px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 15px 0 9px; }
.filters input { flex: 1; min-width: min(150px,100%); }
input, select { color: var(--ink); }
.filters input, .filters select, dialog input, dialog select { border: 1px solid #ccd7e7; border-radius: 8px; padding: 8px 10px; background: white; min-height: 40px; font-size: 13px; }
.table-wrap { position: relative; overflow: auto; margin-top: 6px; }
table { width: 100%; text-align: left; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 8px; border-bottom: 1px solid #edf0f5; }
thead th { color: var(--muted); font-size: 11px; font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
tbody td:first-child { min-width: 128px; }
tbody td:last-child { text-align: right; }
td .text-btn { min-height: 27px; }
.nowrap { white-space: nowrap; }
.category-list { display: grid; gap: 10px; margin-top: 14px; }
.category-item { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 6px 14px; padding: 11px 0; }
.category-item + .category-item { border-top: 1px solid var(--line); }
.category-item small { color: var(--muted); }
.category-item a { justify-self: end; }
dialog { width: min(470px,calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); box-shadow: 0 18px 60px #11294f42; }
dialog::backdrop { background: #13254470; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.dialog-head h2 { font-size: 20px; letter-spacing: -.03em; overflow-wrap: anywhere; }
.dialog-head .icon-btn { flex: none; min-height: 34px; width: 34px; }
.dialog-note { color: var(--muted); font-size: 12px; margin-top: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.form-grid label, .form-grid .form-field { display: grid; gap: 4px; font-size: 12px; font-weight: 680; }
.form-grid input, .form-grid select { width: 100%; min-width: 0; }
.form-wide { grid-column: 1/-1; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 15px; }
.detail-grid > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { text-align: right; font-weight: 710; }
.error { color: var(--red); margin-top: 10px; font-size: 12px; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: calc(100% - 40px); z-index: 3; padding: 11px 14px; border-radius: 10px; background: #142b51; color: #fff; font-size: 13px; box-shadow: 0 8px 25px #12274d32; }
@media (max-width: 1060px) {
  .shell { grid-template-columns: 191px minmax(0,1fr); }
  .sidebar { padding-inline: 11px; }
  .quick a > .icon { display: none; }
}
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; padding: 9px 13px; }
  .brand { margin: 0; padding: 0; }
  .brand-mark { width: 35px; height: 35px; }
  .brand-mark svg { width: 25px; height: 25px; }
  .mobile-menu { display: inline-flex !important; margin-left: auto; }
  .sidebar-top { display: flex; align-items: center; }
  .nav { margin-top: 10px; }
  .nav-group nav { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .sidebar[data-expanded="false"] :is(.nav,.sidebar-footer) { display: none; }
  .sidebar-footer { padding-top: 10px; }
  .topbar { min-height: 49px; }
  .profile-copy { display: none; }
  .avatar { width: 29px; height: 29px; }
  main { padding-top: 19px; }
}
@media (max-width: 500px) {
  .heading { align-items: stretch; flex-direction: column; gap: 11px; margin-bottom: 15px; }
  .heading-actions { justify-content: space-between; }
  .summary { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .balance { grid-column: 1/-1; }
  .metric, .balance { min-height: 113px; padding: 12px; }
  .metric-top { font-size: 12px; }
  .metric-top .tile { width: 27px; height: 27px; }
  .quick { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 10px 0; }
  .quick a { min-height: 48px; }
  .panel { padding: 15px 12px; }
  .dashboard-grid, .dashboard-grid + .dashboard-grid { gap: 10px; }
  .page-metrics { grid-template-columns: 1fr; gap: 8px; }
  .page-metrics .metric { min-height: unset; }
  .table-wrap table, .table-wrap tbody { display: block; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-wrap tbody tr { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: center; }
  .table-wrap tbody tr:last-child { border: 0; }
  .table-wrap td { min-width: 0; padding: 0; border: 0; overflow-wrap: anywhere; }
  .table-wrap td:first-child { grid-area: 1 / 1; min-width: 0; }
  .table-wrap td:nth-child(2) { grid-area: 2 / 1; color: var(--muted); }
  .table-wrap td:nth-child(3) { grid-area: 3 / 1; color: var(--muted); }
  .table-wrap td:nth-child(4) { grid-area: 1 / 2; font-weight: 700; }
  .table-wrap td:nth-child(5) { grid-area: 2 / 2; }
  .table-wrap td:nth-child(6) { grid-area: 3 / 2; }
  .table-wrap td:nth-child(n+4) { text-align: right; }
  .table-wrap td .text-btn { min-height: 32px; }
}
.managed-field { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 12px; }
.managed-field input { min-height: auto; }
.scope { flex: none; padding: 4px 8px; border: 1px solid #dce5f3; border-radius: 6px; color: #40618b; background: #f5f8fd; font-size: 11px; font-weight: 650; }
.profit-panel { margin-bottom: 15px; }
.profit-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-top: 13px; }
.profit-grid > div { border: 1px solid var(--line); border-radius: 10px; background: #f9fbff; padding: 9px 11px; }
.profit-grid > .profit-total { background: #eef5ff; border-color: #deebfc; }
.profit-grid span, .profit-grid strong { display: block; overflow-wrap: anywhere; }
.profit-grid span { color: var(--muted); font-size: 12px; font-weight: 650; }
.profit-grid small { margin-inline-start: 3px; color: #21589c; }
.profit-grid strong { margin-top: 3px; font-size: clamp(16px,1.65vw,22px); letter-spacing: -.035em; }
.negative { color: var(--red); }
.record-repeat { display: inline-flex; color: #395d98; vertical-align: middle; }
.record-repeat .icon { width: 13px; height: 13px; }
.series-list { list-style: none; padding: 0; margin-top: 11px; }
.series-item { display: flex; align-items: flex-start; gap: 11px; padding: 12px 0; }
.series-item + .series-item { border-top: 1px solid var(--line); }
.series-copy { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.series-copy strong, .series-copy small { display: block; }
.series-copy small { font-size: 12px; color: var(--muted); }
.series-side { display: grid; gap: 2px; justify-items: end; font-size: 13px; white-space: nowrap; }
.series-side .text-btn { min-height: 26px; }
.extras { margin-top: 10px; }
.deduction-fields { min-width: 0; margin: 15px 0 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.deduction-fields legend { padding: 0 5px; font-size: 13px; font-weight: 700; }
.deduction-fields [data-add-cost] { max-width: 100%; white-space: normal; text-align: left; }
.deduction-fields > p { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.deduction-fields > #cost-preview { margin: 8px 0 0; color: var(--blue-dark); font-weight: 650; }
.cost-field { padding: 9px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 8px; background: #f9fbff; }
.cost-field-head { display: flex; justify-content: space-between; align-items: center; gap: 5px; margin-bottom: 6px; font-size: 12px; }
.cost-field-head .icon-btn { width: 28px; min-height: 28px; }
.cost-field-head .icon { width: 15px; height: 15px; }
.contract-costs { margin-top: 14px; }
.contract-costs h3 { font-size: 13px; }
.contract-costs ul { padding: 0; margin: 5px 0 0; list-style: none; }
.contract-costs li { display: flex; justify-content: space-between; align-items: start; gap: 10px; padding: 6px 0; font-size: 12px; }
.contract-costs li small { display: block; color: var(--muted); }
.invite-card { max-width: 540px; }
.invite-card form { margin-top: 15px; }
.invite-actions { flex: none; }
@media (max-width: 500px) {
  .profit-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .profit-grid > .profit-total { grid-column: 1/-1; }
  .series-item:has(.invite-actions) { flex-wrap: wrap; }
  .invite-actions { margin-left: 46px; }
  .crumb { min-width: 0; flex-wrap: wrap; gap: 1px 6px; }
  .scope { max-width: 41%; white-space: normal; text-align: right; }
  .deduction-fields .form-grid { grid-template-columns: 1fr; }
  .series-side > strong { white-space: normal; text-align: right; }
}

.auth-shell { display: grid; place-items: center; min-height: 100dvh; padding: 16px; background: radial-gradient(ellipse at 10% 0,#dce8fc,transparent 65%),radial-gradient(ellipse at 100% 0,#f1e0f2,transparent 55%),#ebeef7; }
main.auth-card { width: min(100%,440px); margin: 0; padding: 24px; box-shadow: 0 12px 40px #1f356516; }
.auth-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: #274a7c; }
.auth-card h1 { font-size: 27px; }
.auth-card p { color: var(--muted); margin-top: 9px; }
.auth-card form { margin-top: 15px; }
.auth-card .form-grid { grid-template-columns: 1fr; }
.auth-card input { min-height: 43px; }
.auth-card .error { color: var(--red); }
.sign-out { margin: 8px 0 0 8px; }
.balance-settings { color: #deebff; margin-left: 8px; min-height: 25px; font-size: 12px; }
.balance-settings:hover { color: white; }
