:root {
  color-scheme: light;
  color: #1d1d1f;
  background: #f8fafc;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 1rem;
}

body::before {
  content: "";
  display: block;
  height: 0;
}

img, svg {
  max-width: 100%;
}

button, input {
  font: inherit;
}

.banner {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.eyebrow {
  color: #475569;
  font-size: 0.95rem;
  margin: 0 0 0.25rem;
}

h1 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  margin: 0;
}

button {
  border: 1px solid #64748b;
  background: #fff;
  color: #0f172a;
  border-radius: 0.5rem;
  cursor: pointer;
  padding: 0.9rem 1.2rem;
}

button:hover,
button:focus-visible {
  outline: none;
  border-color: #0f172a;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.12);
}

button:focus-visible {
  outline: 2px solid #0f172a;
  outline-offset: 2px;
}

main {
  display: grid;
  gap: 1rem;
}

.summary-panel,
.cards,
.controls,
.table-container {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1rem;
}

.summary-panel {
  display: grid;
  gap: 1rem;
}

.summary-item {
  display: grid;
  gap: 0.25rem;
}

.summary-label {
  color: #475569;
  font-size: 0.95rem;
  margin: 0;
}

.summary-value {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.summary-note {
  color: #475569;
  font-size: 0.95rem;
}

.status-message {
  color: #0f172a;
  font-size: 0.95rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.status-card {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 1rem;
  text-align: left;
}

.status-card.has-value.status-good {
  background: #f0fdf4;
  border-color: #16a34a;
}

.status-card.has-value.status-expiring-soon {
  background: #fffbeb;
  border-color: #d97706;
}

.status-card.has-value.status-expired,
.status-card.has-value.status-error {
  background: #fef2f2;
  border-color: #dc2626;
}

.status-card.active,
.status-card:hover,
.status-card:focus-visible {
  background: #e2e8f0;
}

.status-card strong {
  display: block;
  font-size: 1.25rem;
}

.controls {
  display: grid;
  gap: 0.5rem;
}

.controls label {
  font-weight: 600;
}

.controls input {
  border: 1px solid #cbd5e1;
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  width: 100%;
}

.table-container {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 900px;
  width: 100%;
}

caption {
  caption-side: top;
  font-weight: 600;
  margin-bottom: 0.75rem;
  text-align: left;
}

th,
td {
  border-bottom: 1px solid #e2e8f0;
  padding: 0.9rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

th {
  color: #0f172a;
  font-weight: 700;
}

.sort-header {
  border: 0;
  border-radius: 0.25rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-weight: inherit;
  padding: 0.2rem;
  text-align: left;
}

.sort-header:hover,
.sort-header:focus-visible {
  background: #e2e8f0;
  box-shadow: none;
}

tbody tr {
  background: #fff;
}

tbody tr.good {
  border-left: 0.35rem solid #16a34a;
  background: #f0fdf4;
}

tbody tr.expiring-soon {
  border-left: 0.35rem solid #d97706;
  background: #fffbeb;
}

tbody tr.expired,
tbody tr.error {
  border-left: 0.35rem solid #dc2626;
  background: #fef2f2;
}

td:not(:first-child) {
  white-space: normal;
  word-break: break-word;
}

.details-content {
  color: #334155;
  font-size: 0.95rem;
  margin: 0.5rem 0 0;
}

details {
  margin-top: 0.5rem;
}

details summary {
  cursor: pointer;
  font-weight: 600;
}

.no-results {
  color: #475569;
  padding: 1rem;
}

.visually-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  white-space: nowrap;
}

.footer {
  color: #475569;
  font-size: 0.95rem;
  margin-top: 1rem;
}

@media (max-width: 720px) {
  .banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto;
    transition: none !important;
    animation: none !important;
  }
}
