/* === Design Tokens === */
:root {
  /* Brand Colors */
  --yellow: #FFB300;
  --yellow-light: #FFD600;
  --yellow-dark: #FF8F00;
  --yellow-bg: #FFF3CD;
  --yellow-bg-light: #FFFDE7;

  /* Neutrals */
  --ink: #1A1A2E;
  --ink-med: #2D3561;
  --ink-body: #4B5378;
  --gray: #6B7280;
  --gray-light: #94A3B8;
  --gray-lighter: #D1D5DB;
  --gray-border: #E5E7EB;
  --white: #FFFFFF;
  --bg-section: #FAFAFA;
  --bg-page: #F5F6FA;

  /* Semantic */
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --success: #10B981;
  --success-bg: #ECFDF5;
  --info: #3B82F6;
  --info-bg: #EFF6FF;
  --warning: #F59E0B;

  /* Spacing (4px grid) */
  --sp-4: 4px;
  --sp-8: 8px;
  --sp-12: 12px;
  --sp-16: 16px;
  --sp-20: 20px;
  --sp-24: 24px;
  --sp-32: 32px;
  --sp-40: 40px;
  --sp-48: 48px;
  --sp-64: 64px;
  --sp-80: 80px;

  /* Font Sizes */
  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-base: 15px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;
  --fs-4xl: 38px;

  /* Line Heights */
  --lh-tight: 1.2;
  --lh-normal: 1.5;
  --lh-loose: 1.8;

  /* Font Weights */
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extrabold: 800;

  /* Border Radius */
  --br-sm: 4px;
  --br-md: 6px;
  --br-lg: 8px;
  --br-xl: 12px;
  --br-2xl: 16px;
  --br-full: 9999px;

  /* Shadows */
  --sh-sm: 0 1px 2px rgba(26, 26, 46, 0.06);
  --sh-md: 0 4px 12px rgba(26, 26, 46, 0.08);
  --sh-lg: 0 8px 24px rgba(26, 26, 46, 0.12);
  --sh-gold: 0 4px 16px rgba(255, 179, 0, 0.2);

  /* Transitions */
  --tr-fast: 150ms ease;
  --tr-normal: 200ms ease;
  --tr-slow: 300ms ease;
  --tr-modal: 400ms ease;

  /* Layout */
  --sidebar-w: 260px;
  --header-h: 64px;
  --content-max: 1400px;
}

/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--ink-body);
  background: var(--bg-page);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
ul, ol { list-style: none; }

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* === Focus === */
:focus-visible {
  outline: 2px solid var(--yellow-dark);
  outline-offset: 2px;
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-lighter); border-radius: var(--br-full); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-light); }

/* === Header === */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-24);
  box-shadow: var(--sh-md);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  color: var(--white);
}

.header-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--yellow), var(--yellow-dark));
  border-radius: var(--br-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-lg);
}

.header-logo .logo-dot {
  color: var(--yellow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-16);
}

.header-btn {
  padding: var(--sp-8) var(--sp-16);
  border-radius: var(--br-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transition: all var(--tr-fast);
  color: var(--gray-light);
}

.header-btn:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

.header-btn.active {
  color: var(--yellow);
  background: rgba(255, 179, 0, 0.12);
}

.header-btn-icon {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
}

/* === Layout === */
.app-layout {
  display: flex;
  max-width: var(--content-max);
  margin: 0 auto;
  min-height: calc(100vh - var(--header-h));
}

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--gray-border);
  padding: var(--sp-20);
  overflow-y: auto;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
}

.sidebar-section {
  margin-bottom: var(--sp-24);
}

.sidebar-title {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-12);
  padding-left: var(--sp-4);
}

.category-list { display: flex; flex-direction: column; gap: var(--sp-4); }

.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-8) var(--sp-12);
  border-radius: var(--br-md);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: all var(--tr-fast);
  color: var(--ink-body);
}

.category-item:hover { background: var(--bg-page); }
.category-item.active {
  background: var(--yellow-bg);
  color: var(--yellow-dark);
  font-weight: var(--fw-semibold);
}

