:root {
  --purple: #6850a4;
  --ink: #293248;
  --mint: #8fd3b3;
  --paper: #f4f1f8;
  --muted: #617087;
  --line: #e6e1ed;
  --surface: #fcfcfa;
  --soft: #e9e3f3;
  --danger: #ab424d;
  --green: #287151;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
.nav a.has-problems { color: var(--danger); }
.problem-count { margin-left: auto; }
.problem-count[hidden] { display: none; }
.problem-materials { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 12px 0; }
.problem-close { margin-top: 22px; }
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
summary {
  touch-action: manipulation;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button,
input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
}
button {
  padding: 10px 15px;
  font-weight: 600;
  min-height: 42px;
}
button:hover:not(:disabled) {
  border-color: #b7a8d1;
  background: #f4f0f9;
}
button.primary {
  color: white;
  background: var(--purple);
  border-color: var(--purple);
}
button.primary:hover:not(:disabled) {
  background: #58418f;
}
.danger {
  color: var(--danger);
}
button.quiet {
  background: transparent;
  border-color: transparent;
  color: var(--purple);
}
a {
  color: var(--purple);
  text-decoration: none;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #baa7dc;
  outline-offset: 3px;
}
input,
select,
textarea {
  padding: 10px 12px;
  min-height: 42px;
  max-width: 100%;
}
textarea {
  resize: vertical;
  min-height: 90px;
}
input[type="checkbox"] {
  min-height: 18px;
  width: 18px;
  height: 18px;
  accent-color: var(--purple);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -1px;
}
h2 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.4px;
}
h3 {
  font-size: 15px;
  font-weight: 600;
}
.muted,
.note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.note {
  margin: 12px 0;
}
.startup {
  margin: 20vh auto;
  text-align: center;
  color: var(--muted);
}
.layout {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #f9f7fb;
  border-right: 1px solid var(--line);
  padding: 30px 18px 20px;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 0 8px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.brand img {
  width: 42px;
  height: 42px;
}
.brand small {
  display: block;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 1.7px;
  color: var(--muted);
  margin-top: 5px;
}
.nav {
  margin-top: 42px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  padding: 13px 14px;
  border-radius: 12px;
  white-space: nowrap;
}
.nav a:hover {
  background: #f0ebf6;
}
.nav a.active {
  background: var(--soft);
  color: var(--purple);
  font-weight: 600;
}
.nav svg {
  width: 19px;
  height: 19px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.session {
  margin-top: auto;
  padding: 20px 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.session .role {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.session button {
  margin-top: 10px;
  padding-left: 0;
  min-height: 32px;
}
.main {
  padding: 38px 38px 24px;
  max-width: 1750px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.demo-label {
  margin-top: 10px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 8px;
}
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.device-header-actions {
  align-items: flex-end;
}
.device-header-actions select,
.device-header-actions > button {
  height: 44px;
}
.admin-recovery-actions {
  margin-bottom: 18px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
}
.filters {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 19px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  margin-bottom: 18px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.field > span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.filters .field {
  flex: 0 1 auto;
}
.filters .field.search {
  flex: 1 1 170px;
}
.filters .field.search input {
  width: 100%;
}
.filters select {
  max-width: 210px;
}
.filters .account-field {
  flex: 0 1 360px;
  max-width: 100%;
}
.filters .account-field select {
  width: 100%;
  max-width: none;
}
.device-name,
.dialog-head h2,
.details-grid dd,
.choices label {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
td:has(.device-name) {
  min-width: 210px;
  max-width: 360px;
}
.dialog-head h2 { flex: 1; }
.dialog-head > button { flex: 0 0 auto; }
.link-button { white-space: normal; overflow-wrap: anywhere; }
.episode-list { margin: 22px 0; }
.episode-list h3 { margin-bottom: 10px; }
.recovery-preview-dialog { width: 940px; max-width: calc(100vw - 32px); }
.filters input[type="date"] {
  width: 153px;
}
.filters .extra {
  align-self: center;
  max-width: 100%;
}
.extra summary {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  padding: 12px 0;
}
.extra[open] {
  flex-basis: 100%;
}
.extra .extra-content {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 7px;
}
.account-menu {
  position: relative;
  align-self: flex-end;
}
.account-menu summary {
  list-style: none;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
  font-size: 14px;
  min-width: 155px;
}
.account-menu .choices {
  position: absolute;
  top: 46px;
  left: 0;
  z-index: 3;
  min-width: 240px;
  max-height: 320px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 25px #29324812;
  padding: 10px;
}
.choices label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  font-size: 13px;
}
.totals-line {
  display: flex;
  flex-wrap: wrap;
  gap: 25px;
  align-items: center;
  padding: 17px 21px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.totals-line strong {
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
}
.period-summary {
  margin-bottom: 18px;
}
.coverage-line, .devices-total {
  border-bottom: 0;
}
.devices-total {
  border-top: 1px solid var(--line);
}
.exclusion-note {
  max-width: 280px;
  white-space: normal;
}
@media (min-width: 761px) {
  .operations-panel td:first-child {
    min-width: 180px;
    max-width: 280px;
  }
}
.table-scroll {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  font-size: 13px;
}
th,
td {
  padding: 17px 20px;
  border-bottom: 1px solid #eeeaf2;
  vertical-align: middle;
}
th {
  background: #faf8fc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: #f9f7fc;
}
td .sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}
td.counterparty {
  min-width: 180px;
  max-width: 360px;
  overflow-wrap: anywhere;
}
.nowrap {
  white-space: nowrap;
}
.number {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}
.positive {
  color: var(--green);
}
.negative {
  color: var(--ink);
}
.link-button {
  border: 0;
  background: none;
  border-radius: 5px;
  padding: 2px 0;
  min-height: 28px;
  color: var(--purple);
  font-weight: 500;
  text-align: left;
}
.link-button.network-alert {
  color: var(--danger);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 10px;
  line-height: 1.3;
  white-space: nowrap;
  background: #eeeaf4;
  color: #6b607e;
}
.badge.good {
  background: #e7f4ec;
  color: #346e50;
}
.badge.warn {
  background: #fcf0dc;
  color: #8c661f;
}
.badge.error {
  background: #f9e9eb;
  color: #a54850;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.pager button {
  padding: 5px 12px;
  min-height: 34px;
  font-size: 12px;
}
.empty {
  padding: 65px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.empty p {
  margin-bottom: 15px;
}
.error-box {
  padding: 22px;
  border: 1px solid #e5bec4;
  background: #fff6f7;
  border-radius: 14px;
  color: var(--danger);
  margin-bottom: 18px;
}
.error-box button {
  margin-left: 15px;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 29px 0 13px;
}
.history-time-pending { margin-top: 20px; }
.history-time-pending .section-title {
  margin: 0;
  padding: 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--line);
  padding: 22px 8px;
}
.summary-grid > div {
  padding: 0 15px;
  border-right: 1px solid var(--line);
}
.summary-grid > div:last-child {
  border: 0;
}
.summary-grid span {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-bottom: 9px;
}
.summary-grid strong {
  font-size: 20px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.metric-detail {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.footnote {
  font-size: 11px;
  color: var(--muted);
  margin: 16px 3px;
}
.health {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 20px;
  flex-wrap: wrap;
  font-size: 13px;
}
.health span {
  display: flex;
  align-items: center;
  gap: 9px;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 22px;
  max-width: min(680px, calc(100vw - 32px));
  width: 620px;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 20px 100px #29324828;
  max-height: 90svh;
}
dialog::backdrop {
  background: #2932484a;
  backdrop-filter: blur(3px);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 25px 16px;
  gap: 20px;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
  border-bottom: 1px solid var(--line);
}
.dialog-head button {
  font-size: 21px;
  min-height: 32px;
  padding: 1px 9px;
}
.dialog-body {
  padding: 24px 25px;
}
.dialog-body .field {
  margin-bottom: 17px;
}
.dialog-body .actions {
  margin-top: 20px;
}
.adjustments-dialog {
  width: 1180px;
  max-width: calc(100vw - 32px);
}
.adjustments-filters {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) repeat(2, minmax(145px, 180px)) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
}
.adjustments-dialog .adjustments-filters .field {
  margin-bottom: 0;
}
.adjustments-dialog .account-menu .choices {
  position: static;
  min-width: 0;
  max-height: 240px;
  margin-top: 8px;
}
.adjustments-dialog .choices label {
  align-items: flex-start;
  overflow-wrap: anywhere;
}
.adjustments-dialog .choices small,
.adjustment-locked-account small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}
.adjustment-locked-account {
  overflow-wrap: anywhere;
}
.adjustments-message {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}
.adjustments-table {
  border: 1px solid var(--line);
  border-radius: 14px;
}
.adjustments-table th,
.adjustments-table td {
  padding: 12px;
}
.adjustments-table td {
  font-size: 12px;
  overflow-wrap: anywhere;
}
.adjustment-at {
  min-width: 172px;
}
.adjustment-device {
  min-width: 130px;
}
.adjustment-reason-preview {
  min-width: 140px;
  max-width: 270px;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.adjustment-full-reason {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.adjustment-statuses,
.adjustment-page-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
@media (max-width: 380px) {
  .adjustments-dialog .adjustments-filters {
    grid-template-columns: minmax(0, 1fr);
  }
}
.adjustments-dialog .pager {
  padding: 16px 0 0;
  border-top: 0;
}
@media (max-width: 760px) {
  .adjustments-dialog .dialog-body {
    padding: 16px;
  }
  .adjustments-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .adjustments-filters .account-menu,
  .adjustments-filters .adjustment-locked-account,
  .adjustments-filters > button {
    grid-column: 1 / -1;
  }
  .adjustments-filters input {
    width: 100%;
    min-width: 0;
  }
  .adjustments-table,
  .adjustments-table table,
  .adjustments-table tbody {
    display: block;
  }
  .adjustments-table thead {
    display: none;
  }
  .adjustments-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
  }
  .adjustments-table td {
    padding: 0;
    border: 0;
    min-width: 0;
  }
  .adjustments-table td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 5px;
  }
  .adjustments-table .adjustment-at,
  .adjustments-table .adjustment-reason,
  .adjustments-table .adjustment-author,
  .adjustments-table .adjustment-state,
  .adjustments-table .adjustment-open {
    grid-column: 1 / -1;
  }
  .adjustments-table .adjustment-open {
    justify-self: end;
  }
  .adjustment-reason-preview {
    min-width: 0;
    max-width: none;
  }
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 15px;
}
.form-error {
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
  margin: 10px 0;
}
.details-grid {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 13px;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.details-grid dt {
  color: var(--muted);
}
.details-grid dd {
  margin: 0;
}
.raw {
  white-space: pre-wrap;
  word-break: break-word;
  font:
    12px/1.6 ui-monospace,
    monospace;
  background: #f5f2f8;
  padding: 16px;
  border-radius: 12px;
  max-height: 300px;
  overflow: auto;
}
.code {
  font:
    600 36px ui-monospace,
    monospace;
  letter-spacing: 8px;
  color: var(--purple);
  padding: 20px 0;
  text-align: center;
}
.login {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 25px;
}
.login-card {
  width: 100%;
  max-width: 390px;
  padding: 36px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
}
.login-card img {
  width: 64px;
  height: 64px;
  margin-bottom: 24px;
}
.login-card h1 {
  font-size: 26px;
  margin-bottom: 8px;
}
.login-card form {
  margin-top: 28px;
}
.login-card .field {
  margin-bottom: 18px;
}
.login-card button {
  width: 100%;
  margin-top: 4px;
}
.login-card .muted {
  font-size: 12px;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 22px;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  box-shadow: 0 8px 20px #29324825;
  z-index: 20;
  display: none;
  max-width: calc(100vw - 30px);
}
#toast.visible {
  display: block;
}
.loading {
  opacity: 0.5;
  pointer-events: none;
}
.review-note {
  color: #8c661f;
  font-size: 12px;
  padding: 12px 20px;
  background: #fcf6e9;
}
.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}
.text-break {
  word-break: break-word;
}
.wide {
  min-width: 650px;
}
@media (min-width: 1600px) {
  .main {
    padding: 42px 50px;
  }
  .nav {
    margin-top: 50px;
  }
}
@media (max-width: 1150px) {
  .layout {
    grid-template-columns: 198px minmax(0, 1fr);
  }
  .sidebar {
    padding: 26px 12px;
  }
  .brand {
    font-size: 14px;
  }
  .main {
    padding: 30px 22px;
  }
  .summary-grid {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 23px;
  }
  .summary-grid > div:nth-child(3) {
    border: 0;
  }
  th,
  td {
    padding: 15px 16px;
  }
}
@media (max-width: 760px) {
  .layout {
    display: block;
  }
  .sidebar {
    position: static;
    height: auto;
    padding: 17px 18px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand {
    padding: 0;
    font-size: 16px;
  }
  .brand img {
    width: 36px;
    height: 36px;
  }
  .brand small {
    font-size: 8px;
    margin-top: 4px;
  }
  .nav {
    margin-top: 18px;
    flex-direction: row;
    overflow: auto;
    gap: 4px;
    padding-bottom: 10px;
  }
  .nav a {
    font-size: 12px;
    padding: 10px 12px;
  }
  .nav svg {
    width: 16px;
    height: 16px;
  }
  .session {
    position: absolute;
    right: 18px;
    top: 19px;
    margin: 0;
    border: 0;
    padding: 0;
    text-align: right;
  }
  .session .role {
    display: none;
  }
  .session button {
    margin: 0;
    padding: 0;
    min-height: 25px;
    font-size: 11px;
  }
  .main {
    padding: 25px 16px;
  }
  .page-head {
    margin-bottom: 20px;
    gap: 10px;
  }
  .page-head h1 {
    font-size: 26px;
  }
  .eyebrow {
    font-size: 9px;
  }
  .page-head .actions button {
    font-size: 12px;
    padding: 9px 11px;
  }
  .devices-head {
    flex-wrap: wrap;
  }
  .devices-head .device-header-actions {
    width: 100%;
  }
  .filters {
    padding: 15px;
    gap: 12px;
    border-radius: 14px;
  }
  .filters .field {
    flex: 1 1 120px;
  }
  .filters select,
  .filters input {
    width: 100%;
    max-width: none;
  }
  .filters .account-menu {
    flex: 1 1 100%;
  }
  .filters .primary {
    flex: 1 1 100%;
  }
  .filters .field.search {
    flex-basis: 100%;
  }
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 20px 4px;
    row-gap: 25px;
  }
  .summary-grid > div:nth-child(3) {
    border-right: 1px solid var(--line);
  }
  .summary-grid > div:nth-child(2n) {
    border: 0;
  }
  .summary-grid strong {
    font-size: 18px;
  }
  .totals-line {
    gap: 13px 18px;
    padding: 15px;
  }
  .totals-line strong {
    font-size: 13px;
  }
  .panel {
    border-radius: 15px;
  }
  .pager {
    padding: 12px;
    font-size: 11px;
    flex-wrap: wrap;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .dialog-body {
    padding: 20px;
  }
  .dialog-head {
    padding: 18px 20px;
  }
  .details-grid {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .details-grid dd {
    margin-bottom: 12px;
  }
  .health {
    gap: 15px;
    font-size: 12px;
  }
  .login-card {
    padding: 29px;
  }
  .table-scroll {
    scrollbar-width: thin;
  }
}
@media (max-width: 760px) {
  .nav {
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar {
    display: none;
  }
  .filters > .field:first-child {
    flex-basis: 100%;
  }
  .operations-panel .table-scroll {
    overflow: visible;
  }
  .operations-panel table,
  .operations-panel tbody {
    display: block;
  }
  .operations-panel thead {
    display: none;
  }
  .operations-panel tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "device amount" "time direction" "before before" "balance balance" "party party" "accounting accounting" "status details";
    gap: 10px 14px;
    padding: 18px;
    border-bottom: 1px solid var(--line);
  }
  .operations-panel tbody tr:last-child {
    border-bottom: 0;
  }
  .operations-panel td {
    border: 0;
    padding: 0;
    font-size: 12px;
  }
  .operations-panel td:nth-child(1) {
    grid-area: device;
    font-weight: 600;
  }
  .operations-panel td:nth-child(2) {
    grid-area: time;
    color: var(--muted);
    font-size: 11px;
  }
  .operations-panel td:nth-child(3) {
    grid-area: direction;
    text-align: right;
  }
  .operations-panel td:nth-child(4) {
    grid-area: before;
    text-align: right;
  }
  .operations-panel td.operation-balance-before::before {
    content: "Остаток до: ";
    color: var(--muted);
    font-size: 11px;
  }
  .operations-panel td:nth-child(5) {
    grid-area: amount;
    font-size: 16px;
    font-weight: 600;
  }
  .operations-panel td:nth-child(6) {
    grid-area: balance;
    text-align: right;
  }
  .operations-panel td.operation-balance::before {
    content: "Остаток после: ";
    color: var(--muted);
    font-size: 11px;
  }
  .operations-panel td:nth-child(7) {
    grid-area: party;
    min-width: 0;
    max-width: none;
    line-height: 1.5;
  }
  .operations-panel td:nth-child(8) {
    grid-area: accounting;
  }
  .operations-panel td:nth-child(9) {
    grid-area: status;
  }
  .operations-panel td:nth-child(10) {
    grid-area: details;
    text-align: right;
  }
}
.diagnostic-image {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  margin: 1rem auto;
  border-radius: 12px;
  object-fit: contain;
}
/* Confirmation evidence and reversible accounting decisions. */
.confirmation-review-dialog { width: min(1400px, 96vw); max-width: 96vw; }
.confirmation-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr)); gap:18px; align-items:start; }
.confirmation-card { border:1px solid var(--line,#e7e0f1); border-radius:14px; padding:18px; min-width:0; }
.confirmation-title { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.confirmation-card dl { display:grid; grid-template-columns:120px 1fr; gap:10px; }
.confirmation-card dd { margin:0; overflow-wrap:anywhere; }
.confirmation-evidence { margin:16px 0; text-align:center; }
.confirmation-image { display:block; max-width:100%; max-height:520px; margin:auto; object-fit:contain; border-radius:8px; }
.confirmation-card .actions { flex-wrap:wrap; }
.confirmation-card pre { white-space:pre-wrap; overflow-wrap:anywhere; max-height:220px; overflow:auto; }
.confirmation-history { margin-top:22px; }
.confirmation-target { overflow-wrap:anywhere; }
.confirmation-warning {border:2px solid #aa391c;border-left-width:8px;border-radius:12px;background:#fff1e5;color:#682410;padding:18px;margin:0 0 20px;line-height:1.5;overflow-wrap:anywhere;}
.confirmation-warning strong {display:block;font-size:18px;line-height:1.35;}
.confirmation-warning p {margin:10px 0 0;}
.confirmation-warning button {margin-top:12px;border-color:#aa391c;color:#682410;background:#fff;}
.confirmation-ack {display:flex;align-items:flex-start;gap:12px;padding:14px;border:2px solid #aa391c;border-radius:10px;margin:16px 0;font-weight:600;line-height:1.5;}
.confirmation-ack input[type="checkbox"] {width:22px;height:22px;min-height:22px;flex:0 0 22px;margin-top:2px;accent-color:#aa391c;}
/* Compact diagnostic summaries; historical open cases remain explicit. */
.problem-card { padding:14px 20px; border-bottom:1px solid var(--line); display:grid; grid-template-columns:minmax(130px,1fr) minmax(240px,2fr) minmax(210px,1.3fr) auto; grid-template-areas:"device summary counters action" "device meta counters action"; gap:5px 20px; align-items:center; }
.problem-card:last-child { border-bottom:0; }
.problem-card .problem-card-title { display:contents; }
.problem-card-title > div { grid-area:device; }
.problem-card-title > button { grid-area:action; }
.problem-card > .problem-card-summary { grid-area:summary; margin:0; gap:7px; }
.problem-card > .problem-counters { grid-area:counters; margin:0; gap:5px; }
.problem-card > .problem-case-time { grid-area:meta; }
.problem-card-title,.problem-card-summary,.episode-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.problem-card-summary { margin:12px 0; justify-content:flex-start; flex-wrap:wrap; }
.problem-counters { display:flex; flex-wrap:wrap; gap:8px; margin:14px 0; }
.problem-counter { border:1px solid var(--line); background:transparent; color:var(--muted); padding:4px 8px; min-height:0; line-height:1.3; border-radius:9px; font-size:12px; }
.problem-counter.has-open { color:#a83248; background:#fff6f7; border-color:#efcdd4; }
.problem-details { min-width:0; }
.problem-scopes { display:flex; flex-wrap:wrap; gap:8px; margin:0 0 16px; }
.problem-scopes .selected { color:var(--purple,#66509b); border-color:var(--purple,#66509b); background:#eee7f7; }
.problem-description { margin:10px 0; }
.problem-primary-actions { margin:14px 0; }
.episode-group,.problem-technical { border-top:1px solid var(--line); padding:14px 0; }
.episode-group summary { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.episode-group summary::before { content:"▸"; }
.episode-group[open] summary::before { content:"▾"; }
.episode-group summary > span:first-child { flex:1; }
.episode-content { margin-top:12px; }
.episode-card { padding:14px 0; border-top:1px solid var(--line); }
.episode-card .actions { margin-top:8px; flex-wrap:wrap; }
.episode-heading { margin-bottom:6px; flex-wrap:wrap; }
.problem-technical .details-grid { margin-top:16px; }
@media(max-width:1000px) {
  .problem-card { display:block; padding:16px; }
  .problem-card .problem-card-title { display:flex; }
  .problem-card > .problem-card-summary { margin:10px 0; }
  .problem-card > .problem-counters { margin:10px 0; }
}
@media(max-width:600px) {
  .problem-card-title { align-items:flex-start; }
  .problem-card-title > div { min-width:0; overflow-wrap:anywhere; }
  .problem-card-summary { align-items:flex-start; }
  .problem-counters { gap:7px; }
  .problem-counter { text-align:left; }
  .episode-group summary { flex-wrap:wrap; }
  .episode-group summary > span:first-child { flex-basis:65%; }
  .episode-group summary .badge { margin-left:18px; }
}

/* The combined helper name fits the established compact sidebar. */
.brand > span {font-size:14px;}

.reading-controls {margin-bottom:24px;padding-bottom:20px;border-bottom:1px solid var(--line);}
.reading-controls h3 {margin-bottom:8px;}
.reading-controls table {table-layout:fixed;width:100%;}
.reading-controls td,.reading-controls th {padding:12px 8px;white-space:normal;overflow-wrap:anywhere;}
.reading-controls input[type="checkbox"] {width:18px;height:18px;accent-color:var(--purple,#66509b);vertical-align:middle;}
.reading-controls td:first-child {width:28%;}
.reading-controls .muted {margin-bottom:12px;}
@media(max-width:600px){
 .reading-controls th {font-size:10px;}
 .reading-controls td {font-size:12px;}
 .reading-controls label {display:flex;align-items:center;gap:4px;}
 .reading-controls input[type="checkbox"] {flex-shrink:0;}
}
/* Independent screenshot evidence never replaces the financial ledger. */
.control-image { max-width: 100%; max-height: 55vh; object-fit: contain; }
.control-evidence { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 1rem; }
.control-evidence pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.control-read-trace pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.initial-balance-scopes {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:12px 0 20px;}
.initial-balance-scope {border:1px solid var(--line);border-radius:10px;padding:10px;overflow-wrap:anywhere;font-size:13px;}
.initial-balance-scope strong {display:block;margin-bottom:6px;}
.initial-balance-scope.selected {border-color:var(--purple,#66509b);background:#f3edf9;}
.dialog-body .field[hidden] {display:none;}
.service-reading-help {margin:18px 0;line-height:1.5;}
.service-reading-help summary {cursor:pointer;color:var(--purple,#66509b);}
.service-reading-help p {margin:10px 0;}
@media(max-width:480px){.initial-balance-scopes{grid-template-columns:1fr;}}
