:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-dark: #101828;
  --text: #101828;
  --text-secondary: #475467;
  --text-muted: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --primary: #f5b51b;
  --primary-hover: #dda00b;
  --primary-soft: #fff8e5;
  --blue: #175cd3;
  --blue-soft: #eff8ff;
  --green: #067647;
  --green-soft: #ecfdf3;
  --red: #b42318;
  --red-soft: #fef3f2;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, .24);
  --radius: 14px;
  --radius-lg: 20px;
}

@font-face {
  font-family: "ProtocolArial";
  src: url("../assets/fonts/LiberationSans-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "ProtocolArial";
  src: url("../assets/fonts/LiberationSans-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.noscript { padding: 14px; color: #fff; background: var(--red); text-align: center; font-weight: 700; }
:focus-visible { outline: 3px solid rgba(23, 92, 211, .3); outline-offset: 2px; }

.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.brand-mark, .loader-mark { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #101828; background: var(--primary); font-size: 12px; font-weight: 800; box-shadow: 0 6px 14px rgba(245, 181, 27, .22); }
.brand-light { color: #fff; }
.eyebrow { margin: 0 0 7px; color: #8a5d00; font-size: 12px; line-height: 1.2; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.muted { color: var(--text-muted); }

.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 14px; background: var(--surface); }
.center-screen strong { display: block; font-size: 17px; }
.center-screen p { margin: 2px 0 0; color: var(--text-muted); font-size: 13px; }
.loader-mark { animation: loaderPulse 1.3s ease-in-out infinite; }
@keyframes loaderPulse { 50% { transform: scale(.94); opacity: .7; } }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 1.05fr) minmax(430px, .95fr); }
.auth-intro { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 42px clamp(36px, 6vw, 90px) 70px; color: #fff; background: radial-gradient(circle at 80% 14%, rgba(245, 181, 27, .2), transparent 28%), radial-gradient(circle at 10% 85%, rgba(47, 128, 237, .18), transparent 30%), var(--surface-dark); }
.auth-intro::after { content: ""; position: absolute; right: -110px; bottom: -160px; width: 420px; height: 420px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.018); }
.auth-copy { position: relative; z-index: 1; max-width: 640px; margin: 120px 0 auto; }
.auth-copy .eyebrow { color: #f7cd69; }
.auth-copy h1 { max-width: 620px; margin: 0 0 24px; font-size: clamp(36px, 4vw, 62px); line-height: 1.05; letter-spacing: -.055em; }
.auth-copy > p:not(.eyebrow) { max-width: 580px; color: #d0d5dd; font-size: 17px; }
.feature-list { display: grid; gap: 13px; margin: 34px 0 0; padding: 0; list-style: none; color: #eaecf0; }
.feature-list li { display: flex; align-items: center; gap: 11px; }
.feature-list span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #101828; background: var(--primary); font-weight: 800; }
.auth-panel { display: grid; place-items: center; padding: 40px; background: var(--surface-soft); }
.auth-card { width: min(100%, 440px); padding: clamp(28px, 5vw, 48px); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 16px 42px rgba(16, 24, 40, .08); }
.auth-card h2 { margin: 0; font-size: 31px; letter-spacing: -.04em; }
.auth-card > .muted { margin: 7px 0 28px; }
.mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 38px; font-weight: 800; }
.auth-help { margin: 22px 0 0; color: var(--text-muted); font-size: 12px; text-align: center; }

.field { min-width: 0; }
.field + .field { margin-top: 18px; }
.field label { display: block; margin: 0 0 7px; color: #344054; font-size: 13px; font-weight: 700; }
.field label span { color: var(--text-muted); font-weight: 500; }
.field label strong { color: var(--red); }
.field input, .field select, .field textarea, .select-field select, .country-control select { width: 100%; min-height: 46px; padding: 10px 13px; color: var(--text); background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; outline: none; transition: border-color .16s, box-shadow .16s; }
.field input:hover, .field select:hover, .field textarea:hover, .select-field select:hover, .country-control select:hover { border-color: #98a2b3; }
.field input:focus, .field select:focus, .field textarea:focus, .select-field select:focus, .country-control select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23, 92, 211, .12); }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 3px rgba(180, 35, 24, .08); }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.label-row label { margin: 0; }
.text-button { padding: 2px; color: var(--blue); background: none; border: 0; font-size: 12px; font-weight: 700; }
.field-error { display: block; min-height: 16px; margin-top: 4px; color: var(--red); font-size: 11px; }

.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border: 1px solid transparent; border-radius: 10px; font-size: 13px; font-weight: 750; line-height: 1.2; transition: transform .12s, background .16s, border-color .16s, box-shadow .16s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .65; }
.button-primary { color: #101828; background: var(--primary); border-color: var(--primary); box-shadow: 0 5px 12px rgba(245, 181, 27, .2); }
.button-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.button-secondary { color: #344054; background: #fff; border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.button-secondary:hover:not(:disabled), .button-ghost:hover:not(:disabled) { background: #f9fafb; border-color: #98a2b3; }
.button-ghost { color: #475467; background: transparent; border-color: transparent; }
.button-danger { color: #fff; background: var(--red); border-color: var(--red); }
.button-danger-ghost { color: var(--red); background: transparent; border-color: transparent; }
.button-danger-ghost:hover { background: var(--red-soft); }
.button-block { width: 100%; margin-top: 24px; }
.button-compact { min-height: 40px; padding: 8px 13px; }
.button-spinner { display: none; width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.is-busy .button-spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.form-message { margin: 14px 0; padding: 11px 13px; color: var(--red); background: var(--red-soft); border: 1px solid #fecdca; border-radius: 9px; font-size: 13px; }
.form-message.success { color: var(--green); background: var(--green-soft); border-color: #abefc6; }

.app-header { position: sticky; top: 0; z-index: 30; display: flex; min-height: 70px; align-items: center; justify-content: space-between; gap: 24px; padding: 12px clamp(18px, 4vw, 54px); color: #fff; background: rgba(16, 24, 40, .97); border-bottom: 1px solid rgba(255,255,255,.08); backdrop-filter: blur(10px); }
.header-context { display: flex; align-items: center; gap: 16px; }
.country-control { display: flex; align-items: center; gap: 8px; }
.country-control > span { color: #98a2b3; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.country-control select { min-height: 38px; min-width: 130px; padding: 7px 34px 7px 10px; color: #fff; background-color: #1d2939; border-color: #344054; font-size: 13px; }
.account-block { display: flex; flex-direction: column; align-items: flex-end; min-width: 150px; }
.account-email { max-width: 240px; overflow: hidden; color: #d0d5dd; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sync-state { display: flex; align-items: center; gap: 6px; color: #d0d5dd; font-size: 11px; font-weight: 650; }
.sync-state i { width: 7px; height: 7px; border-radius: 50%; background: #17b26a; }
.sync-state.syncing i { background: var(--primary); animation: loaderPulse 1s infinite; }
.sync-state.error i { background: #f04438; }
.app-header .button-ghost { color: #eaecf0; }

.page-main { width: min(1500px, 100%); margin: 0 auto; padding: 42px clamp(18px, 4vw, 54px) 60px; }
.page-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 28px; }
.page-hero h1 { margin: 0; font-size: clamp(30px, 4vw, 44px); line-height: 1.1; letter-spacing: -.045em; }
.page-hero p:last-child { margin: 9px 0 0; color: var(--text-muted); }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { display: flex; align-items: center; gap: 15px; min-height: 94px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stat-icon { display: grid; flex: 0 0 auto; place-items: center; width: 46px; height: 46px; border-radius: 12px; font-size: 16px; font-weight: 800; }
.stat-all { color: var(--blue); background: var(--blue-soft); }
.stat-receipt { color: #93370d; background: #fffaeb; }
.stat-periodic { color: var(--green); background: var(--green-soft); }
.stat-card div { display: flex; flex-direction: column; }
.stat-label { color: var(--text-muted); font-size: 12px; font-weight: 650; }
.stat-card strong { font-size: 27px; line-height: 1.15; letter-spacing: -.04em; }

.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(155px, auto); align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.search-field { position: relative; display: flex; align-items: center; }
.search-field span { position: absolute; left: 14px; color: var(--text-muted); font-size: 21px; pointer-events: none; }
.search-field input { width: 100%; min-height: 44px; padding: 10px 14px 10px 43px; color: var(--text); background: var(--surface-soft); border: 1px solid transparent; border-radius: 9px; outline: none; }
.search-field input:focus { background: #fff; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23, 92, 211, .1); }
.segment { display: flex; padding: 4px; background: #f2f4f7; border-radius: 10px; }
.segment button { min-height: 36px; padding: 7px 12px; color: var(--text-muted); background: transparent; border: 0; border-radius: 7px; font-size: 12px; font-weight: 750; }
.segment button[aria-selected="true"] { color: var(--text); background: #fff; box-shadow: 0 1px 3px rgba(16,24,40,.12); }
.segment span { display: inline-grid; min-width: 19px; height: 19px; place-items: center; margin-left: 4px; padding: 0 5px; background: #eaecf0; border-radius: 10px; font-size: 10px; }
.select-field select { min-height: 40px; padding: 8px 32px 8px 11px; font-size: 12px; }

.workspace { display: grid; grid-template-columns: minmax(310px, 390px) minmax(0, 1fr); min-height: 590px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.measurement-list-panel { position: relative; min-height: 590px; background: var(--surface-soft); border-right: 1px solid var(--line); }
.measurement-list { display: grid; gap: 8px; max-height: calc(100vh - 278px); min-height: 590px; padding: 12px; overflow-y: auto; }
.measurement-card { width: 100%; padding: 15px; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 12px; text-align: left; transition: border-color .16s, box-shadow .16s, transform .12s; }
.measurement-card:hover { transform: translateY(-1px); border-color: #b9c0ca; box-shadow: 0 7px 18px rgba(16,24,40,.06); }
.measurement-card.selected { border-color: #e4a80f; box-shadow: 0 0 0 3px rgba(245,181,27,.15); }
.card-top, .card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-top strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.card-date { flex: 0 0 auto; color: var(--text-muted); font-size: 10px; }
.card-address { display: -webkit-box; min-height: 34px; margin: 7px 0 11px; overflow: hidden; color: var(--text-secondary); font-size: 12px; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-bottom { color: var(--text-muted); font-size: 10px; }
.card-machine { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; min-height: 23px; align-items: center; padding: 4px 8px; color: #344054; background: #f2f4f7; border-radius: 999px; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .025em; }
.badge.review-receipt { color: #93370d; background: #fffaeb; }
.badge.review-periodic { color: var(--blue); background: var(--blue-soft); }
.badge.status-active { color: var(--green); background: var(--green-soft); }
.badge.status-completed { color: #475467; background: #f2f4f7; }
.list-loading { display: grid; gap: 10px; padding: 12px; color: var(--text-muted); font-size: 11px; text-align: center; }
.skeleton-card { height: 108px; border-radius: 12px; background: linear-gradient(90deg, #eaecf0 25%, #f6f7f8 50%, #eaecf0 75%); background-size: 200% 100%; animation: skeleton 1.3s infinite; }
@keyframes skeleton { to { background-position: -200% 0; } }

.detail-panel { min-width: 0; min-height: 590px; background: #fff; }
.detail-placeholder { min-height: 590px; display: grid; align-content: center; justify-items: center; padding: 40px; color: var(--text-muted); text-align: center; }
.detail-placeholder-mark { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 14px; color: var(--blue); background: var(--blue-soft); border-radius: 18px; font-size: 28px; }
.detail-placeholder h2 { margin: 0; color: var(--text); font-size: 18px; }
.detail-placeholder p { margin: 6px 0 0; font-size: 13px; }
.detail-topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 26px 28px; border-bottom: 1px solid var(--line); }
.detail-heading { min-width: 0; }
.badge-row { display: flex; gap: 7px; margin-bottom: 9px; }
.detail-heading h2 { margin: 0; overflow-wrap: anywhere; font-size: 25px; line-height: 1.18; letter-spacing: -.035em; }
.detail-heading p { margin: 6px 0 0; color: var(--text-muted); font-size: 12px; }
.detail-actions { display: flex; flex: 0 0 auto; gap: 7px; }
.detail-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 22px 28px 28px; }
.detail-section { padding: 17px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; }
.detail-section-wide { grid-column: 1 / -1; }
.detail-section h3 { margin: 0 0 14px; font-size: 12px; letter-spacing: .07em; text-transform: uppercase; }
.value-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.value-item { min-width: 0; }
.value-item span { display: block; color: var(--text-muted); font-size: 10px; }
.value-item strong { display: block; margin-top: 2px; overflow-wrap: anywhere; font-size: 13px; font-weight: 700; }
.result-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.result-card { padding: 13px; background: #fff; border: 1px solid #d1e9ff; border-radius: 9px; }
.result-card span { display: block; color: var(--blue); font-size: 10px; font-weight: 650; }
.result-card strong { display: block; margin-top: 4px; font-size: 17px; }
.result-card small { display: block; margin-top: 2px; color: var(--text-muted); font-size: 9px; }
.detail-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 28px; border-top: 1px solid var(--line); }
.mobile-only { display: none; }

.empty-panel { display: grid; min-height: 320px; align-content: center; justify-items: center; padding: 32px 20px; color: var(--text-muted); text-align: center; }
.empty-panel h1, .empty-panel h2 { margin: 0; color: var(--text); font-size: 18px; }
.empty-panel p { max-width: 430px; margin: 7px auto 18px; font-size: 12px; }
.empty-panel-large { min-height: calc(100vh - 180px); }
.empty-panel-large h1 { font-size: 26px; }
.empty-icon { display: grid; width: 48px; height: 48px; place-items: center; margin-bottom: 13px; color: var(--blue); background: var(--blue-soft); border-radius: 14px; font-size: 23px; font-weight: 800; }
.error-panel .empty-icon { color: var(--red); background: var(--red-soft); }

.modal { max-width: none; max-height: none; padding: 0; background: transparent; border: 0; overflow: visible; }
.modal::backdrop { background: rgba(16, 24, 40, .68); backdrop-filter: blur(3px); }
.modal-frame { display: flex; flex-direction: column; width: min(980px, calc(100vw - 34px)); max-height: calc(100vh - 34px); margin: 0; background: #fff; border: 1px solid rgba(255,255,255,.45); border-radius: 19px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-header, .modal-footer { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 22px; background: #fff; }
.modal-header { border-bottom: 1px solid var(--line); }
.modal-footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 21px; letter-spacing: -.03em; }
.modal-header .eyebrow { margin-bottom: 4px; }
.icon-button { display: grid; flex: 0 0 auto; width: 44px; height: 44px; place-items: center; padding: 0; color: var(--text-muted); background: transparent; border: 0; border-radius: 9px; font-size: 28px; line-height: 1; }
.icon-button:hover { color: var(--text); background: #f2f4f7; }
.modal-body { min-height: 0; padding: 22px; overflow-y: auto; }
.editor-body { background: var(--surface-soft); }
.form-section { margin: 0 0 16px; padding: 19px; background: #fff; border: 1px solid var(--line); border-radius: 13px; }
.form-section legend { display: flex; align-items: center; gap: 9px; padding: 0 4px; font-size: 14px; font-weight: 800; }
.form-section > legend > span { display: inline-grid; width: 25px; height: 25px; place-items: center; color: #101828; background: var(--primary); border-radius: 8px; font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .field { margin-top: 13px; }
.field-wide { grid-column: 1 / -1; }
.input-action { display: flex; gap: 8px; }
.input-action input { min-width: 0; }
.input-action .button { flex: 0 0 auto; }
.calculation-panel { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 18px; margin-top: 20px; padding: 17px; background: var(--blue-soft); border: 1px solid #b2ddff; border-radius: 11px; }
.calculation-panel h3 { margin: 0; font-size: 15px; }
.calculation-panel .eyebrow { color: var(--blue); }
.calculation-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.calculation-grid > div { min-width: 0; padding: 10px; background: #fff; border-radius: 8px; }
.calculation-grid span, .calculation-grid small { display: block; color: var(--text-muted); font-size: 9px; }
.calculation-grid strong { display: block; margin: 3px 0 1px; color: var(--blue); font-size: 15px; }
.advanced-section { background: #fff; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.advanced-section summary { padding: 17px 20px; cursor: pointer; font-size: 13px; font-weight: 800; }
.advanced-section summary span { margin-left: 6px; color: var(--text-muted); font-size: 10px; font-weight: 500; }
.advanced-content { padding: 0 15px 1px; border-top: 1px solid var(--line); }
.form-section-nested { margin: 14px 0; background: var(--surface-soft); }
.form-section-nested legend { font-size: 12px; }
.protocol-modal .modal-frame { width: min(1180px, calc(100vw - 28px)); height: min(920px, calc(100dvh - 28px)); max-height: calc(100dvh - 28px); }
.protocol-modal.is-quick-workspace { position: fixed; inset: 0; width: 100vw; height: 100dvh; margin: 0; }
.protocol-modal.is-quick-workspace::backdrop { background: #d0d5dd; backdrop-filter: none; }
.protocol-modal.is-quick-workspace .modal-frame { width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
.protocol-modal.is-quick-workspace .protocol-header { min-height: 50px; padding: 7px 14px; }
.protocol-modal.is-quick-workspace .protocol-header .eyebrow { display: none; }
.protocol-modal.is-quick-workspace .protocol-header h2 { max-width: calc(100vw - 82px); overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.protocol-modal.is-quick-workspace .protocol-header .icon-button { width: 38px; height: 38px; }
.protocol-header { background: linear-gradient(90deg, #fff, #fffaf0); }
.protocol-body { padding: 18px 22px 30px; background: var(--surface-soft); }
.protocol-overview { display: grid; grid-template-columns: minmax(260px, 1fr) auto; align-items: end; gap: 24px; margin-bottom: 14px; padding: 18px 20px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); }
.protocol-progress-copy { max-width: 660px; }
.protocol-progress-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.protocol-progress-row h3 { margin: 0; font-size: 17px; }
.protocol-progress-row strong { color: var(--green); font-size: 19px; }
.protocol-progress-copy progress { display: block; width: 100%; height: 9px; margin: 9px 0 5px; overflow: hidden; accent-color: var(--green); border: 0; border-radius: 999px; }
.protocol-progress-copy progress::-webkit-progress-bar { background: #eaecf0; border-radius: 999px; }
.protocol-progress-copy progress::-webkit-progress-value { background: var(--green); border-radius: 999px; }
.protocol-progress-copy small { color: var(--text-muted); font-size: 11px; }
.protocol-overview-actions { display: flex; align-items: stretch; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.protocol-overview-actions .button { min-height: 44px; }
.protocol-beta-badge { display: inline-flex; align-items: center; min-height: 19px; margin-left: 5px; padding: 2px 6px; color: #614000; background: #fff3c6; border: 1px solid #f6d883; border-radius: 999px; font-size: 8px; font-weight: 850; letter-spacing: .08em; }
.protocol-toolbar { position: sticky; top: -18px; z-index: 3; display: grid; grid-template-columns: minmax(240px, 1fr) auto; align-items: center; gap: 14px; margin-bottom: 14px; padding: 12px; background: rgba(248, 250, 252, .96); border: 1px solid var(--line); border-radius: 13px; backdrop-filter: blur(10px); }
.protocol-toggle { display: inline-flex; min-height: 44px; align-items: center; gap: 9px; padding: 8px 12px; color: var(--text-secondary); background: #fff; border: 1px solid var(--line); border-radius: 9px; font-size: 12px; font-weight: 700; cursor: pointer; }
.protocol-toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.protocol-loading { display: flex; min-height: 180px; align-items: center; justify-content: center; gap: 10px; color: var(--text-muted); font-size: 13px; }
.protocol-loader { width: 19px; height: 19px; border: 2px solid #d0d5dd; border-right-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
.protocol-groups { display: grid; gap: 13px; }
.protocol-groups[aria-busy="true"] { opacity: .65; pointer-events: none; }
.protocol-group { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); }
.protocol-group-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; background: #fff; border: 0; border-bottom: 1px solid transparent; text-align: left; }
button.protocol-group-header { width: 100%; }
.protocol-group.is-open .protocol-group-header { border-bottom-color: var(--line); }
.protocol-group-title { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 800; }
.protocol-group-title::before { content: ""; width: 9px; height: 9px; background: var(--primary); border-radius: 3px; }
.protocol-group-count { padding: 3px 8px; color: var(--text-muted); background: #f2f4f7; border-radius: 999px; font-size: 10px; font-weight: 750; }
.protocol-group-chevron { color: var(--text-muted); font-size: 17px; transition: transform .16s; }
.protocol-group.is-open .protocol-group-chevron { transform: rotate(180deg); }
.protocol-group-fields { display: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; padding: 16px; background: var(--surface-soft); }
.protocol-group.is-open .protocol-group-fields { display: grid; }
.protocol-field { min-width: 0; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 11px; }
.protocol-field.is-wide { grid-column: 1 / -1; }
.protocol-label-row { display: flex; min-height: 31px; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.protocol-label-row label, .protocol-field-label { color: #344054; font-size: 12px; font-weight: 750; line-height: 1.35; }
.protocol-field-page { display: block; margin-top: 2px; color: var(--text-muted); font-size: 9px; font-weight: 500; }
.protocol-bookmark { display: grid; flex: 0 0 auto; width: 32px; height: 32px; place-items: center; padding: 0; color: #98a2b3; background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
.protocol-bookmark.is-remembered { color: #8a5d00; background: var(--primary-soft); border-color: #f6d883; }
.protocol-field input, .protocol-field textarea { width: 100%; min-height: 43px; padding: 9px 11px; color: var(--text); background: #fff; border: 1px solid var(--line-strong); border-radius: 9px; outline: none; }
.protocol-field textarea { min-height: 84px; resize: vertical; }
.protocol-field input:focus, .protocol-field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23, 92, 211, .1); }
.protocol-input-row { display: flex; align-items: stretch; gap: 8px; }
.protocol-input-row input { min-width: 0; }
.protocol-input-row .button { flex: 0 0 auto; min-height: 43px; padding-inline: 12px; }
.protocol-choice-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 7px; }
.protocol-choice { min-height: 42px; padding: 8px 10px; color: #344054; background: #fff; border: 1px solid var(--line-strong); border-radius: 9px; font-size: 11px; font-weight: 750; }
.protocol-choice[aria-checked="true"].is-positive { color: #054f31; background: #dcfae6; border-color: #75e0a7; }
.protocol-choice[aria-checked="true"].is-negative { color: #fff; background: var(--red); border-color: var(--red); }
.protocol-choice[aria-checked="true"].is-neutral { color: #fff; background: var(--blue); border-color: var(--blue); }
.protocol-empty-search { display: grid; min-height: 190px; place-content: center; justify-items: center; padding: 30px; color: var(--text-muted); text-align: center; }
.protocol-empty-search strong { color: var(--text); }
.protocol-empty-search span { margin-top: 4px; font-size: 12px; }
.protocol-footer { justify-content: space-between; }
.protocol-template-note { max-width: 380px; color: var(--text-muted); font-size: 10px; }
.protocol-footer-actions { display: flex; gap: 8px; }
.protocol-modal .modal-frame.is-preview { width: min(1540px, calc(100vw - 24px)); height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); }
.protocol-modal.is-quick-workspace .modal-frame.is-preview { width: 100vw; height: 100dvh; max-height: 100dvh; }
.protocol-preview-view { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; background: #eef1f5; }
.protocol-preview-toolbar { display: grid; flex: 0 0 auto; grid-template-columns: auto minmax(240px, 1fr) auto; align-items: center; gap: 14px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line); }
.protocol-preview-toolbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.protocol-preview-lock { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; color: var(--text-muted); font-size: 11px; text-align: center; }
.protocol-preview-lock span { font-size: 15px; }
.protocol-preview-lock strong { color: var(--text-secondary); }
#protocol-preview-lock-copy { font-size: inherit; }
.protocol-preview-message { flex: 0 0 auto; margin: 10px 14px 0; }
.protocol-preview-layout { display: grid; flex: 1 1 auto; grid-template-columns: 76px minmax(420px, 1fr) 310px; min-height: 0; overflow: hidden; }
.protocol-preview-view.is-inspector-collapsed .protocol-preview-layout { grid-template-columns: 76px minmax(420px, 1fr); }
.protocol-preview-view.is-inspector-collapsed .protocol-preview-inspector { display: none; }
.protocol-preview-pages { display: flex; min-height: 0; flex-direction: column; gap: 7px; padding: 12px 9px; overflow-y: auto; background: #1d2939; border-right: 1px solid #344054; }
.protocol-preview-page-button { display: grid; flex: 0 0 auto; min-height: 58px; place-items: center; padding: 7px 4px; color: #d0d5dd; background: #344054; border: 1px solid #475467; border-radius: 9px; font-size: 10px; font-weight: 750; }
.protocol-preview-page-button span { display: block; color: #98a2b3; font-size: 9px; font-weight: 500; }
.protocol-preview-page-button[aria-current="page"] { color: #101828; background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(245,181,27,.2); }
.protocol-preview-page-button[aria-current="page"] span { color: #614000; }
.protocol-preview-document { display: flex; min-width: 0; min-height: 0; flex-direction: column; background: #344054; }
.protocol-preview-pagebar { display: grid; flex: 0 0 auto; grid-template-columns: 1fr auto 1fr; min-height: 48px; align-items: center; gap: 13px; padding: 6px 12px; color: #fff; background: #1d2939; border-bottom: 1px solid #475467; }
.protocol-preview-page-navigation { display: flex; grid-column: 2; align-items: center; justify-content: center; gap: 13px; }
.protocol-preview-pagebar strong { min-width: 100px; font-size: 12px; text-align: center; }
.protocol-preview-nav { width: 36px; height: 36px; color: #d0d5dd; font-size: 25px; }
.protocol-preview-nav:hover:not(:disabled) { color: #fff; background: #344054; }
.protocol-preview-nav:disabled { cursor: default; opacity: .35; }
.protocol-preview-zoom { display: flex; grid-column: 3; align-items: center; justify-self: end; gap: 4px; }
.protocol-preview-zoom button { display: grid; min-width: 34px; height: 34px; place-items: center; padding: 0 8px; color: #e4e7ec; background: #344054; border: 1px solid #475467; border-radius: 8px; font-size: 16px; font-weight: 750; }
.protocol-preview-zoom button:hover { color: #fff; background: #475467; }
.protocol-preview-zoom #protocol-preview-zoom-fit { min-width: 58px; font-size: 10px; }
.protocol-preview-viewport { min-width: 0; min-height: 0; flex: 1 1 auto; padding: 22px; overflow: auto; overscroll-behavior: contain; }
.protocol-preview-page-shell { position: relative; margin: 0 auto; background: #fff; box-shadow: 0 16px 38px rgba(16,24,40,.35); }
.protocol-preview-stage { position: absolute; left: 0; top: 0; width: 595.32px; height: 841.92px; overflow: hidden; background: #fff; transform-origin: left top; user-select: none; }
.protocol-preview-stage > img, .protocol-preview-stage > canvas, .protocol-preview-hitboxes { position: absolute; inset: 0; width: 100%; height: 100%; }
.protocol-preview-stage > img { display: block; pointer-events: none; }
.protocol-preview-stage > canvas { pointer-events: none; }
.protocol-preview-hitboxes { pointer-events: none; }
.protocol-preview-hitbox { position: absolute; min-width: 10px; min-height: 10px; margin: 0; padding: 0; touch-action: none; color: transparent; background: rgba(23,92,211,.025); border: 1px dashed rgba(23,92,211,.3); border-radius: 2px; cursor: grab; pointer-events: auto; }
.protocol-preview-hitbox:hover { background: rgba(23,92,211,.08); border-color: rgba(23,92,211,.8); }
.protocol-preview-hitbox.is-choice { background: rgba(245,181,27,.035); border-color: rgba(138,93,0,.34); }
.protocol-preview-hitbox.is-selected { z-index: 2; background: rgba(23,92,211,.1); border-color: var(--blue); box-shadow: 0 0 0 2px rgba(23,92,211,.2); cursor: move; }
.protocol-preview-hitbox.is-dragging { cursor: grabbing; }
.protocol-preview-inspector { min-width: 0; min-height: 0; padding: 18px; overflow-y: auto; background: #fff; border-left: 1px solid var(--line); }
.protocol-preview-inspector h3 { margin: 0 0 15px; font-size: 18px; letter-spacing: -.025em; }
.protocol-preview-select-label { display: block; margin-bottom: 6px; color: #344054; font-size: 11px; font-weight: 750; }
.protocol-preview-inspector select, .protocol-preview-inspector input { width: 100%; min-height: 42px; padding: 8px 10px; color: var(--text); background: #fff; border: 1px solid var(--line-strong); border-radius: 9px; outline: none; }
.protocol-preview-inspector select:focus, .protocol-preview-inspector input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23,92,211,.1); }
.protocol-preview-inspector-empty { display: grid; min-height: 240px; place-content: center; justify-items: center; color: var(--text-muted); text-align: center; }
.protocol-preview-inspector-empty > span { display: grid; width: 46px; height: 46px; place-items: center; color: var(--blue); background: var(--blue-soft); border-radius: 13px; font-size: 23px; }
.protocol-preview-inspector-empty p { max-width: 230px; margin: 12px 0 0; font-size: 11px; }
.protocol-preview-inspector-controls { display: grid; gap: 15px; margin-top: 15px; }
.protocol-preview-selected-copy { padding: 13px; background: var(--blue-soft); border: 1px solid #b2ddff; border-radius: 10px; }
.protocol-preview-selected-copy span { display: block; color: var(--blue); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.protocol-preview-selected-copy strong { display: block; margin-top: 3px; font-size: 12px; }
.protocol-preview-selected-copy p { max-height: 68px; margin: 7px 0 0; overflow: auto; color: var(--text-secondary); font-family: "ProtocolArial", Arial, sans-serif; font-size: 12px; white-space: pre-wrap; }
.protocol-preview-number-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.protocol-preview-number-grid label, .protocol-preview-font-controls > label { color: #344054; font-size: 10px; font-weight: 750; }
.protocol-preview-number-grid label span, .protocol-preview-font-controls > label span { color: var(--text-muted); font-weight: 500; }
.protocol-preview-number-grid input { margin-top: 5px; }
.protocol-preview-move-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; padding: 0; border: 0; }
.protocol-preview-move-pad legend { grid-column: 1 / -1; margin-bottom: 4px; color: #344054; font-size: 10px; font-weight: 750; }
.protocol-preview-move-pad button, .protocol-preview-font-controls button { display: grid; min-width: 42px; height: 42px; place-items: center; padding: 0; color: #344054; background: #fff; border: 1px solid var(--line-strong); border-radius: 9px; font-size: 17px; font-weight: 750; }
.protocol-preview-move-pad button:hover, .protocol-preview-font-controls button:hover { color: var(--blue); background: var(--blue-soft); border-color: #84adff; }
.protocol-preview-font-controls { display: grid; gap: 6px; }
.protocol-preview-font-controls > div { display: grid; grid-template-columns: 42px 1fr 42px; gap: 6px; }
.protocol-preview-font-controls input { min-width: 0; text-align: center; }
.protocol-preview-choice-note { margin: 0; padding: 11px; color: #854a0e; background: #fffaeb; border: 1px solid #fedf89; border-radius: 9px; font-size: 10px; }
.protocol-quick-controls { display: grid; gap: 13px; margin-top: 16px; padding: 15px; background: linear-gradient(180deg, #fffcf5, #fff); border: 1px solid #f6d883; border-radius: 13px; box-shadow: 0 6px 18px rgba(138,93,0,.08); }
.protocol-quick-heading { display: grid; gap: 5px; }
.protocol-quick-heading > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.protocol-quick-heading span { color: #8a5d00; font-size: 10px; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.protocol-quick-heading h4 { margin: 0; color: var(--text); font-size: 17px; line-height: 1.3; letter-spacing: -.015em; }
.protocol-quick-input-wrap { display: grid; }
.protocol-quick-input-wrap input { width: 100%; min-height: 50px; padding: 10px 12px; color: var(--text); background: #fff; border: 1px solid #d6b457; border-radius: 10px; outline: none; font-family: "ProtocolArial", Arial, sans-serif; font-size: 16px; }
.protocol-quick-input-wrap input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23,92,211,.12); }
.protocol-quick-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; border: 0; }
.protocol-quick-choices button { min-height: 48px; padding: 9px 10px; color: #344054; background: #fff; border: 1px solid var(--line-strong); border-radius: 9px; font-size: 13px; font-weight: 750; }
.protocol-quick-choices button:hover { color: var(--blue); background: var(--blue-soft); border-color: #84adff; }
.protocol-quick-choices button[aria-checked="true"], .protocol-quick-choices button[aria-pressed="true"] { color: #fff; background: var(--blue); border-color: var(--blue); box-shadow: 0 0 0 2px rgba(23,92,211,.16); }
.protocol-quick-toggle { display: flex; min-height: 44px; align-items: center; gap: 9px; padding: 9px 10px; color: var(--text-secondary); background: #fff; border: 1px solid var(--line); border-radius: 9px; font-size: 11px; font-weight: 700; cursor: pointer; }
.protocol-quick-toggle input { flex: 0 0 auto; width: 18px !important; min-height: 18px !important; height: 18px; margin: 0; padding: 0 !important; accent-color: var(--blue); }
.protocol-quick-navigation { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.protocol-quick-navigation .button { min-height: 44px; padding-inline: 9px; }
.protocol-quick-help { margin: 0; color: var(--text-muted); font-size: 11px; line-height: 1.5; }
.protocol-quick-custom-tools { display: grid; gap: 10px; padding: 11px; background: var(--blue-soft); border: 1px solid #b2ddff; border-radius: 10px; }
.protocol-quick-custom-tools > p { margin: 0; color: #175cd3; font-size: 11px; line-height: 1.45; }
.protocol-quick-custom-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 8px; }
.protocol-quick-custom-options > label:not(.protocol-quick-custom-bold) { color: #344054; font-size: 10px; font-weight: 750; }
.protocol-quick-custom-options input[type="number"] { margin-top: 5px; }
.protocol-quick-custom-bold { display: flex; grid-column: 1 / -1; min-height: 42px; align-items: center; gap: 7px; padding: 7px 9px; color: #344054; background: #fff; border: 1px solid var(--line); border-radius: 9px; font-size: 10px; font-weight: 700; }
.protocol-quick-custom-bold input { flex: 0 0 auto; width: 18px !important; min-height: 18px !important; height: 18px; margin: 0; padding: 0 !important; }
.protocol-quick-custom-move { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; padding: 0; border: 0; }
.protocol-quick-custom-move legend { grid-column: 1 / -1; color: #344054; font-size: 10px; font-weight: 750; }
.protocol-quick-custom-move button { display: grid; min-width: 40px; height: 40px; place-items: center; padding: 0; color: #344054; background: #fff; border: 1px solid #84adff; border-radius: 8px; font-size: 17px; font-weight: 800; }
.protocol-quick-custom-move button:hover { color: var(--blue); background: #eff8ff; }
.protocol-quick-custom-delete { min-height: 40px; color: var(--red); border: 1px solid #fecdca; }
.protocol-preview-view.is-quick .protocol-preview-hitbox { touch-action: manipulation; background: rgba(23,92,211,.055); border: 1px solid rgba(23,92,211,.55); cursor: text; }
.protocol-preview-view.is-quick .protocol-preview-hitbox.is-empty { background: rgba(245,181,27,.13); border-color: #d99a00; border-style: dashed; box-shadow: inset 0 0 0 1px rgba(255,255,255,.55); }
.protocol-preview-view.is-quick .protocol-preview-hitbox.is-filled { background: rgba(6,118,71,.09); border-color: rgba(6,118,71,.65); }
.protocol-preview-view.is-quick .protocol-preview-hitbox.is-current,
.protocol-preview-view.is-quick .protocol-preview-hitbox.is-selected { z-index: 4; background: rgba(23,92,211,.17); border: 2px solid var(--blue); box-shadow: 0 0 0 3px rgba(23,92,211,.2); cursor: text; }
.protocol-preview-view.is-quick .protocol-preview-hitbox.is-dragging { cursor: text; }
.protocol-preview-view.is-quick #protocol-preview-inspector-empty,
.protocol-preview-view.is-quick #protocol-preview-inspector-controls { display: none !important; }
.protocol-preview-footer { justify-content: space-between; }
.protocol-preview-save-state { color: var(--text-muted); font-size: 10px; }
.protocol-preview-save-state.is-dirty { color: #93370d; font-weight: 750; }
.protocol-preview-save-state.is-saved { color: var(--green); font-weight: 750; }
.protocol-preview-footer-actions { display: flex; gap: 8px; }
.protocol-quick-footer { justify-content: space-between; background: #fffcf5; }
.protocol-quick-progress { color: #854a0e; font-size: 10px; font-weight: 750; }
.protocol-quick-footer-actions { display: flex; gap: 8px; }
.confirm-modal .modal-frame { width: min(500px, calc(100vw - 34px)); }
.eyebrow-danger { color: var(--red); }
.scanner-modal .modal-frame { width: min(620px, calc(100vw - 34px)); }
.scanner-frame { position: relative; overflow: hidden; aspect-ratio: 4 / 3; background: #101828; border-radius: 12px; }
.scanner-frame video { width: 100%; height: 100%; object-fit: cover; }
.scanner-frame span { position: absolute; inset: 19% 12%; border: 2px solid var(--primary); border-radius: 12px; box-shadow: 0 0 0 999px rgba(16,24,40,.38); }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 8px; width: min(360px, calc(100vw - 40px)); }
.toast { padding: 13px 15px; color: #fff; background: #101828; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 12px; animation: toastIn .18s ease-out; }
.toast.success { background: #05603a; }
.toast.error { background: #912018; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.print-sheet { display: none; }

@media (max-width: 1050px) {
  .pomiary-page input, .pomiary-page select, .pomiary-page textarea { font-size: 16px; }
  .result-grid, .calculation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calculation-panel { grid-template-columns: 1fr; }
  .detail-topbar { flex-wrap: wrap; }
  .detail-actions { width: 100%; }
  .protocol-group-fields { grid-template-columns: 1fr; }
  .protocol-field.is-wide { grid-column: auto; }
  .protocol-preview-layout { grid-template-columns: 64px minmax(360px, 1fr) 280px; }
  .protocol-preview-view.is-inspector-collapsed .protocol-preview-layout { grid-template-columns: 64px minmax(360px, 1fr); }
  .protocol-preview-inspector { padding: 14px; }
}

@media (max-width: 820px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-intro { display: none; }
  .auth-panel { min-height: 100vh; padding: 20px; }
  .mobile-brand { display: flex; }
  .app-header { align-items: flex-start; padding: 12px 16px; }
  .brand-name { display: none; }
  .header-context { flex: 1; justify-content: flex-end; gap: 8px; }
  .country-control > span, .account-block { display: none; }
  .country-control select { min-width: 118px; }
  .app-header .button { min-height: 38px; }
  .page-main { padding: 27px 14px 40px; }
  .page-hero { align-items: flex-start; }
  .page-hero h1 { font-size: 30px; }
  .page-hero p:last-child { font-size: 13px; }
  .stats-grid { gap: 8px; }
  .stat-card { min-height: 80px; padding: 13px; }
  .stat-icon { width: 39px; height: 39px; }
  .stat-card strong { font-size: 22px; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .segment { width: 100%; }
  .segment button { flex: 1; }
  .select-field select { width: 100%; }
  .workspace { display: block; min-height: 520px; }
  .measurement-list-panel { min-height: 520px; border-right: 0; }
  .measurement-list { max-height: none; min-height: 0; }
  .detail-panel { display: none; position: fixed; inset: 0; z-index: 40; overflow-y: auto; background: #fff; }
  .detail-panel.mobile-open { display: block; }
  .detail-topbar { position: sticky; top: 0; z-index: 2; padding: 14px 16px; background: #fff; }
  .mobile-only { display: inline-flex; }
  .detail-heading { flex: 1 1 calc(100% - 90px); }
  .detail-actions { padding-left: 88px; }
  .detail-sections { padding: 16px; }
  .detail-footer { padding: 15px 16px 28px; }
  .protocol-preview-toolbar { grid-template-columns: auto 1fr; }
  .protocol-preview-lock { justify-content: flex-start; text-align: left; }
  .protocol-preview-toolbar-actions { grid-column: 1 / -1; justify-self: end; }
  .protocol-preview-layout { display: grid; grid-template-columns: 1fr; grid-template-rows: auto minmax(520px, 1fr) auto; overflow-y: auto; }
  .protocol-preview-view.is-inspector-collapsed .protocol-preview-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(520px, 1fr); }
  .protocol-preview-pages { flex-direction: row; padding: 8px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid #344054; }
  .protocol-preview-page-button { min-width: 68px; min-height: 48px; }
  .protocol-preview-document { min-height: 520px; }
  .protocol-preview-pagebar { grid-template-columns: 1fr auto; }
  .protocol-preview-page-navigation { grid-column: 1; justify-self: start; }
  .protocol-preview-zoom { grid-column: 2; }
  .protocol-preview-viewport { overscroll-behavior: auto; }
  .protocol-preview-inspector { min-height: 360px; overflow: visible; border-top: 1px solid var(--line); border-left: 0; }
}

@media (pointer: coarse) {
  .protocol-preview-hitbox { background: transparent; border-color: transparent; }
  .protocol-preview-hitbox.is-selected { background: rgba(23,92,211,.1); border-color: var(--blue); }
}

@media (max-width: 620px) {
  .auth-card { padding: 28px 22px; }
  .app-header .brand-mark { width: 36px; height: 36px; }
  .app-header .button { padding-inline: 10px; }
  .page-hero { display: block; }
  .hero-actions { justify-content: stretch; margin-top: 20px; }
  .hero-actions .button { flex: 1; }
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-card { display: block; text-align: center; }
  .stat-icon { margin: 0 auto 7px; }
  .stat-label { font-size: 10px; }
  .toolbar { grid-template-columns: 1fr; }
  .segment, .select-field { grid-column: 1; }
  .detail-sections { grid-template-columns: 1fr; }
  .detail-section-wide { grid-column: auto; }
  .result-grid, .value-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-actions { padding-left: 0; }
  .detail-actions .button { flex: 1; }
  .modal { margin: 0; }
  .editor-modal .modal-frame, .protocol-modal .modal-frame { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .editor-modal .modal-header, .editor-modal .modal-footer, .protocol-modal .modal-header, .protocol-modal .modal-footer { padding: 13px 15px; }
  .editor-modal .modal-body, .protocol-modal .modal-body { padding: 12px; }
  .form-section { padding: 15px; }
  .form-grid, .form-grid-three { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .field input, .field select { font-size: 16px; }
  .calculation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .input-action { align-items: stretch; }
  .input-action .button { padding-inline: 11px; }
  .protocol-overview { grid-template-columns: 1fr; align-items: stretch; padding: 15px; }
  .protocol-overview-actions { justify-content: stretch; }
  .protocol-overview-actions .button { flex: 1; }
  .protocol-toolbar { top: -12px; grid-template-columns: 1fr; }
  .protocol-footer { align-items: stretch; }
  .protocol-template-note { display: none; }
  .protocol-footer-actions { width: 100%; }
  .protocol-footer-actions .button { flex: 1; padding-inline: 9px; }
  .protocol-modal .modal-frame.is-preview { width: 100vw; height: 100dvh; max-height: 100dvh; }
  .protocol-preview-toolbar { grid-template-columns: 1fr auto; padding: 9px 10px; }
  .protocol-preview-lock { grid-column: 1 / -1; grid-row: 2; }
  .protocol-preview-toolbar-actions { grid-column: 2; grid-row: 1; }
  .protocol-preview-viewport { padding: 10px; }
  .protocol-preview-layout { grid-template-rows: auto minmax(470px, 1fr) auto; }
  .protocol-preview-view.is-inspector-collapsed .protocol-preview-layout { grid-template-rows: auto minmax(470px, 1fr); }
  .protocol-preview-document { min-height: 470px; }
  .protocol-preview-inspector { padding: 15px; }
  .protocol-preview-view.is-quick .protocol-preview-inspector { position: sticky; bottom: 0; z-index: 5; min-height: 0; max-height: 48dvh; overflow-y: auto; box-shadow: 0 -14px 28px rgba(16,24,40,.14); }
  .protocol-quick-controls { margin-top: 12px; padding: 13px; }
  .protocol-quick-input-wrap input { min-height: 48px; font-size: 16px; }
  .protocol-quick-choices button { min-height: 48px; font-size: 13px; }
  .protocol-quick-toggle, .protocol-quick-navigation .button { min-height: 46px; }
  .protocol-preview-footer { display: grid; gap: 8px; padding: 10px !important; }
  .protocol-quick-footer { display: grid; gap: 8px; padding: 10px !important; }
  .protocol-preview-save-state { text-align: center; }
  .protocol-quick-progress { text-align: center; }
  .protocol-preview-footer-actions { width: 100%; }
  .protocol-preview-footer-actions .button { flex: 1; padding-inline: 8px; }
  .protocol-quick-footer-actions { width: 100%; }
  .protocol-quick-footer-actions .button { flex: 1; padding-inline: 8px; }
  .protocol-preview-pagebar { gap: 6px; padding-inline: 7px; }
  .protocol-preview-page-navigation { gap: 4px; }
  .protocol-preview-pagebar strong { min-width: 82px; }
  .protocol-preview-zoom button { min-width: 32px; padding-inline: 6px; }
  .protocol-preview-zoom #protocol-preview-zoom-fit { min-width: 50px; }
  .protocol-quick-custom-options { grid-template-columns: 1fr; }
  .protocol-quick-custom-bold { grid-column: auto; }
}

@media (max-width: 390px) {
  .country-control select { max-width: 112px; min-width: 0; }
  .page-main { padding-inline: 10px; }
  .hero-actions { display: grid; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { display: flex; min-height: 68px; text-align: left; }
  .stat-icon { margin: 0; }
  .result-grid, .calculation-grid { grid-template-columns: 1fr; }
  .protocol-choice-group { grid-template-columns: 1fr 1fr; }
  .protocol-footer-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .protocol-footer-actions #protocol-cancel { display: none; }
  .protocol-footer-actions #protocol-save-pdf { grid-column: 1 / -1; }
  .protocol-preview-toolbar .button { min-height: 40px; padding: 8px 10px; font-size: 11px; }
  .protocol-preview-lock { font-size: 10px; }
  .protocol-preview-footer-actions { display: grid; grid-template-columns: 1fr; }
  .protocol-quick-footer-actions { display: grid; grid-template-columns: 1fr; }
  .protocol-quick-choices { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 10pt; }
  body > *:not(.print-sheet) { display: none !important; }
  .print-sheet { display: block !important; color: #000; }
  .print-header { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 2px solid #000; }
  .print-header h1 { margin: 0; font-size: 19pt; }
  .print-header p { margin: 2px 0; }
  .print-section { margin: 14px 0; page-break-inside: avoid; }
  .print-section h2 { margin: 0 0 7px; padding-bottom: 4px; border-bottom: 1px solid #888; font-size: 11pt; }
  .print-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px 14px; }
  .print-item span { display: block; color: #555; font-size: 8pt; }
  .print-item strong { font-size: 9.5pt; }
  .print-footer { margin-top: 28px; color: #555; font-size: 8pt; text-align: right; }
}
