:root {
  --ink: #1A2420;
  --muted: #6B7670;
  --border: #DCE3DE;
  --bg: #F4F7F5;
  --brand: #00693E;
  --brand-dark: #00502F;
  --white: #FFFFFF;
  --danger: #B23B3B;
  --danger-bg: #FBEEEE;
  --success: #1E8A5F;
  --chip-bg: #EEF1EF;
  --font-display: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-body: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* Header */
header.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
}
header.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 16px; padding-bottom: 16px;
}
.brand-eyebrow {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--brand); margin: 0 0 2px;
}
.brand-title {
  font-family: var(--font-display); font-size: 22px; font-weight: 700; margin: 0; color: var(--ink);
}
.header-actions { display: flex; gap: 8px; align-items: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border-radius: 10px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--border); background: var(--white); color: var(--muted);
  cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; }
.btn-outline-brand { color: var(--brand); border-color: var(--border); background: var(--white); }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 7px 10px; font-size: 13px; }
.btn-block { width: 100%; }

/* Banner */
.status-banner {
  border-radius: 14px; padding: 18px 22px; color: #fff;
  display: flex; align-items: center; gap: 14px; margin: 24px 0;
}
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: #fff; flex-shrink: 0; position: relative; }
.status-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: #fff;
  opacity: .6; animation: ping 1.6s cubic-bezier(0,0,0.2,1) infinite;
}
@keyframes ping { 75%, 100% { transform: scale(2.2); opacity: 0; } }
.status-banner h2 { font-family: var(--font-display); margin: 0 0 2px; font-size: 18px; }
.status-banner p { margin: 0; opacity: .9; font-size: 14px; }

/* Filter chips */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.chip {
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border); background: var(--white); color: var(--muted);
  text-decoration: none; cursor: pointer;
}
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Incident cards */
.incident-list { display: flex; flex-direction: column; gap: 12px; }
.incident-card {
  background: var(--white); border: 1px solid var(--border); border-radius: 12px;
  border-left-width: 4px; border-left-style: solid; overflow: hidden;
}
.incident-card .card-body { padding: 16px 18px; }
.badge-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
}
.ref-code { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.incident-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; margin: 0 0 6px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--muted); }
.meta-row .sep { opacity: .5; }
.incident-desc {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 14px; color: #3A424C; white-space: pre-wrap;
}
.affected-line { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.affected-line strong { color: var(--ink); }
.resolved-tag { color: var(--success); font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }

.empty-state {
  text-align: center; padding: 40px 20px; background: var(--white);
  border: 1px solid var(--border); border-radius: 14px; color: var(--muted);
}

.history-toggle {
  background: none; border: none; color: var(--brand); font-weight: 600; font-size: 14px;
  cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
}

/* Forms (admin) */
.panel { background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin-bottom: 16px; }
.panel h3 { font-family: var(--font-display); margin: 0 0 4px; font-size: 16px; }
.panel .hint { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input[type=text], .field input[type=password], .field select, .field textarea {
  width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--border);
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
.field textarea { resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scope-toggle { display: flex; gap: 8px; margin-bottom: 10px; }
.scope-toggle .opt {
  flex: 1; text-align: center; padding: 9px; border-radius: 10px; border: 1px solid var(--border);
  font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; background: #fff;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.scope-toggle .opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.scope-toggle .opt:has(input:checked) { background: var(--brand); border-color: var(--brand); color: #fff; }

.company-section { display: none; }
.incident-form:has(#scope_companies:checked) .company-section { display: block; }

.company-chips { display: flex; flex-wrap: wrap; gap: 6px; border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.company-chip {
  padding: 5px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; background: var(--chip-bg); color: var(--ink); border: 1px solid transparent;
}
.company-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.company-chip:has(input:checked) { background: var(--brand); color: #fff; }
.form-actions { display: flex; gap: 8px; margin-top: 4px; }

/* Admin list rows */
.admin-row {
  background: var(--white); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px;
}
.admin-row .row-title { font-weight: 600; font-size: 14px; margin-top: 4px; }
.admin-row .row-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  border: 1px solid var(--border); background: #fff; border-radius: 8px; width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none;
}

.company-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px;
  border-radius: 999px; background: var(--chip-bg); font-size: 12.5px; font-weight: 600; color: var(--ink);
}
.company-pill button { border: none; background: rgba(0,0,0,.08); border-radius: 999px; width: 18px; height: 18px; cursor: pointer; font-size: 11px; line-height: 1; }

.alert { padding: 10px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 14px; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: #E6F0EA; color: var(--brand-dark); }

.login-box { max-width: 380px; margin: 60px auto 0; }

footer.site-footer { text-align: center; font-size: 12px; color: var(--muted); padding: 32px 20px; }

@media (max-width: 560px) {
  .grid-2 { grid-template-columns: 1fr; }
  .brand-title { font-size: 19px; }
}
