/* Admin Panel Styles v2 — Sidebar layout */
:root {
  --color-bg:        #FAFAFA;
  --color-surface:   #FFFFFF;
  --color-border:    #E8E8E8;
  --color-muted:     #888;
  --color-fg:        #111;
  --color-accent:    #C9A86C;
  --color-accent-dk: #A88A50;
  --color-error:     #C53030;
  --color-success:   #166534;
  --color-changed:   #92400E;
  --color-changed-bg:#FEF3C7;
  --sidebar-w:       220px;
  --font:            'Inter', system-ui, sans-serif;
  --radius:          0.625rem;
  --shadow-card:     0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 0.9375rem;
  background: var(--color-bg);
  color: var(--color-fg);
  line-height: 1.6;
  min-height: 100vh;
}

:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
img { max-width: 100%; display: block; }

/* ── Login ──────────────────────────────────────────────────────────────── */
.admin-login {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 2rem;
  background: linear-gradient(135deg,#fff 0%,#F8F9FB 100%);
}
.admin-login__card {
  width: 100%; max-width: 400px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: 0 24px 60px rgba(0,0,0,.09);
}
.admin-login__brand { text-align: center; margin-bottom: 2rem; }
.admin-login__brand img { height: 44px; width: auto; margin: 0 auto 1.25rem; }
.admin-login__brand h1 { font-size: 1.375rem; font-weight: 600; margin-bottom: .375rem; }
.admin-login__brand p { font-size: .875rem; color: var(--color-muted); }
.login-form .field { margin-bottom: 1.125rem; }
.login-error {
  color: var(--color-error);
  background: #FEE2E2;
  border: 1px solid #FECACA;
  border-radius: .5rem;
  padding: .625rem .875rem;
  font-size: .875rem;
  margin-bottom: 1rem;
}

/* ── Dashboard layout ───────────────────────────────────────────────────── */
.admin-dashboard {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.dash-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform .25s ease;
}
.dash-sidebar__logo {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--color-border);
}
.dash-sidebar__logo img { height: 32px; width: auto; }

