:root {
  --brand: #0a66ff;
  --brand-600: #0952cc;
  --text: #0b0c0f;
  --muted: #55637a;
  --border: #e6e8eb;
  --bg: #ffffff;
  --bg2: #f7f8fa;
  --bg-page: #f4f6fb;
  --danger: #e03131;
  --success: #2f9e44;
  --warning: #f08c00;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.12);
  --ring: 0 0 0 4px rgba(10, 102, 255, 0.16);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
  color: var(--text);
  background: var(--bg-page);
  line-height: 1.5;
}

.container a {
  color: inherit;
}

.container a:hover {
  color: var(--text);
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.9);
  backdrop-filter: saturate(150%) blur(8px);
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.04);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand {
  font-weight: 800;
  font-size: 18px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.nav-group {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
}

.nav-right {
  justify-content: flex-end;
}

.nav-auth {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.nav-user {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
}

.nav-badge-vip {
  color: #b45309;
  border-color: rgba(180, 83, 9, 0.25);
  background: rgba(180, 83, 9, 0.08);
}

.nav-msg {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.nav-msg-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  border: 2px solid var(--bg);
  display: none;
}

.nav-admin {
  color: var(--muted);
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav a:hover {
  background: var(--bg2);
  color: var(--text);
  transform: translateY(-1px);
}

.nav a.active {
  color: var(--brand);
  background: #eef4ff;
}

main.container {
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
  animation: pageFadeIn 0.4s ease-out;
}

@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.container h1 {
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-3);
}

.container h2 {
  font-size: 18px;
  margin: 0 0 var(--space-3);
  letter-spacing: -0.01em;
}

.container h3 {
  font-size: 16px;
  margin: 0 0 var(--space-2);
}

.section-title {
  font-weight: 700;
  color: var(--text);
  margin: 0 0 var(--space-2);
}

.footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: var(--space-6) 0;
  color: var(--muted);
  font-size: 14px;
}

/* Admin page: remove container max-width limit */
body[data-page="admin"] .container {
  max-width: none;
}

/* Hero & Swiper Styles */
.hero-swiper {
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  margin-top: 16px;
  margin-bottom: 24px;
}

.hero {
  padding: 80px 20px;
  text-align: center;
  background-size: cover;
  background-position: center;
  position: relative;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to bottom, rgba(244,246,251,0.9), rgba(244,246,251,0.6));
  z-index: 1;
}

.hero-slide-1 {
  background-image: url('/static/images/hero/hero-slide-1.jpg');
}

.hero-slide-2 {
  background-image: url('/static/images/hero/hero-slide-2.jpg');
}

.hero-slide-3 {
  background-image: url('/static/images/hero/hero-slide-3.jpg');
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--text);
  text-shadow: 0 2px 4px rgba(255,255,255,0.8);
}

.hero-desc {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 40px;
  font-weight: 500;
}

@media (max-width: 768px) {
  .hero {
    padding: 60px 20px;
    min-height: 320px;
  }
  .hero-title {
    font-size: 2rem;
  }
  .hero-desc {
    font-size: 1.1rem;
  }
  .hero-toolbar {
    flex-direction: column;
    gap: 12px;
  }
}

.hero-toolbar {
  justify-content: center;
  gap: 20px;
}

.swiper-button-next, .swiper-button-prev {
  color: var(--brand) !important;
  background: rgba(255,255,255,0.8);
  width: 48px !important;
  height: 48px !important;
  border-radius: 50%;
  backdrop-filter: blur(4px);
}

.swiper-button-next:after, .swiper-button-prev:after {
  font-size: 20px !important;
  font-weight: bold;
}

.swiper-pagination-bullet-active {
  background: var(--brand) !important;
}

.toolbar {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
  margin: var(--space-3) 0;
}

.toolbar-tight {
  margin: 0;
}

.input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  min-width: 0;
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input.input,
select.input {
  height: 40px;
}

textarea.input {
  padding: 12px 12px;
  min-height: 120px;
  resize: vertical;
}

.form {
  max-width: 480px;
  width: 100%;
}

.form .input {
  width: 100%;
}

.form input.input,
.form select.input {
  height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 15px;
}

.form textarea.input {
  border-radius: 12px;
  font-size: 14px;
}

.modal .input {
  width: 100%;
}

