:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --card: #ffffff;
  --ink: #111827;
  --muted: #687385;
  --line: #e5eaf1;
  --brand: #0f766e;
  --brand-2: #155e75;
  --good: #15803d;
  --warn: #b45309;
  --bad: #dc2626;
  --shadow: 0 18px 60px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 360px),
    var(--bg);
  color: var(--ink);
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 52px 0 64px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: 42px;
  line-height: 1.12;
  letter-spacing: 0;
}

.subtitle {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 150px;
  justify-content: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
}

.status-pill.ok .dot {
  background: var(--good);
}

.lookup-panel,
.card,
.metric {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.lookup-panel {
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 18px;
}

label {
  display: block;
  margin-bottom: 10px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.lookup-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
}

input {
  width: 100%;
  height: 46px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 15px;
  font-family: Consolas, "SFMono-Regular", monospace;
  outline: none;
}

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

button {
  height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--brand-2);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.ghost {
  background: #eef2f7;
  color: #334155;
}

button.ghost:hover {
  background: #e2e8f0;
}

.hint,
.error {
  margin: 10px 0 0;
  font-size: 13px;
}

.hint {
  color: var(--muted);
}

.error {
  color: var(--bad);
  min-height: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  border-radius: 8px;
  padding: 18px;
}

.metric.primary {
  background: linear-gradient(135deg, #0f766e, #155e75);
  color: #fff;
  border: 0;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric.primary span,
.metric.primary small {
  color: rgba(255, 255, 255, 0.78);
}

.metric strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 28px;
  line-height: 1;
}

.metric small {
  font-size: 13px;
}

.card {
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 18px;
}

.card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.card-title.compact {
  margin-bottom: 12px;
}

h2 {
  margin: 0 0 5px;
  font-size: 20px;
}

.card-title p {
  margin: 0;
  color: var(--muted);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.badge.active {
  background: #dcfce7;
  color: #166534;
}

.badge.expired,
.badge.exhausted {
  background: #fef3c7;
  color: #92400e;
}

.badge.disabled {
  background: #fee2e2;
  color: #991b1b;
}

.progress-wrap {
  margin-bottom: 18px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.progress div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #22c55e);
  transition: width 0.25s ease;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.info-grid div {
  min-width: 0;
  padding: 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.info-grid div:nth-child(3n) {
  border-right: 0;
}

.info-grid div:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.info-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.info-grid strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #1f2937;
  font-size: 14px;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f8fafc;
  color: #475569;
  font-weight: 800;
}

td {
  color: #263241;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  .hero {
    display: block;
  }

  h1 {
    font-size: 32px;
  }

  .status-pill {
    margin-top: 18px;
  }

  .lookup-row {
    grid-template-columns: 1fr;
  }

  .summary-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .info-grid div,
  .info-grid div:nth-child(3n),
  .info-grid div:nth-last-child(-n + 3) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .info-grid div:last-child {
    border-bottom: 0;
  }
}
