:root {
  color-scheme: light;
  --ink: #192924;
  --muted: #5f6c64;
  --paper: #f5f5ef;
  --white: #fffefa;
  --stroke: #e0e4da;
  --forest: #192a23;
  --leaf: #d8f1ac;
  --green: #2d6147;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, monospace;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; }
button,input,select,textarea { font: inherit; }
button,select,summary { cursor: pointer; }
button:disabled, [aria-disabled="true"] { opacity: .55; cursor: default; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #659450; outline-offset: 3px; }
.skip { position: fixed; left: 12px; top: -80px; z-index: 20; padding: 10px; background: var(--white); }
.skip:focus { top: 12px; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 226px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100dvh; padding: 26px 16px 18px; background: var(--forest); color: #f0f4e9; display: flex; flex-direction: column; overflow: auto; z-index: 4; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 7px; margin-bottom: 35px; font-size: 19px; font-weight: 700; letter-spacing: -.05em; text-decoration: none; }
.brand img { width: 39px; height: 39px; }
.brand small { display: block; color: #adc0b2; font-size: 10px; letter-spacing: .12em; font-weight: 600; text-transform: uppercase; margin-top: 1px; }
.nav-group { margin-bottom: 25px; }
.nav-group h2 { padding: 0 10px; color: #b2c2b6; font-size: 10px; letter-spacing: .105em; text-transform: uppercase; font-weight: 700; margin: 0 0 7px; }
.nav-link { display: flex; gap: 11px; align-items: center; width: 100%; min-height: 41px; padding: 8px 10px; border-radius: 7px; color: #d4dfd4; font-weight: 550; text-decoration: none; }
.nav-link:hover { background: #2c3d34; }
.nav-link[aria-current="page"] { background: #33473b; color: var(--leaf); font-weight: 700; }
.nav-link .icon { width: 18px; height: 18px; }
.sidebar-end { margin-top: auto; padding-top: 10px; border-top: 1px solid #3a4c40; }
.nav-count { margin-left: auto; background: #d8f1ac; color: #24372c; border-radius: 5px; min-width: 22px; text-align: center; font-size: 11px; font-weight: 800; }
.icon { width: 17px; height: 17px; flex: none; vertical-align: middle; }
.work { min-width: 0; }
.top { min-height: 74px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(15px,3vw,42px); background: var(--white); border-bottom: 1px solid var(--stroke); gap: 14px; }
.top-left,.top-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.top-company { font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 26ch; }
.top-crumb { color: var(--muted); white-space: nowrap; }
.top-divider { color: #929f93; }
.top select { min-width: 144px; }
.menu { display: none !important; }
main#content { padding: 34px clamp(15px,3vw,42px) 50px; max-width: 1600px; margin: auto; }
h1,h2,h3,p { margin: 0; }
h1 { font: 500 clamp(39px,4vw,62px)/1.02 var(--serif); letter-spacing: -.054em; }
h2 { font-size: 18px; letter-spacing: -.025em; line-height: 1.2; }
h3 { font-size: 14px; line-height: 1.35; }
p { line-height: 1.55; }
.page-head { display: flex; gap: 18px; align-items: end; justify-content: space-between; margin-bottom: 25px; }
.kicker { color: var(--green); text-transform: uppercase; font-size: 10px; letter-spacing: .15em; font-weight: 800; display: block; margin-bottom: 10px; }
.subtitle { color: var(--muted); margin-top: 10px; max-width: 74ch; }
.button { min-height: 39px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #d8ddd3; color: var(--ink); background: var(--white); padding: 8px 13px; border-radius: 7px; font-weight: 700; line-height: 1.2; text-decoration: none; white-space: nowrap; }
.button:hover:not(:disabled) { background: #edf1e7; }
.button.primary { background: #244634; color: #fff; border-color: #244634; }
.button.primary:hover:not(:disabled) { background: #346047; }
.button.small { min-height: 33px; padding: 5px 9px; font-size: 12px; }
.button.ghost { border-color: transparent; background: transparent; }
.button.danger { color: #9a3925; }
input, select, textarea { display: block; width: 100%; min-height: 39px; border: 1px solid #d6ded1; border-radius: 7px; padding: 7px 10px; background: var(--white); color: var(--ink); }
input[type=file] { padding: 8px; }
label { display: grid; gap: 5px; font-size: 12px; font-weight: 700; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.panel { background: var(--white); border: 1px solid var(--stroke); border-radius: 12px; min-width: 0; }
.panel-pad { padding: 19px; }
.panel-head { display: flex; align-items: start; justify-content: space-between; gap: 13px; padding: 19px 19px 14px; }
.panel-head p { color: var(--muted); font-size: 12px; margin-top: 4px; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; margin-bottom: 16px; }
.metric { padding: 17px; min-height: 123px; }
.metric-label { display: flex; align-items: center; gap: 8px; font-weight: 750; font-size: 12px; color: #425349; }
.metric-label .icon { color: #4c7058; }
.metric-value { display: block; font: 500 clamp(20px,2.5vw,36px)/1.15 var(--serif); letter-spacing: -.05em; margin-top: 10px; white-space: nowrap; }
.metric-note { display: block; font-size: 11px; color: var(--muted); margin-top: 6px; }
.metric:first-child { background: #e9f1dc; border-color: #dde9d0; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(245px,.98fr); gap: 15px; margin-bottom: 16px; }
.chart { display: block; width: 100%; min-width: 380px; height: auto; color: var(--muted); }
.chart-wrap { overflow: auto; padding: 0 15px 10px; }
.chart text { font: 12px var(--sans); fill: currentColor; }
.chart .rule { stroke: #dde4d9; stroke-dasharray: 3 3; }
.chart .zero { stroke: #cfdacc; }
.chart .products { fill: #37694d; }
.chart .expenses { fill: #b7d0a1; }
.legend { display: flex; gap: 13px; color: var(--muted); white-space: nowrap; font-size: 11px; }
.swatch { display: inline-block; border-radius: 3px; width: 9px; height: 9px; margin-right: 4px; background: #37694d; }
.swatch.light { background: #b7d0a1; }
.source-list { padding: 0 19px 15px; }
.source { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--stroke); }
.source:last-child { border: 0; }
.source-text { flex: 1; min-width: 0; }
.source-text strong,.source-text small { display: block; overflow-wrap: anywhere; }
.source-text small { color: var(--muted); margin-top: 2px; font-size: 11px; }
.source .icon-box { width: 33px; height: 33px; border-radius: 8px; background: #e9efe3; color: var(--green); display: grid; place-items: center; flex: none; }
.source-card-foot { padding: 0 19px 17px; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 750; padding: 4px 8px; border-radius: 5px; background: #eef0eb; color: #515e54; white-space: nowrap; }
.badge.ok { background: #e8f2de; color: #315e39; }
.badge.wait { background: #fbefda; color: #714b1a; }
.badge.err { background: #fbe9e1; color: #892f25; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
thead { background: #f4f6ef; }
th,td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--stroke); }
th { color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
td { font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { border-bottom: 0; border-top: 1px solid var(--stroke); font-weight: 800; background: #f4f6ef; }
.num { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.pos { color: #285d3f; }
.mono { font: 12px var(--mono); }
.link { color: #2a5b40; text-underline-offset: 3px; font-weight: 700; }
.empty { display: grid; gap: 8px; justify-items: start; color: var(--muted); padding: 24px 20px; }
.empty strong { color: var(--ink); }
.notice { background: #eaf0e3; border: 1px solid #dce6d6; color: #364d3d; padding: 11px 14px; border-radius: 8px; margin-bottom: 15px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.notice a { margin-left: auto; }
.stack { display: grid; gap: 12px; }
.split { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; align-items: start; }
.three { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; }
.cols { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }
.filters { display: flex; gap: 9px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.filters select,.filters input { width: auto; max-width: 100%; }
.export-card { padding: 18px; display: grid; gap: 12px; justify-items: start; }
.export-card p { color: var(--muted); margin-bottom: 3px; }
dialog { border: 1px solid var(--stroke); border-radius: 13px; width: min(calc(100% - 28px),720px); max-height: calc(100% - 32px); padding: 0; background: var(--white); color: var(--ink); }
dialog::backdrop { background: #182822a0; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--stroke); }
.dialog-content { padding: 17px 18px; }
.dialog-foot { display: flex; gap: 12px; justify-content: end; align-items: center; flex-wrap: wrap; padding-top: 6px; }
.entry-line { display: grid; grid-template-columns: minmax(100px,1.5fr) minmax(58px,.6fr) minmax(58px,.6fr) auto; gap: 7px; align-items: end; margin-bottom: 6px; }
.entry-line select { text-overflow: ellipsis; }
.error { color: #9a3529; font-weight: 650; }
.toast { position: fixed; bottom: 18px; right: 18px; max-width: min(460px,calc(100% - 36px)); padding: 12px 17px; background: var(--forest); color: white; border-radius: 8px; z-index: 8; box-shadow: 0 7px 26px #18282233; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.55 var(--mono); max-height: 50vh; overflow: auto; background: var(--paper); padding: 12px; border-radius: 7px; }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { padding: 25px; width: min(100%,420px); display: grid; gap: 18px; }
.loading { color: var(--muted); padding: 12px 0; }
@media(max-width:1160px) {
  .shell { grid-template-columns: 196px minmax(0,1fr); }
  .metric { padding: 12px; }
}
@media(max-width:1000px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .source-list { display: grid; grid-template-columns: repeat(3,1fr); gap: 11px; }
  .source { border-bottom: 0; align-items: flex-start; }
  .source .badge { display: none; }
}
@media(max-width:780px) {
  .shell { display: block; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 235px; box-shadow: 0 0 0 100vmax #18282255; }
  .sidebar:not(.open) { display: none; }
  .menu { display: inline-flex !important; }
  .top { min-height: 61px; }
  .top-crumb,.top-divider { display: none; }
  main#content { padding-top: 24px; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric-value { font-size: clamp(20px,5vw,33px); }
  .three { grid-template-columns: 1fr; }
}
@media(max-width:530px) {
  .source-list,.split { display: block; }
  .split > * + * { margin-top: 12px; }
  .top-company { max-width: 14ch; }
  .top-right .button { display: none; }
  .page-head { align-items: start; flex-direction: column; }
  .legend { flex-direction: column; gap: 2px; }
  .panel-head, th, td { padding-left: 11px; padding-right: 11px; }
}
.connection-items { width: 100%; }
.connection-items .source { flex-wrap: wrap; }
.connection-items .source button { margin-left: auto; }
@media(max-width:530px) {
  .top-left,.top-right { gap: 7px; }
  .top-right .button,.top-left .menu { display: inline-flex; font-size: 0; gap: 0; padding: 6px 9px; }
  .top select { min-width: 0; max-width: 132px; }
  .entry-line .button { font-size: 0; gap: 0; padding: 6px; }
}