.dash-nav {
  flex: 1;
  overflow-y: auto;
  padding: .75rem 0;
}
.dash-nav__link {
  display: flex; align-items: center; gap: .625rem;
  padding: .6rem 1.25rem;
  font-size: .875rem; font-weight: 450; color: var(--color-muted);
  text-decoration: none;
  border-radius: 0;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.dash-nav__link svg { width: 16px; height: 16px; flex-shrink: 0; }
.dash-nav__link:hover { color: var(--color-fg); background: var(--color-bg); }
.dash-nav__link--active {
  color: var(--color-accent-dk);
  background: #FEF3E2;
  font-weight: 500;
  border-left: 2px solid var(--color-accent);
  padding-left: calc(1.25rem - 2px);
}

.dash-sidebar__footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--color-border);
  display: flex; flex-direction: column; gap: .5rem;
}
.dash-user-email {
  font-size: .75rem; color: var(--color-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Mobile header */
.dash-mobile-header {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  height: 52px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  align-items: center; justify-content: space-between;
  padding: 0 1rem;
  z-index: 110;
}
.dash-mobile-menu {
  background: none; border: none; cursor: pointer; color: var(--color-fg);
  padding: .375rem; display: flex; align-items: center;
}
.dash-mobile-menu svg { width: 20px; height: 20px; }
.dash-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 90;
}

/* Main content */
.dash-content {
  margin-left: var(--sidebar-w);
  flex: 1; min-width: 0;
  padding: 1.75rem 2rem 4rem;
  max-width: 860px;
}

/* Top bar */
.dash-topbar {
  display: flex; align-items: center; gap: 1rem; margin-bottom: 1.75rem;
  min-height: 36px;
}
.pending-indicator {
  display: flex; align-items: center; gap: .375rem;
  font-size: .8125rem; font-weight: 500;
  color: var(--color-changed);
  background: var(--color-changed-bg);
  border: 1px solid #FCD34D;
  border-radius: 2rem; padding: .25rem .75rem;
}
.pending-indicator svg { width: 14px; height: 14px; }
.pending-badge {
  font-size: .75rem; font-weight: 500; color: var(--color-changed);
  background: var(--color-changed-bg); border: 1px solid #FCD34D;
  border-radius: 1rem; padding: .15rem .6rem;
}
.preview-btn { margin-left: auto; }

/* ── Panels ──────────────────────────────────────────────────────────────── */
.dash-panel { display: block; }
.dash-panel[hidden] { display: none; }

.dash-panel__header { margin-bottom: 1.5rem; }
.dash-panel__header h2 {
  font-size: 1.125rem; font-weight: 600; margin-bottom: .25rem;
}
.dash-panel__header p { font-size: .875rem; color: var(--color-muted); }

/* Cards */
.dash-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.25rem;
}
.dash-card__title {
  font-size: .875rem; font-weight: 600; color: var(--color-muted);
  text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: 1.125rem;
}
.dash-divider { border: none; border-top: 1px solid var(--color-border); margin: 1.25rem 0; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.dash-form { display: flex; flex-direction: column; gap: 1rem; }

.field { display: flex; flex-direction: column; gap: .375rem; min-width: 0; }
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.field label {
  font-size: .8125rem; font-weight: 500; color: var(--color-fg);
  display: flex; align-items: baseline; gap: .25rem;
}
.field__hint { font-size: .75rem; font-weight: 400; color: var(--color-muted); }
.field input, .field textarea, .field select {
  width: 100%; padding: .5rem .75rem;
  font: inherit; font-size: .9rem;
  border: 1px solid var(--color-border);
  border-radius: .5rem;
  background: #FAFAFA;
  color: var(--color-fg);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(201,168,108,.15);
  background: var(--color-surface);
}
.field textarea { resize: vertical; min-height: 80px; }
.field__saved {
  font-size: .75rem; color: var(--color-muted);
  min-height: 1rem; transition: color .15s;
}
.field__saved--changed {
  color: var(--color-changed);
  background: var(--color-changed-bg);
  padding: .125rem .5rem;
  border-radius: .25rem;
  font-style: italic;
}

/* Milestone cards */
.milestone-group { display: flex; flex-direction: column; gap: .875rem; }
.milestone-card {
  display: flex; gap: 1rem; align-items: flex-start;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: .5rem;
  padding: 1rem;
}
.milestone-card__num {
  width: 28px; height: 28px; flex-shrink: 0;
  background: var(--color-accent);
  color: #fff; font-size: .8125rem; font-weight: 600;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-top: .125rem;
}
.milestone-card__fields { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

/* Hero image preview */
.hero-img-preview {
  width: 100%; aspect-ratio: 16/9; max-height: 220px;
  border-radius: .5rem; overflow: hidden;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  margin-bottom: 1rem;
  position: relative; display: flex; align-items: center; justify-content: center;
}
.hero-img-preview img {
  width: 100%; height: 100%; object-fit: cover;
}
.hero-img-preview__empty {
  font-size: .875rem; color: var(--color-muted);
  position: absolute;
}

/* File drop zone */
.file-drop {
  border: 1.5px dashed var(--color-border);
  border-radius: .5rem;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
  background: var(--color-bg);
}
.file-drop:hover, .file-drop--over {
  border-color: var(--color-accent);
  background: #FEF9F0;
}
.file-drop__input {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.file-drop__label {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  font-size: .875rem; color: var(--color-muted); pointer-events: none;
}
.file-drop__label svg { width: 28px; height: 28px; color: var(--color-accent); margin-bottom: .25rem; }
.file-drop__name {
  font-size: .8125rem; color: var(--color-muted);
  margin-top: .5rem;
}

/* Upload progress */
.upload-progress {
  display: flex; flex-direction: column; gap: .375rem;
}
.upload-progress__bar {
  height: 4px; background: var(--color-accent);
  border-radius: 2px;
  width: 0; transition: width .3s ease;
}
.upload-progress span { font-size: .8125rem; color: var(--color-muted); }

/* ── Gallery grid ─────────────────────────────────────────────────────────── */
.admin-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.admin-gallery__item {
  border: 1px solid var(--color-border);
  border-radius: .5rem; overflow: hidden;
  background: var(--color-bg);
  display: flex; flex-direction: column;
  transition: box-shadow .15s;
}
.admin-gallery__item:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.admin-gallery__item img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
}
.admin-gallery__meta {
  padding: .625rem .75rem;
  display: flex; flex-direction: column; gap: .5rem; flex: 1;
}
.admin-gallery__caption {
  font-size: .8rem; color: var(--color-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1;
}
.admin-gallery__delete {
  width: 100%;
}
.admin-section__hint {
  font-size: .875rem; color: var(--color-muted); padding: .5rem 0;
}

/* ── Social fields ────────────────────────────────────────────────────────── */
.admin-social-fields {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Each platform row */
.social-row {
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
}
.social-row:first-child { padding-top: 0; }
.social-row:last-child { border-bottom: none; padding-bottom: 0; }

.social-row__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .625rem;
}

.social-row__label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9375rem;
  font-weight: 500;
  color: var(--color-text);
}
.social-row__name { font-weight: 600; }

.social-row__url-field { margin-top: 0; }
.social-row__url-field--dim { opacity: .45; pointer-events: none; }
.social-row__url-field--dim input { cursor: not-allowed; }

/* ── Toggle switch ───────────────────────────────────────────────────────── */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.toggle-switch__input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
}

.toggle-switch__track {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  background-color: var(--color-border);
  border-radius: 9999px;
  transition: background-color .2s ease;
  flex-shrink: 0;
}
.toggle-switch__track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
  transition: transform .2s ease;
}

