:root {
  --bg: #f7f1e6;
  --card: rgba(255, 252, 246, 0.92);
  --card-strong: #fffdfa;
  --ink: #243038;
  --accent: #0d7c73;
  --accent-2: #c78627;
  --accent-3: #8d6232;
  --line: #e7dac4;
  --line-strong: #d8c2a0;
  --muted: #6f6d67;
  --shadow: 0 16px 40px rgba(17, 84, 76, 0.10);
  --shadow-soft: 0 10px 22px rgba(30, 34, 40, 0.06);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(900px 460px at 8% -6%, #ffe8c2, transparent),
    radial-gradient(980px 440px at 100% 0%, #d9efe7, transparent),
    linear-gradient(180deg, #fcf8f1 0%, #f7f1e6 100%);
  color: var(--ink);
}

.wrap {
  max-width: 1360px;
  margin: 28px auto 88px;
  padding: 0 24px;
}

.top {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(280px 180px at 85% 20%, rgba(13, 124, 115, 0.10), transparent),
    linear-gradient(135deg, rgba(255,255,255,0.92), rgba(255,249,239,0.88));
  backdrop-filter: blur(12px);
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.top-kicker {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(13, 124, 115, 0.10);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.top h1 {
  margin: 12px 0 8px;
  font-size: 32px;
  letter-spacing: .2px;
  line-height: 1.1;
}

.desc {
  color: var(--muted);
  font-size: 15px;
}

.top-tips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.tip-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(220, 199, 161, 0.9);
  color: #715228;
  font-size: 12px;
  font-weight: 600;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 18px 0 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid rgba(231, 218, 196, 0.88);
  border-radius: 18px;
  background: rgba(255, 250, 243, 0.82);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
}

.tab {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fffdfa 0%, #f5ecdc 100%);
  color: #77572e;
  padding: 10px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .18s ease;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.tab.active {
  background: linear-gradient(135deg, var(--accent), #15978b);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(13, 124, 115, 0.24);
}

.tab:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  color: #5b4323;
}

.panel {
  display: none;
  margin-top: 18px;
  background: var(--card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.panel.active { display: block; }

.panel h2 {
  margin: 0 0 8px;
  font-size: 25px;
  letter-spacing: .2px;
}

.panel-subtitle {
  margin: 24px 0 12px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: 15px;
  font-weight: 700;
  color: #654a25;
}

.panel-intro {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.split-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.category-sidebar {
  position: sticky;
  top: 88px;
  border: 1px solid rgba(231, 218, 196, 0.86);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(250,243,231,0.9));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.sidebar-head {
  padding: 14px;
  border-bottom: 1px solid rgba(231, 218, 196, 0.86);
  background: rgba(255, 249, 239, 0.8);
}

.sidebar-title {
  font-size: 14px;
  font-weight: 800;
  color: #694b22;
  margin-bottom: 10px;
}

.category-nav {
  max-height: 70vh;
  overflow: auto;
  padding: 8px;
}

.category-nav-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: #5d5248;
  box-shadow: none;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: relative;
}

.category-nav-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.category-nav-item:hover {
  transform: none;
  background: rgba(255, 249, 239, 0.92);
  border-color: rgba(220, 199, 161, 0.9);
}

.category-nav-item.active {
  background: linear-gradient(135deg, rgba(13,124,115,0.12), rgba(21,151,139,0.14));
  border-color: rgba(13, 124, 115, 0.28);
  color: #0d6b63;
  box-shadow: inset 0 0 0 1px rgba(13, 124, 115, 0.08), 0 8px 16px rgba(13, 124, 115, 0.10);
  padding-left: 16px;
}

.category-nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), #52b7ad);
}

.category-nav-item.active .category-nav-name::after {
  content: "已选中";
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(13, 124, 115, 0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.category-nav-name {
  font-weight: 700;
  word-break: break-all;
}

.category-nav-count {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.category-nav-count:empty {
  display: none;
}

.category-nav-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.mini-tag-live {
  background: rgba(13, 124, 115, 0.10);
  color: var(--accent);
}

.mini-tag-muted {
  background: rgba(120, 120, 120, 0.10);
  color: #7b776f;
}

.mini-tag-home {
  background: rgba(199, 134, 39, 0.12);
  color: #9a6817;
}

.mini-tag-diy {
  background: rgba(122, 92, 212, 0.12);
  color: #6a48b0;
}

.mini-tag-page {
  background: rgba(58, 125, 202, 0.12);
  color: #2f6aa8;
}

.mini-tag-current {
  background: rgba(29, 162, 98, 0.14);
  color: #17714a;
}

.split-main {
  min-width: 0;
}

.current-context {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(13, 124, 115, 0.08);
  border: 1px solid rgba(13, 124, 115, 0.16);
  color: #4e615c;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(13, 124, 115, 0.06);
}

.editor-card {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 253, 248, 0.82);
  box-shadow: 0 18px 40px rgba(201, 179, 142, 0.08);
}

.table tbody tr.row-selected {
  background: rgba(13, 124, 115, 0.08);
}

.table tbody tr.row-selected td {
  border-bottom-color: rgba(13, 124, 115, 0.14);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid rgba(231, 218, 196, 0.80);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(255,248,238,0.72));
}

.form-grid-cat,
.form-grid-popup {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.span-2,
.span-3,
.span-4 {
  grid-column: 1 / -1;
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 -2px;
  padding-top: 4px;
  color: #6f4f24;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  grid-column: 1 / -1;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(216, 194, 160, 0.85);
}

.form-section-title::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #65b8b0);
  box-shadow: 0 0 0 4px rgba(13, 124, 115, 0.10);
}

.form-grid label {
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #645a4c;
  font-weight: 600;
}

.form-grid > .actions {
  grid-column: 1 / -1;
  justify-content: flex-start;
  padding-top: 4px;
}

.field-help {
  grid-column: 1 / -1;
  margin: -4px 0 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(13, 124, 115, 0.06);
  border: 1px dashed rgba(13, 124, 115, 0.18);
  color: #5e665f;
  font-size: 12px;
  line-height: 1.7;
}

.field-help strong {
  color: #4e513b;
}

.form-editing-flash {
  animation: formEditingFlash 1.6s ease;
}

@keyframes formEditingFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(13, 124, 115, 0.00), var(--shadow);
  }
  18% {
    box-shadow: 0 0 0 4px rgba(13, 124, 115, 0.14), 0 14px 30px rgba(13, 124, 115, 0.12);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(13, 124, 115, 0.00), var(--shadow);
  }
}

input, select, textarea, button {
  font: inherit;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.96);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

select:invalid {
  color: var(--muted);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(13,124,115,0.12);
}

textarea {
  resize: vertical;
  min-height: 92px;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}

button {
  background: linear-gradient(135deg, var(--accent), #15978b);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(13,124,115,0.18);
  font-weight: 700;
}

button[type="button"] {
  background: linear-gradient(135deg, var(--accent-2), #e39a31);
}

button:hover {
  filter: brightness(1.02);
  transform: translateY(-1px);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  overflow: hidden;
  border: 1px solid rgba(231, 218, 196, 0.86);
  border-radius: 18px;
  background: rgba(255,255,255,0.88);
  box-shadow: var(--shadow-soft);
}

.table-scroll {
  overflow-x: auto;
  padding-bottom: 6px;
}

.table-scroll .table {
  min-width: 100%;
}

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

.table thead th {
  color: #756c5d;
  font-weight: 700;
  background: linear-gradient(180deg, #fff9ef, #f8efdf);
  position: sticky;
  top: 0;
  z-index: 1;
}

.table tbody tr:nth-child(even) {
  background: rgba(255, 249, 240, 0.42);
}

.table tbody tr:hover {
  background: #fff4e3;
}

.table a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}

.table a:hover {
  text-decoration: underline;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px !important;
  background: linear-gradient(180deg, rgba(255,252,246,0.9), rgba(250,243,231,0.9));
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-live {
  background: #dff5ea;
  color: #156c4d;
}

.status-waiting {
  background: #fff2d8;
  color: #8a5a12;
}

.status-ended {
  background: #f1f1f1;
  color: #6c6c6c;
}

.status-disabled {
  background: #fde5e5;
  color: #a33a3a;
}

.table img {
  width: 80px;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 6px 14px rgba(0,0,0,0.04);
}

.row {
  margin: 8px 0 12px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(231, 218, 196, 0.82);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.8), rgba(249,241,228,0.8));
}

.toolbar button {
  background: linear-gradient(135deg, var(--accent-3), #a9783f);
}

.inline-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}

.inline-label select {
  min-width: 160px;
}

.list-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  padding: 0 2px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  border: 1px solid var(--line);
  background:
    radial-gradient(160px 90px at 100% 0%, rgba(13,124,115,0.08), transparent),
    linear-gradient(180deg, #fffefa 0%, #faf1e2 100%);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow-soft);
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  margin-top: 6px;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.table .check-col {
  width: 36px;
}

.inline-sort {
  width: 84px;
}

.table-inline-input,
.table-inline-select {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font-size: 13px;
}

.table-inline-input:focus,
.table-inline-select:focus {
  outline: none;
  border-color: rgba(13, 124, 115, 0.4);
  box-shadow: 0 0 0 4px rgba(13, 124, 115, 0.08);
}

.table-actions {
  white-space: nowrap;
}

.table-actions button {
  margin-right: 6px;
}

.festival-range-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.festival-range-cell .inline-sort {
  width: 64px;
}

#category-table {
  min-width: 1640px;
}

#popup-table,
#festival-card-table,
#search-hot-table,
#user-upload-table {
  min-width: 1320px;
}

#category-table .category-name-input {
  min-width: 110px;
}

#category-table .category-desc-input {
  min-width: 180px;
}

#category-table .category-type-select,
#category-table .category-show-home-select,
#category-table .category-show-diy-select,
#category-table .category-show-page-select,
#category-table .category-enabled-select {
  min-width: 74px;
}

#category-table .category-mode-select {
  min-width: 118px;
}

