:root {
  --ink: #102a43;
  --muted: #627d98;
  --soft: #f2f7f9;
  --panel: #ffffff;
  --line: #d9e2ec;
  --brand: #0e7490;
  --brand-dark: #155e75;
  --brand-soft: #e6f6f8;
  --nav: #0b2533;
  --success: #15803d;
  --warning: #b45309;
  --danger: #be123c;
  --shadow: 0 16px 42px rgba(16, 42, 67, .12);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--soft); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(14, 116, 144, .28); outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.4rem, 2vw, 1.9rem); letter-spacing: -.025em; }
h2 { font-size: 1.25rem; letter-spacing: -.015em; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); line-height: 1.55; }
.eyebrow { margin: 0 0 4px; color: var(--brand); font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; }
.wide { width: 100%; }
.hidden { display: none !important; }

.primary, .secondary, .ghost, .danger-button, .success-button, .icon-button, .segmented button, .chip-button {
  min-height: 44px; border: 0; border-radius: 12px; padding: 0 16px; font-weight: 760; transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}
.primary { color: #fff; background: var(--brand); box-shadow: 0 8px 18px rgba(14, 116, 144, .22); }
.primary:hover { background: var(--brand-dark); transform: translateY(-1px); }
.secondary { color: var(--brand-dark); background: var(--brand-soft); }
.secondary:hover { background: #d8f0f3; }
.ghost { color: var(--muted); background: transparent; }
.ghost:hover { color: var(--ink); background: rgba(255,255,255,.09); }
.danger-button { color: var(--danger); background: #fff1f4; }
.success-button { color: #fff; background: var(--success); }
.icon-button { width: 44px; padding: 0; color: var(--ink); background: transparent; font-size: 1.25rem; }
.icon-button:hover { background: rgba(98,125,152,.1); }
button:disabled { cursor: not-allowed; opacity: .48; transform: none !important; }

.brand-mark { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 20px; border-radius: 20px; color: #fff; background: linear-gradient(145deg, #18a3b9, #0e7490 56%, #164e63); box-shadow: 0 14px 30px rgba(14, 116, 144, .28); font-size: 1.9rem; font-weight: 900; }
.brand-mark.small { flex: 0 0 auto; width: 42px; height: 42px; margin: 0; border-radius: 13px; font-size: 1.2rem; box-shadow: none; }

.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: radial-gradient(circle at 20% 15%, rgba(24,163,185,.17), transparent 32%), radial-gradient(circle at 80% 85%, rgba(14,116,144,.12), transparent 36%), #eef5f7; }
.auth-card, .verify-card { width: min(440px, 100%); padding: clamp(28px, 6vw, 48px); border: 1px solid rgba(255,255,255,.75); border-radius: 28px; background: rgba(255,255,255,.9); box-shadow: 0 26px 80px rgba(16,42,67,.16); backdrop-filter: blur(16px); text-align: center; }
.auth-card h1, .verify-card h1 { margin-bottom: 12px; }
.auth-form { display: grid; gap: 16px; margin-top: 26px; text-align: left; }
.auth-form label, .form-field { display: grid; gap: 7px; color: #334e68; font-size: .82rem; font-weight: 760; }
.auth-form small, .form-field small { color: var(--muted); font-weight: 500; }
.auth-form input, .form-field input, .form-field textarea, .form-field select, .table-input {
  width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--ink); background: #fff;
}
.auth-form input:focus, .form-field input:focus, .form-field textarea:focus, .form-field select:focus, .table-input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(14,116,144,.09); outline: 0; }
.auth-foot { margin: 24px 0 0; color: var(--muted); font-size: .72rem; }
.alert { margin: 18px 0 0; padding: 12px 14px; border-radius: 12px; font-size: .84rem; line-height: 1.45; text-align: left; }
.alert.danger { color: #881337; background: #fff1f4; border: 1px solid #fecdd3; }
.alert.info { color: #164e63; background: var(--brand-soft); border: 1px solid #bae6ea; }
.alert.success { color: #166534; background: #f0fdf4; border: 1px solid #bbf7d0; }

.app-shell { display: grid; grid-template: 88px minmax(0, 1fr) / 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; grid-row: 1 / 3; display: flex; flex-direction: column; height: 100vh; padding: 24px 18px max(18px, env(safe-area-inset-bottom)); color: #d9e8ef; background: radial-gradient(circle at 10% 0, rgba(24,163,185,.22), transparent 26%), var(--nav); z-index: 20; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 28px; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { color: #fff; font-size: 1.06rem; }
.sidebar-brand small { margin-top: 2px; color: #8fb2c1; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
.side-nav { display: grid; gap: 6px; }
.side-nav button { display: flex; align-items: center; gap: 13px; min-height: 50px; border: 0; border-radius: 13px; padding: 0 14px; color: #a9c1cc; background: transparent; font-weight: 680; text-align: left; }
.side-nav button span { display: grid; place-items: center; width: 22px; font-size: 1.18rem; }
.side-nav button:hover { color: #fff; background: rgba(255,255,255,.06); }
.side-nav button.active { color: #fff; background: rgba(24,163,185,.19); box-shadow: inset 3px 0 #4cc9dc; }
.sidebar-user { margin: auto 5px 12px; padding: 13px 12px; border: 1px solid rgba(255,255,255,.09); border-radius: 13px; background: rgba(255,255,255,.045); }
.sidebar-user strong, .sidebar-user small { display: block; }
.sidebar-user small { margin-top: 3px; color: #87a8b6; font-size: .72rem; }
.sidebar > form .ghost { color: #a9c1cc; }

.topbar { grid-column: 2; display: flex; align-items: center; justify-content: space-between; gap: 22px; min-width: 0; padding: 18px clamp(20px, 4vw, 44px); padding-top: max(18px, env(safe-area-inset-top)); border-bottom: 1px solid rgba(217,226,236,.78); background: rgba(255,255,255,.84); backdrop-filter: blur(18px); z-index: 10; }
.topbar > div:nth-child(2) { min-width: 0; flex: 1; }
.top-actions { display: flex; align-items: center; gap: 13px; }
.sync-pill, .status-pill { display: inline-flex; align-items: center; gap: 7px; min-height: 28px; padding: 5px 10px; border-radius: 999px; font-size: .72rem; font-weight: 760; white-space: nowrap; }
.sync-pill { color: #39716f; background: #ebf7f4; }
.sync-pill i { width: 7px; height: 7px; border-radius: 50%; background: #20a47a; box-shadow: 0 0 0 3px rgba(32,164,122,.13); }
.menu-button { display: none; }

.main-content { grid-column: 2; min-width: 0; padding: clamp(22px, 4vw, 44px); overflow: hidden; }
.content-wrap { width: min(1280px, 100%); margin: 0 auto; }
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); gap: 24px; overflow: hidden; margin-bottom: 24px; padding: clamp(24px, 4vw, 38px); border-radius: 24px; color: #fff; background: linear-gradient(125deg, #0b4f64, #0e7490 52%, #1a91a8); box-shadow: 0 16px 40px rgba(14,116,144,.2); }
.hero::after { content: ""; position: absolute; width: 320px; height: 320px; right: -120px; top: -170px; border: 42px solid rgba(255,255,255,.08); border-radius: 50%; }
.hero h2 { margin-bottom: 9px; font-size: clamp(1.5rem, 3vw, 2.35rem); }
.hero p { max-width: 650px; margin-bottom: 23px; color: #d9eff3; line-height: 1.55; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero .primary { color: var(--brand-dark); background: #fff; box-shadow: 0 8px 22px rgba(6,56,69,.2); }
.hero .secondary { color: #fff; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.16); }
.hero-visual { display: grid; place-items: center; min-height: 160px; z-index: 1; }
.generator-card { width: min(290px, 100%); padding: 22px; border: 1px solid rgba(255,255,255,.18); border-radius: 22px; background: rgba(6,51,65,.27); backdrop-filter: blur(8px); }
.generator-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.generator-display { padding: 12px; border-radius: 10px; color: #9ee6dc; background: #083946; font: 700 1.2rem ui-monospace, monospace; }
.generator-dots { display: flex; gap: 6px; }
.generator-dots i { width: 9px; height: 9px; border-radius: 50%; background: #73e2bd; }
.generator-dots i:nth-child(2) { background: #f8ca61; }
.generator-lines { display: grid; gap: 8px; }
.generator-lines i { height: 5px; border-radius: 4px; background: rgba(255,255,255,.2); }
.generator-lines i:nth-child(2) { width: 72%; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 24px; }
.metric-card, .panel { border: 1px solid rgba(217,226,236,.82); border-radius: var(--radius); background: var(--panel); box-shadow: 0 2px 7px rgba(16,42,67,.035); }
.metric-card { padding: 20px; }
.metric-card .metric-icon { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 18px; border-radius: 12px; color: var(--brand); background: var(--brand-soft); font-size: 1.15rem; }
.metric-card strong { display: block; margin-bottom: 6px; font-size: 1.9rem; letter-spacing: -.04em; }
.metric-card span { color: var(--muted); font-size: .78rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); gap: 20px; }
.panel { overflow: hidden; }
.panel + .panel { margin-top: 20px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 19px 21px; border-bottom: 1px solid #edf1f4; }
.panel-header h2, .panel-header h3 { margin: 0; }
.panel-body { padding: 21px; }
.panel-empty { padding: 40px 20px; color: var(--muted); text-align: center; }

.protocol-list { display: grid; }
.protocol-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(130px, .75fr) minmax(90px, .45fr) auto; gap: 16px; align-items: center; min-height: 80px; padding: 14px 20px; border-bottom: 1px solid #edf1f4; cursor: pointer; }
.protocol-row:last-child { border-bottom: 0; }
.protocol-row:hover { background: #f8fbfc; }
.protocol-row strong, .protocol-row small { display: block; }
.protocol-row strong { margin-bottom: 4px; }
.protocol-row small { color: var(--muted); }
.status-pill.draft { color: #526b7a; background: #edf2f4; }
.status-pill.signed { color: #9a5b0d; background: #fff5dd; }
.status-pill.final { color: #14723a; background: #eaf8ef; }
.row-arrow { color: #9fb3c8; font-size: 1.25rem; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.protocol-delete { min-height: 34px; padding: 0 11px; font-size: .72rem; }
.supplier-groups { display: grid; gap: 10px; padding: 12px; background: #f5f9fa; }
.supplier-group { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.supplier-group summary { display: flex; align-items: center; gap: 11px; min-height: 58px; padding: 10px 15px; color: var(--ink); background: #fff; cursor: pointer; list-style: none; user-select: none; }
.supplier-group summary::-webkit-details-marker { display: none; }
.supplier-group summary:hover { background: #f8fbfc; }
.supplier-group summary span:not(.supplier-group-chevron), .supplier-group summary strong, .supplier-group summary small { display: block; }
.supplier-group summary small { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.supplier-group-chevron { display: grid; place-items: center; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; color: var(--brand-dark); background: var(--brand-soft); font-size: 1.35rem; font-weight: 800; transform: rotate(0deg); transition: transform .16s ease; }
.supplier-group[open] .supplier-group-chevron { transform: rotate(90deg); }
.supplier-group > .protocol-list { border-top: 1px solid #edf1f4; }

.quality-stack { display: grid; gap: 12px; }
.quality-item { display: flex; align-items: flex-start; gap: 12px; padding: 13px; border-radius: 14px; background: #f6fafb; }
.quality-item b { display: grid; place-items: center; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; color: #fff; background: var(--success); }
.quality-item strong, .quality-item small { display: block; }
.quality-item small { margin-top: 3px; color: var(--muted); line-height: 1.4; }

.page-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.search-box { position: relative; flex: 1; max-width: 420px; }
.search-box input { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 13px; padding: 0 14px 0 42px; background: #fff; }
.search-box span { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.section-tabs { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; }
.section-tabs button { flex: 0 0 auto; min-height: 38px; border: 0; border-radius: 999px; padding: 0 15px; color: var(--muted); background: transparent; font-size: .8rem; font-weight: 760; }
.section-tabs button.active { color: var(--brand-dark); background: var(--brand-soft); }

.master-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.master-card { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 13px; align-items: center; padding: 14px 0; border-bottom: 1px solid #edf1f4; }
.master-card:last-child { border-bottom: 0; }
.master-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: var(--brand-dark); background: var(--brand-soft); font-weight: 800; }
.master-icon.logo-icon { overflow: hidden; padding: 5px; background: #fff; border: 1px solid var(--line); }
.master-icon.logo-icon img { width: 100%; height: 100%; object-fit: contain; }
.master-card strong, .master-card small { display: block; }
.master-card small { margin-top: 3px; color: var(--muted); }

.editor { width: min(1320px, 100%); margin: 0 auto; }
.editor-header { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: calc(clamp(22px, 4vw, 44px) * -1); margin-bottom: 20px; padding: 18px clamp(22px, 4vw, 44px); border-bottom: 1px solid var(--line); background: rgba(242,247,249,.93); backdrop-filter: blur(16px); z-index: 8; }
.editor-title { min-width: 0; }
.editor-title h2 { margin: 2px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-actions { display: flex; gap: 9px; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: start; }
.editor-main { min-width: 0; }
.editor-nav { position: sticky; top: 92px; display: grid; gap: 7px; padding: 11px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.editor-nav button { min-height: 42px; border: 0; border-radius: 10px; padding: 0 12px; color: var(--muted); background: transparent; text-align: left; font-size: .8rem; font-weight: 720; }
.editor-nav button.active { color: var(--brand-dark); background: var(--brand-soft); }
.form-section { display: none; }
.form-section.active { display: block; }
.form-section > .panel { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 15px; }
.span-12 { grid-column: span 12; }
.form-field { grid-column: span 12; }
.form-field.span-3 { grid-column: span 3; }
.form-field.span-4 { grid-column: span 4; }
.form-field.span-6 { grid-column: span 6; }
.form-field.span-8 { grid-column: span 8; }
.form-field textarea { min-height: 110px; resize: vertical; }
.field-prefix { position: relative; }
.field-prefix input { padding-right: 54px; }
.field-prefix span { position: absolute; top: 50%; right: 13px; transform: translateY(-50%); color: var(--muted); font-size: .77rem; }

.check-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.check-table th { padding: 10px; color: var(--muted); background: #f7fafb; text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
.check-table th:first-child { border-radius: 10px 0 0 10px; }
.check-table th:last-child { border-radius: 0 10px 10px 0; }
.check-table td { padding: 11px 9px; border-bottom: 1px solid #edf1f4; vertical-align: middle; font-size: .82rem; }
.check-table td:first-child { width: 34%; font-weight: 670; }
.check-table td:nth-child(2) { width: 17%; }
.check-table td:nth-child(3) { width: 20%; }
.check-table select, .check-table input { width: 100%; min-height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; background: #fff; }
.check-result { font-weight: 720; }
.check-row.not_ok td { background: #fff7f8; }
.check-row.na { color: #7b93a5; }

.location-box { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.address-search { position: relative; min-width: 0; }
.address-suggestions { position: absolute; top: calc(100% + 6px); right: 0; left: 0; overflow: hidden; max-height: 330px; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: 0 18px 45px rgba(16,42,67,.18); z-index: 30; }
.address-suggestion { display: grid; gap: 3px; width: 100%; min-height: 56px; border: 0; border-bottom: 1px solid #edf2f5; padding: 10px 13px; color: var(--ink); background: #fff; text-align: left; }
.address-suggestion:last-child { border-bottom: 0; }
.address-suggestion:hover, .address-suggestion:focus-visible { background: var(--brand-soft); outline: 0; }
.address-suggestion strong { font-size: .84rem; line-height: 1.35; }
.address-suggestion small { color: var(--muted); font-size: .69rem; font-weight: 560; }
.address-suggestion-message { padding: 14px; color: var(--muted); background: #fff; font-size: .8rem; font-weight: 600; }
.location-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .75rem; }
.location-meta span { padding: 5px 8px; border-radius: 99px; background: #eff5f7; }

.photo-drop { position: relative; display: grid; place-items: center; min-height: 170px; border: 2px dashed #b8cbd4; border-radius: 18px; padding: 20px; color: var(--muted); background: #f8fbfc; text-align: center; }
.photo-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-drop strong, .photo-drop small { display: block; }
.photo-drop strong { margin-bottom: 5px; color: var(--ink); }
.photo-icon { margin-bottom: 12px; font-size: 2rem; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-top: 18px; }
.photo-card { position: relative; overflow: hidden; min-height: 170px; border-radius: 15px; background: #dce8ec; }
.photo-card img { width: 100%; height: 170px; object-fit: cover; display: block; }
.photo-card figcaption { position: absolute; inset: auto 0 0; padding: 22px 11px 10px; color: #fff; background: linear-gradient(transparent, rgba(6,28,36,.82)); font-size: .75rem; }
.photo-card button { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border: 0; border-radius: 50%; color: #fff; background: rgba(6,28,36,.72); }
.ocr-box { margin-top: 18px; padding: 16px; border: 1px solid #bee2e7; border-radius: 15px; background: var(--brand-soft); }
.ocr-box h3 { margin-bottom: 6px; color: var(--brand-dark); }
.ocr-box pre { overflow: auto; max-height: 150px; margin: 10px 0 0; padding: 10px; border-radius: 10px; color: #315266; background: rgba(255,255,255,.72); font-size: .7rem; white-space: pre-wrap; }

.signature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.signature-card { padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: #f9fbfc; }
.signature-canvas { width: 100%; height: 170px; margin: 10px 0; border: 1px solid #c8d6dc; border-radius: 12px; background: #fff; touch-action: none; }
.signature-line { border-top: 1px solid #c8d6dc; padding-top: 7px; color: var(--muted); font-size: .72rem; }
.signature-actions { display: flex; gap: 8px; }
.signed-badge { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 11px; border-radius: 11px; color: #166534; background: #edf9f1; font-size: .78rem; font-weight: 720; }
.signed-badge b { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; color: #fff; background: var(--success); }

.finalize-card { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 22px; border: 1px solid #bee2e7; border-radius: 17px; background: linear-gradient(135deg, #eefafb, #f8fcfc); }
.finalize-card h3 { margin-bottom: 7px; }
.finalize-card p { margin: 0; color: var(--muted); line-height: 1.45; font-size: .82rem; }

.audit-list { display: grid; }
.audit-event { position: relative; display: grid; grid-template-columns: 16px minmax(0,1fr) auto; gap: 13px; padding: 13px 0; border-bottom: 1px solid #edf1f4; }
.audit-event:last-child { border-bottom: 0; }
.audit-event::before { content: ""; width: 10px; height: 10px; margin-top: 5px; border: 3px solid #b8e1e7; border-radius: 50%; background: var(--brand); }
.audit-event strong, .audit-event small { display: block; }
.audit-event small { margin-top: 3px; color: var(--muted); }
.audit-event time { color: var(--muted); font-size: .7rem; white-space: nowrap; }

.modal { width: min(680px, calc(100% - 28px)); max-height: min(820px, calc(100vh - 28px)); border: 0; border-radius: 22px; padding: 0; color: var(--ink); background: #fff; box-shadow: 0 30px 90px rgba(5,36,50,.32); }
.modal::backdrop { background: rgba(4,25,34,.57); backdrop-filter: blur(5px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 24px 16px; border-bottom: 1px solid #edf1f4; }
.modal-head h2 { margin: 0; }
.modal-body { overflow: auto; max-height: calc(100vh - 190px); padding: 22px 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 24px 22px; border-top: 1px solid #edf1f4; }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 25px); z-index: 100; max-width: min(440px, calc(100% - 32px)); padding: 13px 18px; border-radius: 13px; color: #fff; background: #0d3342; box-shadow: 0 16px 40px rgba(6,32,42,.28); font-size: .82rem; font-weight: 680; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #9f1239; }

.verify-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%; color: #fff; font-size: 1.8rem; font-weight: 900; }
.verify-icon.ok { background: var(--success); }
.verify-icon.bad { background: var(--danger); }
.verify-list { margin: 26px 0 0; text-align: left; }
.verify-list div { padding: 12px 0; border-top: 1px solid var(--line); }
.verify-list dt { margin-bottom: 5px; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.verify-list dd { margin: 0; font-size: .85rem; font-weight: 670; }

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 88px minmax(0,1fr); }
  .sidebar { padding-inline: 14px; }
  .sidebar-brand { justify-content: center; padding-inline: 0; }
  .sidebar-brand > span:last-child { display: none; }
  .side-nav button:not(.active)::after, .side-nav button { font-size: 0; }
  .side-nav button { justify-content: center; padding: 0; }
  .side-nav button span { font-size: 1.2rem; }
  .sidebar-user { padding: 10px 5px; text-align: center; }
  .sidebar-user strong { font-size: 0; overflow: hidden; text-overflow: ellipsis; }
  .sidebar-user strong::before { content: "QA"; font-size: .72rem; }
  .sidebar-user small { display: none; }
  .sidebar > form .ghost { font-size: 0; }
  .sidebar > form .ghost::before { content: "↪"; font-size: 1.15rem; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-nav { position: static; display: flex; overflow-x: auto; }
  .editor-nav button { flex: 0 0 auto; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw); transform: translateX(-105%); transition: transform .24s ease; box-shadow: 18px 0 50px rgba(0,0,0,.24); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 15; background: rgba(2,22,30,.48); }
  .sidebar-brand { justify-content: flex-start; }
  .sidebar-brand > span:last-child { display: block; }
  .side-nav button { justify-content: flex-start; padding: 0 14px; font-size: .9rem; }
  .side-nav button span { font-size: 1.2rem; }
  .sidebar-user { padding: 13px 12px; text-align: left; }
  .sidebar-user strong { font-size: .8rem; }
  .sidebar-user strong::before { content: none; }
  .sidebar-user small { display: block; }
  .sidebar > form .ghost { font-size: .9rem; }
  .sidebar > form .ghost::before { content: none; }
  .topbar { position: sticky; top: 0; padding: 14px 18px; }
  .menu-button { display: block; }
  .top-actions .sync-pill { display: none; }
  .main-content { padding: 20px 16px 36px; }
  .hero { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid, .master-grid { grid-template-columns: 1fr; }
  .protocol-row { grid-template-columns: minmax(0,1fr) auto; }
  .protocol-row > :nth-child(2), .protocol-row > :nth-child(3) { display: none; }
  .form-field.span-3, .form-field.span-4, .form-field.span-6, .form-field.span-8 { grid-column: span 12; }
  .signature-grid { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: 1fr 1fr; }
  .check-table { display: block; overflow-x: auto; }
  .check-table th, .check-table td { min-width: 135px; }
  .check-table td:first-child { min-width: 230px; }
  .finalize-card { grid-template-columns: 1fr; }
  .editor-header { margin: -20px -16px 18px; padding: 14px 16px; }
  .editor-actions .secondary { display: none; }
}

@media (max-width: 520px) {
  .topbar .primary { width: 44px; overflow: hidden; padding: 0; font-size: 0; }
  .topbar .primary::before { content: "+"; font-size: 1.35rem; }
  .metric-grid { gap: 10px; }
  .metric-card { padding: 15px; }
  .metric-card strong { font-size: 1.55rem; }
  .photo-grid { grid-template-columns: 1fr; }
  .location-box { grid-template-columns: 1fr; }
  .location-meta { grid-column: 1; }
  .page-toolbar { align-items: stretch; flex-direction: column; }
  .search-box { max-width: none; }
  .modal-head, .modal-body, .modal-actions { padding-inline: 17px; }
}

@media print {
  .sidebar, .topbar, .editor-nav, .editor-actions { display: none !important; }
  .app-shell, .main-content, .editor-layout { display: block; padding: 0; }
  .form-section { display: block !important; break-after: page; }
  .panel { box-shadow: none; }
}