.category-item .count {
  font-size: var(--fs-xs);
  color: var(--gray-light);
  background: var(--bg-page);
  padding: 2px var(--sp-8);
  border-radius: var(--br-full);
}

.category-item.active .count {
  background: var(--yellow-bg-light);
  color: var(--yellow-dark);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-8);
}

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-12);
  border-radius: var(--br-full);
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: all var(--tr-fast);
  border: 1px solid var(--gray-border);
  color: var(--ink-body);
  white-space: nowrap;
}

.tag-item:hover {
  border-color: var(--yellow);
  color: var(--yellow-dark);
}

.tag-item.active {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--white);
  font-weight: var(--fw-medium);
}

.tag-item .tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-stats {
  font-size: var(--fs-xs);
  color: var(--gray-light);
  text-align: center;
  padding-top: var(--sp-16);
  border-top: 1px solid var(--gray-border);
}

/* === Main Content === */
.main-content {
  flex: 1;
  padding: var(--sp-24);
  min-width: 0;
}

/* === Search Bar === */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  background: var(--white);
  border-radius: var(--br-xl);
  padding: var(--sp-12) var(--sp-20);
  box-shadow: var(--sh-sm);
  margin-bottom: var(--sp-24);
  border: 1px solid var(--gray-border);
  transition: all var(--tr-fast);
}

.search-bar:focus-within {
  border-color: var(--yellow);
  box-shadow: var(--sh-gold);
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: var(--fs-md);
  color: var(--ink);
  background: none;
}

.search-input::placeholder { color: var(--gray-light); }

.search-icon {
  font-size: var(--fs-xl);
  color: var(--gray-light);
  flex-shrink: 0;
}

.search-clear {
  padding: var(--sp-4);
  border-radius: 50%;
  color: var(--gray-light);
  transition: color var(--tr-fast);
  display: none;
  font-size: var(--fs-lg);
  line-height: 1;
}

.search-clear.visible { display: block; }
.search-clear:hover { color: var(--ink-body); }

/* === Toolbar === */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-20);
  flex-wrap: wrap;
  gap: var(--sp-12);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
}

.view-toggle {
  display: flex;
  background: var(--white);
  border-radius: var(--br-md);
  border: 1px solid var(--gray-border);
  overflow: hidden;
}

.view-btn {
  padding: var(--sp-8) var(--sp-12);
  font-size: var(--fs-sm);
  transition: all var(--tr-fast);
  color: var(--gray);
}

.view-btn.active { background: var(--yellow); color: var(--white); }
.view-btn:not(.active):hover { background: var(--bg-page); }

.result-count {
  font-size: var(--fs-sm);
  color: var(--gray);
}

/* === Sort === */
.sort-select {
  padding: var(--sp-8) var(--sp-12);
  border: 1px solid var(--gray-border);
  border-radius: var(--br-md);
  font-size: var(--fs-sm);
  background: var(--white);
  color: var(--ink-body);
  cursor: pointer;
  min-width: 120px;
}

.sort-select:focus { border-color: var(--yellow); }

/* === Grid View === */
.material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-20);
}

/* === List View === */
.material-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-12);
}

/* === Material Card (Grid) === */
.material-card {
  background: var(--white);
  border-radius: var(--br-xl);
  overflow: hidden;
  box-shadow: var(--sh-sm);
  border: 1px solid var(--gray-border);
  transition: all var(--tr-normal);
  cursor: pointer;
}

.material-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
  border-color: var(--yellow);
}

.card-thumb {
  position: relative;
  aspect-ratio: 16/10;
  background: var(--bg-page);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-thumb .thumb-placeholder {
  font-size: var(--fs-2xl);
  color: var(--gray-lighter);
}

.card-type-badge {
  position: absolute;
  top: var(--sp-8);
  right: var(--sp-8);
  padding: 2px var(--sp-8);
  border-radius: var(--br-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--white);
  pointer-events: none;
}

.card-type-badge.video { background: var(--info); }
.card-type-badge.image { background: var(--success); }
.card-type-badge.text { background: var(--warning); }

.card-body { padding: var(--sp-16); }

.card-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--ink);
  margin-bottom: var(--sp-8);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-desc {
  font-size: var(--fs-sm);
  color: var(--gray);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--sp-12);
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--gray-light);
}

