:root {
  --bg: #12100f;
  --panel: #1b1715;
  --panel-strong: #211c19;
  --line: #3b342f;
  --line-soft: #2a2420;
  --text: #f5f1ea;
  --muted: #b8aea3;
  --muted-2: #8f8479;
  --accent: #eb8a44;
  --accent-2: #f5c36b;
  --danger: #d95c5c;
  --success: #3fa66b;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(235, 138, 68, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(245, 195, 107, 0.12), transparent 24%),
    var(--bg);
  color: var(--text);
  font: 16px/1.5 "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a {
  color: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  padding: 28px;
  border-right: 1px solid var(--line-soft);
  background: rgba(16, 13, 12, 0.86);
  backdrop-filter: blur(10px);
}

.brand h1,
.page-header h2,
.panel h3,
.auth-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.02em;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 8px;
  margin-top: 32px;
}

.nav-link {
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: var(--panel);
  border-color: var(--line);
}

.logout-form {
  margin-top: 24px;
}

.main {
  padding: 32px;
}

.main-auth {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card,
.panel,
.stat-card {
  background: linear-gradient(180deg, rgba(33, 28, 25, 0.96), rgba(23, 19, 17, 0.96));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(480px, 100%);
  padding: 32px;
}

.auth-header p,
.page-header p,
.panel-header p,
.meta,
.field span,
.empty p {
  color: var(--muted);
}

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

.header-actions,
.toolbar,
.form-actions,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 20px 22px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 34px;
  font-family: Georgia, "Times New Roman", serif;
}

.stack {
  display: grid;
  gap: 20px;
}

.panel {
  padding: 20px;
}

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

.panel-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

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

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

.table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.actions-col {
  min-width: 340px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
}

.badge-success {
  background: rgba(63, 166, 107, 0.14);
  color: #8ce0af;
}

.badge-muted {
  background: rgba(184, 174, 163, 0.12);
  color: var(--muted);
}

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #21150d;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.button:hover {
  filter: brightness(1.03);
}

.button-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.button-danger {
  background: rgba(217, 92, 92, 0.16);
  border-color: rgba(217, 92, 92, 0.3);
  color: #ffb0b0;
}

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

.form-panel {
  max-width: 860px;
}

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

.field input,
.field textarea,
.field select {
  width: 100%;
  background: rgba(11, 9, 8, 0.9);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}

.field textarea {
  resize: vertical;
  min-height: 120px;
}

.checkbox {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.flash {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.flash-success {
  background: rgba(63, 166, 107, 0.16);
  color: #9ae6b4;
}

.flash-error {
  background: rgba(217, 92, 92, 0.16);
  color: #ffb0b0;
}

.empty {
  padding: 24px 8px 8px;
}

@media (max-width: 1120px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

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

@media (max-width: 720px) {
  .main,
  .sidebar {
    padding: 20px;
  }

  .page-header,
  .panel-header,
  .panel-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .actions-col {
    min-width: 240px;
  }
}

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

.field-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.icon-builder {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(240px, 300px) 1fr;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(11, 9, 8, 0.45);
}

.icon-preview-panel,
.icon-controls {
  display: grid;
  gap: 14px;
}

.icon-preview-card {
  display: grid;
  gap: 16px;
  align-content: start;
}

.icon-preview {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: rgba(11, 9, 8, 0.9);
  border: 1px solid var(--line);
  overflow: hidden;
}

.icon-preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.icon-preview-text {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 10px;
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.1;
  word-break: break-all;
}

.icon-preview-copy {
  display: grid;
  gap: 6px;
}

.icon-preview-copy p {
  margin: 0;
  color: var(--muted);
}

.field-group {
  display: grid;
  gap: 12px;
}

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

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

.helper-text.is-loading {
  color: var(--accent-2);
}

.helper-text.is-success {
  color: #8ce0af;
}

.helper-text.is-warning {
  color: #ffcf8b;
}

.site-form {
  position: relative;
}

.icon-fetch-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(18, 16, 15, 0.76);
  backdrop-filter: blur(10px);
}

.site-form.is-fetching .icon-fetch-overlay {
  display: grid;
}

.icon-fetch-dialog {
  width: min(460px, 100%);
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 14px 16px;
  align-items: center;
  padding: 24px;
  border: 1px solid rgba(245, 195, 107, 0.26);
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(245, 195, 107, 0.14), transparent 36%),
    linear-gradient(180deg, rgba(33, 28, 25, 0.98), rgba(15, 12, 10, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}

.icon-fetch-dialog strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 17px;
}

.icon-fetch-dialog p {
  margin: 0;
  color: var(--muted);
}

.icon-fetch-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(245, 195, 107, 0.18);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: icon-fetch-spin 0.85s linear infinite;
}

.icon-fetch-progress {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.icon-fetch-progress span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: icon-fetch-progress 1.25s ease-in-out infinite;
}

.site-form.is-fetching {
  cursor: wait;
}

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

@keyframes icon-fetch-progress {
  0% {
    transform: translateX(-120%);
  }

  50% {
    transform: translateX(82%);
  }

  100% {
    transform: translateX(250%);
  }
}

@media (max-width: 980px) {
  .icon-builder,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
