:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --bg-soft: #eef1f5;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --ink: #17202a;
  --muted: #687586;
  --line: #dde3eb;
  --line-strong: #c8d1dc;
  --border: var(--line);
  --text: var(--ink);
  --accent: #e1262f;
  --brand: var(--accent);
  --accent-dark: #b91520;
  --accent-soft: rgba(225, 38, 47, 0.1);
  --accent-2: #f59e0b;
  --good: #168a55;
  --warn: #b7791f;
  --bad: #d51f2a;
  --shadow: 0 18px 42px rgba(29, 39, 53, 0.08);
  --shadow-soft: 0 8px 24px rgba(29, 39, 53, 0.06);
}

/* Expertise workspace */
.expertise-workspace { display: grid; gap: 12px; min-width: 0; }
.expertise-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 4px 0; }
.expertise-head > div { display: grid; gap: 3px; }
.expertise-head span { color: var(--accent-dark); font-size: 10px; font-weight: 800; }
.expertise-head h2 { font-size: 22px; }
.expertise-head p, .section-title p { margin: 0; color: var(--muted); font-size: 12px; }
.expertise-statuses { display: flex; flex-wrap: wrap; gap: 7px; }
.expertise-statuses button { min-height: 32px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #526071; cursor: pointer; }
.expertise-statuses button:hover, .expertise-statuses button.active { border-color: rgba(225,38,47,.35); background: #fff4f4; color: var(--accent-dark); }
.expertise-statuses b { margin-left: 5px; }
.expertise-filters { display: grid; grid-template-columns: minmax(280px,1fr) 280px auto; align-items: end; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.expertise-filters input, .expertise-filters select { width: 100%; min-width: 0; }
.expertise-journal { overflow: hidden; }
.expertise-meta { padding: 9px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.expertise-journal table { width: 100%; border-collapse: collapse; }
.expertise-journal th, .expertise-journal td { padding: 10px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.expertise-journal th { color: #657386; font-size: 10px; text-transform: uppercase; }
.expertise-journal tbody tr { cursor: pointer; }
.expertise-journal tbody tr:hover { background: #fff7f7; }
.expertise-journal td small { display: block; max-width: 260px; margin-top: 2px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expertise-status { display: inline-flex; padding: 4px 7px; border-radius: 7px; background: #edf3f8; color: #526071; font-size: 11px; font-weight: 700; white-space: nowrap; }
.expertise-status.status-research, .expertise-status.status-assigned { background: #e8f4ff; color: #1368a8; }
.expertise-status.status-waiting_documents, .expertise-status.status-drafting { background: #fff4d9; color: #946200; }
.expertise-status.status-ready, .expertise-status.status-issued { background: #e4f8ec; color: #16723b; }
.expertise-status.status-review { background: #f3eaff; color: #6e35ad; }

.expertise-drawer-root { z-index: 180; }
.expertise-drawer { position: fixed; z-index: 190; inset: 0 0 0 auto; width: min(1080px, 88vw); height: 100vh; display: grid; grid-template-rows: auto auto minmax(0,1fr) auto; overflow: hidden; border-left: 1px solid var(--line); background: #fff; box-shadow: -24px 0 70px rgba(15,23,42,.18); animation: drawerIn .18s ease; }
.expertise-drawer-head { display: grid; grid-template-columns: minmax(0,1fr) 210px 40px; align-items: start; gap: 14px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.expertise-drawer-head > div > span { color: var(--accent-dark); font-size: 12px; font-weight: 800; }
.expertise-drawer-head h2 { margin-top: 2px; font-size: 22px; }
.expertise-drawer-head p { margin: 3px 0 6px; color: #a01921; font-weight: 700; }
.expertise-case-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.expertise-case-meta > * { padding: 3px 7px; border: 1px solid var(--line); border-radius: 7px; color: #526071; font-size: 11px; }
.expertise-drawer-head select { width: 100%; min-width: 0; }
.expertise-tabs { display: grid; grid-template-columns: repeat(5,1fr); gap: 6px; padding: 9px 20px; border-bottom: 1px solid var(--line); }
.expertise-tabs button { min-height: 35px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.expertise-tabs button.active { border-color: rgba(225,38,47,.35); background: #fff0f0; color: var(--accent-dark); }
.expertise-drawer-body { min-width: 0; overflow-y: auto; overflow-x: hidden; padding: 14px 20px 24px; }
.expertise-drawer > footer, .expertise-create-modal footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px 20px; border-top: 1px solid var(--line); background: #fff; }
.expertise-footer-note { margin-right: auto; color: var(--muted); font-size: 11px; }
.expertise-finalize { border-color: #d5b24a; background: #fff9e8; color: #765b08; }
.expertise-final-badge { border-color: #b8dfc8 !important; background: #eaf9f0; color: #156c3d !important; font-weight: 700; }
.expertise-drawer.is-finalized [data-case-form] { opacity: .82; }
.expertise-edit-grid, .expertise-research-form { display: grid; grid-template-columns: 1fr; gap: 14px; }
.expertise-edit-grid section { padding: 13px; border: 1px solid var(--line); border-radius: 9px; }
.expertise-edit-grid h3 { margin-bottom: 10px; }
.expertise-grid, .expertise-research-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
.expertise-grid { display: grid; gap: 10px; }
.expertise-grid .span-2, .expertise-research-form .span-2 { grid-column: 1 / -1; }
.expertise-grid input, .expertise-grid textarea, .expertise-research-form input, .expertise-research-form textarea { width: 100%; min-width: 0; }
.expertise-grid textarea, .expertise-research-form textarea { min-height: 66px; }
.expertise-checks { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.expertise-checks label { display: flex; align-items: center; gap: 6px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; color: #3d4a59; }
.expertise-checks input { width: 15px; min-width: 15px; height: 15px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.expertise-row { display: grid; grid-template-columns: 1.2fr 1fr 90px 1.2fr 34px; gap: 6px; margin-bottom: 7px; }
.expertise-row input, .expertise-row select { width: 100%; min-width: 0; }
.expertise-row > button { border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.evidence-row { grid-template-columns: 130px 1fr 1.4fr 34px; }
.expertise-upload { display: grid; grid-template-columns: 180px minmax(0,1fr); gap: 10px; margin-bottom: 14px; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: #f8fafc; }
.expertise-upload label { min-width: 0; }
.expertise-upload input, .expertise-upload select { width: 100%; min-width: 0; }
.expertise-upload .span-2 { grid-column: 1/-1; }
.expertise-upload > button { justify-self: end; grid-column: 1/-1; }
.expertise-file { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 4px 10px; padding: 10px; border: 1px dashed var(--line-strong); border-radius: 8px; background: #fff; cursor: pointer; }
.expertise-file input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.expertise-file span { grid-row: 1/3; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; font-weight: 700; }
.expertise-file small { min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expertise-evidence-list { display: grid; gap: 8px; }
.expertise-evidence-card { display: grid; grid-template-columns: 58px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.expertise-evidence-icon { display: grid; place-items: center; width: 58px; height: 46px; border-radius: 7px; background: #eef2f7; color: #536173; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.expertise-evidence-card p { margin: 2px 0; color: #536173; }
.expertise-evidence-card small { display: block; color: var(--muted); font-size: 10px; }
.expertise-evidence-actions { display: flex; align-items: center; gap: 6px; }
.expertise-evidence-actions a { text-decoration: none; }
.expertise-question { position: relative; display: grid; grid-template-columns: minmax(240px,.8fr) minmax(320px,1.2fr) auto; gap: 8px; margin-bottom: 8px; }
.expertise-question input, .expertise-question textarea { width: 100%; min-width: 0; }
.expertise-question textarea { min-height: 58px; }
.expertise-question button { align-self: start; min-height: 40px; border: 1px solid #f0c1c4; border-radius: 8px; background: #fff5f5; color: #b71b24; }
.expertise-history { display: grid; gap: 0; }
.expertise-history article { display: grid; grid-template-columns: 10px 1fr; gap: 9px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.expertise-history i { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--accent); }
.expertise-history time, .expertise-history small { color: var(--muted); font-size: 11px; }
.expertise-history strong { display: block; margin: 2px 0; }
.expertise-history p { margin: 0; color: #526071; }

.expertise-create-modal { position: fixed; z-index: 210; top: 50%; left: 50%; width: min(940px, 94vw); max-height: 92vh; display: grid; grid-template-rows: auto minmax(0,1fr) auto; overflow: hidden; transform: translate(-50%,-50%); border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 28px 80px rgba(15,23,42,.22); }
.expertise-create-modal > form { min-height: 0; display: contents; }
.expertise-create-modal header { display: flex; justify-content: space-between; gap: 14px; padding: 17px 20px 12px; border-bottom: 1px solid var(--line); }
.expertise-create-modal header span { color: var(--accent-dark); font-size: 10px; font-weight: 800; }
.expertise-create-modal header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.expertise-form-scroll { min-height: 0; overflow-y: auto; padding: 14px 20px 22px; }
.expertise-form-scroll fieldset { position: relative; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 0 0 13px; padding: 14px; border: 1px solid var(--line); border-radius: 9px; }
.expertise-form-scroll legend { padding: 0 5px; font-weight: 800; }
.expertise-form-scroll .span-2 { grid-column: 1/-1; }
.expertise-form-scroll input, .expertise-form-scroll select, .expertise-form-scroll textarea { width: 100%; min-width: 0; }
.expertise-client-results { position: absolute; z-index: 10; top: 78px; left: 14px; right: 14px; display: grid; max-height: 230px; overflow-y: auto; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: 0 16px 40px rgba(15,23,42,.14); }
.expertise-client-results:empty { display: none; }
.expertise-client-results button { padding: 9px 11px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; cursor: pointer; }
.expertise-client-results button:hover { background: #fff5f5; }
.expertise-client-results small { display: block; color: var(--muted); }

@media (max-width: 900px) {
  .expertise-filters { grid-template-columns: 1fr; }
  .expertise-drawer { width: 96vw; }
  .expertise-drawer-head { grid-template-columns: minmax(0,1fr) 40px; }
  .expertise-drawer-head > label { grid-column: 1/-1; grid-row: 2; }
  .expertise-tabs { grid-template-columns: repeat(3,1fr); }
  .expertise-grid, .expertise-research-form, .expertise-form-scroll fieldset { grid-template-columns: 1fr; }
  .expertise-grid .span-2, .expertise-research-form .span-2, .expertise-form-scroll .span-2 { grid-column: auto; }
  .expertise-row, .evidence-row, .expertise-question { grid-template-columns: 1fr; }
  .expertise-upload { grid-template-columns: 1fr; }
  .expertise-upload .span-2, .expertise-upload > button { grid-column: auto; }
  .expertise-evidence-card { grid-template-columns: 48px minmax(0,1fr); }
  .expertise-evidence-icon { width: 48px; }
  .expertise-evidence-actions { grid-column: 1/-1; justify-content: flex-end; }
  .expertise-footer-note { display: none; }
}

.client-ledger-modal {
  width: min(920px, 94vw);
}

.finance-ledger-list {
  display: grid;
  gap: 6px;
  max-height: min(52vh, 520px);
  overflow: auto;
}

.client-ledger-row {
  grid-template-columns: 140px minmax(130px, 1fr) 100px 110px 110px 100px 110px minmax(140px, 1.3fr);
  min-width: 860px;
}

.modal-field small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.nav-separator {
  height: 1px;
  margin: 8px 12px;
  background: rgba(18, 24, 38, 0.09);
}

.stock-workspace {
  display: grid;
  gap: 12px;
}

.stock-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.stock-tabs button {
  border: 1px solid transparent;
  border-radius: 999px;
  background: #f5f7fb;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  padding: 9px 13px;
}

.stock-tabs button.active,
.stock-tabs button:hover {
  border-color: rgba(214, 40, 40, 0.25);
  background: rgba(214, 40, 40, 0.08);
  color: var(--brand);
}

.stock-filter-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.stock-filter-panel .stock-search {
  grid-column: span 2;
  position: relative;
}

.stock-filter-panel .stock-search .stock-search-status {
  position: absolute;
  right: 4px;
  top: 0;
}

.stock-filter-panel label {
  color: var(--muted);
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
}

.stock-filter-panel input,
.stock-filter-panel select,
.stock-document-line input,
.stock-document-line select {
  border: 1px solid var(--border);
  border-radius: 10px;
  box-sizing: border-box;
  background: #fff;
  color: var(--text);
  font: inherit;
  min-width: 0;
  padding: 10px 11px;
  width: 100%;
}

.stock-filter-panel strong {
  color: var(--muted);
  justify-self: end;
  padding: 10px 0;
}

.stock-doc-filter {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.stock-doc-type-tabs,
.stock-product-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.stock-doc-type-tabs button,
.stock-product-tabs button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  padding: 8px 11px;
}

.stock-doc-type-tabs button.active,
.stock-product-tabs button.active,
.stock-doc-type-tabs button:hover,
.stock-product-tabs button:hover {
  border-color: rgba(225, 38, 47, 0.28);
  background: var(--accent-soft);
  color: var(--accent);
}

.stock-balances-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 12px;
}

.stock-groups-panel {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  max-height: calc(100vh - 265px);
  overflow: auto;
  padding: 10px;
}

.stock-groups-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  padding: 4px 4px 8px;
}

.stock-group-row {
  align-items: center;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
  min-height: 32px;
  width: 100%;
}

.stock-group-row:hover,
.stock-group-row.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.stock-group-row b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-group-main {
  align-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: grid;
  grid-template-columns: calc(var(--level, 0) * 14px) 18px minmax(0, 1fr) auto;
  gap: 4px;
  min-height: 32px;
  padding: 5px 7px;
  text-align: left;
  width: 100%;
}

.stock-group-row small {
  color: var(--muted);
  font-weight: 800;
}

.stock-group-toggle {
  color: var(--muted);
  text-align: center;
}

.stock-group-actions {
  display: inline-flex;
  gap: 4px;
  opacity: 0.78;
}

.stock-group-actions button {
  align-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  height: 22px;
  justify-content: center;
  padding: 0;
  width: 22px;
}

.stock-group-actions button:hover {
  background: #fff;
  color: var(--accent);
}

.modal-error {
  color: var(--bad);
  font-size: 13px;
  font-weight: 700;
  min-height: 18px;
}

.stock-balances-main {
  min-width: 0;
}

.stock-panel {
  overflow: hidden;
  padding: 0;
}

.stock-table-wrap {
  max-height: calc(100vh - 310px);
  overflow: auto;
}

.stock-table {
  border-collapse: collapse;
  width: 100%;
}

.stock-balance-table {
  min-width: 1110px;
}

.stock-table th,
.stock-table td {
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
}

.stock-table th {
  background: #f7f9fc;
  color: var(--muted);
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.stock-balance-head tr:first-child th {
  top: 0;
}

.stock-balance-head tr:nth-child(2) th {
  top: 37px;
}

.stock-balance-head .stock-column-group {
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--text);
  text-align: center;
}

.stock-balance-head tr:nth-child(2) th {
  text-align: center;
}

.stock-table tr {
  cursor: pointer;
}

.stock-table tr:hover {
  background: #fff7f7;
}

.stock-table td strong,
.stock-table td small {
  display: block;
}

.stock-table td small {
  color: var(--muted);
  margin-top: 3px;
}

.stock-quantity-cell {
  min-width: 88px;
  white-space: nowrap;
}

.stock-quantity-cell b {
  font-size: 14px;
}

.stock-quantity-cell small {
  font-size: 10px;
  white-space: normal;
}

.stock-status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 9px;
}

.stock-status.ok {
  background: #e8f7ee;
  color: #137333;
}

.stock-status.low {
  background: #fff4d8;
  color: #946200;
}

.stock-status.empty {
  background: #fff0f0;
  color: #b42318;
}

.stock-doc-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
}

.stock-doc-head h3 {
  margin: 0 0 4px;
}

.stock-doc-head p {
  color: var(--muted);
  margin: 0;
}

.stock-document-list,
.stock-movement-list {
  display: grid;
  gap: 8px;
  padding: 0 16px 16px;
}

.stock-document-row,
.stock-movement-row {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 1fr) auto;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
}

.stock-movement-row.is-clickable {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.stock-movement-row.is-clickable:hover,
.stock-movement-row.is-clickable:focus-visible {
  border-color: rgba(220, 38, 38, 0.36);
  background: #fffafa;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  outline: none;
}

.stock-movement-amount {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.stock-movement-amount small {
  margin: 0;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
}

.stock-document-row small,
.stock-movement-row small {
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.drawer-header-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.stock-drawer .drawer-header {
  overflow: visible;
}

.stock-document-menu .repair-more-menu-list {
  left: 0;
  max-width: min(280px, calc(100vw - 32px));
  min-width: 210px;
  right: auto;
  white-space: nowrap;
  width: max-content;
  z-index: 180;
}

.stock-document-menu .repair-more-menu-list button {
  align-items: center;
  display: flex;
  min-width: 0;
  width: 100%;
}

.stock-document-drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 74px;
  scrollbar-gutter: stable;
}

.stock-document-edit {
  display: grid;
  gap: 14px;
  padding: 0 16px;
}

.stock-doc-edit-toolbar,
.stock-doc-edit-total {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.stock-document-edit-list {
  display: grid;
  gap: 8px;
}

.stock-document-edit-row {
  align-items: end;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(180px, 1.5fr) minmax(104px, .55fr) repeat(3, minmax(74px, .55fr)) minmax(82px, .5fr) 30px;
  padding: 8px;
}

.stock-document-edit-row label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 5px;
}

.stock-document-edit-row input,
.stock-document-edit-row select {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  min-width: 0;
  padding: 7px 8px;
}

.stock-document-qty-control {
  align-items: center;
  display: grid;
  grid-template-columns: 28px minmax(48px, 1fr) 28px;
  gap: 0;
  width: min(112px, 100%);
}

.stock-document-qty-control button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: grid;
  font-size: 15px;
  font-weight: 700;
  height: 30px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 28px;
}

.stock-document-qty-control button:first-child {
  border-radius: 8px 0 0 8px;
}

.stock-document-qty-control button:last-child {
  border-radius: 0 8px 8px 0;
}

.stock-document-qty-control button + input,
.stock-document-qty-control input + button {
  margin-left: -1px;
}

.stock-document-qty-control button:hover {
  background: #fff1f2;
  border-color: rgba(225, 38, 47, 0.28);
  position: relative;
  z-index: 1;
}

.stock-document-qty-control button:disabled {
  background: #f8fafc;
  color: #cbd5e1;
  cursor: not-allowed;
}

.stock-document-qty-control input {
  border-radius: 0;
  height: 30px;
  min-width: 48px;
  padding: 0 5px;
  text-align: center;
}

.stock-document-qty-control input::-webkit-outer-spin-button,
.stock-document-qty-control input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stock-document-qty-control input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.stock-document-edit-row strong,
.stock-doc-edit-total b {
  color: var(--text);
}

.stock-document-line .stock-return-reason,
.stock-document-edit-row .stock-return-reason {
  grid-column: 1 / -1;
}

.stock-return-reason input {
  width: 100%;
}

.stock-doc-edit-total {
  color: var(--muted);
  justify-content: flex-end;
  padding: 10px 0;
}

.stock-document-actionbar {
  backdrop-filter: blur(10px);
  background: rgba(248, 250, 252, .96);
  border-top: 1px solid var(--border);
  bottom: 0;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  box-sizing: border-box;
  flex: 0 0 auto;
  margin: 16px 0 0;
  padding: 10px 16px;
  position: sticky;
  width: 100%;
}

.stock-document-history {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding: 0 16px 16px;
}

.stock-document-history article {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 2px;
  padding: 9px 10px;
}

.stock-document-history span,
.stock-document-history small {
  color: var(--muted);
  font-size: 12px;
}

.stock-settlement-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  gap: 12px;
  margin: 0 16px 16px;
  padding: 14px;
}

.stock-settlement-card.paid {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.stock-settlement-card.partial {
  background: #fffbeb;
  border-color: #fde68a;
}

.stock-settlement-card.overpaid {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.stock-supplier-balance {
  align-items: center;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: space-between;
  padding-top: 10px;
}

.stock-supplier-balance span {
  color: var(--muted);
  font-size: 12px;
}

.stock-settlement-head,
.stock-payment-history article {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.stock-settlement-head > div,
.stock-payment-history article > div {
  display: grid;
  gap: 3px;
}

.stock-settlement-head span,
.stock-settlement-summary span,
.stock-payment-history small,
.stock-settlement-empty {
  color: var(--muted);
  font-size: 12px;
}

.stock-settlement-summary {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stock-settlement-summary article {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 9px;
  display: grid;
  gap: 4px;
  padding: 9px 10px;
}

.stock-settlement-summary article.due b {
  color: #b45309;
}

.stock-payment-history {
  display: grid;
  gap: 7px;
}

.stock-payment-history article {
  background: rgba(255, 255, 255, .82);
  border-top: 1px solid var(--border);
  padding: 8px 2px 0;
}

.stock-payment-history article.payment-cancelled {
  opacity: .62;
}

.stock-payment-history article.payment-cancelled b,
.stock-payment-history article.payment-cancelled > .stock-payment-history-actions > strong {
  text-decoration: line-through;
}

.stock-payment-history-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.stock-settlement-empty {
  margin: 0;
}

.stock-create-payment-fields {
  align-items: end;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, .7fr) minmax(220px, 1fr);
  padding: 10px;
}

.stock-create-payment-fields[hidden] {
  display: none;
}

.stock-create-payment-fields label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 5px;
}

.stock-create-payment-fields p,
.stock-payment-note {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.stock-payment-modal {
  width: min(620px, calc(100vw - 32px));
}

.stock-supplier-return-cancellation-modal {
  width: min(760px, calc(100vw - 32px));
}

.stock-supplier-return-cancellation-note {
  padding: 10px 12px;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 13px;
  line-height: 1.4;
}

.stock-supplier-return-cancellation-lines {
  display: grid;
  max-height: min(42vh, 420px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.stock-supplier-return-cancellation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 156px;
  gap: 16px;
  align-items: end;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.stock-supplier-return-cancellation-row:last-child {
  border-bottom: 0;
}

.stock-supplier-return-cancellation-row span {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.stock-supplier-return-cancellation-row b,
.stock-supplier-return-cancellation-row small {
  overflow-wrap: anywhere;
}

.stock-supplier-return-cancellation-row small {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 620px) {
  .stock-supplier-return-cancellation-row {
    grid-template-columns: 1fr;
  }
}

.stock-drawer-root {
  position: fixed;
  inset: 0;
  z-index: 140;
  pointer-events: none;
}

.stock-drawer-root .drawer-backdrop {
  z-index: 140;
  pointer-events: auto;
}

.stock-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 145;
  width: clamp(720px, 64vw, 900px);
  max-width: 90vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -28px 0 80px rgba(15, 23, 42, 0.18);
  pointer-events: auto;
}

.stock-product-header {
  align-items: flex-start;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 18px 20px 14px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.stock-product-title {
  min-width: 0;
}

.stock-product-title h2 {
  color: var(--ink);
  display: -webkit-box;
  font-size: 22px;
  line-height: 1.18;
  margin: 0 0 6px;
  max-height: 78px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.stock-product-title p {
  color: var(--muted);
  margin: 0;
}

.stock-product-header-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 340px;
}

.stock-product-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-top: 14px;
}

.stock-product-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 18px 14px;
}

.stock-product-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 0 18px 12px;
  scrollbar-width: thin;
}

.stock-product-tab-content {
  padding-bottom: 18px;
}

.price-label-modal {
  max-width: 1100px;
  width: min(1100px, 90vw);
}

.price-label-workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
}

.price-label-controls {
  align-self: start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.price-label-preview-panel {
  min-width: 0;
}

.price-label-preview-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 8px;
}

.price-label-warning {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  color: #9a3412;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  padding: 10px;
}

.price-label-preview {
  align-items: start;
  background: #f3f5f8;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  justify-items: center;
  min-height: 440px;
  overflow: auto;
  padding: 28px;
}

.price-label-sheet {
  display: flex;
  flex-wrap: wrap;
  gap: 6mm;
}

.price-label-sheet.preview-mode {
  zoom: var(--preview-scale, 2);
}

.price-label-sheet.roll {
  display: grid;
  justify-items: center;
}

.price-label-sheet.a4 {
  align-content: start;
  background: #fff;
  box-shadow: var(--shadow-soft);
  min-height: 297mm;
  padding: 10mm;
  width: 210mm;
}

.price-label {
  background: #fff;
  border: 0.18mm solid #000;
  color: #000;
  display: grid;
  font-family: Arial, sans-serif;
  height: var(--label-height);
  overflow: hidden;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
  width: var(--label-width);
}

.price-label-top {
  align-items: center;
  display: flex;
  gap: 1mm;
  justify-content: space-between;
  min-width: 0;
}

.price-label-brand,
.price-label-code {
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.price-label-footer {
  align-items: end;
  display: flex;
  gap: 1mm;
  justify-content: space-between;
  letter-spacing: 0;
  min-width: 0;
  white-space: nowrap;
}

.price-label-footer-code {
  overflow: hidden;
  text-overflow: ellipsis;
}

.price-label-name {
  display: -webkit-box;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.08;
  overflow: hidden;
  word-break: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--label-name-lines, 2);
}

.price-label-price {
  align-items: baseline;
  display: flex;
  font-weight: 900;
  gap: 0.5mm;
  justify-content: center;
  letter-spacing: 0;
  line-height: 0.92;
  min-width: 0;
  white-space: nowrap;
}

.price-label-price-value {
  align-items: baseline;
  display: flex;
  gap: 0.5mm;
}

.price-label-price-brand {
  display: none;
}

.price-label-price span,
.price-label-price em {
  font-style: normal;
}

.price-label-barcode-wrap {
  display: grid;
  gap: 0.35mm;
  justify-items: center;
  min-height: 0;
}

.price-label-barcode {
  fill: #000;
  justify-self: center;
  max-width: 100%;
  shape-rendering: crispEdges;
  width: auto;
}

.price-label-barcode-text,
.price-label-no-barcode {
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  text-align: center;
}

.price-label-40x30 {
  column-gap: 0.8mm;
  grid-template-columns: 12.5mm minmax(0, 1fr);
  grid-template-rows: 9.5mm 16.4mm;
  row-gap: 0.5mm;
  padding: 1.5mm;
}

.price-label-40x30 .price-label-top {
  display: none;
}

.price-label-40x30 .price-label-name {
  align-self: start;
  font-size: 6.4pt;
  font-weight: 600;
  grid-column: 1 / -1;
  grid-row: 1;
  letter-spacing: 0;
  line-height: 1.1;
  -webkit-line-clamp: 3;
}

.price-label-40x30 .price-label-price {
  align-items: flex-start;
  align-self: stretch;
  flex-direction: column;
  gap: 1.2mm;
  grid-column: 1;
  grid-row: 2;
  justify-content: center;
}

.price-label-40x30 .price-label-price strong {
  font-size: 15pt;
  font-weight: 700;
}

.price-label-40x30 .price-label-price span,
.price-label-40x30 .price-label-price em {
  font-size: 9pt;
  font-weight: 700;
}

.price-label-40x30 .price-label-price-brand {
  display: block;
  font-size: 5.5pt;
  font-weight: 700;
  line-height: 1;
}

.price-label-40x30 .price-label-barcode-wrap,
.price-label-40x30 .price-label-no-barcode {
  align-self: stretch;
  grid-column: 2;
  grid-row: 2;
}

.price-label-40x30 .price-label-barcode-wrap {
  align-content: center;
  grid-template-rows: 10mm 3mm;
  row-gap: 0.7mm;
}

.price-label-40x30 .price-label-barcode {
  height: 10mm;
}

.price-label-40x30 .price-label-barcode-text,
.price-label-40x30 .price-label-no-barcode {
  font-size: 6.3pt;
  font-weight: 700;
}

.price-label-40x30 .price-label-footer {
  display: none;
}

.price-label-58x30 {
  grid-template-rows: 3.5mm 7mm 9.2mm 6mm 2mm;
  padding: 1.8mm 2.2mm;
}

.price-label-58x30 .price-label-brand,
.price-label-58x30 .price-label-code,
.price-label-58x30 .price-label-footer {
  font-size: 5.6pt;
}

.price-label-58x30 .price-label-name {
  font-size: 7.6pt;
}

.price-label-58x30 .price-label-price strong {
  font-size: 24pt;
}

.price-label-58x30 .price-label-price span,
.price-label-58x30 .price-label-price em {
  font-size: 14pt;
}

.price-label-58x30 .price-label-barcode {
  height: 5mm;
}

.price-label-58x30 .price-label-barcode-text,
.price-label-58x30 .price-label-no-barcode {
  font-size: 5pt;
}

.price-label-58x30 .price-label-footer-code {
  display: none;
}

.price-label-58x40 {
  grid-template-rows: 4mm 10mm 11mm 8mm 2.5mm;
  padding: 2.2mm 2.6mm;
}

.price-label-58x40 .price-label-brand,
.price-label-58x40 .price-label-code,
.price-label-58x40 .price-label-footer {
  font-size: 6pt;
}

.price-label-58x40 .price-label-name {
  font-size: 8.5pt;
}

.price-label-58x40 .price-label-price strong {
  font-size: 29pt;
}

.price-label-58x40 .price-label-price span,
.price-label-58x40 .price-label-price em {
  font-size: 16pt;
}

.price-label-58x40 .price-label-barcode {
  height: 6.8mm;
}

.price-label-58x40 .price-label-barcode-text,
.price-label-58x40 .price-label-no-barcode {
  font-size: 5.4pt;
}

.price-label-58x40 .price-label-footer-code {
  display: none;
}

#labelPrintRoot {
  display: none;
}

.stock-drawer-actions {
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  padding: 12px 18px;
}

.stock-product-summary article,
.stock-product-grid div {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.stock-product-summary span,
.stock-product-grid span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 5px;
}

.stock-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 18px 10px;
}

.stock-document-lines {
  display: grid;
  gap: 8px;
}

.stock-document-line {
  align-items: end;
  display: grid;
  grid-template-columns: minmax(280px, 1.7fr) 104px repeat(3, minmax(112px, .7fr)) 38px;
  gap: 8px;
}

.stock-document-line label {
  color: var(--muted);
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
}

.stock-product-combobox {
  min-width: 0;
  position: relative;
}

.stock-product-input-row {
  align-items: stretch;
  display: flex;
  gap: 6px;
  min-width: 0;
}

.stock-product-input-row > input {
  flex: 1 1 auto;
  min-width: 0;
}

.stock-product-catalog-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding-inline: 10px;
  white-space: nowrap;
}

.stock-product-search-results {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
  display: grid;
  gap: 2px;
  left: 0;
  max-height: 320px;
  min-width: min(520px, calc(100vw - 48px));
  overflow: auto;
  padding: 6px;
  position: absolute;
  right: auto;
  top: calc(100% + 6px);
  z-index: 260;
}

.stock-document-line .stock-product-search-results,
.stock-document-edit-row .stock-product-search-results {
  max-width: min(560px, calc(100vw - 48px));
  min-width: min(420px, calc(100vw - 48px));
}

.stock-product-search-results[hidden] {
  display: none;
}

.stock-product-search-results:empty {
  display: none;
}

@media (max-width: 760px) {
  .stock-product-input-row {
    align-items: stretch;
    flex-direction: column;
  }

  .stock-product-catalog-button {
    width: 100%;
  }
}

.stock-product-search-result,
.stock-product-create-inline,
.stock-search-empty button {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  text-align: left;
  width: 100%;
}

.stock-product-search-result strong {
  font-size: 13px;
  line-height: 1.25;
}

.stock-product-search-result span,
.stock-search-empty span,
.stock-search-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.stock-product-search-result:hover,
.stock-product-search-result.active {
  background: #fff1f2;
}

.stock-product-create-inline,
.stock-search-empty button {
  color: var(--accent-dark);
  font-weight: 800;
}

.stock-search-empty,
.stock-duplicate-warning {
  display: grid;
  gap: 6px;
  padding: 9px;
}

.stock-duplicate-warning {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  color: #9a3412;
}

.stock-duplicate-warning span {
  color: #9a3412;
  font-size: 12px;
}

.stock-quick-product-root {
  z-index: 300;
}

.stock-quick-product-modal {
  max-width: 90vw;
  width: min(820px, 90vw);
}

.stock-document-modal {
  max-width: 820px;
  overflow-x: hidden;
  width: min(820px, calc(100vw - 32px));
}

.stock-document-modal .modal-actions {
  bottom: 0;
  box-shadow: none;
  box-sizing: border-box;
  margin: 0;
  padding: 10px 0 0;
  width: 100%;
}

.stock-bulk-label-modal {
  max-width: calc(100vw - 32px);
  width: min(900px, calc(100vw - 32px));
}

.stock-bulk-label-toolbar {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, .8fr) auto;
}

.stock-bulk-label-list {
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: min(52vh, 520px);
  overflow-y: auto;
}

.stock-bulk-label-list-head,
.stock-bulk-label-row {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 22px minmax(220px, 1fr) 86px 110px 94px;
  min-width: 0;
  padding: 9px 12px;
}

.stock-bulk-label-list-head {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  position: sticky;
  text-transform: uppercase;
  top: 0;
  z-index: 1;
}

.stock-bulk-label-row {
  background: #fff;
}

.stock-bulk-label-row + .stock-bulk-label-row {
  border-top: 1px solid var(--border);
}

.stock-bulk-label-row:hover {
  background: #fff7f7;
}

.stock-bulk-label-check {
  align-items: center;
  cursor: pointer;
  display: inline-flex;
  height: 24px;
  justify-content: center;
  min-width: 22px;
  width: 22px;
}

.stock-bulk-label-check > input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
  height: 18px;
  margin: 0;
  min-width: 18px;
  width: 18px;
}

.stock-bulk-label-row.is-unselected {
  background: #f8fafc;
  color: var(--muted);
}

.stock-bulk-label-row.is-unselected .stock-bulk-label-copies {
  background: #eef2f7;
  cursor: not-allowed;
}

.stock-bulk-label-product {
  min-width: 0;
}

.stock-bulk-label-product strong,
.stock-bulk-label-product small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-bulk-label-product small {
  color: var(--muted);
  margin-top: 3px;
}

.stock-bulk-label-copies {
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 72px;
  padding: 8px;
  text-align: center;
}

.stock-bulk-label-summary {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-weight: 700;
  gap: 12px;
  justify-content: space-between;
  min-height: 24px;
}

.stock-bulk-label-summary .modal-error:empty {
  display: none;
}

.sticky-actions {
  background: rgba(255, 255, 255, 0.96);
  bottom: 0;
  position: sticky;
  z-index: 1;
}

@media (max-width: 900px) {
  .stock-drawer {
    width: 96vw;
    max-width: 96vw;
  }

  .stock-product-header {
    grid-template-columns: 1fr;
  }

  .stock-product-header-actions {
    justify-content: flex-start;
    max-width: none;
  }

  .stock-filter-panel,
  .stock-balances-layout,
  .stock-doc-filter,
  .stock-product-summary,
  .stock-product-grid,
  .price-label-workspace,
  .stock-document-line,
  .stock-document-edit-row,
  .stock-document-row,
  .stock-movement-row,
  .stock-settlement-summary,
  .stock-create-payment-fields {
    grid-template-columns: 1fr;
  }

  .stock-bulk-label-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .stock-bulk-label-toolbar .secondary-action {
    grid-column: 1 / -1;
  }

  .stock-bulk-label-list-head {
    display: none;
  }

  .stock-bulk-label-row {
    grid-template-columns: 22px minmax(0, 1fr) 86px;
  }

  .stock-bulk-label-row > span:nth-of-type(2),
  .stock-bulk-label-row > span:nth-of-type(3) {
    display: none;
  }

  .stock-filter-panel strong {
    justify-self: start;
  }
}

@page {
  margin: 0;
}

@media print {
  body.printing-labels > :not(#labelPrintRoot) {
    display: none !important;
  }

  body.printing-labels,
  body.printing-labels #labelPrintRoot {
    background: #fff !important;
    display: block !important;
    margin: 0 !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  body.printing-labels #labelPrintRoot .price-label-sheet.roll {
    display: block;
  }

  body.printing-labels #labelPrintRoot .price-label {
    break-inside: avoid;
    box-shadow: none;
    color: #000 !important;
    margin: 0;
    page-break-inside: avoid;
  }

  body.printing-labels #labelPrintRoot .price-label * {
    color: #000 !important;
  }

  body.printing-labels #labelPrintRoot .price-label-sheet.roll .price-label {
    page-break-after: always;
  }

  body.printing-labels #labelPrintRoot .price-label-sheet.roll .price-label:last-child {
    page-break-after: auto;
  }

  body.printing-labels #labelPrintRoot .price-label-sheet.a4 {
    box-shadow: none;
    display: flex;
    gap: 4mm;
    min-height: auto;
    padding: 6mm;
    width: 210mm;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 284px 1fr;
  background:
    radial-gradient(circle at top left, rgba(225, 38, 47, 0.08), transparent 32rem),
    linear-gradient(135deg, #f8fafc 0%, #f3f6fa 48%, #eef2f7 100%);
  color: var(--ink);
  font: 14px/1.45 Inter, "Segoe UI", Arial, sans-serif;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: 8px 0 28px rgba(29, 39, 53, 0.04);
}

.brand {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 16px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff4d55, #b70f18);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 14px 30px rgba(225, 38, 47, 0.25);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
}

.brand span,
.sync-box span,
.sync-box small,
#pageDescription {
  color: var(--muted);
  font-size: 12px;
}

.main-nav {
  display: grid;
  gap: 5px;
  overflow-y: auto;
  padding-right: 3px;
}

.main-nav a {
  position: relative;
  min-height: 42px;
  padding: 10px 12px 10px 14px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #4d5b6b;
  text-decoration: none;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.main-nav a::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 99px;
  background: transparent;
}

.main-nav svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  opacity: 0.92;
}

.main-nav span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-nav a:hover {
  color: var(--ink);
  background: #f7f9fc;
  border-color: var(--line);
  transform: translateX(2px);
}

.main-nav a.active {
  color: var(--accent-dark);
  background: linear-gradient(90deg, rgba(225, 38, 47, 0.12), rgba(225, 38, 47, 0.04));
  border-color: rgba(225, 38, 47, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 12px 28px rgba(225, 38, 47, 0.09);
}

.main-nav a.active::before {
  background: var(--accent);
}

.sync-box {
  margin-top: auto;
  padding: 14px;
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.sync-box strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.role-switcher {
  margin-bottom: 8px;
}

main {
  min-width: 0;
  padding: 28px;
  display: grid;
  align-content: start;
  gap: 20px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
}

/* Each workspace has its own controls; the global context header only repeated the active navigation item. */
.topbar[hidden] {
  display: none !important;
}

.topbar p,
.panel-head span,
.metrics span,
.page-head span,
.command-card span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.08;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

.filters {
  display: flex;
  align-items: end;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

input,
select,
textarea {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: none;
}

input,
select {
  height: 40px;
  min-width: 210px;
  padding: 0 12px;
}

textarea {
  min-height: 78px;
  padding: 10px 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(225, 38, 47, 0.55);
  box-shadow: 0 0 0 3px rgba(225, 38, 47, 0.11);
}

button {
  font: inherit;
}

.app-section {
  display: grid;
  gap: 16px;
}

.app-section[hidden],
[hidden] {
  display: none !important;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.primary-action,
.secondary-action,
.line-editor button,
.detail-actions button,
.ai-console button {
  height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(225, 38, 47, 0.55);
  border-radius: 10px;
  background: linear-gradient(135deg, #f0444d, #bd1621);
  color: #fff;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 10px 22px rgba(225, 38, 47, 0.16);
}

.secondary-action,
.detail-actions button:not(:first-child) {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
  box-shadow: none;
}

.primary-action:hover,
.line-editor button:hover,
.ai-console button:hover {
  filter: brightness(0.98);
  transform: translateY(-1px);
}

.command-strip,
.metrics,
.status-summary,
.dashboard-grid,
.attention-grid,
.repair-workspace,
.client-workspace,
.stock-grid,
.employee-grid,
.settings-grid,
.placeholder-grid {
  display: grid;
  gap: 14px;
}

.command-strip {
  grid-template-columns: 1.45fr 0.8fr 0.8fr;
}

.command-card,
.metrics article,
.panel,
.placeholder-card,
.status-tile {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
}

.command-card {
  min-height: 120px;
  padding: 18px;
  display: grid;
  align-content: space-between;
}

.command-card.primary {
  background: linear-gradient(135deg, #fff, #fff4f5 78%);
  border-color: rgba(225, 38, 47, 0.28);
}

.command-card strong {
  font-size: 34px;
  line-height: 1;
}

.command-card small,
.metrics small,
.compact-row span,
.compact-row small,
.task-row small,
.client-row small,
.rank-meta,
td,
.panel-note,
.detail-note {
  color: var(--muted);
}

.status-summary {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  overflow-x: auto;
}

.status-tile {
  min-height: 108px;
  padding: 14px;
  display: grid;
  align-content: space-between;
  border-top: 3px solid var(--line-strong);
}

.status-tile strong {
  font-size: 30px;
  line-height: 1;
}

.status-new { border-top-color: #94a3b8; }
.status-work { border-top-color: #0ea5e9; }
.status-approval { border-top-color: #8b5cf6; }
.status-decision { border-top-color: var(--warn); }
.status-parts { border-top-color: var(--accent); }
.status-ready { border-top-color: var(--good); }
.status-payment { border-top-color: var(--accent-2); }

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metrics article,
.panel,
.placeholder-card {
  padding: 18px;
}

.metrics article {
  display: grid;
  gap: 8px;
}

.metrics strong {
  font-size: 28px;
  line-height: 1.1;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.7fr) minmax(340px, 0.8fr);
}

.dashboard-grid-cash {
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
}

.topbar > .filters {
  display: none;
}

body[data-section="dashboard"] .topbar {
  display: none;
}

#dashboard {
  gap: 10px;
}

.dashboard-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 2px 0;
}

.dashboard-heading span,
.dashboard-heading p {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-heading h2,
.dashboard-heading p {
  margin: 3px 0 0;
}

.dashboard-heading h2 {
  font-size: 20px;
}

.dashboard-title-row {
  margin-top: 3px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.dashboard-title-row h2,
.dashboard-title-row p {
  margin: 0;
}

.dashboard-refresh {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  font-size: 20px;
}

.dashboard-heading-actions,
.dashboard-month-picker {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dashboard-month-picker {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.dashboard-month-picker .icon-button {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  font-size: 20px;
}

.dashboard-month-picker input[type="month"] {
  width: 138px;
  min-height: 30px;
  padding: 4px 7px;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--text);
}

@media (max-width: 760px) {
  .dashboard-heading { align-items: flex-start; }
  .dashboard-heading-actions { align-items: flex-end; flex-direction: column-reverse; }
  .dashboard-month-picker { flex-wrap: wrap; justify-content: flex-end; }
}

.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

body[data-role="administrator"] .dashboard-kpis,
body[data-role="master"] .dashboard-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-kpi {
  min-width: 0;
  min-height: 88px;
  padding: 12px 14px;
  display: grid;
  align-content: space-between;
  gap: 7px;
  border: 1px solid var(--line);
  border-left: 3px solid #64748b;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.dashboard-kpi.primary { border-left-color: var(--accent); }
.dashboard-kpi.debt { border-left-color: #d97706; }
.dashboard-kpi.cash { border-left-color: #0f766e; }
.dashboard-kpi[hidden] { display: none; }

.dashboard-kpi[data-dashboard-repair-filter],
.dashboard-kpi[data-dashboard-finance] {
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.dashboard-kpi[data-dashboard-repair-filter]:hover,
.dashboard-kpi[data-dashboard-repair-filter]:focus-visible,
.dashboard-kpi[data-dashboard-finance]:hover,
.dashboard-kpi[data-dashboard-finance]:focus-visible {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.dashboard-kpi span,
.dashboard-kpi small {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-kpi strong {
  font-size: 28px;
  line-height: 1;
}

.dashboard-statuses {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
  gap: 8px;
}

.owner-dashboard-statuses {
  grid-template-columns: repeat(8, minmax(104px, 1fr));
}

.owner-attention-panel {
  border-left: 3px solid #d97706;
}

.owner-attention-panel .panel-head > small,
.owner-capacity-panel .panel-head > small {
  color: var(--muted);
}

.dashboard-status-today {
  border-top-color: #64748b;
}

.dashboard-status {
  min-width: 0;
  min-height: 72px;
  padding: 9px 11px;
  display: grid;
  align-content: space-between;
  gap: 4px;
  text-align: left;
  border: 1px solid var(--line);
  border-top: 2px solid #94a3b8;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.dashboard-status[data-dashboard-repair-filter] { cursor: pointer; }
.dashboard-status[data-dashboard-repair-filter]:hover { border-color: #cbd5e1; background: #f8fafc; }
.dashboard-status-work { border-top-color: #2563eb; }
.dashboard-status-approval { border-top-color: #ca8a04; }
.dashboard-status-parts { border-top-color: #ea580c; }
.dashboard-status-ready, .dashboard-status-issued { border-top-color: #16a34a; }
.dashboard-status-problems { border-top-color: #dc2626; }

.dashboard-status span,
.dashboard-status small {
  color: var(--muted);
  font-size: 11px;
}

.dashboard-status strong {
  font-size: 23px;
  line-height: 1;
}

.dashboard-owner-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(420px, 1.2fr);
  gap: 10px;
}

.dashboard-owner-grid .panel,
.dashboard-attention-panel {
  padding: 12px 14px;
  border-radius: 8px;
}

.dashboard-owner-grid .panel {
  min-height: 212px;
  height: auto;
  overflow: visible;
}

.dashboard-owner-grid .panel-head,
.dashboard-attention-panel .panel-head {
  margin-bottom: 9px;
}

.dashboard-cash-panel .cash-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.dashboard-cash-panel .cash-main,
.dashboard-cash-panel .panel-note {
  grid-column: 1 / -1;
}

.dashboard-cash-panel .cash-main {
  min-height: 54px;
  padding: 8px 12px;
}

.dashboard-cash-panel .cash-row:not(.cash-main) {
  min-height: 40px;
  padding: 6px 8px;
  display: grid;
  gap: 1px;
}

.dashboard-cash-panel .cash-row:not(.cash-main) strong {
  font-size: 15px;
}

.dashboard-cash-panel button.cash-row {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, transform .16s ease;
}

.dashboard-cash-panel button.cash-row:hover,
.dashboard-cash-panel button.cash-row:focus-visible {
  border-color: rgba(225, 38, 47, .36);
  background: #fff8f8;
  outline: none;
  transform: translateY(-1px);
}

.dashboard-cash-panel .panel-note {
  margin: 0;
  font-size: 11px;
}

.dashboard-debt-panel .panel-head > strong {
  font-size: 20px;
  color: #b45309;
}

.dashboard-debt-list {
  display: grid;
  gap: 4px;
  max-height: 150px;
  padding-right: 4px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.dashboard-debt-row {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 0;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.dashboard-debt-row:hover { background: #fff7ed; }
.dashboard-debt-row > span { min-width: 0; display: grid; gap: 2px; }
.dashboard-debt-row small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-debt-row b { flex: 0 0 auto; color: #b45309; }

.dashboard-attention-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-attention-item {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.dashboard-attention-item:hover { border-color: #cbd5e1; background: #fff; transform: translateY(-1px); }

.dashboard-attention-item strong {
  grid-row: 1 / 3;
  font-size: 24px;
}

.dashboard-attention-item span { font-weight: 700; }
.dashboard-attention-item small { color: var(--muted); }
.dashboard-attention-item.needs-attention { border-color: #fed7aa; background: #fff7ed; }
.dashboard-attention-item.needs-attention strong { color: #c2410c; }
.dashboard-attention-item.is-clear strong { color: var(--good); }

.dashboard-attention-modal {
  width: min(760px, 92vw);
  max-height: min(720px, 88vh);
}

.dashboard-attention-list {
  min-height: 120px;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 2px 16px 16px;
  overflow-y: auto;
}

.dashboard-attention-repair {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.dashboard-attention-repair:hover { border-color: #f4b7ba; background: #fff7f7; }
.dashboard-attention-repair > span { min-width: 0; display: grid; gap: 2px; }
.dashboard-attention-repair small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-attention-repair-meta { flex: 0 0 auto; max-width: 220px; text-align: right; }

.planning-dashboard-panel { padding: 12px 14px; border-radius: 8px; }

.dashboard-team-capacity {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 14px;
}

.dashboard-capacity-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(150px, .9fr) minmax(120px, 1fr) 48px;
  align-items: center;
  gap: 9px;
}

.dashboard-capacity-row > span { min-width: 0; display: grid; gap: 1px; }
.dashboard-capacity-row > span strong,
.dashboard-capacity-row > span small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-capacity-row > span small { color: var(--muted); font-size: 11px; }
.dashboard-capacity-row > div { height: 7px; overflow: hidden; border-radius: 4px; background: #e2e8f0; }
.dashboard-capacity-row > div i { display: block; height: 100%; border-radius: inherit; background: #2563eb; }
.dashboard-capacity-row > b { text-align: right; }

.dashboard-planning-queue { display: grid; gap: 6px; }

.dashboard-planning-item {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) minmax(180px, .55fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.dashboard-planning-item:hover { border-color: #f4b7ba; background: #fff8f8; }
.dashboard-planning-item.is-next { border-left: 3px solid var(--accent); }
.dashboard-planning-item.is-risk { border-color: #fdba74; background: #fff7ed; }
.dashboard-planning-item .queue-number { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: #f1f5f9; font-weight: 800; }
.dashboard-planning-item > span { min-width: 0; display: grid; gap: 2px; }
.dashboard-planning-item > span:last-child { text-align: right; }
.dashboard-planning-item small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

body[data-role="master"] .master-dashboard-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.repair-workflow-stage {
  display: block;
  margin-top: 4px;
  color: #9a3412;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}
body[data-role="manager"] .manager-dashboard-kpis { grid-template-columns: repeat(8, minmax(0, 1fr)); }
body[data-role="administrator"] .administrator-dashboard-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.manager-dashboard-kpis .dashboard-kpi {
  min-height: 82px;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.manager-dashboard-kpis .dashboard-kpi:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.manager-dashboard-workspace {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(330px, .75fr);
  gap: 10px;
  align-items: start;
}

.manager-team-panel,
.manager-process-panel,
.manager-analytics-panel,
.manager-optional-panel {
  min-width: 0;
  padding: 12px 14px;
  border-radius: 8px;
}

.manager-team-panel .panel-head,
.manager-process-panel .panel-head,
.manager-analytics-panel .panel-head,
.manager-optional-panel .panel-head { margin-bottom: 8px; }
.manager-team-panel .panel-head small { color: var(--muted); }

.manager-employee-load { min-width: 0; }
.manager-employee-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.manager-employee-table th { padding: 5px 7px; color: var(--muted); font-size: 10px; text-align: center; text-transform: uppercase; }
.manager-employee-table th:first-child { width: 28%; text-align: left; }
.manager-employee-table td { padding: 7px; border-top: 1px solid var(--line); text-align: center; }
.manager-employee-table td:first-child { min-width: 0; text-align: left; }
.manager-employee-table td:first-child strong,
.manager-employee-table td:first-child small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manager-employee-table td:first-child small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.manager-table-metric {
  min-width: 34px;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.manager-table-metric:hover { border-color: #cbd5e1; background: #fff; }
.manager-table-metric.is-danger { background: #fee2e2; color: #b91c1c; }

.manager-process-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.manager-process-item {
  min-width: 0;
  min-height: 70px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.manager-process-item strong { grid-row: 1 / 3; font-size: 22px; }
.manager-process-item span { font-weight: 750; line-height: 1.2; }
.manager-process-item small { color: var(--muted); line-height: 1.25; }
.manager-process-item.needs-attention { border-color: #fed7aa; background: #fff7ed; }
.manager-process-item.needs-attention strong { color: #c2410c; }
.manager-process-item.is-clear strong { color: var(--good); }

.manager-analytics-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 7px;
}
.manager-analytics-grid > div { min-width: 0; padding: 9px 10px; display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 7px; background: #f8fafc; }
.manager-analytics-grid span,
.manager-analytics-grid small { color: var(--muted); font-size: 11px; }
.manager-analytics-grid strong { font-size: 18px; }

.master-next-repair {
  min-width: 0;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
}

.master-next-repair.is-empty { border-left-color: #94a3b8; }
.master-next-repair.priority-critical { border-left-color: #dc2626; background: #fffafa; }
.master-next-repair.priority-high { border-left-color: #d97706; }
.master-next-copy { min-width: 0; display: grid; gap: 4px; }
.master-next-copy > span { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.master-next-copy h2 { font-size: 20px; overflow-wrap: anywhere; }
.master-next-copy p,
.master-next-copy small { margin: 0; }
.master-next-copy p { font-weight: 700; }
.master-next-copy small { color: var(--muted); }
.master-next-actions { flex: 0 0 auto; display: flex; gap: 8px; }

.master-priority-badge {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.master-priority-badge.priority-critical { background: #fee2e2; color: #b91c1c; }
.master-priority-badge.priority-high { background: #ffedd5; color: #c2410c; }
.master-priority-badge.priority-complex { background: #ede9fe; color: #6d28d9; }

.master-dashboard-workspace {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr);
  gap: 10px;
  align-items: start;
}

.master-queue-panel,
.master-action-panel,
.master-waiting-panel,
.master-results-panel { min-width: 0; padding: 12px 14px; border-radius: 8px; }
.master-dashboard-workspace .panel-head,
.master-results-panel .panel-head { margin-bottom: 8px; }
.master-dashboard-workspace .panel-head > small,
.master-results-panel .panel-head > small { color: var(--muted); }
.master-dashboard-side { min-width: 0; display: grid; gap: 10px; }

.master-queue-table-wrap { min-width: 0; }
.master-queue-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.master-queue-table th { padding: 5px 7px; color: var(--muted); font-size: 10px; text-align: left; text-transform: uppercase; }
.master-queue-table td { min-width: 0; padding: 7px; border-top: 1px solid var(--line); vertical-align: middle; }
.master-queue-table th:nth-child(1) { width: 92px; }
.master-queue-table th:nth-child(2) { width: 112px; }
.master-queue-table th:nth-child(4) { width: 112px; }
.master-queue-table th:nth-child(5) { width: 150px; }
.master-queue-table th:nth-child(6) { width: 82px; }
.master-queue-table td > strong,
.master-queue-table td > small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.master-queue-table td > small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.master-queue-table tr.is-risk td { background: #fff7ed; }

.master-action-list,
.master-waiting-list { display: grid; gap: 5px; }
.master-action-row,
.master-waiting-row {
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.master-action-row:hover,
.master-waiting-row:hover { border-color: #cbd5e1; background: #fff; }
.master-action-row.is-overdue { border-color: #fecaca; background: #fff7f7; }
.master-action-row > span,
.master-waiting-row > span { min-width: 0; display: grid; gap: 2px; }
.master-action-row strong,
.master-action-row small,
.master-waiting-row strong,
.master-waiting-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.master-action-row small,
.master-waiting-row small { color: var(--muted); font-size: 11px; }
.master-action-row time { flex: 0 0 auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.master-action-row.is-overdue time { color: #b91c1c; font-weight: 700; }

.master-results-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.master-results-grid > div { min-width: 0; padding: 9px 11px; display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 7px; background: #f8fafc; }
.master-results-grid span,
.master-results-grid small { color: var(--muted); font-size: 11px; }
.master-results-grid strong { font-size: 20px; }
.empty-state.compact.success { color: #15803d; background: #f0fdf4; border-color: #bbf7d0; }

.attention-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.repair-workspace,
.client-workspace {
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.95fr);
}

.client-workspace {
  grid-template-columns: minmax(0, 1fr);
}

.repairs-list-panel {
  min-width: 0;
}

.repair-filter-panel {
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(160px, 0.7fr) minmax(140px, 0.6fr) minmax(150px, 0.7fr) auto;
  align-items: end;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
}

.repair-filter-panel input,
.repair-filter-panel select {
  width: 100%;
  min-width: 0;
}

body[data-section="clients"] .topbar .filters {
  display: none;
}

.compact-head {
  align-items: center;
}

.client-filter-panel {
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(260px, auto) minmax(170px, 0.7fr) auto;
  align-items: end;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.client-filter-panel input,
.client-filter-panel select {
  width: 100%;
}

.segmented-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented-filter button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.segmented-filter button:hover,
.segmented-filter button.active {
  border-color: rgba(225, 38, 47, 0.32);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.repair-status-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.repair-active-selection {
  width: max-content;
  max-width: 100%;
  min-height: 34px;
  padding: 5px 6px 5px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(225, 38, 47, 0.25);
  border-radius: 8px;
  background: #fff7f7;
  color: var(--muted);
  font-size: 12px;
}

.repair-active-selection strong {
  color: var(--accent-dark);
  font-size: 13px;
}

.repair-active-selection .icon-button {
  width: 24px;
  height: 24px;
  min-height: 24px;
  border: 0;
  background: transparent;
}

.repair-status-chip {
  min-width: max-content;
  min-height: 34px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  box-shadow: none;
}

.repair-status-chip strong {
  min-width: 26px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
  text-align: center;
}

.repair-status-chip:hover,
.repair-status-chip.active {
  border-color: rgba(225, 38, 47, 0.3);
  background: #fff7f7;
  color: var(--accent-dark);
}

.repair-status-chip.active strong {
  background: var(--accent);
  color: #fff;
}

.status-tone-blue { border-color: rgba(37, 99, 235, 0.25); }
.status-tone-blue strong { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; }
.status-tone-violet { border-color: rgba(124, 58, 237, 0.24); }
.status-tone-violet strong { background: rgba(124, 58, 237, 0.12); color: #6d28d9; }
.status-tone-yellow { border-color: rgba(202, 138, 4, 0.24); }
.status-tone-yellow strong { background: rgba(234, 179, 8, 0.18); color: #854d0e; }
.status-tone-orange { border-color: rgba(249, 115, 22, 0.24); }
.status-tone-orange strong { background: rgba(249, 115, 22, 0.14); color: #9a3412; }
.status-tone-dark-orange { border-color: rgba(194, 65, 12, 0.26); }
.status-tone-dark-orange strong { background: rgba(194, 65, 12, 0.14); color: #7c2d12; }
.status-tone-green { border-color: rgba(22, 163, 74, 0.24); }
.status-tone-green strong { background: rgba(22, 163, 74, 0.13); color: #15803d; }
.status-tone-teal { border-color: rgba(13, 148, 136, 0.24); }
.status-tone-teal strong { background: rgba(13, 148, 136, 0.13); color: #0f766e; }
.status-tone-gray strong,
.status-tone-neutral strong { background: #eef2f7; color: #475569; }
.status-tone-dark-gray strong { background: #e2e8f0; color: #334155; }
.status-tone-red strong { background: rgba(225, 38, 47, 0.12); color: var(--accent-dark); }
.status-tone-burgundy strong { background: rgba(136, 19, 55, 0.12); color: #881337; }
.status-tone-light-gray strong { background: #f1f5f9; color: #64748b; }

.repair-empty-toggle {
  display: none;
}

.stock-grid,
.employee-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.import-wizard {
  display: grid;
  gap: 14px;
}

.import-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.import-steps span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.import-steps span.active {
  border-color: rgba(225, 38, 47, 0.28);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.import-upload {
  padding: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.import-limit-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.import-limit-panel input {
  width: 100%;
}

.import-orders-field {
  grid-column: 1 / -1;
}

.import-upload div,
.import-session-row {
  min-width: 0;
}

.import-upload strong,
.import-upload small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.import-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #f59e0b);
  transition: width 0.18s ease;
}

.import-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.import-metrics article {
  padding: 10px;
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.import-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.import-metrics strong {
  font-size: 15px;
}

.import-columns,
.import-alert,
.import-report,
.import-history {
  padding: 12px;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.import-columns div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.import-columns span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f3f6fa;
  color: var(--muted);
  font-size: 12px;
}

.import-alert {
  border-color: rgba(245, 158, 11, 0.32);
  background: #fffbeb;
  color: #8a5600;
}

.settings-list > .settings-import-row > .import-columns,
.settings-list > .settings-import-row > .mini-list {
  display: none;
}

.placeholder-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.placeholder-card {
  min-height: 156px;
  display: grid;
  align-content: start;
  gap: 10px;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.placeholder-card:hover {
  transform: translateY(-2px);
  border-color: rgba(225, 38, 47, 0.28);
  background: #fff8f8;
}

.placeholder-card span {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
}

.placeholder-card p {
  margin: 0;
  color: var(--muted);
}

.placeholder-card.wide {
  grid-column: span 2;
}

.panel-head,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.cash-summary,
.control-summary,
.legend-list,
.compact-list,
.task-list,
.client-list,
.rank-list,
.master-list,
.settings-list,
.mini-list,
.inventory-list {
  display: grid;
  gap: 10px;
}

.cash-row,
.control-row,
.compact-row,
.task-row,
.client-row,
.master-row,
.mini-row,
.settings-row,
.detail-list div,
.inventory-row,
.employee-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.cash-row,
.control-row {
  min-height: 50px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cash-main {
  min-height: 66px;
  background: linear-gradient(135deg, #fff, #fff0f1);
  border-color: rgba(225, 38, 47, 0.24);
}

.cash-row strong,
.control-row strong {
  font-size: 18px;
  white-space: nowrap;
}

.cash-main strong {
  font-size: 28px;
}

.finance-workspace {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.finance-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.finance-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.finance-expense-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.finance-expense-list {
  overflow: hidden;
}

.finance-expense-head,
.finance-expense-row {
  display: grid;
  grid-template-columns: 110px minmax(220px, 1.4fr) minmax(180px, 1fr) minmax(110px, .7fr) 120px;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
}

.finance-expense-head {
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.finance-expense-row {
  border-bottom: 1px solid var(--line-soft, #edf0f3);
}

.finance-expense-row:last-child { border-bottom: 0; }
.finance-expense-row > div { display: grid; gap: 3px; min-width: 0; }
.finance-expense-row small { color: var(--muted); }
.finance-expense-row > strong:last-child { text-align: right; }
.finance-expense-row.is-cancelled { opacity: .55; text-decoration: line-through; }

.cash-access-form { min-width: 0; width: 100%; }
.cash-access-list { display: grid; gap: 12px; max-height: 58vh; overflow: auto; padding-right: 4px; }
.cash-access-employee { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cash-access-employee-head { align-items: center; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; padding: 11px 12px; background: #f8fafc; }
.cash-access-employee-head > div { display: grid; gap: 3px; }
.cash-access-employee-head small { color: var(--muted); }
.cash-access-presets { align-items: center; display: flex !important; flex-direction: row; gap: 6px !important; }
.cash-access-presets button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 8px;
}
.cash-access-presets button:hover { border-color: rgba(211, 47, 47, .35); color: var(--accent); }
.cash-access-grid {
  display: grid;
  grid-template-columns: minmax(170px, 1.5fr) repeat(5, minmax(68px, .55fr));
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 7px 12px;
  border-top: 1px solid var(--line);
}
.cash-access-grid-head { border-top: 0; color: var(--muted); font-size: 11px; font-weight: 800; }
.cash-access-check { cursor: pointer; display: grid; place-items: center; }
.cash-access-check input {
  appearance: none;
  background: #cbd5e1;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  height: 20px;
  margin: 0;
  position: relative;
  transition: background .16s ease;
  width: 36px;
}
.cash-access-check input::after {
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .28);
  content: "";
  height: 16px;
  left: 2px;
  position: absolute;
  top: 2px;
  transition: transform .16s ease;
  width: 16px;
}
.cash-access-check input:checked { background: var(--accent); }
.cash-access-check input:checked::after { transform: translateX(16px); }
.cash-access-check input:disabled { cursor: not-allowed; opacity: .45; }

.directory-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}

.directory-tabs button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
}

.directory-tabs button:hover,
.directory-tabs button.active {
  border-color: rgba(211, 47, 47, 0.35);
  background: rgba(211, 47, 47, 0.08);
  color: var(--accent);
}

.directory-panel[hidden] {
  display: none;
}

.directory-toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.directory-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.directory-toolbar input,
.directory-toolbar select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
}

.directory-toolbar input {
  min-width: min(420px, 72vw);
}

.directory-list {
  display: grid;
  gap: 8px;
}

.directory-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.directory-row div {
  display: grid;
  gap: 4px;
}

.directory-row small {
  color: var(--muted);
}

.work-directory-row.is-archived {
  background: #f8fafc;
  opacity: .78;
}

.directory-row .directory-row-main,
.directory-row .directory-row-side {
  min-width: 0;
}

.directory-row .directory-row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.directory-row-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.directory-origin {
  flex: none;
  padding: 2px 6px;
  border-radius: 5px;
  background: #eef2f7;
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.directory-origin.is-manual {
  background: #e8f7ee;
  color: #187747;
}

.directory-row-description {
  overflow: hidden;
  max-width: 760px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-row .directory-row-side {
  justify-items: end;
  text-align: right;
}

.directory-row .directory-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
}

.work-catalog-modal {
  width: min(860px, calc(100vw - 32px));
}

.work-catalog-source-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.work-catalog-source-note strong {
  color: var(--text);
}

@media (max-width: 700px) {
  .work-directory-row {
    grid-template-columns: 1fr;
  }

  .directory-row .directory-row-side {
    justify-items: start;
    text-align: left;
  }

  .directory-row .directory-row-actions {
    justify-content: flex-start;
  }

  .work-catalog-source-note {
    align-items: flex-start;
    flex-direction: column;
  }
}

.finance-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.finance-branch-summary {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 10px;
}

.finance-branch-summary > * {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
}

.finance-branch-summary span,
.finance-branch-summary small {
  display: block;
  color: var(--muted);
}

.finance-branch-summary strong {
  display: block;
  margin: 6px 0;
  font-size: 24px;
}

.finance-branch-summary small {
  line-height: 1.45;
}

.finance-branch-total {
  border-color: rgba(225, 38, 47, 0.24);
  background: #fff7f7;
}

.finance-money-group {
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.finance-money-group:hover {
  border-color: rgba(225, 38, 47, 0.3);
  background: #fffafa;
}

.finance-secondary-kpis {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.finance-summary-grid article {
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.finance-summary-grid-work article {
  display: grid;
  align-content: space-between;
  gap: 7px;
}

.finance-kpi-main {
  border-color: rgba(225, 38, 47, 0.22);
  background: linear-gradient(135deg, #fff, #fff6f6);
}

.finance-summary-grid span,
.finance-toolbar span,
.cashbox-card span {
  color: var(--muted);
  font-size: 12px;
}

.finance-summary-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
}

.finance-summary-grid small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.finance-tabs {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.finance-tabs button,
.cashbox-card-actions button {
  border: 1px solid transparent;
  border-radius: 10px;
  background: #f4f6f8;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.finance-tabs button {
  padding: 9px 13px;
  font-weight: 800;
}

.finance-tabs button:hover,
.finance-tabs button.active,
.secondary-action.is-active,
.cashbox-card-actions button:hover {
  border-color: rgba(225, 38, 47, 0.24);
  background: #fff4f4;
  color: var(--accent-dark);
}

.owner-reports {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.report-filterbar {
  display: grid;
  grid-template-columns: 142px 142px minmax(180px, 1fr) 140px 150px auto;
  gap: 9px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.report-filterbar label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.report-filterbar label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.report-filterbar input,
.report-filterbar select {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.report-filter-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}

.report-filter-actions button { min-height: 38px; white-space: nowrap; }

.report-section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.report-section-tabs button {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.report-section-tabs button:hover,
.report-section-tabs button.active {
  border-color: rgba(225, 38, 47, .28);
  background: #fff4f4;
  color: var(--accent-dark);
}

.report-content { display: grid; gap: 12px; min-width: 0; }

.report-catalog-search {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.report-catalog-search label { display: grid; flex: 1; gap: 5px; }
.report-catalog-search label > span,
.report-catalog-search > small { color: var(--muted); font-size: 11px; }
.report-catalog-search input {
  width: min(560px, 100%);
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.inventory-report-toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.inventory-report-toolbar label {
  display: grid;
  min-width: min(420px, 100%);
  gap: 5px;
}

.inventory-report-toolbar label > span,
.inventory-report-toolbar > small {
  color: var(--muted);
  font-size: 11px;
}

.inventory-report-toolbar select {
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.inventory-report-toolbar > small {
  margin: 0 0 10px auto;
}

.product-credit-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.product-credit-card.success { border-color: #86efac; background: #f6fff9; }
.product-credit-card.danger { border-color: #fca5a5; background: #fff7f7; }
.product-credit-card > div { display: grid; gap: 4px; }
.product-credit-card > div > span,
.product-credit-card small,
.product-credit-card label > span { color: var(--muted); font-size: 11px; }
.product-credit-card > div > strong { font-size: 18px; }
.product-credit-card label { display: grid; min-width: 250px; gap: 4px; }
.product-credit-card label > div { display: flex; align-items: center; gap: 7px; }
.product-credit-card input { width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.product-credit-card b { font-size: 15px; }

.report-line-chart { min-width: 0; padding: 12px 14px 8px; }
.report-line-chart svg { display: block; width: 100%; height: auto; max-height: 260px; overflow: hidden; }
.report-chart-grid { stroke: #e9edf2; stroke-width: 1; vector-effect: non-scaling-stroke; }
.report-chart-zero { stroke: #9ca3af; stroke-width: 1; vector-effect: non-scaling-stroke; }
.report-chart-line { fill: none; stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.report-chart-line.revenue { stroke: #dc2626; }
.report-chart-line.margin { stroke: #0f766e; }
.report-chart-hit { fill: transparent; cursor: pointer; }
.report-chart-dot { stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.report-chart-dot.revenue { fill: #dc2626; }
.report-chart-dot.margin { fill: #0f766e; }
.report-chart-day:hover .report-chart-hit,
.report-chart-day:focus .report-chart-hit { fill: rgba(225, 38, 47, .05); }
.report-chart-day:focus { outline: none; }
.report-chart-day:hover .report-chart-dot,
.report-chart-day:focus .report-chart-dot { r: 5; }
.report-chart-axis-label,
.report-chart-date-label { fill: #718096; font-size: 10px; }
.report-line-chart > p { margin: 3px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.report-chart-legend { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 11px; }
.report-chart-legend span::before { content: ""; display: inline-block; width: 18px; height: 3px; margin-right: 6px; border-radius: 2px; vertical-align: middle; }
.report-chart-legend .revenue::before { background: #dc2626; }
.report-chart-legend .margin::before { background: #0f766e; }
.report-negative { color: #b91c1c; }

.settings-documents-workspace { display: grid; gap: 12px; }
.document-template-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 4px 2px 2px; }
.document-template-head span { color: var(--accent); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.document-template-head h2 { margin: 3px 0; font-size: 20px; }
.document-template-head p { margin: 0; color: var(--muted); font-size: 12px; }
.document-template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.document-template-card { display: flex; min-height: 122px; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.document-template-card.is-ready { border-color: #fecaca; box-shadow: inset 3px 0 0 var(--accent); }
.document-template-card > div { display: grid; gap: 6px; }
.document-template-card strong { font-size: 15px; }
.document-template-card p { max-width: 460px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.document-format { width: max-content; padding: 3px 7px; border-radius: 4px; background: #f3f4f6; color: #6b7280; font-size: 10px; font-weight: 700; }
.document-template-card.is-ready .document-format { background: #fff1f2; color: #be123c; }
.document-legal-note { padding: 14px 16px; border: 1px solid #dbeafe; border-radius: 8px; background: #f8fbff; }
.document-legal-note strong { display: block; margin-bottom: 5px; }
.document-legal-note p { margin: 0; color: #526176; font-size: 12px; line-height: 1.5; }

@media (max-width: 900px) {
  .document-template-grid { grid-template-columns: 1fr; }
  .inventory-report-toolbar { align-items: stretch; flex-direction: column; }
  .inventory-report-toolbar label { min-width: 0; }
  .inventory-report-toolbar > small { margin: 0; }
}

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.report-kpi-grid.compact { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.report-kpi {
  display: grid;
  align-content: space-between;
  gap: 5px;
  min-height: 96px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.report-kpi span,
.report-kpi small { color: var(--muted); font-size: 11px; }
.report-kpi strong { font-size: 21px; line-height: 1.1; }
.report-kpi.accent { border-color: #bfdbfe; background: #f7fbff; }
.report-kpi.success { border-color: #bbf7d0; background: #f6fff9; }
.report-kpi.danger { border-color: #fecaca; background: #fff7f7; }

.report-two-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
  gap: 12px;
}

.report-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.report-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft, #edf0f3);
}

.report-panel-head > div { display: grid; gap: 2px; }
.report-panel-head span,
.report-panel-head small { color: var(--muted); font-size: 11px; }

.report-pnl,
.report-control-list { display: grid; padding: 6px 14px 10px; }
.report-pnl > div,
.report-control-list > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft, #edf0f3);
}
.report-pnl > div:last-child,
.report-control-list > div:last-child { border-bottom: 0; }
.report-pnl .total { margin-top: 4px; padding-top: 12px; font-size: 16px; }

.report-table-wrap { width: 100%; overflow: auto; }
.report-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.report-table th {
  padding: 8px 10px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 10px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.report-table td { padding: 9px 10px; border-top: 1px solid var(--line-soft, #edf0f3); vertical-align: middle; }
.report-table td small { display: block; margin-top: 2px; color: var(--muted); }
.report-table tr.action-row { cursor: pointer; }
.report-table tr.action-row:hover { background: #fff8f8; }
.report-table tr.action-row:focus { outline: 2px solid rgba(225, 38, 47, .28); outline-offset: -2px; }
.report-empty { padding: 18px !important; color: var(--muted); text-align: center !important; }

.modal.report-day-modal { box-sizing: border-box; width: min(1040px, calc(100vw - 32px)); max-height: min(820px, calc(100vh - 32px)); overflow: hidden; }
body.report-operation-open #modalRoot { z-index: 90; }
body.report-operation-open #modalRoot .modal-backdrop { z-index: 90; }
body.report-operation-open #modalRoot .report-day-modal { z-index: 95; }
.report-day-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft, #edf0f3); }
.report-day-summary > div { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.report-day-summary span,
.report-day-summary small { color: var(--muted); font-size: 11px; }
.report-day-summary strong { font-size: 19px; }
.card-reconciliation-note { margin: 10px 14px; padding: 11px 13px; border: 1px solid #fde68a; border-radius: 8px; background: #fffbeb; color: #92400e; font-size: 12px; }
.card-reconciliation-form { display: grid; gap: 12px; margin: 12px 14px; padding: 14px; border: 1px solid #fecaca; border-radius: 10px; background: #fffafa; }
.card-reconciliation-form.is-reconciled { border-color: #bbf7d0; background: #f7fff9; }
.card-reconciliation-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.card-reconciliation-head > div { display: grid; gap: 3px; }
.card-reconciliation-head span { color: #c91924; font-size: 10px; font-weight: 800; letter-spacing: .06em; }
.card-reconciliation-form.is-reconciled .card-reconciliation-head span { color: #15803d; }
.card-reconciliation-head strong { font-size: 14px; }
.card-reconciliation-head small { color: var(--muted); font-size: 11px; text-align: right; }
.card-reconciliation-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.card-reconciliation-result { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.card-reconciliation-result > span { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 7px; background: rgba(255,255,255,.84); color: var(--muted); font-size: 11px; }
.card-reconciliation-result b { color: var(--ink); font-size: 13px; white-space: nowrap; }
.card-reconciliation-result b.money-good { color: #15803d; }
.card-reconciliation-result b.money-bad { color: #c91924; }
.card-reconciliation-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.report-day-modal:has(.card-reconciliation-form) .report-operation-list { max-height: min(300px, max(160px, calc(100vh - 590px))); }
.report-day-loading { padding: 32px; color: var(--muted); text-align: center; }
.report-operation-type { display: inline-flex; padding: 3px 7px; border-radius: 5px; background: #eff6ff; color: #1d4ed8; font-size: 10px; font-weight: 800; }
.report-operation-type.sale { background: #f0fdf4; color: #15803d; }
.report-operation-list {
  display: grid;
  max-height: min(510px, calc(100vh - 310px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.report-operation-row {
  display: grid;
  grid-template-columns: 110px minmax(210px, 1.5fr) minmax(150px, 1fr) 112px 112px;
  gap: 12px;
  align-items: center;
  min-width: 0;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line-soft, #edf0f3);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.report-operation-row.card-payment { grid-template-columns: 110px minmax(180px, 1.35fr) minmax(150px, 1fr) repeat(3, 108px); }
.report-operation-row:hover { background: #fff8f8; }
.report-operation-row:focus-visible { position: relative; outline: 2px solid rgba(225, 38, 47, .35); outline-offset: -2px; }
.report-operation-row > span { min-width: 0; }
.report-operation-time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.report-operation-main,
.report-operation-party,
.report-operation-money { display: grid; gap: 3px; }
.report-operation-main > span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.report-operation-main strong,
.report-operation-party strong,
.report-operation-money strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-operation-main small,
.report-operation-party small,
.report-operation-money small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.report-operation-money { justify-items: end; text-align: right; }
.dashboard-cash-today-modal { width: min(980px, calc(100vw - 32px)); }
.report-operation-row.dashboard-cash-operation { grid-template-columns: 110px minmax(240px, 1.4fr) minmax(180px, 1fr) minmax(170px, .8fr); }
.report-operation-row.dashboard-cash-operation.is-static { cursor: default; }
.report-operation-row.dashboard-cash-operation.is-static:hover { background: #fff; }
.dashboard-cash-limit-note { padding: 8px 14px; }

@media (max-width: 900px) {
  .report-operation-row.dashboard-cash-operation { grid-template-columns: 86px minmax(210px, 1fr) minmax(160px, .85fr); }
  .report-operation-row.dashboard-cash-operation .report-operation-party { grid-column: 2; }
  .report-operation-row.dashboard-cash-operation .report-operation-money { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
  .report-operation-row,
  .report-operation-row.card-payment { grid-template-columns: 86px minmax(180px, 1fr) repeat(2, 100px); }
  .report-operation-row .report-operation-party { grid-column: 2; }
  .report-operation-row.card-payment .report-operation-party { grid-column: 2; }
  .report-operation-row.card-payment .report-operation-money:nth-last-child(3) { grid-column: 3; grid-row: 1; }
  .report-operation-row.card-payment .report-operation-money:nth-last-child(2) { grid-column: 3; grid-row: 2; }
  .report-operation-row.card-payment .report-operation-money:last-child { grid-column: 4; grid-row: 1 / span 2; align-self: center; }
}

@media (max-width: 700px) {
  .report-day-summary { grid-template-columns: 1fr; }
  .modal.report-day-modal { overflow-y: auto; }
  .card-reconciliation-head { display: grid; }
  .card-reconciliation-head small { text-align: left; }
  .card-reconciliation-fields,
  .card-reconciliation-result,
  .card-reconciliation-actions { grid-template-columns: 1fr; }
  .card-reconciliation-result > span { min-height: 36px; }
  .card-reconciliation-actions button { width: 100%; }
  .report-day-modal:has(.card-reconciliation-form) .report-operation-list { max-height: none; overflow: visible; }
  .report-operation-list { max-height: calc(100vh - 420px); }
  .report-operation-row,
  .report-operation-row.card-payment { grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 11px 12px; }
  .report-operation-row.dashboard-cash-operation { grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 11px 12px; }
  .report-operation-row.dashboard-cash-operation .report-operation-party { grid-column: 1 / -1; grid-row: 3; }
  .report-operation-row.dashboard-cash-operation .report-operation-money { grid-column: 1 / -1; grid-row: 4; justify-items: start; text-align: left; }
  .report-operation-time { grid-column: 1; grid-row: 1; }
  .report-operation-main { grid-column: 1 / -1; grid-row: 2; }
  .report-operation-party,
  .report-operation-row.card-payment .report-operation-party { grid-column: 1 / -1; grid-row: 3; }
  .report-operation-money { justify-items: start; text-align: left; }
  .report-operation-row.card-payment .report-operation-money:nth-last-child(3),
  .report-operation-row.card-payment .report-operation-money:nth-last-child(2),
  .report-operation-row.card-payment .report-operation-money:last-child { grid-column: auto; grid-row: auto; align-self: auto; }
}

.client-value-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft, #edf0f3);
  background: #fafbfc;
  color: var(--muted);
  font-size: 11px;
}

.client-value-legend span { display: inline-flex; align-items: center; gap: 6px; }
.client-value-legend b { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.client-value-legend b.is-priority { background: #16a34a; }
.client-value-legend b.is-stable { background: #2563eb; }
.client-value-legend b.is-review { background: #d97706; }

.client-value-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.client-value-badge.is-priority { color: #166534; background: #dcfce7; }
.client-value-badge.is-stable { color: #1d4ed8; background: #dbeafe; }
.client-value-badge.is-review { color: #9a3412; background: #ffedd5; }

.report-status-grid,
.report-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
  padding: 12px;
}
.report-status-grid > div,
.report-category-grid > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line-soft, #edf0f3);
  border-radius: 8px;
  background: #fafbfc;
}
.report-status-grid span,
.report-status-grid small,
.report-category-grid span,
.report-category-grid small { color: var(--muted); font-size: 11px; }

.report-loading,
.report-error,
.report-empty-state {
  display: grid;
  place-items: center;
  gap: 5px;
  min-height: 180px;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}
.report-error { color: #b91c1c; background: #fff7f7; }

@media (max-width: 1280px) {
  .report-filterbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-filter-actions { justify-content: flex-end; }
  .report-kpi-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body[data-role="administrator"] .dashboard-kpis,
  body[data-role="master"] .dashboard-kpis {
    grid-template-columns: 1fr;
  }

  .report-filterbar { grid-template-columns: 1fr 1fr; }
  .report-filterbar label:nth-child(n+3),
  .report-filter-actions { grid-column: 1 / -1; }
  .report-filter-actions > * { flex: 1; }
  .report-kpi-grid,
  .report-kpi-grid.compact,
  .report-two-columns { grid-template-columns: 1fr 1fr; }
  .report-two-columns > * { grid-column: 1 / -1; }
  .report-panel-head { align-items: flex-start; flex-direction: column; }
  .product-credit-card { align-items: stretch; flex-direction: column; }
  .product-credit-card label { min-width: 0; }
}

@media (max-width: 480px) {
  .report-filterbar,
  .report-kpi-grid,
  .report-kpi-grid.compact { grid-template-columns: 1fr; }
  .report-filterbar label { grid-column: 1; }
}

.finance-cashbox-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}

.finance-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.finance-toolbar > div:first-child {
  display: grid;
  gap: 3px;
}

.finance-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.cashbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.cashbox-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.cashbox-card.is-archived {
  opacity: 0.72;
  background: #f8fafc;
}

.cashbox-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cashbox-card-head h3 {
  margin: 4px 0 0;
  font-size: 17px;
}

.cashbox-card-head strong {
  white-space: nowrap;
  font-size: 22px;
}

.cashbox-card-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.cashbox-balance-breakdown {
  display: grid;
  gap: 6px;
}

.cashbox-balance-breakdown button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  cursor: pointer;
}

.cashbox-balance-breakdown button > span {
  display: grid;
  gap: 2px;
  text-align: left;
}

.cashbox-balance-breakdown button small {
  color: var(--muted);
  font-size: 10px;
}

.cashbox-balance-breakdown button:hover {
  border-color: rgba(225, 38, 47, 0.25);
  background: #fff7f7;
}

.cash-register-identity {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.cash-register-identity span,
.cash-register-identity small,
.form-hint {
  color: var(--muted);
  font-size: 12px;
}

.form-hint {
  margin: 0;
  line-height: 1.45;
}

.cashbox-balance-breakdown strong {
  font-size: 14px;
}

.cashbox-card-stats span {
  display: grid;
  gap: 2px;
  padding: 8px;
  border-radius: 10px;
  background: #f8fafc;
}

.cashbox-card-stats b {
  color: var(--ink);
  font-size: 13px;
}

.cashbox-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.cashbox-card-actions button {
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 800;
}

.finance-archive {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.finance-recent {
  display: grid;
  gap: 0;
}

.finance-recent .panel-head {
  margin-bottom: 10px;
}

.finance-recent-list {
  display: grid;
  gap: 8px;
}

.finance-recent-row {
  min-height: 48px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.finance-operation-trigger {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
}

.finance-ledger-row.finance-operation-trigger {
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  background: #fff;
}

.finance-operation-trigger:hover,
.finance-operation-trigger:focus-visible {
  background: #fff7f7;
  outline: 2px solid rgba(225, 38, 47, 0.18);
  outline-offset: -2px;
}

.finance-recent-row div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.finance-recent-row strong,
.finance-recent-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-recent-row span {
  color: var(--muted);
  font-size: 12px;
}

.finance-archive h3 {
  margin: 0;
  font-size: 16px;
}

.finance-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.finance-ledger-table {
  max-height: calc(100vh - 250px);
  overflow: auto;
  overscroll-behavior: contain;
}

.finance-ledger-table .finance-table-head {
  position: sticky;
  top: 0;
  z-index: 4;
  box-shadow: 0 1px 0 var(--line), 0 8px 16px rgba(15, 23, 42, 0.05);
}

.finance-column-filter {
  position: relative;
  min-width: 0;
  text-transform: none;
}

.finance-column-filter summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-height: 28px;
  color: inherit;
  font: inherit;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.finance-column-filter summary::-webkit-details-marker {
  display: none;
}

.finance-column-filter summary span {
  flex: 0 0 auto;
  font-size: 10px;
  transition: transform 0.15s ease;
}

.finance-column-filter[open] summary span {
  transform: rotate(180deg);
}

.finance-column-filter.is-active summary {
  color: var(--accent-dark);
}

.finance-column-filter-popover {
  position: absolute;
  top: calc(100% + 7px);
  left: -8px;
  z-index: 20;
  width: 230px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.18);
  text-align: left;
  text-transform: none;
}

.finance-column-filter:nth-last-child(-n+3) .finance-column-filter-popover {
  right: -8px;
  left: auto;
}

.finance-column-filter-popover input,
.finance-column-filter-popover select {
  width: 100%;
  height: 38px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-transform: none;
}

.finance-column-filter-popover button {
  width: 100%;
  margin-top: 8px;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: #f3f4f6;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.finance-journal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.finance-journal-footer span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 640px) {
  .finance-ledger-table {
    max-height: calc(100dvh - 230px);
  }

  .finance-journal-footer {
    align-items: stretch;
    flex-direction: column;
  }
}

.finance-table-head,
.finance-table-row {
  min-width: 1120px;
  display: grid;
  grid-template-columns: 135px 160px 130px 130px 105px 120px 105px 150px minmax(150px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
}

.finance-ledger-head,
.finance-ledger-row {
  min-width: 1900px;
  grid-template-columns: 140px 125px 145px 150px 125px 150px 125px 105px 95px 105px 110px 120px minmax(180px, 1fr) 90px;
}

.finance-table-head {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.finance-table-row {
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.finance-debt-head,
.finance-debt-row {
  min-width: 980px;
  display: grid;
  grid-template-columns: 110px minmax(150px, 1.1fr) minmax(150px, 1.1fr) 105px 105px 105px 90px 140px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
}

.finance-debt-head {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.finance-debt-row {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.finance-debt-row:hover {
  background: #fff7f7;
}

.finance-debt-row span,
.finance-debt-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-table-row span,
.finance-table-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-operation-modal {
  width: min(900px, calc(100vw - 32px));
}

.finance-operation-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.finance-operation-summary article {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.finance-operation-summary span,
.finance-operation-lines small {
  color: var(--muted);
  font-size: 12px;
}

.finance-operation-summary strong {
  font-size: 18px;
}

.finance-operation-section {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.finance-operation-section h3 {
  margin: 0;
  font-size: 14px;
}

.finance-operation-lines {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.finance-operation-lines article {
  display: grid;
  grid-template-columns: 90px minmax(170px, 1fr) 130px 140px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.finance-operation-lines article:first-child {
  border-top: 0;
}

.finance-operation-lines article > span:not(.finance-operation-direction) {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.finance-operation-direction {
  width: fit-content;
  padding: 4px 7px;
  border-radius: 999px;
  background: #e8f7ee;
  color: #087a3d;
  font-size: 11px;
  font-weight: 800;
}

.finance-operation-direction.out {
  background: #fff0f0;
  color: #c51f28;
}

.finance-operation-details {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.finance-operation-details > div {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.finance-operation-details dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}

.finance-operation-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

@media (max-width: 720px) {
  .finance-operation-summary,
  .finance-operation-details {
    grid-template-columns: 1fr;
  }

  .finance-operation-lines article {
    grid-template-columns: 1fr 1fr;
  }
}

.payment-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(225, 38, 47, 0.2);
  border-radius: 14px;
  background: #fff6f6;
}

.payment-preview div,
.cashbox-history-balance {
  display: grid;
  gap: 3px;
}

.payment-preview span,
.cashbox-history-balance span {
  color: var(--muted);
  font-size: 12px;
}

.payment-preview strong {
  font-size: 18px;
}

.cashbox-history {
  display: grid;
  gap: 10px;
}

.cashbox-history-balance {
  padding: 12px;
  border-radius: 14px;
  background: #fff6f6;
}

.cashbox-history-balance strong {
  font-size: 24px;
}

.cash-reconciliation-register {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.cash-reconciliation-register span {
  color: var(--muted);
  font-size: 12px;
}

.cash-reconciliation-register strong {
  font-size: 18px;
}

.cash-reconciliation-grid {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.cash-reconciliation-head,
.cash-reconciliation-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) repeat(3, minmax(120px, 1fr));
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
}

.cash-reconciliation-head {
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.cash-reconciliation-row {
  border-top: 1px solid var(--line);
}

.cash-reconciliation-row input {
  width: 100%;
  min-width: 0;
}

.cash-reconciliation-history {
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.cash-reconciliation-history-item button {
  width: 100%;
  display: grid;
  grid-template-columns: 120px minmax(180px, 1fr) 110px;
  gap: 6px 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.cash-reconciliation-history-item button:hover {
  border-color: rgba(225, 38, 47, 0.35);
  background: #fff8f8;
}

.cash-reconciliation-history-item small {
  grid-column: 1 / -1;
  color: var(--muted);
}

@media (max-width: 760px) {
  .finance-expense-head { display: none; }
  .finance-expense-row { grid-template-columns: 1fr auto; }
  .finance-expense-row > *:nth-child(1),
  .finance-expense-row > *:nth-child(3),
  .finance-expense-row > *:nth-child(4) { grid-column: 1; }
  .finance-expense-row > strong:last-child { grid-column: 2; grid-row: 1 / span 2; }
  .cash-access-form { min-width: 0; }
  .cash-access-list { overflow-x: auto; }
  .cash-access-grid { min-width: 690px; }
  .cash-reconciliation-head {
    display: none;
  }

  .cash-reconciliation-row,
  .cash-reconciliation-history-item button {
    grid-template-columns: 1fr;
  }

  .cash-reconciliation-history-item small {
    grid-column: auto;
  }
}

/* Employees v2 */
.employee-page-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.employee-page-tabs button {
  padding: 9px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.employee-page-tabs button.active {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.settings-page-tabs {
  width: 100%;
  min-width: 0;
  gap: 6px;
  margin: 0 0 14px;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  scrollbar-width: thin;
}

.settings-page-tabs button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 7px;
  white-space: nowrap;
}

.settings-page-tabs button:hover,
.settings-page-tabs button:focus-visible {
  border-color: #e2e8f0;
  background: #fff;
  outline: none;
}

.settings-page-tabs button.active {
  border-color: rgba(225, 38, 47, 0.28);
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: 0 2px 8px rgba(159, 18, 24, 0.08);
}

.settings-page-tabs button span {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: 5px;
  place-items: center;
  border-radius: 999px;
  background: #fff;
  font-size: 10px;
}

.settings-overview-grid {
  align-items: start;
}

.settings-overview-grid-single {
  grid-template-columns: minmax(0, 1fr);
}

.settings-overview-panel,
.settings-import-panel {
  min-width: 0;
}

.settings-overview-panel .settings-list {
  gap: 10px;
}

.settings-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafbfc;
}

.settings-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-card-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.settings-card-head strong {
  font-size: 14px;
}

.settings-card-head small,
.settings-card span {
  color: var(--muted);
  font-size: 11px;
}

.settings-card-icon {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: #feecef;
  color: var(--accent-dark) !important;
  font-size: 16px !important;
  font-weight: 800;
}

.settings-card .settings-layout-row {
  padding: 0;
}

.settings-system-facts {
  display: grid;
  grid-template-columns: 90px 120px minmax(0, 1fr);
  gap: 8px;
}

.settings-system-facts > span {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e8edf3;
  border-radius: 7px;
  background: #fff;
}

.settings-system-facts strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .settings-overview-grid {
    grid-template-columns: 1fr;
  }

  .settings-page-head {
    margin-bottom: 12px;
  }
}

@media (max-width: 620px) {
  .settings-layout-row,
  .settings-system-facts {
    grid-template-columns: 1fr;
  }

}

.employee-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(130px, 1fr)) auto;
  align-items: end;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.employee-filter-bar label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.employee-filter-bar label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.employee-filter-bar input,
.employee-filter-bar select {
  width: 100%;
  min-width: 0;
}

.employee-list-meta {
  padding: 9px 2px 6px;
  color: var(--muted);
  font-size: 12px;
}

.employee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 10px;
}

.employee-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

/* Payroll workspace */
.payroll-workspace { display: grid; gap: 10px; min-width: 0; }
.payroll-toolbar {
  display: grid;
  grid-template-columns: 220px minmax(280px, 1fr) 120px auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.payroll-toolbar label,
.payroll-period-status { display: grid; gap: 5px; }
.payroll-toolbar label,
.payroll-schedule { min-width: 0; }
.payroll-toolbar label > span,
.payroll-period-status > span,
.payroll-schedule span { color: var(--muted); font-size: 11px; }
.payroll-toolbar input { width: 100%; min-width: 0; }
.payroll-schedule { display: grid; gap: 4px; align-self: center; }
.payroll-schedule span { line-height: 1.35; white-space: normal; }
.payroll-month-control { display: grid; grid-template-columns: 32px minmax(0, 1fr) 32px; min-width: 0; }
.payroll-month-control button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--text);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.payroll-month-control button:first-child { border-radius: 7px 0 0 7px; border-right: 0; }
.payroll-month-control button:last-child { border-radius: 0 7px 7px 0; border-left: 0; }
.payroll-month-control input { border-radius: 0; }
.payroll-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.payroll-summary-grid article { display: grid; gap: 4px; padding: 13px 15px; border-right: 1px solid var(--line); }
.payroll-summary-grid article:last-child { border-right: 0; }
.payroll-summary-grid span,
.payroll-summary-grid small { color: var(--muted); font-size: 11px; }
.payroll-summary-grid strong { font-size: 20px; }
.payroll-summary-grid .accent { background: #fff7f7; }
.payroll-summary-grid .accent strong { color: var(--accent-dark); }
.payroll-note { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid #fed7aa; border-radius: 8px; background: #fffaf3; font-size: 12px; }
.payroll-note span { color: var(--muted); }
.payroll-list { display: grid; gap: 7px; }
.payroll-employee {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.payroll-employee-main {
  display: grid;
  grid-template-columns: 36px minmax(170px, 1.5fr) repeat(4, minmax(82px, .7fr));
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.payroll-employee-main:hover { background: #fafbfc; }
.payroll-employee-main > span:not(.employee-avatar) { display: grid; gap: 3px; min-width: 0; }
.payroll-employee-main small { color: var(--muted); font-size: 10px; }
.payroll-person strong,
.payroll-person small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payroll-person-link strong { color: #1d4ed8; text-decoration: underline; text-decoration-color: #bfdbfe; text-underline-offset: 3px; }
.payroll-person-link:hover strong { color: #dc2626; text-decoration-color: #fecaca; }
.payroll-employee-actions { display: flex; gap: 6px; padding-right: 10px; }
.payroll-employee-actions button { white-space: nowrap; }
.payroll-employee-actions button:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }
.money-warn { color: #b45309 !important; }
.payroll-payment-history { grid-column: 1 / -1; display: grid; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); background: #fafbfc; }
.payroll-payment-history > .payroll-payment-row { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(150px, 1fr) auto 30px; align-items: center; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12px; }
.payroll-payment-history > .payroll-payment-row span { color: var(--muted); }
.payroll-payment-history > .payroll-breakdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; border-top: 0; padding-top: 0; }
.payroll-breakdown span { display: grid; gap: 3px; }
.payroll-breakdown strong { color: var(--text); }
.payroll-accrual-history { display: grid; gap: 6px; margin: 4px 0 8px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.payroll-history-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.payroll-history-heading small { color: var(--muted); }
.payroll-accrual-list { display: grid; }
.payroll-accrual-row { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(150px, .65fr) auto 30px; align-items: center; gap: 12px; min-width: 0; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12px; }
.payroll-accrual-details { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: 10px; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.payroll-accrual-details > span { min-width: 0; }
.payroll-accrual-details > span:first-child,
.payroll-document-label { color: var(--muted); }
.payroll-accrual-details strong,
.payroll-accrual-details small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payroll-accrual-details small { margin-top: 2px; color: var(--muted); }
.payroll-accrual-details:hover strong { color: var(--accent); }
.payroll-document-link { justify-self: start; max-width: 100%; padding: 4px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--accent); font: inherit; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.payroll-document-link:hover { border-color: rgba(220, 38, 38, .35); background: var(--accent-soft); }
.payroll-transaction-delete { display: grid; width: 30px; height: 30px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.payroll-transaction-delete:hover { border-color: rgba(220, 38, 38, .4); background: var(--accent-soft); color: var(--accent); }
.payroll-transaction-delete:disabled { opacity: .45; cursor: wait; }
.payroll-history-error { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--bad); }
.payroll-payment-warning { padding: 9px 10px; border-radius: 6px; background: #f5f7f9; color: var(--muted); font-size: 11px; }
.payroll-modal { width: min(620px, calc(100vw - 32px)); }

@media (max-width: 1500px) {
  .payroll-toolbar { grid-template-columns: 220px minmax(250px, 1fr) auto; }
  .payroll-period-status { display: none; }
  .payroll-employee { grid-template-columns: 1fr; }
  .payroll-employee-main { grid-template-columns: 36px minmax(160px, 1.4fr) repeat(4, minmax(78px, .7fr)); }
  .payroll-employee-actions { justify-content: flex-end; padding: 0 10px 10px; }
}

@media (max-width: 760px) {
  .payroll-toolbar { grid-template-columns: 1fr; align-items: stretch; }
  .payroll-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .payroll-summary-grid article:nth-child(2) { border-right: 0; }
  .payroll-summary-grid article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .payroll-note { align-items: flex-start; flex-direction: column; }
  .payroll-employee-main { grid-template-columns: 32px minmax(130px, 1fr) minmax(90px, .7fr); }
  .payroll-employee-main > span:not(.employee-avatar):not(.payroll-person):not(:last-child) { display: none; }
  .payroll-payment-history > .payroll-payment-row { grid-template-columns: minmax(0, 1fr) auto 30px; }
  .payroll-payment-history > .payroll-payment-row span:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .payroll-payment-history > .payroll-breakdown { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .payroll-accrual-row { grid-template-columns: minmax(0, 1fr) auto 30px; }
  .payroll-accrual-details { grid-template-columns: 1fr; gap: 2px; }
  .payroll-document-link,
  .payroll-document-label { grid-column: 1 / -1; }
}

.employee-card:hover,
.employee-card:focus-visible {
  border-color: rgba(220, 38, 38, 0.35);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
  outline: 0;
}

.employee-card-primary {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 34px;
  align-items: start;
  gap: 10px;
}

.employee-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 14px;
  font-weight: 800;
}

.employee-card-title,
.employee-card-title > div {
  min-width: 0;
}

.employee-card-title > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.employee-card-title strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-card-title p {
  margin: 3px 0 7px;
  color: var(--muted);
  font-size: 12px;
}

.employee-status,
.employee-access-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 3px 6px;
  border-radius: 6px;
  background: #ecfdf3;
  color: #166534;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.employee-status.invited { background: #eff6ff; color: #1d4ed8; }
.employee-status.blocked { background: #fff7ed; color: #c2410c; }
.employee-status.dismissed,
.employee-status.archived { background: #f1f5f9; color: #64748b; }

.employee-role-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.employee-role-badges span {
  padding: 3px 6px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f8fafc;
  color: #374151;
  font-size: 10px;
  font-weight: 700;
}

.employee-role-badges span.muted { color: var(--muted); }

.employee-card-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid #eef0f3;
}

.employee-card-facts span,
.employee-account-facts span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.employee-card-facts small,
.employee-account-facts small {
  color: var(--muted);
  font-size: 10px;
}

.employee-card-facts strong,
.employee-account-facts strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-on { color: #15803d; }
.access-off { color: #b45309; }

.employee-role-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.employee-role-overview-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.employee-role-overview-card h3,
.employee-role-overview-card p { margin: 3px 0; }
.employee-role-overview-card p,
.employee-role-overview-card > div > span { color: var(--muted); font-size: 11px; }
.employee-role-overview-card > strong { font-size: 24px; text-align: right; }
.employee-role-overview-card > strong small { display: block; color: var(--muted); font-size: 10px; }
.employee-role-permissions-preview { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 5px; }
.employee-role-permissions-preview span { padding: 4px 6px; border-radius: 6px; background: #f3f4f6; font-size: 10px; }
.employee-role-overview-card > button { grid-column: 1 / -1; justify-self: start; }

.employee-audit-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.employee-audit-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.employee-audit-head span,
.employee-audit-head p,
.employee-audit-table small { color: var(--muted); font-size: 11px; }
.employee-audit-head h3,
.employee-audit-head p { margin: 3px 0; }
.employee-audit-head > strong { font-size: 22px; text-align: right; }
.employee-audit-head > strong small { display: block; color: var(--muted); font-size: 10px; }
.employee-audit-table-wrap { overflow-x: auto; }
.employee-audit-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.employee-audit-table th,
.employee-audit-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.employee-audit-table th { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.employee-audit-table td strong,
.employee-audit-table td small { display: block; }
.employee-audit-result { display: inline-flex; padding: 3px 7px; border-radius: 6px; font-weight: 700; }
.employee-audit-result.success { color: #15803d; background: #ecfdf3; }
.employee-audit-result.failed { color: #b91c1c; background: #fef2f2; }

body:not([data-role="owner"]) .dashboard-grid-cash {
  grid-template-columns: minmax(0, 1fr);
}

.employee-drawer {
  grid-template-rows: auto auto auto minmax(0, 1fr);
  width: min(920px, 94vw);
}

.employee-drawer-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.employee-drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.employee-drawer-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 9px 28px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.employee-drawer-tabs {
  flex-wrap: wrap;
  overflow-x: hidden;
}

.employee-drawer-tabs button {
  padding: 9px 10px;
  font-size: 12px;
}

.employee-profile-form,
.employee-access-section,
.employee-account-panel {
  display: grid;
  gap: 14px;
}

.employee-profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.employee-profile-grid label,
.employee-role-assign-form label,
.employee-account-create-form label,
.employee-account-create-fields label {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.employee-profile-grid label.wide { grid-column: 1 / -1; }

.employee-assigned-roles {
  display: grid;
  gap: 7px;
}

.employee-assigned-roles article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.employee-assigned-roles article div { display: grid; gap: 2px; }
.employee-assigned-roles small { color: var(--muted); }

.employee-role-assign-form,
.employee-account-create-form,
.employee-account-create-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.employee-account-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.employee-access-badge.disabled { background: #fff7ed; color: #b45309; }
.employee-account-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 10px; }
.employee-access-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.employee-access-actions button:disabled { opacity: 0.48; cursor: not-allowed; }
.employee-password-reset-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fffafa;
}
.employee-password-reset-form > div:first-child { display: grid; gap: 3px; }
.employee-password-reset-form small,
.employee-session-heading small,
.employee-session-list small { color: var(--muted); font-size: 11px; }
.employee-password-reset-form label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.employee-password-input { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.employee-password-reset-actions { display: flex; justify-content: flex-end; gap: 7px; }
.employee-session-panel { display: grid; gap: 9px; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.employee-session-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.employee-session-heading > div { display: grid; gap: 2px; }
.employee-session-heading > span { min-width: 26px; padding: 3px 7px; border-radius: 6px; background: #f1f5f9; color: #475569; font-size: 11px; font-weight: 800; text-align: center; }
.employee-session-list { display: grid; gap: 7px; }
.employee-session-list article { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: #fafbfc; }
.employee-session-list article > div { display: grid; gap: 2px; min-width: 0; }
.employee-session-list article > div:last-child { text-align: right; }
.employee-session-list span { color: #334155; font-size: 12px; font-weight: 700; }
.employee-session-list .empty-state.compact { padding: 14px; }
.employee-permission-panel {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.employee-permission-panel .employee-section-heading { align-items: flex-start; }
.employee-permission-panel .employee-section-heading p { max-width: 680px; margin: 4px 0 0; color: var(--muted); font-size: 12px; font-weight: 500; }
.employee-permission-owner-note { display: grid; gap: 3px; padding: 11px 12px; border: 1px solid #bfdbfe; border-radius: 7px; background: #eff6ff; color: #1e3a8a; }
.employee-permission-owner-note span { font-size: 12px; color: #475569; }
.employee-permission-matrix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.employee-permission-group { min-width: 0; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #fff; }
.employee-permission-group > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.employee-permission-group h4 { margin: 0; font-size: 12px; }
.employee-permission-group > header span { color: var(--muted); font-size: 10px; font-weight: 800; }
.employee-permission-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(150px, 190px); align-items: center; gap: 9px; padding: 8px 10px; border-bottom: 1px solid #edf1f5; }
.employee-permission-row:last-child { border-bottom: 0; }
.employee-permission-copy { display: grid; min-width: 0; gap: 2px; }
.employee-permission-copy strong { color: var(--text); font-size: 12px; }
.employee-permission-copy small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.employee-permission-effective { padding: 3px 6px; border-radius: 5px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.employee-permission-effective.allowed { background: #ecfdf3; color: #16814d; }
.employee-permission-effective.denied { background: #f1f5f9; color: #64748b; }
.employee-permission-row select { width: 100%; min-width: 0; padding: 7px 28px 7px 8px; font-size: 11px; }
.employee-permission-row select:disabled { opacity: 0.72; cursor: default; }
.employee-permission-actions { position: sticky; bottom: -1px; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 2px; background: #fff; }
.employee-permission-actions span { color: var(--muted); font-size: 11px; }

.employee-period-list,
.employee-shift-list {
  display: grid;
  gap: 7px;
}

.employee-period-list article,
.employee-shift-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 120px;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}

.employee-period-list article div,
.employee-shift-list article div { display: grid; gap: 2px; }
.employee-period-list small,
.employee-shift-list small { color: var(--muted); }
.employee-period-list b,
.employee-shift-list b { text-align: right; }

.employee-work-calendar {
  min-width: 0;
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
  overflow-x: hidden;
}

.employee-calendar-toolbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.employee-calendar-toolbar > div:first-child { display: grid; gap: 2px; }
.employee-calendar-toolbar span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.employee-calendar-toolbar h3 { margin: 0; font-size: 19px; text-transform: capitalize; }
.employee-calendar-toolbar > div:last-child { display: flex; align-items: center; gap: 6px; }
.employee-calendar-toolbar .icon-button { font-size: 22px; }

.employee-calendar-weekdays,
.employee-calendar-grid {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.employee-calendar-weekdays {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.employee-calendar-weekdays span { padding: 4px; }
.employee-calendar-grid { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--line); gap: 1px; }

.employee-calendar-day {
  min-width: 0;
  min-height: 112px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: #fff;
  cursor: pointer;
  transition: box-shadow 120ms ease, transform 120ms ease;
  overflow: hidden;
}

.employee-calendar-day:hover { box-shadow: inset 0 0 0 2px #94a3b8; }
.employee-calendar-day:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.28); outline-offset: -3px; }

.employee-calendar-day > header { display: flex; align-items: center; justify-content: space-between; }
.employee-calendar-day > header b { font-size: 12px; }
.employee-calendar-day > header span { color: #2563eb; font-size: 9px; }
.employee-calendar-day > small { color: #475569; font-size: 10px; }
.employee-calendar-day > em { color: var(--muted); font-size: 9px; font-style: normal; }
.employee-calendar-day > em.is-shift { color: #16814d; }
.employee-calendar-day.is-outside { opacity: 0.38; }
.employee-calendar-day.is-day-off { background: #f8fafc; }
.employee-calendar-day.is-today { box-shadow: inset 0 0 0 2px #2563eb; }
.employee-calendar-day.is-overloaded { background: #fff7ed; }
.employee-calendar-day.has-overdue { background: #fff1f2; }

.employee-calendar-load { height: 5px; overflow: hidden; border-radius: 999px; background: #e2e8f0; }
.employee-calendar-load i { display: block; height: 100%; border-radius: inherit; background: #2563eb; }
.employee-calendar-day.is-overloaded .employee-calendar-load i { background: #ea580c; }
.employee-calendar-notices { margin-top: auto; color: #be123c; font-size: 9px; }

.employee-calendar-legend {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
}

.employee-calendar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.employee-calendar-legend i { width: 9px; height: 9px; border-radius: 3px; }
.employee-calendar-legend i.is-load { background: #2563eb; }
.employee-calendar-legend i.is-notice { background: #be123c; }
.employee-calendar-legend i.is-off { background: #e2e8f0; }
.employee-calendar-legend small { margin-left: auto; }
.employee-shift-history { display: grid; gap: 10px; }

@media (max-width: 760px) {
  .employee-work-calendar { width: 100%; }
  .employee-calendar-toolbar { flex-wrap: wrap; }
  .employee-calendar-toolbar h3 { font-size: 17px; }
  .employee-calendar-day { min-height: 86px; padding: 5px; gap: 3px; }
  .employee-calendar-day > small { font-size: 8px; overflow-wrap: anywhere; }
  .employee-calendar-day > em { font-size: 8px; }
  .employee-calendar-notices { font-size: 8px; overflow-wrap: anywhere; }
  .employee-calendar-legend { gap: 7px; }
  .employee-calendar-legend small { width: 100%; margin-left: 0; }
}

@media (max-width: 460px) {
  .employee-calendar-toolbar { gap: 8px; }
  .employee-calendar-toolbar > div:last-child { margin-left: auto; }
  .employee-calendar-day { min-height: 68px; padding: 4px; }
  .employee-calendar-day > em,
  .employee-calendar-notices { display: none; }
  .employee-calendar-load { height: 4px; }
}

.employee-schedule-modal { width: min(660px, calc(100vw - 28px)); }
.modal-root.employee-schedule-layer { z-index: 3000; }
.modal-root.employee-schedule-layer .modal-backdrop { z-index: 3000; }
.modal-root.employee-schedule-layer .employee-schedule-modal { z-index: 3010; }

@media (min-width: 900px) {
  .modal-root.employee-schedule-layer .employee-schedule-modal {
    right: 28px;
    left: auto;
    transform: translateY(-50%);
  }
}
.employee-schedule-modal form { display: grid; gap: 16px; }
.employee-schedule-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}
.employee-schedule-toggle input { width: 20px; height: 20px; accent-color: #dc2626; }
.employee-schedule-toggle span { display: grid; gap: 2px; }
.employee-schedule-toggle small,
.employee-schedule-hint { color: var(--muted); font-size: 12px; }
.employee-schedule-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.employee-schedule-fields label,
.employee-schedule-note { display: grid; gap: 6px; color: #475569; font-size: 12px; font-weight: 700; }
.employee-schedule-fields input,
.employee-schedule-note textarea { width: 100%; }
.employee-schedule-fields input:disabled { opacity: 0.48; }
.employee-schedule-hint { margin: -4px 0 0; }
.employee-schedule-modal .modal-actions > span { flex: 1; }

@media (max-width: 640px) {
  .employee-schedule-fields { grid-template-columns: 1fr; }
  .employee-schedule-modal .modal-actions { flex-wrap: wrap; }
  .employee-schedule-modal .modal-actions > span { display: none; }
}

.employee-create-modal {
  width: min(880px, calc(100vw - 32px));
  overflow-x: hidden;
}

.employee-create-modal .modal-form { gap: 0; }

.employee-create-section {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  margin: 0 -20px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}
.employee-create-section > div:first-child { display: flex; align-items: flex-start; gap: 7px; }
.employee-create-section > div:first-child > span { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 6px; background: #fee2e2; color: #b91c1c; font-weight: 800; }
.employee-create-section.muted-section p { margin: 0; color: var(--muted); }
.employee-create-modal .employee-profile-grid input,
.employee-create-modal .employee-profile-grid select,
.employee-create-modal .employee-profile-grid textarea,
.employee-create-modal .employee-account-create-fields input {
  width: 100%;
  min-width: 0;
}

.employee-create-modal .employee-profile-grid input,
.employee-create-modal .employee-profile-grid select,
.employee-create-modal .employee-account-create-fields input { height: 38px; }

.employee-create-modal .employee-profile-grid textarea { min-height: 68px; }

.employee-role-choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; min-width: 0; }
.employee-role-choice label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}
.employee-role-choice label:hover { border-color: #ef9aa3; background: #fffafb; }
.employee-role-choice input[type="checkbox"],
.employee-crm-switch input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 1px 0 0;
  padding: 0;
  accent-color: var(--accent);
}
.employee-role-choice label span { display: grid; gap: 2px; font-weight: 700; }
.employee-role-choice small { color: var(--muted); font-weight: 400; }
.employee-create-content { display: grid; min-width: 0; gap: 10px; }
.employee-crm-switch { display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 38px; cursor: pointer; }
.employee-account-create-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; }
.employee-create-modal .modal-actions { margin-top: 0; }

.employee-permissions-modal { width: min(720px, 94vw); }
.employee-permission-groups { display: grid; gap: 14px; padding: 0 20px 18px; max-height: 60vh; overflow: auto; }
.employee-permission-groups section { display: grid; gap: 5px; }
.employee-permission-groups h3 { margin: 0 0 3px; font-size: 13px; }
.employee-permission-groups section > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 9px; background: #f8fafc; font-size: 12px; }

@media (max-width: 980px) {
  .employee-permission-matrix { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .employee-permission-row { grid-template-columns: minmax(0, 1fr) auto; }
  .employee-permission-row select { grid-column: 1 / -1; }
  .employee-permission-actions { align-items: stretch; flex-direction: column; }
}

@media (max-width: 1100px) {
  .employee-filter-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .employee-search-field { grid-column: span 2; }
  .employee-role-overview { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .employee-filter-bar,
  .employee-grid,
  .employee-profile-grid,
  .employee-card-facts,
  .employee-role-choice,
  .employee-account-facts,
  .employee-role-assign-form,
  .employee-account-create-form,
  .employee-account-create-fields { grid-template-columns: 1fr; }
  .employee-password-input { grid-template-columns: 1fr; }
  .employee-session-list article { align-items: flex-start; flex-direction: column; gap: 6px; }
  .employee-session-list article > div:last-child { text-align: left; }
  .employee-search-field { grid-column: auto; }
  .employee-create-section { grid-template-columns: 1fr; }
  .employee-create-section { gap: 10px; }
  .employee-drawer-header { align-items: center; }
  .employee-drawer-header-actions .secondary-action { display: none; }
  .employee-period-list article,
  .employee-shift-list article { grid-template-columns: 1fr auto; }
  .employee-period-list b,
  .employee-shift-list b { grid-column: 2; grid-row: 1; }
}

.danger-action {
  border-color: rgba(225, 38, 47, 0.3);
  color: var(--accent-dark);
}

.bars {
  min-height: 280px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(18px, 1fr);
  align-items: end;
  gap: 7px;
  padding-top: 16px;
}

.bar {
  min-height: 6px;
  position: relative;
  border-radius: 9px 9px 3px 3px;
  background: linear-gradient(180deg, #ff5b63, #b91520);
}

.bar:hover::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  z-index: 3;
  width: max-content;
  max-width: 220px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #17202a;
  color: #fff;
  font-size: 12px;
}

.daily-stats {
  margin-top: 12px;
  padding-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.donut-wrap {
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 18px;
}

.donut {
  width: 150px;
  height: 150px;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0 var(--closed), #e6ebf1 var(--closed) 360deg);
}

.donut::after {
  content: "";
  position: absolute;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: var(--panel);
}

.donut span {
  position: relative;
  z-index: 1;
  font-size: 24px;
  font-weight: 800;
}

.legend-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.legend-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.dot-1 { background: var(--accent-2); }
.dot-2 { background: #4f46e5; }
.dot-3 { background: var(--bad); }
.dot-4 { background: var(--good); }

.crm-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(190px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.crm-column {
  min-height: 320px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-2);
}

.crm-column header {
  display: grid;
  gap: 3px;
  margin-bottom: 10px;
}

.crm-column header span {
  color: var(--muted);
  font-size: 12px;
}

.crm-cards {
  display: grid;
  gap: 9px;
}

.crm-card,
.compact-row,
.task-row,
.client-row,
.master-row,
.mini-row {
  width: 100%;
  padding: 11px;
  display: grid;
  gap: 5px;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.crm-card:hover,
.compact-row:hover,
.task-row:hover,
.client-row:hover,
.master-row:hover,
.mini-row:hover,
tr:hover {
  background: #fff7f7;
  border-color: rgba(225, 38, 47, 0.28);
}

.crm-card {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.crm-card strong,
.crm-card small,
.task-row strong,
.task-row small,
.client-row strong,
.client-row small,
.compact-row strong,
.compact-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-card b {
  color: var(--accent-dark);
}

.task-row {
  grid-template-columns: 78px minmax(0, 1fr) auto;
  align-items: center;
}

.task-row > div { min-width: 0; }
.task-row .task-description { margin-top: 2px; color: #64748b; font-size: 11px; }
.task-row > b { color: #475569; font-size: 11px; font-weight: 700; white-space: nowrap; }

.repair-work-queue {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 7px 0;
}

.repair-work-queue button {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.repair-work-queue button:hover,
.repair-work-queue button.active {
  border-color: rgba(225, 38, 47, 0.35);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.repair-queue-plan {
  margin: 0 0 10px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .85fr);
  gap: 8px;
}

.repair-queue-plan[hidden] { display: none; }

.repair-queue-next,
.repair-queue-upcoming,
.repair-queue-clear {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.repair-queue-eyebrow,
.repair-queue-upcoming > span {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.repair-queue-main {
  width: 100%;
  min-width: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.repair-queue-main > span { min-width: 0; display: grid; gap: 2px; }
.repair-queue-main strong { color: var(--accent-dark); font-size: 17px; }
.repair-queue-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repair-queue-main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repair-queue-timing { flex: 0 0 210px; text-align: right; }
.repair-queue-actions { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.repair-queue-actions button { min-height: 32px; }

.repair-queue-upcoming { display: grid; align-content: start; gap: 4px; }
.repair-queue-upcoming > button {
  min-width: 0;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1px 8px;
  border: 0;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.repair-queue-upcoming > button:hover { background: var(--accent-soft); }
.repair-queue-upcoming span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repair-queue-upcoming small { grid-column: 2; color: var(--muted); }
.repair-queue-clear { display: grid; gap: 3px; color: var(--muted); }
.repair-queue-clear strong { color: var(--good); }

.tasks-page-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  padding: 4px;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tasks-page-tabs button {
  min-height: 34px;
  padding: 7px 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.tasks-page-tabs button:hover { background: #f7f8fa; color: var(--ink); }
.tasks-page-tabs button.active { background: var(--accent-soft); color: var(--accent-dark); }
.tasks-page-tabs button span {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef1f4;
  color: inherit;
  font-size: 11px;
  text-align: center;
}

.notification-panel { display: grid; gap: 12px; }
.notification-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}
.notification-toolbar > div { display: grid; gap: 3px; }
.notification-toolbar small { color: var(--muted); }
.notification-toolbar label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.notification-toolbar select { min-width: 160px; }
.notification-list { display: grid; gap: 8px; }
.notification-row {
  padding: 12px;
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.notification-row.status-draft { border-left: 3px solid #f59e0b; }
.notification-row.status-sent { border-left: 3px solid #168a55; }
.notification-row.status-cancelled { opacity: 0.72; }
.notification-row-head,
.notification-row-head > div,
.notification-meta,
.notification-actions { display: flex; align-items: center; gap: 8px; }
.notification-row-head { justify-content: space-between; }
.notification-channel,
.notification-status {
  padding: 3px 7px;
  border-radius: 999px;
  background: #f0f2f5;
  color: #536070;
  font-size: 11px;
  font-weight: 700;
}
.notification-row p { margin: 0; line-height: 1.45; }
.notification-meta { flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.notification-meta span + span::before { content: "·"; margin-right: 8px; }
.notification-meta button { padding: 0; border: 0; background: none; color: var(--accent-dark); font: inherit; font-weight: 700; cursor: pointer; }
.notification-meta time { margin-left: auto; }
.notification-actions { justify-content: flex-end; }

@media (max-width: 720px) {
  .notification-toolbar { align-items: stretch; flex-direction: column; }
  .notification-toolbar select { width: 100%; }
  .notification-row-head { align-items: flex-start; }
  .notification-meta time { width: 100%; margin-left: 0; }
  .notification-actions { flex-wrap: wrap; }
}

.client-row,
.compact-row,
.inventory-row,
.employee-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.client-row {
  grid-template-columns: minmax(220px, 1.3fr) minmax(170px, 0.7fr) minmax(160px, 0.6fr);
  min-height: 64px;
}

.client-row.is-selected,
.mini-row.is-selected {
  border-color: rgba(225, 38, 47, 0.36);
  background: #fff5f5;
  box-shadow: inset 3px 0 0 var(--accent);
}

.client-row div,
.compact-row div,
.task-row div,
.master-row div,
.inventory-row div,
.employee-row div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.client-row div:last-child,
.compact-row div:last-child,
.inventory-row div:last-child,
.employee-row div:last-child {
  text-align: right;
}

.client-list-panel {
  min-width: 0;
}

.money-bad {
  color: var(--bad);
}

.button-like {
  min-height: 38px;
  padding: 9px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.inventory-row,
.employee-row {
  padding: 12px;
  display: grid;
  gap: 8px;
}

.inventory-row > span,
.employee-row span {
  color: var(--muted);
  font-size: 12px;
}

.priority,
.client-type,
.status {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.14);
  color: #8a5600;
  font-size: 12px;
}

.priority-high {
  background: rgba(225, 38, 47, 0.13);
  color: var(--accent-dark);
}

.client-type-b2b,
.status {
  background: rgba(225, 38, 47, 0.1);
  color: var(--accent-dark);
}

.client-type-supplier {
  background: rgba(13, 148, 136, 0.12);
  color: #0f766e;
}

.status-green {
  background: rgba(22, 138, 85, 0.12);
  color: #146c43;
}

.status-yellow {
  background: rgba(245, 158, 11, 0.16);
  color: #8a5600;
}

.status-orange {
  background: rgba(249, 115, 22, 0.16);
  color: #9a3412;
}

.status-blue {
  background: rgba(14, 165, 233, 0.14);
  color: #075985;
}

.status-violet {
  background: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
}

.status-dark-orange {
  background: rgba(194, 65, 12, 0.14);
  color: #7c2d12;
}

.status-red {
  background: rgba(225, 38, 47, 0.12);
  color: var(--accent-dark);
}

.status-dark-gray {
  background: #e2e8f0;
  color: #334155;
}

.status-burgundy {
  background: rgba(136, 19, 55, 0.12);
  color: #881337;
}

.status-light-gray {
  background: #f1f5f9;
  color: #64748b;
}

.status-gray {
  background: #eef2f7;
  color: #475569;
}

.repair-type-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}

.repair-type-badge.paid {
  background: #eef2f7;
  color: #475569;
}

.repair-type-badge.warranty {
  background: #fff3cd;
  color: #8a5600;
}

.repair-route-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  padding: 2px 7px;
  border: 1px solid #a7d7c5;
  border-radius: 999px;
  background: #eaf8f1;
  color: #166044;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}

.is-selected,
tr.is-selected {
  background: rgba(225, 38, 47, 0.1) !important;
  outline: 1px solid rgba(225, 38, 47, 0.35);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: #536172;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td strong {
  color: var(--ink);
}

tbody tr {
  cursor: pointer;
}

tbody tr:focus-visible {
  outline: 2px solid rgba(225, 38, 47, 0.35);
  outline-offset: -2px;
}

.orders-sentinel td {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 14px;
}

.detail-panel {
  position: sticky;
  top: 20px;
  align-self: start;
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.repair-card {
  display: grid;
  gap: 14px;
}

.repair-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 2px 44px 14px 0;
  border-bottom: 1px solid var(--line);
}

.repair-card-kicker {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.repair-card-head h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
}

.repair-card-head strong {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 16px;
}

.repair-card-head .status {
  flex: 0 0 auto;
  margin-top: 2px;
}

.repair-workflow-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 10px 16px 0;
  padding: 12px 14px;
  border: 1px solid #d9dee7;
  border-left: 3px solid #7c8798;
  border-radius: 6px;
  background: #f3f5f7;
}

.repair-terminal-comment {
  display: grid;
  gap: 5px;
  margin: 10px 16px 0;
  padding: 12px 14px;
  border: 1px solid #e7c1c5;
  border-left: 3px solid #ad2432;
  border-radius: 6px;
  background: #fff6f7;
}

.repair-terminal-comment.is-refused {
  border-color: #d8dde5;
  border-left-color: #626d7d;
  background: #f6f7f9;
}

.repair-terminal-comment span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.repair-terminal-comment p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  white-space: pre-wrap;
}

.repair-workflow-panel.is-overdue {
  border-color: #efb7bd;
  border-left-color: #d92f3d;
  background: #fff4f5;
}

.repair-workflow-panel.landing-intake-panel {
  border-color: #ead79e;
  border-left-color: #d89a12;
  background: #fffaf0;
}

.landing-intake-modal {
  width: min(820px, 96vw);
  max-height: min(900px, 94vh);
  overflow-x: hidden;
}

.landing-intake-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 700px) {
  .landing-intake-grid { grid-template-columns: 1fr; }
}

.repair-workflow-copy {
  min-width: 0;
}

.repair-workflow-copy > span {
  display: block;
  color: #747e8c;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.repair-workflow-proposal {
  display: flex;
  align-items: baseline;
  gap: 6px 12px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 12px;
}

.repair-workflow-proposal span { color: #374151; }
.repair-workflow-proposal strong { color: #111827; }
.repair-workflow-proposal small { color: var(--muted); }

.repair-workflow-copy strong {
  display: block;
  margin-top: 2px;
  color: #1f2732;
  font-size: 15px;
}

.repair-workflow-copy p {
  margin: 3px 0 0;
  color: #616b78;
  font-size: 12px;
  line-height: 1.35;
}

.repair-workflow-side {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
}

.repair-workflow-deadline {
  color: #687281;
  font-size: 12px;
  font-weight: 600;
}

.is-overdue .repair-workflow-deadline {
  color: #bd1f2d;
}

.repair-workflow-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.landing-intake-panel .danger-action {
  background: #fff;
}

.landing-intake-panel .danger-action:hover {
  border-color: #d92f3d;
  background: #fff1f2;
}

.workflow-duration-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.workflow-duration-options label {
  cursor: pointer;
}

.workflow-duration-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.workflow-duration-options span {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8dee8;
  border-radius: 6px;
  background: #fff;
  color: #4d5765;
  font-size: 12px;
  font-weight: 700;
}

.workflow-duration-options input:checked + span {
  border-color: #dc3545;
  background: #fff1f2;
  color: #bd1f2d;
}

@media (max-width: 760px) {
  .repair-workflow-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .repair-workflow-side {
    align-items: stretch;
  }

  .repair-workflow-actions {
    justify-content: flex-start;
  }

  .workflow-duration-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.repair-summary-grid,
.repair-tab-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.repair-summary-grid article {
  min-width: 0;
  padding: 13px 14px;
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.repair-summary-grid span {
  color: var(--muted);
  font-size: 12px;
}

.repair-summary-grid strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repair-status-select-wrap {
  display: inline-grid;
  gap: 4px;
  justify-items: end;
  min-width: 170px;
}

.repair-status-select-wrap span {
  color: var(--muted);
  font-size: 11px;
}

.repair-status-select-wrap select.status {
  max-width: 240px;
  min-height: 34px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
}

.repair-status-select-wrap select.status:focus {
  border-color: rgba(225, 38, 47, 0.45);
  box-shadow: 0 0 0 3px rgba(225, 38, 47, 0.12);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.quick-actions button,
.repair-tabs button,
.stub-action,
.document-actions button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.quick-actions button:hover,
.repair-tabs button:hover,
.document-actions button:hover {
  border-color: rgba(225, 38, 47, 0.28);
  background: #fff7f7;
}

.repair-process-actions {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.repair-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.repair-tabs button {
  white-space: nowrap;
}

.repair-tabs button.active {
  color: var(--accent-dark);
  border-color: rgba(225, 38, 47, 0.32);
  background: var(--accent-soft);
}

.repair-tab-content {
  display: grid;
  gap: 12px;
}

.repair-work-state {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.repair-work-state > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.repair-work-state dt {
  color: var(--muted);
  font-size: 11px;
}

.repair-work-state dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-weight: 800;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.photo-drop {
  min-height: 126px;
  padding: 14px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: #fbfcfe;
  color: var(--muted);
  text-align: center;
}

.photo-drop strong {
  color: var(--ink);
}

.repair-photo-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
}

.repair-photo-stage {
  min-width: 0;
  min-height: 58px;
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.repair-photo-stage.is-pending {
  border-color: #efb2b7;
  background: #fff8f8;
}

.repair-photo-stage > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.repair-photo-stage > header > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.repair-photo-stage > header strong {
  color: var(--ink);
  font-size: 13px;
}

.repair-photo-stage > header span,
.repair-photo-empty,
.repair-photo-thumbnails small {
  color: var(--muted);
  font-size: 11px;
}

.repair-photo-stage > header button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 8px;
  white-space: nowrap;
}

.repair-photo-empty {
  margin-top: auto;
  padding-top: 7px;
  border-top: 1px dashed var(--line);
  line-height: 1.25;
}

.repair-photo-thumbnails {
  margin-top: auto;
  padding-top: 7px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  border-top: 1px dashed var(--line);
}

.repair-photo-thumbnails a {
  min-width: 0;
  display: grid;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}

.repair-photo-thumbnails img {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f3f5f8;
}

.repair-photo-thumbnails small {
  display: none;
}

@media (max-width: 1450px) {
  .repair-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .repair-photo-grid {
    grid-template-columns: 1fr;
  }
}

.repair-photo-request-state {
  margin-bottom: 8px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #efb2b7;
  border-radius: 7px;
  background: #fff5f5;
  color: #8d1e28;
  font-size: 12px;
}

.repair-photo-request-state b {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
}

.repair-photo-loading {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.document-actions {
  display: grid;
  gap: 8px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  position: relative;
  padding: 12px 12px 12px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 16px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-item span,
.timeline-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.timeline-item strong {
  display: block;
  margin: 2px 0 4px;
}

.detail-head {
  display: grid;
  gap: 4px;
}

.detail-head span,
.employee-card span,
.positions-head span,
.order-money-grid span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-head strong {
  font-size: 22px;
}

.detail-list {
  margin: 0;
  display: grid;
  gap: 8px;
}

.detail-list div,
.settings-row {
  padding: 10px;
}

.settings-import-row {
  display: grid;
  gap: 8px;
}

.settings-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-import-row small {
  color: var(--muted);
}

.detail-list dt {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.order-form,
.positions-section,
.mini-list,
.settings-list {
  display: grid;
  gap: 12px;
}

.order-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.order-form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.order-form input,
.order-form textarea {
  width: 100%;
}

.wide-field {
  display: grid;
  gap: 6px;
}

.order-money-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.order-money-grid article {
  padding: 12px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.order-money-grid strong {
  font-size: 18px;
}

.position-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.work-table {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.work-head,
.work-row {
  min-width: 820px;
  display: grid;
  grid-template-columns: minmax(200px, 1.6fr) 72px 92px 92px 92px minmax(100px, 0.8fr) 86px;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
}

.work-head {
  background: #f8fafc;
  color: #536172;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.work-row {
  border-top: 1px solid var(--line);
}

.work-row strong,
.work-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-row strong {
  display: grid;
  gap: 2px;
}

.work-row strong small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.work-row span {
  color: var(--muted);
  font-size: 12px;
}

.work-row-actions {
  display: flex;
  gap: 4px;
}

.work-row-actions .icon-button {
  width: 30px;
  height: 30px;
  min-height: 30px;
}

.position-head,
.position-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 64px 92px 92px 78px;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
}

.position-head {
  background: #f8fafc;
  color: #536172;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.position-row {
  border-top: 1px solid var(--line);
}

.position-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.position-row span {
  color: var(--muted);
  font-size: 12px;
}

.line-editor {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 100px 120px auto;
  gap: 8px;
}

.line-editor.parts-editor {
  grid-template-columns: minmax(0, 1.4fr) 76px 96px 112px auto;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}

.toggle-row input {
  width: 17px;
  height: 17px;
  min-width: 0;
}

.rank-row {
  display: grid;
  gap: 6px;
}

.rank-top,
.rank-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.rank-top strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf4;
}

.rank-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
  background: #fbfcfe;
}

.employee-card {
  display: grid;
  gap: 6px;
}

.employee-card strong {
  font-size: 20px;
}

.ai-page {
  display: grid;
  gap: 12px;
}

.ai-provider-status {
  align-self: center;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.ai-provider-status.is-ready {
  border-color: #b7e4c7;
  background: #f0fdf4;
  color: #166534;
}

.ai-provider-status.is-warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.ai-case-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  align-items: end;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ai-case-search label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.ai-case-search textarea {
  min-height: 66px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.ai-case-results {
  min-height: 140px;
}

.ai-similar-cases {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ai-case-card {
  position: relative;
  min-width: 0;
  padding: 11px;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.ai-case-card:hover {
  border-color: #efb2b7;
  background: #fffafa;
}

.ai-case-card > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-case-card strong { color: var(--accent-dark); }
.ai-case-card small { color: var(--muted); font-size: 10px; }
.ai-case-card p {
  min-height: 34px;
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ai-case-card em {
  justify-self: start;
  padding: 3px 6px;
  border-radius: 5px;
  background: #f1f5f9;
  color: #526071;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}

.ai-cases-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.modal-root {
  position: relative;
  z-index: 200;
}

.drawer-root {
  position: relative;
  z-index: 100;
}

.client-drawer-root {
  z-index: 130;
}

body.client-over-modal #clientDrawerRoot {
  z-index: 230;
}

.repair-client-form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
}

.repair-client-form-actions > span {
  color: var(--muted);
  font-size: 12px;
}

.repair-client-form-actions > span.is-selected {
  color: var(--green-dark, #247044);
  font-weight: 700;
}

.repair-client-form-actions > span.is-warning {
  color: #b45309;
  font-weight: 700;
}

.client-additional-phones {
  display: grid;
  gap: 8px;
}

.client-additional-phones-head,
.client-additional-phone-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.client-additional-phones-head {
  justify-content: space-between;
}

.client-additional-phone-list {
  display: grid;
  gap: 6px;
}

.client-additional-phone-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.client-additional-phone-row .icon-button {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
}

body.repair-over-client #repairDrawerRoot {
  z-index: 170;
}

body.repair-over-stock #repairDrawerRoot {
  z-index: 180;
}

body.no-scroll {
  overflow: hidden;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.26);
}

.repair-drawer {
  position: fixed;
  z-index: 110;
  top: 0;
  right: 0;
  width: min(600px, 100vw);
  height: 100vh;
  padding: 0;
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -28px 0 80px rgba(15, 23, 42, 0.18);
  animation: drawerIn 0.18s ease;
}

.repair-drawer.no-enter-animation {
  animation: none;
}

.client-drawer {
  width: min(820px, 86vw);
  min-width: 720px;
  max-width: 860px;
  height: 100%;
  max-height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.client-drawer-header,
.client-drawer-actions,
.client-drawer-summary,
.client-drawer-tabs {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  background: #fff;
}

.client-profile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 52px 8px 18px;
}

.client-profile-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.client-profile-head p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 750;
}

.client-drawer .client-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 2px 18px 0;
}

.client-drawer .quick-actions {
  margin: 8px 18px 0;
}

.client-drawer .repair-tabs {
  margin: 12px 18px 0;
}

.client-drawer .client-tab-content {
  padding: 12px 18px 18px;
}

.client-drawer-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  align-content: start;
  overscroll-behavior: contain;
}

.client-drawer .client-drawer-content {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
}

.client-tab-content {
  min-width: 0;
}

.client-overview-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.client-overview-card article {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.client-overview-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.client-overview-card strong {
  color: var(--ink);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.client-overview-wide {
  grid-column: 1 / -1;
}

.client-overview-layout {
  display: grid;
  gap: 12px;
}

.client-info-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.client-info-section h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.client-info-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.client-money-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.client-money-grid article {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.client-money-grid span,
.client-repair-row small {
  color: var(--muted);
  font-size: 12px;
}

.client-money-grid strong {
  color: var(--ink);
  font-size: 15px;
}

.client-balance-card {
  grid-column: 1 / -1;
}

.client-balance-card.is-debt {
  background: #fff5f5;
  border-color: rgba(225, 38, 47, 0.24);
}

.client-balance-card.is-positive,
.client-balance-card.is-closed {
  background: #f0fdf4;
  border-color: rgba(22, 163, 74, 0.24);
}

.client-device-list {
  display: grid;
  gap: 10px;
  min-height: 0;
}

.client-repair-list {
  min-height: 0;
}

.client-repair-row {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(220px, 1.4fr) minmax(120px, 0.6fr);
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.client-repair-row:hover {
  border-color: rgba(225, 38, 47, 0.28);
  background: #fffafa;
}

.client-repair-row span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.client-repair-row strong,
.client-repair-row b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-repair-money {
  text-align: right;
}

.client-show-more {
  width: 100%;
  margin-top: 12px;
  justify-content: center;
}

.client-device-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.client-device-card > button {
  width: 100%;
  padding: 13px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.client-device-card > button strong,
.client-device-card > button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-device-card > button small {
  grid-column: 1 / -1;
  color: var(--muted);
  text-align: left;
}

.client-device-card .mini-list {
  padding: 0 10px 10px;
}

@keyframes drawerIn {
  from {
    transform: translateX(24px);
    opacity: 0.5;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(4px);
}

.modal {
  position: fixed;
  z-index: 210;
  top: 50%;
  left: 50%;
  width: min(820px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  transform: translate(-50%, -50%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
}

.modal.repair-modal {
  height: min(920px, calc(100dvh - 24px));
  max-height: calc(100dvh - 24px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  padding: 0;
}

.repair-modal > .modal-head {
  min-width: 0;
  margin: 0;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.repair-modal > .modal-form {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  overflow: hidden;
}

.repair-modal > .modal-form > .modal-grid {
  min-height: 0;
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 16px 20px 28px;
}

.repair-modal > .modal-form > .modal-actions {
  position: static;
  z-index: 1;
  bottom: auto;
  margin: 0;
  padding: 12px 20px;
  flex: 0 0 auto;
}

.repair-process-modal {
  width: min(880px, calc(100vw - 32px));
}

.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.modal-head span {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.modal-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.modal-form {
  display: grid;
  gap: 16px;
}

.issue-form {
  gap: 14px;
}

.issue-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.issue-section h3 {
  margin: 0;
  font-size: 15px;
}

.issue-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.issue-summary-grid > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.quality-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quality-row {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.quality-row select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 10px;
  background: #fff;
}

.issue-payments {
  display: grid;
  gap: 8px;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.modal-field,
.modal-check {
  min-width: 0;
}

.modal-field input,
.modal-field select,
.modal-field textarea {
  width: 100%;
}

.modal-field-wide {
  grid-column: 1 / -1;
}

.repair-planning-preview {
  padding: 12px;
  display: grid;
  gap: 9px;
  border: 1px solid #bfdbfe;
  border-left: 3px solid #2563eb;
  border-radius: 8px;
  background: #eff6ff;
}

.repair-planning-preview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.repair-planning-preview-head span,
.repair-planning-preview-grid span,
.repair-planning-preview-grid small,
.repair-planning-reasons { color: #64748b; font-size: 11px; }
.repair-planning-preview-head strong { color: #1d4ed8; }

.repair-planning-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.repair-planning-preview-grid > span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.repair-approval-modal { width: min(760px, 94vw); }

.repair-planning-preview-grid > div { min-width: 0; display: grid; gap: 2px; }
.repair-planning-preview-grid strong { overflow-wrap: anywhere; }
.repair-planning-preview-grid .customer-promise strong { color: var(--accent-dark); }
.repair-planning-preview-loading { color: var(--muted); }
.repair-planning-preview-error { color: var(--bad); }
.repair-queue-skip-modal { width: min(560px, 92vw); }

.repair-workflow-plan-dates {
  display: flex;
  justify-content: flex-end;
  gap: 4px 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 1500px) {
  body[data-role="manager"] .manager-dashboard-kpis,
  .manager-analytics-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .manager-dashboard-workspace { grid-template-columns: 1fr; }
}

@media (max-width: 1000px) {
  .repair-queue-plan { grid-template-columns: 1fr; }
  .repair-planning-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-team-capacity { grid-template-columns: 1fr; }
  .master-dashboard-workspace,
  .manager-dashboard-workspace { grid-template-columns: 1fr; }
  body[data-role="master"] .master-dashboard-kpis,
  body[data-role="manager"] .manager-dashboard-kpis,
  body[data-role="administrator"] .administrator-dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .manager-process-grid,
  .manager-analytics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manager-employee-table { min-width: 680px; }
  .manager-employee-load { overflow-x: auto; }
  .master-next-repair { align-items: stretch; flex-direction: column; gap: 12px; }
  .master-next-actions > button { flex: 1; }
  .master-results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .master-queue-table thead { display: none; }
  .master-queue-table,
  .master-queue-table tbody,
  .master-queue-table tr,
  .master-queue-table td { display: block; width: 100%; }
  .master-queue-table tr { padding: 8px 0; border-top: 1px solid var(--line); }
  .master-queue-table td { padding: 3px 7px; border: 0; }
  .master-queue-table td:last-child { padding-top: 7px; }
  .master-queue-table td:last-child button { width: 100%; }
}

.work-participants {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.work-participants > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.work-participants > header div {
  display: grid;
  gap: 2px;
}

.work-participants small {
  color: var(--muted);
  font-size: 11px;
}

.work-participant-method {
  display: grid;
  grid-template-columns: minmax(140px, 0.45fr) minmax(200px, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.work-participant-method select,
.work-participant-row select,
.work-participant-row input {
  width: 100%;
  min-width: 0;
}

.work-participant-list {
  display: grid;
  gap: 6px;
}

.work-participant-row {
  display: grid;
  grid-template-columns: minmax(165px, 1.35fr) minmax(110px, 0.8fr) minmax(82px, 0.55fr) minmax(84px, 0.6fr) 32px;
  align-items: center;
  gap: 6px;
}

.work-participant-row label {
  position: relative;
}

.work-participant-row label span {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.work-participant-row label input {
  padding-right: 24px;
}

.work-participant-row > strong {
  text-align: right;
  font-size: 12px;
  white-space: nowrap;
}

.work-participant-empty {
  padding: 9px 10px;
  color: var(--muted);
  font-size: 12px;
  border: 1px dashed var(--line);
  border-radius: 7px;
}

.work-participant-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.work-participant-summary small {
  margin-left: auto;
}

.work-participant-summary small.valid { color: #16834a; }
.work-participant-summary small.invalid { color: var(--brand); }

@media (max-width: 760px) {
  .work-participant-row { grid-template-columns: 1fr 1fr; }
  .work-participant-row > strong { text-align: left; }
  .work-participant-method { grid-template-columns: 1fr; }
}

.modal-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(225, 38, 47, 0.18);
  border-radius: 12px;
  background: #fff7f7;
  color: var(--ink);
}

.modal-notice strong {
  font-size: 14px;
}

.modal-check {
  min-height: 40px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.modal-check input {
  width: 17px;
  height: 17px;
  min-width: 0;
}

.compact-switch-field {
  min-height: 40px;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.compact-switch-field input {
  width: 17px;
  height: 17px;
  min-width: 0;
  accent-color: var(--accent);
}

.modular-route-switch {
  justify-content: flex-start;
  min-height: 48px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
}

.modular-route-switch:hover {
  border-color: #cbd5e1;
  background: #fff;
}

.modular-route-switch > span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.modular-route-switch b {
  font-size: 13px;
}

.modular-route-switch small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.modular-route-switch input:focus-visible + i {
  outline: 2px solid rgba(229, 37, 53, .3);
  outline-offset: 2px;
}

.repair-intake-modular-switch {
  border-color: rgba(229, 37, 53, .22);
  background: #fff8f8;
}

.iphone-parts-suggestion {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #cfd9e8;
  border-radius: 12px;
  background: #f8fbff;
}

.iphone-parts-suggestion[hidden] { display: none; }

.iphone-parts-suggestion-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.iphone-parts-suggestion-head > div {
  display: grid;
  gap: 2px;
}

.iphone-parts-suggestion-head span {
  color: #526174;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.iphone-parts-suggestion-head strong { font-size: 16px; }
.iphone-parts-suggestion-head > small { max-width: 360px; color: var(--muted); text-align: right; }

.iphone-parts-kind {
  display: grid;
  gap: 7px;
}

.iphone-parts-kind h4 { margin: 0; font-size: 13px; }
.iphone-parts-list { display: grid; gap: 6px; }

.iphone-part-option {
  min-width: 0;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(250px,auto);
  align-items: center;
  gap: 12px;
  border: 1px solid #dde5ef;
  border-radius: 9px;
  background: #fff;
}

.iphone-part-option > div { min-width: 0; display: grid; gap: 3px; }
.iphone-part-option > div:first-child strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iphone-part-option small { color: var(--muted); font-size: 11px; }
.iphone-part-price { text-align: right; }
.iphone-part-price > strong { color: #14834a; font-size: 15px; }
.iphone-part-price.is-missing > strong { color: #b36b00; }
.iphone-parts-loading,.iphone-parts-empty,.iphone-parts-error { padding: 10px; border: 1px dashed #ccd6e3; border-radius: 9px; color: var(--muted); text-align: center; }
.iphone-parts-error { color: var(--brand); }

@media (max-width: 760px) {
  .iphone-parts-suggestion-head { display: grid; gap: 5px; }
  .iphone-parts-suggestion-head > small { text-align: left; }
  .iphone-part-option { grid-template-columns: 1fr; }
  .iphone-part-price { text-align: left; }
}

.repair-app-switch {
  cursor: pointer;
}

.repair-app-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.repair-app-switch i {
  position: relative;
  width: 34px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #d8dee8;
  transition: background .15s ease;
}

.repair-app-switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .18);
  transition: transform .15s ease;
}

.repair-app-switch.is-checked i,
.repair-app-switch:has(input:checked) i {
  background: var(--accent);
}

.repair-app-switch.is-checked i::after,
.repair-app-switch:has(input:checked) i::after {
  transform: translateX(14px);
}

.dictionary-group {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfe;
}

.dictionary-group legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
}

.dictionary-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dictionary-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.dictionary-check input {
  width: 15px;
  height: 15px;
  min-width: 0;
}

.dictionary-other-field {
  margin-top: 10px;
}

.modal-actions {
  position: sticky;
  z-index: 4;
  bottom: -20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0 -20px -20px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -8px 18px rgba(15, 23, 42, 0.04);
}

.client-search-field {
  position: relative;
}

.client-search-control {
  position: relative;
}

.client-search-results {
  display: grid;
  gap: 6px;
}

.client-search-control .client-search-results:not(:empty) {
  position: absolute;
  z-index: 40;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
}

.client-search-results button,
.client-search-empty {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
}

.client-search-results button {
  cursor: pointer;
}

.client-search-results button:hover {
  border-color: rgba(225, 38, 47, 0.3);
  background: #fff7f7;
}

.client-search-results button.is-exact-phone {
  border-color: #86efac;
  background: #f0fdf4;
}

.client-search-results strong,
.client-search-results span {
  display: block;
}

.client-search-results span,
.client-search-empty,
#newClientHint {
  color: var(--muted);
  font-size: 12px;
}

.repair-catalog-modal {
  width: min(1520px, calc(100vw - 40px));
  height: min(860px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.repair-catalog-head {
  flex: 0 0 auto;
  margin-bottom: 12px;
}

.repair-catalog-toolbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.repair-catalog-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.repair-catalog-tabs button {
  min-height: 34px;
  padding: 6px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.repair-catalog-tabs button.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
}

.repair-catalog-search {
  min-width: 0;
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.repair-catalog-search input,
.repair-catalog-number input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.repair-catalog-search input:focus,
.repair-catalog-number input:focus {
  border-color: rgba(225, 38, 47, 0.42);
  box-shadow: 0 0 0 3px rgba(225, 38, 47, 0.08);
}

.repair-catalog-close-option {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.repair-catalog-close-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.repair-catalog-results {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 4px;
}

.repair-catalog-browser {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.repair-catalog-browser.is-work-only {
  grid-template-columns: minmax(0, 1fr);
}

.repair-catalog-browser.is-work-only .repair-catalog-groups {
  display: none;
}

.repair-catalog-groups {
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.repair-catalog-groups > header {
  display: grid;
  gap: 2px;
  padding: 4px 6px 9px;
  border-bottom: 1px solid var(--line);
}

.repair-catalog-groups > header strong {
  font-size: 12px;
}

.repair-catalog-groups > header small {
  color: var(--muted);
  font-size: 10px;
}

.repair-catalog-group-row {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 5px;
  align-items: center;
  padding: 5px 7px 5px calc(7px + var(--group-level, 0) * 13px);
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.repair-catalog-group-row:hover,
.repair-catalog-group-row.active {
  background: #fff;
  color: var(--accent-dark);
}

.repair-catalog-group-row.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.repair-catalog-group-row b {
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repair-catalog-group-row small {
  color: var(--muted);
  font-size: 9px;
}

.repair-catalog-group-toggle {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.repair-catalog-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 110px 110px 130px auto;
  gap: 10px;
  align-items: center;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}

.repair-catalog-row:hover {
  background: #fffafa;
}

.repair-catalog-row.is-unavailable {
  background: #f8fafc;
  opacity: 0.68;
}

.repair-catalog-item-main {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 8px;
  align-items: center;
}

.repair-catalog-item-main strong,
.repair-catalog-item-main small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.repair-catalog-item-main strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.repair-catalog-item-main small {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.repair-catalog-kind {
  grid-row: 1 / 3;
  padding: 3px 6px;
  border-radius: 6px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.repair-catalog-kind.product {
  background: #ecfdf5;
  color: #047857;
}

.repair-catalog-stock,
.repair-catalog-number {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
}

.repair-catalog-stock strong {
  color: var(--ink);
  font-size: 12px;
}

.repair-catalog-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.repair-catalog-actions {
  position: static;
  flex: 0 0 auto;
  align-items: center;
  margin-top: 12px;
}

.repair-catalog-actions > span {
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 820px) {
  .repair-catalog-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .repair-catalog-tabs {
    justify-content: stretch;
  }

  .repair-catalog-tabs button {
    flex: 1;
  }

  .repair-catalog-row {
    grid-template-columns: minmax(0, 1fr) 90px 100px;
  }

  .repair-catalog-stock {
    display: none;
  }

  .repair-catalog-row > button {
    grid-column: 3;
  }

  .repair-catalog-browser {
    grid-template-columns: 1fr;
  }

  .repair-catalog-groups {
    max-height: 180px;
  }
}

@media (min-width: 821px) and (max-width: 1180px) {
  .repair-catalog-browser {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .repair-catalog-row {
    grid-template-columns: minmax(280px, 1fr) 94px 100px 112px auto;
    gap: 7px;
  }
}

@media (max-width: 700px) {
  .repair-inline-add {
    grid-template-columns: 1fr;
  }

  .repair-inline-actions {
    flex-wrap: wrap;
  }
}

.autocomplete-field {
  position: relative;
}

.autocomplete-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  display: grid;
  gap: 4px;
  max-height: 230px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}

.autocomplete-results[hidden] {
  display: none;
}

.autocomplete-results button {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.autocomplete-results button:hover,
.autocomplete-results button.is-active {
  background: #fff1f2;
  color: var(--accent);
}

.autocomplete-results mark {
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

.autocomplete-add {
  border-top: 1px solid var(--line) !important;
  color: var(--accent) !important;
  font-weight: 700;
}

.toast {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2200;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid rgba(22, 138, 85, 0.26);
  border-radius: 12px;
  background: #f0fdf4;
  color: #14532d;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.toast[data-tone="error"] {
  background: #fff1f2;
  border-color: rgba(190, 18, 60, 0.24);
  color: #9f1239;
}

.toast-close {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: currentColor;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 26px;
  font-size: 18px;
  height: 26px;
  justify-content: center;
  padding: 0;
  width: 26px;
}

.toast-close:hover {
  background: rgba(15, 23, 42, 0.08);
}

.money-good { color: var(--good); }
.money-bad { color: var(--bad); }

.boot-error {
  display: block;
  padding: 32px;
}

body[data-section="orders"] main {
  gap: 10px;
}

body[data-section="orders"] .topbar {
  display: none;
}

body[data-section="orders"] .topbar .filters,
body[data-section="orders"] #roleLabel,
body[data-section="orders"] #pageDescription {
  display: none;
}

body[data-section="finance"] .topbar .filters {
  display: none;
}

body[data-section="finance"] .topbar {
  display: none;
}

body[data-section="sales"] .topbar {
  display: none;
}

body[data-section="print3d"] .topbar {
  display: none;
}

body[data-section="employees"] .topbar .filters {
  display: none;
}

body[data-section="stock"] .topbar .filters {
  display: none;
}

body[data-section="stock"] #roleLabel,
body[data-section="stock"] #pageDescription {
  display: none;
}

body[data-section="stock"] .topbar {
  display: none;
}

body[data-section="stock"] main {
  gap: 8px;
  padding-top: 12px;
}

body[data-section="stock"] #stock {
  gap: 8px;
}

.stock-page-head {
  align-items: center;
  margin-bottom: 0;
  min-height: 48px;
  padding: 7px 10px 7px 12px;
}

.stock-page-head > div:first-child {
  align-items: baseline;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.stock-page-head > div:first-child > span {
  display: none;
}

.stock-page-head h2 {
  flex: 0 0 auto;
  font-size: 18px;
  margin: 0;
}

.stock-page-head p {
  font-size: 12px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-page-head .page-actions {
  flex-wrap: nowrap;
  gap: 7px;
}

.stock-page-head .page-actions button {
  height: 34px;
  padding: 0 11px;
}

body[data-section="stock"] .stock-workspace {
  gap: 8px;
}

body[data-section="stock"] .stock-command-bar {
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  min-height: 38px;
  padding: 4px;
}

body[data-section="stock"] .stock-tabs {
  border: 0;
  border-radius: 0;
  background: transparent;
  gap: 5px;
  padding: 0;
}

body[data-section="stock"] .stock-tabs button {
  min-height: 32px;
  padding: 5px 11px;
}

body[data-section="stock"] .stock-command-actions {
  display: flex;
  gap: 6px;
}

body[data-section="stock"] .stock-command-actions button {
  height: 30px;
  padding: 0 11px;
}

body[data-section="stock"] .stock-filter-panel {
  gap: 7px;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  padding: 8px;
}

body[data-section="stock"] .stock-filter-panel label {
  gap: 3px;
}

body[data-section="stock"] .stock-filter-label {
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

body[data-section="stock"] .stock-filter-panel input,
body[data-section="stock"] .stock-filter-panel select {
  min-height: 32px;
  padding: 6px 9px;
}

body[data-section="stock"] .stock-sale-toolbar {
  gap: 7px;
  min-height: 34px;
}

body[data-section="stock"] .stock-sale-toolbar button {
  min-height: 32px;
  padding: 6px 10px;
}

body[data-section="stock"] .stock-table th,
body[data-section="stock"] .stock-table td {
  line-height: 1.2;
  padding: 8px 10px;
}

body[data-section="stock"] .stock-balance-head tr:nth-child(2) th {
  top: 31px;
}

body[data-section="stock"] .stock-table td small {
  margin-top: 2px;
}

body[data-section="stock"] main {
  box-sizing: border-box;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding: 8px 16px 10px;
}

body[data-nav-layout="top"][data-section="stock"] main {
  height: calc(100dvh - 72px);
}

body[data-section="stock"] #stock,
body[data-section="stock"] .stock-workspace,
body[data-section="stock"] .stock-tab-content,
body[data-section="stock"] .stock-balances-layout,
body[data-section="stock"] .stock-balances-main,
body[data-section="stock"] .stock-panel,
body[data-section="stock"] #stockResultsRegion {
  min-height: 0;
}

body[data-section="stock"] #stock {
  height: 100%;
  overflow: hidden;
}

body[data-section="stock"] .stock-workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
}

body[data-section="stock"] .stock-tab-content {
  overflow: hidden;
}

body[data-section="stock"] .stock-balances-layout {
  height: 100%;
}

body[data-section="stock"] .stock-balances-main,
body[data-section="stock"] .stock-documents-content {
  display: grid;
  gap: 8px;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
}

body[data-section="stock"] .stock-recommendations-content {
  height: 100%;
  overflow: auto;
}

.stock-recommendations {
  display: grid;
  gap: 10px;
  padding-right: 2px;
}

.stock-recommendations-toolbar,
.stock-recommendation-panel-head {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.stock-recommendations-toolbar {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.stock-recommendations h2,
.stock-recommendations h3,
.stock-recommendations p {
  margin: 0;
}

.stock-recommendations h2 {
  font-size: 16px;
}

.stock-recommendations h3 {
  font-size: 14px;
}

.stock-recommendations p,
.stock-recommendation-panel-head p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 3px;
}

.stock-recommendations-controls {
  align-items: end;
  display: flex;
  gap: 8px;
}

.stock-recommendations-controls label {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 700;
  gap: 3px;
}

.stock-recommendations-controls select {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  min-height: 30px;
  padding: 4px 8px;
}

.stock-recommendation-summary {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stock-recommendation-summary article {
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px;
}

.stock-recommendation-summary article.urgent {
  border-color: rgba(225, 38, 47, .32);
  background: #fff5f5;
}

.stock-recommendation-summary article.withdraw {
  border-color: rgba(177, 109, 0, .28);
  background: #fffaf0;
}

.stock-recommendation-summary span,
.stock-recommendation-summary small {
  color: var(--muted);
  font-size: 11px;
}

.stock-recommendation-summary strong {
  color: var(--text);
  font-size: 21px;
  line-height: 1.05;
}

.stock-recommendation-panel {
  padding: 0;
}

.stock-recommendation-panel-head {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
}

.stock-recommendation-panel-head > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.stock-recommendation-table-wrap {
  min-height: 0;
  max-height: none;
}

/* Share the remaining workspace height between populated recommendation lists. */
@media (min-width: 761px) {
  body[data-section="stock"] main:has(.stock-recommendations-content) {
    grid-template-rows: minmax(0, 1fr);
  }

  .stock-recommendations {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }

  .stock-recommendations > * {
    flex-shrink: 0;
  }

  .stock-recommendation-panel:has(.stock-recommendation-table-wrap) {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    flex: 1 0 200px;
    min-height: 200px;
  }
}

@media (max-width: 760px) {
  .stock-recommendation-table-wrap {
    max-height: 62dvh;
  }
}

.stock-recommendation-table {
  min-width: 940px;
}

.stock-recommendation-table tr {
  cursor: default;
}

.stock-recommendation-table td:last-child {
  min-width: 145px;
}

.stock-recommendation-priority {
  border-radius: 999px;
  background: #edf5ff;
  color: #2168b7;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 7px;
  white-space: nowrap;
}

.stock-recommendation-priority.urgent {
  background: #ffe7e7;
  color: #b42020;
}

.stock-recommendation-priority.withdraw {
  background: #fff0cf;
  color: #9a5c00;
}

@media (max-width: 920px) {
  .stock-recommendations-toolbar,
  .stock-recommendation-panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .stock-recommendation-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

body[data-section="stock"] .stock-groups-panel {
  align-self: stretch;
  height: 100%;
  max-height: none;
}

body[data-section="stock"] .stock-panel,
body[data-section="stock"] #stockResultsRegion,
body[data-section="stock"] .stock-table-wrap {
  height: 100%;
}

body[data-section="stock"] #stockResultsRegion {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

body[data-section="stock"] .stock-table-wrap {
  max-height: none;
}

@media (max-width: 760px) {
  body[data-section="stock"] main,
  body[data-nav-layout="top"][data-section="stock"] main {
    height: auto;
    overflow: visible;
    padding: 8px;
  }

  body[data-section="stock"] #stock {
    height: auto;
    overflow: visible;
  }

body[data-section="stock"] .stock-command-bar {
    align-items: stretch;
    flex-direction: column;
  }

  body[data-section="stock"] .stock-command-actions button {
    flex: 1 1 0;
  }

  body[data-section="stock"] .stock-tab-content,
  body[data-section="stock"] .stock-balances-layout,
  body[data-section="stock"] .stock-balances-main,
  body[data-section="stock"] .stock-recommendations-content,
  body[data-section="stock"] .stock-groups-panel,
  body[data-section="stock"] .stock-panel,
  body[data-section="stock"] #stockResultsRegion,
  body[data-section="stock"] .stock-table-wrap {
    height: auto;
  }

  body[data-section="stock"] .stock-groups-panel,
  body[data-section="stock"] .stock-table-wrap {
    max-height: 62vh;
  }

  .stock-recommendation-summary {
    grid-template-columns: 1fr;
  }

  .stock-recommendations-controls {
    align-items: stretch;
    flex-direction: column;
  }
}

body[data-section="orders"] h1 {
  font-size: 28px;
}

body[data-section="orders"] #orders {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px 8px;
}

.repair-top-actions {
  grid-column: 3;
  grid-row: 1;
  margin: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

body[data-section="orders"] .repair-top-actions .primary-action {
  min-height: 34px;
  padding: 6px 12px;
}

body[data-section="orders"] .repair-active-selection {
  grid-column: 1;
  grid-row: 1;
  min-height: 32px;
  align-self: center;
}

body[data-section="orders"] .repair-work-queue {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  margin: 0;
}

body[data-section="orders"] #orders:has(.repair-active-selection[hidden]) .repair-work-queue {
  grid-column: 1 / 3;
}

body[data-section="orders"] .repair-queue-plan,
body[data-section="orders"] .repair-filter-panel,
body[data-section="orders"] .repairs-list-panel {
  grid-column: 1 / -1;
}

.repair-top-actions strong,
.repairs-visible-count {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.repair-status-strip {
  gap: 10px;
  padding-bottom: 0;
}

.repair-status-chip {
  min-height: 34px;
  padding: 6px 10px;
  gap: 6px;
  box-shadow: none;
}

.repair-status-chip strong {
  min-width: 22px;
  padding: 1px 6px;
}

.repair-filter-panel {
  padding: 6px 8px;
  display: flex;
  flex-wrap: nowrap;
  align-items: end;
  gap: 6px;
  border-radius: 12px;
  box-shadow: none;
}

.repair-filter-panel label {
  flex: 0 1 150px;
}

.repair-filter-panel label:first-child {
  flex: 1 1 460px;
}

.repair-filter-panel input,
.repair-filter-panel select,
.repair-filter-panel .secondary-action {
  height: 32px;
  min-height: 32px;
  padding-top: 5px;
  padding-bottom: 5px;
}

.repair-filter-panel .secondary-action {
  flex: 0 0 auto;
}

.repairs-list-panel {
  padding: 8px 10px 10px;
}

.repairs-visible-count {
  margin-bottom: 6px;
}

#repairsTable {
  min-width: 1180px;
  table-layout: fixed;
}

#repairsTable th,
#repairsTable td {
  padding: 9px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

#repairsTable td strong,
#repairsTable td span:not(.status) {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#repairsTable th:nth-child(1) { width: 112px; }
#repairsTable th:nth-child(2) { width: 86px; }
#repairsTable th:nth-child(3) { width: 178px; }
#repairsTable th:nth-child(4) { width: 136px; }
#repairsTable th:nth-child(5) { width: 190px; }
#repairsTable th:nth-child(6) { width: 218px; }
#repairsTable th:nth-child(7) { width: 150px; }
#repairsTable th:nth-child(8) { width: 132px; }
#repairsTable th:nth-child(9) { width: 112px; }
#repairsTable th:nth-child(10) { width: 112px; }

.repair-group-row td {
  background: #f6f8fb;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 7px 10px;
}

.repair-group-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font: inherit;
  gap: 8px;
  padding: 0;
  text-align: left;
  width: 100%;
}

#repairsTable .repair-group-toggle strong {
  display: inline;
  font-size: 13px;
  font-weight: 800;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

#repairsTable .repair-group-toggle small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#repairsTable .repair-group-caret {
  color: var(--muted);
  display: inline-block;
  font-size: 13px;
  width: 14px;
}

#repairsTable .status-dot {
  border-radius: 999px;
  display: inline-block;
  height: 8px;
  width: 8px;
}

#repairsTable tr.landing-lead-needs-contact > td {
  background: #fff8e7;
  border-top-color: #f4c96b;
  border-bottom-color: #f4c96b;
}

#repairsTable tr.landing-lead-needs-contact > td:first-child {
  box-shadow: inset 4px 0 0 #f59e0b;
}

#repairsTable tr.landing-lead-contacted > td {
  background: #f4fbf7;
}

.landing-source-badge {
  display: inline-flex;
  margin-top: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #fff0c2;
  color: #8a5200;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.landing-call-link,
.landing-contact-toggle {
  display: inline-flex;
  width: max-content;
  margin-top: 5px;
  color: #9a5b00;
  font-size: 10px;
  font-weight: 750;
  text-decoration: none;
}

.landing-call-link:hover { text-decoration: underline; }

.landing-contact-toggle {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.landing-contact-toggle:hover { color: #5f3700; text-decoration: underline; }

.landing-contact-status.needs-contact {
  background: #ffdf8a;
  color: #744300;
}

.landing-contact-status.contacted {
  background: #d9f4e4;
  color: #17643a;
}

.status-dot.status-tone-blue { background: #2563eb; }
.status-dot.status-tone-violet { background: #7c3aed; }
.status-dot.status-tone-yellow { background: #d97706; }
.status-dot.status-tone-orange { background: #ea580c; }
.status-dot.status-tone-dark-orange { background: #c2410c; }
.status-dot.status-tone-green { background: #16a34a; }
.status-dot.status-tone-teal { background: #0f766e; }
.status-dot.status-tone-gray { background: #64748b; }
.status-dot.status-tone-red { background: #dc2626; }
.status-dot.status-tone-dark-gray { background: #475569; }
.status-dot.status-tone-burgundy { background: #9f1239; }
.status-dot.status-tone-light-gray { background: #94a3b8; }

.repair-drawer {
  width: min(1440px, 95vw);
  min-width: 1100px;
  max-width: 1440px;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-y: hidden;
  overflow-x: hidden;
}

.repair-card {
  overflow-x: hidden;
}

.repair-card-head {
  gap: 12px;
}

.repair-card-head h2 {
  font-size: 20px;
}

.repair-card-top-controls {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.repair-header-compact {
  display: block;
  padding: 0 44px 8px 0;
}

.repair-header-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.repair-title-row {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.repair-title-stack {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.repair-header-compact .repair-title-stack h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0;
}

.repair-header-compact .repair-title-stack strong {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.repair-main-issue {
  margin: 0;
  color: #991b1b;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.repair-header-meta {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  color: var(--muted);
  font-size: 12px;
}

.repair-meta-item,
.repair-age-badge,
.repair-header-client-link {
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  padding: 0 8px;
  max-width: 100%;
}

.repair-meta-client {
  color: var(--ink);
  font-weight: 800;
}

.repair-age-badge {
  color: #047857;
  border-color: #bbf7d0;
  background: #f0fdf4;
  font-weight: 800;
}

.repair-age-badge.is-muted {
  color: var(--muted);
  border-color: var(--line);
  background: #f8fafc;
}

.repair-age-badge.is-old {
  color: #b45309;
  border-color: #fde68a;
  background: #fffbeb;
}

.repair-age-badge.is-critical {
  color: #b91c1c;
  border-color: #fecdd3;
  background: #fff1f2;
}

.repair-header-client-link {
  appearance: none;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.repair-header-client-link:hover {
  color: var(--accent-dark);
  border-color: rgba(225, 38, 47, 0.35);
  background: #fff5f5;
}

.repair-journal-amount {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  white-space: nowrap;
  font-weight: 750;
}

.repair-journal-amount.is-estimate {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.repair-journal-amount.is-under {
  color: #a16207;
  border-color: #fde68a;
  background: #fffbeb;
}

.repair-journal-amount.is-equal {
  color: #15803d;
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.repair-journal-amount.is-over {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}

.repair-journal-amount.is-neutral {
  color: var(--muted);
  border-color: var(--line);
  background: #f8fafc;
}

.repair-header-compact .repair-status-select-wrap {
  flex: 0 0 auto;
  min-width: 210px;
}

.repair-drawer-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 20px 32px;
}

.repair-drawer-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: start;
}

.repair-history-panel {
  position: sticky;
  top: 0;
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.repair-history-panel header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.repair-history-panel header span {
  color: var(--ink);
  font-weight: 800;
}

.repair-history-panel header strong {
  color: var(--muted);
  font-size: 12px;
}

.repair-history-timeline {
  display: grid;
  gap: 6px;
}

.repair-history-item {
  position: relative;
  padding: 6px 6px 6px 20px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.repair-history-item::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
}

.repair-history-item.history-create::before { background: var(--good); }
.repair-history-item.history-status::before { background: #0ea5e9; }
.repair-history-item.history-edit::before { background: var(--accent); }
.repair-history-item.history-money::before { background: var(--accent-2); }
.repair-history-item.history-diagnostics::before { background: #8b5cf6; }

.repair-history-item summary {
  cursor: pointer;
  list-style: none;
}

.repair-history-item summary::-webkit-details-marker {
  display: none;
}

.repair-history-item summary span {
  min-width: 0;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 7px;
  align-items: baseline;
}

.repair-history-item time,
.repair-history-item small {
  color: var(--muted);
  font-size: 11px;
}

.repair-history-item strong {
  display: block;
  margin: 0;
  font-size: 12px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repair-history-item p {
  margin: 5px 0 3px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.repair-history-details {
  padding-left: 89px;
}

.device-history-box {
  margin-top: 10px;
  padding: 10px;
  display: grid;
  gap: 7px;
  border: 1px solid rgba(225, 38, 47, 0.18);
  border-radius: 12px;
  background: #fff7f7;
}

.device-history-box > span,
.device-history-box small,
.device-history-box p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.device-history-box article {
  padding-top: 7px;
  border-top: 1px solid rgba(225, 38, 47, 0.12);
}

.repair-card.is-editing {
  padding: 12px;
  margin: -12px;
  border: 1px solid rgba(225, 38, 47, 0.18);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #fff8f8);
}

.repair-edit-actions {
  min-height: 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.repair-action-panel {
  justify-content: stretch;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(18, 24, 40, 0.05);
}

.repair-drawer-actionbar {
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
  margin: 0;
  padding: 10px 16px max(10px, env(safe-area-inset-bottom));
  border-width: 1px 0 0;
  border-radius: 0;
  box-shadow: 0 -16px 34px rgba(15, 23, 42, 0.08);
}

.repair-action-left,
.repair-action-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.repair-action-left {
  margin-right: auto;
}

.repair-print-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.repair-print-action svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.repair-print-modal {
  width: min(620px, 94vw);
}

.repair-print-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.repair-print-option {
  min-width: 0;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.repair-print-option:hover {
  border-color: rgba(225, 38, 47, 0.35);
  background: #fffafa;
}

.repair-print-option input[type="checkbox"] {
  width: 17px;
  height: 17px;
  min-width: 17px;
  margin: 1px 0 0;
  padding: 0;
  align-self: start;
  accent-color: var(--accent);
}

.repair-print-option:has(input:checked) {
  border-color: rgba(225, 38, 47, 0.42);
  background: #fff7f8;
  box-shadow: inset 3px 0 0 var(--accent);
}

.repair-print-option span {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.repair-print-option small {
  color: var(--muted);
  line-height: 1.35;
}

@media (max-width: 620px) {
  .repair-print-options { grid-template-columns: 1fr; }
}

.compact-action,
.repair-more-menu summary {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1;
}

.inline-field-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.stock-label-name-field small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.stock-group-picker-field {
  position: relative;
}

.stock-group-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  position: relative;
}

.stock-group-picker-trigger {
  align-items: start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 3px;
  min-height: 42px;
  padding: 8px 10px;
  text-align: left;
}

.stock-group-picker-trigger span {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-group-picker-trigger small {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.stock-group-picker-popover {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.18);
  display: grid;
  gap: 8px;
  left: 0;
  max-height: 340px;
  overflow: auto;
  padding: 10px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 80;
}

.stock-group-picker-popover input {
  width: 100%;
}

.stock-group-picker-tree {
  display: grid;
  gap: 3px;
}

.stock-group-picker-node {
  display: grid;
  gap: 3px;
}

.stock-group-picker-node summary {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  list-style: none;
}

.stock-group-picker-node summary::-webkit-details-marker {
  display: none;
}

.stock-group-picker-row {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 2px 7px;
  grid-template-columns: calc(var(--level, 0) * 14px) minmax(0, 1fr);
  min-height: 34px;
  padding: 6px 8px;
  text-align: left;
  width: 100%;
}

.stock-group-picker-row:hover,
.stock-group-picker-row.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.stock-group-picker-row strong,
.stock-group-picker-row small {
  grid-column: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-group-picker-row small {
  color: var(--muted);
  font-size: 11px;
}

.stock-group-picker-empty {
  color: var(--muted);
  padding: 10px;
  text-align: center;
}

.neutral-action {
  color: var(--muted);
}

.repair-more-menu {
  position: relative;
}

.repair-more-menu summary {
  width: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.repair-more-menu summary::-webkit-details-marker {
  display: none;
}

.repair-more-menu[open] summary {
  border-color: rgba(15, 23, 42, 0.18);
  color: var(--ink);
}

.repair-more-menu-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 230px;
  padding: 6px;
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
}

.repair-drawer-actionbar .repair-more-menu-list {
  top: auto;
  bottom: calc(100% + 6px);
}

.repair-more-menu-list button {
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.repair-more-menu-list button:hover {
  background: #f8fafc;
}

.repair-more-menu-list .danger-menu-item {
  color: var(--accent-dark);
}

.repair-edit-actions span {
  margin-right: auto;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.same-client-action {
  border-color: rgba(225, 38, 47, 0.24);
  background: #fff7f7;
  color: var(--accent-dark);
  font-weight: 800;
}

.same-client-action:hover {
  border-color: rgba(225, 38, 47, 0.42);
  background: #fff1f1;
}

.repair-inline-add {
  position: relative;
  margin: 6px 0 10px;
}

.repair-inline-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.repair-inline-add label {
  display: grid;
  gap: 5px;
}

.repair-inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.repair-inline-actions button {
  min-height: 36px;
  white-space: nowrap;
}

.repair-inline-cancel {
  white-space: nowrap;
}

.repair-inline-add label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.repair-inline-add input {
  width: 100%;
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  outline: none;
}

.repair-inline-add input:focus {
  border-color: rgba(225, 38, 47, 0.42);
  box-shadow: 0 0 0 3px rgba(225, 38, 47, 0.08);
}

.repair-inline-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  max-height: 330px;
  overflow: auto;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
}

.repair-inline-group + .repair-inline-group {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.repair-inline-group > strong {
  display: block;
  margin: 0 0 4px 4px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.repair-inline-group button {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.repair-inline-group button:hover,
.repair-inline-group button.is-active {
  background: #fff1f2;
}

.repair-inline-group button.has-stock-state.is-available {
  box-shadow: inset 3px 0 0 #16a465;
}

.repair-inline-group button.has-stock-state.is-empty {
  opacity: 0.68;
}

.repair-inline-group button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 750;
}

.repair-inline-group button .repair-inline-result-name {
  display: flex;
  align-items: center;
  gap: 7px;
}

.repair-inline-group button .repair-inline-result-name > span {
  flex: 1 1 auto;
}

.repair-inline-group button .repair-inline-stock {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  max-width: none;
  padding: 3px 7px;
  overflow: visible;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: clip;
  white-space: nowrap;
}

.repair-inline-stock.is-available {
  color: #087443;
  background: #e8f8ef;
}

.repair-inline-stock.is-empty {
  color: #8b6470;
  background: #f4eef0;
}

.repair-inline-group button small,
.repair-inline-empty {
  color: var(--muted);
  font-size: 12px;
}

.inline-price-picks {
  display: flex;
  gap: 4px;
  margin: -2px 0 5px 9px;
}

.inline-price-picks button {
  min-height: 24px;
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.inline-price-picks button:hover:not(:disabled) {
  border-color: rgba(225, 38, 47, 0.34);
  color: var(--accent);
  background: #fff5f5;
}

.repair-inline-empty {
  padding: 10px;
}

.repair-work-tree {
  display: grid;
  gap: 12px;
}

.work-tree-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.work-tree-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 12px;
}

.work-tree-title {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.work-tree-title strong {
  color: var(--ink);
  font-size: 16px;
  overflow-wrap: anywhere;
}

.work-tree-title small,
.work-tree-meta,
.work-tree-attachment small,
.loose-parts-warning span {
  color: var(--muted);
  font-size: 12px;
}

.work-tree-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
}

.work-tree-meta b {
  color: var(--ink);
}

.work-tree-meta span:first-child {
  color: var(--ink);
  font-size: 16px;
}

.work-inline-fields {
  display: grid;
  grid-template-columns: 74px 92px 82px minmax(150px, 1fr);
  gap: 6px;
  align-items: end;
}

.work-inline-fields label {
  min-width: 0;
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.work-inline-input {
  width: 100%;
  min-height: 30px;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  outline: none;
}

.work-inline-input:hover {
  border-color: var(--line);
  background: #fff;
}

.work-inline-input:focus {
  border-color: rgba(225, 38, 47, 0.42);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(225, 38, 47, 0.08);
}

.work-inline-select {
  min-width: 0;
}

.work-tree-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.work-tree-attachments {
  display: grid;
  gap: 0;
  padding: 0 12px 12px 20px;
  background: #fbfcfe;
}

.work-tree-attachment {
  min-width: 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
  min-height: 40px;
  padding: 6px 0;
  border-top: 1px solid rgba(226, 232, 240, 0.7);
}

.work-tree-attachment strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.work-tree-attachment-title {
  min-width: 0;
  grid-column: 2;
  grid-row: 1;
}

.work-tree-attachment-meta {
  min-width: 0;
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 5px 10px;
  color: var(--muted);
  font-size: 12px;
}

.work-tree-attachment-actions {
  grid-column: 3;
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  white-space: nowrap;
}

.work-tree-attachment-actions .secondary-action {
  min-height: 30px;
  padding-inline: 9px;
}

.work-tree-branch {
  grid-column: 1;
  grid-row: 1 / span 2;
  color: var(--muted);
  font-family: Consolas, monospace;
  font-size: 12px;
}

.work-tree-cost {
  color: var(--muted);
  white-space: nowrap;
}

.loose-parts-warning {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px dashed #fbbf24;
  border-radius: 12px;
  background: #fffbeb;
}

.repair-products-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  overflow: hidden;
}

.repair-products-list > header,
.repair-product-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
}

.repair-products-list > header {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  font-size: 12px;
}

.repair-products-list > header span {
  color: var(--muted);
}

.repair-product-row + .repair-product-row {
  border-top: 1px solid var(--line);
}

.repair-product-main {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  gap: 2px;
}

.repair-product-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repair-product-row small {
  color: var(--muted);
  font-size: 11px;
}

.repair-product-price {
  flex: 0 0 auto;
  display: grid;
  justify-items: end;
  gap: 2px;
}

.repair-product-cost {
  flex: 0 0 auto;
  white-space: nowrap;
}

.work-row.has-attachments {
  border-bottom-color: transparent;
}

.work-attachments {
  display: grid;
  gap: 4px;
  padding: 0 8px 8px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.work-own-row {
  min-height: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 5px 14px 5px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
  color: var(--muted);
  font-size: 12px;
}

.work-own-row b {
  color: var(--ink);
}

.work-attachment-row {
  min-height: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 30px;
  gap: 8px;
  align-items: center;
  padding: 5px 6px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 12px;
}

.work-attachment-row:hover {
  background: #fff;
}

.work-attachment-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;
}

.work-attachment-row small {
  color: var(--muted);
}

.work-attach-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px 9px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.work-attach-control select {
  min-height: 32px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

.repair-view-compact {
  display: grid;
  gap: 7px;
}

.repair-client-badge {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.repair-client-badge.is-retail {
  border: 1px solid rgba(22, 138, 85, 0.22);
  background: #f0fdf4;
  color: #146c43;
}

.repair-client-badge.is-b2b {
  border: 1px solid rgba(124, 58, 237, 0.22);
  background: #f5f3ff;
  color: #6d28d9;
}

.repair-view-section {
  display: grid;
  gap: 3px;
}

.repair-view-section h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.repair-view-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px 12px;
}

.repair-view-field {
  min-width: 0;
  padding: 5px 0;
  border-bottom: 1px solid #eef2f7;
}

.repair-view-field.wide {
  grid-column: 1 / -1;
}

.repair-view-field.span-2 {
  grid-column: span 2;
}

.repair-view-field span {
  display: block;
  margin-bottom: 1px;
  color: var(--muted);
  font-size: 11px;
}

.repair-view-field b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.inline-edit-button {
  width: 24px;
  height: 24px;
  margin-left: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.inline-edit-button:hover {
  color: var(--ink);
  background: #f8fafc;
}

.repair-summary-grid,
.repair-tab-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.repair-info-sections {
  display: grid;
  gap: 12px;
}

.repair-accordion-list {
  display: grid;
  gap: 7px;
}

.repair-accordion {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.repair-accordion-head {
  width: 100%;
  min-height: 42px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.repair-accordion-head:hover {
  background: #fff7f7;
}

.repair-accordion-head span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.repair-accordion-head strong,
.repair-accordion-head small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repair-accordion-head small {
  color: var(--muted);
  font-size: 12px;
}

.repair-accordion-head b {
  color: var(--accent-dark);
  font-size: 16px;
}

.repair-accordion-body {
  padding: 8px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

.repair-info-section {
  display: grid;
  gap: 8px;
}

.repair-info-section h3 {
  color: var(--ink);
  font-size: 13px;
}

.repair-info-section .detail-list {
  gap: 5px;
}

.repair-info-section .detail-list div {
  padding: 6px 8px;
  border-radius: 10px;
}

.repair-info-section .detail-list dt {
  margin-bottom: 1px;
  font-size: 11px;
}

.repair-info-section .detail-list dd {
  font-size: 12px;
  line-height: 1.25;
}

.repair-finance-compact {
  display: grid;
  gap: 8px;
}

.finance-main-grid,
.finance-extra-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.finance-detail-grid article {
  min-height: 58px;
  padding: 9px 10px;
}

.finance-details-toggle {
  width: fit-content;
  min-height: 34px;
  padding-inline: 14px;
}

.repair-finance-details {
  display: grid;
  gap: 10px;
}

.finance-payment-history {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.finance-payment-history > strong {
  font-size: 13px;
}

.finance-payment-history article {
  display: grid;
  grid-template-columns: 120px 110px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

.finance-payment-history span,
.finance-payment-history small,
.finance-payment-history p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.finance-payment-history b {
  color: var(--ink);
}

.finance-payment-history .payment-history-action {
  min-height: 30px;
  padding: 5px 10px;
  white-space: nowrap;
}

.finance-payment-history .payment-history-reversed {
  opacity: 0.62;
}

.finance-payment-history .payment-history-focused {
  margin-inline: -7px;
  padding-inline: 7px;
  border: 1px solid #ef9a9a;
  border-radius: 9px;
  background: #fff4f4;
  box-shadow: 0 0 0 3px rgba(211, 35, 45, 0.08);
}

.payment-correction-note {
  padding: 10px 12px;
  border: 1px solid #f3d2a4;
  border-radius: 8px;
  background: #fff8eb;
  color: #654515;
  font-size: 13px;
  line-height: 1.45;
}

.payment-method-correction-modal {
  width: min(560px, 94vw);
}

.repair-edit-form,
.repair-edit-grid {
  display: grid;
  gap: 8px;
}

.repair-edit-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.repair-edit-wide,
.repair-edit-dictionary {
  grid-column: 1 / -1;
}

.repair-edit-form input,
.repair-edit-form select {
  height: 32px;
  width: 100%;
}

.repair-edit-form textarea {
  width: 100%;
  min-height: 54px;
  line-height: 1.35;
}

.repair-edit-form .modal-field {
  gap: 4px;
  font-size: 12px;
}

.repair-edit-form .repair-info-section {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.repair-edit-form .repair-info-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.repair-edit-form .dictionary-group {
  padding: 8px;
}

.repair-edit-form .dictionary-check {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.repair-edit-form .dictionary-options {
  gap: 5px;
}

.repair-edit-form .dictionary-check input {
  width: 14px;
  height: 14px;
}

.repair-imei-field span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.repair-imei-field button {
  height: 36px;
  white-space: nowrap;
}

.imei-lookup-status {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.imei-lookup-status[data-tone="ok"] {
  border-color: rgba(22, 138, 85, 0.25);
  background: #f0fdf4;
  color: #146c43;
}

.imei-lookup-status[data-tone="warn"] {
  border-color: rgba(245, 158, 11, 0.3);
  background: #fffbeb;
  color: #8a5600;
}

.repair-summary-grid strong,
.detail-list dd,
.timeline-item p {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
}

.quick-actions button {
  flex: 1 1 120px;
}

.repair-tabs {
  gap: 6px;
  flex-wrap: wrap;
  overflow-x: hidden;
}

.repair-tabs button {
  flex: 1 1 104px;
}

.repair-history-note {
  padding: 12px 14px;
  display: grid;
  gap: 4px;
  border: 1px solid rgba(225, 38, 47, 0.16);
  border-radius: 12px;
  background: #fff7f7;
}

.repair-history-note span {
  color: var(--muted);
  font-size: 12px;
}

.repair-tab-content,
.work-table,
.position-table {
  overflow-x: hidden;
}

.work-head,
.work-row {
  min-width: 0;
  grid-template-columns: minmax(170px, 1.5fr) 64px minmax(120px, 1fr) 78px 90px 90px 74px;
}

.repair-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.repair-work-minimal {
  display: grid;
  gap: 8px;
}

.repair-work-executor-picker {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(220px, 320px);
  gap: 10px;
  align-items: center;
  width: fit-content;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.repair-work-executor-picker select,
.work-tree-executor select {
  min-height: 32px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.work-tree-executor {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.work-tree-executor > span {
  color: var(--muted);
}

.work-tree-executor select {
  max-width: 230px;
  padding: 3px 28px 3px 8px;
  font-size: 12px;
}

.repair-work-executor-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  align-items: baseline;
}

.repair-work-executor-notice small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.repair-finance-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 16px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
}

.repair-work-economy {
  position: relative;
}

.repair-work-economy summary,
.repair-work-notes > summary,
.loose-parts-warning > summary {
  cursor: pointer;
  list-style: none;
}

.repair-work-economy summary::-webkit-details-marker,
.repair-work-notes > summary::-webkit-details-marker,
.loose-parts-warning > summary::-webkit-details-marker {
  display: none;
}

.repair-work-economy summary {
  color: var(--accent);
  font-weight: 700;
}

.repair-work-economy > div {
  position: absolute;
  right: 0;
  top: auto;
  bottom: calc(100% + 7px);
  z-index: 12;
  min-width: 240px;
  padding: 9px 11px;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.repair-work-notes {
  border-top: 1px solid var(--line);
}

.repair-master-note {
  padding-top: 12px;
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
}

.repair-master-note > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.repair-master-note > header span {
  color: var(--muted);
  font-size: 12px;
}

.repair-master-note textarea {
  width: 100%;
  min-height: 92px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
  color: var(--ink);
  resize: vertical;
}

.repair-master-note > div {
  display: flex;
  justify-content: flex-end;
}

.repair-work-notes > summary {
  padding: 8px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.repair-work-notes > summary span {
  color: var(--muted);
  font-size: 12px;
}

.repair-work-notes[open] > summary {
  margin-bottom: 6px;
}

.repair-finance-line small {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}

.repair-compact-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.repair-compact-notes label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.repair-compact-notes textarea {
  min-height: 56px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  resize: vertical;
}

.repair-ai-assistant {
  grid-column: 1 / -1;
  padding: 10px;
  display: grid;
  gap: 8px;
  border: 1px solid #f0c4c8;
  border-radius: 8px;
  background: #fffafa;
}

.repair-ai-assistant > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.repair-ai-assistant > header > div {
  display: grid;
  gap: 2px;
}

.repair-ai-assistant > header span {
  color: var(--muted);
  font-size: 11px;
}

.repair-ai-mark {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 5px;
  background: var(--accent);
  color: #fff !important;
  font-size: 10px !important;
  font-weight: 800;
}

.repair-ai-assistant > textarea {
  width: 100%;
  min-height: 58px;
  padding: 8px 9px;
  border: 1px solid #e6b9bd;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.repair-ai-actions,
.repair-ai-draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.repair-ai-draft {
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.repair-ai-draft > header,
.repair-ai-draft-actions {
  grid-column: 1 / -1;
}

.repair-ai-draft > header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.repair-ai-draft > header span {
  color: #b45309;
  font-size: 10px;
}

.repair-ai-draft section {
  min-width: 0;
  padding: 8px;
  border: 1px solid #edf0f4;
  border-radius: 6px;
  background: #fafbfc;
}

.repair-ai-draft p,
.repair-ai-draft ul {
  margin: 5px 0 0;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.45;
}

.repair-ai-draft ul { padding-left: 17px; }
.repair-ai-cases { display: grid; gap: 7px; }
.repair-ai-cases h4 { margin: 0; font-size: 12px; }
.repair-ai-cases .ai-similar-cases { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.repair-ai-cases .ai-case-card { padding: 8px; }

@media (max-width: 1100px) {
  .ai-similar-cases { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .ai-case-search,
  .ai-similar-cases,
  .repair-ai-draft,
  .repair-ai-cases .ai-similar-cases {
    grid-template-columns: 1fr;
  }
}

.loose-parts-warning {
  padding: 0;
}

.loose-parts-warning > summary {
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.loose-parts-warning > summary span {
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.14);
  color: #92400e;
  text-align: center;
  font-weight: 800;
}

.loose-parts-content {
  padding: 0 10px 9px;
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.loose-parts-content p {
  margin: 0 0 3px;
  color: var(--muted);
}

.photo-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

@media (max-width: 1100px) {
  .finance-branch-summary {
    grid-template-columns: 1fr;
  }

  body[data-section="orders"] #orders {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  body[data-section="orders"] .repair-active-selection {
    grid-column: 1;
  }

  body[data-section="orders"] .repair-top-actions {
    grid-column: 2;
  }

  body[data-section="orders"] .repair-work-queue,
  body[data-section="orders"] #orders:has(.repair-active-selection[hidden]) .repair-work-queue {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .repair-filter-panel {
    flex-wrap: wrap;
  }

  .repair-filter-panel label,
  .repair-filter-panel label:first-child {
    flex: 1 1 220px;
  }
}

@media (max-width: 1200px) {
  .repair-drawer {
    width: 96vw;
    min-width: 0;
    max-width: 96vw;
  }

  .client-drawer {
    width: 96vw;
    min-width: 0;
    max-width: 96vw;
    height: 100%;
    max-height: 100vh;
    overflow: hidden;
  }

  .repair-drawer-grid {
    grid-template-columns: 1fr;
  }

  .repair-drawer-body {
    padding: 18px;
    padding-right: 58px;
    padding-bottom: 34px;
  }

  .repair-history-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 820px) {
  .repair-drawer {
    width: 96vw;
    min-width: 0;
    max-width: 96vw;
  }

  .client-drawer {
    width: 96vw;
    min-width: 0;
    max-width: 96vw;
    height: 100%;
    max-height: 100vh;
    overflow: hidden;
  }

  .client-profile-head,
  .client-drawer .quick-actions,
  .client-drawer .client-summary-grid,
  .client-drawer .repair-tabs {
    margin-left: 12px;
    margin-right: 12px;
  }

  .client-profile-head {
    padding: 14px 48px 6px 12px;
  }

  .client-drawer .client-tab-content {
    padding: 10px 12px 14px;
  }

  .client-info-list,
  .client-money-grid,
  .client-repair-row {
    grid-template-columns: 1fr;
  }

  .client-repair-money {
    text-align: left;
  }

  .repair-drawer-body {
    padding: 14px;
    padding-right: 52px;
    padding-bottom: 32px;
  }

  .repair-drawer-actionbar {
    padding: 10px 10px max(10px, env(safe-area-inset-bottom));
  }

  .repair-card-top-controls,
  .repair-action-left,
  .repair-action-right {
    width: 100%;
    justify-content: flex-start;
  }

  .repair-header-compact {
    padding-right: 38px;
  }

  .repair-title-row {
    flex-direction: column;
    align-items: stretch;
  }

  .repair-header-compact .repair-status-select-wrap {
    width: 100%;
    min-width: 0;
    justify-items: stretch;
  }

  .repair-header-compact .repair-status-select-wrap select.status {
    max-width: none;
    width: 100%;
  }

  .work-tree-main,
  .work-tree-meta,
  .work-tree-actions,
  .work-inline-fields {
    grid-column: 1 / -1;
  }

  .repair-work-executor-picker {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .work-tree-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .work-tree-attachments {
    padding-left: 12px;
  }

  .work-tree-attachment {
    grid-template-columns: 28px minmax(0, 1fr) 30px;
  }

  .work-tree-attachment-meta {
    grid-column: 2;
    grid-row: 2;
    justify-content: flex-start;
  }

  .work-inline-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .work-tree-cost {
    display: none;
  }

  .repair-view-grid {
    grid-template-columns: 1fr;
  }

  .repair-compact-notes {
    grid-template-columns: 1fr;
  }

  .finance-payment-history article {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .repair-top-actions {
    justify-content: space-between;
  }

  #repairsTable {
    min-width: 980px;
  }
}

@media (max-width: 1180px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .main-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .status-summary {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
  }

  .command-strip,
  .metrics,
  .dashboard-kpis,
  .dashboard-attention-grid,
  .finance-summary-grid,
  .cashbox-grid,
  .dashboard-grid,
  .dashboard-grid-cash,
  .attention-grid,
  .repair-workspace,
  .repair-filter-panel,
  .client-filter-panel,
  .client-workspace,
  .stock-grid,
  .employee-grid,
  .settings-grid,
  .placeholder-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-statuses {
    grid-template-columns: repeat(4, minmax(112px, 1fr));
  }

  .dashboard-owner-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  body {
    grid-template-columns: minmax(0, 1fr);
    max-width: 100%;
    overflow-x: hidden;
  }

  .sidebar {
    position: static;
    min-width: 0;
    width: auto;
    max-width: 100vw;
    box-sizing: border-box;
    height: auto;
    padding: 10px 12px;
    gap: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    padding: 2px 4px 8px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }

  .main-nav {
    display: flex;
    min-width: 0;
    max-width: calc(100vw - 24px);
    grid-template-columns: none;
    gap: 6px;
    padding: 0 0 4px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .main-nav a {
    flex: 0 0 auto;
  box-sizing: border-box;
  height: 38px;
  min-height: 38px;
    padding: 8px 11px;
    grid-template-columns: 18px auto;
    gap: 7px;
    border-radius: 8px;
  }

  .main-nav svg {
    width: 18px;
    height: 18px;
  }

  .nav-separator,
  .sync-box {
    display: none;
  }

  main {
    padding: 18px;
  }

  .topbar,
  .filters {
    align-items: stretch;
    flex-direction: column;
  }

  input,
  select {
    min-width: 0;
    width: 100%;
  }

  .main-nav,
  .finance-nav-row,
  .command-strip,
  .metrics,
  .dashboard-kpis,
  .dashboard-attention-grid,
  .dashboard-owner-grid,
  .finance-summary-grid,
  .cashbox-grid,
  .payment-preview,
  .status-summary,
  .dashboard-grid,
  .dashboard-grid-cash,
  .attention-grid,
  .repair-workspace,
  .repair-filter-panel,
  .client-filter-panel,
  .client-workspace,
  .stock-grid,
  .employee-grid,
  .settings-grid,
  .placeholder-grid,
  .ai-prompts,
  .donut-wrap,
  .order-form-grid,
  .order-form-grid.two,
  .order-money-grid,
  .line-editor,
  .line-editor.parts-editor,
  .ai-console,
  .modal-grid,
  .issue-summary-grid,
  .quality-grid,
  .repair-work-state {
    grid-template-columns: 1fr;
  }

  .dashboard-statuses {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-cash-panel .cash-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-head,
  .panel-head,
  .finance-nav-row,
  .finance-cashbox-strip,
  .modal-head {
    align-items: start;
    flex-direction: column;
  }

  .page-actions,
  .finance-nav-row > .primary-action,
  .finance-cashbox-strip .secondary-action,
  .modal-actions {
    width: 100%;
    justify-content: stretch;
  }

  .page-actions button,
  .finance-nav-row > .primary-action,
  .finance-cashbox-strip .secondary-action,
  .modal-actions button {
    width: 100%;
  }

  .task-row,
  .inventory-row,
  .employee-row {
    grid-template-columns: 1fr;
  }

  .inventory-row div:last-child,
  .employee-row div:last-child {
    text-align: left;
  }

  .position-head,
  .position-row {
    grid-template-columns: minmax(0, 1fr) 50px 76px;
  }

  .repair-summary-grid,
  .repair-tab-grid,
  .repair-edit-grid,
  .quick-actions,
  .photo-grid,
  .finance-detail-grid {
    grid-template-columns: 1fr;
  }

  .position-head span:nth-child(4),
  .position-head span:nth-child(5),
  .position-row span:nth-child(4),
  .position-row span:nth-child(5) {
    display: none;
  }
}
/* Employee compensation and payroll */
.employee-card-button {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.employee-card-button:hover {
  border-color: rgba(220, 38, 38, 0.28);
  background: #fffafa;
}

.employee-drawer-root[hidden] {
  display: none;
}

.employee-drawer-root {
  position: fixed;
  inset: 0;
  z-index: 2800;
}

.employee-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.34);
}

.employee-drawer {
  position: absolute;
  inset: 0 0 0 auto;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(760px, 92vw);
  background: #fff;
  border-left: 1px solid #e5e7eb;
  box-shadow: -20px 0 55px rgba(15, 23, 42, 0.18);
}

.employee-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid #eef0f3;
}

.employee-drawer-header span,
.employee-section-heading span {
  color: #dc2626;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.employee-drawer-header h2 {
  margin: 4px 0;
  font-size: 24px;
}

.employee-drawer-header p {
  margin: 0;
  color: #64748b;
}

.employee-drawer-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 28px 0;
  overflow-x: auto;
  border-bottom: 1px solid #eef0f3;
}

.employee-drawer-tabs button {
  padding: 11px 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #64748b;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.employee-drawer-tabs button.active {
  border-bottom-color: #dc2626;
  color: #111827;
}

.employee-drawer-content {
  min-width: 0;
  padding: 22px 28px 32px;
  overflow-y: auto;
  overflow-x: hidden;
}

.employee-detail-grid,
.employee-payroll-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.employee-detail-grid article,
.employee-payroll-summary article {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid #e8ebef;
  border-radius: 8px;
  background: #fafbfc;
}

.employee-detail-grid article.wide {
  grid-column: 1 / -1;
}

.employee-detail-grid span,
.employee-payroll-summary span,
.employee-payroll-period span {
  color: #64748b;
  font-size: 12px;
}

.employee-work-performance {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e8ebef;
}

.employee-work-performance-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.employee-work-performance-summary article {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid #e8ebef;
  border-radius: 8px;
  background: #fafbfc;
}

.employee-work-performance-summary span,
.employee-work-performance-list small,
.employee-work-performance > p {
  color: #64748b;
  font-size: 12px;
}

.employee-work-performance-summary strong {
  font-size: 20px;
}

.employee-work-performance-list {
  display: grid;
  margin-top: 10px;
  border: 1px solid #e8ebef;
  border-radius: 8px;
  overflow: hidden;
}

.employee-work-performance-list div {
  display: grid;
  grid-template-columns: 100px 90px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid #eef1f4;
}

.employee-work-performance-list div:last-child {
  border-bottom: 0;
}

.employee-work-performance > p {
  margin: 9px 0 0;
}

.employee-history-section,
.employee-compensation-form {
  margin-top: 20px;
}

.employee-event-list {
  display: grid;
  gap: 8px;
}

.employee-event-list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 13px;
  border-left: 2px solid #dc2626;
  background: #f8fafc;
}

.employee-event-list article div {
  display: grid;
  gap: 3px;
}

.employee-event-list span,
.employee-event-list small {
  color: #64748b;
  font-size: 12px;
}

.employee-compensation-form {
  display: grid;
  gap: 14px;
}

.employee-rule-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.employee-rule-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.employee-rule-card.inactive {
  opacity: 0.68;
  background: #f8fafc;
}

.employee-rule-card > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.employee-rule-card > div:first-child span,
.employee-rule-card small {
  color: #64748b;
  font-size: 11px;
}

.employee-rule-actions {
  display: flex;
  gap: 4px;
}

.employee-rule-editor {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e5e7eb;
}

.employee-rule-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.employee-rule-form-grid > label {
  display: grid;
  gap: 6px;
}

.employee-rule-form-grid > label.wide {
  grid-column: 1 / -1;
}

.employee-rule-conditions {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 11px 13px;
}

.employee-rule-conditions summary {
  cursor: pointer;
  font-weight: 700;
}

.employee-rule-conditions .employee-rule-form-grid {
  margin-top: 12px;
}

.employee-rule-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px auto;
  align-items: end;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid #fee2e2;
  border-radius: 8px;
  background: #fffafa;
}

.employee-rule-preview > span {
  align-self: center;
  color: #991b1b;
  font-weight: 700;
}

.employee-rule-preview label {
  display: grid;
  gap: 5px;
  color: #64748b;
  font-size: 12px;
}

.employee-rule-preview strong {
  padding-bottom: 9px;
  font-size: 20px;
}

.employee-accrual-row.debit strong:nth-last-child(2) {
  color: #b42318;
}

.employee-accrual-row:disabled {
  cursor: default;
  opacity: 1;
}

.employee-compensation-form > label {
  display: grid;
  gap: 6px;
}

.employee-compensation-form input,
.employee-compensation-form select {
  width: 100%;
}

.employee-compensation-form fieldset {
  display: flex;
  gap: 18px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.employee-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.employee-section-heading h3 {
  margin: 3px 0 0;
}

.employee-rule-status,
.employee-accrual-status {
  display: inline-flex;
  justify-content: center;
  padding: 4px 7px;
  border-radius: 999px;
  background: #ecfdf3;
  color: #166534;
  font-size: 11px;
  font-weight: 700;
}

.employee-compensation-note {
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafc;
  color: #526071;
  line-height: 1.5;
}

.employee-form-actions {
  display: flex;
  justify-content: flex-end;
}

.employee-accrual-table {
  min-width: 680px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.employee-accrual-head,
.employee-accrual-row {
  display: grid;
  grid-template-columns: 86px minmax(105px, 1.1fr) minmax(130px, 1.35fr) 92px 52px 95px 100px;
  align-items: center;
  gap: 8px;
}

.employee-accrual-head {
  padding: 9px 11px;
  background: #f3f5f7;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.employee-accrual-row {
  width: 100%;
  padding: 11px;
  border: 0;
  border-top: 1px solid #eef0f3;
  background: #fff;
  color: #273142;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.employee-accrual-row:hover {
  background: #fffafa;
}

.employee-accrual-source {
  display: grid;
  min-width: 0;
  gap: 2px;
  text-align: left;
}

.employee-accrual-source strong,
.employee-accrual-source small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-accrual-source small {
  color: #b45309;
  font-size: 10px;
}

.employee-accrual-modal {
  width: min(720px, 94vw);
}

.employee-accrual-period-note {
  margin: 0 20px;
  padding: 9px 11px;
  border: 1px solid #fed7aa;
  border-radius: 7px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
  font-weight: 700;
}

.employee-accrual-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 20px 0;
}

.employee-accrual-detail-grid article {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.employee-accrual-detail-grid span,
.employee-accrual-detail-section p {
  color: var(--muted);
  font-size: 11px;
}

.employee-accrual-detail-section {
  margin: 12px 20px 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.employee-accrual-detail-section h3,
.employee-accrual-detail-section p { margin: 0; }

.employee-accrual-participants {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.employee-accrual-participants span {
  display: flex;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

@media (max-width: 600px) {
  .employee-accrual-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.employee-accrual-status.cancelled {
  background: #f1f5f9;
  color: #64748b;
}

.employee-payroll-period {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.employee-payroll-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.employee-payroll-summary strong {
  font-size: 20px;
}

@media (max-width: 760px) {
  .employee-drawer {
    width: 100vw;
  }

  .employee-drawer-header,
  .employee-drawer-content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .employee-drawer-tabs {
    padding-left: 16px;
    padding-right: 16px;
  }

  .employee-detail-grid,
  .employee-payroll-summary,
  .employee-work-performance-summary {
    grid-template-columns: 1fr;
  }

  .employee-work-performance-list div {
    grid-template-columns: 86px 76px minmax(0, 1fr);
    gap: 8px;
  }

  .employee-rule-card,
  .employee-rule-form-grid,
  .employee-rule-preview {
    grid-template-columns: 1fr;
  }

  .employee-rule-card > .employee-rule-status {
    justify-self: start;
  }

  .employee-accrual-table {
    min-width: 0;
    border: 0;
  }

  .employee-accrual-head {
    display: none;
  }

  .employee-accrual-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
  }
}
body.auth-required > .app-shell,
body.auth-required > #modalRoot,
body.auth-required > #repairDrawerRoot,
body.auth-required > #clientDrawerRoot {
  visibility: hidden;
}

body.auth-required > aside,
body.auth-required > main,
body.auth-required > div:not(#authRoot) {
  visibility: hidden;
}

body.app-booting {
  overflow: hidden;
}

body.app-booting > .sidebar,
body.app-booting > main,
body.app-booting > .app-shell {
  visibility: hidden;
}

.app-boot-screen {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #f5f7fa;
  color: #202735;
}

.app-boot-screen > div:last-child {
  display: grid;
  gap: 2px;
}

.app-boot-screen strong {
  font-size: 15px;
}

.app-boot-screen span {
  color: #7a8595;
  font-size: 12px;
}

.app-boot-brand {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #df2638;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(223, 38, 56, .18);
}

body:not(.app-booting) > .app-boot-screen {
  display: none;
}

#authRoot[hidden] { display: none; }

#authRoot {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #f3f5f8;
}

.auth-shell {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid #e3e7ed;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(23, 31, 44, .14);
  padding: 30px;
}

.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.auth-brand > span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: #df2638; color: #fff; font-weight: 800; }
.auth-brand div { display: grid; gap: 2px; }
.auth-brand strong { color: #171d28; }
.auth-brand small { color: #7c8798; }
.auth-heading > span { color: #d72537; font-size: 11px; font-weight: 800; }
.auth-heading h1 { margin: 7px 0 8px; font-size: 25px; letter-spacing: 0; color: #171d28; }
.auth-heading p { margin: 0 0 22px; color: #697486; line-height: 1.5; }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 7px; color: #4d5869; font-size: 12px; font-weight: 700; }
.auth-form input { width: 100%; height: 42px; border: 1px solid #d9dee7; border-radius: 6px; padding: 0 12px; font: inherit; color: #171d28; background: #fff; }
.auth-form input:focus { outline: 2px solid rgba(223, 38, 56, .14); border-color: #df2638; }
.auth-submit { width: 100%; min-height: 42px; margin-top: 4px; }
.auth-error { padding: 10px 12px; border: 1px solid #f3c2c8; border-radius: 6px; background: #fff4f5; color: #a51e2d; font-size: 13px; }

.auth-profile { display: grid; grid-template-columns: minmax(0, 1fr) 32px 32px; align-items: center; gap: 8px; margin-bottom: 12px; }
.auth-profile > div { display: grid; min-width: 0; gap: 2px; }
.auth-profile strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #202735; font-size: 12px; }
.auth-profile span { color: #7a8595; font-size: 11px; }
.auth-profile .icon-button { width: 32px; height: 32px; }

.desktop-notification-bell { position: relative; }
.desktop-notification-bell svg { width: 16px; height: 16px; fill: currentColor; }
.desktop-notification-bell.has-alerts {
  border-color: rgba(225, 38, 47, 0.35);
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.desktop-notification-bell > span {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.desktop-notification-root {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 12000;
  width: min(420px, calc(100vw - 36px));
  pointer-events: none;
}

.desktop-alert-card {
  overflow: hidden;
  display: grid;
  border: 1px solid rgba(225, 38, 47, 0.28);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.24);
  pointer-events: auto;
  animation: desktop-alert-in 180ms ease-out;
}

.desktop-alert-card.is-critical { box-shadow: 0 22px 60px rgba(190, 24, 37, 0.28); }
.desktop-alert-head,
.desktop-alert-actions,
.desktop-alert-meta { display: flex; align-items: center; }
.desktop-alert-head {
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
}
.desktop-alert-head-actions { display: flex; align-items: center; gap: 8px; }
.desktop-alert-head-actions button {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #7a8595;
  font: inherit;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.desktop-alert-head-actions button:hover { background: #f0f2f5; color: var(--ink); }
.desktop-alert-eyebrow {
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.desktop-alert-counter {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.desktop-alert-body { display: grid; gap: 7px; padding: 0 16px 14px; }
.desktop-alert-body h3 { margin: 0; color: var(--ink); font-size: 17px; line-height: 1.25; }
.desktop-alert-body p { margin: 0; color: #4b5563; font-size: 13px; line-height: 1.42; }
.desktop-alert-repair { color: var(--accent-dark); font-size: 14px; font-weight: 800; }
.desktop-alert-meta { gap: 7px; flex-wrap: wrap; color: var(--muted); font-size: 11px; }
.desktop-alert-meta span { padding: 3px 7px; border-radius: 5px; background: #f3f5f8; }
.desktop-alert-actions {
  gap: 7px;
  padding: 11px 16px 14px;
  border-top: 1px solid var(--line);
  background: #fafbfc;
}
.desktop-alert-actions button { min-height: 34px; flex: 1; }
.desktop-alert-actions .desktop-alert-snooze { flex: 0 0 auto; }

.notification-center-root {
  position: fixed;
  top: 70px;
  right: 18px;
  z-index: 11990;
  width: min(430px, calc(100vw - 36px));
}

.notification-center {
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  max-height: min(720px, calc(100vh - 88px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 65px rgba(15, 23, 42, 0.24);
}

.notification-center-head,
.notification-center-toolbar,
.notification-center-footer,
.notification-center-item-top {
  display: flex;
  align-items: center;
}

.notification-center-head {
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.notification-center-head > div { display: grid; gap: 3px; }
.notification-center-head span {
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.notification-center-head h2 { margin: 0; color: var(--ink); font-size: 18px; letter-spacing: 0; }
.notification-center-head .icon-button { width: 32px; height: 32px; font-size: 19px; }

.notification-center-toolbar {
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 8px 16px;
  background: #f8f9fb;
  color: var(--muted);
  font-size: 11px;
}
.notification-center-toolbar button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.notification-center-list {
  overflow-y: auto;
  min-height: 120px;
  padding: 6px 8px 8px;
  overscroll-behavior: contain;
}
.notification-center-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid var(--line);
}
.notification-center-item:last-child { border-bottom: 0; }
.notification-center-item.is-critical { border-left: 3px solid var(--accent); }
.notification-center-item.is-snoozed { opacity: 0.72; }
.notification-center-item-main {
  min-width: 0;
  padding: 11px 8px;
  display: grid;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.notification-center-item-main:hover { background: #f8f9fb; }
.notification-center-item-top { justify-content: space-between; gap: 10px; }
.notification-center-item-top strong { color: var(--accent-dark); font-size: 12px; }
.notification-center-item-top time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.notification-center-item-main > b { font-size: 13px; line-height: 1.3; }
.notification-center-item-main > span,
.notification-center-item-main > small {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #586477;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
}
.notification-center-item-main > em { color: var(--muted); font-size: 10px; font-style: normal; }
.notification-center-item-ack {
  margin-right: 7px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: #536070;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.notification-center-item-ack:hover { border-color: #9fabb9; color: var(--ink); }
.notification-center-empty {
  min-height: 160px;
  display: grid;
  place-content: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
}
.notification-center-empty strong { color: var(--ink); font-size: 14px; }
.notification-center-empty span { font-size: 12px; }
.notification-center-footer {
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}
.notification-center-footer button { min-height: 30px; padding: 5px 9px; flex: 0 0 auto; }

@keyframes desktop-alert-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 700px) {
  .desktop-notification-root { top: 10px; right: 10px; width: calc(100vw - 20px); }
  .notification-center-root { top: 62px; right: 8px; width: calc(100vw - 16px); }
  .notification-center { max-height: calc(100vh - 70px); }
  .desktop-alert-actions { flex-wrap: wrap; }
  .desktop-alert-actions button { min-width: calc(50% - 4px); }
  .desktop-alert-actions .desktop-alert-snooze { flex: 1; }
}

@media (max-width: 520px) {
  .auth-shell { padding: 12px; }
  .auth-card { padding: 22px; }
}

/* User-selectable primary navigation layout. */
body[data-nav-layout="top"] {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}

body[data-nav-layout="top"] .sidebar {
  position: sticky;
  top: 0;
  z-index: 90;
  width: 100%;
  height: 72px;
  padding: 8px 18px;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  border-right: 0;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(29, 39, 53, 0.06);
}

body[data-nav-layout="top"] .brand {
  flex: 0 0 auto;
  padding: 0 16px 0 0;
  border-right: 1px solid var(--line);
  border-bottom: 0;
}

body[data-nav-layout="top"] .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 9px;
}

body[data-nav-layout="top"] .brand span {
  display: none;
}

body[data-nav-layout="top"] .main-nav {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 2px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

body[data-nav-layout="top"] .main-nav a {
  min-width: max-content;
  min-height: 36px;
  padding: 6px 8px;
  grid-template-columns: 16px auto;
  gap: 6px;
  border-radius: 8px;
}

body[data-nav-layout="top"] .main-nav a::before {
  left: 10px;
  right: 10px;
  top: auto;
  bottom: -1px;
  width: auto;
  height: 3px;
}

body[data-nav-layout="top"] .main-nav a:hover {
  transform: translateY(-1px);
}

body[data-nav-layout="top"] .main-nav svg {
  width: 16px;
  height: 16px;
}

body[data-nav-layout="top"] .nav-separator {
  width: 1px;
  height: 26px;
  margin: 0 3px;
  background: var(--line);
}

body[data-nav-layout="top"] .sync-box {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  display: block;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body[data-nav-layout="top"] .sync-box > span,
body[data-nav-layout="top"] .sync-box > strong,
body[data-nav-layout="top"] .sync-box > small,
body[data-nav-layout="top"] .role-switcher {
  display: none;
}

body[data-nav-layout="top"] .auth-profile {
  grid-template-columns: minmax(90px, 170px) 32px 32px;
  margin: 0;
}

body[data-nav-layout="top"] main {
  padding: 20px 24px 28px;
}

.settings-layout-row {
  grid-template-columns: minmax(0, 1fr) minmax(210px, 280px);
  align-items: center;
  gap: 20px;
}

.settings-layout-row > div {
  display: grid;
  gap: 4px;
}

.settings-layout-control select {
  width: 100%;
  min-width: 0;
}

body[data-nav-layout="top"] .settings-grid > *,
body[data-nav-layout="top"] .import-limit-panel > label,
body[data-nav-layout="top"] .import-limit-panel input {
  min-width: 0;
}

@media (max-width: 1400px) {
  body[data-nav-layout="top"] .main-nav a {
    min-width: 36px;
    padding: 7px 9px;
    grid-template-columns: 16px;
    place-items: center;
  }

  body[data-nav-layout="top"] .main-nav a span {
    display: none;
  }

  body[data-nav-layout="top"] .brand strong,
  body[data-nav-layout="top"] .auth-profile > div {
    display: none;
  }

  body[data-nav-layout="top"] .brand {
    padding-right: 10px;
  }

  body[data-nav-layout="top"] .auth-profile {
    grid-template-columns: 32px 32px;
  }
}

@media (max-width: 760px) {
  body[data-nav-layout="top"] .sidebar {
    position: sticky;
    height: auto;
    min-height: 62px;
    padding: 8px 10px;
    flex-direction: row;
    flex-wrap: nowrap;
    border-bottom: 1px solid var(--line);
  }

  body[data-nav-layout="top"] .main-nav {
    display: flex;
    overflow-x: auto;
  }

  body[data-nav-layout="top"] .main-nav a {
    grid-template-columns: 18px;
    place-items: center;
    min-width: 42px;
    padding: 9px;
  }

  body[data-nav-layout="top"] .main-nav a span,
  body[data-nav-layout="top"] .sync-box,
  body[data-nav-layout="top"] .nav-separator {
    display: none;
  }

  body[data-nav-layout="top"] main {
    padding: 14px 12px 24px;
  }

  body[data-nav-layout="top"] .topbar,
  body[data-nav-layout="top"] .app-section,
  body[data-nav-layout="top"] .page-head,
  body[data-nav-layout="top"] .settings-grid,
body[data-nav-layout="top"] .settings-grid > * {
    width: 100%;
    min-width: 0;
  }

  body[data-nav-layout="top"] .employee-page-tabs {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .settings-layout-row {
    grid-template-columns: 1fr;
  }
}
.own-payroll-workspace {
  display: grid;
  gap: 12px;
}

.own-payroll-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.own-payroll-head h2,
.own-payroll-head p {
  margin: 2px 0 0;
}

.own-payroll-head > div > span,
.own-payroll-kpis span {
  color: var(--muted);
  font-size: 12px;
}

.own-payroll-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.own-payroll-kpis article {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.own-payroll-kpis strong {
  font-size: 22px;
}

.own-payroll-kpis .is-negative strong {
  color: var(--bad);
}

.own-payroll-list td small,
.cash-access-grid strong small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 400;
}

.cash-access-grid.is-safe-locked {
  background: var(--panel-2);
  color: var(--muted);
}

@media (max-width: 720px) {
  .own-payroll-head {
    align-items: stretch;
    flex-direction: column;
  }

  .own-payroll-kpis {
    grid-template-columns: 1fr;
  }
}
/* Unified repair payment rows: amount and its destination are one control. */
.payment-entry-list {
  display: grid;
  gap: 8px;
}

.payment-entry-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(190px, 1.2fr);
  gap: 8px;
  align-items: end;
}

.payment-entry-row.has-remove {
  grid-template-columns: minmax(120px, 0.8fr) minmax(190px, 1.2fr) 32px;
}

.payment-entry-row .modal-field,
.payment-entry-row input,
.payment-entry-row select {
  width: 100%;
  min-width: 0;
}

.payment-entry-remove {
  width: 32px;
  height: 44px;
}

.payment-entry-mixed {
  justify-self: start;
}

@media (max-width: 720px) {
  .payment-entry-row {
    grid-template-columns: 1fr;
  }

  .payment-entry-row.has-remove {
    grid-template-columns: 1fr 32px;
  }

  .payment-entry-row.has-remove .modal-field:first-child {
    grid-column: 1 / -1;
  }

  .payment-entry-mixed {
    width: 100%;
    justify-self: stretch;
  }
}
.daily-report-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px minmax(240px, 1fr) auto;
  gap: 14px;
  align-items: end;
  padding-top: 16px;
}

.daily-report-form > label:not(.toggle-row) { display: grid; gap: 6px; }
.daily-report-form > label > span { color: var(--muted); font-size: 12px; }
.daily-report-form .toggle-row { align-self: center; }
.daily-report-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.daily-report-form > small { grid-column: 1 / -1; color: var(--muted); }

@media (max-width: 900px) {
  .daily-report-form { grid-template-columns: 1fr; align-items: stretch; }
  .daily-report-actions { justify-content: flex-start; }
}

.print3d-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.print3d-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.print3d-workspace-tabs { display: flex; gap: 4px; margin: 0 0 16px; padding: 4px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; scrollbar-width: thin; }
.print3d-workspace-tabs button { flex: 0 0 auto; min-height: 34px; padding: 0 13px; border: 1px solid transparent; border-radius: 8px; color: #59697b; background: transparent; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.print3d-workspace-tabs button:hover { color: #a71922; background: #fff; }
.print3d-workspace-tabs button.is-active { border-color: #f3c3c6; color: #c81f29; background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.08); }
[data-print3d-tab-panel][hidden] { display: none !important; }
.print3d-overview-queue, .print3d-production-panel, .print3d-showcase-panel { margin-bottom: 16px; }
.print3d-queue-summary { display: flex; flex-wrap: wrap; gap: 9px; margin: 0 0 12px; }
.print3d-queue-summary span { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #f8fafc; font-size: 12px; }
.print3d-queue-summary b { color: var(--text); }
.print3d-queue-list { display: grid; }
.print3d-queue-list > div { display: grid; grid-template-columns: minmax(130px,.7fr) minmax(180px,1.4fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.print3d-queue-list span { color: var(--muted); font-size: 13px; }
.print3d-queue-list b { justify-self: end; padding: 4px 8px; border-radius: 999px; background: #f1f5f9; font-size: 11px; }
.print3d-status-в-печати { color: #9a6700; background: #fff7d6 !important; }
.print3d-status-готов { color: #137333; background: #e8f7ed !important; }
.print3d-status-новый { color: #a71922; background: #fff1f2 !important; }
.print3d-production-panel table { min-width: 760px; }
.print3d-production-panel td > strong, .print3d-production-panel td > small { display: block; }
.print3d-production-panel td > small { margin-top: 3px; color: var(--muted); line-height: 1.35; }
.print3d-production-panel td select { width: 100%; min-width: 120px; }
.print3d-production-panel td .secondary-action { margin-top: 7px; }
.print3d-showcase-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.print3d-showcase-card { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 10px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; }
.print3d-showcase-card > div { display: grid; gap: 3px; min-width: 0; }
.print3d-showcase-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.print3d-showcase-card small { color: var(--muted); }
.print3d-showcase-card b { color: #137333; font-size: 13px; }
.print3d-showcase-card span { font-weight: 800; }
.print3d-material-panel { margin-bottom: 16px; }
.print3d-material-panel .print3d-list, .print3d-model-panel .print3d-list { max-height: 560px; overflow-y: auto; padding-right: 6px; scrollbar-gutter: stable; }
.print3d-orders .print3d-order-utility { display: inline-flex; align-items: center; min-height: 28px; margin: 6px 4px 0 0; padding: 4px 9px; border-radius: 999px; font-size: 11px; line-height: 1; white-space: nowrap; }
.print3d-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.print3d-kpis .panel { padding: 18px; }
.print3d-kpis h2 { margin: 8px 0 5px; }
.print3d-losses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0 0 16px; }
.print3d-losses .panel { padding: 16px 18px; }
.print3d-losses h3 { margin: 8px 0 5px; font-size: 22px; }
.print3d-waste-history > div { display: grid; gap: 2px; padding: 4px 0; font-size: 12px; }
.print3d-waste-history > div b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.print3d-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.print3d-list { display: grid; }
.print3d-grid .print3d-list { max-height: 360px; overflow-y: auto; padding-right: 6px; scrollbar-gutter: stable; }
.print3d-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 13px 0; border-top: 1px solid var(--line); }
.print3d-row:first-child { border-top: 0; padding-top: 0; }
.print3d-row > div:last-child { text-align: right; flex: 0 0 auto; }
.print3d-row-actions { display: grid; justify-items: end; gap: 3px; }
.print3d-row-actions button { margin-top: 4px; }
.print3d-row strong, .print3d-row small, .print3d-orders td small { display: block; }
.print3d-color-swatch { display: inline-block; width: 13px; height: 13px; margin-right: 7px; border: 1px solid #cbd5e1; border-radius: 3px; vertical-align: -1px; }
.print3d-stock-check { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.print3d-stock-check.is-ok { border-color: #a7e5bc; background: #f0fdf4; }
.print3d-stock-check.is-shortage { border-color: #fecaca; background: #fff5f5; }
.print3d-stock-check > strong { display: block; margin-bottom: 7px; }
.print3d-stock-check > div { display: flex; justify-content: space-between; gap: 14px; padding: 4px 0; font-size: 13px; }
.print3d-stock-check > div b { text-align: right; }
.print3d-price-recommendation { display: grid; gap: 9px; padding: 12px 14px; border: 1px solid #bbdfc6; border-radius: 10px; background: #f2fbf5; }
.print3d-price-recommendation > strong { font-size: 13px; }
.print3d-price-recommendation > small { color: var(--muted); line-height: 1.35; }
.print3d-price-recommendation-costs { display: flex; flex-wrap: wrap; gap: 5px 12px; color: var(--muted); font-size: 12px; }
.print3d-price-recommendation-costs span { white-space: nowrap; }
.print3d-price-recommendation-costs b { color: var(--text); }
.print3d-price-recommendation-total { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.print3d-price-recommendation-total span { display: grid; gap: 2px; }
.print3d-price-recommendation-total small { color: var(--muted); }
.print3d-price-recommendation-total strong { font-size: 16px; }
.print3d-stock-note { margin: 14px 0 0; color: var(--muted); }
.print3d-purchase-preview { display: grid; gap: 5px; margin-top: 14px; padding: 13px 15px; border: 1px solid #bbdfc6; border-radius: 10px; background: #f2fbf5; }
.print3d-purchase-preview strong, .print3d-purchase-preview small { display: block; }
.print3d-purchase-preview small { color: var(--muted); line-height: 1.4; }
.print3d-row small, .print3d-orders td small { color: var(--muted); margin-top: 3px; line-height: 1.35; }
.print3d-orders { margin-bottom: 16px; }
.print3d-orders table { min-width: 850px; }
.print3d-orders select { width: 100%; min-width: 118px; }
.print3d-orders td > span { display: block; margin-bottom: 5px; }
.print3d-order-status-cell { display: grid; min-width: 142px; gap: 7px; align-items: start; justify-items: stretch; }
.print3d-order-status-cell .secondary-action { width: 100%; min-height: 32px; white-space: nowrap; }
.print3d-order-status-cell > small { margin-top: 0; }
.print3d-purchases { margin-bottom: 16px; }
.print3d-purchases table { min-width: 820px; }
.print3d-purchases td small { display: block; margin-top: 3px; color: var(--muted); line-height: 1.35; }
.print3d-purchases .link-button { display: block; margin-top: 5px; }
.print3d-immediate-payment { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.print3d-immediate-payment[hidden] { display: none; }
.print3d-recipe-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 8px; }
.print3d-recipe-fields label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.print3d-recipe-add, .print3d-recipe-row { display: flex; gap: 8px; align-items: center; }
.print3d-recipe-add select, .print3d-recipe-row input { min-width: 0; flex: 1; }
.print3d-recipe-row { margin-top: 8px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; }
.print3d-recipe-row span { flex: 1; font-size: 13px; }
.print3d-printers { margin-bottom: 16px; }
.print3d-printer-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.print3d-printer-card { display: grid; gap: 4px; min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.print3d-printer-card strong, .print3d-printer-card span, .print3d-printer-card small { overflow-wrap: anywhere; }
.print3d-printer-card span { color: var(--text); font-weight: 700; }
.print3d-printer-card small { color: var(--muted); line-height: 1.35; }
.print3d-duration-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.print3d-duration-fields legend { grid-column: 1 / -1; margin: 0 0 4px; padding: 0; color: var(--muted); font-size: 12px; line-height: 1.2; }
.print3d-duration-fields label { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.2; }
.print3d-duration-fields input { box-sizing: border-box; width: 100%; min-width: 0; }
.print3d-batch-timing-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; border: 0; }
.print3d-batch-timing-fields legend { grid-column: 1 / -1; margin-bottom: 4px; padding: 0; color: var(--muted); font-size: 12px; }
.print3d-batch-timing-fields legend small { font-weight: 400; }
.print3d-batch-timing-fields label { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: 12px; }
.print3d-batch-timing-fields input { width: 100%; }
.print3d-batch-timing-fields > small { grid-column: 1 / -1; color: #166534; line-height: 1.4; }
.print3d-order-modal { box-sizing: border-box; width: calc(100vw - 32px); max-width: none; height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); overflow: hidden; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.print3d-order-form { min-height: 0; overflow-y: auto; align-content: start; gap: 12px; padding-right: 6px; scrollbar-gutter: stable; overscroll-behavior: contain; }
.print3d-order-client, .print3d-order-prepayment, .print3d-order-production-details { padding: 11px 13px; border: 1px solid #dde5ee; border-radius: 12px; background: linear-gradient(135deg, #ffffff, #f7f9fc); }
.print3d-order-client summary, .print3d-order-prepayment summary, .print3d-order-production-details summary { cursor: pointer; color: var(--text); font-size: 13px; font-weight: 700; }
.print3d-order-client summary small, .print3d-order-prepayment summary small { color: var(--muted); font-weight: 500; }
.print3d-order-client[open] > .modal-grid, .print3d-order-prepayment[open] > .modal-grid, .print3d-order-production-details[open] > .modal-grid { margin-top: 10px; }
.print3d-order-prepayment > small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.print3d-order-items { display: grid; align-content: start; gap: 12px; }
.print3d-order-item { padding: 16px; border: 1px solid #dbe3ed; border-radius: 16px; background: linear-gradient(145deg, #ffffff 0%, #f7f9fc 100%); box-shadow: 0 8px 22px rgba(15, 23, 42, .05); }
.print3d-order-item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.print3d-order-item-head span { color: var(--danger); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.print3d-order-item-head h3 { margin: 3px 0 0; font-size: 16px; }
.print3d-order-item-head [hidden] { display: none; }
.print3d-order-mode { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px; border: 1px solid #e3e9f1; border-radius: 10px; background: rgba(255, 255, 255, .72); }
.print3d-order-mode > span { color: var(--muted); font-size: 12px; }
.print3d-order-mode > strong { font-size: 13px; }
.print3d-order-mode .link-button { margin-left: auto; }
.print3d-order-item-grid { grid-template-columns: minmax(180px, .9fr) minmax(250px, 1.3fr) minmax(230px, 1fr) minmax(110px, .5fr) minmax(140px, .6fr); align-items: start; gap: 12px; }
.print3d-order-item-grid > [data-print3d-print-fields] { display: contents; }
.print3d-order-mode { order: 0; grid-column: 1 / -1; }
.print3d-order-description-field { order: 1; grid-column: 1 / -1; }
.print3d-order-product-field { order: 2; grid-column: auto; }
.print3d-order-printer-field { order: 3; grid-column: auto; }
.print3d-duration-fields { order: 4; grid-column: auto; }
.print3d-order-quantity-field { order: 5; grid-column: auto; }
.print3d-order-price-field { order: 6; grid-column: auto; }
.print3d-materials-field { order: 7; grid-column: 1 / -1; padding: 12px; border: 1px solid #e0e7ef; border-radius: 12px; background: rgba(255, 255, 255, .72); }
.print3d-batch-timing-fields { order: 8; grid-column: 1 / -1; padding: 12px; border: 1px dashed #cbd7e5; border-radius: 12px; background: #fbfcfe; }
.print3d-order-accessory-name { order: 9; grid-column: span 2; }
.print3d-order-accessory-cost { order: 9; grid-column: span 2; }
.print3d-order-cost { order: 10; grid-column: 1 / -1; }
.print3d-order-profile { order: 4; grid-column: 1 / -1; min-height: 58px; }
.print3d-order-production-details { order: 5; grid-column: 1 / -1; }
.print3d-order-kind-field { border: 0; padding: 0; margin: 0; }
.print3d-order-kind-field legend { margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.print3d-order-kind-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #f1f5f9; }
.print3d-order-kind-choice { display: grid; place-items: center; min-height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; color: #59697b; cursor: pointer; transition: color .15s ease, background .15s ease, box-shadow .15s ease; }
.print3d-order-kind-choice:hover { color: #9f1d25; background: #fffafb; }
.print3d-order-kind-choice.is-selected { border-color: #f3c3c6; background: #fff; color: #c81f29; box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.print3d-order-kind-choice input { position: absolute; width: 1px !important; min-width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.print3d-order-kind-choice b { font-size: 11px; line-height: 1; white-space: nowrap; }
.print3d-order-add { justify-self: start; }
.print3d-order-form > .panel-note { margin: 0; }
.print3d-order-form > .modal-actions { margin-top: 0; }
.print3d-order-cost { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid #b7e3c6; border-radius: 12px; background: linear-gradient(135deg, #effcf3, #f7fff9); }
.print3d-order-cost > span, .print3d-order-cost small { color: #466356; font-size: 11px; }
.print3d-order-cost > div { display: flex; flex-wrap: wrap; gap: 5px 12px; }
.print3d-order-cost > div b { color: #1f3b2b; font-size: 12px; }
.print3d-order-cost > strong { color: #166534; font-size: 14px; }
.print3d-materials-field { display: grid; gap: 8px; }
.print3d-materials-field > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.print3d-material-allocations { display: grid; gap: 9px; }
.print3d-material-allocation { display: grid; grid-template-columns: minmax(0, 1fr) 150px 38px; gap: 8px; align-items: end; padding: 10px; border: 1px solid #e0e7ef; border-radius: 10px; background: #fff; }
.print3d-material-allocation > label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.print3d-material-allocation > .icon-button { margin-bottom: 1px; }
.print3d-write-off-materials-field { display: grid; gap: 8px; margin-top: 14px; }
.print3d-write-off-materials-field > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.print3d-write-off-materials { display: grid; gap: 9px; }
.print3d-write-off-material-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 38px; gap: 8px; align-items: end; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.print3d-write-off-material-row > label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.print3d-write-off-material-row > .icon-button { margin-bottom: 1px; }
.print3d-material-picker { display: grid; gap: 5px; min-width: 0; }
.print3d-material-picker input, .print3d-material-picker select { width: 100%; min-width: 0; }
.print3d-material-picker [data-print3d-material-search-result]:empty { display: none; }
.print3d-material-picker [data-print3d-material-search-result] { color: var(--muted); font-size: 10px; }
.print3d-materials-field [data-print3d-material-total] { color: var(--muted); font-size: 11px; }
.print3d-product-row { align-items: center; }
.print3d-product-copy { flex: 1 1 auto; min-width: 0; }
.print3d-product-image { display: block; flex: 0 0 auto; width: 58px; height: 58px; border: 1px solid var(--line); border-radius: 10px; background: #f1f5f9; object-fit: cover; }
.print3d-product-image-placeholder { display: grid; place-items: center; color: #94a3b8; font-size: 14px; font-weight: 900; letter-spacing: .06em; }
.print3d-product-image.is-profile { width: 48px; height: 48px; }
.print3d-product-image.is-editor { width: 132px; height: 132px; border-radius: 12px; }
.print3d-selected-profile { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid #f2c7ca; border-radius: 10px; background: #fff7f8; }
.print3d-selected-profile > div > span { color: var(--danger); font-size: 11px; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.print3d-selected-profile strong, .print3d-selected-profile small { display: block; overflow-wrap: anywhere; }
.print3d-selected-profile small { color: var(--muted); line-height: 1.4; }
.print3d-image-upload > span { color: var(--muted); font-size: 12px; }
.print3d-image-upload-body { display: flex; align-items: center; gap: 14px; padding: 10px; border: 1px dashed #cbd5e1; border-radius: 12px; background: #f8fafc; }
.print3d-image-upload-controls { display: grid; justify-items: start; gap: 8px; min-width: 0; }
.print3d-image-upload-controls .secondary-action { cursor: pointer; }
.print3d-image-upload-controls small { color: var(--muted); line-height: 1.35; }
.print3d-image-remove { color: var(--muted); font-size: 12px; }
@media (max-width: 900px) { .print3d-head, .print3d-grid { display: grid; grid-template-columns: 1fr; } .print3d-actions { justify-content: flex-start; } .print3d-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .print3d-losses { grid-template-columns: 1fr; } .print3d-showcase-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1200px) { .print3d-printer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .print3d-kpis, .print3d-recipe-fields { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .print3d-showcase-grid { grid-template-columns: 1fr; } .print3d-queue-list > div { grid-template-columns: 1fr; gap: 3px; } .print3d-queue-list b { justify-self: start; } }
@media (max-width: 520px) { .print3d-printer-grid { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .print3d-image-upload-body { align-items: flex-start; flex-direction: column; } .print3d-selected-profile { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .print3d-order-modal { width: calc(100vw - 16px); height: calc(100vh - 16px); } }
@media (max-width: 1200px) { .print3d-order-item-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .print3d-order-product-field { grid-column: span 2; } .print3d-order-accessory-name, .print3d-order-accessory-cost { grid-column: span 1; } }
@media (max-width: 900px) { .print3d-order-item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .print3d-order-product-field, .print3d-order-profile, .print3d-order-production-details { grid-column: 1 / -1; } .print3d-order-accessory-name, .print3d-order-accessory-cost { grid-column: span 1; } }
@media (max-width: 700px) { .print3d-order-item-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .print3d-material-allocation, .print3d-write-off-material-row { grid-template-columns: 1fr 38px; } .print3d-material-allocation > label, .print3d-write-off-material-row > label { grid-column: 1 / -1; } }
@media (max-width: 520px) { .print3d-batch-timing-fields { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .print3d-price-recommendation-total { align-items: stretch; flex-direction: column; } .print3d-price-recommendation-total .secondary-action { width: 100%; } }

.dashboard-money-month-panel { margin-bottom: 16px; }
.dashboard-money-month { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(360px, 1.1fr); gap: 18px; align-items: start; }
.dashboard-money-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.dashboard-money-totals > div { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; }
.dashboard-money-totals .inventory { grid-column: 1 / -1; }
.dashboard-money-totals span, .dashboard-money-totals small, .dashboard-money-row small { color: var(--muted); }
.dashboard-money-totals strong { font-size: 19px; }
.dashboard-money-breakdown { display: grid; gap: 7px; }
.dashboard-money-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(80px, 1fr) auto; gap: 10px; align-items: center; }
.dashboard-money-row > span { min-width: 0; display: grid; gap: 1px; }
.dashboard-money-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.dashboard-money-row > i { height: 7px; overflow: hidden; border-radius: 999px; background: #eef1f5; }
.dashboard-money-row > i > em { display: block; height: 100%; border-radius: inherit; background: #dc2626; }
.dashboard-money-row > strong { min-width: 92px; text-align: right; }
.dashboard-money-month > .panel-note { grid-column: 1 / -1; margin: 0; }
@media (max-width: 900px) { .dashboard-money-month { grid-template-columns: 1fr; } }
@media (max-width: 520px) {
  .dashboard-money-totals { grid-template-columns: 1fr; }
  .dashboard-money-totals .inventory { grid-column: auto; }
  .dashboard-money-row { grid-template-columns: minmax(0, 1fr) auto; }
  .dashboard-money-row > i { grid-column: 1 / -1; grid-row: 2; }
}
.vk-agent-panel{display:grid;gap:1rem;margin:1rem 0 1.25rem;border-color:color-mix(in srgb,#4a70d8 32%,var(--border-color,#d9dee8))}.vk-agent-panel h3{margin:.2rem 0 .7rem}.vk-agent-status,.vk-agent-setup{margin:0;color:var(--muted,#667085)}.vk-agent-status strong{color:var(--text,#202938)}.vk-agent-inbox,.vk-agent-post-tools{display:grid;gap:.75rem}.vk-agent-message,.vk-agent-post{display:grid;gap:.65rem;padding:1rem;border:1px solid var(--border-color,#d9dee8);border-radius:14px;background:var(--surface-soft,#f8f9fc)}.vk-agent-customer-message{margin:0;padding:.75rem;border-radius:10px;background:var(--surface,#fff);white-space:pre-wrap;overflow-wrap:anywhere}.vk-agent-message label,.vk-agent-order-fields label,.vk-agent-post-tools form label{display:grid;gap:.35rem}.vk-agent-message textarea,.vk-agent-post textarea{width:100%;min-height:5rem;resize:vertical}.vk-agent-order{border-top:1px solid var(--border-color,#d9dee8);padding-top:.65rem}.vk-agent-order summary{cursor:pointer;font-weight:650}.vk-agent-order-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:.65rem;padding-top:.75rem}.vk-agent-post-tools form{display:flex;align-items:flex-end;gap:.65rem;flex-wrap:wrap}.vk-agent-post-tools form label{flex:1 1 260px}
.vk-agent-post-schedule{display:flex;align-items:flex-end;gap:.65rem;flex-wrap:wrap;padding-top:.25rem}.vk-agent-post-schedule label{display:grid;gap:.35rem;flex:1 1 230px;max-width:360px}
.vk-agent-daily{display:grid;gap:.6rem;padding:1rem;border:1px solid var(--border-color,#d9dee8);border-radius:14px;background:var(--surface-soft,#f8f9fc)}.vk-agent-daily h3{margin:0}.vk-agent-daily form{display:flex;align-items:flex-end;gap:.75rem;flex-wrap:wrap}.vk-agent-daily form label{display:grid;gap:.35rem}.vk-agent-daily-toggle{display:flex!important;align-items:center;gap:.55rem;flex:1 1 320px}.vk-agent-daily-toggle input{width:auto}.vk-agent-post-image{display:block;width:min(100%,640px);height:auto;border-radius:12px;border:1px solid var(--border-color,#d9dee8)}

.expertise-drawer { grid-template-rows: auto auto auto minmax(0,1fr) auto; }
.expertise-money-bar { display:flex; align-items:center; flex-wrap:wrap; gap:12px; padding:12px 20px; border-bottom:1px solid var(--line); background:#f7f9fc; }
.expertise-money-bar span { display:grid; gap:3px; margin-right:auto; font-size:12px; }
.expertise-money-bar b { font-size:16px; }
.expertise-payment-modal { position:fixed; z-index:220; top:50%; left:50%; transform:translate(-50%,-50%); width:min(540px,94vw); max-height:90vh; overflow:auto; padding:24px; background:white; border-radius:16px; }
.expertise-payment-modal form { display:grid; gap:16px; }
.expertise-payment-modal h2 { margin:0; font-size:20px; }
.expertise-payment-modal label { display:grid; gap:6px; }
.expertise-payment-modal input,.expertise-payment-modal select { width:100%; }
.expertise-payment-modal footer { display:flex; justify-content:flex-end; gap:8px; flex-wrap:wrap; }
.expertise-payment-modal [role=alert] { color:#c8102e; }

.expertise-tabs { grid-template-columns:repeat(6,minmax(0,1fr)); }
@media(max-width:900px){.expertise-tabs{grid-template-columns:repeat(3,minmax(0,1fr));}}