.card-tags {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-top: var(--sp-8);
}

.card-tag {
  font-size: 10px;
  padding: 1px var(--sp-8);
  border-radius: var(--br-full);
  background: var(--bg-page);
  color: var(--gray);
}

/* === Material Row (List View) === */
.material-row {
  display: flex;
  align-items: center;
  gap: var(--sp-16);
  background: var(--white);
  border-radius: var(--br-lg);
  padding: var(--sp-16);
  box-shadow: var(--sh-sm);
  border: 1px solid var(--gray-border);
  transition: all var(--tr-fast);
  cursor: pointer;
}

.material-row:hover {
  border-color: var(--yellow);
  box-shadow: var(--sh-md);
}

.row-thumb {
  width: 80px;
  height: 56px;
  border-radius: var(--br-md);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
}

.row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.row-thumb .thumb-placeholder { font-size: var(--fs-xl); color: var(--gray-lighter); }

.row-info { flex: 1; min-width: 0; }
.row-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--ink); }
.row-desc { font-size: var(--fs-sm); color: var(--gray); margin-top: var(--sp-4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.row-meta {
  text-align: right;
  flex-shrink: 0;
}

.row-meta .row-date { font-size: var(--fs-xs); color: var(--gray-light); }
.row-meta .row-category { font-size: var(--fs-xs); color: var(--yellow-dark); font-weight: var(--fw-medium); }

/* === Empty State === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-80) var(--sp-24);
  text-align: center;
  color: var(--gray-light);
}

.empty-state .empty-icon {
  font-size: 64px;
  margin-bottom: var(--sp-20);
  opacity: 0.4;
}

.empty-state .empty-title {
  font-size: var(--fs-xl);
  color: var(--gray);
  margin-bottom: var(--sp-8);
}

.empty-state .empty-desc {
  font-size: var(--fs-sm);
  max-width: 400px;
}

/* === Detail Page === */
.detail-page {
  max-width: 900px;
  margin: 0 auto;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
  padding: var(--sp-8) var(--sp-16);
  border-radius: var(--br-md);
  font-size: var(--fs-sm);
  color: var(--gray);
  transition: all var(--tr-fast);
  margin-bottom: var(--sp-20);
}

.detail-back:hover { color: var(--yellow-dark); background: var(--yellow-bg); }

.detail-card {
  background: var(--white);
  border-radius: var(--br-xl);
  padding: var(--sp-32);
  box-shadow: var(--sh-sm);
  border: 1px solid var(--gray-border);
}

.detail-header { margin-bottom: var(--sp-24); }

.detail-title {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  color: var(--ink);
  margin-bottom: var(--sp-12);
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-16);
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  color: var(--gray);
}

.detail-meta-item {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.detail-body {
  margin-bottom: var(--sp-24);
  padding: var(--sp-20);
  background: var(--bg-page);
  border-radius: var(--br-lg);
}

.detail-body video {
  width: 100%;
  border-radius: var(--br-md);
  max-height: 500px;
}

.detail-body .detail-image {
  width: 100%;
  border-radius: var(--br-md);
  cursor: pointer;
}

.detail-body .detail-text {
  font-size: var(--fs-md);
  line-height: var(--lh-loose);
  color: var(--ink-body);
  white-space: pre-wrap;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-8);
  margin-bottom: var(--sp-24);
}

.detail-tag {
  padding: var(--sp-4) var(--sp-16);
  border-radius: var(--br-full);
  font-size: var(--fs-sm);
  background: var(--yellow-bg);
  color: var(--yellow-dark);
  font-weight: var(--fw-medium);
}

.detail-category-label {
  font-size: var(--fs-sm);
  color: var(--gray);
  margin-bottom: var(--sp-8);
}

.detail-category-value {
  display: inline-block;
  padding: var(--sp-8) var(--sp-16);
  border-radius: var(--br-md);
  background: var(--info-bg);
  color: var(--info);
  font-weight: var(--fw-medium);
  font-size: var(--fs-sm);
}

.detail-actions {
  display: flex;
  gap: var(--sp-12);
  padding-top: var(--sp-20);
  border-top: 1px solid var(--gray-border);
  margin-top: var(--sp-24);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
  padding: var(--sp-8) var(--sp-20);
  border-radius: var(--br-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  transition: all var(--tr-fast);
  min-height: 44px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--yellow);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--yellow-dark);
  transform: translateY(-1px);
  box-shadow: var(--sh-gold);
}