.input::placeholder {
  color: rgba(85, 99, 122, 0.88);
  opacity: 1;
}

.page-header .input::placeholder {
  color: rgba(255, 255, 255, 0.85);
}

.input:focus {
  outline: none;
  border-color: rgba(10, 102, 255, 0.45);
  box-shadow: var(--ring);
}

.btn, a.btn {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg2);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-weight: 650;
  transition: transform 120ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn[disabled], a.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn:hover, a.btn:hover {
  background: #eef1f6;
  transform: translateY(-1px);
  color: var(--text);
  text-decoration: none;
}

.btn-primary, a.btn-primary {
  border-color: transparent;
  background: linear-gradient(180deg, #1a73ff 0%, var(--brand) 100%);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(10, 102, 255, 0.22);
}

.btn-primary:hover, a.btn-primary:hover {
  background: linear-gradient(180deg, #1468f0 0%, var(--brand-600) 100%);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(10, 102, 255, 0.26);
}

.btn-ghost, a.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--brand);
  text-decoration: none;
}

.btn-ghost:hover, a.btn-ghost:hover {
  background: rgba(10, 102, 255, 0.05);
  color: var(--brand);
  text-decoration: none;
}

.btn-danger, a.btn-danger {
  border-color: transparent;
  background: linear-gradient(180deg, #fa5252 0%, var(--danger) 100%);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(224, 49, 49, 0.22);
}

.btn-danger:hover, a.btn-danger:hover {
  background: linear-gradient(180deg, #f03e3e 0%, #c92a2a 100%);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(224, 49, 49, 0.26);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 1.1rem;
  border-radius: 12px;
}

.btn-sm, a.btn-sm {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.btn-toggle.active {
  border-color: rgba(10, 102, 255, 0.35);
  background: rgba(10, 102, 255, 0.08);
  color: var(--brand);
}

.btn-group {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg2);
  flex-wrap: wrap;
}

.segmented.nowrap {
  flex-wrap: nowrap;
  overflow-x: auto;
}

.segmented.nowrap .btn {
  white-space: nowrap;
  flex: 0 0 auto;
}

.segmented .btn {
  border-radius: 10px;
}

.segmented .btn.active {
  border-color: rgba(10, 102, 255, 0.35);
  background: rgba(10, 102, 255, 0.08);
  color: var(--brand);
}

.input.is-invalid,
.modal .input.is-invalid {
  border-color: rgba(224, 49, 49, 0.7);
  box-shadow: 0 0 0 4px rgba(224, 49, 49, 0.12);
}

.segmented.is-invalid {
  border-color: rgba(224, 49, 49, 0.7);
  box-shadow: 0 0 0 4px rgba(224, 49, 49, 0.12);
}

.help {
  margin-top: 8px;
  color: rgba(85, 99, 122, 0.92);
  font-size: 13px;
  line-height: 1.35;
}

.checkbox-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.collapse {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 12px;
  overflow: hidden;
}

.collapse + .collapse {
  margin-top: var(--space-3);
}

.collapse-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 12px;
  background: var(--bg2);
  border: 0;
  cursor: pointer;
  font-weight: 750;
  text-align: left;
}

.collapse-body {
  padding: 12px;
}

.collapse[data-open="0"] .collapse-body {
  display: none;
}

.collapse-icon {
  transition: transform 160ms ease;
}

.collapse[data-open="0"] .collapse-icon {
  transform: rotate(-90deg);
}

.form-section {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 12px;
  padding: var(--space-3);
}

.form-section-title {
  font-weight: 700;
  margin: 0 0 var(--space-2);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.form-grid .label {
  margin-top: 0;
}

.form-grid .input {
  min-width: 0;
  width: 100%;
}

.md-editor {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
}

.md-editor-toolbar {
  padding: 10px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

.md-editor-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  padding: 12px;
}

.md-editor-preview {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--bg);
  min-height: 220px;
}

.md-toc {
  border: 1px solid var(--border);
  background: var(--bg2);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.md-toc-title {
  font-weight: 750;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.md-toc-items {
  display: grid;
  gap: 6px;
}

.md-toc-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  color: var(--text);
  text-align: left;
}

.md-toc-item:hover {
  border-color: rgba(10, 102, 255, 0.18);
  background: rgba(10, 102, 255, 0.06);
}

.md-editor[data-view="edit"] .md-editor-preview {
  display: none;
}

.md-editor[data-view="preview"] .md-editor-input {
  display: none;
}

.md-editor[data-view="split"] .md-editor-body {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

@media (max-width: 720px) {
  .md-editor[data-view="split"] .md-editor-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-msg {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg2);
  margin-top: var(--space-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.toast-error {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(224, 49, 49, 0.25);
  background: rgba(224, 49, 49, 0.06);
  color: var(--danger);
  box-shadow: var(--shadow);
}

.toast-success {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(47, 158, 68, 0.25);
  background: rgba(47, 158, 68, 0.06);
  color: var(--success);
  box-shadow: var(--shadow);
}

.section-label {
  margin-top: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

@media (max-width: 980px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 768px) {
  .topbar-inner {
    flex-direction: column;
    height: auto;
    padding: 12px 0;
    gap: 12px;
  }
  .nav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
  }
  .nav-group {
    justify-content: center;
  }
  .brand {
    margin-right: 0;
  }
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  background: var(--bg);
  box-shadow: var(--shadow);
  transition: transform 140ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(10, 102, 255, 0.18);
}

body[data-page="admin"] .card:hover,
body[data-page="admin_login"] .card:hover {
  transform: none;
  box-shadow: var(--shadow);
  border-color: var(--border);
}

.skeleton {
  background: linear-gradient(90deg, rgba(0,0,0,0.06) 0%, rgba(0,0,0,0.03) 20%, rgba(0,0,0,0.06) 40%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.skeleton-line {
  height: 14px;
  border-radius: 10px;
  margin: 10px 0;
}

.skeleton-pill {
  height: 18px;
  width: 88px;
  border-radius: 999px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.card h3 {
  margin: 0 0 var(--space-2);
  font-size: 18px;
}

.muted {
  color: var(--muted);
}

.list {
  display: grid;
  gap: var(--space-3);
}

.label {
  display: block;
  margin: 10px 0 6px;
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--space-4);
}

@media (max-width: 1000px) {
  .split {
    grid-template-columns: 1fr;
  }
}

.me-info-grid {
  display: grid;
  gap: 12px;
}

.me-info-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg2);
}

.me-info-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.me-info-label i {
  color: var(--muted);
}

.me-info-value {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 600;
}

@media (max-width: 640px) {
  .me-info-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .me-info-value {
    font-weight: 550;
  }
}

.code {
  white-space: pre-wrap;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  background: var(--bg2);
  min-height: 300px;
  overflow: auto;
}

.pager {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-3);
}

.admin-layout .pager {
  justify-content: flex-end;
}

.breadcrumb {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: var(--space-2) 0 var(--space-3);
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--bg2);
}

.badge-free {
  color: var(--success);
  border-color: rgba(47, 158, 68, 0.25);
  background: rgba(47, 158, 68, 0.06);
}

.badge-vip {
  color: #b45309;
  border-color: rgba(180, 83, 9, 0.25);
  background: rgba(180, 83, 9, 0.08);
}

.badge-success {
  color: var(--success);
  border-color: rgba(47, 158, 68, 0.25);
  background: rgba(47, 158, 68, 0.06);
}

.badge-danger {
  color: var(--danger);
  border-color: rgba(224, 49, 49, 0.25);
  background: rgba(224, 49, 49, 0.06);
}

.badge-warning {
  color: var(--warning);
  border-color: rgba(240, 140, 0, 0.25);
  background: rgba(240, 140, 0, 0.08);
}

.badge-info {
  color: var(--brand);
  border-color: rgba(10, 102, 255, 0.25);
  background: rgba(10, 102, 255, 0.06);
}

.table {
  width: 100%;
  min-width: 800px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.table th, .table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table td.table-empty {
  padding: 18px 12px;
  text-align: center;
  white-space: normal;
}

.table thead th {
  background: var(--bg2);
  color: var(--muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table tbody tr {
  transition: background 160ms ease;
}

.table tbody tr:nth-child(even) {
  background: #fbfcfe;
}

.table tbody tr:hover {
  background: #f1f5f9;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
}

.kpi {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  background: var(--bg);
  box-shadow: var(--shadow);
}

.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-4);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
}

.sider {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: var(--space-4);
  height: fit-content;
  position: sticky;
  top: 80px;
}

@media (max-width: 980px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .sider {
    position: static;
    top: 0;
  }
}

@media (max-width: 640px) {
  .kpis {
    grid-template-columns: 1fr;
  }
}

.sider-title {
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.menu {
  display: grid;
  gap: var(--space-2);
}

.menu-item {
  display: block;
  text-decoration: none;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
}

.menu-item:hover {
  background: var(--bg2);
}

.menu-item.active {
  background: #eef4ff;
  color: var(--brand);
}

.sider-footer {
  margin-top: var(--space-4);
}

.content {
  min-height: 60vh;
}

body[data-page="admin"] .content {
  min-height: 0;
}

body[data-page="admin"] .footer {
  display: none;
}

.admin-layout .content-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
  padding: var(--space-4);
}

.admin-layout .content-section .toolbar {
  margin: 0 0 var(--space-3);
}

.admin-layout .content-section .table-wrap {
  box-shadow: none;
}

.admin-layout .content-section .card {
  box-shadow: none;
}

.admin-layout .metric-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 96px;
}

.admin-layout .metric-label {
  font-size: 13px;
}

.admin-layout .metric-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.admin-layout .metric-sub {
  font-size: 13px;
}

.admin-layout .settings-card {
  padding: var(--space-4);
}

.admin-layout .settings-toolbar {
  gap: var(--space-2);
}

.admin-layout .settings-search {
  flex: 1;
  min-width: 220px;
}

.admin-layout .settings-nav {
  width: 100%;
}

.admin-layout .settings-nav .btn {
  white-space: nowrap;
}

.admin-layout #settingsGroups.is-tabs .settings-group {
  display: none;
}

.admin-layout #settingsGroups.is-tabs .settings-group.is-active {
  display: block;
}

.admin-layout .collapse-head-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.admin-layout .settings-group-title {
  font-weight: 800;
}

.admin-layout .settings-group-desc {
  font-weight: 550;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-layout .settings-group .collapse-head {
  gap: 10px;
}

.admin-layout .settings-checkbox {
  margin-top: 6px;
}

.admin-layout .settings-group-toolbar {
  margin: 0 0 var(--space-3);
  justify-content: flex-end;
  gap: var(--space-2);
}

.secret-textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  -webkit-text-security: disc;
}

.secret-textarea.is-revealed {
  -webkit-text-security: none;
}

.table td.td-actions {
  white-space: nowrap;
  overflow: visible;
}

.td-actions .btn-group {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.admin-layout #userTable {
  min-width: 0;
}

.admin-layout #userTable td.td-actions {
  white-space: nowrap;
}

