/* MixCommerce Social — brand system.
   Flat colour only: no gradients anywhere, minimal shadow, restrained motion. */

:root {
  --primary: #1C3988;
  --primary-light: #488BFD;
  --primary-dark: #142a66;
  --background: #F1F6FC;
  --success: #67C27C;
  --warning: #E8A33D;
  --danger: #D6534A;
  --info: #488BFD;

  --surface: #FFFFFF;
  --surface-alt: #F7FAFE;
  --border: #E1E9F5;
  --border-strong: #CBD8ED;

  --text: #16233D;
  --text-muted: #5A6782;
  --text-subtle: #8A96AC;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(22, 35, 61, 0.06);
  --shadow: 0 2px 8px rgba(22, 35, 61, 0.08);

  --sidebar-width: 244px;
  --topbar-height: 60px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 12px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
h4 { font-size: 14.5px; }
p { margin: 0 0 12px; }

:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 2px; }

/* ---------- Layout ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--primary);
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 40;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 18px 20px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex; align-items: center; gap: 9px;
}
.sidebar-brand .mark {
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--primary-light);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.sidebar-section { padding: 14px 12px 4px; }
.sidebar-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.5); padding: 0 8px 6px; font-weight: 600;
}
.sidebar-nav { list-style: none; margin: 0; padding: 0 8px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  transition: background 0.12s ease;
}
.sidebar-nav a i { font-size: 16.5px; width: 18px; text-align: center; flex-shrink: 0; color: rgba(255, 255, 255, 0.65); }
.sidebar-nav a:hover i, .sidebar-nav a.active i { color: #fff; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, 0.1); text-decoration: none; color: #fff; }
.sidebar-nav a.active { background: var(--primary-light); color: #fff; font-weight: 500; }
.sidebar-nav .badge-count {
  margin-left: auto; background: rgba(255, 255, 255, 0.22);
  border-radius: 20px; padding: 1px 7px; font-size: 11px; font-weight: 600;
}
.sidebar-footer {
  margin-top: auto; padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 12.5px;
}

.main { flex: 1; margin-left: var(--sidebar-width); min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { margin: 0; font-size: 17px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.content { padding: 22px; flex: 1; max-width: 1400px; width: 100%; }

.page-head {
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.page-head .lead { color: var(--text-muted); margin: 0; font-size: 14px; }
.page-head-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-alt); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-sidebar { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }

/* ---------- Stats ---------- */

.stat { padding: 16px 18px; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 600; margin-top: 4px; letter-spacing: -0.02em; }
.stat-meta { font-size: 12.5px; color: var(--text-subtle); margin-top: 2px; }
.stat-value.unavailable { font-size: 15px; color: var(--text-subtle); font-weight: 500; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  font-size: 14px; font-weight: 500; font-family: inherit;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-alt); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 11px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ---------- Forms ---------- */

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.field .hint { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

.color-swatches { display: flex; gap: 6px; margin-top: 8px; }
.color-swatch { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border-strong); }

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit; font-size: 14px; color: var(--text);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(72, 139, 253, 0.14);
}
.textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-alt); color: var(--text-subtle); }

.password-field { position: relative; }
.password-field .input { padding-right: 42px; }
.password-toggle {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  border: none; background: transparent; border-radius: var(--radius-sm);
  color: var(--text-subtle); cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.password-toggle:hover { background: var(--surface-alt); color: var(--text-muted); }
.password-toggle:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 1px; }
.password-toggle .icon-off { display: none; }
.password-toggle.is-visible .icon-on { display: none; }
.password-toggle.is-visible .icon-off { display: inline-flex; }

.checkbox, .radio { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; margin-bottom: 8px; cursor: pointer; }
.checkbox input, .radio input { margin-top: 3px; accent-color: var(--primary); }

.inline-form { display: inline; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 180px; }

