:root {
  --navy: #063b5c;
  --navy-2: #052d47;
  --green: #19b866;
  --green-dark: #0b8e4a;
  --mint: #e8f8ef;
  --bg: #f3f6f8;
  --card: #ffffff;
  --ink: #172231;
  --muted: #6c7784;
  --line: #dfe6eb;
  --danger: #c53a3a;
  --danger-bg: #fff0f0;
  --warning: #a86400;
  --warning-bg: #fff6df;
  --shadow: 0 14px 35px rgba(16, 45, 65, .12);
  --radius: 20px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.loading-screen {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-content: center; justify-items: center; gap: 18px;
  background: linear-gradient(160deg, var(--navy-2), var(--navy)); color: white;
}
.loading-screen p { margin: 0; opacity: .82; }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid rgba(255,255,255,.28); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.brand-mark { font-weight: 900; font-size: 34px; letter-spacing: -2px; }
.brand-mark span { color: #54df8f; }
.brand-mark.large { font-size: 44px; min-width: 86px; }
.auth-view {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(circle at 10% 10%, rgba(25,184,102,.22), transparent 35%),
    linear-gradient(160deg, #052d47, #074f76);
}
.auth-card { width: min(100%, 460px); background: #fff; border-radius: 28px; padding: 26px; box-shadow: 0 24px 70px rgba(0,0,0,.3); }
.auth-brand { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 24px; }
.auth-brand h1 { margin: 4px 0 6px; font-size: 23px; line-height: 1.12; }
.auth-brand p { margin: 0; color: var(--muted); line-height: 1.45; }
.auth-foot { margin: 22px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 7px; font-weight: 700; font-size: 14px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 13px; padding: 13px 14px; outline: none; min-height: 48px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(25,184,102,.14); }
.btn { border: 0; border-radius: 13px; padding: 13px 16px; min-height: 48px; font-weight: 800; }
.btn.primary { background: var(--green); color: white; box-shadow: 0 8px 18px rgba(25,184,102,.22); }
.btn.primary:hover { background: var(--green-dark); }
.btn.secondary { background: #e8eef2; color: var(--navy); }
.btn.danger { background: var(--danger); color: white; }
.btn.outline { background: white; color: var(--navy); border: 1px solid var(--line); }
.btn.link { padding: 5px; min-height: auto; background: transparent; color: var(--navy); }
.btn.small { min-height: 38px; padding: 8px 12px; font-size: 13px; }
.form-message { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-size: 14px; }
.app-shell { min-height: 100vh; padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: 82px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: calc(14px + env(safe-area-inset-top)) 20px 14px;
  background: linear-gradient(135deg, var(--navy-2), var(--navy)); color: white;
  box-shadow: 0 5px 18px rgba(0,0,0,.12);
}
.topbar h1 { margin: 3px 0 0; font-size: 22px; line-height: 1.1; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; font-weight: 900; opacity: .75; }
.avatar-button { width: 46px; height: 46px; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; background: rgba(255,255,255,.13); color: white; font-weight: 900; }
.content { width: min(100%, 900px); margin: 0 auto; padding: 18px 16px 28px; }
.hero {
  background: linear-gradient(145deg, #063b5c, #08648a); color: white; border-radius: 24px;
  padding: 22px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.hero::after { content: "+"; position: absolute; right: 10px; bottom: -45px; font-size: 190px; font-weight: 900; color: rgba(255,255,255,.06); }
.hero h2 { margin: 8px 0 8px; font-size: 25px; max-width: 430px; }
.hero p { margin: 0; max-width: 580px; color: rgba(255,255,255,.82); line-height: 1.48; }
.hero-status { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding: 8px 11px; background: rgba(25,184,102,.2); border: 1px solid rgba(94,234,154,.4); border-radius: 999px; font-size: 12px; font-weight: 800; }
.hero-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #54df8f; box-shadow: 0 0 0 5px rgba(84,223,143,.13); }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 18px; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.kpi-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: 0 5px 18px rgba(22,46,62,.06); }
.kpi-card strong { display: block; font-size: 30px; color: var(--navy); }
.kpi-card span { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); font-weight: 700; }
.kpi-card.critical strong { color: var(--danger); }
.quick-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.quick-action { text-align: left; border: 1px solid var(--line); border-radius: 17px; padding: 15px; background: white; color: var(--ink); box-shadow: 0 5px 16px rgba(22,46,62,.05); }
.quick-action b { display: block; margin-bottom: 5px; color: var(--navy); }
.quick-action small { color: var(--muted); line-height: 1.35; }
.quick-action .quick-icon { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 10px; border-radius: 12px; background: var(--mint); color: var(--green-dark); font-weight: 900; }
.card-list { display: grid; gap: 11px; }
.data-card { background: white; border: 1px solid var(--line); border-radius: 17px; padding: 15px; box-shadow: 0 4px 15px rgba(22,46,62,.05); }
.data-card-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.data-card h3 { margin: 0 0 5px; font-size: 16px; }
.data-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.data-card-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.data-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 900; background: #edf2f5; color: #425362; }
.badge.low { background: #eaf5ff; color: #24658c; }
.badge.medium { background: var(--warning-bg); color: var(--warning); }
.badge.high, .badge.critical { background: var(--danger-bg); color: var(--danger); }
.badge.active, .badge.approved, .badge.conforming { background: var(--mint); color: var(--green-dark); }
.badge.blocked { background: var(--danger-bg); color: var(--danger); }
.empty-state { border: 1px dashed #bcc8d0; border-radius: 18px; padding: 28px 20px; text-align: center; background: rgba(255,255,255,.65); }
.empty-state strong { display: block; color: var(--navy); margin-bottom: 6px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; }
.toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.toolbar .btn { flex: 1; }
.context-card { background: white; border-radius: 18px; border: 1px solid var(--line); padding: 17px; }
.context-card dl { display: grid; grid-template-columns: 110px 1fr; gap: 9px 12px; margin: 0; font-size: 13px; }
.context-card dt { color: var(--muted); }
.context-card dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr); min-height: calc(68px + env(safe-area-inset-bottom));
  padding: 5px 5px env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -10px 35px rgba(8,42,63,.10);
}
.nav-item { border: 0; background: transparent; color: #73808b; display: grid; place-items: center; align-content: center; gap: 2px; font-size: 10px; font-weight: 800; }
.nav-item.active { color: var(--green-dark); }
.nav-icon { font-size: 22px; font-weight: 900; line-height: 1; }
.nav-alert .nav-icon { width: 36px; height: 36px; display: grid; place-items: center; margin-top: -16px; border-radius: 50%; background: var(--green); color: white; border: 4px solid white; box-shadow: 0 5px 15px rgba(25,184,102,.28); }
.modal { position: fixed; inset: 0; z-index: 80; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2,21,34,.58); }
.modal-sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow: auto; background: var(--bg); border-radius: 24px 24px 0 0; box-shadow: 0 -20px 55px rgba(0,0,0,.25); padding-bottom: env(safe-area-inset-bottom); }
.modal-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 18px 14px; background: rgba(243,246,248,.96); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 3px 0 0; font-size: 20px; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: white; font-size: 24px; }
.modal-body { padding: 18px; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; }
.checkbox-row input { width: 20px; min-height: 20px; margin-top: 2px; }
.inline-note { background: #e9f2f7; border-radius: 14px; padding: 12px 13px; color: #395568; font-size: 13px; line-height: 1.45; }
.toast { position: fixed; z-index: 120; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 32px), 460px); background: #112c3c; color: white; padding: 13px 15px; border-radius: 14px; text-align: center; box-shadow: var(--shadow); font-weight: 700; font-size: 13px; }
.toast.error { background: #852f2f; }
.skeleton { min-height: 75px; border-radius: 17px; background: linear-gradient(90deg,#e9eef1,#f6f8f9,#e9eef1); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (min-width: 700px) {
  .kpi-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .quick-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .bottom-nav { left: 50%; transform: translateX(-50%); max-width: 900px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  .modal-sheet { left: 50%; right: auto; width: min(620px,100%); transform: translateX(-50%); }
}
@media (max-width: 420px) {
  .form-grid.two { grid-template-columns: 1fr; }
  .auth-brand { display: block; }
  .brand-mark.large { margin-bottom: 12px; }
}


/* WG+ 3.0 v4 — Biblioteca Mestre de Checklists */
.eyebrow.dark { color: var(--green-dark); opacity: 1; }
.inspection-intro {
  display: grid; gap: 16px; padding: 20px; border-radius: 22px;
  background: linear-gradient(145deg, #ffffff, #eef7f2); border: 1px solid #cfe4d8;
  box-shadow: 0 8px 28px rgba(22,46,62,.08);
}
.inspection-intro h2 { margin: 5px 0 7px; color: var(--navy); font-size: 24px; }
.inspection-intro p { margin: 0; color: var(--muted); line-height: 1.5; }
.inspection-intro .toolbar { margin: 0; flex-wrap: wrap; }
.category-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; margin-top: 15px; }
.category-card {
  position: relative; display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 10px;
  min-height: 112px; padding: 14px; text-align: left; border: 1px solid var(--line);
  border-radius: 18px; background: white; color: var(--ink); box-shadow: 0 5px 16px rgba(22,46,62,.05);
}
.category-card:hover { border-color: #8bcbb0; transform: translateY(-1px); }
.category-card.compact { min-height: 88px; }
.category-card span:nth-child(2) { min-width: 0; }
.category-card b { display: block; color: var(--navy); font-size: 14px; line-height: 1.25; }
.category-card small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.category-card em {
  position: absolute; right: 9px; top: 9px; min-width: 24px; height: 24px; display: grid; place-items: center;
  border-radius: 999px; background: var(--mint); color: var(--green-dark); font-size: 10px; font-style: normal; font-weight: 900;
}
.category-icon {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px;
  background: #edf6f1; font-size: 23px; flex: 0 0 auto;
}
.custom-callout {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 16px; border: 1px dashed #9ab9aa; border-radius: 18px; background: #f7fbf9;
}
.custom-callout p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.library-panel { display: grid; gap: 14px; }
.modal-grid { margin-top: 0; }
.back-link { justify-self: start; }
.template-list { display: grid; gap: 10px; }
.template-card {
  display: grid; grid-template-columns: 46px 1fr 22px; gap: 11px; align-items: center;
  width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 16px;
  background: white; color: var(--ink); text-align: left;
}
.template-card b { display: block; color: var(--navy); font-size: 14px; line-height: 1.3; }
.template-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.template-arrow { font-size: 25px; color: var(--green-dark); }
.template-summary {
  display: flex; gap: 12px; padding: 15px; background: white; border: 1px solid var(--line); border-radius: 17px;
}
.template-summary h3 { margin: 0 0 5px; color: var(--navy); font-size: 17px; }
.template-summary p { margin: 0 0 6px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.template-summary small { color: var(--green-dark); font-weight: 800; }
.guided-checklist { display: grid; gap: 14px; }
.checklist-progress {
  position: sticky; top: 73px; z-index: 3; display: grid; gap: 7px; padding: 12px 14px;
  background: rgba(243,246,248,.96); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 14px;
}
.checklist-progress div { color: var(--navy); font-size: 13px; }
.checklist-progress progress { width: 100%; height: 9px; accent-color: var(--green); }
.question-list { display: grid; gap: 12px; }
.question-card {
  display: grid; grid-template-columns: 34px 1fr; gap: 11px; padding: 14px;
  background: white; border: 1px solid var(--line); border-radius: 17px; transition: .18s ease;
}
.question-card.failed { border-color: #db7777; background: #fff7f7; box-shadow: 0 0 0 3px rgba(190,54,54,.07); }
.question-card.critical-question { border-left: 5px solid #dc8b38; }
.question-number {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%;
  background: var(--navy); color: white; font-weight: 900; font-size: 12px;
}
.question-title { color: var(--navy); font-weight: 850; line-height: 1.38; }
.question-content > p { margin: 5px 0 9px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.critical-label {
  display: inline-flex; margin: 2px 0 9px; padding: 4px 8px; border-radius: 999px;
  background: #fff0df; color: #9a5200; font-size: 10px; font-weight: 900;
}
.answer-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; margin-top: 10px; }
.answer-choice { display: block; font-size: 12px; }
.answer-choice input { position: absolute; opacity: 0; pointer-events: none; }
.answer-choice span {
  min-height: 44px; display: grid; place-items: center; padding: 8px 5px; border: 1px solid var(--line);
  border-radius: 12px; background: #f7f9fa; color: #51616e; font-weight: 900; text-align: center;
}
.answer-choice.yes input:checked + span { background: var(--mint); border-color: var(--green); color: var(--green-dark); }
.answer-choice.no input:checked + span { background: var(--danger-bg); border-color: #d76d6d; color: var(--danger); }
.answer-choice.na input:checked + span { background: #eef1f3; border-color: #9daab3; color: #53616b; }
.failure-extra { display: grid; gap: 10px; margin-top: 12px; padding: 12px; border-radius: 13px; background: #fff; border: 1px dashed #d38b8b; }
.failure-extra textarea { min-height: 82px; }
.required-note { color: var(--danger); font-size: 10px; text-transform: uppercase; }
.optional-note { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.question-field { margin-top: 10px; }
.sticky-submit { position: sticky; bottom: 10px; z-index: 4; width: 100%; box-shadow: 0 9px 25px rgba(25,184,102,.3); }
.inspection-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.inspection-detail-head small { color: var(--muted); }
.response-list { display: grid; gap: 9px; }
.response-card {
  display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 12px;
  border: 1px solid var(--line); background: white; border-radius: 14px;
}
.response-card > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #edf2f5; font-weight: 900; font-size: 11px; }
.response-card b { color: var(--navy); font-size: 13px; line-height: 1.35; }
.response-card p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.response-card small { display: inline-block; margin-top: 7px; color: var(--green-dark); font-weight: 800; }
.response-card.failed { background: #fff7f7; border-color: #df9a9a; }
.custom-question-list { display: grid; gap: 12px; }
.custom-question-row {
  position: relative; display: grid; gap: 9px; padding: 14px; border: 1px solid var(--line);
  border-radius: 16px; background: white;
}
.question-row-number {
  position: absolute; right: 10px; top: 10px; width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 50%; background: var(--navy); color: white; font-size: 11px; font-weight: 900;
}
.remove-question { justify-self: start; color: var(--danger) !important; }
@media (min-width: 700px) {
  .category-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .inspection-intro { grid-template-columns: 1fr auto; align-items: center; }
  .inspection-intro .toolbar { width: 280px; }
  .modal-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 480px) {
  .category-grid { grid-template-columns: 1fr 1fr; }
  .category-card { grid-template-columns: 40px 1fr; min-height: 102px; padding: 12px; }
  .category-icon { width: 38px; height: 38px; font-size: 20px; }
  .answer-options { grid-template-columns: 1fr 1fr 1.2fr; }
  .custom-callout { align-items: flex-start; flex-direction: column; }
}