.admin-layout #userTable .td-actions .btn-group {
  flex-wrap: nowrap;
}

.admin-layout .table td .btn,
.modal .table td .btn {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.upload-thumb {
  width: 56px;
  height: 40px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg2);
}

.upload-name {
  font-weight: 600;
  word-break: break-all;
}

.upload-url {
  font-size: 12px;
  word-break: break-all;
}

.auth-card {
  max-width: 520px;
  margin: 0 auto;
}

.auth-card-title {
  margin: 0 0 var(--space-3);
  font-size: 20px;
}

.auth-card-form {
  max-width: none;
}

.auth-card-actions {
  margin: var(--space-3) 0 0;
}

.auth-card-msg {
  margin-top: var(--space-2);
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.md {
  color: var(--text);
}

.md h1, .md h2, .md h3 {
  margin: 0 0 var(--space-2);
}

.md p {
  margin: 0 0 var(--space-3);
  color: var(--text);
}

.md code {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 6px;
}

.md .code code {
  background: transparent;
  border: none;
  padding: 0;
}

.md-img, .md-video {
  display: block;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg2);
  margin: var(--space-2) 0 var(--space-3);
}

.resource-card-cover {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg2);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  margin-bottom: var(--space-3);
}

.resource-card-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.resource-card-tags {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: var(--space-2) 0 var(--space-2);
}

