:root {
  --blue: #3f478f;
  --blue-dark: #2f356e;
  --magenta: #9b2f59;
  --yellow: #ffef00;
  --background: #eef0f4;
  --card: #ffffff;
  --text: #1c2230;
  --muted: #687085;
  --border: #d8dce6;
  --danger: #a61b29;
  --success: #147a42;
  --warning-bg: #fff4cc;
  --info-bg: #e8edff;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--background);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background: var(--background);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button, input, select { font: inherit; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 48px 1fr 44px;
  gap: 10px;
  align-items: center;
  min-height: 74px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  color: white;
  background: var(--blue);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}

.header-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: white;
}

.app-header h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: .03em;
}

.app-header p {
  margin: 2px 0 0;
  font-size: .78rem;
  opacity: .9;
}

main {
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 14px 12px calc(28px + env(safe-area-inset-bottom));
}

.card {
  margin-bottom: 13px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(28, 34, 48, .06);
}

.identity-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-left: 5px solid var(--blue);
}

.field-label, .help-text, .version {
  color: var(--muted);
}

.field {
  margin-bottom: 18px;
}

.field label,
.modal-content label {
  display: block;
  margin-bottom: 7px;
  font-weight: 700;
}

input, select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--text);
  background: white;
  border: 1px solid #bec4d1;
  border-radius: 8px;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(63, 71, 143, .15);
}

select:disabled {
  color: #9197a4;
  background: #f2f3f6;
}

.classification-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 20px;
  padding: 11px 12px;
  border: 2px solid var(--text);
  border-radius: 5px;
  font-weight: 800;
}

.classification-box[data-level="CRITICO"] strong,
.classification-box[data-level="CRÍTICO"] strong { color: #b00020; }

.classification-box[data-level="MAYOR"] strong { color: #b55a00; }

.classification-box[data-level="MENOR"] strong { color: #176c39; }

.button {
  display: block;
  width: 100%;
  min-height: 46px;
  margin-top: 10px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 750;
  cursor: pointer;
}

.button:disabled {
  opacity: .48;
  cursor: not-allowed;
}

.button-primary {
  color: #111;
  background: var(--yellow);
  border-color: #dacd00;
}

.button-primary:active { background: #e7db00; }

.button-secondary {
  color: white;
  background: var(--blue);
}

.button-outline {
  color: var(--blue-dark);
  background: white;
  border-color: var(--blue);
}

.button-link {
  color: var(--blue);
  background: transparent;
  border-color: transparent;
  text-decoration: underline;
}

.pending-count {
  margin: 0 0 12px;
  text-align: center;
  font-size: .95rem;
}

.pending-count strong {
  display: inline-block;
  min-width: 26px;
  padding: 2px 7px;
  color: white;
  background: var(--magenta);
  border-radius: 999px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
}

.icon-button:active { background: rgba(255,255,255,.13); }

.banner {
  margin-bottom: 12px;
  padding: 11px 13px;
  border-radius: 8px;
  font-weight: 650;
}

.banner-warning { background: var(--warning-bg); }
.banner-info { background: var(--info-bg); color: var(--blue-dark); }

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.1rem;
}

.incident {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.incident:last-child { border-bottom: 0; }

.incident h3 {
  margin: 0 0 5px;
  font-size: .98rem;
}

.incident p {
  margin: 3px 0;
  color: #454c5e;
  font-size: .88rem;
}

.incident-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.badge {
  padding: 3px 7px;
  background: #eceef5;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
}

.version {
  margin: 18px 0 0;
  text-align: center;
  font-size: .75rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 18, 28, .62);
}

.modal-content {
  width: min(100%, 470px);
  padding: 21px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}

.modal-content h2 { margin-top: 0; }

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 15px;
}

.toast {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 28px), 500px);
  padding: 13px 16px;
  color: white;
  background: #222936;
  border-radius: 9px;
  text-align: center;
  box-shadow: 0 7px 24px rgba(0,0,0,.28);
}

.hidden { display: none !important; }

@media (min-width: 620px) {
  main { padding-top: 20px; }
  .card { padding: 20px; }
}
