/* style.css — FunBaseballFacts Design Tokens + Components */

/* ====== TYPE SCALE ====== */
:root {
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.9rem  + 0.5vw,  1.125rem);
  --text-lg:   clamp(1.125rem, 0.95rem + 0.85vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1rem    + 1.5vw,  2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    5rem);
  --text-hero: clamp(3rem,     0.5rem  + 7vw,    8rem);

  /* SPACING */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* FONTS */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', 'Helvetica Neue', sans-serif;

  /* RADIUS */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* TRANSITIONS */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* CONTENT WIDTHS */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
  --content-full: 100%;
}

/* ====== LIGHT MODE ====== */
:root, [data-theme="light"] {
  --color-bg:               #faf5e8;
  --color-surface:          #fdf8ee;
  --color-surface-2:        #ffffff;
  --color-surface-offset:   #f3ecda;
  --color-surface-offset-2: #ebe4d0;
  --color-surface-dynamic:  #e2dbc7;
  --color-divider:          #d5ceb8;
  --color-border:           #c9c2ab;

  --color-text:             #1a2744;
  --color-text-muted:       #5a6478;
  --color-text-faint:       #9ba3b0;
  --color-text-inverse:     #faf5e8;

  --color-primary:          #1a2744;
  --color-primary-hover:    #253556;
  --color-primary-active:   #0f1a2e;
  --color-primary-highlight: #dde1ea;

  --color-accent:           #c62828;
  --color-accent-hover:     #a51e1e;
  --color-accent-active:    #8b1616;
  --color-accent-highlight: #f3d5d5;

  --color-gold:             #c9a84c;
  --color-gold-hover:       #b8952e;
  --color-gold-active:      #9a7d20;
  --color-gold-highlight:   #f0e8d0;

  --color-success:          #2e7d32;
  --color-success-hover:    #1b5e20;
  --color-success-highlight:#d4dfcc;

  --color-error:            #c62828;
  --color-error-hover:      #a51e1e;
  --color-error-highlight:  #f3d5d5;

  --color-warning:          #c9a84c;
  --color-warning-hover:    #b8952e;
  --color-warning-highlight:#f0e8d0;

  --color-blue:             #1565c0;
  --color-blue-highlight:   #d5e3f5;

  --shadow-sm: 0 1px 2px oklch(0.2 0.02 60 / 0.08);
  --shadow-md: 0 4px 12px oklch(0.2 0.02 60 / 0.1);
  --shadow-lg: 0 12px 32px oklch(0.2 0.02 60 / 0.14);
}

/* ====== DARK MODE ====== */
[data-theme="dark"] {
  --color-bg:               #0f1520;
  --color-surface:          #151d2b;
  --color-surface-2:        #1a2436;
  --color-surface-offset:   #1e293d;
  --color-surface-offset-2: #243044;
  --color-surface-dynamic:  #2c3a52;
  --color-divider:          #2c3a52;
  --color-border:           #384a66;

  --color-text:             #e8e2d4;
  --color-text-muted:       #8d95a5;
  --color-text-faint:       #5a6478;
  --color-text-inverse:     #0f1520;

  --color-primary:          #8facc8;
  --color-primary-hover:    #a5bee0;
  --color-primary-active:   #6d90b4;
  --color-primary-highlight:#1e293d;

  --color-accent:           #ef5350;
  --color-accent-hover:     #f06b69;
  --color-accent-active:    #d63c3a;
  --color-accent-highlight: #2e1a1a;

  --color-gold:             #e0c06a;
  --color-gold-hover:       #f0d080;
  --color-gold-active:      #c8a848;
  --color-gold-highlight:   #2e2810;

  --color-success:          #6daa45;
  --color-success-hover:    #4d8f25;
  --color-success-highlight:#1a2a14;

  --color-error:            #ef5350;
  --color-error-hover:      #f06b69;
  --color-error-highlight:  #2e1a1a;

  --color-warning:          #e0c06a;
  --color-warning-hover:    #f0d080;
  --color-warning-highlight:#2e2810;

  --color-blue:             #5591c7;
  --color-blue-highlight:   #1e293d;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.25);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.35);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:               #0f1520;
    --color-surface:          #151d2b;
    --color-surface-2:        #1a2436;
    --color-surface-offset:   #1e293d;
    --color-surface-offset-2: #243044;
    --color-surface-dynamic:  #2c3a52;
    --color-divider:          #2c3a52;
    --color-border:           #384a66;
    --color-text:             #e8e2d4;
    --color-text-muted:       #8d95a5;
    --color-text-faint:       #5a6478;
    --color-text-inverse:     #0f1520;
    --color-primary:          #8facc8;
    --color-primary-hover:    #a5bee0;
    --color-primary-active:   #6d90b4;
    --color-primary-highlight:#1e293d;
    --color-accent:           #ef5350;
    --color-accent-hover:     #f06b69;
    --color-accent-active:    #d63c3a;
    --color-accent-highlight: #2e1a1a;
    --color-gold:             #e0c06a;
    --color-gold-hover:       #f0d080;
    --color-gold-active:      #c8a848;
    --color-gold-highlight:   #2e2810;
    --color-success:          #6daa45;
    --color-success-hover:    #4d8f25;
    --color-success-highlight:#1a2a14;
    --color-error:            #ef5350;
    --color-error-hover:      #f06b69;
    --color-error-highlight:  #2e1a1a;
    --color-warning:          #e0c06a;
    --color-warning-hover:    #f0d080;
    --color-warning-highlight:#2e2810;
    --color-blue:             #5591c7;
    --color-blue-highlight:   #1e293d;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.25);
    --shadow-md: 0 4px 12px oklch(0 0 0 / 0.35);
    --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.45);
  }
}

