:root {
  --bg: #0d1220;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.95);
  --text: #101827;
  --muted: #667085;
  --line: rgba(15, 23, 42, 0.12);
  --accent: #645bff;
  --accent-2: #00a4ff;
  --green: #0f9f6e;
  --red: #d92d20;
  --amber: #b54708;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 16% 8%, rgba(100, 91, 255, .35), transparent 28rem),
    radial-gradient(circle at 78% 0%, rgba(0, 164, 255, .28), transparent 24rem),
    linear-gradient(135deg, #f5f7ff 0%, #edf3ff 45%, #f9fbff 100%);
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

.shell {
  position: relative;
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.eyebrow {
  display: inline-flex;
  padding: 7px 10px;
  border: 1px solid rgba(100, 91, 255, .22);
  border-radius: 999px;
  color: #4f46e5;
  background: rgba(255,255,255,.68);
  backdrop-filter: blur(12px);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
}

h1 {
  margin: 14px 0 8px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: .94;
  letter-spacing: -0.055em;
}

.subtitle {
  margin: 0;
  max-width: 760px;
  color: #475467;
  font-size: 17px;
  line-height: 1.55;
}

.searchPanel, .statusRow, .card, .emptyState {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.searchPanel {
  position: sticky;
  top: 14px;
  z-index: 20;
  padding: 14px;
}

.searchBox {
  display: grid;
  grid-template-columns: 26px 1fr 38px;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 0 16px;
  border: 1px solid rgba(100, 91, 255, .22);
  border-radius: 22px;
  background: rgba(255,255,255,.92);
}
.searchBox svg { width: 24px; fill: #667085; }
.searchBox input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 20px;
  color: var(--text);
}
.searchBox input::placeholder { color: #98a2b3; }
#clearBtn {
  border: none;
  border-radius: 14px;
  width: 34px;
  height: 34px;
  background: #eef2ff;
  color: #4f46e5;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.tabs {
  display: flex;
  gap: 8px;
  padding: 5px;
  border-radius: 18px;
  background: rgba(15, 23, 42, .06);
}
.tab, .ghostBtn, .filterActions button, .copyBtn {
  border: 0;
  cursor: pointer;
  font: inherit;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.tab {
  padding: 10px 14px;
  border-radius: 14px;
  color: #475467;
  background: transparent;
  font-weight: 700;
}
.tab.active {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px rgba(100,91,255,.26);
}
.ghostBtn, .filterActions button {
  padding: 10px 14px;
  border-radius: 14px;
  color: #344054;
  background: rgba(255,255,255,.76);
  border: 1px solid var(--line);
  font-weight: 700;
}
.tab:hover, .ghostBtn:hover, .filterActions button:hover, .copyBtn:hover { transform: translateY(-1px); }

.filters {
  margin-top: 12px;
  padding: 0 4px 2px;
}
.filters summary {
  cursor: pointer;
  color: #475467;
  font-weight: 800;
  padding: 9px 6px;
}
#selectedSectionsHint { color: var(--accent); font-weight: 800; }
.filterActions { display: flex; gap: 8px; margin: 8px 0 12px; }
.sectionsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}
.sectionCheck {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.62);
  border: 1px solid rgba(15,23,42,.08);
  color: #344054;
  font-size: 14px;
}
.sectionCheck input { accent-color: var(--accent); }

.statusRow {
  margin: 16px 0;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  box-shadow: 0 12px 40px rgba(15,23,42,.10);
}
.summary { color: #475467; font-weight: 700; }
.statusActions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}
.answerSwitch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}
.answerSwitch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switchTrack {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #d0d5dd;
  transition: background .18s ease;
}
.switchThumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15,23,42,.28);
  transition: transform .18s ease;
}
.answerSwitch input:checked + .switchTrack { background: var(--accent); }
.answerSwitch input:checked + .switchTrack .switchThumb { transform: translateX(16px); }
.answerSwitch input:focus-visible + .switchTrack { outline: 3px solid rgba(79,70,229,.24); outline-offset: 2px; }
.terms { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.termPill {
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
  color: #4f46e5;
  background: #eef2ff;
}

.results { display: grid; gap: 14px; }
.card {
  overflow: hidden;
  background: var(--panel-strong);
  box-shadow: 0 16px 48px rgba(15,23,42,.12);
}
.cardToggle {
  width: 100%;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.cardToggle:hover { background: #f8fafc; }
.cardToggle:focus-visible { outline: 3px solid rgba(79,70,229,.24); outline-offset: -3px; }
.card.is-expanded .cardToggle { border-bottom: 1px solid var(--line); }
.cardHeaderContent { min-width: 0; }
.cardChevron {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #475467;
  background: #f2f4f7;
  font-size: 22px;
  line-height: 1;
  transition: transform .18s ease;
}
.card.is-expanded .cardChevron { transform: rotate(180deg); }
.cardTitle {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: -0.02em;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #344054;
  background: #f2f4f7;
}
.badge.bz { color: #175cd3; background: #eff8ff; }
.badge.tickets { color: #b54708; background: #fffaeb; }
.badge.portal-mos { color: #c4320a; background: #fff1f3; }
.badge.portal-ed { color: #7a5af8; background: #f4f3ff; }
.badge.portal-ng { color: #026aa2; background: #eff8ff; }
.cardBody { padding: 18px 20px 20px; }
.cardBody[hidden] { display: none; }
.field { margin: 0 0 16px; }
.field:last-child { margin-bottom: 0; }
.fieldLabel {
  margin-bottom: 6px;
  color: #475467;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .045em;
}
.text {
  white-space: pre-wrap;
  line-height: 1.58;
  color: #1d2939;
}
mark {
  background: #fff2a8;
  color: inherit;
  border-radius: 5px;
  padding: 0 3px;
}
.cardActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.copyBtn, .linkBtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 11px;
  border-radius: 12px;
  font-weight: 800;
  text-decoration: none;
  color: #344054;
  background: #f8fafc;
  border: 1px solid var(--line);
}
.linkBtn:hover { background: #eef2ff; }
.emptyState {
  margin-top: 18px;
  padding: 52px 22px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(15,23,42,.10);
}
.emptyIcon { font-size: 42px; }
.emptyState h2 { margin: 8px 0; }
.emptyState p { margin: 0 auto; max-width: 560px; color: var(--muted); line-height: 1.55; }

.skeleton {
  height: 150px;
  border-radius: 28px;
  background: linear-gradient(90deg, rgba(255,255,255,.55), rgba(255,255,255,.95), rgba(255,255,255,.55));
  background-size: 200% 100%;
  animation: shimmer 1.1s infinite linear;
  border: 1px solid var(--line);
}
@keyframes shimmer { to { background-position: -200% 0; } }

.errorBox {
  padding: 18px 20px;
  border-radius: 22px;
  color: #7a271a;
  background: #fffbfa;
  border: 1px solid #fecdca;
}

@media (max-width: 820px) {
  .shell { width: min(100% - 20px, 1280px); padding-top: 18px; }
  .hero { grid-template-columns: 1fr; }
  .searchPanel { top: 8px; border-radius: 22px; }
  .searchBox input { font-size: 16px; }
  .statusRow { flex-direction: column; align-items: flex-start; }
  .statusActions { width: 100%; justify-content: space-between; }
  .cardToggle { align-items: flex-start; }
}

.errorBox pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 10px 0;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.75);
  border: 1px solid rgba(122,39,26,.14);
}

.toolbarActions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.reportBtn, .primaryBtn {
  border: 0;
  cursor: pointer;
  font: inherit;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
  padding: 10px 14px;
  border-radius: 14px;
  color: white;
  background: linear-gradient(135deg, #f97316, #ef4444);
  box-shadow: 0 10px 26px rgba(239,68,68,.22);
  font-weight: 800;
}
.reportBtn:hover, .primaryBtn:hover { transform: translateY(-1px); }
.primaryBtn:disabled { opacity: .65; cursor: wait; transform: none; }

.modalOpen { overflow: hidden; }
.modalBackdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(14px);
}
.modalBackdrop.hidden { display: none; }
.modalCard {
  position: relative;
  width: min(620px, 100%);
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,.55);
  background: rgba(255,255,255,.96);
  box-shadow: 0 28px 90px rgba(15,23,42,.32);
  padding: 22px;
}
.modalClose {
  position: absolute;
  right: 16px;
  top: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 14px;
  background: #f2f4f7;
  color: #344054;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}
.modalHeader {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding-right: 36px;
  margin-bottom: 18px;
}
.modalIcon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, #f97316, #ef4444);
  font-weight: 900;
  font-size: 22px;
}
.modalHeader h2 {
  margin: 0 0 4px;
  font-size: 24px;
  letter-spacing: -0.03em;
}
.modalHeader p {
  margin: 0;
  color: #667085;
  line-height: 1.45;
}
.reportForm { display: grid; gap: 12px; }
.reportForm label { display: grid; gap: 6px; }
.reportForm label span {
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}
.reportForm input, .reportForm textarea, .reportForm select {
  width: 100%;
  border: 1px solid rgba(15,23,42,.14);
  border-radius: 16px;
  padding: 12px 13px;
  outline: none;
  background: #ffffff;
  color: #101827;
  font: inherit;
}
.reportForm textarea { resize: vertical; min-height: 120px; }
.reportForm input:focus, .reportForm textarea:focus, .reportForm select:focus {
  border-color: rgba(100,91,255,.65);
  box-shadow: 0 0 0 4px rgba(100,91,255,.12);
}
.reportStatus {
  min-height: 20px;
  color: #667085;
  font-weight: 700;
  line-height: 1.4;
}
.reportStatus.success { color: #0f9f6e; }
.reportStatus.error { color: #d92d20; }
.modalActions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.dataRefreshNotice {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: center;
  width: min(430px, calc(100vw - 36px));
  padding: 14px 16px;
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 18px;
  color: #1d2939;
  background: rgba(255,255,255,.96);
  box-shadow: 0 18px 52px rgba(15,23,42,.24);
  backdrop-filter: blur(18px);
}
.dataRefreshNotice.hidden { display: none; }
.dataRefreshNotice b {
  display: block;
  margin-bottom: 2px;
  font-size: 14px;
}
.dataRefreshNotice span {
  display: block;
  color: #667085;
  font-size: 13px;
  line-height: 1.35;
}
.dataRefreshNotice.success { border-color: rgba(15,159,110,.25); }
.dataRefreshNotice.success b { color: #0f9f6e; }
.dataRefreshNotice.error { border-color: rgba(217,45,32,.25); }
.dataRefreshNotice.error b { color: #d92d20; }
.noticeSpinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid #e0e7ff;
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 620px) {
  .modalCard { padding: 18px; border-radius: 22px; }
  .modalActions { justify-content: stretch; }
  .modalActions button { flex: 1; }
  .dataRefreshNotice { right: 10px; bottom: 10px; width: calc(100vw - 20px); }
}