.btn-secondary {
  background: var(--white);
  color: var(--ink-body);
  border: 1px solid var(--gray-border);
}

.btn-secondary:hover {
  border-color: var(--yellow);
  color: var(--yellow-dark);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover { background: #DC2626; }

.btn-sm {
  padding: var(--sp-4) var(--sp-12);
  font-size: var(--fs-xs);
  min-height: 32px;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--br-md);
}

/* === Form === */
.form-group {
  margin-bottom: var(--sp-20);
}

.form-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--ink);
  margin-bottom: var(--sp-8);
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: var(--sp-12) var(--sp-16);
  border: 1px solid var(--gray-border);
  border-radius: var(--br-md);
  font-size: var(--fs-md);
  background: var(--white);
  transition: border-color var(--tr-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(255, 179, 0, 0.1);
  outline: none;
}

.form-textarea { min-height: 120px; resize: vertical; }
.form-hint { font-size: var(--fs-xs); color: var(--gray-light); margin-top: var(--sp-4); }

/* === Tag Input === */
.tag-input-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-8);
  padding: var(--sp-8);
  border: 1px solid var(--gray-border);
  border-radius: var(--br-md);
  background: var(--white);
  min-height: 44px;
  align-items: center;
}

.tag-input-wrapper:focus-within {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(255, 179, 0, 0.1);
}

.tag-input-wrapper .tag-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-12);
  border-radius: var(--br-full);
  font-size: var(--fs-xs);
  background: var(--yellow-bg);
  color: var(--yellow-dark);
  font-weight: var(--fw-medium);
}

.tag-chip .tag-remove {
  cursor: pointer;
  font-weight: var(--fw-bold);
  opacity: 0.6;
  font-size: var(--fs-sm);
  line-height: 1;
}

.tag-chip .tag-remove:hover { opacity: 1; }

.tag-input-inner {
  border: none;
  outline: none;
  flex: 1;
  min-width: 100px;
  font-size: var(--fs-sm);
  padding: var(--sp-4);
}

/* === File Upload Zone === */
.upload-zone {
  border: 2px dashed var(--gray-lighter);
  border-radius: var(--br-xl);
  padding: var(--sp-48);
  text-align: center;
  transition: all var(--tr-fast);
  cursor: pointer;
  background: var(--bg-page);
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--yellow);
  background: var(--yellow-bg-light);
}

.upload-zone .upload-icon { font-size: 48px; margin-bottom: var(--sp-16); }

.upload-zone .upload-text {
  font-size: var(--fs-md);
  color: var(--gray);
  margin-bottom: var(--sp-8);
}

.upload-zone .upload-hint {
  font-size: var(--fs-sm);
  color: var(--gray-light);
}

/* === Manage Pages (Categories/Tags) === */
.manage-page { max-width: 800px; margin: 0 auto; }
.manage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-24);
}

.manage-title {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  color: var(--ink);
}

.manage-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
}

.manage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-12) var(--sp-16);
  background: var(--white);
  border-radius: var(--br-md);
  border: 1px solid var(--gray-border);
  transition: all var(--tr-fast);
}

.manage-item:hover { border-color: var(--yellow); }