/* ====== SKELETON LOADERS ====== */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--color-surface-offset) 25%, var(--color-surface-dynamic) 50%, var(--color-surface-offset) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* ====== LAYOUT ====== */
.container {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.container--narrow {
  max-width: var(--content-default);
}

/* ====== HEADER ====== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-divider);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-3);
  gap: var(--space-4);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.logo-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--color-text);
  flex-shrink: 0;
}

.logo-link svg {
  display: block;
}

.logo-wordmark {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.header-nav a, .header-nav button {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  transition: all var(--transition-interactive);
  text-decoration: none;
  white-space: nowrap;
}

.header-nav a:hover, .header-nav button:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

.header-nav a.active {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.x-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  transition: all var(--transition-interactive);
  text-decoration: none;
  white-space: nowrap;
}

.x-link:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

.theme-toggle {
  padding: var(--space-2);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.theme-toggle:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

/* Mobile header */
.mobile-menu-toggle {
  display: none;
  padding: var(--space-2);
  color: var(--color-text);
}

@media (max-width: 767px) {
  /* Hide the header nav + hamburger — replaced by bottom tab bar */
  .header-nav { display: none !important; }
  .mobile-menu-toggle { display: none !important; }
  .x-link .x-link-text { display: none; }
  .logo-wordmark { font-size: var(--text-xs); }

  /* Bottom tab bar */
  body { padding-bottom: 64px; }
}

/* ====== BOTTOM TAB BAR (mobile) ====== */
.bottom-tab-bar {
  display: none;
}
@media (max-width: 767px) {
  .bottom-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-top: 1px solid var(--color-divider);
    box-shadow: 0 -2px 12px oklch(0.2 0.02 60 / 0.08);
    z-index: 1000;
    height: 64px;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .bottom-tab-bar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.03em;
    transition: color var(--transition-interactive);
    padding: var(--space-2) 0;
  }
  .bottom-tab-bar a svg {
    flex-shrink: 0;
  }
  .bottom-tab-bar a.active {
    color: var(--color-accent);
  }
  .bottom-tab-bar a:hover {
    color: var(--color-text);
  }
}

/* ====== HERO / TODAY SECTION ====== */
.hero-section {
  padding: clamp(var(--space-10), 6vw, var(--space-20)) 0;
  text-align: center;
}

.hero-date-label {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-gold);
  margin-bottom: var(--space-3);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.hero-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 50ch;
  margin-inline: auto;
}

/* ====== FACT CARDS ====== */
.facts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: var(--space-6);
  margin-top: var(--space-8);
}

.fact-card {
  background: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-interactive);
  cursor: pointer;
}