.resource-detail-head {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  flex-wrap: wrap;
}

.resource-detail-cover {
  width: min(280px, 100%);
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg2);
  object-fit: cover;
}

.cover-picker-img {
  cursor: pointer;
  aspect-ratio: 16 / 9;
}

.cover-picker-img:hover {
  border-color: rgba(10, 102, 255, 0.35);
  box-shadow: 0 0 0 4px rgba(10, 102, 255, 0.12);
}

.cover-picker-img.is-placeholder {
  object-fit: contain;
  padding: 18px;
}

.resource-detail-meta {
  flex: 1 1 360px;
  min-width: 0;
}

.resource-detail-meta h1 {
  margin: 0 0 var(--space-2);
}

.resource-browser {
  padding-top: 0;
}

.resource-browser-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px) saturate(140%);
  box-shadow: 0 6px 16px rgba(16, 24, 40, 0.08);
}

.resource-browser #tree .card {
  padding: 12px 16px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: background-color 0.2s ease 0s, border-color 0.2s ease 0s, transform 0.2s ease 0s;
  border: 1px solid transparent;
  cursor: pointer;
  height: 40px;
  box-shadow: none;
}

.resource-browser #tree.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.resource-browser #tree .card > div {
  min-width: 0;
  white-space: nowrap;
}

