@font-face {
  font-family: Golos;
  src: url('./fonts/golos-cyr.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Golos;
  src: url('./fonts/golos-latin.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212;
}
:root {
  font-family: Golos, 'Segoe UI', Arial, sans-serif;
  background: #f6f5f1;
  color: #272925;
  font-size: 15px;
  --ink: #292b28;
  --action: #a33d22;
  --line: #dcdcd5;
  --muted: #5f625a;
  --accent: #c95532;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a.button {
  cursor: pointer;
  border: 1px solid #c9cac2;
  background: white;
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 7px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
button:hover,
a.button:hover {
  background: #eeeee8;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #a9472b;
  outline-offset: 2px;
}
button.primary {
  background: var(--action);
  color: white;
  border-color: var(--action);
}
button.primary:hover {
  background: #86341f;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(26px, 2.6vw, 36px);
  letter-spacing: -0.045em;
  line-height: 1.12;
}
h2 {
  font-size: 21px;
  letter-spacing: -0.025em;
}
h3 {
  font-size: 16px;
}
.muted,
small {
  color: var(--muted);
}
.muted {
  line-height: 1.55;
}
.layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 100vh;
}
aside {
  display: flex;
  flex-direction: column;
  background: #eeeee8;
  border-right: 1px solid var(--line);
  color: var(--ink);
  padding: 30px 17px;
  gap: 15px;
}
.brand {
  font-size: 29px;
  font-weight: 700;
  letter-spacing: -0.06em;
}
.brand b { color: var(--accent); }
.brand { display: block; line-height: 1.1; }
.side-title {
  font-size: 12px;
  color: #64675f;
  margin: 0 0 23px 3px;
}
nav {
  display: grid;
  gap: 5px;
}
nav button,
.signout {
  background: transparent;
  text-align: left;
  color: #353730;
  border: 0;
}
nav button:hover,
.signout:hover {
  background: #e5e5de;
}
nav button[aria-current='page'] {
  background: #e9e4da;
  color: var(--ink);
  box-shadow: inset 3px 0 var(--accent);
}
.account {
  margin-top: auto;
  display: grid;
  gap: 5px;
  border-top: 1px solid #d6d7ce;
  padding: 17px 4px 0;
}
.account span {
  font-size: 12px;
  color: #64675f;
}
.signout {
  padding: 8px 0;
  font-size: 13px;
}
main {
  min-width: 0;
}
header {
  background: #fff;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(18px, 4vw, 62px);
  border-bottom: 1px solid var(--line);
}
.context,
.client-picker {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #777b71;
}
input,
select,
textarea {
  background: #fff;
  color: var(--ink);
  border: 1px solid #a9ada2;
  border-radius: 6px;
  min-height: 41px;
  padding: 8px 10px;
  width: 100%;
}
select {
  max-width: 100%;
}
.client-picker select {
  max-width: 245px;
  min-width: 130px;
}
#view {
  margin: 0 auto;
  max-width: 1500px;
  padding: clamp(22px, 3.5vw, 54px);
}
.title-row,
.tools,
.dialog-head,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.title-row {
  margin-bottom: 25px;
}
.actions,
.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.metric,
.panel,
.auth-card,
dialog {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.metric {
  padding: 19px 20px;
}
.metric:first-child {
  background: #f2efe6;
  border-color: #d9d5c9;
}
.metric span {
  display: block;
  color: #585c52;
  font-size: 13px;
}
.metric strong {
  display: block;
  margin: 12px 0 0;
  font-size: 31px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.05em;
}
.panel {
  margin-bottom: 17px;
  overflow: hidden;
}
.panel.pad,
.tools,
.section-head {
  padding: 19px;
}
.section-head,
.tools {
  border-bottom: 1px solid var(--line);
}
.tools input {
  max-width: 330px;
}
.table-scroll {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
td,
th {
  text-align: left;
  border-bottom: 1px solid #e6e7df;
  padding: 12px 15px;
  vertical-align: middle;
}
th {
  font-size: 12px;
  color: var(--muted);
  background: #f7f7f2;
  font-weight: 600;
}
tbody tr:last-child td {
  border-bottom: 0;
}
td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.mono {
  font-family: 'Cascadia Mono', Consolas, monospace;
  font-size: 13px;
}
.empty {
  padding: 30px 20px;
  color: var(--muted);
  line-height: 1.5;
}
.more {
  margin: 12px;
}
.tag {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 6px;
  background: #eeeee7;
  color: #40463c;
  font-size: 12px;
  font-weight: 650;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.stack {
  display: grid;
  gap: 14px;
}
.stack label,
.grid label,
label.field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.wide {
  grid-column: 1/-1;
}
.operation {
  max-width: 1020px;
}
.scan input {
  font-size: 18px;
}
.scan {
  display: flex;
  gap: 8px;
  align-items: center;
}
.qty {
  width: 88px;
}
.footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 16px 0;
}
dialog {
  width: min(630px, calc(100% - 28px));
  padding: 22px;
  color: var(--ink);
  max-height: 90vh;
  overflow-y: auto;
}
dialog::backdrop {
  background: #292b286b;
}
.dialog-head {
  margin-bottom: 16px;
}
.dialog-head button {
  font-size: 22px;
  padding: 2px 9px;
}
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #f1f0e9;
}
.auth-card {
  width: min(405px, 100%);
  padding: 32px;
}
.auth-card h1 {
  font-size: 32px;
  margin: 28px 0 22px;
}
.auth-card form,
.auth-card label {
  display: grid;
  gap: 8px;
}
.auth-card form {
  gap: 16px;
}
.auth-card p {
  margin-top: 16px;
  font-size: 13px;
}
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 5;
  max-width: min(500px, calc(100vw - 40px));
  border-radius: 8px;
  padding: 13px 18px;
  background: var(--ink);
  color: white;
  box-shadow: 0 5px 25px #0002;
}
.toast.error {
  background: #852e24;
}
.inline-error {
  color: #932e20;
  line-height: 1.4;
}
.link-btn {
  border: 0;
  padding: 3px 0;
  background: transparent;
  color: var(--action);
  text-decoration: underline;
}
@media (max-width: 860px) {
  .layout {
    grid-template-columns: 182px minmax(0, 1fr);
  }
  aside {
    padding: 22px 10px;
  }
  .metric {
    padding: 13px;
  }
  .metrics {
    gap: 8px;
  }
  #view {
    padding: 20px;
  }
}
@media (max-width: 660px) {
  .layout {
    display: block;
  }
  aside {
    padding: 12px 15px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
  }
  .brand {
    font-size: 22px;
  }
  .side-title,
  .account span,
  .account strong {
    display: none;
  }
  nav {
    display: flex;
    grid-column: 1/-1;
    grid-row: 2;
    overflow: auto;
  }
  nav button {
    font-size: 13px;
    padding: 8px 10px;
  }
  .account {
    margin: 0;
    padding: 0;
    border: 0;
  }
  .signout {
    padding: 2px 7px;
  }
  header {
    min-height: 50px;
    padding: 8px 15px;
  }
  .context {
    font-size: 12px;
  }
  .client-picker {
    max-width: 60%;
  }
  .client-picker select {
    min-width: 80px;
  }
  #view {
    padding: 17px 12px;
  }
  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .title-row {
    margin-bottom: 15px;
  }
  .tools,
  .section-head,
  .panel.pad {
    padding: 13px;
  }
  td,
  th {
    padding: 10px;
  }
  .actions button,
  .actions .button {
    font-size: 13px;
  }
  .auth-card {
    padding: 22px;
  }
}

#document-discussion { border-top: 1px solid #d8d9cf; padding-top: 12px; }
#document-discussion .section-head { padding: 4px 0 12px; flex-wrap: wrap; }
.comment-list article { padding: 10px 0; border-bottom: 1px solid #e3e4dc; overflow-wrap: anywhere; }
.comment-list article strong { font-size: .85rem; }
.comment-list article p { white-space: pre-wrap; margin: 6px 0; }
.comment-list img, .attachment img { display: block; max-width: 100%; max-height: 150px; border-radius: 6px; margin: 6px 0; }
.comment-form { margin-top: 14px; }
.comment-form textarea { display: block; width: 100%; box-sizing: border-box; resize: vertical; padding: 9px; font: inherit; }
.late-task { color:#96351f; font-weight:700; }
tbody tr:hover { background: #fafaf6; }
nav button { white-space: normal; }
.auth-card { border-top: 3px solid var(--action); }
@media (max-width: 660px) {
  nav { min-width: 0; }
  nav button { white-space: nowrap; min-height: 44px; }
  .table-scroll { overscroll-behavior-x: contain; }
}
#task-form textarea { width:100%; box-sizing:border-box; font:inherit; padding:8px; resize:vertical; }
