@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
  --bg-0: #f7f9ed;
  --bg-1: #f0f4dd;
  --card: #fffffc;
  --ink: #182018;
  --muted: #526054;
  --line: #d6decb;
  --accent: #da6b2e;
  --accent-2: #2f8f5b;
  --danger: #bf2f2f;
  --warn: #b87014;
  --ok: #2f8f5b;
  --shadow: 0 16px 38px rgba(43, 60, 43, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg-0), var(--bg-1));
}

.background-blobs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 999px;
  filter: blur(12px);
  opacity: 0.45;
}

.blob-a {
  width: 320px;
  height: 320px;
  left: -90px;
  top: -50px;
  background: #f2b769;
}

.blob-b {
  width: 280px;
  height: 280px;
  right: -70px;
  top: 120px;
  background: #7ec79f;
}

.blob-c {
  width: 240px;
  height: 240px;
  right: 30%;
  bottom: -80px;
  background: #dbd58c;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1160px;
  margin: 0 auto;
  padding: 32px 16px 48px;
}

.hero {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.08em;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
}

h1 {
  margin: 6px 0 8px;
  font-size: clamp(1.7rem, 3.5vw, 2.6rem);
}

.subtitle {
  margin: 0 0 16px;
  color: var(--muted);
  max-width: 720px;
}

.error-banner {
  margin: 0 0 12px;
  border: 1px solid #e8b5b5;
  background: #fff5f5;
  color: #862b2b;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.error-inline {
  border: 1px solid #e8b5b5;
  background: #fff5f5;
  color: #862b2b;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.86rem;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.controls input {
  width: 180px;
}

.grid {
  display: grid;
  gap: 14px;
}

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

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.one-col {
  grid-template-columns: 1fr;
  margin-bottom: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.stat h2 {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.stat-value {
  margin: 10px 0 0;
  font-size: 2rem;
  font-weight: 700;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

h2 {
  margin: 0;
  font-size: 1.1rem;
}

.subhead {
  margin: 14px 0 8px;
  font-size: 0.95rem;
}

.form {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 5px;
  font-size: 0.9rem;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.api-details {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 10px;
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.65);
}

.api-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
}

.camera-details {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.65);
}

.camera-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
}

.realtime-details {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 10px;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.65);
}

.realtime-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
}

.realtime-panel {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.realtime-fields {
  grid-template-columns: 1fr 1fr;
  align-items: center;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 0.86rem;
}

.checkline input {
  width: auto;
}

.realtime-log {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  max-height: 220px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.35;
  white-space: pre-wrap;
}

.realtime-log .line {
  margin: 0 0 6px;
}

.realtime-log .line:last-child {
  margin-bottom: 0;
}

.camera-panel {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.camera-video {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #111;
}

.camera-fields {
  grid-template-columns: 1fr 1fr;
}

.review-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.review-custom {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 6px;
  margin-top: 8px;
}

.review-custom input {
  min-width: 0;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
  opacity: 0.93;
}

.btn.secondary {
  background: var(--accent-2);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn.tiny {
  padding: 5px 8px;
  font-size: 0.78rem;
}

.btn.warn {
  background: var(--warn);
}

.list {
  display: grid;
  gap: 8px;
}

.item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: #fff;
}

.item-main {
  display: grid;
  gap: 4px;
}

.item .name {
  font-size: 0.96rem;
}

.meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.item-side {
  display: grid;
  gap: 6px;
  justify-items: end;
  align-content: center;
}

.badge {
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 3px 8px;
  font-weight: 700;
}

.badge.fresh {
  color: #fff;
  background: var(--ok);
}

.badge.expiring_soon {
  color: #fff;
  background: var(--warn);
}

.badge.expired {
  color: #fff;
  background: var(--danger);
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 12px;
}

@media (max-width: 980px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .review-custom {
    grid-template-columns: 1fr;
  }
}
