/* Required documents (signing gate, viewer, sign step, admin matrix) + company alerts. */
.ok { color: var(--ok); } .warn { color: #ffb48a; } .bad { color: #ff9b9e; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.linklike { background: none; border: 0; padding: 0; color: #6cc4f2; text-decoration: underline; cursor: pointer; }

/* layout wrapper so the alert banner can sit above the app */
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.shell > .app { flex: 1; min-height: 0; height: auto; }
.sb-links { display: flex; gap: 6px; margin: 6px 12px 0; }
.sb-link { flex: 1; text-align: left; min-height: 40px; font-size: 13.5px; display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 0; }
.sb-link .badge { flex: none; }

/* ---------- gate ---------- */
.docs-gate { min-height: 100vh; min-height: 100dvh; background: radial-gradient(1000px 500px at 50% -10%, var(--teal) 0%, var(--navy) 60%); }
.docs-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: rgba(16,38,61,.85); }
.docs-top .sb-title { flex: 1; }
.docs-wrap { max-width: 640px; margin: 0 auto; padding: 18px 16px 40px; padding-bottom: max(40px, env(safe-area-inset-bottom)); }
.docs-wrap h1 { margin: 4px 0 6px; font-size: 24px; }
.docs-progress { height: 8px; background: var(--navy-3); border-radius: 6px; overflow: hidden; margin-top: 14px; }
.docs-progress-bar { height: 100%; background: var(--ok); min-width: 4px; }
.docs-steps { list-style: none; padding: 0; margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.docs-step { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--navy-2); }
.docs-step.current { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange) inset; }
.docs-step.locked { opacity: .6; }
.docs-step-num { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--navy-3); }
.docs-step.done .docs-step-num { background: #1f7a4d; color: #fff; }
.docs-step.current .docs-step-num { background: var(--orange); color: #1a0d05; }
.docs-step-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.docs-step-main .btn { align-self: flex-start; margin-top: 6px; min-height: 44px; padding: 10px 18px; }
.docs-step.done .docs-step-state { color: var(--ok); }
.docs-step.current .docs-step-state { color: #ffb48a; }

/* ---------- viewer / sign overlay ---------- */
body.docs-open { overflow: hidden; }
.docs-overlay { position: fixed; inset: 0; z-index: 40; background: var(--navy); }
.docs-viewer { display: flex; flex-direction: column; height: 100%; }
.docs-vhead { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--navy-2); border-bottom: 1px solid var(--line); }
.docs-vhead .icon-btn { width: 44px; height: 44px; font-size: 22px; }
.docs-vtitle { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.docs-vtitle strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.docs-vhead .btn { margin: 0; flex: none; }
.pdf-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px; background: #50575f; display: flex; flex-direction: column; align-items: center; gap: 10px; outline: none; }
.pdf-page { position: relative; width: 100%; max-width: 860px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.35); flex: none; }
.pdf-page img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pdf-page-num { position: absolute; top: 45%; left: 0; right: 0; text-align: center; color: #888; }
.pdf-page.drawn .pdf-page-num { display: none; }
.pdf-end { color: #e3e6ea; padding: 10px 0 30px; }
.docs-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--navy-2); border-top: 1px solid var(--line); }
.docs-foot .btn { margin: 0; min-height: 46px; padding: 10px 18px; }
.docs-foot .btn:disabled { opacity: .45; cursor: not-allowed; }
.docs-endnote { color: var(--muted); }
.docs-fallback { background: var(--navy-2); color: var(--text); border-radius: 12px; padding: 20px; max-width: 420px; margin-top: 30px; display: flex; flex-direction: column; gap: 6px; }
.docs-sign-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.docs-sign-form { max-width: 620px; margin: 0 auto; padding: 14px 16px 40px; padding-bottom: max(40px, env(safe-area-inset-bottom)); }
.docs-consent { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--navy-2); }
.docs-consent-text { white-space: pre-wrap; color: var(--muted); max-height: 170px; overflow-y: auto; margin-top: 6px; line-height: 1.45; }
.docs-check { align-items: flex-start !important; color: var(--text) !important; font-size: 15px !important; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 10px 0 !important; cursor: pointer; }
.docs-check input { width: 22px !important; height: 22px; flex: none; margin-top: 1px !important; accent-color: var(--orange); }
.docs-pad-label { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
.docs-pad-label .btn { margin: 0; }
.sig-wrap { position: relative; }
.sig-pad { display: block; width: 100%; height: 170px; background: #fff; border-radius: 10px; border: 2px solid var(--line); touch-action: none; cursor: crosshair; }
.sig-line { position: absolute; left: 28px; right: 18px; bottom: 38px; border-bottom: 1px solid #b9c0c8; pointer-events: none; }
.sig-x { position: absolute; left: 10px; bottom: 38px; color: #9aa3ad; font-size: 14px; pointer-events: none; }
.docs-submit { width: 100%; min-height: 50px; margin-top: 10px; font-size: 16px; }
.docs-submit:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Handbook & Policies ---------- */
.docs-lib li { align-items: flex-start; flex-wrap: wrap; }
.docs-lib-main { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.docs-lib-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.docs-lib-actions .btn { margin: 0; }
.docs-older { margin-top: 10px; }

/* ---------- admin Documents ---------- */
.docs-admin-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.docs-admin-sum > div { background: var(--navy); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.docs-admin-sum .big { font-size: 20px; }
.docs-admin-tools { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.docs-admin-tools input { flex: 1; min-width: 0; }
.docs-admin-tools select { width: auto; max-width: 44%; }
.docs-admin-tools .btn { margin: 0; white-space: nowrap; }
.docs-matrix th, .docs-matrix td { padding: 7px 5px; }
.docs-matrix .doc-who { font-weight: 500; text-transform: none; font-size: 13.5px; color: var(--text); min-width: 110px; }
.docs-matrix tr.blocked .doc-who div:first-child { color: #ffb3b5; }
.doc-cell { white-space: nowrap; }
.doc-cell .small { margin-left: 4px; }
.chip.ok { background: rgba(60,207,142,.16); color: #8ff0c2; }
.chip.bad { background: rgba(229,72,77,.18); color: #ffb3b5; }
.chip.amber, .chip.warn { background: rgba(255,107,31,.18); color: #ffc49e; }
.chip { display: inline-block; margin: 1px 0; }
.docs-admin-h { margin: 16px 0 4px; font-size: 15px; }
.docs-versions li { flex-wrap: wrap; }
.file-btn { color: var(--text) !important; font-size: 13px !important; margin: 0 !important; }

/* ---------- alerts ---------- */
.alert-bar { flex: none; display: none; }
.alert-bar.show { display: block; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); background: #0d2236; border-bottom: 1px solid var(--line); max-height: 45vh; overflow-y: auto; }
.alert-bar.show ~ .app .sb-top, .alert-bar.show ~ .app .ch-header { padding-top: 14px; }
.alert-card { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: #173f63; border: 1px solid #2b6a9b; margin: 6px 0; }
.alert-bar .alert-card { margin: 0; }
.alert-card.urgent { background: #6b1d21; border-color: #e5484d; }
.alert-card.acked { background: var(--navy-2); border-color: var(--line); }
.alert-icon { font-size: 20px; line-height: 1.2; flex: none; }
.alert-main { flex: 1; min-width: 0; }
.alert-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.alert-title strong { overflow-wrap: anywhere; }
.alert-tag { font-size: 11px; font-weight: 800; letter-spacing: .04em; background: #fff; color: #9b1c21; padding: 1px 6px; border-radius: 5px; }
.alert-tag.upd { color: #173f63; }
.alert-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 3px; }
.alert-body.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.alert-meta { color: #c3d2e0; margin-top: 4px; }
.alert-card.urgent .alert-meta { color: #f3c9cb; }
.alert-ack { flex: none; margin: 0; min-height: 44px; min-width: 76px; font-weight: 700; background: #fff; color: #0a1a2b; border-color: #fff; }
.alert-card.urgent .alert-ack { color: #9b1c21; }
.alert-more { display: block; width: 100%; margin-top: 6px; background: transparent; border: 1px dashed #4a7aa3; color: #cfe3f3; border-radius: 8px; padding: 6px; cursor: pointer; }
.alerts-h { margin: 14px 0 6px; font-size: 15px; }
.alert-compose textarea { resize: vertical; }
.alert-compose-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.alert-compose-row label { margin: 6px 0; }
.alert-compose-row label.check { flex: 1 1 220px; color: var(--text); font-size: 14px; }
.alert-compose-row select { width: auto; }
.alert-admin-row { align-items: flex-start !important; flex-wrap: wrap; }
.alert-admin-main { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.alert-admin-main .alert-tag { margin-right: 6px; }
.ack-meter { height: 6px; background: var(--navy-3); border-radius: 4px; overflow: hidden; max-width: 260px; }
.ack-meter-bar { height: 100%; background: var(--ok); }
.acks-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.ack-list { list-style: none; padding: 0; margin: 4px 0; }
.ack-list li { display: flex; flex-direction: column; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.alerts-past { margin: 10px 0; }

@media (max-width: 760px) {
  .docs-admin-sum .big { font-size: 17px; }
  .docs-matrix { font-size: 12.5px; }
  .doc-cell .chip { font-size: 11.5px; padding: 2px 7px; }
  .acks-cols { grid-template-columns: 1fr; }
  .docs-wrap h1 { font-size: 22px; }
}

/* Admin now has 7 tabs: keep the modal inside the phone screen and let tabs/tables scroll sideways. */
.modal-bg { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.modal, .modal-body { min-width: 0; }
.tabs { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; white-space: nowrap; }
.docs-admin-sum > div { min-width: 0; }
.ack-list li { align-items: flex-start; text-align: left; }

/* ---------- office: signed paper copies ---------- */
.chip.paper { background: rgba(108,196,242,.16); color: #b6e2fa; align-self: flex-start; }
.paper-dlg h3 { margin: 16px 0 6px; font-size: 15px; }
.paper-form { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--navy-2); margin-top: 12px; }
.paper-form h3 { margin: 0; }
.paper-form .field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.paper-docs { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.paper-docs legend { font-size: 13px; padding: 0 4px; }
.check-row { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.check-row input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.check-row.attest { padding: 8px; border-radius: 8px; background: rgba(255,107,31,.10); }
.paper-actions { display: flex; gap: 8px; }
.paper-uploads li, .paper-status li { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.paper-uploads li.removed { opacity: .6; }
