/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #f5f5f0;
  color: #1a1a1a;
  min-height: 100vh;
}
input, select, button, textarea { font-family: inherit; }
input, select, textarea { outline: none; }
input:focus, select:focus, textarea:focus {
  border-color: #1B4332 !important;
  box-shadow: 0 0 0 3px rgba(27, 67, 50, .1);
}
button { cursor: pointer; }
button:active { opacity: .85; }
.hidden { display: none !important; }

/* ── Spinner ────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid #e0e0d8;
  border-top-color: #1B4332;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 16px;
}

/* ── Toast ──────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  padding: 12px 22px; border-radius: 10px;
  font-size: 14px; z-index: 9999;
  opacity: 0; transition: opacity .3s;
  pointer-events: none;
  max-width: 340px; text-align: center;
  background: #1a1a1a; color: #fff;
  white-space: pre-line;
}
#toast.show { opacity: 1; }
#toast.ok  { background: #1B4332; }
#toast.err { background: #A32D2D; }

/* ── Form controls ──────────────────────────────────────────── */
.lbl { font-size: 13px; color: #666; display: block; margin-bottom: 5px; font-weight: 500; }
.inp {
  width: 100%; padding: 11px 13px;
  border-radius: 8px; border: 1px solid #e0e0d8;
  font-size: 15px; margin-bottom: 14px;
  display: block; background: #fff; color: #1a1a1a;
}
.sel {
  width: 100%; padding: 11px 13px;
  border-radius: 8px; border: 1px solid #e0e0d8;
  font-size: 15px; margin-bottom: 14px;
  display: block; background: #fff; color: #1a1a1a;
  -webkit-appearance: none;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  border: none; border-radius: 9px;
  padding: 10px 20px; font-size: 14px;
  font-weight: 600; cursor: pointer; display: inline-block;
}
.btn:active { opacity: .85; }
.g  { background: #1B4332; color: #fff; }
.o  { background: transparent; color: #1a1a1a; border: 1px solid #e0e0d8; }
.fw { width: 100%; text-align: center; }

/* ── Cards & layout ─────────────────────────────────────────── */
.card {
  background: #fff; border-radius: 14px;
  border: 1px solid #e0e0d8; padding: 18px; margin-bottom: 14px;
}
.stat { background: #f0f0ec; border-radius: 10px; padding: 14px 16px; }

/* ── Badges ─────────────────────────────────────────────────── */
.ba {
  background: #EAF3DE; color: #3B6D11;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500; display: inline-block;
}
.bp {
  background: #FAEEDA; color: #854F0B;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500; display: inline-block;
}

/* ── Method cards (auth selection) ─────────────────────────── */
.mcard {
  border: 1px solid #e0e0d8; border-radius: 11px;
  padding: 14px 16px; cursor: pointer;
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 10px; background: #fff;
  width: 100%; text-align: left;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .hide-sm { display: none !important; }
  .nav-sub { display: none; }
}

/* ── Report preview (report.html) ───────────────────────────── */
#rpt { background: #fff; font-family: 'Segoe UI', Arial, sans-serif; color: #1a1a1a; }
.rpt-hdr { background: #1B4332; color: #fff; padding: 26px 30px 20px; }
.rpt-logo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.rpt-logo {
  width: 42px; height: 42px; border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,.4);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.rpt-org  { font-size: 21px; font-weight: 700; }
.rpt-sub  { font-size: 11px; opacity: .7; letter-spacing: .06em; text-transform: uppercase; margin-top: 2px; }
.rpt-title { font-size: 16px; font-weight: 600; margin-bottom: 3px; }
.rpt-meta  { font-size: 12px; opacity: .7; }
.rpt-band {
  background: #f5f5f0; border-bottom: 1px solid #e0e0d8;
  padding: 16px 30px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px;
}
.rpt-field label {
  font-size: 10px; color: #999; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  display: block; margin-bottom: 2px;
}
.rpt-field span { font-size: 14px; font-weight: 600; color: #1a1a1a; }
.rpt-body { padding: 22px 30px; }
.rpt-stats { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.rpt-stat  { background: #EAF3DE; border-radius: 9px; padding: 12px 16px; flex: 1; min-width: 110px; }
.rpt-stat-v { font-size: 22px; font-weight: 700; color: #1B4332; }
.rpt-stat-l { font-size: 12px; color: #3B6D11; font-weight: 500; margin-top: 2px; }
.rpt-sec {
  font-size: 15px; font-weight: 700; color: #1B4332;
  margin-bottom: 12px; padding-bottom: 6px;
  border-bottom: 2px solid #EAF3DE;
}
table.rpt-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.rpt-tbl th {
  text-align: left; padding: 9px 10px;
  background: #f5f5f0; color: #666; font-weight: 600;
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid #e0e0d8;
}
table.rpt-tbl td {
  padding: 10px 10px; border-bottom: 1px solid #f0f0ec;
  vertical-align: top; line-height: 1.5;
}
table.rpt-tbl tr:nth-child(even) td { background: #fafaf8; }
.rpt-ft {
  background: #f5f5f0; border-top: 1px solid #e0e0d8;
  padding: 12px 30px;
  display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 8px;
  font-size: 12px; color: #999;
}

@media print {
  body { background: #fff; }
  #ctrl-panel, #action-bar, #pg-loading, #pg-denied { display: none !important; }
  #preview-wrap { border: none !important; border-radius: 0 !important; }
  .rpt-hdr, .rpt-band, .rpt-stat, .rpt-tbl th,
  .rpt-tbl tr:nth-child(even) td, .rpt-ft {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