.fact-card:hover {
  box-shadow: var(--shadow-md);
  border-color: oklch(from var(--color-text) l c h / 0.15);
  border-left-color: var(--color-gold);
  transform: translateY(-2px);
}

.fact-card-image {
  background: var(--color-surface-offset);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 320px;
}

.fact-card-image img {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
}

.fact-card-body {
  padding: var(--space-5);
}

.fact-card-category {
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-gold);
  margin-bottom: var(--space-2);
}

.fact-card-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-2);
  line-height: 1.25;
}

.fact-card-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fact-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* ====== FACT DETAIL MODAL ====== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: oklch(from var(--color-bg) l c h / 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-interactive);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  transition: transform var(--transition-interactive);
}

.modal-overlay.open .modal-content {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
  z-index: 1;
}

.modal-close:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

.modal-image {
  background: var(--color-surface-offset);
  overflow: hidden;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 480px;
}

.modal-image img {
  width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: contain;
}

.modal-body {
  padding: var(--space-6);
}

.modal-body .fact-card-category { margin-bottom: var(--space-3); }
.modal-body .fact-card-title { font-size: var(--text-xl); margin-bottom: var(--space-4); }

.modal-body .fact-text {
  font-size: var(--text-base);
  color: var(--color-text);
  line-height: 1.7;
  margin-bottom: var(--space-4);
}

.modal-body .fact-meta {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* ====== EMPTY STATE ====== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--color-text-muted);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-4);
  color: var(--color-text-faint);
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.empty-state p {
  max-width: 40ch;
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}

/* ====== ARCHIVE PAGE ====== */
.page-header {
  padding: var(--space-8) 0 var(--space-6);
}

.page-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.page-description {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Filter chips */
.filter-chips {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
  cursor: pointer;
}

.chip:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.chip.active {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-8);
  padding-bottom: var(--space-8);
}

.pagination button {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
}

.pagination button:hover:not(:disabled) {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination .page-info {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  padding: 0 var(--space-3);
}

/* ====== ON THIS DAY ====== */
.date-picker-row {
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.date-picker-row .field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.date-picker-row label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.date-picker-row select {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  font-size: var(--text-sm);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235a6478'%3E%3Cpath d='M6 8.5L1 3.5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: var(--space-8);
  min-width: 140px;
}

/* ====== SEARCH ====== */
.search-wrapper {
  position: relative;
  max-width: 560px;
  margin-bottom: var(--space-6);
}

.search-wrapper input {
  width: 100%;
  padding: var(--space-3) var(--space-5);
  padding-left: var(--space-10);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  font-size: var(--text-sm);
  transition: all var(--transition-interactive);
}

.search-wrapper input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
}

.search-wrapper .search-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-faint);
  pointer-events: none;
}

/* ====== FOOTER ====== */
.site-footer {
  border-top: 1px solid var(--color-divider);
  padding: var(--space-10) 0;
  margin-top: var(--space-12);
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-4);
}

.footer-follow {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  color: var(--color-text);
}

.footer-follow a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-follow a:hover {
  color: var(--color-accent-hover);
}

.footer-about {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  max-width: 50ch;
}

.footer-attribution {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.footer-attribution a {
  color: var(--color-text-faint);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-attribution a:hover {
  color: var(--color-text-muted);
}

/* ====== ADMIN PANEL ====== */

/* Admin login */
.admin-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-20) var(--space-4);
}

.admin-login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}

.admin-login-card h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}

.admin-login-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

.form-group label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

.form-group input, .form-group textarea, .form-group select {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  font-size: var(--text-sm);
  transition: border-color var(--transition-interactive);
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
}

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

.form-error {
  font-size: var(--text-xs);
  color: var(--color-error);
  margin-top: var(--space-1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-interactive);
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn-primary:hover { background: var(--color-primary-hover); }

.btn-accent {
  background: var(--color-accent);
  color: #fff;
}
.btn-accent:hover { background: var(--color-accent-hover); }

.btn-success {
  background: var(--color-success);
  color: #fff;
}
.btn-success:hover { background: var(--color-success-hover); }

.btn-secondary {
  background: var(--color-surface-offset);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: var(--color-surface-offset-2); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  padding: var(--space-1) var(--space-3);
}
.btn-ghost:hover { background: var(--color-surface-offset); color: var(--color-text); }

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn:active {
  transform: scale(0.97);
}

.btn-full {
  width: 100%;
}

/* Admin layout */

.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: calc(100dvh - 60px);
}

