:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17211c;
  --muted: #68746d;
  --line: #d5dce3;
  --accent: #2f6fb3;
  --side: #17375e;
  --side-hover: #245487;
  --ok: #157347;
  --warn: #b7791f;
  --danger: #b42318;
  --info: #2f6fb3;
  --soft: #eef4f0;
  --shadow-sm: 0 8px 20px rgba(23, 33, 28, .07);
  --shadow-md: 0 14px 34px rgba(23, 33, 28, .1);
}

* { box-sizing: border-box; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}
button, input, select, textarea { max-width: 100%; font: inherit; }
button { cursor: pointer; overflow-wrap: anywhere; }
a { color: var(--accent); }
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(245, 247, 243, .94);
}
.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 70px rgba(23,33,28,.16);
}
.login-panel p { color: var(--muted); }
.login-error {
  min-height: 18px;
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.25;
}
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
}
.app, .main, .view, .top, .top-actions, .registry-toolbar, .toolbar-group, .filters, .facts, .metrics, .settings, .settings-grid, .list-item {
  min-width: 0;
}
h1, h2, h3, p, label, button, .nav, .toolbar-button, .table-action, .metric, .fact, .setting, .card-field {
  overflow-wrap: anywhere;
}
.app.sidebar-collapsed { grid-template-columns: 56px minmax(0, 1fr); }
.side {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 10px;
  background: var(--side);
  color: #fff;
}
.logo-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 6px;
  background: #fff;
  color: var(--side);
  padding: 0;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,.18);
}
.logo-toggle:hover { background: #dbeafe; }
.sidebar-icon {
  position: absolute;
  inset: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  object-fit: contain;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}
.logo-toggle.has-sidebar-icons .doc-mark,
.logo-toggle.has-sidebar-icons .collapse-mark {
  display: none;
}
.logo-toggle.has-sidebar-icons .sidebar-logo-icon {
  opacity: 1;
}
.logo-toggle.has-sidebar-icons:hover .sidebar-logo-icon,
.app.sidebar-collapsed .logo-toggle.has-sidebar-icons .sidebar-logo-icon {
  opacity: 0;
  transform: translateX(-4px);
}
.logo-toggle.has-sidebar-icons:hover .sidebar-collapse-icon {
  opacity: 1;
  transform: translateX(0);
}
.app.sidebar-collapsed .logo-toggle.has-sidebar-icons .sidebar-collapse-icon {
  opacity: 0;
}
.app.sidebar-collapsed .logo-toggle.has-sidebar-icons .sidebar-expand-icon {
  opacity: 1;
  transform: translateX(0);
}
.doc-mark,
.collapse-mark {
  position: absolute;
  inset: 0;
  transition: opacity .18s ease, transform .18s ease;
}
.doc-mark {
  opacity: 1;
  background:
    linear-gradient(var(--accent), var(--accent)) 10px 13px / 20px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) 10px 23px / 16px 2px no-repeat;
}
.collapse-mark {
  opacity: 0;
  transform: translateX(6px);
}
.collapse-mark::before {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  left: 50%;
  top: 50%;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: translate(-35%, -50%) rotate(45deg);
}
.logo-toggle:hover .doc-mark,
.app.sidebar-collapsed .logo-toggle .doc-mark {
  opacity: 0;
  transform: translateX(-6px);
}
.logo-toggle:hover .collapse-mark,
.app.sidebar-collapsed .logo-toggle .collapse-mark {
  opacity: 1;
  transform: translateX(0);
}
.app.sidebar-collapsed .collapse-mark::before {
  transform: translate(-65%, -50%) rotate(225deg);
}
.app.sidebar-collapsed .side {
  align-items: center;
  padding: 12px 7px;
}
.app.sidebar-collapsed .nav,
.app.sidebar-collapsed .nav-spacer,
.app.sidebar-collapsed .storage {
  display: none;
}
.app.sidebar-collapsed .brand {
  margin: 0;
}
.app.sidebar-collapsed .brand div:last-child {
  display: none;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
}
.brand strong {
  display: block;
  font-size: 18px;
  letter-spacing: 0;
  line-height: 1.1;
}
.brand span {
  display: block;
  color: #dbeafe;
  font-size: 12px;
  line-height: 1.25;
  margin-top: 3px;
}
.logo {
  width: 38px;
  height: 44px;
  flex: 0 0 auto;
  border: 2px solid #1d4ed8;
  border-radius: 6px;
  background:
    linear-gradient(#1d4ed8, #1d4ed8) 8px 12px / 20px 2px no-repeat,
    linear-gradient(#1d4ed8, #1d4ed8) 8px 22px / 16px 2px no-repeat,
    #fff;
}
.nav {
  display: flex;
  align-items: center;
  min-height: 38px;
  width: 100%;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  padding: 0 10px;
  background: rgba(255,255,255,.06);
  color: #e7f0ff;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.2;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.nav-spacer { flex: 1; }
.settings-nav { margin-top: auto; }
.nav.active, .nav:hover {
  border-color: rgba(255,255,255,.28);
  background: var(--side-hover);
  color: #fff;
}
.storage {
  margin-top: auto;
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  background: transparent;
  opacity: .78;
}
.storage small { color: rgba(255,255,255,.58); }
.storage b { overflow-wrap: anywhere; font-size: 12px; font-weight: 600; }
.profile-card span { color: rgba(215,230,247,.74); font-size: 11px; }
.profile-card .secondary {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}
.main { min-width: 0; max-width: 100%; overflow-x: hidden; padding: 12px 14px; }
.top {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 18px;
}
.top-actions, .registry-toolbar {
  display: grid;
  width: min(100%, 520px);
  gap: 8px;
  align-items: stretch;
  justify-content: flex-end;
}
.title-actions {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}
.toolbar-group,
.create-actions,
.utility-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.create-actions { justify-content: flex-end; }
.utility-actions { justify-content: flex-end; }
.title-actions .utility-actions { max-width: min(900px, 100%); }
.toolbar-button,
.file-mini span {
  min-height: 38px;
  max-width: 210px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: normal;
  line-height: 1.15;
  font-size: 13px;
  font-weight: 700;
}
input, select, textarea {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  background: #fff;
  color: var(--ink);
}
#search, #powerSearch { max-width: 560px; margin-bottom: 12px; }
.filters #search,
.filters #powerSearch,
.registry-search-row #search {
  max-width: none;
  margin-bottom: 0;
}
.primary, .secondary, .icon {
  min-height: 34px;
  border-radius: 6px;
  padding: 0 14px;
}
.primary { border: 0; background: var(--accent); color: #fff; font-weight: 700; }
.secondary { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.linked-primary {
  min-height: 34px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0 14px;
  background: #fff;
  color: var(--accent);
  font-weight: 700;
}
.linked-primary:hover {
  background: #eff6ff;
}
.icon-toolbar-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  flex: 0 0 34px;
}
.icon-toolbar-button:focus { outline: 0; }
.icon-toolbar-button:focus-visible {
  outline: 2px solid rgba(47, 111, 179, .55);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(47, 111, 179, .12);
}
.file-mini.icon-toolbar-button > span {
  width: 34px;
  height: 34px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}
.toolbar-icon-img {
  width: 15px;
  height: 15px;
  max-width: 15px;
  max-height: 15px;
  display: block;
  object-fit: contain;
}
.toolbar-fallback {
  width: 15px;
  height: 15px;
}
.table-view-button {
  line-height: 1;
  color: #334155;
}
.icon-toolbar-button.active {
  border-color: var(--accent);
  color: var(--accent);
  background: #eff6ff;
}
.icon-toolbar-button.filter-state {
  border-color: var(--accent);
  color: var(--accent);
  background: #eff6ff;
}
.toolbar-button.attention-alert {
  border-color: #e7aaa4;
  background: #fff3f2;
  color: var(--danger);
  font-weight: 800;
}
.toolbar-button.attention-empty {
  border-color: var(--line);
  background: #fff;
  color: #334155;
  font-weight: 700;
  white-space: nowrap;
}
.attention-count {
  margin-left: 3px;
  color: inherit;
  font-weight: 600;
}
.attention-empty .attention-count {
  color: #64748b;
  font-weight: 600;
}
.attention-count.has-attention {
  color: var(--danger);
  font-weight: 900;
}
.icon-toolbar-button,
.icon-row-action {
  overflow: hidden;
}
.filter-button {
  position: relative;
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  flex: 0 0 34px;
}
.filter-icon {
  position: relative;
  display: block;
  width: 15px;
  height: 15px;
}
.filter-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 2px;
  width: 16px;
  height: 10px;
  border: 2px solid var(--accent);
  border-bottom: 0;
  clip-path: polygon(0 0, 100% 0, 62% 100%, 38% 100%);
}
.filter-icon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 11px;
  width: 4px;
  height: 5px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
}
.storage .secondary { color: #fff; background: transparent; border-color: rgba(255,255,255,.25); }
.permissions-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}
.permissions-box legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
}
.user-permissions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin-top: 8px;
  max-width: 100%;
}
.mini-perm {
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  white-space: normal;
  overflow-wrap: anywhere;
}
.locked-metric {
  opacity: .62;
  cursor: not-allowed;
}
.trash-row {
  align-items: flex-start;
}
.icon {
  width: 38px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 22px;
}
.danger-icon { color: var(--danger); }
.view { display: none; max-width: 100%; overflow-x: hidden; }
.view.active { display: block; }
#powers.view.active {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 32px);
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; line-height: 1.2; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.title-row { margin-bottom: 14px; }
.title-actions { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.title-row p, .section-note { margin-top: 6px; color: var(--muted); }
.placeholder-panel {
  min-height: 320px;
  align-content: center;
  justify-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}
.placeholder-panel.active { display: grid; }
.attention-panel {
  margin: 8px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.attention-panel h2 {
  font-size: 13px;
  font-weight: 700;
}
.attention-panel .secondary {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
}
.attention-list {
  display: grid;
  gap: 6px;
}
.attention-reasons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 4px;
}
.attention-reason {
  min-height: 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
}
.attention-reason b { font-size: 11px; font-weight: 700; }
.attention-reason.active {
  border-color: var(--accent);
  background: #eef6ff;
}
.attention-details {
  display: grid;
  gap: 6px;
}
.attention-group {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}
.attention-group-head {
  width: 100%;
  min-height: 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 4px 6px;
  background: #eef3ef;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
}
.attention-group-head.static {
  cursor: default;
}
.attention-group-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 4px;
  padding: 5px;
}
.attention-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}
.attention-item {
  padding: 5px 6px;
  border-radius: 6px;
  box-shadow: none;
  font-size: 11px;
  line-height: 1.2;
}
.attention-item b {
  font-size: 11px;
  font-weight: 600;
}
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}
.registry-search-row {
  display: grid;
  grid-template-columns: minmax(260px, 520px);
  margin: -2px 0 12px;
}
.filter-search {
  grid-column: span 2;
  min-width: min(100%, 300px);
}
.range-filter {
  min-width: 0;
}
.range-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
}
.archive-switch {
  width: auto;
  max-width: 220px;
  min-width: 0;
  justify-self: start;
  justify-content: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  white-space: nowrap;
}
.archive-switch input {
  flex: 0 0 auto;
}
.archive-switch {
  overflow: hidden;
  text-overflow: clip;
}
.power-filters {
  grid-template-columns: minmax(220px, 1.5fr) minmax(130px, .85fr) minmax(130px, .85fr) minmax(110px, .75fr) minmax(230px, 1.15fr) minmax(145px, .8fr) minmax(190px, .95fr);
  gap: 8px;
}
.power-filters .filter-search {
  grid-column: auto;
}
.power-filters .archive-switch {
  width: 100%;
  max-width: none;
  min-height: 34px;
  padding: 7px 8px;
  white-space: normal;
  line-height: 1.15;
  align-content: center;
}
.filters .switch { min-height: 38px; }
.filter-active {
  color: var(--accent);
  font-weight: 700;
}
.filter-active input,
.filter-active select,
.filter-active.archive-switch {
  border-color: #77a7dc;
  background: #f6fbff;
  box-shadow: 0 0 0 2px rgba(47, 111, 179, .08);
}
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.label-title { display: inline-flex; gap: 3px; align-items: baseline; }
.required .label-title {
  color: #2d3a45;
  font-weight: 800;
}
.req-star { color: #7c8a00; font-weight: 900; }
label.optional-required .req-star { display: none; }
.field-error { color: var(--danger); }
.field-error input, .field-error select, .field-error textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(180, 35, 24, .08);
}
.switch {
  min-height: 38px;
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
}
.switch input { width: auto; min-height: auto; }
.column-panel {
  margin: 10px 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(23,33,28,.06);
}
.column-panel .filters {
  margin: 0 0 12px;
}
.dashboard-panel,
.power-dashboard-panel {
  margin: 10px 0 12px;
}
.column-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.column-toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--soft);
  font-size: 12px;
}
.column-toggle input { width: auto; min-height: auto; }
.table-box {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 40px rgba(23,33,28,.08);
}
table { width: max-content; min-width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 6px 7px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
th, td { padding: 5px 7px; }
th {
  position: relative;
  height: 46px;
  min-height: 46px;
  padding-top: 6px;
  padding-bottom: 6px;
  background: #eef3ef;
  color: #4b5650;
  font-size: 11px;
  line-height: 1.15;
  user-select: none;
}
.th-label {
  display: block;
  max-height: 36px;
  overflow: hidden;
  white-space: normal;
  text-overflow: clip;
  overflow-wrap: anywhere;
  word-break: normal;
  padding-right: 8px;
}
.col-resizer,
.power-col-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  z-index: 2;
}
.power-col-resizer {
  right: 0;
  width: 12px;
  transform: translateX(50%);
  z-index: 4;
}
.col-resizer::after,
.power-col-resizer::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 3px;
  border-left: 1px solid #b7c3ba;
}
.power-col-resizer::after {
  top: 6px;
  bottom: 6px;
  left: 5px;
  border-left: 2px solid #8fa198;
}
.power-col-resizer:hover::after {
  border-left-color: var(--accent);
}
body.resizing-column { cursor: col-resize; user-select: none; }
td { font-size: 11px; }
#contracts .table-box,
#powers .table-box {
  max-height: max(280px, calc(100vh - 360px));
  min-height: 280px;
}
#contractsTable {
  border-collapse: separate;
  border-spacing: 0;
}
#powers .table-box {
  flex: 1 1 420px;
  height: auto;
  max-height: none;
  min-height: 420px;
}
#powersTable {
  border-collapse: separate;
  border-spacing: 0;
}
#contractsTable thead th,
#powersTable thead th {
  position: sticky;
  top: 0;
  z-index: 6;
}
#contractsTable [data-column="kind"] {
  white-space: normal;
  line-height: 1.15;
  text-overflow: clip;
}
#contractsTable [data-column="counterparty"] {
  white-space: normal;
  line-height: 1.15;
  text-overflow: clip;
}
#contractsTable td[data-column="kind"] {
  max-height: 34px;
}
#contractsTable td[data-column="counterparty"] {
  max-height: 34px;
}
#contractsTable [data-column="files"] {
  text-align: center;
  padding-left: 3px;
  padding-right: 3px;
}
#powersTable [data-power-column="files"] {
  text-align: center;
  padding-left: 3px;
  padding-right: 3px;
}
#contractsTable th[data-column="files"] .th-label {
  padding-right: 0;
  text-align: center;
  overflow-wrap: break-word;
}
#contractsTable th[data-column="actions"] .th-label {
  padding-right: 0;
  text-align: center;
}
#powersTable th,
#powersTable td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  line-height: 1.2;
  word-break: normal;
}
#powersTable th {
  height: 38px;
  min-height: 38px;
  padding: 4px 5px;
  border-left: 1px solid #c8d2cb;
}
#powersTable th:first-child { border-left: 0; }
#powersTable td {
  height: 28px;
  padding: 3px 5px;
  border-left: 1px solid #eef2ef;
}
#powersTable td:first-child {
  border-left: 0;
}
#powersTable .th-label {
  overflow: hidden;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.1;
  padding-right: 0;
  font-size: 10px;
}
.th-sort {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px;
  align-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}
