:root {
  --blue: #1167a9;
  --blue-dark: #0a4d82;
  --blue-soft: #eaf4fc;
  --ink: #172430;
  --muted: #6b7a87;
  --line: #dfe6eb;
  --paper: #fff;
  --bg: #f3f6f8;
  --green: #16835d;
  --orange: #b96813;
  --red: #b83a31;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
body.locked { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 86px;
  gap: 18px;
  padding: 10px max(24px, calc((100% - 1500px) / 2));
  color: white;
  background: linear-gradient(120deg, #083e69, #126dac);
  box-shadow: 0 5px 18px rgba(7, 50, 84, .18);
}

.brand, .brand > span:last-child, .server-state, .account-area, .header-nav { display: flex; align-items: center; }
.brand { gap: 12px; }
.brand > span:last-child { align-items: flex-start; flex-direction: column; }
.brand small { margin-top: 2px; color: #cfe5f7; font-size: 11px; }
.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  overflow: hidden;
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 11px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.brand-mark:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,.16); }
.brand-mark img { width: 44px; height: 44px; object-fit: contain; }
.server-state { justify-content: center; width: 18px; height: 32px; }
.server-state i { width: 9px; height: 9px; border-radius: 50%; background: #5de1a2; box-shadow: 0 0 0 4px rgba(93,225,162,.14); animation: online-breathe 5s ease-in-out infinite; }
@keyframes online-breathe { 0%, 100% { opacity: .28; box-shadow: 0 0 0 2px rgba(93,225,162,.08); } 50% { opacity: 1; box-shadow: 0 0 0 5px rgba(93,225,162,.18); } }
.header-nav { flex: 1 1 auto; justify-content: center; gap: 7px; min-width: 0; }
.header-nav button, .header-nav a { min-height: 40px; display: inline-flex; align-items: center; flex: 0 0 auto; padding: 0 14px; color: #eaf6ff; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); border-radius: 10px; font-size: 12px; font-weight: 750; line-height: 1.2; white-space: nowrap; text-decoration: none; }
.header-nav button:hover, .header-nav button:focus-visible, .header-nav a:hover, .header-nav a:focus-visible { color: #083e69; background: white; outline: none; }
.header-nav .active, .header-nav [aria-current="page"] { color: #083e69; background: white; border-color: white; }
.account-area { flex: 0 0 auto; gap: 8px; }
.user-chip, .logout-button { display: grid; width: 42px; height: 42px; padding: 0; place-items: center; color: white; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.28); border-radius: 11px; }
.user-chip { cursor: default; }
.user-chip[data-role="admin"] { color: #fff3bd; background: rgba(255,214,85,.15); border-color: rgba(255,231,148,.48); }
.user-chip[data-role="operator"] { color: #dff4ff; background: rgba(255,255,255,.1); }
.role-icon, .logout-button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.admin-role-icon path:last-child { fill: currentColor; stroke-width: 1.1; }
.user-chip[data-role="admin"] .operator-role-icon, .user-chip[data-role="operator"] .admin-role-icon { display: none; }
.logout-button { cursor: pointer; background: transparent; }
.logout-button:hover, .logout-button:focus-visible { color: #083e69; background: white; outline: none; }

.login-screen { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #092f50, #126dab); }
@media screen {
  .session-check { position: fixed; z-index: 1001; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; background: var(--bg); color: var(--muted); font-size: 14px; text-align: center; }
  .session-check p { margin: 0; }
}
.login-card { width: min(390px, 100%); padding: 32px; background: white; border-radius: 18px; box-shadow: 0 25px 70px rgba(0,0,0,.27); }
.login-card h1 { margin: 5px 0 7px; font-size: 25px; }
.login-card > p:not(.eyebrow):not(.login-message) { margin: 0 0 22px; color: var(--muted); font-size: 12px; }
.login-card .field { margin-bottom: 13px; }
.login-card .primary { width: 100%; margin-top: 6px; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 82px; }
.password-field button { position: absolute; top: 50%; right: 7px; min-height: 32px; padding: 0 9px; transform: translateY(-50%); color: var(--blue-dark); background: var(--blue-soft); border: 0; border-radius: 7px; font-size: 10px; font-weight: 750; }
.login-mark { display: grid; width: 48px; height: 48px; margin-bottom: 15px; place-items: center; overflow: hidden; background: var(--blue-soft); border: 1px solid #cfe3f3; border-radius: 12px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.login-mark:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(17,103,169,.18); }
.login-mark img { width: 44px; height: 44px; object-fit: contain; }
.login-message { min-height: 18px; margin: 12px 0 0; color: var(--red); font-size: 12px; font-weight: 700; }

.shell { max-width: 1320px; padding: 28px 24px 40px; margin: auto; }
.eyebrow { margin: 0; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.summary article { min-height: 96px; padding: 19px 20px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 5px 18px rgba(23,36,48,.045); }
.summary span, .summary strong { display: block; }
.summary span { color: var(--muted); font-size: 12px; }
.summary strong { margin-top: 8px; color: var(--blue-dark); font-size: 25px; }

.panel { padding: 26px; margin-bottom: 22px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 7px 24px rgba(23,36,48,.055); }
.panel-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.panel-title h2 { margin: 3px 0 0; font-size: 21px; letter-spacing: -.02em; }
.panel-title > span { color: var(--muted); font-size: 11px; }

.customer-grid { display: grid; grid-template-columns: 1.25fr 1fr .75fr .9fr; gap: 14px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span { color: #4e5c68; font-size: 12px; font-weight: 750; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  color: var(--ink);
  background: white;
  border: 1px solid #d4dde4;
  border-radius: 9px;
  outline: none;
  transition: .15s;
}
textarea { min-height: 90px; padding-top: 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(17,103,169,.1); }
input::placeholder, textarea::placeholder { color: #9aa6af; }
.formatted-date-control { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 38px; width: 100%; min-width: 0; }
.formatted-date-display { min-width: 0; padding-right: 8px; border-radius: 9px 0 0 9px !important; }
.date-picker-trigger { min-width: 38px; min-height: 44px; padding: 0; color: var(--blue); background: var(--blue-soft); border: 1px solid #c7d9e7; border-left: 0; border-radius: 0 9px 9px 0; font-size: 19px; font-weight: 900; }
.date-picker-trigger:hover:not(:disabled) { color: white; background: var(--blue); }
.date-picker-trigger:disabled { cursor: not-allowed; opacity: .55; }
.native-date-source { position: absolute !important; right: 38px; bottom: 0; width: 1px !important; min-width: 1px !important; height: 1px !important; min-height: 1px !important; padding: 0 !important; opacity: 0; pointer-events: none; }
.date-bound .formatted-date-control { flex: 1 1 auto; grid-template-columns: minmax(0, 1fr) 30px; }
.date-bound .formatted-date-display { min-height: 40px; padding: 0 3px; background: transparent; border: 0 !important; box-shadow: none; font-size: 10px; }
.date-bound .date-picker-trigger { min-width: 30px; min-height: 40px; background: transparent; border: 0; border-radius: 0; font-size: 15px; }
.password-input-wrap { position: relative; display: block; }
.password-input-wrap input { padding-right: 48px; }
.password-toggle { position: absolute; top: 50%; right: 7px; display: grid; width: 34px; height: 34px; padding: 0; transform: translateY(-50%); place-items: center; color: #657581; background: transparent; border: 0; border-radius: 7px; }
.password-toggle:hover, .password-toggle:focus-visible { color: var(--blue); background: var(--blue-soft); outline: none; }
.password-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-toggle .eye-closed, .password-toggle.is-visible .eye-open { display: none; }
.password-toggle.is-visible .eye-closed { display: block; }

.company-toggle {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 7px 11px;
  background: #f7f9fa;
  border: 1px solid #dbe3e8;
  border-radius: 9px;
  cursor: pointer;
}
.company-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.checkmark { display: grid; flex: 0 0 auto; width: 26px; height: 26px; place-items: center; color: transparent; background: white; border: 1px solid #bfcbd4; border-radius: 7px; font-weight: 900; }
.company-toggle input:checked + .checkmark { color: white; background: var(--blue); border-color: var(--blue); }
.visibility-toggle-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; padding: 9px 12px; background: #eef7f4; border: 1px solid #cae4da; border-radius: 9px; cursor: pointer; }
.visibility-toggle-field > span:first-child { display: grid; gap: 3px; }
.visibility-toggle-field strong { color: #274252; font-size: 12px; }
.visibility-toggle-field small { color: var(--muted); font-size: 9px; }
.visibility-toggle-field input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.visibility-switch { position: relative; flex: 0 0 auto; width: 38px; height: 22px; background: #c9d2d9; border-radius: 999px; transition: background .16s ease; }
.visibility-switch i { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: white; border-radius: 50%; box-shadow: 0 1px 3px rgba(13,31,45,.24); transition: transform .16s ease; }
.visibility-toggle-field input:checked + .visibility-switch { background: var(--green); }
.visibility-toggle-field input:checked + .visibility-switch i { transform: translateX(16px); }
.visibility-toggle-field input:focus-visible + .visibility-switch { outline: 3px solid rgba(22,131,93,.18); outline-offset: 2px; }
.company-toggle > span:last-child { display: flex; flex-direction: column; }
.company-toggle strong { font-size: 12px; }
.company-toggle small { margin-top: 1px; color: var(--muted); font-size: 9px; }
.company-fields { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; padding: 16px; margin-top: 13px; background: var(--blue-soft); border: 1px solid #cfe3f3; border-radius: 11px; animation: reveal .16s ease-out; }
.company-match-message { grid-column: 1 / -1; min-height: 14px; margin-top: -5px; color: var(--orange); font-size: 10px; font-weight: 700; }
.company-match-message.success { color: var(--green); }
.company-match-message.error { color: var(--red); }
.tax-verify-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.tax-verify-row input { min-width: 0; }
.verify-company { min-height: 42px; padding-inline: 11px; white-space: nowrap; }
.client-match-message { display: block; min-height: 14px; margin: 6px 0 -6px; color: var(--orange); font-size: 10px; font-weight: 700; }
.clearable-input { position: relative; display: block; }
.clearable-input input { padding-right: 44px; }
.clearable-input > button { position: absolute; top: 50%; right: 7px; display: grid; width: 30px; height: 30px; padding: 0; transform: translateY(-50%); place-items: center; color: var(--red); background: #fff1f0; border: 0; border-radius: 7px; font-size: 20px; line-height: 1; }
.clearable-input > button:hover { color: white; background: var(--red); }
@keyframes reveal { from { transform: translateY(-4px); opacity: 0; } }

.section-label { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 10px; }
.section-label > div { display: flex; align-items: center; gap: 9px; }
.section-label div span { display: grid; width: 26px; height: 26px; place-items: center; color: var(--blue); background: var(--blue-soft); border-radius: 7px; font-size: 10px; font-weight: 900; }
.section-label strong { font-size: 13px; }
.section-label small { color: var(--muted); font-size: 10px; }

.services-box { padding: 15px; background: #f7f9fa; border: 1px solid #e0e7eb; border-radius: 12px; }
.service-row { display: grid; grid-template-columns: minmax(280px, 1fr) 92px 190px 130px 38px; gap: 10px; align-items: end; margin-bottom: 11px; }
.service-name-field { position: relative; }
.service-suggestions { position: absolute; top: calc(100% + 4px); right: 0; left: 0; z-index: 20; display: grid; max-height: 250px; padding: 4px; overflow-y: auto; border: 1px solid #b9d0e1; border-radius: 9px; background: #fff; box-shadow: 0 12px 28px rgba(17,55,83,.18); }
.service-suggestions[hidden] { display: none; }
.service-suggestion { display: grid; gap: 2px; width: 100%; padding: 9px 10px; border: 0; border-radius: 6px; color: #183d58; background: #fff; text-align: left; cursor: pointer; }
.service-suggestion:hover, .service-suggestion:focus { color: #fff; background: var(--blue); outline: none; }
.service-suggestion small { color: #668095; font-size: 10px; }
.service-suggestion:hover small, .service-suggestion:focus small { color: #e9f6ff; }
.service-suggestion.is-active { color: #fff; background: var(--blue); outline: none; }
.service-suggestion.is-active small { color: #e9f6ff; }
.client-autocomplete { position: relative; display: block; min-width: 0; }
.company-suggestions, .client-suggestions { width: 100%; min-width: 0; max-width: 100%; z-index: 30; max-height: 300px; }
.company-suggestion, .client-suggestion { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.company-suggestion strong, .client-suggestion strong { overflow-wrap: anywhere; font-size: 12px; line-height: 1.3; }
.company-suggestion small, .client-suggestion small { white-space: nowrap; }
.company-suggestion.is-active, .client-suggestion.is-active { color: #fff; background: var(--blue); outline: none; }
.company-suggestion.is-active small, .client-suggestion.is-active small { color: #e9f6ff; }
.operator-view .service-row { grid-template-columns: minmax(280px, 1fr) 92px 190px 38px; }
.operator-view .cost-field { display: none; }
.order-materials { grid-column: 1 / -1; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.operator-view .order-materials { display: none; }
.order-materials .catalog-materials-head { margin-bottom: 0; }
.order-material-list:not(:empty) { display: grid; gap: 8px; margin-top: 9px; }
.order-material-row { display: grid; grid-template-columns: minmax(220px, 1fr) 150px auto; gap: 8px; align-items: end; }
.order-material-row .catalog-material-search { margin-bottom: 6px; }
.order-material-row .remove-order-material { min-width: 38px; height: 44px; }
.order-materials > small { display: block; margin-top: 7px; color: var(--muted); }
.amount-entry-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: stretch; }
.test-toggle { display: inline-flex; align-items: center; min-height: 44px; padding: 0 9px 0 6px; color: #8b5a1e; background: #fff8ed; border: 1px solid #efd6ae; border-radius: 9px; font-size: 9px; font-weight: 850; line-height: 1; cursor: pointer; transition: .15s; }
.test-toggle input { position: absolute; width: 1px; height: 1px; min-height: 1px; padding: 0; opacity: 0; }
.test-toggle > span { display: inline-flex; align-items: center; gap: 5px; }
.test-toggle > span::before { content: "✓"; display: grid; width: 16px; height: 16px; place-items: center; color: transparent; background: white; border: 1px solid #d7b984; border-radius: 50%; font-size: 9px; transition: .15s; }
.test-toggle:has(input:checked) { color: white; background: var(--orange); border-color: var(--orange); box-shadow: 0 2px 6px rgba(185,104,19,.22); }
.test-toggle input:checked + span::before { color: var(--orange); border-color: white; }
.test-toggle:has(input:focus-visible) { outline: 3px solid rgba(185,104,19,.18); outline-offset: 1px; }
.amount-field.is-testing .amount { color: var(--muted); background: #eef1f3; }
.test-badge { display: inline-flex; padding: 3px 7px; color: #9a5a0d; background: #fff1d9; border-radius: 5px; font-size: 10px; font-weight: 800; }
.remove-service { display: grid; width: 38px; height: 44px; padding: 0; place-items: center; color: var(--red); background: white; border: 1px solid #efc9c6; border-radius: 9px; font-size: 22px; }
.remove-service:hover { color: white; background: var(--red); }
.service-row:only-child .remove-service { visibility: hidden; }
.services-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.services-footer div { color: var(--muted); font-size: 12px; }
.services-footer strong { color: var(--ink); }

.details-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; align-items: end; }
.primary, .secondary, .ghost { min-height: 42px; padding: 0 16px; border-radius: 9px; font-weight: 750; }
.primary { color: white; background: var(--blue); border: 1px solid var(--blue); box-shadow: 0 5px 12px rgba(17,103,169,.18); }
.primary:hover { background: var(--blue-dark); }
.primary:disabled { opacity: .6; cursor: wait; }
.secondary { color: var(--blue-dark); background: var(--blue-soft); border: 1px solid #c8deef; }
.ghost { color: #52616d; background: white; border: 1px solid #d4dde4; }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
#form-message { margin: 0 0 0 8px; color: var(--green); font-size: 12px; font-weight: 700; }
#form-message.error { color: var(--red); }

.records-title { align-items: center; }
.record-count { padding: 8px 12px; color: var(--blue); background: var(--blue-soft); border-radius: 8px; font-size: 11px; }
.record-count span { font-size: 16px; }
.filters { display: grid; grid-template-columns: minmax(300px, 3fr) minmax(230px, 2fr) minmax(76px, .75fr) minmax(76px, .75fr) minmax(112px, 1fr) minmax(112px, 1fr); gap: 12px; align-items: start; padding: 14px; margin-bottom: 15px; background: #f7f9fa; border-radius: 11px; }
.filters > .field { grid-column: auto; }
.filter-search-group { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.filter-search-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 20px; color: #4e5c68; font-size: 12px; font-weight: 750; }
.filter-search-label-row > label:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filters .filter-amount { grid-column: auto; }
.filters > .field > span, .date-range-field > span { display: flex; align-items: center; min-height: 20px; }
.date-range-field { display: flex; flex-direction: column; gap: 7px; width: 100%; min-width: 0; }
.date-range-field > span { color: #4e5c68; font-size: 12px; font-weight: 750; }
.date-range-control { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 38px; align-items: center; min-height: 44px; overflow: hidden; background: white; border: 1px solid #d4dde4; border-radius: 9px; }
.date-range-control:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(17,103,169,.1); }
.date-range-control > i { color: #8b98a2; font-size: 11px; font-style: normal; }
.date-bound { display: flex; align-items: center; min-width: 0; padding-left: 7px; }
.date-bound > input[type="checkbox"] { flex: 0 0 auto; width: 15px; height: 15px; min-height: 15px; padding: 0; margin: 0 3px 0 0; accent-color: var(--blue); }
.date-bound .formatted-date-display:disabled { color: #9ca7ae; opacity: .65; }
.date-preset { width: 38px; min-height: 42px; padding: 0 7px; color: var(--blue); background: var(--blue-soft); border: 0; border-left: 1px solid #d4dde4; border-radius: 0; font-size: 12px; font-weight: 900; }
.filter-actions { display: flex; grid-column: 1 / -1; gap: 8px; justify-content: flex-end; }
.filter-actions button { min-width: 92px; }
.company-filter-switch { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; color: #52616d; cursor: pointer; user-select: none; }
.company-filter-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.company-filter-switch .switch-track { position: relative; width: 32px; height: 18px; background: #c9d2d9; border-radius: 999px; transition: background .16s ease; }
.company-filter-switch .switch-track i { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; background: white; border-radius: 50%; box-shadow: 0 1px 3px rgba(13,31,45,.24); transition: transform .16s ease; }
.company-filter-switch strong { font-size: 12px; }
.company-filter-switch input:checked + .switch-track { background: var(--blue); }
.company-filter-switch input:checked + .switch-track i { transform: translateX(14px); }
.company-filter-switch input:focus-visible + .switch-track { outline: 3px solid rgba(17,103,169,.18); outline-offset: 2px; }
.export-button, .print-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 44px; }
.export-button { color: #147247; background: #e8f7ef; border-color: #b9e2cb; }
.export-button:hover { color: white; background: #147247; border-color: #147247; }
.excel-glyph { display: grid; width: 19px; height: 19px; place-items: center; color: white; background: #16835d; border-radius: 4px; font-size: 10px; font-weight: 900; line-height: 1; }
.export-button:hover .excel-glyph { color: #147247; background: white; }
.print-button { color: var(--blue-dark); background: var(--blue-soft); border-color: #bdd9ed; }
.print-button:hover { color: white; background: var(--blue); border-color: var(--blue); }
.printer-glyph { display: inline-block; width: 21px; color: currentColor; font-family: "Segoe UI Symbol", "Arial Unicode MS", sans-serif; font-size: 20px; font-weight: 400; line-height: 1; text-align: center; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; }
.records-totals { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 10px; margin-top: 12px; }
.records-totals article { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; padding: 10px 14px; background: #f7f9fa; border: 1px solid var(--line); border-radius: 10px; }
.records-totals span { color: var(--muted); font-size: 11px; font-weight: 700; }
.records-totals strong { color: var(--blue-dark); font-size: 16px; white-space: nowrap; }
.records-totals .records-total-stack { flex-direction: column; align-items: stretch; }
.records-total-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.records-total-line + .records-total-line { padding-top: 9px; border-top: 1px solid var(--line); }
.records-totals .records-total-cost strong { color: var(--red); }
.records-totals .records-total-profit strong { color: var(--green); }
.operator-view .admin-only-total { display: none; }
.operator-view .operator-hidden-total { display: none; }
.operator-view .admin-only-total-line { display: none; }
.operator-view .records-totals { grid-template-columns: minmax(180px, 1fr); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 14px; color: var(--muted); font-size: 11px; }
.pagination-pages { display: flex; align-items: center; gap: 10px; }
.pagination-pages > #page-range { margin-right: 6px; }
.pagination button { min-height: 36px; padding: 0 12px; font-size: 11px; }
.pagination button:disabled { opacity: .45; cursor: default; }
.pagination strong { min-width: 92px; color: var(--ink); text-align: center; }
.pagination-size { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); white-space: nowrap; }
.pagination-size select { width: 66px; min-height: 36px; padding: 0 8px; color: var(--ink); background: white; border-radius: 8px; font-size: 11px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 12px; color: #5d6b76; background: #f4f7f9; border-bottom: 1px solid var(--line); text-align: left; font-size: 10px; text-transform: uppercase; }
.sortable-heading { white-space: nowrap; }
.sortable-heading > span { margin: 0 3px; color: #9aa6ae; }
.sortable-heading button { padding: 4px 3px; color: inherit; background: transparent; border: 0; border-radius: 5px; font-size: inherit; font-weight: 800; text-transform: uppercase; }
.sortable-heading button:hover { color: var(--blue-dark); background: #e3edf4; }
.sortable-heading button.active { color: var(--blue); background: var(--blue-soft); }
.sortable-heading button i { display: inline-block; min-width: 10px; margin-left: 2px; font-style: normal; }
td { padding: 13px 12px; border-bottom: 1px solid #e8edf0; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
#records-body tr { transition: background-color .18s ease, box-shadow .18s ease; }
#records-body tr:hover { background: #eaf2f7; box-shadow: inset 4px 0 0 var(--blue); }
#records-body tr:hover .service-list strong { color: var(--blue-dark); }
.id-date strong, .customer-cell strong, .service-list strong { display: block; }
.service-list strong { transition: color .18s ease; }
.id-date small, .customer-cell small, .service-list small, .note-line { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.company-badge { display: inline-block; padding: 2px 6px; margin: 5px 0 0; color: var(--blue-dark); background: var(--blue-soft); border-radius: 4px; font-size: 9px; font-weight: 800; }
.visibility-badge { display: inline-flex; width: max-content; padding: 2px 6px; margin-top: 5px; border-radius: 4px; font-size: 9px; font-weight: 800; }
.visibility-badge.operator { color: #08734f; background: #daf3e8; }
.visibility-badge.admin { color: #8b5a1e; background: #fff1d9; }
.legacy-id { color: #7a6a4f !important; }
.status-badge, .payment-badge { display: inline-flex; padding: 5px 8px; border-radius: 6px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.status-received { color: #3f6280; background: #e9f0f5; }
.status-in_progress { color: #9a5a0d; background: #fff1d9; }
.status-ready { color: #08734f; background: #daf3e8; }
.status-delivered { color: #08734f; background: #daf3e8; }
.status-cancelled { color: #a3342c; background: #fce5e3; }
.payment-unpaid { color: #a3342c; background: #fce5e3; }
.payment-cash, .payment-card, .payment-bank_transfer { color: #08734f; background: #daf3e8; }
.row-actions { display: flex; gap: 6px; }
.row-actions button { width: 31px; height: 31px; padding: 0; border-radius: 7px; background: white; border: 1px solid #d6dfe5; }
.row-actions button:disabled { opacity: .38; cursor: not-allowed; }
.row-actions .delete { color: var(--red); }
@media screen {
  .service-history-table [data-order-note] { display: grid; place-items: center; }
  .service-history-table [data-order-note]:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
  .service-history-table .row-actions { flex-wrap: wrap; }
  .service-history-table .row-actions button { flex-shrink: 0; }
  .service-history-table .id-date .visibility-badge { width: fit-content; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .service-history-table .id-date > strong, .service-history-table .id-date > small { white-space: nowrap; }
}
@media screen and (min-width: 681px) {
  .service-history-table { table-layout: fixed; min-width: 1180px; }
  .service-history-table th, .service-history-table td { padding-inline: 8px; overflow-wrap: anywhere; }
  .service-history-table th:nth-child(1) { width: 9%; }
  .service-history-table th:nth-child(2) { width: 15.5%; }
  .service-history-table th:nth-child(3) { width: 23.5%; }
  .service-history-table th:nth-child(4) { width: 9.5%; }
  .service-history-table th:nth-child(5) { width: 11%; }
  .service-history-table th:nth-child(6) { width: 11.5%; }
  .service-history-table th:nth-child(7) { width: 20%; }
  .service-history-table th.sortable-heading { white-space: normal; }
  .service-history-table .sortable-heading button { white-space: nowrap; }
}
@media screen and (max-width: 680px) {
  .service-history-table thead { display: block; }
  .service-history-table thead tr { padding: 0; }
  .service-history-table thead th { display: none; }
  .service-history-table thead th.sortable-heading { display: block; white-space: normal; }
  .service-history-table .row-actions { min-width: 0; }
}
.row-actions .invoice { display: grid; place-items: center; color: #30379f; background: #eef0ff; border-color: #c7cbf2; }
.row-actions .rs-invoice { width: 36px; color: #76568a; background: #eee8f3; border-color: #d9cbe4; font-size: 9px; font-weight: 900; letter-spacing: -.2px; }
.row-actions .rs-invoice.rs-sent { color: #fff; background: #6f2aa8; border-color: #592087; box-shadow: 0 0 0 2px rgba(111,42,168,.12); }
.row-actions .rs-invoice.rs-confirmed { color: #fff; background: #16835d; border-color: #0e6749; }
.row-actions .rs-invoice.rs-deleted { width: 61px; display: grid; place-content: center; gap: 0; color: #fff; background: #c83f36; border-color: #a62e27; line-height: 1; }
.row-actions .rs-invoice.rs-deleted small { display: block; margin-top: 2px; color: #fff; font-size: 7px; font-weight: 800; }
.admin-title-actions { display: flex; align-items: center; gap: 8px; }
.rs-settings-button { min-height: 38px; padding: 0 13px; color: #fff; background: #6f2aa8; border: 1px solid #592087; border-radius: 9px; font-weight: 800; }
#rs-settings-form .field { margin-top: 12px; }
#rs-settings-message { min-height: 18px; margin: 10px 0 0; color: #08734f; font-size: 11px; font-weight: 700; }
#rs-settings-message.error { color: #a3342c; }
.invoice-glyph { position: relative; display: block; width: 13px; height: 16px; border: 1.5px solid currentColor; border-radius: 2px; }
.invoice-glyph::before, .invoice-glyph::after { content: ""; position: absolute; left: 2px; height: 1.5px; background: currentColor; border-radius: 1px; }
.invoice-glyph::before { top: 5px; width: 7px; box-shadow: 0 3px 0 currentColor; }
.invoice-glyph::after { top: 11px; width: 4px; }
.row-actions .sms { color: #08734f; background: #e4f6ee; border-color: #b9e2cf; font-size: 17px; }
.row-actions .sms.sms-pending { color: #1265a8; background: #e8f2fb; border-color: #9fc8e8; }
.row-actions .sms.sms-delivered { color: white; background: #16a05d; border-color: #0d8048; font-weight: 900; }
.row-actions .sms.sms-undelivered { color: white; background: #d0443b; border-color: #aa2d26; font-weight: 900; }
.inline-select { width: 100%; min-width: 112px; min-height: 32px; padding: 4px 24px 4px 7px; border: 1px solid transparent; border-radius: 7px; font-size: 10px; font-weight: 750; }
.inline-select.payment-unpaid { color: #a3342c; background: #fce5e3; }
.inline-select.payment-cash, .inline-select.payment-card, .inline-select.payment-bank_transfer { color: #08734f; background: #daf3e8; }
.payment-partial-label { display: inline-block; padding: 6px 8px; border-radius: 7px; color: #87520b; background: #fff1d9; font-size: 12px; font-weight: 750; white-space: nowrap; }
.payment-progress { display: block; margin-top: 5px; color: #465867; font-size: 12px; line-height: 1.5; }
.inline-select.status-received { color: #3f6280; background: #e9f0f5; }
.inline-select.status-in_progress { color: #9a5a0d; background: #fff1d9; }
.inline-select.status-ready { color: #08734f; background: #daf3e8; }
.inline-select.status-delivered { color: #08734f; background: #daf3e8; border-color: #a7ddc5; }
.inline-select.status-cancelled { color: #a3342c; background: #fce5e3; }
.relative-day-tag { display: inline-flex; width: max-content; padding: 3px 7px; margin: 5px 0 1px; color: #755200; background: #ffe596; border: 1px solid #efc953; border-radius: 999px; font-size: 9px; font-weight: 900; }
#date-admin-note { margin-left: 5px; color: #8b6a24; font-size: 9px; font-weight: 650; }
#service-date:disabled { color: #6f7c86; background: #f0f3f5; cursor: not-allowed; }
.sms-dialog { width: min(460px, calc(100vw - 24px)); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 24px 70px rgba(18,41,58,.3); }
.sms-dialog::backdrop { background: rgba(13,31,45,.48); backdrop-filter: blur(2px); }
.sms-dialog-card { padding: 18px; }
.sms-dialog-card > header, .sms-dialog-card > footer, .sms-template-editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sms-dialog-card > header { margin-bottom: 12px; }
.sms-dialog-card h2, .sms-dialog-card h3, .sms-dialog-card p { margin-top: 0; }
.sms-dialog-card header small { color: var(--muted); }
.sms-dialog-close { width: 32px; height: 32px; border: 0; border-radius: 8px; color: #61717c; background: #eef2f4; font-size: 20px; }
.sms-delivery-line { min-height: 18px; margin-bottom: 10px; color: #55707e; font-size: 11px; font-weight: 700; }
.sms-template-buttons { display: grid; gap: 7px; margin-bottom: 12px; }
.sms-template-buttons button { padding: 10px; color: #274252; background: #f7fafc; border: 1px solid #d9e4ea; border-radius: 9px; text-align: left; }
.sms-template-buttons button:hover { background: #e8f3fc; border-color: #9fc8e8; }
.sms-template-buttons strong, .sms-template-buttons span { display: block; }
.sms-template-buttons span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.sms-text-field textarea { min-height: 100px; resize: vertical; }
.sms-text-field > small { display: block; margin-top: 3px; color: var(--muted); text-align: right; }
.sms-dialog-card > footer { margin-top: 12px; }
.sms-dialog-card > footer #send-sms { margin-left: auto; }
.invoice-dialog { width: min(520px, calc(100vw - 24px)); }
.invoice-choice { display: grid; gap: 12px; }
.invoice-choice-button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid #c7cbf2; border-radius: 12px; color: #30379f; background: #eef0ff; text-align: left; }
.invoice-choice-button:hover { border-color: #979ede; background: #e5e8ff; }
.invoice-choice-button strong, .invoice-choice-button small { display: block; }
.invoice-choice-button small { margin-top: 3px; color: var(--muted); font-weight: 500; }
.invoice-choice-icon { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 10px; color: #fff; background: #30379f; font-size: 19px; }
.invoice-email-choice { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; padding: 14px; border: 1px solid #d8e2ef; border-radius: 12px; background: #f8fafc; }
.invoice-email-choice .primary { white-space: nowrap; }
.invoice-save-email { display: flex; align-items: center; gap: 6px; margin-top: 7px; color: var(--muted); font-size: 10px; font-weight: 700; }
#invoice-message.success { color: #08734f; }
@media (max-width: 560px) { .invoice-email-choice { grid-template-columns: 1fr; } .invoice-email-choice .primary { width: 100%; } }
.sms-template-editor { padding: 12px; margin-top: 10px; background: #f7fafc; border: 1px solid #d9e4ea; border-radius: 10px; }
.sms-template-editor h3 { font-size: 13px; }
.sms-template-editor label { display: grid; gap: 5px; margin-top: 9px; }
.sms-template-editor input, .sms-template-editor textarea { width: 100%; padding: 8px; border: 1px solid #d4dde4; border-radius: 8px; font: inherit; }
.sms-template-editor textarea { min-height: 64px; resize: vertical; }
.sms-template-editor-actions { margin-top: 10px; }
#sms-message { min-height: 18px; margin: 9px 0 0; color: #08734f; font-size: 11px; font-weight: 700; }
#sms-message.error { color: #a3342c; }
.rs-result-dialog { width: min(420px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 26px 80px rgba(18,41,58,.34); }
.rs-result-dialog::backdrop { background: rgba(13,31,45,.52); backdrop-filter: blur(2px); }
.rs-result-card { display: grid; justify-items: center; gap: 9px; padding: 28px 24px 22px; text-align: center; }
.rs-result-icon { display: grid; width: 68px; height: 68px; place-items: center; color: #fff; border-radius: 50%; font-size: 44px; font-weight: 900; line-height: 1; }
.rs-result-dialog.success .rs-result-icon { background: var(--green); box-shadow: 0 9px 25px rgba(22,131,93,.28); }
.rs-result-dialog.error .rs-result-icon { background: var(--red); box-shadow: 0 9px 25px rgba(203,59,50,.25); }
.rs-result-card h2 { margin: 5px 0 0; color: #17384f; font-size: 21px; }
.rs-result-card p { min-height: 20px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; white-space: pre-line; }
.rs-result-dialog.error .rs-result-card h2 { color: #a3342c; }
.rs-result-card button { min-width: 120px; margin-top: 5px; }
.row-actions .sticker { display: grid; place-items: center; color: var(--blue); background: var(--blue-soft); border-color: #c5dff2; }
.sticker-glyph { position: relative; display: block; width: 15px; height: 13px; border: 1.5px solid currentColor; border-radius: 3px; }
.sticker-glyph::after { content: ""; position: absolute; top: 50%; left: 50%; width: 3px; height: 3px; transform: translate(-50%, -50%); background: currentColor; border-radius: 1px; }
.amount-breakdown small, .amount-breakdown b { display: block; margin-top: 3px; font-size: 10px; }
.amount-breakdown small { color: var(--red); }
.amount-breakdown b { color: var(--green); }
.admin-help { margin: -8px 0 16px; color: var(--muted); font-size: 12px; }
.catalog-search-bar { display: flex; align-items: end; gap: 12px; padding: 13px; margin-bottom: 14px; background: var(--blue-soft); border: 1px solid #cfe3f3; border-radius: 10px; }
.catalog-search-bar .field { width: min(420px, 100%); }
.catalog-search-bar input { background: white; }
.catalog-search-bar small { min-width: 82px; padding-bottom: 12px; color: var(--blue-dark); font-size: 10px; font-weight: 800; }
.catalog-list { display: flex; flex-direction: column; gap: 10px; }
.catalog-row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 12px; align-items: end; padding: 12px; background: #f7f9fa; border: 1px solid var(--line); border-radius: 10px; }
.catalog-row.is-new { background: #f1f8fd; border-color: #85bde3; box-shadow: 0 0 0 3px rgba(17,103,169,.08); }
.catalog-row.is-dirty:not(.is-new) { border-color: #d8b26d; }
.catalog-row-actions { display: flex; align-items: center; gap: 7px; }
.catalog-materials { grid-column: 1 / -1; padding: 10px; border-radius: 9px; background: #fff; border: 1px solid var(--line); }
.catalog-materials-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.catalog-material-list { display: flex; flex-direction: column; gap: 7px; }
.catalog-material-row { display: grid; grid-template-columns: minmax(220px, 1fr) 150px auto; align-items: end; gap: 8px; }
.catalog-material-search { margin-bottom: 6px; }
.catalog-material-row .remove-service { position: static; }
.catalog-materials > small { display: block; margin-top: 7px; color: var(--muted); }
.catalog-row-save { min-height: 44px; padding-inline: 13px; }
.catalog-row-message { grid-column: 1 / -1; min-height: 14px; margin-top: -5px; color: var(--green); font-size: 10px; font-weight: 800; }
.catalog-row-message.error { color: var(--red); }
.companies-panel, .admin-panel, .email-history-panel { scroll-margin-top: 16px; }
.email-history-filters { display: grid; grid-template-columns: minmax(260px, 1fr) 210px auto; align-items: end; gap: 12px; padding: 13px; margin-bottom: 14px; background: #f1f6fb; border: 1px solid #d4e3ef; border-radius: 10px; }
.email-history-filters small { min-width: 90px; padding-bottom: 12px; color: var(--blue-dark); font-size: 10px; font-weight: 800; }
.email-history-table th, .email-history-table td { vertical-align: top; }
.email-history-table td strong, .email-history-table td small { display: block; }
.email-history-table td small { margin-top: 4px; color: var(--muted); }
.email-status { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 850; white-space: nowrap; }
.email-status.sent { color: #08734f; background: #dcf5eb; }
.email-status.failed { color: #a3342c; background: #fbe4e2; }
.email-status.pending { color: #875a10; background: #fff2d5; }
.email-detail-button { min-height: 32px; padding: 6px 10px; }
.email-detail-dialog { width: min(720px, calc(100vw - 24px)); }
.email-detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.email-detail-list div { min-width: 0; padding: 10px; background: #f5f8fa; border: 1px solid var(--line); border-radius: 9px; }
.email-detail-list dt { margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 800; }
.email-detail-list dd { margin: 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 700; }
.email-detail-body { margin-top: 12px; }
.email-detail-body > strong { display: block; margin-bottom: 6px; font-size: 11px; }
.email-detail-body pre { min-height: 130px; margin: 0; padding: 13px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 9px; background: white; font: 12px/1.55 inherit; }
.email-detail-error { padding: 10px; margin: 10px 0 0 !important; color: #a3342c; background: #fbe4e2; border-radius: 9px; font-size: 11px; font-weight: 700; }
.directory-search-bar { display: flex; align-items: end; gap: 12px; padding: 13px; margin-bottom: 14px; background: #eef7f4; border: 1px solid #cae4da; border-radius: 10px; }
.directory-search-bar .field { width: min(620px, 100%); }
.directory-search-bar input { background: white; }
.directory-search-bar small { min-width: 100px; padding-bottom: 12px; color: var(--green); font-size: 10px; font-weight: 800; }
.company-directory-list { display: flex; flex-direction: column; gap: 10px; max-height: 680px; padding-right: 4px; overflow-y: auto; }
.company-directory-row { display: grid; grid-template-columns: minmax(220px, 1.7fr) minmax(125px, .8fr) minmax(175px, 1.1fr) minmax(145px, .9fr) minmax(220px, 1.35fr) auto; gap: 10px; align-items: end; padding: 12px; background: #f7f9fa; border: 1px solid var(--line); border-radius: 10px; }
.company-directory-row.is-new { background: #eef8f4; border-color: #7bc5a6; box-shadow: 0 0 0 3px rgba(22,131,93,.08); }
.company-directory-row.is-dirty:not(.is-new) { border-color: #d8b26d; }
.company-row-actions { display: flex; align-items: center; }
.company-row-save { min-height: 44px; padding-inline: 13px; }
.company-row-message { grid-column: 1 / -1; min-height: 14px; margin-top: -5px; color: var(--green); font-size: 10px; font-weight: 800; }
.company-row-message.error { color: var(--red); }
.empty { padding: 42px; color: var(--muted); text-align: center; }
.empty strong, .empty span { display: block; }
.empty span { margin-top: 5px; font-size: 11px; }

@media (max-width: 980px) {
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding-block: 10px; }
  .header-nav { grid-column: 1 / -1; grid-row: 2; width: 100%; justify-content: flex-start; padding-bottom: 2px; overflow-x: auto; scrollbar-width: thin; }
  .account-area { justify-content: flex-end; }
  .customer-grid, .details-grid { grid-template-columns: repeat(2, 1fr); }
  .note-field { grid-column: 1 / -1; }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-search-group, .date-range-field { grid-column: span 2; }
  .filters > .field, .filters .filter-amount { grid-column: auto; }
  .filter-actions { grid-column: 1 / -1; }
  .company-directory-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .company-name-cell, .company-address-cell, .company-row-message { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .topbar { padding: 10px 16px; }
  .brand small { display: none; }
  .brand > span:last-child { display: none; }
  .header-nav { width: 100%; justify-content: flex-start; }
  .header-nav button, .header-nav a { min-height: 38px; padding-inline: 12px; }
  .account-area { gap: 6px; }
  .user-chip, .logout-button { width: 40px; height: 40px; }
  .shell { padding: 20px 14px 30px; }
  .panel { padding: 19px 14px; }
  .summary, .customer-grid, .company-fields, .details-grid, .filters { grid-template-columns: 1fr; }
  .filters > .field, .filter-search-group, .filters .filter-amount, .date-range-field, .filter-actions { grid-column: auto; }
  .filter-actions { display: grid; grid-template-columns: repeat(3, 1fr); }
  .filter-actions button { min-width: 0; padding-inline: 8px; }
  .pagination { align-items: stretch; flex-direction: column; }
  .records-totals { grid-template-columns: 1fr; }
  .pagination-pages { flex-wrap: wrap; }
  .pagination-size { align-self: flex-end; }
  .catalog-search-bar { align-items: stretch; flex-direction: column; }
  .catalog-search-bar small { padding-bottom: 0; }
  .directory-search-bar { align-items: stretch; flex-direction: column; }
  .directory-search-bar small { padding-bottom: 0; }
  .email-history-filters { grid-template-columns: 1fr; align-items: stretch; }
  .email-history-filters small { padding-bottom: 0; }
  .email-detail-list { grid-template-columns: 1fr; }
  .service-row, .catalog-row, .company-directory-row { grid-template-columns: 1fr; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
  .order-materials { grid-column: auto; }
  .order-material-row { grid-template-columns: 1fr; }
  .company-name-cell, .company-address-cell, .company-row-message { grid-column: auto; }
  .remove-service { width: 100%; height: 36px; }
  .services-footer, .form-actions { align-items: stretch; flex-direction: column; }
  .services-footer div { text-align: right; }
  #form-message { margin: 2px 0 0; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tbody tr { padding: 13px; border-bottom: 1px solid var(--line); }
  td { display: grid; grid-template-columns: 100px 1fr; gap: 8px; padding: 7px 0; border: 0; }
  td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; }
}

.order-history-entry { padding: 16px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.order-history-entry header { display: flex; flex-wrap: wrap; gap: 8px; }
.order-history-entry header span { color: var(--muted); }
.order-history-entry ul { list-style: none; padding: 0; margin: 12px 0 0; }
.order-history-entry li { margin-top: 12px; overflow-wrap: anywhere; }
.order-change-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 6px; }
.order-change-values span { white-space: pre-wrap; }
.order-change-values small { display: block; color: var(--muted); font-size: 14px; }
#order-history-dialog footer { flex-wrap: wrap; }

@media print {
  .topbar, .summary, #entry-panel, #admin-panel, #companies-panel, #email-history-panel, .filters, .pagination, .row-actions, th:last-child, td:last-child { display: none !important; }
  body, .shell { background: white; }
  .shell { max-width: none; padding: 0; }
  .panel { padding: 0; border: 0; box-shadow: none; }
  .table-wrap { border: 0; overflow: visible; }
}

.company-debt-alerts { margin-bottom: 18px; padding: 16px 18px; border: 1px solid #df5252; border-radius: 12px; background: #fff0f0; color: #982020; }
.company-debt-alerts[hidden], .operator-view .company-debt-alerts { display: none; }
.company-debt-alert-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.company-debt-alert-heading button { border: 0; background: transparent; color: #982020; font-size: 24px; cursor: pointer; }
.company-debt-alerts ul { padding: 0; margin: 10px 0 0; list-style: none; }
.company-debt-alerts li { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; }
.company-debt-alerts a { color: inherit; text-decoration: underline; }
.company-debt-alert-toggle { margin-top: 8px; padding: 8px 12px; border: 1px solid #df5252; border-radius: 8px; background: transparent; color: inherit; font-weight: 700; }
@media print { .company-debt-alerts { display: none !important; } }