.manage-item-info { display: flex; align-items: center; gap: var(--sp-12); }

.manage-item-name { font-weight: var(--fw-medium); color: var(--ink); }

.manage-item-count { font-size: var(--fs-xs); color: var(--gray-light); }

.manage-item-actions { display: flex; gap: var(--sp-8); }

.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--tr-modal);
}

.modal {
  background: var(--white);
  border-radius: var(--br-xl);
  padding: var(--sp-32);
  max-width: 500px;
  width: 90%;
  box-shadow: var(--sh-lg);
  animation: slideUp var(--tr-modal);
}

.modal-title { font-size: var(--fs-xl); font-weight: var(--fw-bold); color: var(--ink); margin-bottom: var(--sp-20); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-12);
  margin-top: var(--sp-24);
}

/* === Image Lightbox === */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.9);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: fadeIn var(--tr-fast);
}

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--br-md);
}

.lightbox-close {
  position: absolute;
  top: var(--sp-24);
  right: var(--sp-24);
  color: var(--white);
  font-size: var(--fs-2xl);
  padding: var(--sp-8);
  cursor: pointer;
}

/* === Toast === */
.toast-container {
  position: fixed;
  top: calc(var(--header-h) + var(--sp-16));
  right: var(--sp-24);
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
}

.toast {
  padding: var(--sp-12) var(--sp-20);
  border-radius: var(--br-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  box-shadow: var(--sh-md);
  animation: slideInRight var(--tr-normal);
  max-width: 360px;
}

.toast.success { background: var(--success-bg); color: #065F46; border: 1px solid #A7F3D0; }
.toast.error { background: var(--danger-bg); color: #991B1B; border: 1px solid #FECACA; }
.toast.info { background: var(--info-bg); color: #1E40AF; border: 1px solid #BFDBFE; }

/* === Help Section === */
.help-section {
  background: var(--white);
  border-radius: var(--br-xl);
  padding: var(--sp-32);
  border: 1px solid var(--gray-border);
  margin-top: var(--sp-32);
}

.help-section h3 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--ink);
  margin-bottom: var(--sp-16);
}

.help-section p, .help-section li {
  font-size: var(--fs-sm);
  color: var(--ink-body);
  line-height: var(--lh-loose);
}

.help-section ul { padding-left: var(--sp-20); }
.help-section li { list-style: disc; margin-bottom: var(--sp-4); }

/* === Pagination === */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-8);
  margin-top: var(--sp-32);
}

.page-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--br-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  border: 1px solid var(--gray-border);
  background: var(--white);
  color: var(--ink-body);
  transition: all var(--tr-fast);
}

.page-btn:hover:not(:disabled) { border-color: var(--yellow); color: var(--yellow-dark); }
.page-btn.active { background: var(--yellow); border-color: var(--yellow); color: var(--white); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* === Animations === */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* === Responsive === */
@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  .material-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    position: relative;
    top: 0;
    height: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--gray-border);
  }

  .sidebar-collapsible { display: none; }
  .sidebar-collapsible.open { display: block; }

  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: var(--sp-8) 0;
  }

  .main-content { padding: var(--sp-16); }
  .material-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-12); }
  .search-bar { margin-bottom: var(--sp-16); }
  .toolbar { flex-direction: column; align-items: flex-start; }
  .material-row { flex-wrap: wrap; }
  .row-thumb { width: 100%; height: 160px; }
  .row-meta { text-align: left; width: 100%; margin-top: var(--sp-8); }

  .detail-card { padding: var(--sp-20); }
  .detail-title { font-size: var(--fs-2xl); }
}

@media (max-width: 480px) {
  .header { padding: 0 var(--sp-12); }
  .header-logo { font-size: var(--fs-md); }
  .header-btn { padding: var(--sp-4) var(--sp-8); font-size: var(--fs-xs); }
  .material-grid { grid-template-columns: 1fr; }
  .manage-header { flex-direction: column; gap: var(--sp-12); align-items: flex-start; }
}
