:root {
  --bg: #f6f1e8;
  --panel: rgba(255, 252, 247, 0.88);
  --ink: #1f2937;
  --muted: #5f6b7a;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #b45309;
  --danger: #b91c1c;
  --line: rgba(31, 41, 55, 0.12);
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
  --radius-lg: 24px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(180, 83, 9, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.18), transparent 32%),
    var(--bg);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar,
.footer,
.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 0 16px;
}

.brand {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.topnav {
  display: flex;
  gap: 16px;
  color: var(--muted);
}

.flash {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 16px;
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 600;
}

.flash-success {
  background: rgba(15, 118, 110, 0.12);
  color: var(--brand-dark);
}

.flash-error {
  background: rgba(185, 28, 28, 0.12);
  color: var(--danger);
}

.page {
  padding: 24px 0 64px;
}

.hero,
.result-head,
.admin-hero,
.empty-state,
.admin-card,
.table-card {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 28px;
  padding: 40px;
}

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

h1,
h2 {
  margin: 0 0 12px;
}

.hero h1,
.result-head h1,
.empty-state h1,
.admin-hero h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.06;
}

.hero-text,
.note-text,
.resource-meta,
.inline-note,
.footer,
.tip-list,
table {
  color: var(--muted);
}

.card-panel,
.admin-card,
.table-card,
.resource-card {
  padding: 24px;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stack-form input,
.stack-form textarea,
.stack-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font: inherit;
}

.stack-form button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.stack-form select[multiple] {
  min-height: 220px;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.primary-btn:hover,
.ghost-btn:hover,
.danger-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  border: 1px solid var(--line);
}

.danger-btn {
  background: rgba(185, 28, 28, 0.12);
  color: var(--danger);
}

.tip-list {
  margin: 18px 0 0;
  padding-left: 18px;
  line-height: 1.8;
}

.mono,
.hash-cell {
  font-family: "Consolas", "Courier New", monospace;
}

.result-head,
.admin-hero,
.empty-state {
  padding: 32px;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.result-actions,
.actions-cell {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.resource-grid,
.admin-grid {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}

.resource-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.resource-card {
  background: rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.resource-name {
  margin: 0 0 8px;
  font-weight: 700;
}

.admin-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.table-card {
  margin-top: 24px;
}

.filter-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
  padding: 18px 24px 0;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-field label {
  color: var(--ink);
  font-weight: 600;
}

.filter-field input,
.filter-field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font: inherit;
}

.filter-field-wide {
  min-width: min(100%, 280px);
}

.bulk-toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  padding: 18px 24px 0;
}

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

.bulk-check {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-weight: 600;
}

.bulk-check input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.bulk-hint {
  color: var(--muted);
  font-size: 0.92rem;
}

.bulk-actions button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 24px 24px 0;
}

.table-wrap {
  overflow-x: auto;
  padding: 18px 24px 24px;
}

.fixed-table-card .table-wrap {
  max-height: 460px;
  overflow: auto;
}

.fixed-table-card thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(255, 252, 247, 0.98);
  backdrop-filter: blur(12px);
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--ink);
}

.inline-fields {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 0.94rem;
}

.field-tip,
.empty-inline {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
}

.stat-box strong {
  font-size: 1.4rem;
}

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

.file-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.file-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

.file-option input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.file-option-name {
  color: var(--ink);
  word-break: break-all;
}

.file-option-meta {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.inline-note {
  margin: 6px 0 0;
}

.recent-codes {
  padding: 18px 24px 24px;
}

.recent-codes textarea {
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: inherit;
  font-family: "Consolas", "Courier New", monospace;
  resize: vertical;
}

.status-chip {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}

.status-active {
  color: var(--brand-dark);
  background: rgba(15, 118, 110, 0.12);
}

.status-off {
  color: var(--danger);
  background: rgba(185, 28, 28, 0.12);
}

.small-btn {
  min-height: 36px;
  padding: 0 14px;
}

.narrow-page {
  max-width: 720px;
}

.footer {
  padding: 0 0 28px;
  text-align: center;
}

@media (max-width: 860px) {
  .hero,
  .result-head,
  .topbar,
  .section-head {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .hero {
    padding: 28px;
  }

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

  .field-head,
  .topnav {
    align-items: flex-start;
    flex-direction: column;
  }

  .topnav {
    flex-wrap: wrap;
  }
}
