:root {
  --bg: #071827;
  --panel: #0d2235;
  --panel-2: #102a41;
  --card: rgba(255,255,255,.075);
  --card-strong: rgba(255,255,255,.12);
  --text: #f3f7fb;
  --muted: #a7b7c7;
  --line: rgba(255,255,255,.12);
  --brand: #18a4e0;
  --brand-2: #f4b33d;
  --yes: #12b76a;
  --no: #ef4444;
  --na: #94a3b8;
  --warning: #f59e0b;
  --shadow: 0 16px 38px rgba(0,0,0,.32);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(24,164,224,.24), transparent 32%),
    radial-gradient(circle at 88% 8%, rgba(244,179,61,.14), transparent 31%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100%; padding-bottom: calc(78px + var(--safe-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 15px 12px;
  background: rgba(7,24,39,.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), #0f6aa7 58%, var(--brand-2));
  display: grid; place-items: center; color: white; font-weight: 900;
  box-shadow: var(--shadow);
}
.eyebrow { font-size: 11px; letter-spacing: .12em; color: var(--brand-2); font-weight: 800; }
h1 { margin: 2px 0 0; font-size: 19px; line-height: 1.08; }
.view { padding: 14px; max-width: 980px; margin: 0 auto; }
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 8px 7px calc(8px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: rgba(7,24,39,.93);
  backdrop-filter: blur(14px);
}
.bottom-nav button {
  border: 0; background: transparent; color: var(--muted);
  border-radius: 16px; padding: 8px 2px 6px;
  font-size: 11px; font-weight: 750;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.bottom-nav button span { font-size: 18px; }
.bottom-nav button.active { color: white; background: rgba(24,164,224,.18); }

.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.095), rgba(255,255,255,.058));
  border: 1px solid var(--line); border-radius: 22px; padding: 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}
.card.tight { padding: 11px; }
.card-title { margin: 0 0 8px; font-size: 16px; }
.muted { color: var(--muted); }
.big-number { font-size: 35px; line-height: 1; font-weight: 900; letter-spacing: -.03em; }
.metric-label { margin-top: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 999px; padding: 6px 10px; border: 1px solid var(--line);
  color: var(--text); background: rgba(255,255,255,.07); font-size: 12px; font-weight: 800;
}
.pill.excellent { background: rgba(24,164,224,.18); border-color: rgba(24,164,224,.35); }
.pill.good { background: rgba(18,183,106,.16); border-color: rgba(18,183,106,.35); }
.pill.attention { background: rgba(245,158,11,.16); border-color: rgba(245,158,11,.35); }
.pill.critical, .pill.danger { background: rgba(239,68,68,.16); border-color: rgba(239,68,68,.35); }

.primary-btn, .ghost-btn, .danger-btn {
  border: 0; border-radius: 16px; padding: 11px 13px;
  color: white; font-weight: 850; min-height: 42px;
}
.primary-btn { background: linear-gradient(135deg, var(--brand), #0b74ad); box-shadow: 0 10px 24px rgba(24,164,224,.22); }
.ghost-btn { background: rgba(255,255,255,.08); border: 1px solid var(--line); }
.danger-btn { background: rgba(239,68,68,.18); border: 1px solid rgba(239,68,68,.38); }
.small { min-height: 34px; padding: 7px 10px; border-radius: 13px; font-size: 12px; }
.action-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.action-row > * { flex: 1 1 auto; }

.form-grid { display: grid; gap: 10px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 16px;
  background: rgba(0,0,0,.18); color: var(--text); padding: 12px;
  outline: none;
}
select option { background: #0d2235; color: white; }
textarea { min-height: 76px; resize: vertical; }

.progress-bar { width: 100%; height: 11px; background: rgba(255,255,255,.09); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: inherit; }
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 6px; }

.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 18px 0 9px; }
.section-head h2 { margin: 0; font-size: 18px; }
.area-chip { color: white; background: rgba(24,164,224,.13); border: 1px solid rgba(24,164,224,.3); border-radius: 14px; padding: 8px 10px; font-weight: 900; font-size: 13px; }
.item-card { display: grid; gap: 10px; }
.item-top { display: flex; gap: 10px; align-items: flex-start; }
.item-code { flex: 0 0 auto; font-size: 11px; color: var(--brand-2); font-weight: 900; background: rgba(244,179,61,.12); border: 1px solid rgba(244,179,61,.26); padding: 5px 7px; border-radius: 10px; }
.item-question { font-weight: 800; line-height: 1.3; }
.answer-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.answer-btn {
  border: 1px solid var(--line); border-radius: 15px; min-height: 46px;
  background: rgba(255,255,255,.07); color: white; font-weight: 900;
}
.answer-btn.yes.active { background: rgba(18,183,106,.92); border-color: rgba(18,183,106,1); }
.answer-btn.no.active { background: rgba(239,68,68,.92); border-color: rgba(239,68,68,1); }
.answer-btn.na.active { background: rgba(148,163,184,.72); border-color: rgba(148,163,184,1); }
.more-fields { display: none; gap: 8px; }
.more-fields.open { display: grid; }
.more-toggle { color: var(--muted); background: transparent; border: 0; text-align: left; padding: 5px 0; font-weight: 800; }


.photo-field {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px dashed rgba(255,255,255,.18);
  border-radius: 16px;
  background: rgba(0,0,0,.12);
}
.photo-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--text); }
.photo-input { display: none; }
.photo-preview {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.18);
}
.photo-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.table-wrap { overflow-x: auto; border-radius: 18px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.rank-badge { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(244,179,61,.18); color: var(--brand-2); font-weight: 900; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.status-dot.excellent { background: var(--brand); }
.status-dot.good { background: var(--yes); }
.status-dot.attention { background: var(--warning); }
.status-dot.critical, .status-dot.danger { background: var(--no); }

.empty {
  padding: 28px 16px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 20px;
}

.modal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.58); padding: 20px 14px calc(20px + var(--safe-bottom)); display: grid; place-items: end center; }
.modal.hidden { display: none; }
.modal-card { width: min(780px, 100%); max-height: 88vh; overflow: auto; background: #0b2032; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #0b2032; z-index: 1; }
.modal-content { padding: 14px; }
.report-preview { white-space: pre-wrap; line-height: 1.45; background: rgba(0,0,0,.18); border: 1px solid var(--line); border-radius: 16px; padding: 13px; color: #eaf2f9; }

.toast { position: fixed; left: 50%; bottom: calc(92px + var(--safe-bottom)); transform: translateX(-50%); z-index: 90; background: #0c2a40; color: white; border: 1px solid rgba(24,164,224,.35); border-radius: 999px; padding: 11px 15px; box-shadow: var(--shadow); font-weight: 850; }

@media (max-width: 720px) {
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .view { padding: 12px; }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 13px; }
  h1 { font-size: 17px; }
  .card { border-radius: 20px; }
  table { min-width: 540px; }
}

@media print {
  body { background: white !important; color: #111; }
  .topbar, .bottom-nav, .modal, .no-print { display: none !important; }
  .view { max-width: none; padding: 0; }
  .card { background: white; color: #111; box-shadow: none; border: 1px solid #ddd; }
}