.admin-sidebar {
  background: var(--color-surface);
  border-right: 1px solid var(--color-divider);
  padding: var(--space-4);
}

.admin-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  list-style: none;
}

.admin-sidebar-nav button {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
  text-align: left;
}

.admin-sidebar-nav button:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

.admin-sidebar-nav button.active {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}

.admin-main {
  padding: var(--space-6);
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-width: 767px) {
  
.admin-layout {
    grid-template-columns: 1fr;
  }
  .admin-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--color-divider);
    padding: var(--space-2) var(--space-4);
  }
  .admin-sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: var(--space-1);
  }
  .admin-sidebar-nav button {
    white-space: nowrap;
    font-size: var(--text-xs);
  }
  .admin-main {
    padding: var(--space-4);
  }
}

/* Stats cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
}

.stat-card-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-1);
}

.stat-card-value {
  font-size: var(--text-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--color-text);
}

/* Data table */
.data-table-wrapper {
  background: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
  gap: var(--space-3);
  flex-wrap: wrap;
}

.data-table-header h3 {
  font-size: var(--text-sm);
  font-weight: 600;
}

.data-table-filters {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

.data-table-filters select, .data-table-filters input {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  font-size: var(--text-xs);
}

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

.data-table thead th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--color-surface-offset);
  border-bottom: 1px solid var(--color-divider);
  position: sticky;
  top: 0;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--color-divider);
  transition: background var(--transition-interactive);
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: var(--color-surface-offset);
}

.data-table tbody td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  vertical-align: middle;
}

.data-table .td-subject {
  font-weight: 500;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table .td-num {
  font-variant-numeric: tabular-nums lining-nums;
  text-align: right;
}

@media (max-width: 767px) {
  .data-table-wrapper { overflow-x: auto; }
  .data-table { min-width: 600px; }
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
}

.badge-draft {
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
}

.badge-approved {
  background: var(--color-blue-highlight);
  color: var(--color-blue);
}

.badge-posted {
  background: var(--color-success-highlight);
  color: var(--color-success);
}

/* Admin editor modal */
.editor-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100vw);
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
}

.editor-panel.open {
  transform: translateX(0);
}

.editor-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
  flex-shrink: 0;
}

.editor-panel-header h3 {
  font-size: var(--text-sm);
  font-weight: 600;
}

.editor-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  overscroll-behavior: contain;
}

.editor-panel-footer {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-divider);
  flex-shrink: 0;
}

/* Editor backdrop */
.editor-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(from var(--color-bg) l c h / 0.5);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-interactive);
}

.editor-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Queue section */
.queue-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  transition: all var(--transition-interactive);
}

.queue-item:hover {
  box-shadow: var(--shadow-sm);
}

.queue-item-order {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-faint);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.queue-item-image {
  width: 80px;
  height: 60px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--color-surface-offset);
}

.queue-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.queue-item-info {
  flex: 1;
  min-width: 0;
}

.queue-item-info h4 {
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-text {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
  margin: var(--space-1) 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.queue-item-info p {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.queue-item-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
  align-items: center;
}

/* Section heading */
.section-heading {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Decorative divider */
.diamond-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-8) 0;
  color: var(--color-text-faint);
}

.diamond-divider::before,
.diamond-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-divider);
}

.diamond-divider svg {
  flex-shrink: 0;
}

/* Loading spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-divider);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-16);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.toast {
  padding: var(--space-3) var(--space-5);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  animation: toastIn 300ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastIn {
  to { opacity: 1; transform: translateY(0); }
}

.toast.toast-error {
  background: var(--color-error);
  color: #fff;
}

.toast.toast-success {
  background: var(--color-success);
  color: #fff;
}

/* Misc */
.text-muted { color: var(--color-text-muted); }
.text-faint { color: var(--color-text-faint); }
.text-accent { color: var(--color-accent); }
.text-gold { color: var(--color-gold); }
.font-display { font-family: var(--font-display); }
.font-tabnum { font-variant-numeric: tabular-nums lining-nums; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