.th-sort.active {
  color: var(--accent);
  font-weight: 700;
}
.sort-mark {
  color: #748179;
  font-size: 11px;
}
tbody tr:nth-child(odd):not(.inactive-row):not(.archive-row) { background: #fff; }
tbody tr:nth-child(even):not(.inactive-row):not(.archive-row) { background: #f7fbff; }
tbody tr:hover { background: #eef8f4; }
tbody tr.selected,
tbody tr.selected:nth-child(even),
tr.archive-row.selected,
tr.inactive-row.selected {
  opacity: 1;
  background: #d8ebff;
  color: var(--ink);
  box-shadow: inset 4px 0 0 var(--accent);
}
tbody tr.selected td {
  border-top: 1px solid #9bc3ff;
  border-bottom-color: #9bc3ff;
}
tr.inactive-row { background: #f2f4f6; color: #68746d; }
tr.inactive-row:nth-child(even) { background: #eceff2; }
tr.archive-row { opacity: .58; background: #e8eaec; color: #68746d; }
tr.archive-row:nth-child(even) { background: #dde1e5; }
tr.archive-row:hover, tr.inactive-row:hover { opacity: .82; background: #e8f0f7; }
tr.duplicate-row td:first-child { border-left: 4px solid var(--warn); }
.sticky-col {
  position: sticky;
  z-index: 2;
  background: inherit;
  box-shadow: 1px 0 0 var(--line);
}
thead .sticky-col {
  z-index: 10;
  background: #eef3ef;
}
#contractsTable thead th.sticky-head-col {
  position: sticky !important;
  top: 0;
  z-index: 30;
  background: #eef3ef;
  box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line);
}
tbody tr.selected .sticky-col {
  background: #d8ebff;
}
.linked-child-row .tree-doc {
  display: inline-block;
  padding-left: 18px;
  color: #315c85;
  font-weight: 700;
}
.parent-contract-row [data-column="docNumber"] {
  font-weight: 700;
}
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.ok { background: #e8f5ef; color: var(--ok); }
.warn { background: #fff1e8; color: var(--warn); }
.danger { background: #fdecec; color: var(--danger); }
.neutral { background: #edf0f2; color: #59636b; }
.card {
  padding: 20px 16px;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-md);
}
.empty {
  min-height: calc(100vh - 40px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
  color: var(--muted);
}
.docpic {
  width: 88px;
  height: 108px;
  border: 2px solid #cbd5cf;
  border-radius: 8px;
  background:
    linear-gradient(#cbd5cf, #cbd5cf) 16px 24px / 50px 3px no-repeat,
    linear-gradient(#cbd5cf, #cbd5cf) 16px 44px / 40px 3px no-repeat,
    #fff;
}
.card-content { display: grid; gap: 14px; }
.card-head { display: flex; justify-content: space-between; gap: 10px; }
.card-actions { display: flex; gap: 8px; align-items: flex-start; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.card-party {
  color: var(--ink);
  font-weight: 700;
}
.card-inn {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.card-control {
  flex: 0 0 auto;
}
.card-section {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.card-section h3 {
  margin-bottom: 8px;
  font-size: 15px;
  color: #1f3550;
}
.card-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 6px;
}
.card-field {
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}
.card-field span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}
.card-field b {
  overflow-wrap: anywhere;
  white-space: normal;
  font-size: 12px;
  line-height: 1.25;
}
.wide-card-field {
  grid-column: 1 / -1;
}
.fact, .list-item, .metric, .setting {
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.fact span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.fact b { overflow-wrap: anywhere; }
.link-doc {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  text-align: left;
  font-weight: 700;
}
.full { grid-column: 1 / -1; }
.list, .metrics, .settings { display: grid; gap: 10px; margin-top: 14px; }
.metrics { grid-template-columns: repeat(4, minmax(140px, 1fr)); }
.dashboard-panel .metrics {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.dashboard-metric-group {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.dashboard-metric-group h3 {
  margin: 0 0 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid #e4ebef;
  color: #43515b;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 600;
}
.dashboard-metric-list {
  display: grid;
  gap: 4px;
}
.power-metrics { margin: 0 0 12px; grid-template-columns: repeat(6, minmax(130px, 1fr)); }
.home-dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 8px;
  align-items: start;
}
.dashboard-block {
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 100%;
  box-shadow: var(--shadow-sm);
}
.dashboard-block h2 {
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
  color: #1f3550;
  font-size: 12px;
  margin-bottom: 6px;
}
.home-metrics {
  grid-template-columns: 1fr;
  gap: 3px;
  margin-top: 0;
}
.home-metrics .metric {
  min-height: 27px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
}
.home-metrics .metric span {
  font-size: 10.5px;
  line-height: 1.2;
}
.home-metrics .metric b {
  margin-top: 0;
  font-size: 13px;
  font-weight: 600;
}
.metric b { display: block; margin-top: 4px; font-size: 15px; font-weight: 600; }
.metric {
  text-align: left;
  cursor: pointer;
  border-left: 4px solid transparent;
}
.dashboard-panel .metric,
.power-dashboard-panel .metric {
  min-height: 30px;
  padding: 5px 6px;
  border-left-width: 3px;
}
.dashboard-panel .metric span,
.power-dashboard-panel .metric span {
  font-size: 11px;
  line-height: 1.2;
}
.dashboard-panel .metric {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
}
.dashboard-panel .metric b {
  margin-top: 0;
  font-size: 12px;
  font-weight: 600;
}
.metric.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(29, 78, 216, .08);
}
.dashboard-results { margin-top: 14px; }
.tone-ok { border-left-color: var(--ok); }
.tone-warn { border-left-color: var(--warn); }
.tone-danger { border-left-color: var(--danger); }
.tone-info { border-left-color: var(--info); }
.tone-neutral { border-left-color: #8b98a6; }
.tone-ok b { color: var(--ok); }
.tone-warn b { color: var(--warn); }
.tone-danger b { color: var(--danger); }
.tone-info b { color: var(--info); }
.attention-today,
.recent-block,
.quick-actions-block {
  grid-column: span 2;
}
.attention-today-list,
.recent-list,
.quick-actions {
  display: grid;
  gap: 5px;
}
.attention-line {
  min-height: 30px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-sm);
}
.attention-line::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #8b98a6;
}
.attention-line.tone-ok::before { background: var(--ok); }
.attention-line.tone-warn::before { background: var(--warn); }
.attention-line.tone-danger::before { background: var(--danger); }
.attention-line.tone-info::before { background: var(--info); }
.attention-line.tone-neutral-zero {
  color: var(--muted);
  box-shadow: none;
}
.attention-line.tone-neutral-zero::before { background: #c6ced6; }
.attention-line.tone-neutral-zero b { color: #8b98a6; }
.attention-line span {
  color: var(--ink);
  font-size: 11px;
}
.attention-line b {
  font-size: 14px;
  font-weight: 700;
}
.metric b.zero-value,
.attention-line b.zero-value {
  color: #8b98a6;
  font-size: 15px;
  font-weight: 600;
}
.quick-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.quick-action-button img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}
.recent-item {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 7px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.25;
}
.recent-item:last-child { border-bottom: 0; }
.recent-item time {
  color: var(--muted);
  font-size: 10.5px;
}
.empty-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.active-filter-note {
  display: inline-flex;
  width: fit-content;
  margin: 8px 0 12px;
  padding: 6px 10px;
  border: 1px solid #cfe0f1;
  border-radius: 8px;
  background: #f7fbff;
  color: #245487;
  font-size: 13px;
  font-weight: 700;
}
.quick-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grouped-table th {
  text-align: center;
}
.grouped-table .counterparty-main {
  text-align: left;
}
.grouped-table td {
  text-align: center;
}
.grouped-table td:first-child,
.grouped-table td:nth-child(2) {
  text-align: left;
}
.group-head {
  color: var(--ink);
  font-weight: 800;
}
.contracts-group {
  background-color: #eef6ff;
}
.incoming-group {
  background-color: #eef8f2;
}
.outgoing-group {
  background-color: #fff6e8;
}
#counterpartiesTable th,
#counterpartiesTable td {
  height: 24px;
  padding: 3px 6px;
  border-left: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.15;
}
#counterpartiesTable th {
  height: 26px;
  padding-top: 4px;
  padding-bottom: 4px;
}
#counterpartiesTable th:first-child,
#counterpartiesTable td:first-child {
  border-left: 0;
}
#counterpartiesRows tr {
  cursor: pointer;
}
.counterparty-filters {
  margin-bottom: 10px;
}
.mini-line {
  padding: 3px 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.3;
}
.settings { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
.setting-chip {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.setting-chip ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px;
  align-items: start;
  margin-top: 14px;
}
.full-setting { grid-column: 1 / -1; }
.setting {
  min-width: 0;
  align-self: start;
}
.setting ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.list-item {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  border: 1px solid var(--line);
  text-align: left;
}
.table-action {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}
.icon-row-action {
  width: 25px;
  height: 25px;
  min-height: 25px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}
.ui-icon {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  color: currentColor;
}
.action-icon-img {
  width: 14px;
  height: 14px;
  max-width: 14px;
  max-height: 14px;
  display: block;
  object-fit: contain;
}
.file-icon-link {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
}
.file-icon-link:hover {
  border-color: var(--line);
  background: #f7fbff;
}
.file-icon-link .action-icon-img,
.file-icon-link .ui-icon {
  width: 18px;
  height: 18px;
  max-width: 18px;
  max-height: 18px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.favorite-active {
  color: #d92d20;
  border-color: #f1b5ae;
  background: #fff5f3;
}
.ui-icon-heart::before,
.ui-icon-heart-filled::before {
  content: "♡";
  position: absolute;
  inset: -2px 0 0;
  font-size: 20px;
  line-height: 16px;
  font-weight: 700;
}
.ui-icon-heart-filled::before {
  content: "♥";
}
.ui-icon-filter::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 3px;
  width: 12px;
  height: 3px;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  box-shadow: 0 6px 0 -1px currentColor;
}
.ui-icon-dashboard::before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 2px solid currentColor;
  border-radius: 2px;
  box-shadow: inset 7px 0 0 -5px currentColor, inset 0 7px 0 -5px currentColor;
}
.ui-icon-table-list::before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 2px solid currentColor;
  border-radius: 2px;
  box-shadow: inset 0 4px 0 -2px currentColor, inset 0 -4px 0 -2px currentColor;
}
.ui-icon-refresh::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-left-color: transparent;
  border-radius: 50%;
}
.ui-icon-refresh::after {
  content: "";
  position: absolute;
  right: 1px;
  top: 3px;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}
.ui-icon-import::before,
.ui-icon-export::before {
  content: "";
  position: absolute;
  left: 3px;
  bottom: 2px;
  width: 10px;
  height: 6px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 2px 2px;
}
.ui-icon-import::after,
.ui-icon-export::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 1px;
  width: 2px;
  height: 10px;
  background: currentColor;
}
.ui-icon-import::after {
  box-shadow: -3px 5px 0 -1px currentColor, 3px 5px 0 -1px currentColor;
}
.ui-icon-export::after {
  box-shadow: -3px -1px 0 -1px currentColor, 3px -1px 0 -1px currentColor;
}
.ui-icon-edit::before {
  content: "";
  position: absolute;
  width: 13px;
  height: 4px;
  left: 1px;
  top: 8px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(-38deg);
}
.ui-icon-edit::after {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 5px;
  height: 2px;
  background: currentColor;
  transform: rotate(-38deg);
}
.ui-icon-trash::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 5px;
  width: 8px;
  height: 9px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 2px 2px;
}
.ui-icon-trash::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 2px;
  width: 10px;
  height: 2px;
  background: currentColor;
  box-shadow: 3px -2px 0 -1px currentColor;
}
.ui-icon-file-plus::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 1px;
  width: 10px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 2px;
}
.ui-icon-file::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 1px;
  width: 10px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 2px;
}
.ui-icon-file::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 8px;
  width: 7px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 4px 0 currentColor;
}
.ui-icon-file-plus::after {
  content: "+";
  position: absolute;
  right: -1px;
  bottom: -4px;
  font-size: 15px;
  line-height: 1;
  font-weight: 700;
}
.home-favorites {
  margin-bottom: 8px;
}
.favorite-summary {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #d6e0da;
  border-radius: 8px;
  padding: 5px 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 22px rgba(23, 33, 28, .05);
}
.favorite-summary b,
.favorite-summary-title {
  display: block;
  font-size: 13px;
  font-weight: 500;
}
.favorite-summary small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.favorite-summary-icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #fff4f3;
  color: #d92d20;
}
.favorite-block {
  grid-column: 1 / -1;
  margin-top: 8px;
}
.favorite-list {
  display: grid;
  gap: 8px;
}
.favorite-item {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  text-align: left;
  color: var(--ink);
}
.favorite-item-title {
  display: block;
  font-size: 12px;
  font-weight: 500;
}
.favorite-item small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}
.dialog-favorite-list {
  margin-top: 0;
}
.favorite-item .ui-icon {
  color: #d92d20;
}
.table-link {
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  text-align: left;
  font-weight: 700;
}
.pending-file-pill,
.attached-file-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 7px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}
.pending-file-pill button {
  min-width: 22px;
  min-height: 22px;
  border: 0;
  border-radius: 50%;
  background: #f1f5f9;
  color: #334155;
}
.attached-files {
  display: grid;
  gap: 6px;
}
.attached-files-title {
  color: var(--muted);
  font-size: 12px;
}
.attached-file-row {
  justify-content: space-between;
}
.small-button {
  min-height: 26px;
  padding: 0 9px;
  font-size: 12px;
}
.row-actions { white-space: nowrap; display: inline-flex; gap: 4px; align-items: center; }
.danger-text { color: var(--danger); }
.empty-inline {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}
.compact-table table { min-width: 760px; }
.dashboard-results .compact-table table {
  width: 100%;
  min-width: 100%;
}
.import-report-box {
  margin: 12px 0;
  max-height: min(50vh, 420px);
}
.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.user-row span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.user-main, .user-head, .users-list, .permission-group { min-width: 0; }
.users-list {
  display: grid;
  gap: 8px;
  max-width: 100%;
}
.user-head b,
.user-head span,
.setting label,
.section-note {
  overflow-wrap: anywhere;
}
.user-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 210px;
  white-space: normal;
}
.user-actions .table-action { white-space: normal; }
.user-create-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
}
.permissions-box .switch {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.user-permissions-details {
  margin-top: 8px;
  max-width: 100%;
}
.user-permissions-details summary {
  cursor: pointer;
  width: fit-content;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.permission-group {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.permission-title {
  margin: 0 0 2px;
  color: var(--ink);
  font-weight: 700;
}
dialog {
  width: min(980px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(18,28,24,.48); }
.form { padding: 0 18px 18px; }
.dialog-top, .actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-top {
  margin: 0 -18px 14px;
  padding: 16px 18px 12px;
  background: #fff;
}
.sticky-dialog-top {
  position: sticky;
  top: 0;
  z-index: 3;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(23, 33, 28, .08);
}
.dialog-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dialog-sections {
  display: grid;
  gap: 14px;
}
.form-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.form-section h3 {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: #1f3550;
  font-size: 16px;
}
.finance-section {
  border-color: #9fbfe1;
  background: #f7fbff;
  box-shadow: 0 14px 36px rgba(47, 111, 179, .13);
}
.finance-section h3 {
  color: #245487;
  border-bottom-color: #cfe0f1;
}
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.wide-field { grid-column: span 2; }
.wide { margin-top: 12px; }
.vat-multiple-switch {
  align-self: end;
}
.vat-lines-panel {
  grid-column: 1 / -1;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}
.vat-lines-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.vat-lines-head h3 {
  font-size: 13px;
}
.vat-lines {
  display: grid;
  gap: 8px;
}
.vat-line {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  gap: 8px;
  align-items: end;
}
.vat-line-remove {
  min-height: 34px;
  white-space: nowrap;
}
.muted-field {
  opacity: .72;
}
.form-files {
  align-self: end;
  margin-top: 0;
}
.files { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.file-button input, .file-mini input { display: none; }
.file-button span, .file-mini span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}
.file-mini span { min-height: 38px; }
.hint { min-height: 20px; margin-top: 10px; color: var(--muted); }
.lookup-status {
  margin-bottom: 0;
}
.inn-input-wrap {
  position: relative;
  display: block;
}
.inn-input-wrap input {
  padding-right: 34px;
}
.lookup-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: var(--muted);
}
.lookup-searching .lookup-icon::before {
  content: "";
  display: block;
  width: 15px;
  height: 15px;
  border: 2px solid #9fbfe1;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.lookup-found input {
  border-color: #8cc7a5;
  background: #f3fbf7;
}
.lookup-found .lookup-icon::before {
  content: "";
  position: absolute;
  width: 9px;
  height: 5px;
  left: 2px;
  top: 3px;
  border-left: 2px solid var(--ok);
  border-bottom: 2px solid var(--ok);
  transform: rotate(-45deg);
}
.lookup-not-found input,
.lookup-error input {
  border-color: #e3b36a;
  background: #fffaf0;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.error { min-height: 20px; margin-top: 10px; color: var(--danger); }
.calculated-line {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbff;
  color: var(--muted);
  font-size: 13px;
}
.actions { margin-top: 10px; }
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #17211c;
  color: #fff;
  box-shadow: 0 14px 40px rgba(23,33,28,.24);
}
@media (max-width: 1180px) {
  .home-dashboard { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
  .app { grid-template-columns: 78px minmax(0, 1fr); }
  .app.sidebar-collapsed { grid-template-columns: 56px minmax(0, 1fr); }
  .brand div:last-child, .nav { font-size: 0; }
  .storage { display: none; }
  .card { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .empty { min-height: 220px; }
}
@media (max-width: 760px) {
  .home-dashboard { grid-template-columns: 1fr; }
  .attention-today, .recent-block, .quick-actions-block { grid-column: 1; }
  .recent-item { grid-template-columns: 1fr; gap: 3px; }
  .quick-actions { grid-template-columns: 1fr; }
  .app { display: block; }
  .side { position: sticky; top: 0; z-index: 5; flex-direction: row; overflow-x: auto; }
  .brand { min-width: 38px; margin: 0; }
  .main, .card { padding: 14px; }
  .top, .top-actions, .registry-toolbar, .filters, .grid, .facts, .metrics, .settings, .settings-grid, .user-create-grid, .list-item, .files { grid-template-columns: 1fr; display: grid; }
  .full-setting { grid-column: auto; }
  .user-row { grid-template-columns: 1fr; }
  .user-actions { justify-content: flex-start; max-width: none; }
  .toolbar-group { justify-content: stretch; }
  .toolbar-button, .file-mini span { max-width: none; width: 100%; }
  .wide-field { grid-column: 1; }
  .vat-line { grid-template-columns: 1fr; }
  #search { max-width: none; }
}
