: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; justify-content: flex-end; gap: 8px; padding: 10px 20px; border-top: 1px solid var(--line); background: #fff; }
.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-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 { width: min(940px, 94vw); max-height: 92vh; display: grid; grid-template-rows: auto minmax(0,1fr) auto; overflow: hidden; }
.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; }
}

.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: 1280px;
}

.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-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-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 {
  padding-bottom: 74px;
}

.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-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;
  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-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-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-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 #111827;
  color: #111827;
  display: grid;
  font-family: Arial, sans-serif;
  height: var(--label-height);
  overflow: hidden;
  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 span,
.price-label-price em {
  font-style: normal;
}

.price-label-barcode-wrap {
  display: grid;
  gap: 0.35mm;
  min-height: 0;
}

.price-label-barcode {
  fill: #111827;
  justify-self: stretch;
  width: 100%;
}

.price-label-barcode-text,
.price-label-no-barcode {
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  text-align: center;
}

.price-label-40x30 {
  grid-template-rows: 6.6mm 8mm 6.5mm 2.6mm;
  row-gap: 0.45mm;
  padding: 1.5mm;
}

.price-label-40x30 .price-label-top {
  display: none;
}

.price-label-40x30 .price-label-name {
  font-size: 6.7pt;
  font-weight: 600;
  line-height: 1.06;
  -webkit-line-clamp: 2;
}

.price-label-40x30 .price-label-price strong {
  font-size: 18pt;
  font-weight: 600;
}

.price-label-40x30 .price-label-price span,
.price-label-40x30 .price-label-price em {
  font-size: 13pt;
  font-weight: 600;
}

.price-label-40x30 .price-label-barcode {
  height: 4.4mm;
}

.price-label-40x30 .price-label-barcode-text,
.price-label-40x30 .price-label-no-barcode {
  font-size: 4.2pt;
  font-weight: 600;
}

.price-label-40x30 .price-label-footer {
  font-size: 6pt;
  font-weight: 600;
  line-height: 1;
}

.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-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-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%;
}

.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-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;
    margin: 0;
    page-break-inside: avoid;
  }

  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 {
  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;
}

.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-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.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[hidden] { display: none; }

.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;
}

.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(4, 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 .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; }

.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-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);
}

.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-line-chart { padding: 12px 14px 10px; min-width: 0; }
.report-line-chart svg { display: block; width: 100%; height: 190px; overflow: visible; }
.report-line-chart polyline { fill: none; stroke-width: 4; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.report-line-chart polyline.revenue { stroke: #dc2626; }
.report-line-chart polyline.margin { stroke: #15803d; }
.report-line-chart .axis { stroke: #e5e7eb; stroke-width: 1; vector-effect: non-scaling-stroke; }
.report-line-chart > div { display: flex; justify-content: space-between; margin-top: 4px; color: var(--muted); font-size: 11px; }
.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: #15803d; }
.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; }
}

.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-empty { padding: 18px !important; color: var(--muted); text-align: center !important; }

.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) {
  .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; }
}

@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-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-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: 1080px;
  display: grid;
  grid-template-columns: 110px minmax(150px, 1.1fr) minmax(150px, 1.1fr) 105px 105px 105px 90px 140px 95px;
  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;
}

.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);
}

.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-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 > div { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(150px, 1fr) auto; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12px; }
.payroll-payment-history > div span { color: var(--muted); }
.payroll-payment-history > .payroll-breakdown { grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 0; padding-top: 0; }
.payroll-breakdown span { display: grid; gap: 3px; }
.payroll-breakdown strong { color: var(--text); }
.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 > div { grid-template-columns: 1fr auto; }
  .payroll-payment-history > div span:nth-child(2) { grid-column: 1 / -1; }
  .payroll-payment-history > .payroll-breakdown { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.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-note { margin-top: 18px; padding: 12px; border-left: 3px solid #94a3b8; background: #f8fafc; }
.employee-permission-note p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.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-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: 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);
}

.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);
}

.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;
}

.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-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-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.repair-over-client #repairDrawerRoot {
  z-index: 170;
}

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);
}

.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;
}

.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);
}

.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-results {
  display: grid;
  gap: 6px;
}

.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 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(1120px, calc(100vw - 32px));
  height: min(760px, calc(100vh - 40px));
  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;
  margin-top: 12px;
  padding-right: 4px;
}

.repair-catalog-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 105px 105px 125px 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: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repair-catalog-item-main small {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
}

.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;
  }
}

.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;
  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 {
  align-items: center;
}

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="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 {
  min-height: 0;
  padding: 12px 18px;
}

.stock-page-head {
  align-items: center;
  margin-bottom: 10px;
  padding: 12px 14px;
}

.stock-page-head h2 {
  font-size: 20px;
  margin: 2px 0;
}

.stock-page-head p {
  margin: 0;
}

body[data-section="orders"] h1 {
  font-size: 28px;
}

body[data-section="orders"] #orders {
  gap: 8px;
}

.repair-top-actions {
  margin-top: -4px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.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: 8px;
  display: flex;
  flex-wrap: nowrap;
  align-items: end;
  gap: 8px;
  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: 36px;
}

.repair-filter-panel .secondary-action {
  flex: 0 0 auto;
}

.repairs-list-panel {
  padding: 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;
  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;
  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-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 span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 750;
}

.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: 34px minmax(0, 1fr) auto 30px;
  gap: 8px;
  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;
}

.work-tree-attachment-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.work-tree-branch {
  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;
}

.loose-parts-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  overflow: hidden;
}

.loose-parts-list > header,
.loose-part-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
}

.loose-parts-list > header {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  font-size: 12px;
}

.loose-parts-list > header span {
  color: var(--muted);
}

.loose-part-row + .loose-part-row {
  border-top: 1px solid var(--line);
}

.loose-part-row > div {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  gap: 2px;
}

.loose-part-row > div strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loose-part-row small {
  color: var(--muted);
  font-size: 11px;
}

.loose-part-row select {
  min-width: 170px;
  max-width: 260px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.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);
  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);
}

.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-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;
  }
  .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;
  }

  .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;
    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;
    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: auto;
}

.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;
}

#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-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; }

@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); }
  .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: 42px;
  padding: 8px 10px;
  grid-template-columns: 18px auto;
  gap: 7px;
  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: 18px;
  height: 18px;
}

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: 42px;
    padding: 9px 11px;
    grid-template-columns: 18px;
    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;
  }
}