.toggle-switch__input:checked + .toggle-switch__track {
  background-color: #22c55e;
}
.toggle-switch__input:checked + .toggle-switch__track::after {
  transform: translateX(16px);
}

.toggle-switch__label {
  font-size: .8125rem;
  font-weight: 500;
  color: var(--color-muted);
  min-width: 3.5rem;
}
.toggle-switch__input:checked ~ .toggle-switch__label {
  color: #16a34a;
}

.social-icon { font-size: 1rem; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .375rem;
  font: 500 .875rem var(--font);
  padding: .5rem 1.25rem;
  border-radius: .5rem;
  border: none; cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s, opacity .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:disabled, .btn[aria-busy="true"] { opacity: .6; cursor: not-allowed; }
.btn--primary {
  background: var(--color-accent);
  color: #fff;
  align-self: flex-start;
}
.btn--primary:hover:not(:disabled) { background: var(--color-accent-dk); }
.btn--ghost {
  background: transparent; color: var(--color-muted);
  padding: .4rem .875rem;
}
.btn--ghost:hover { color: var(--color-fg); background: var(--color-bg); }
.btn--icon {
  display: inline-flex; align-items: center; gap: .375rem;
  font-size: .8125rem;
}
.btn--icon svg { width: 15px; height: 15px; }
.btn--danger-ghost {
  background: transparent;
  color: var(--color-error);
  border: 1px solid #FECACA;
  font-size: .8125rem;
  padding: .35rem .75rem;
}
.btn--danger-ghost:hover { background: #FEE2E2; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--color-fg); color: #fff;
  padding: .75rem 1.25rem;
  border-radius: .5rem;
  font-size: .875rem; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  z-index: 999;
  animation: toast-in .2s ease;
  max-width: 320px;
}
.toast--error { background: var(--color-error); }
.toast--success { background: var(--color-success); }
@keyframes toast-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .dash-sidebar {
    transform: translateX(-100%);
  }
  .dash-sidebar--open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,.12);
  }
  .dash-mobile-header { display: flex; }
  .dash-content {
    margin-left: 0;
    padding: 4.5rem 1rem 4rem;
  }
  .field-row { grid-template-columns: 1fr; }
  .milestone-card__fields { grid-template-columns: 1fr; }
  .admin-social-fields { grid-template-columns: 1fr; }
  .admin-gallery { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ── Shared small utilities ───────────────────────────────────────────────── */
.field--narrow { max-width: 120px; }

.btn--sm {
  padding: .3rem .75rem;
  font-size: .8125rem;
  height: auto;
  min-height: 0;
  gap: .3rem;
}
.btn--sm svg { width: 13px; height: 13px; }

.btn--danger {
  color: #dc2626;
}
.btn--danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

/* ── Tournaments table (admin) ─────────────────────────────────────────────── */

/* Card header row */
.tc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.tc-header .dash-card__title { margin: 0; }

/* Collapsible add-form */
.tc-add-panel {
  background: var(--color-background-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem 1rem;
  margin-bottom: 1.25rem;
}
.tc-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .625rem .875rem;
}
.tc-form__grid .field--narrow { grid-column: span 1; max-width: 120px; }
.tc-form__actions {
  display: flex;
  gap: .5rem;
  margin-top: .875rem;
}

/* State messages */
.tc-state {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 1.25rem 0;
  font-size: .875rem;
  color: var(--color-muted);
}
.tc-state--error { color: #b91c1c; }

/* Spinner */
.tc-spinner {
  width: 18px; height: 18px;
  animation: tc-spin .8s linear infinite;
  flex-shrink: 0;
}
@keyframes tc-spin { to { transform: rotate(360deg); } }

/* Table */
.tc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.tc-table th {
  text-align: left;
  padding: .5rem .75rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--color-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.tc-table td {
  padding: .75rem .75rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
.tc-table tbody tr:last-child td { border-bottom: none; }
.tc-table tbody tr:hover > td { background: var(--color-background-soft); }

/* Abbr badge */
.tc-abbr {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 .375rem;
  background: var(--color-background-soft);
  border: 1px solid var(--color-border);
  border-radius: .375rem;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--color-accent);
}

/* Title / meta / result stacked text */
.tc-title-en, .tc-meta-en, .tc-result-en {
  display: block;
  font-size: .875rem;
  color: var(--color-foreground);
  font-weight: 500;
}
.tc-title-ar, .tc-meta-ar, .tc-result-ar {
  display: block;
  font-size: .8125rem;
  color: var(--color-muted);
  direction: rtl;
}

/* Status badge */
.tc-badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 9999px;
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}

/* Actions column */
.tc-td-abbr { width: 52px; }
.tc-td-actions {
  width: 72px;
  white-space: nowrap;
}
.tc-td-actions .btn { padding: .3rem .45rem; }

/* Inline edit row */
.tc-edit-row td {
  background: var(--color-background-soft);
  padding: 1rem;
}
.tc-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .625rem .875rem;
  margin-bottom: .875rem;
}
.tc-edit-grid .field--narrow { max-width: 120px; }
.tc-edit-actions {
  display: flex;
  gap: .5rem;
}

/* Required asterisk */
.field__req { color: #b91c1c; margin-left: .125rem; }

@media (max-width: 640px) {
  .tc-form__grid, .tc-edit-grid { grid-template-columns: 1fr; }
  .tc-form__grid .field--narrow, .tc-edit-grid .field--narrow { max-width: 100%; }
  .tc-table th:nth-child(3),
  .tc-table td:nth-child(3),
  .tc-table th:nth-child(4),
  .tc-table td:nth-child(4) { display: none; }
}

/* ── Content Calendar ────────────────────────────────────────────────────────────────── */
.cal-card { padding: 1.25rem; }

.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.cal-month-nav {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.cal-month-nav h3 {
  font-size: 1.125rem;
  font-weight: 600;
  min-width: 140px;
  text-align: center;
}

.cal-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.cal-legend {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  font-size: .8125rem;
  color: var(--color-muted);
}

.cal-legend__item {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
}

.cal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.cal-legend__friday .cal-dot { background: #F59E0B; }
.cal-legend__saturday .cal-dot { background: #10B981; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .75rem;
  background: var(--color-surface);
}

.cal-weekday {
  text-align: center;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-muted);
  padding: .5rem 0;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  border-radius: .5rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: .875rem;
  font-weight: 500;
  color: var(--color-fg);
  cursor: pointer;
  min-height: 64px;
  position: relative;
}

.cal-day:hover {
  border-color: var(--color-accent);
}

.cal-day__preview {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: .5rem;
  padding: .5rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
  pointer-events: auto; /* Changed so items can be clicked */
  width: max-content;
  max-width: 320px;
}

.cal-day:hover .cal-day__preview,
.cal-day__preview:hover {
  opacity: 1;
  visibility: visible;
}

.cal-preview__item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem;
  background: var(--color-bg);
  border-radius: .375rem;
  cursor: pointer;
  transition: background 0.15s;
}

.cal-preview__item:hover {
  background: var(--color-border);
}

.cal-preview__item img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: .25rem;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
}

.cal-preview__type {
  font-size: .65rem;
  color: var(--color-muted);
  text-transform: uppercase;
}

.cal-day__add-btn {
  position: absolute;
  top: .25rem;
  right: .25rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
}

.cal-day:hover .cal-day__add-btn {
  opacity: 1;
  transform: scale(1);
}

.cal-day--other { opacity: .35; }
.cal-day--today {
  box-shadow: inset 0 0 0 2px var(--color-accent);
}

.cal-day--friday {
  background: #FFFBEB;
  border-color: #FCD34D;
}
.cal-day--saturday {
  background: #ECFDF5;
  border-color: #6EE7B7;
}

.cal-day__badge {
  font-size: .65rem;
  font-weight: 700;
  padding: .125rem .375rem;
  border-radius: 999px;
  background: rgba(0,0,0,.06);
  color: var(--color-fg);
}
.cal-day--friday .cal-day__badge { background: #FCD34D; }
.cal-day--saturday .cal-day__badge { background: #6EE7B7; }

.cal-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.cal-list-header h3 { font-size: 1rem; font-weight: 600; }

.cal-list-count {
  font-size: .8125rem;
  color: var(--color-muted);
}

.cal-table-wrap {
  width: 100%;
  overflow-x: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.cal-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: .875rem;
}

.cal-table th {
  text-align: left;
  padding: .75rem;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  background: #FAFAFA;
}

.cal-table td {
  padding: .75rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.cal-table tbody tr:last-child td { border-bottom: none; }
.cal-table tbody tr:hover td { background: #FAFAFA; }

.cal-table__platform {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .6875rem;
  font-weight: 600;
  padding: .25rem .625rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  white-space: nowrap;
  margin-bottom: .25rem;
  margin-right: .25rem;
}
.cal-table__platform svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}
.cal-table__platform--instagram { color: #E1306C; }
.cal-table__platform--x { color: var(--color-fg); }
.cal-table__platform--tiktok { color: #000; }
[data-theme="dark"] .cal-table__platform--tiktok { color: #fff; }

.cal-table__type {
  font-size: .75rem;
  color: var(--color-muted);
  white-space: nowrap;
}

.cal-table__caption {
  max-width: 360px;
  line-height: 1.45;
}

@media (max-width: 768px) {
  .cal-grid { gap: .25rem; padding: .5rem; }
  .cal-day { font-size: .75rem; min-height: 48px; }
  .cal-day__badge { font-size: .55rem; padding: .1rem .25rem; }
  .cal-toolbar { flex-direction: column; align-items: stretch; }
  .cal-actions { justify-content: stretch; }
  .cal-actions .btn { flex: 1; }
}

/* ── Content Calendar Modal ───────────────────────────────────────────────────────── */
.cal-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.cal-modal[hidden] {
  display: none !important;
}
.cal-modal__content {
  width: 100%;
  max-width: 850px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 1rem;
  background: var(--color-surface);
  padding: 2.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.cal-modal__layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
}
@media (max-width: 768px) {
  .cal-modal__layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}
.cal-modal__col {
  display: flex;
  flex-direction: column;
}
.cal-media-preview-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.cal-media-preview-item {
  aspect-ratio: 1;
  border-radius: 0.375rem;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-background);
}
.cal-media-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cal-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.cal-modal-close-btn {
  padding: .5rem;
  margin: -.5rem;
  color: var(--color-foreground);
  cursor: pointer;
}
.cal-modal-close-btn:hover {
  color: #000;
}
.cal-checkbox-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .5rem 0;
}
.cal-checkbox-group label {
  display: flex;
  align-items: center;
  gap: .375rem;
  font-weight: 500;
  cursor: pointer;
}
.cal-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}
.file-drop--sm {
  min-height: 80px;
  padding: 1rem;
}
.mt-2 { margin-top: .5rem; }