#popup-table .popup-key-input,
#popup-table .popup-title-input,
#festival-card-table .festival-name-input,
#festival-card-table .festival-tag-input,
#search-hot-table .search-hot-keyword-input {
  min-width: 120px;
}

#search-hot-table .search-hot-note-input {
  min-width: 160px;
}

.upload-status {
  margin: 6px 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.progress {
  width: 240px;
  height: 10px;
  background: #efe7d9;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #4aa3a0);
  transition: width 0.2s ease;
}

.status-text {
  font-size: 13px;
  color: var(--muted);
}

.thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: none;
}

.failed-wrap {
  margin: 6px 0 16px;
}

.failed-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.failed-list {
  padding-left: 16px;
  margin: 0;
  font-size: 12px;
  color: #b00020;
}

@media (max-width: 900px) {
  .split-layout {
    grid-template-columns: 1fr;
  }
  .category-sidebar {
    position: static;
  }
  .form-grid,
  .form-grid-cat,
  .form-grid-popup {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
  .stats-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .wrap { padding: 0 16px; }
}

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .tabs { flex-wrap: wrap; }
  .stats-grid { grid-template-columns: 1fr; }
  .top h1 { font-size: 26px; }
  .panel { padding: 18px; }
  .table { display: block; overflow-x: auto; }
  .span-2, .span-3, .span-4 { grid-column: span 1; }
}
