:root {
  color-scheme: light;
  --bg: #14081f;
  --surface: rgba(248, 244, 235, 0.92);
  --surface-strong: #fffaf2;
  --ink: #22180f;
  --muted: #6f5b42;
  --line: rgba(109, 83, 46, 0.18);
  --brand: #d4af37;
  --accent: #241732;
  --danger: #c33f5c;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
  --radius: 24px;
  font-family: "IBM Plex Sans", "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(212, 175, 55, 0.18), transparent 24%),
    radial-gradient(circle at bottom right, rgba(36, 23, 50, 0.22), transparent 28%),
    linear-gradient(180deg, #f6efe2 0%, #eadcc4 100%);
}

.global-loader[hidden] {
  display: none;
}

.global-loader {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background: rgba(20, 8, 31, 0.2);
  backdrop-filter: blur(4px);
}

.global-loader__panel {
  min-width: 220px;
  padding: 20px 22px;
  border-radius: 22px;
  background: var(--surface-strong);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  display: grid;
  justify-items: center;
  gap: 12px;
}

.global-loader__spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(36, 23, 50, 0.12);
  border-top-color: var(--brand);
  animation: app-spin 0.8s linear infinite;
}

.global-loader__text {
  color: var(--muted);
  font-size: 0.95rem;
}

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

.shell {
  min-height: 100vh;
}

.main {
  padding: 28px;
}

.app-header,
.page-header,
.panel-header,
.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.app-header {
  margin-bottom: 18px;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h2,
.panel h3 {
  margin: 0;
  font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.main {
  padding: 28px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
}

.status-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  box-shadow: var(--shadow);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.cards,
.stack,
.link-grid {
  display: grid;
  gap: 16px;
}

.cards {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 18px;
}

.stack {
  gap: 18px;
}

.metric-card,
.panel {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.metric-card {
  padding: 18px;
}

.metric-card .label {
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-card .value {
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
}

.panel {
  padding: 18px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar input {
  flex: 1 1 320px;
}

.toolbar select {
  flex: 0 0 180px;
}

.toolbar input,
.toolbar select,
.settings-grid input[type="text"],
.settings-grid input[type="number"],
.settings-grid input[type="email"],
.settings-grid input[type="color"],
.settings-grid select,
.request-grid input,
.request-grid textarea,
.request-grid select,
.reply-box,
.request-link-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  padding: 12px 14px;
  color: var(--ink);
}

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

.button:hover {
  transform: translateY(-1px);
}

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

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

.button-secondary {
  background: rgba(36, 23, 50, 0.08);
  color: var(--ink);
  border-color: rgba(36, 23, 50, 0.12);
}

.button-danger {
  color: #fff;
  background: linear-gradient(135deg, #b33150, #7a1535);
}

.table-wrap {
  overflow: auto;
}

.table-meta,
.helper-text,
.note,
.empty,
.muted {
  color: var(--muted);
}

.table-meta {
  margin-bottom: 14px;
  font-size: 0.92rem;
}

.helper-text {
  margin: 0 0 16px;
  font-size: 0.92rem;
}

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

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

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.rating {
  color: var(--accent);
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  background: rgba(36, 23, 50, 0.08);
  text-transform: capitalize;
}

.pill.pending {
  background: #fff7ed;
  color: #c2410c;
}

.pill.published {
  background: #ecfdf5;
  color: #047857;
}

.pill.rejected {
  background: #fef2f2;
  color: var(--danger);
}

.review-body {
  min-width: 320px;
}

.review-body p {
  margin: 12px 0 0;
  line-height: 1.55;
}

.review-meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 6px;
}

.review-actions {
  min-width: 260px;
  display: grid;
  gap: 10px;
}

.review-action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.reply-box {
  min-height: 96px;
  resize: vertical;
}

.checkbox-row,
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input,
.toggle input {
  width: auto;
  margin: 0;
}

.settings-panel {
  display: grid;
  gap: 18px;
}

.settings-section {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.38);
}

.settings-section legend {
  padding: 0 8px;
  font-weight: 700;
  color: var(--ink);
}

.settings-section .helper-text {
  margin: 8px 0 16px;
}

.settings-grid,
.request-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.settings-grid label,
.request-grid label {
  display: grid;
  gap: 8px;
}

.color-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
}

.color-input-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.color-input-controls.has-picker {
  grid-template-columns: minmax(0, 1fr) 52px;
}

.color-picker-input {
  width: 52px;
  min-width: 52px;
  height: 48px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.color-opacity-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.color-opacity-label,
.color-opacity-value {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.2;
}

.color-opacity-input {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
}

.color-opacity-value {
  min-width: 3rem;
  text-align: right;
}

.color-preview {
  --preview-color: transparent;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background-image:
    linear-gradient(var(--preview-color), var(--preview-color)),
    linear-gradient(45deg, rgba(36, 23, 50, 0.08) 25%, transparent 25%, transparent 75%, rgba(36, 23, 50, 0.08) 75%),
    linear-gradient(45deg, rgba(36, 23, 50, 0.08) 25%, transparent 25%, transparent 75%, rgba(36, 23, 50, 0.08) 75%);
  background-size: 100% 100%, 12px 12px, 12px 12px;
  background-position: 0 0, 0 0, 6px 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34);
}

.color-preview.is-invalid {
  border-color: var(--danger);
}

.color-preview.is-empty {
  opacity: 0.72;
}

.color-value {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.settings-note,
.request-note,
.request-result-card,
.link-card {
  border-radius: 18px;
  border: 1px solid var(--line);
}

.settings-note,
.request-note,
.request-result-card {
  background: rgba(255, 255, 255, 0.45);
}

.settings-note,
.request-note {
  padding: 14px 16px;
}

.settings-panel .actions,
.request-wide {
  grid-column: 1 / -1;
}

.request-search-row,
.request-link-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.request-search-row input {
  flex: 1 1 280px;
}

.request-result {
  margin-top: 18px;
}

.request-result-card {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
}

.request-link-input {
  flex: 1 1 420px;
}

.import-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.import-errors {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(36, 23, 50, 0.05);
}

.link-grid {
  margin: 18px 0;
}

.link-card {
  display: block;
  padding: 16px 18px;
  text-decoration: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
}

.link-card strong {
  display: block;
  margin-bottom: 6px;
}

.empty {
  padding: 18px 0;
}

.media-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.media-thumb {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
}

.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.prose h3 {
  margin: 0 0 8px;
}

.prose p {
  margin: 0 0 12px;
  line-height: 1.6;
}

code {
  padding: 0.1em 0.42em;
  border-radius: 8px;
  background: rgba(36, 23, 50, 0.08);
  color: var(--accent);
  font-size: 0.92em;
}

@keyframes app-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  .page-header {
    align-items: flex-start;
  }
}

@media (max-width: 768px) {
  .main {
    padding: 18px;
  }

  .app-header,
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar select,
  .request-link-row,
  .request-search-row {
    width: 100%;
  }

  .request-link-row,
  .request-search-row {
    flex-direction: column;
  }
}