.resource-browser #tree .card > div:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.resource-browser #tree .card > .muted {
  max-width: 52%;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.resource-browser #tree .card:hover {
  transform: translateY(-1px);
  background-color: rgba(14, 165, 233, 0.05);
  border-color: rgba(14, 165, 233, 0.2);
}

.resource-browser #tree .card.is-locked {
  opacity: 0.7;
}

.resource-browser #tree .card.is-locked:hover {
  transform: none;
}

.resource-browser .split {
  height: 500px;
  max-height: 500px;
  overflow: hidden;
}

.resource-browser .split > div {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.resource-browser #tree {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.resource-browser #fileContent {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.resource-browser #tree,
.resource-browser #fileContent {
  scrollbar-width: thin;
  scrollbar-color: rgba(16, 24, 40, 0.28) transparent;
}

.resource-browser #tree::-webkit-scrollbar,
.resource-browser #fileContent::-webkit-scrollbar {
  width: 10px;
}

.resource-browser #tree::-webkit-scrollbar-track,
.resource-browser #fileContent::-webkit-scrollbar-track {
  background: transparent;
}

.resource-browser #tree::-webkit-scrollbar-thumb,
.resource-browser #fileContent::-webkit-scrollbar-thumb {
  background: rgba(16, 24, 40, 0.28);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

.resource-browser #tree:hover::-webkit-scrollbar-thumb,
.resource-browser #fileContent:hover::-webkit-scrollbar-thumb {
  background: rgba(16, 24, 40, 0.38);
  border: 3px solid transparent;
  background-clip: padding-box;
}

@media (max-width: 1000px) {
  .resource-browser .split {
    height: auto;
    max-height: none;
    overflow: visible;
  }
}

.resource-browser .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.6;
}

.toolbar .input {
  min-width: 160px;
}

@media (max-width: 1000px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .sider {
    position: static;
    top: auto;
  }
  .toolbar .input {
    flex: 1;
    min-width: 0;
  }
}

.modal {
  max-height: 80vh;
}

#adminModalBody {
  max-height: 60vh;
  overflow: auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 24, 40, 0.6);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: var(--space-4);
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal {
  width: min(720px, 100%);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: 20px;
  background: var(--bg);
  box-shadow: 0 20px 40px rgba(16, 24, 40, 0.2);
  padding: 32px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal[data-size="sm"] {
  width: min(640px, 100%);
}

.modal[data-size="lg"] {
  width: min(1180px, 100%);
}

.modal .table-wrap {
  box-shadow: none;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.modal-title {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  display: flex;
  align-items: center;
}

.modal-title i {
  color: var(--brand);
  margin-right: 8px;
}

#adminModalBody, #repoModalBody {
  overflow: auto;
  flex: 1 1 auto;
  padding-right: 8px; /* for scrollbar */
}

/* Custom scrollbar for modal body */
#adminModalBody::-webkit-scrollbar, #repoModalBody::-webkit-scrollbar {
  width: 6px;
}
#adminModalBody::-webkit-scrollbar-thumb, #repoModalBody::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.res-form-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.modal[data-size="lg"] .res-form-layout {
  grid-template-columns: 360px minmax(0, 1fr);
  align-items: start;
}

.res-form-side,
.res-form-main {
  min-width: 0;
}

.res-form-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.collapse + .collapse {
  margin-top: 0;
}

.modal[data-size="sm"] .md-editor[data-view="split"] .md-editor-body {
  grid-template-columns: 1fr;
}
