:root {
  --ink: #1c2c43;
  --muted: #586779;
  --line: #d5dce5;
  --bg: #edf0f4;
  --card: #fff;
  --navy: #24364f;
  --blue: #1769e8;
  --red: #b71d39;
  --shadow: none;
  --surface-soft: #f5f7fa;
  --control-border: #b9c5d5;
  --accent-soft: #e8f0ff;
  --accent-border: #abc6ef;
  --blue-hover: #1257c5;
  --panel-radius: 10px;
  --status-open: #3478dc;
  --status-draft: #ce931d;
  --status-submitted: #3b9671;
  --status-cancelled: #7b889a;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.topbar, .site-footer { flex-shrink: 0; }
main.shell { flex: 1 0 auto; }
.site-footer { width: 100%; padding: 14px 16px max(14px, env(safe-area-inset-bottom)); background: #000; color: #fff; text-align: center; font-size: 12px; line-height: 1.6; }
.site-footer p { margin: 0; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: #18324a15; }
button, .choice, .order-card { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
input, select, textarea { min-width: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.shell { width: min(1320px, calc(100% - 48px)); margin: 0 auto; }
.skip-link { position: absolute; left: 12px; top: -100px; z-index: 20; padding: 12px; background: #fff; }
.skip-link:focus { top: 12px; }
.topbar { background: var(--blue); color: #fff; box-shadow: none; }
.topbar-inner { min-height: 72px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; flex-shrink: 0; gap: 12px; color: #fff; text-decoration: none; line-height: 1.05; letter-spacing: .06em; min-height: 48px; }
.brand strong { font-size: 17px; }
.brand small { display: block; margin-top: 6px; color: #e0edff; font-size: 12px; letter-spacing: .15em; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; background: #fff; color: var(--blue); font-size: 28px; font-weight: 900; border-radius: 11px; }
.topbar nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-right: auto; }
.topbar nav a { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 9px 12px; border-radius: 8px; font-size: 14px; font-weight: 650; color: #fff; text-decoration: none; }
.topbar nav a.active { background: #fff; color: var(--navy); }
.account { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.account > span { max-width: 160px; overflow-wrap: anywhere; }
.account > a { max-width: 160px; overflow-wrap: anywhere; color: inherit; }
.account form { margin: 0; }
.link-button { min-height: 44px; padding: 9px 12px; border: 1px solid #ffffff99; background: transparent; color: #fff; border-radius: 8px; font-weight: 650; }
main.shell { padding: 24px 0 max(32px, env(safe-area-inset-bottom)); }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-heading > div { min-width: 0; }
.eyebrow { color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .15em; }
.page-heading h1, .login-card h1 { font-size: clamp(26px, 3vw, 34px); line-height: 1.15; letter-spacing: -.04em; margin: 6px 0 8px; overflow-wrap: anywhere; }
.page-heading p, .login-card p { color: var(--muted); margin: 0; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; border: 1px solid transparent; border-radius: 10px; font-size: 15px; font-weight: 750; text-decoration: none; }
.primary { color: #fff; background: var(--blue); }
.secondary { color: var(--navy); background: #fff; border-color: #bbcbd7; }
.refresh-link { flex-shrink: 0; }
.badge { display: inline-block; padding: 5px 12px; font-size: 12px; font-weight: 750; border-radius: 99px; white-space: nowrap; }
.badge.open { background: #e6eef7; color: #305376; }
.badge.draft { background: #fff0ce; color: #805000; }
.badge.submitted { background: #e0f3e9; color: #1a6040; }
.badge.cancelled { background: #fbe5e9; color: #9a243a; }
.alert { padding: 12px 16px; margin: 0 0 16px; border: 1px solid; border-radius: 10px; overflow-wrap: anywhere; }
.alert.success { background: #eaf7ef; border-color: #b6dbc5; color: #205b3b; }
.alert.error { background: #fff0f2; border-color: #e9b9c3; color: #96243a; }
.alert.info { background: #eaf3f9; border-color: #c4d9e8; color: #295774; }
.list-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 0 0 20px; }
.list-toolbar label { display: grid; gap: 7px; width: min(480px, 100%); font-size: 13px; font-weight: 700; }
.list-toolbar input { width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--control-border); border-radius: 10px; background: #fff; font-size: 16px; }
#order-count { color: var(--muted); font-size: 14px; padding-bottom: 14px; white-space: nowrap; }
.order-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.order-card { --order-stripe: var(--status-open); display: grid; grid-template-columns: minmax(105px, .7fr) minmax(0, 2.1fr) minmax(145px, 1.1fr) auto; align-items: center; gap: 16px; min-width: 0; padding: 15px 17px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--order-stripe); border-radius: var(--panel-radius); text-decoration: none; color: var(--ink); overflow-wrap: anywhere; }
.order-card[data-status="draft"] { --order-stripe: var(--status-draft); }
.order-card[data-status="submitted"] { --order-stripe: var(--status-submitted); }
.order-card[data-status="cancelled"] { --order-stripe: var(--status-cancelled); }
.order-card > span { min-width: 0; }
.order-card-number { color: var(--blue); font-size: 16px; font-weight: 750; letter-spacing: -.015em; }
.order-card-main { display: grid; gap: 3px; }
.order-card-main strong { font-size: 16px; font-weight: 650; }
.order-card-device, .order-card-context { font-size: 13px; color: var(--muted); }
.order-card-schedule { display: grid; gap: 4px; font-size: 13px; }
.order-card-schedule small { font-size: 12px; color: var(--muted); }
.order-card > .badge { justify-self: end; }
.empty { padding: 48px 24px; border: 1px dashed #b8c9d6; border-radius: 14px; text-align: center; background: #fff; color: var(--muted); }
.login-card { width: min(460px, 100%); margin: 5vh auto 0; padding: 36px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: 16px; box-shadow: var(--shadow); }
.login-card form, .user-card { display: grid; gap: 20px; }
.login-card form { margin-top: 28px; }
.login-card label, .user-card label { display: grid; gap: 7px; font-weight: 650; font-size: 14px; }
.login-card input, .user-card input, .user-card select, .field input, .field select, .field textarea { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--control-border); border-radius: 9px; background: #fff; color: var(--ink); font-size: 16px; line-height: 1.4; }
.login-card input:focus, .user-card input:focus, .user-card select:focus, .field input:focus, .field select:focus, .field textarea:focus, .list-toolbar input:focus, .section-jump select:focus { border-color: var(--blue); outline: 3px solid #1769e826; outline-offset: 0; }
.back { display: inline-flex; align-items: center; min-height: 48px; margin-bottom: 8px; font-size: 14px; font-weight: 650; text-decoration: none; }
.order-heading { align-items: end; }
.order-heading h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.save-state { flex-shrink: 0; max-width: 350px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #fff; font-size: 13px; overflow-wrap: anywhere; }
.save-state.error, #save-state-copy.error { color: #96243a; }
.save-state.error { background: #fff0f2; border-color: #e9b9c3; }
.save-state.saving, #save-state-copy.saving { color: var(--blue); }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--line); }
.summary-grid > div { min-width: 0; background: #fff; padding: 11px 16px; }
.summary-grid small { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.summary-grid strong { font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.form-layout { display: grid; grid-template-columns: 212px minmax(0, 1fr); align-items: start; gap: 18px; }
.form-content { min-width: 0; }
.section-nav { position: sticky; top: 18px; display: grid; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.section-nav strong { padding: 10px 12px; font-size: 13px; }
.section-nav a { display: flex; align-items: center; min-height: 44px; padding: 8px 10px; font-size: 13px; color: var(--muted); text-decoration: none; border-radius: 7px; }
.section-nav a.active { background: #eaf1f6; color: var(--navy); font-weight: 700; }
.section-jump { display: none; }
.form-section { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.section-title { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #e4ebf0; }
.section-title > span { display: grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0; background: var(--accent-soft); color: var(--blue); font-weight: 800; font-size: 12px; border-radius: 8px; }
.section-title h2 { margin: 0; font-size: 18px; font-weight: 750; line-height: 1.3; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; align-items: end; }
.field { display: grid; gap: 6px; min-width: 0; font-size: 14px; font-weight: 650; }
.field.full { grid-column: 1 / -1; }
.field > span, .choice-field legend { color: #384f64; overflow-wrap: anywhere; }
.field textarea { resize: vertical; min-height: 76px; }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: var(--surface-soft); color: #536a7b; opacity: 1; }
.choice-field { display: block; margin: 0; padding: 0; border: 0; min-inline-size: 0; }
.choice-field legend { padding: 0; margin-bottom: 6px; }
.choice-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.choice-options.options-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice { position: relative; min-width: 0; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; padding: 0; }
.choice span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 6px; text-align: center; font-size: 13px; font-weight: 650; line-height: 1.3; border: 1px solid var(--control-border); border-radius: 8px; background: #fff; color: #4a6073; cursor: pointer; }
.choice input:checked + span { border-color: var(--navy); background: var(--navy); color: #fff; box-shadow: inset 0 0 0 1px var(--navy); }
.choice input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
.choice-field:disabled .choice span { cursor: default; background: var(--surface-soft); }
.choice-field:disabled input:checked + span { background: #496073; color: #fff; }
.form-actions { position: sticky; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; border: 1px solid #a9bdd4; border-radius: 12px; background: #fff; box-shadow: 0 4px 25px #18324a20; }
.action-status { min-width: 0; }
.action-status strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.action-status small { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.action-buttons { display: flex; flex-shrink: 0; gap: 10px; }
.keyboard-open .form-actions { position: static; }
.user-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 32px; }
.user-card { min-width: 0; background: #fff; padding: 24px; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.user-card h2 { font-size: 20px; margin: 0; overflow-wrap: anywhere; }
.user-card .check { display: flex; align-items: center; min-height: 48px; }
.user-card .check input { width: 24px; height: 24px; min-height: 24px; accent-color: var(--navy); }
.runs { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.runs > div { display: grid; gap: 5px; padding: 16px 20px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.runs > div:last-child { border: 0; }
.runs span { color: var(--muted); font-size: 14px; }
.error-text { color: #96243a; }
.appliance-history { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.appliance-history summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; padding: 10px 16px; cursor: pointer; list-style: none; }
.appliance-history summary::-webkit-details-marker { display: none; }
.appliance-history summary strong { display: block; font-size: 17px; }
.appliance-history summary small { display: block; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.history-arrow { font-size: 24px; line-height: 1; flex-shrink: 0; }
.appliance-history details[open] .history-arrow { transform: rotate(180deg); }
.history-content { padding: 0 20px 20px; }
.history-help, .history-empty { margin: 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.history-list { display: grid; gap: 12px; list-style: none; padding: 0; margin: 16px 0 0; }
.history-entry { display: block; padding: 18px; background: var(--surface-soft); border: 1px solid var(--line); border-left: 3px solid #607e95; border-radius: 10px; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.history-entry-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-entry-top strong { font-size: 17px; }
.history-entry-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.history-serial { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.history-open { display: inline-flex; align-items: center; min-height: 48px; font-size: 14px; font-weight: 700; color: var(--blue); }
@media (max-width: 699px) {
  .appliance-history summary { padding: 16px; }
  .history-content { padding: 0 16px 16px; }
  .history-entry { padding: 14px; }
  .history-entry-top { align-items: start; flex-wrap: wrap; }
  .history-entry-meta { display: grid; gap: 5px; }
}
@media (hover: hover) {
  .history-entry:hover { border-color: #8aa9be; background: var(--surface-soft); }
  .topbar nav a:hover:not(.active) { background: #ffffff12; color: #fff; }
  .primary:hover { background: var(--blue-hover); }
  .secondary:hover { background: var(--surface-soft); }
  .order-card:hover { border-color: #a4b5ca; border-left-color: var(--order-stripe); background: #f8fbff; }
  .section-nav a:hover { background: var(--surface-soft); color: var(--navy); }
}
@media (max-width: 1179px) {
  .editor-focus .form-actions { position: static; }
  .topbar-inner { flex-wrap: wrap; gap: 8px 20px; padding: 10px 0 8px; }
  .account { margin-left: auto; }
  .topbar nav { order: 3; width: 100%; gap: 8px; }
  .topbar nav a { flex: 1; }
  .user-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-layout { grid-template-columns: minmax(0, 1fr); }
  .section-nav { display: none; }
  .section-jump:not([hidden]) { position: sticky; top: 8px; z-index: 4; display: flex; align-items: center; gap: 16px; padding: 10px 14px; margin-bottom: 18px; background: #fff; border: 1px solid #c4d2dd; border-radius: 10px; box-shadow: var(--shadow); }
  .section-jump label { font-size: 13px; font-weight: 700; white-space: nowrap; }
  .section-jump select { width: 100%; min-height: 48px; padding: 10px 12px; background: var(--surface-soft); border: 1px solid #c4d2dd; border-radius: 8px; color: var(--navy); font-size: 16px; }
}
@media (min-width: 700px) and (max-width: 1179px) {
  .role-technician .topbar-inner { flex-wrap: nowrap; min-height: 72px; gap: 20px; padding: 8px 0; }
  .role-technician .topbar nav { order: initial; width: auto; flex: 1; gap: 4px; }
  .role-technician .topbar nav a { padding: 10px 8px; }
}
@media (min-width: 700px) and (max-width: 899px) {
  .role-technician .account > span { display: none; }
}
@media (max-width: 699px) {
  .shell { width: calc(100% - 32px); }
  main.shell { padding-top: 18px; }
  .topbar-inner { gap: 12px; }
  .brand { gap: 9px; }
  .brand strong { font-size: 14px; }
  .brand-mark { width: 36px; height: 36px; font-size: 25px; }
  .account > span { display: none; }
  .topbar nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .topbar nav a { padding: 10px 8px; }
  .page-heading { align-items: start; flex-wrap: wrap; gap: 16px; }
  .refresh-link { min-height: 48px; padding: 10px 14px; }
  .user-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  
  .list-toolbar { gap: 12px; }
  .list-toolbar label { flex: 1; }
  #order-count { font-size: 12px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-grid > div { padding: 10px 12px; }
  .summary-grid strong { font-size: 14px; }
  .order-summary > div:nth-child(3), .order-summary > div:nth-child(4) { grid-column: 1 / -1; }
  .summary-grid small { font-size: 11px; }
  .order-heading .save-state { width: 100%; max-width: none; }
  .field-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .form-section { padding: 16px; }
  .section-title { margin-bottom: 16px; }
  .section-title h2 { font-size: 18px; }
  .section-jump label { display: none; }
  .section-jump:not([hidden]) { padding: 8px; }
  .choice span { font-size: 14px; }
  .form-actions { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px; bottom: max(8px, env(safe-area-inset-bottom)); }
  .action-status small { display: none; }
  .action-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .action-buttons button { padding: 12px 8px; font-size: 14px; }
  .login-card { padding: 28px 24px; margin-top: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
.photo-section { scroll-margin-top: 120px; }
.photo-tools { display: grid; grid-template-columns: 1fr 1.5fr; gap: 16px; }
.photo-tools label, #signature-form > label, .signature-card label { display: grid; gap: 7px; }
.photo-tools input:not([type=file]), .photo-tools select, #signature-form input:not([type=checkbox]), #signature-form select { width: 100%; min-height: 50px; padding: 12px; border: 1px solid var(--control-border); border-radius: 9px; background: white; }
.photo-buttons, .download-buttons { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.photo-buttons { grid-column: 1 / -1; }
.photo-help, .signature-card p { color: var(--muted); font-size: .9rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.photo-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: white; min-width: 0; }
.photo-card img { width: 100%; height: 180px; display: block; object-fit: cover; }
.photo-card > div { padding: 12px; }
.photo-card p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; }
.photo-card button { width: 100%; }
.completion-card { padding: 24px; margin: 20px 0; background: #edf6f1; border: 1px solid #c6dfd0; border-radius: 14px; }
.review-report { max-width: 1000px; margin: auto; }
.review-fields { margin: 0; }
.review-fields > div { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.review-fields dt { color: var(--muted); }
.review-fields dd { margin: 0; white-space: normal; overflow-wrap: anywhere; font-weight: 600; }
.signature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 24px 0; }
.signature-card { min-width: 0; }
.signature-canvas { width: 100%; height: 180px; display: block; border: 2px solid #8195a6; border-radius: 12px; background: #fff; touch-action: none; margin: 12px 0; }
.review-check { display: flex !important; flex-direction: row; align-items: flex-start; gap: 12px !important; padding: 18px 12px; background: var(--surface-soft); border-radius: 10px; }
.review-check input { width: 24px; height: 24px; min-width: 24px; margin: 0; }
@media (max-width: 650px) {
  .photo-tools, .signature-grid { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .photo-card img { height: 130px; }
  .photo-card > div { padding: 9px; }
  .photo-card button { font-size: .85rem; padding: 10px 5px; }
  .photo-buttons > *, .download-buttons > * { flex: 1 1 100%; text-align: center; }
  .review-fields > div { grid-template-columns: 1fr; gap: 5px; }
  .completion-card { padding: 16px; }
}
.database-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.database-tabs a { gap: 5px; }
.database-tabs a.selected { background: #18324a; color: #fff; border-color: #18324a; }
.database-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; margin: 20px 0; }
.database-filters label { flex: 1; min-width: 170px; display: grid; gap: 7px; }
.database-filters input, .database-filters select, #restore-form input[type=password] { width: 100%; min-height: 50px; border: 1px solid var(--control-border); border-radius: 9px; padding: 12px; background: white; }
.database-scroll { max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.database-table { border-collapse: collapse; font-size: 13px; width: max-content; min-width: 100%; }
.database-table th, .database-table td { padding: 12px; border-bottom: 1px solid var(--line); border-right: 1px solid #e5ebf0; vertical-align: top; min-width: 100px; max-width: 350px; overflow-wrap: anywhere; }
.database-table th { background: var(--surface-soft); text-align: left; white-space: nowrap; }
.database-table tr:last-child td { border-bottom: 0; }
.database-json summary { cursor: pointer; min-width: 180px; padding: 6px; }
.database-json pre { font-size: 12px; white-space: pre-wrap; max-height: 400px; overflow: auto; min-width: 300px; max-width: 350px; }
.backup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.backup-grid > section { min-width: 0; }
.backup-list > div { display: grid; gap: 4px; margin: 12px 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.backup-list span { font-size: 13px; color: var(--muted); }
#restore-form > label { display: grid; gap: 8px; margin: 16px 0; }
#restore-file { display: block; width: 100%; padding: 14px 0; }
#restore-progress { width: 100%; height: 22px; }
#restore-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px; background: var(--surface-soft); border-radius: 10px; }
#restore-counts dd { margin: 0; font-weight: 700; }
@media (max-width: 850px) { .backup-grid { grid-template-columns: 1fr; gap: 0; } }
.mail-settings-form .fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.mail-settings-form label, .mail-send-form label { display: grid; gap: 8px; margin: 16px 0; }
.mail-settings-form .fields label { margin: 0; }
.mail-settings-form input:not([type=checkbox]), .mail-settings-form select, .mail-settings-form textarea,
.mail-send-form input:not([type=checkbox]), .mail-send-form textarea { width: 100%; min-height: 50px; padding: 12px; border: 1px solid var(--control-border); border-radius: 9px; background: white; }
.mail-settings-form textarea, .mail-send-form textarea { min-height: 100px; resize: vertical; }
@media (max-width: 650px) { .mail-settings-form .fields { grid-template-columns: 1fr; } }
.login-card .remember-choice { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; }
.login-card .remember-choice input { width: 24px; height: 24px; min-height: 24px; padding: 0; flex: 0 0 24px; accent-color: var(--navy); }
.login-card .remember-help { font-size: 13px; line-height: 1.5; margin-top: -12px; }
.revoke-devices { font-size: 13px; }
@media (max-width: 650px) { .account > a { max-width: 110px; font-size: 12px; } }

/* Compact report panels keep touch targets generous while reducing travel. */
.section-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-tools > span { color: var(--muted); font-size: 13px; }
.section-tools .secondary { flex-shrink: 0; font-size: 13px; padding: 8px 12px; }
.report-section { padding: 0; scroll-margin-top: 84px; }
.report-section > .section-title { list-style: none; margin: 0; padding: 13px 16px; min-height: 60px; border: 0; border-radius: 13px; cursor: pointer; }
.report-section > .section-title::-webkit-details-marker { display: none; }
.report-section > .section-title > .section-number { width: 30px; height: 30px; border-radius: 8px; }
.report-section > .section-title > .section-chevron { width: 10px; height: 10px; margin: 0 4px 4px auto; border: solid #526e91; border-width: 0 2px 2px 0; border-radius: 0; transform: rotate(45deg); background: transparent; }
.report-section[open] { border-color: #85ace1; }
.report-section[open] > .section-title { background: #f0f6ff; border-bottom: 1px solid #d0dff1; border-radius: 13px 13px 0 0; }
.report-section[open] > .section-title > .section-chevron { transform: rotate(225deg); margin-bottom: -4px; }
.section-body { padding: 18px; }
.section-footer { display: flex; justify-content: flex-end; margin-top: 16px; padding-top: 12px; border-top: 1px solid #e0e7ef; }
.section-footer .secondary { font-size: 13px; }
.form-section > h2, .completion-card > h2 { margin: 0 0 12px; font-size: 20px; line-height: 1.3; }
.form-section > p { margin: 8px 0 14px; }
.photo-section { scroll-margin-top: 84px; }
.photo-card img { height: 150px; }
.user-card { gap: 14px; padding: 18px; }
.login-card form { gap: 16px; }
.login-card .remember-choice { margin-top: 4px; }
.login-card .remember-help { margin-top: -4px; }
.database-tabs a.selected { background: var(--blue); border-color: var(--blue); }
.topbar nav a.active { color: #074ba5; box-shadow: 0 1px 4px #003d8e26; }
@media (hover: hover) {
  .report-section > .section-title:hover { background: #eaf2ff; }
  .topbar nav a:hover:not(.active) { background: #ffffff26; }
}
@media (max-width: 1179px) {
  .section-jump:not([hidden]) { top: 6px; gap: 10px; padding: 6px 10px; margin-bottom: 10px; border-color: #a9bdd4; }
  .section-jump select { min-height: 44px; padding: 8px 10px; }
}
@media (max-width: 699px) {
  .shell { width: calc(100% - 24px); }
  .topbar nav { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 4px; padding-bottom: 3px; }
  .topbar nav a { flex: 0 0 auto; min-height: 44px; padding: 8px 12px; white-space: nowrap; }
  .topbar-inner { gap: 8px 12px; }
  .brand small { font-size: 10px; margin-top: 4px; }
  .brand { min-height: 44px; }
  .account { gap: 8px; }
  .account > a { max-width: 86px; }
  .page-heading { gap: 10px; margin-bottom: 14px; }
  .page-heading h1 { font-size: 28px; }
  .page-heading p { font-size: 14px; }
  .order-heading .save-state { width: auto; padding: 7px 10px; }
  .summary-grid strong { font-size: 13px; }
  .order-summary > div:nth-child(3), .order-summary > div:nth-child(4) { grid-column: auto; }
  .section-tools > span { font-size: 12px; }
  .section-tools { gap: 8px; }
  .report-section > .section-title { padding: 12px; gap: 10px; }
  .report-section > .section-title h2 { font-size: 16px; }
  .section-body { padding: 14px 12px; }
  .choice span { font-size: 13px; }
  .photo-card img { height: 120px; }
  .photo-buttons > *, .download-buttons > * { flex-basis: auto; }
  .photo-buttons { gap: 8px; }
  .photo-buttons > * { flex: 1 1 130px; padding: 10px 8px; }
  .form-actions { gap: 8px; padding: 10px; }
  .action-buttons button { min-height: 44px; padding: 10px 6px; }
}
.table-catalog > summary, .table-fields > summary { cursor: pointer; min-height: 44px; padding: 10px 0; font-weight: 700; }
.catalog-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.catalog-table th, .catalog-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.catalog-table thead { background: #edf3fc; }
.catalog-table .secondary { font-size: 13px; white-space: nowrap; }
.table-name { font-size: 13px; font-weight: 500; color: var(--muted); }
.table-fields ul { columns: 2; padding-left: 20px; font-size: 13px; overflow-wrap: anywhere; }
.record-open { display: flex; align-items: center; min-height: 44px; white-space: nowrap; }
.record-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.record-table th, .record-table td { padding: 8px 10px; vertical-align: top; border-bottom: 1px solid var(--line); text-align: left; overflow-wrap: anywhere; }
.record-table th { width: 42%; font-size: 14px; font-weight: 650; }
.record-table th small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 3px; }
.record-table input, .record-table select, .record-table textarea { width: 100%; min-height: 44px; padding: 9px 12px; background: white; color: var(--ink); border: 1px solid var(--control-border); border-radius: 8px; font-size: 16px; }
.record-table textarea { resize: vertical; min-height: 70px; }
.record-readonly { white-space: pre-wrap; padding: 9px 0; font-size: 14px; }
.record-change { padding: 12px 0; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-wrap: anywhere; }
.record-change p { margin: 5px 0; }
#record-form .form-section { max-width: 1050px; }
@media (max-width: 699px) {
  .table-fields ul { columns: 1; }
  .record-table th, .record-table td { display: block; width: 100%; padding: 6px 0; }
  .record-table th { border-bottom: 0; padding-top: 12px; }
  .record-table td { padding-bottom: 12px; }
}
.visually-hidden { position: absolute; left: 0; top: 0; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.user-list-panel { padding: 0; overflow: hidden; }
.users-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; padding: 18px; background: var(--surface-soft); border-bottom: 1px solid var(--line); }
.users-filters label { display: grid; gap: 6px; font-size: 13px; font-weight: 650; flex: 1; min-width: 150px; }
.users-filters label:first-of-type { flex: 2; min-width: 240px; }
.users-filters input, .users-filters select { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--control-border); border-radius: 8px; background: #fff; color: var(--ink); font-size: 16px; }
.users-clear { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; }
.users-scroll { border: 0; border-radius: 0; }
.users-table { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 14px; }
.users-table th, .users-table td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.users-table th { font-size: 12px; font-weight: 700; background: var(--surface-soft); white-space: nowrap; }
.users-table th a { display: inline-flex; align-items: center; min-height: 44px; color: #435f80; text-decoration: none; }
.users-table tbody tr:last-child td { border-bottom: 0; }
.users-table td { overflow-wrap: anywhere; max-width: 320px; }
.user-name { display: flex; align-items: center; gap: 12px; min-width: 170px; }
.user-name strong { display: block; line-height: 1.35; }
.user-name small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.user-avatar { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: #164f9b; font-size: 12px; font-weight: 750; }
.user-role { display: inline-block; padding: 4px 9px; border-radius: 6px; font-size: 12px; color: #43546b; background: #edf1f6; white-space: nowrap; }
.user-role.role-admin { background: var(--accent-soft); color: #124c98; }
.user-status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; white-space: nowrap; color: #5b6778; }
.user-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #8291a4; }
.user-status.is-active { color: #1e6344; }
.user-status.is-active::before { background: #238454; }
.user-edit-link { min-height: 44px; padding: 8px 14px; font-size: 13px; white-space: nowrap; }
.users-table td:last-child { text-align: right; }
.users-empty { padding: 32px 18px !important; text-align: center !important; color: var(--muted); }
.users-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.users-pagination nav { display: flex; gap: 8px; }
.users-pagination a { padding: 8px 12px; font-size: 13px; }
.users-imports > summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-size: 14px; font-weight: 650; }
.users-imports .runs { margin-top: 10px; }
.user-dialog { width: min(660px,calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid #bacce2; border-radius: 16px; background: #fff; color: var(--ink); box-shadow: 0 24px 80px #0b2b5460; overflow-y: auto; overscroll-behavior: contain; }
.user-dialog::backdrop { background: #0b244a80; }
.user-modal-open { overflow: hidden; }
.user-editor-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.user-editor-heading h2 { margin: 6px 0 8px; font-size: 25px; letter-spacing: -.025em; }
.user-editor-heading p { font-size: 13px; color: var(--muted); margin: 0; }
.user-dialog-close { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border: 1px solid #c6d2e0; border-radius: 9px; background: #fff; color: #435f80; font-size: 26px; }
.user-editor-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; padding: 22px 24px 8px; }
.user-editor-fields > label { display: grid; align-content: start; gap: 6px; min-width: 0; font-size: 14px; font-weight: 650; }
.user-editor-fields input:not([type=checkbox]), .user-editor-fields select { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--control-border); border-radius: 8px; background: #fff; color: var(--ink); font-size: 16px; }
.user-editor-fields input:disabled, .user-editor-fields select:disabled { color: #4d6079; background: #eef2f7; opacity: 1; }
.user-editor-fields small { font-size: 12px; font-weight: 400; line-height: 1.5; color: var(--muted); }
.user-editor-fields .user-active-choice { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.user-active-choice input { flex-shrink: 0; width: 24px; height: 24px; margin: 0; accent-color: var(--blue); }
.user-active-choice small { display: block; }
.user-self-help { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--muted); }
.user-editor-message { padding: 0 24px; font-size: 13px; overflow-wrap: anywhere; }
.user-editor-message:empty { display: none; }
.user-editor-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 24px; margin-top: 12px; border-top: 1px solid var(--line); background: #fff; }
.user-revoke-form { padding: 0 24px 18px; }
.user-revoke-form summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 13px; text-decoration: underline; cursor: pointer; }
.user-revoke-form p { font-size: 13px; color: var(--muted); margin: 4px 0 10px; }
.user-editor-page { max-width: 660px; margin: 0 auto; padding: 0; overflow: hidden; }
@media (hover: hover) {
  .users-table tbody tr:hover { background: var(--surface-soft); }
  .user-dialog-close:hover { background: #eaf2ff; }
}
@media (max-width: 699px) {
  .users-filters { padding: 12px; gap: 10px; }
  .users-filters label:first-of-type { flex-basis: 100%; min-width: 0; }
  .users-filters label { min-width: 120px; }
  .users-pagination { padding: 10px 12px; flex-wrap: wrap; }
  .users-table th, .users-table td { padding-left: 12px; padding-right: 12px; }
  .user-dialog { width: calc(100% - 24px); max-height: calc(100dvh - 24px); border-radius: 12px; }
  .user-editor-heading { padding: 16px; gap: 8px; }
  .user-editor-heading h2 { font-size: 22px; }
  .user-editor-fields { grid-template-columns: 1fr; padding: 16px 16px 6px; gap: 14px; }
  .user-editor-message { padding: 0 16px; }
  .user-editor-footer { padding: 14px 16px; gap: 8px; }
  .user-editor-footer > * { flex: 1; padding-left: 8px; padding-right: 8px; }
  .user-revoke-form { padding: 0 16px 16px; }
}

/* Shared Blue & Graphite theme: all HTML pages use the same surfaces,
   controls and type colors; semantic feedback retains its status color. */
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; padding: 5px 9px; }
.badge::before { content: ''; width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: currentColor; }
.badge.open { background: #e8f0ff; color: #1754ad; }
.badge.draft { background: #fff0d6; color: #835000; }
.badge.submitted { background: #e5f3ec; color: #206548; }
.badge.cancelled { background: #edf0f3; color: #586475; }
.alert.info { background: var(--accent-soft); border-color: var(--accent-border); color: #1754ad; }
.alert.success { background: #e5f3ec; border-color: #badbc8; color: #206548; }
.form-section, .login-card, .section-nav, .appliance-history, .photo-card, .runs, .save-state, .user-editor-page { background: var(--card); border-color: var(--line); box-shadow: none; }
.form-section, .login-card, .summary-grid, .section-nav, .appliance-history, .photo-card, .runs, .user-editor-page { border-radius: var(--panel-radius); }
.login-card { border-top-color: var(--blue); }
.summary-grid { border-color: var(--line); background: var(--line); }
.summary-grid > div { background: var(--card); }
.completion-card { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--status-submitted); border-radius: var(--panel-radius); }
.secondary { border-color: var(--control-border); background: var(--card); color: var(--ink); }
input:not(:where([type=hidden], [type=radio], [type=checkbox], [type=file], [type=range])), select, textarea { background-color: var(--card); border-color: var(--control-border); border-radius: 8px; color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.field > span, .choice-field legend { color: var(--ink); }
.field input:disabled, .field select:disabled, .field textarea:disabled, .user-editor-fields input:disabled, .user-editor-fields select:disabled { background: var(--surface-soft); color: var(--muted); }
.choice span { border-color: var(--control-border); background: var(--card); color: var(--muted); }
.choice input:checked + span { background: var(--navy); border-color: var(--navy); }
.choice-field:disabled .choice span { background: var(--surface-soft); }
.choice-field:disabled input:checked + span { background: var(--navy); }
.login-card input:focus, .field input:focus, .field select:focus, .field textarea:focus, .list-toolbar input:focus, .section-jump select:focus { border-color: var(--blue); outline-color: #1769e826; }
.section-nav a.active, .section-title > .section-number, .user-avatar, .user-role.role-admin { background: var(--accent-soft); color: #1754ad; }
.section-jump select, .review-check, #restore-counts, .users-filters, .user-editor-heading, .database-table th, .catalog-table thead, .users-table th { background: var(--surface-soft); }
.report-section[open] { border-color: var(--accent-border); }
.report-section > .section-title { border-radius: 9px; }
.report-section[open] > .section-title { background: var(--surface-soft); border-bottom-color: var(--line); border-radius: 9px 9px 0 0; }
.section-title, .section-footer, .review-fields > div, .record-table th, .record-table td, .database-table td, .database-table th, .users-table td, .users-table th, .user-editor-heading, .user-editor-footer { border-color: var(--line); }
.review-fields dt, .photo-help, .signature-card p, .backup-list span, .user-name small, .user-editor-fields small, .user-self-help, .users-pagination { color: var(--muted); }
.history-entry { background: var(--card); border-color: var(--line); border-left-color: var(--status-submitted); }
.history-entry-meta, .history-serial { color: var(--muted); }
.form-actions { background: var(--card); border-color: var(--control-border); box-shadow: 0 5px 20px #1c2c431a; }
.user-dialog { background: var(--card); border-color: var(--line); border-radius: 12px; box-shadow: 0 24px 80px #1c2c4360; }
.user-dialog::backdrop { background: #1c2c4380; }
.user-role { background: var(--surface-soft); color: var(--muted); }
.user-status { color: var(--muted); }
.user-status::before { background: var(--status-cancelled); }
.user-status.is-active { color: #206548; }
.user-status.is-active::before { background: var(--status-submitted); }
.user-editor-footer, .user-dialog-close { background: var(--card); border-color: var(--line); }
.signature-canvas { background: var(--card); border-color: var(--control-border); border-radius: var(--panel-radius); }
.database-scroll { border-color: var(--line); }
.topbar nav a.active { color: #1754ad; box-shadow: none; }
.user-active-choice input, .login-card .remember-choice input, .review-check input { accent-color: var(--blue); }
@media (hover: hover) {
  .secondary:hover, .history-entry:hover, .section-nav a:hover, .report-section > .section-title:hover, .users-table tbody tr:hover, .user-dialog-close:hover { background: var(--surface-soft); }
}
@media (max-width: 699px) {
  .order-card { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 13px; }
  .order-card-number { grid-column: 1; grid-row: 1; }
  .order-card > .badge { grid-column: 2; grid-row: 1; }
  .order-card-main { grid-column: 1 / -1; grid-row: 2; }
  .order-card-schedule { grid-column: 1 / -1; grid-row: 3; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
  .order-card-main strong { font-size: 15px; }
}