/* ---------- Tables ---------- */

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 10px 14px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-alt); }
.table-wrap { overflow-x: auto; }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  background: var(--surface-alt); color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-draft { background: #EEF2F8; color: #5A6782; border-color: #DDE5F1; }
.badge-scheduled { background: #E6F0FE; color: #2160C4; border-color: #CCE0FD; }
.badge-publishing { background: #FDF3E2; color: #A66A12; border-color: #F7E4C4; }
.badge-published { background: #E6F6EA; color: #35803F; border-color: #CDEBD6; }
.badge-partially_published { background: #FDF3E2; color: #A66A12; border-color: #F7E4C4; }
.badge-failed { background: #FCEBEA; color: #A8362E; border-color: #F5D3D0; }
.badge-cancelled { background: #EEF2F8; color: #8A96AC; border-color: #DDE5F1; }
.badge-pending_approval { background: #F0EBFB; color: #5B3FA8; border-color: #DFD5F5; }
.badge-connected { background: #E6F6EA; color: #35803F; border-color: #CDEBD6; }
.badge-expiring { background: #FDF3E2; color: #A66A12; border-color: #F7E4C4; }
.badge-expired, .badge-error, .badge-revoked { background: #FCEBEA; color: #A8362E; border-color: #F5D3D0; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- Platform chips ---------- */

.platform-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  background: var(--surface-alt); border: 1px solid var(--border);
}
.platform-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* ---------- Alerts ---------- */

.alert {
  padding: 11px 15px; border-radius: var(--radius-sm);
  margin-bottom: 16px; font-size: 14px;
  border: 1px solid transparent;
  display: flex; gap: 10px; align-items: flex-start;
  animation: alert-in 0.2s ease;
}
.alert-success { background: #E9F7ED; border-color: #C6E8D0; color: #2F7239; }
.alert-error, .alert-danger { background: #FCEDEC; border-color: #F3D2CF; color: #A0372F; }
.alert-warning { background: #FDF4E5; border-color: #F5E2C2; color: #8F6014; }
.alert-info { background: #E9F1FE; border-color: #CCE0FD; color: #1C3988; }
.alert-icon { flex-shrink: 0; display: flex; margin-top: 1px; }
.alert-body { flex: 1; }
.alert-close {
  flex-shrink: 0; border: none; background: transparent; color: inherit;
  opacity: 0.55; cursor: pointer; padding: 2px; margin: -2px -4px -2px 0;
  border-radius: var(--radius-sm); display: flex;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.alert-close:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }
.alert-close:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.alert.is-leaving { animation: alert-out 0.15s ease forwards; }
@keyframes alert-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes alert-out { to { opacity: 0; transform: translateY(-4px); } }

/* ---------- Empty states ---------- */

.empty { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty p { max-width: 420px; margin: 0 auto 16px; font-size: 14px; }

/* ---------- Auth ---------- */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--background); }
.auth-col { width: 100%; max-width: 420px; }
.auth-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px; box-shadow: var(--shadow);
  animation: auth-in 0.35s ease both;
}
.auth-card h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; font-weight: 600; font-size: 16px; color: var(--text); }
.auth-brand .mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  box-shadow: 0 0 0 4px rgba(28, 57, 136, 0.08);
}
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-subtle); font-size: 12.5px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-foot { margin-top: 22px; text-align: center; font-size: 13.5px; color: var(--text-muted); }
.auth-foot a, .auth-card .text-right a { color: var(--primary); font-weight: 600; text-decoration: none; transition: color 0.15s ease; }
.auth-foot a:hover, .auth-card .text-right a:hover { color: var(--primary-dark); text-decoration: underline; }
.recaptcha-field { display: flex; justify-content: center; margin: 4px 0 18px; }

@keyframes auth-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Composer ---------- */

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

.destination-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.destination {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13.5px;
}
.destination:hover { background: var(--surface-alt); }
.destination.selected { border-color: var(--primary-light); background: #F3F8FF; }
.destination input { accent-color: var(--primary); }
.destination .avatar { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; background: var(--surface-alt); }
.destination .meta { min-width: 0; }
.destination .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.destination .sub { font-size: 11.5px; color: var(--text-subtle); }

.char-counter { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.char-counter.warn { color: var(--warning); }
.char-counter.over { color: var(--danger); font-weight: 600; }

.ai-panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt); }
.ai-panel-head {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px;
}
.ai-panel-body { padding: 14px; }
.ai-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-actions .btn { font-size: 12.5px; padding: 5px 10px; }
.ai-result { margin-top: 12px; }
.ai-suggestion {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 8px; background: var(--surface);
  font-size: 13.5px; white-space: pre-wrap;
}
.ai-suggestion .apply { margin-top: 8px; }

.platform-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.platform-tab {
  padding: 8px 13px; border: none; background: none;
  border-bottom: 2px solid transparent; cursor: pointer;
  font-size: 13.5px; font-weight: 500; color: var(--text-muted);
  font-family: inherit; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.platform-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.platform-pane { display: none; }
.platform-pane.active { display: block; }

.capability-note {
  font-size: 12.5px; color: var(--text-muted);
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 11px; margin-bottom: 10px;
}

/* ---------- Calendar ---------- */

.calendar { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.calendar-head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-alt); border-bottom: 1px solid var(--border); }
.calendar-head div { padding: 9px 10px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); text-align: center; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-cell { min-height: 116px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; }
.calendar-cell:nth-child(7n) { border-right: none; }
.calendar-cell.other-month { background: var(--surface-alt); }
.calendar-cell.today { background: #F3F8FF; }
.calendar-date { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.calendar-cell.today .calendar-date { color: var(--primary); }
.calendar-event {
  display: block; padding: 4px 7px; margin-bottom: 3px;
  border-radius: 4px; font-size: 11.5px; line-height: 1.35;
  background: #E6F0FE; color: #1C3988;
  border-left: 3px solid var(--primary-light);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer;
}
.calendar-event:hover { text-decoration: none; }
.calendar-event.published { background: #E6F6EA; color: #35803F; border-left-color: var(--success); }
.calendar-event.failed { background: #FCEBEA; color: #A8362E; border-left-color: var(--danger); }
.calendar-event.draft { background: #EEF2F8; color: #5A6782; border-left-color: #A9B6CC; }

/* ---------- Library ---------- */

.library-nav { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.library-nav a {
  padding: 9px 14px; font-size: 14px; font-weight: 500; color: var(--text-muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.library-nav a:hover { color: var(--text); text-decoration: none; }
.library-nav a.active { color: var(--primary); border-bottom-color: var(--primary); }

.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; }
.library-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: border-color 0.12s ease;
}
.library-card:hover { border-color: var(--border-strong); }
.library-card .thumb { height: 152px; background: var(--surface-alt); object-fit: cover; width: 100%; display: block; }
.library-card .thumb-placeholder {
  height: 152px; background: var(--surface-alt); display: grid; place-items: center;
  color: var(--text-subtle); font-size: 13px; padding: 16px; text-align: center;
  border-bottom: 1px solid var(--border);
}
.library-card .body { padding: 14px; flex: 1; display: flex; flex-direction: column; }
.library-card .title { font-weight: 600; font-size: 14.5px; margin-bottom: 5px; }
.library-card .excerpt { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; flex: 1; }
.library-card .foot {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-subtle);
  border-top: 1px solid var(--border); padding-top: 10px; margin-top: auto;
}
.featured-flag {
  background: var(--primary); color: #fff; font-size: 10.5px; font-weight: 700;
  padding: 2px 7px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.05em;
}

/* ---------- Misc ---------- */

.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: 6px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.hidden { display: none !important; }

.avatar-sm { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: var(--surface-alt); }
.avatar-initials {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-light); color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}

.chart { width: 100%; height: 280px; }
.chart-sm { height: 220px; }

.pagination { display: flex; gap: 5px; align-items: center; justify-content: center; margin-top: 20px; }
.pagination a, .pagination span {
  padding: 6px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); font-size: 13.5px; background: var(--surface);
}
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filters .field { margin-bottom: 0; min-width: 150px; }

.progress { height: 6px; background: var(--border); border-radius: 20px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 20px; }
.progress-bar.over { background: var(--danger); }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.media-tile {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--surface); position: relative;
}
.media-tile img { width: 100%; height: 112px; object-fit: cover; display: block; }
.media-tile .placeholder { height: 112px; display: grid; place-items: center; background: var(--surface-alt); color: var(--text-subtle); font-size: 12px; }
.media-tile .info { padding: 7px 9px; font-size: 11.5px; color: var(--text-muted); }
.media-tile.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(28, 57, 136, 0.18); }

.media-visual { position: relative; }
.media-visual[data-video-url] { cursor: pointer; }
.media-visual::after {
  /* A faint scrim on hover so the play hint reads on both light and busy thumbnails. */
  content: ''; position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.08); opacity: 0; transition: opacity 0.15s ease;
  pointer-events: none;
}
.media-tile:hover .media-visual::after { opacity: 1; }

/* Decorative only — clicking anywhere on the thumbnail opens the preview, this just
   signals that up front. The actual click target is .media-visual itself. */
.media-play-hint {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(20, 20, 20, 0.55); color: #fff;
  display: grid; place-items: center; pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: background 0.15s ease, transform 0.15s ease;
}
.media-play-hint svg { margin-left: 2px; } /* optically centre the triangle */
.media-tile:hover .media-play-hint { background: var(--primary); transform: translate(-50%, -50%) scale(1.08); }

/* The one part of a video tile that still toggles selection — kept small and out of
   the way in the corner so it doesn't compete with the preview click target. */
.media-select-badge {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85); background: rgba(20, 20, 20, 0.4);
  color: transparent; display: grid; place-items: center; cursor: pointer; padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.media-select-badge:hover { border-color: #fff; }
.media-tile.selected .media-select-badge { background: var(--primary); border-color: var(--primary); color: #fff; }

.upload-progress {
  height: 4px; border-radius: 2px; background: var(--surface-alt);
  overflow: hidden; margin-bottom: 10px;
}
.upload-progress-bar {
  height: 100%; width: 0%; background: var(--primary);
  transition: width 0.2s ease;
}

.video-lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(9, 15, 33, 0.78);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.video-lightbox-box {
  position: relative;
  width: min(560px, 90vw);
  border-radius: calc(var(--radius) + 4px);
  /* A brand-coloured edge rather than a plain dark box, so the popup reads as this
     product's player and not a generic embed. */
  box-shadow: 0 0 0 1px var(--primary-light), 0 24px 60px rgba(0, 0, 0, 0.45);
}
.video-lightbox .video-js {
  /* fluid:true (set in composer.js) drives the actual sizing via its own padding-top
     technique off this element's width — don't fight it with a second aspect-ratio rule. */
  max-height: 66vh;
  border-radius: calc(var(--radius) + 4px); overflow: hidden;
}
/* video.js's own skin covers the player chrome; these bring it onto brand rather than
   leaving its default grey/white accents. */
.video-lightbox .vjs-big-play-button {
  border-radius: 50%; width: 2em; height: 2em; line-height: 2em;
  background-color: var(--primary); border-color: var(--primary);
}
.video-lightbox .vjs-big-play-button:hover { background-color: var(--primary-dark); border-color: var(--primary-dark); }
.video-lightbox .vjs-play-progress,
.video-lightbox .vjs-volume-level,
.video-lightbox .vjs-slider-bar { background-color: var(--primary-light); }
.video-lightbox .vjs-control-bar { background-color: rgba(9, 15, 33, 0.85); }
.video-lightbox-close {
  position: absolute; top: -14px; right: -14px; z-index: 1;
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--background);
  background: var(--primary); color: #fff; font-size: 16px;
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: background 0.15s ease, transform 0.15s ease;
}
.video-lightbox-close:hover { background: var(--primary-dark); transform: scale(1.08); }

.tag-input { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  background: var(--surface-alt); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 20px; font-size: 12px;
  display: inline-flex; align-items: center; gap: 5px;
}
.tag button { border: none; background: none; cursor: pointer; color: var(--text-subtle); padding: 0; font-size: 14px; line-height: 1; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; display: flex; gap: 10px; }
.timeline li:last-child { border-bottom: none; }

@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .composer-grid, .grid-sidebar { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .calendar-cell { min-height: 78px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
