:root {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: #192a25;
  background: #f3f4ef;
  --ink: #192a25;
  --muted: #57665f;
  --line: #dce2da;
  --surface: #ffffff;
  --canvas: #f3f4ef;
  --green: #18634b;
  --rail: #153b34;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .52; cursor: default; }
button, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #278564; outline-offset: 3px; }
input, select {
  min-width: 0; width: 100%; min-height: 44px; padding: 9px 12px;
  border: 1px solid #aab7ac; border-radius: 7px; background: #fff; color: var(--ink);
}
input::placeholder { color: #6d786e; }
label:not(.check-label) { display: block; margin-bottom: 5px; font-size: .84rem; font-weight: 650; color: #48574f; }
h1,h2,h3,p { margin: 0; }
h1,h2,h3 { line-height: 1.14; }
h1 { font-size: clamp(2.05rem,4.2vw,3rem); font-weight: 650; letter-spacing: -.06em; }
h2 { font-size: 1.45rem; font-weight: 650; letter-spacing: -.035em; }
button.primary, button.secondary {
  border: 1px solid transparent; border-radius: 7px; min-height: 43px;
  padding: 9px 16px; font-weight: 640; font-size: .92rem; line-height: 1.2;
}
button.primary { color: white; background: var(--green); }
button.primary:not(:disabled):hover { background: #114d3a; }
button.secondary { color: #26473a; background: #fff; border-color: #c2ccc2; }
button.secondary:not(:disabled):hover { background: #eff4ee; border-color: #8aa28e; }
.brand { display: flex; align-items: center; gap: 11px; line-height: 1.18; font-size: 1.08rem; font-weight: 700; letter-spacing: -.03em; }
.brand b { display: block; margin-top: 2px; font-weight: 500; font-size: .82rem; letter-spacing: .01em; }
.brand-icon { display: block; position: relative; width: 33px; height: 37px; border-radius: 6px 6px 2px 2px; background: #dcedac; }
.brand-icon::before, .brand-icon::after { content: ""; position: absolute; left: 7px; height: 2px; background: var(--rail); }
.brand-icon::before { top: 11px; width: 18px; box-shadow: 0 6px var(--rail); }
.brand-icon::after { top: 23px; width: 10px; }
.boot { margin: 12vh auto; text-align: center; color: var(--muted); }
.signin { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(100%, 425px); padding: clamp(25px,6vw,45px); border: 1px solid var(--line); border-top: 5px solid var(--rail); border-radius: 12px; background: #fff; box-shadow: 0 12px 42px #23372b0b; }
.login-card h1 { margin: 36px 0 26px; font-size: 2.25rem; }
.login-card .primary { width: 100%; margin-top: 18px; }
.error { color: #923e32; margin-top: 8px; font-size: .92rem; }
.workspace { display: grid; grid-template-columns: 213px minmax(0,1fr); min-height: 100vh; min-height: 100dvh; }
.rail { display: flex; flex-direction: column; align-self: start; position: sticky; top: 0; height: 100vh; height: 100dvh; padding: 32px 16px 18px; background: var(--rail); color: #f4f7ed; }
.rail .brand { margin: 0 12px 45px; }
.rail .brand b { color: #c1d2c5; }
.rail nav { display: grid; gap: 5px; }
.rail nav button, .rail-footer button {
  display: flex; align-items: center; gap: 13px; text-align: left; padding: 11px 13px; min-height: 44px;
  border: 0; border-radius: 7px; background: transparent; color: #d2e0d5; font-weight: 590;
}
.rail nav button[aria-current="page"] { background: #dcedac; color: #173c2c; }
.rail nav button:not([aria-current]):hover, .rail-footer button:hover { background: #245146; color: white; }
.rail button:focus-visible { outline-color: #fff; }
.nav-icon { display: inline-block; width: 15px; height: 15px; flex: 0 0 15px; }
.receipt-icon { border: 1.5px solid currentColor; border-radius: 1px; position: relative; }
.receipt-icon::after { content: ""; position: absolute; top: 3px; left: 2px; right: 2px; border-top: 1.5px solid; box-shadow: 0 4px; }
.menu-icon { background: linear-gradient(to right,currentColor 44%,transparent 44% 56%,currentColor 56%); mask: linear-gradient(to bottom,#000 44%,transparent 44% 56%,#000 56%); }
.issue-icon { border: 1.5px solid currentColor; border-top-width: 4px; border-radius: 2px; }
.report-icon { border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; background: linear-gradient(to top, currentColor 0 100%) 3px bottom / 2px 40% no-repeat, linear-gradient(to top, currentColor 0 100%) 7px bottom / 2px 70% no-repeat, linear-gradient(to top, currentColor 0 100%) 11px bottom / 2px 100% no-repeat; }
#report-message { padding: 16px 24px; }
#report-filters:not([hidden]) + #report-message { padding-top: 0; }
#report-text { margin: 0; padding: 20px 24px; border-top: 1px solid var(--line); font: .96rem/1.55 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.report-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 13px 24px; border-top: 1px solid var(--line); }
.report-actions a { color: var(--green); font-weight: 600; }
@media print {
  body:has(#reports-view:not([hidden])) { background: white; color: black; }
  .workspace:has(#reports-view:not([hidden])) { display: block; }
  .workspace:has(#reports-view:not([hidden])) :is(.rail, #notice, .page-heading, #report-filters, #report-message, .report-actions) { display: none; }
  #workspace:has(#reports-view:not([hidden])) main, #report-text { padding: 0; }
  #reports-view .panel, #report-text { border: 0; }
}
#issue-message { padding: 0 24px 14px; }
.issue-totals { margin: 0; padding: 16px 24px 24px; display: flex; flex-wrap: wrap; gap: 14px 48px; }
.issue-totals dt { font-size: .85rem; color: var(--muted); }
.issue-totals dd { margin: 4px 0 0; font-size: 1.55rem; font-weight: 680; }
.rail-footer { border-top: 1px solid #386055; padding-top: 12px; margin-top: auto; }
main { width: 100%; max-width: 1440px; margin: 0 auto; padding: clamp(32px,5.5vw,82px) clamp(22px,4.8vw,77px); }
.page-heading,.dialog-heading,.menu-actions,.form-actions,.pager,.conflict { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.page-heading { margin-bottom: 27px; }
.panel { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; }
.filterbar { padding: 23px 24px 19px; display: flex; flex-wrap: wrap; align-items: end; gap: 13px; }
.field { min-width: 0; }
.filterbar .field { flex: 0 1 242px; }
.filterbar .search-field { flex: 1 1 240px; }
.section-meta { color: var(--muted); font-size: .86rem; font-weight: 550; }
#receipt-meta { padding: 0 24px 16px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-spacing: 0; border-collapse: collapse; font-size: .91rem; }
th, td { text-align: left; padding: 13px 12px; }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 24px; }
th { background: #eff2eb; color: #43574b; font-size: .78rem; font-weight: 650; }
td { border-top: 1px solid var(--line); overflow-wrap: anywhere; }
tbody tr[data-action] { cursor: pointer; }
tbody tr[data-action]:hover, tbody tr:focus-within { background: #f7f9f4; }
.numeric { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.numeric { font-weight: 680; }
.cell-action,.text-button,.danger-link { background: transparent; color: var(--green); border: 0; padding: 0; font-weight: 640; text-align: left; }
.cell-action, .text-button { min-height: 32px; }
.cell-action { max-width: 100%; overflow-wrap: anywhere; }
.cell-action:hover,.text-button:hover,.danger-link:hover { text-decoration: underline; }
.subtext { display: block; font-size: .8rem; color: var(--muted); }
.tag { display: inline-block; border-radius: 5px; padding: 3px 7px; font-size: .76rem; font-weight: 600; line-height: 1.45; }
.tag.good { background: #e3f1e1; color: #235737; }
.tag.wait { background: #fff2cf; color: #71520d; }
.tag.bad { background: #f9e7e3; color: #85362b; }
.tag.neutral { background: #e9edeb; color: #48564f; }
.empty { padding: 47px 24px 50px; text-align: center; border-top: 1px solid var(--line); }
.empty h2 { font-size: 1.18rem; }
.empty p { margin: 8px auto 0; max-width: 42ch; color: var(--muted); }
.empty button { margin-top: 17px; }
.pager { justify-content: flex-end; padding: 13px 23px; border-top: 1px solid var(--line); }
.pager span { color: var(--muted); font-size: .85rem; }
.menu-actions { padding: 20px 24px; flex-wrap: wrap; }
.menu-actions > div { display: flex; flex-wrap: wrap; gap: 8px; }
.compact { padding-top: 0; }
.notice,.conflict { border-radius: 7px; margin-bottom: 18px; padding: 12px 16px; font-size: .91rem; }
.notice { color: #245238; background: #e3efdd; }
.notice.is-error,.conflict { color: #743d23; background: #fff0da; }
.conflict { flex-wrap: wrap; }
dialog { color: var(--ink); border: 1px solid var(--line); border-radius: 12px; width: min(calc(100% - 24px),530px); max-height: calc(100vh - 34px); max-height: calc(100dvh - 34px); padding: 0; background: white; box-shadow: 0 22px 90px #102b2635; }
dialog::backdrop { background: #0b221e75; }
.dialog-shell { padding: clamp(20px,4vw,30px); }
.dialog-heading { margin-bottom: 22px; align-items: flex-start; }
.close { border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--muted); flex-shrink: 0; width: 36px; height: 36px; padding: 0; font-size: 1.45rem; line-height: 1; }
.close:hover { background: #f0f3ed; }
.overline { font-size: .78rem; margin-bottom: 3px; color: var(--muted); }
.detail-meta { display: grid; gap: 7px; padding: 14px 15px; margin: 0 0 21px; border-radius: 8px; background: #f3f5f0; }
.detail-meta > div, .detail-item, .detail-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.detail-meta dt { color: var(--muted); }
.detail-meta dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.detail-meta, .detail-item,.detail-line { font-size: .91rem; }
.detail-section { padding: 0 0 15px; }
.detail-section h3 { margin-bottom: 9px; font-size: .98rem; }
.detail-item { border-bottom: 1px dashed var(--line); padding: 8px 0; }
.detail-item > :first-child { min-width: 0; overflow-wrap: anywhere; }
.detail-item .subtext { margin-top: 2px; }
.detail-line { padding: 3px 0; }
.detail-total { display: flex; justify-content: space-between; gap: 12px; margin-top: 2px; padding-top: 13px; border-top: 1px solid var(--line); font-size: 1.25rem; }
.edit-form { display: grid; gap: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.check-label { display: flex; gap: 8px; align-items: center; min-height: 38px; }
.check-label input { accent-color: var(--green); width: 19px; min-height: 19px; height: 19px; margin: 0; }
.form-actions { margin-top: 5px; }
.form-actions .primary { margin-left: auto; }
.danger-link { color: #973e30; min-height: 40px; }
.category-list { margin-bottom: 16px; }
.category-entry { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.category-entry > span { overflow-wrap: anywhere; }
@media(max-width:1000px) {
  .workspace { grid-template-columns: 170px minmax(0,1fr); }
  .rail { padding-left: 10px; padding-right: 10px; }
  main { padding-left: 24px; padding-right: 24px; }
}
@media(max-width:800px) {
  .workspace { display: block; }
  .rail { height: auto; position: static; display: grid; grid-template-columns: 1fr auto; padding: 13px 18px 9px; gap: 10px; }
  .rail .brand { margin: 0; }
  .rail .brand b { display: inline; }
  .rail .brand-icon { width: 28px; height: 32px; }
  .rail nav { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
  .rail nav button { padding: 7px 13px; min-height: 37px; }
  .rail-footer { grid-column: 2; grid-row: 1; border: 0; padding: 0; margin: 0; }
  .rail-footer button { min-height: 34px; padding: 6px; }
  main { padding: 28px 16px; }
}
@media(max-width:600px) {
  .page-heading { align-items: flex-start; flex-wrap: wrap; margin-bottom: 17px; }
  .page-heading h1 { font-size: 2.12rem; }
  .filterbar,.menu-actions { padding: 15px; }
  .filterbar .field { flex: 1 1 100%; }
  .compact { padding-top: 0; }
  #receipt-meta { padding: 0 15px 12px; }
  table,tbody { display: block; }
  table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { display: grid; grid-template-columns: minmax(0,1fr) auto; column-gap: 10px; row-gap: 4px; border-top: 1px solid var(--line); padding: 11px 14px; }
  tbody td, td:first-child, td:last-child { padding: 0; border: 0; font-size: .86rem; }
  tbody td:first-child { grid-column: 1; grid-row: 1; }
  tbody td:nth-child(2) { grid-column: 1; grid-row: 2; color: var(--muted); align-self: center; }
  tbody td:nth-child(3) { grid-column: 2; grid-row: 2; text-align: right; }
  tbody td.numeric { grid-column: 2; grid-row: 1; align-self: start; padding-top: 6px; font-size: .96rem; }
  .menu-actions { gap: 9px; }
  .menu-actions > div { width: 100%; }
  .pager { padding: 11px 12px; justify-content: space-between; }
  .empty { padding: 33px 17px; }
  #issue-message, .issue-totals { padding-left: 15px; padding-right: 15px; }
  #issue-table td:nth-child(2) { grid-column: 1; grid-row: 2; text-align: left; padding-top: 0; }
  #issue-table td:nth-child(3) { grid-column: 2; grid-row: 1; }
  #issue-table td:nth-child(2)::before { content: "Количество · "; }
}
@media(prefers-reduced-motion:no-preference) {
  button { transition: background-color .13s, border-color .13s; }
}
