/* ============================================================
   WV7 Instagram SaaS — app.css
   Font: Space Grotesk | Dark #0A0F2C | Cyan #00D4FF
   ============================================================ */

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

:root {
  --bg-dark:    #0A0F2C;
  --bg-card:    #111827;
  --bg-surface: #1a2340;
  --border:     #1E2A5E;
  --cyan:       #00D4FF;
  --cyan-dim:   rgba(0,212,255,.15);
  --text:       #F5F7FF;
  --text-muted: #6B7DB3;
  --green:      #10B981;
  --red:        #EF4444;
  --yellow:     #F59E0B;
  --purple:     #7C3AED;
  --sidebar-w:  240px;
  --radius:     10px;
  --shadow:     0 4px 24px rgba(0,0,0,.4);
}

html { font-size: 15px; }
body { font-family: 'Space Grotesk', sans-serif; background: var(--bg-dark); color: var(--text); line-height: 1.6; min-height: 100vh; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

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

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #080D22;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s;
}
.sidebar-brand { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav-logo svg { flex-shrink: 0; }
.nav-logo-text { font-size: 22px; font-weight: 700; color: #fff; letter-spacing: -0.5px; line-height: 1; }
.nav-logo-text .accent { color: var(--cyan); }
.sidebar-nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  color: var(--text-muted); font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-surface); color: var(--text); }
.nav-item.active { background: var(--cyan-dim); color: var(--cyan); }
.sidebar-footer { padding: 14px 12px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.user-pill { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--cyan-dim); color: var(--cyan); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.user-role { font-size: 11px; color: var(--text-muted); display: block; }
.btn-logout { color: var(--text-muted); padding: 6px; border-radius: 6px; transition: color .15s; flex-shrink: 0; }
.btn-logout:hover { color: var(--red); }

/* ── Topbar mobile ───────────────────────────────────────── */
.topbar { display: none; position: sticky; top: 0; z-index: 90; background: #080D22; border-bottom: 1px solid var(--border); padding: 0 16px; height: 56px; align-items: center; gap: 12px; }
.topbar-toggle { background: none; border: none; color: var(--text); cursor: pointer; padding: 4px; }
.topbar-title { font-weight: 600; font-size: 15px; }

/* ── Main content ────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 28px 32px 60px; max-width: 1280px; }

/* ── Auth ────────────────────────────────────────────────── */
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 40px; width: 100%; max-width: 420px; }
.auth-logo { margin-bottom: 24px; }
.auth-title { font-size: 22px; font-weight: 700; }
.auth-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 4px; margin-bottom: 28px; }

/* ── Cards ───────────────────────────────────────────────── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ── Stats grid ──────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon-blue  { background: rgba(99,102,241,.15); color: #818CF8; }
.stat-icon-green { background: rgba(16,185,129,.15);  color: var(--green); }
.stat-icon-cyan  { background: var(--cyan-dim);        color: var(--cyan); }
.stat-icon-red   { background: rgba(239,68,68,.15);    color: var(--red); }
.stat-value { font-size: 26px; font-weight: 700; display: block; }
.stat-label { font-size: 12px; color: var(--text-muted); display: block; }

/* ── Grid helpers ────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* ── Page header ─────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 8px; font-size: 14px; font-weight: 500; border: none; cursor: pointer; transition: all .15s; text-decoration: none; font-family: inherit; line-height: 1; }
.btn-primary  { background: var(--cyan); color: #0A0F2C; }
.btn-primary:hover { background: #00b8e0; }
.btn-ghost    { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-surface); color: var(--text); }
.btn-danger   { background: var(--red); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-success  { background: var(--green); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-warning  { background: var(--yellow); color: #111; }
.btn-warning:hover { background: #D97706; }
.btn-info     { background: #3B82F6; color: #fff; }
.btn-sm       { padding: 5px 12px; font-size: 12px; }
.btn-block    { width: 100%; justify-content: center; margin-top: 6px; }
.btn-group    { display: flex; gap: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.form-control {
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 10px 14px;
  font-size: 14px; font-family: inherit; width: 100%;
  transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-dim); }
.form-control::placeholder { color: var(--text-muted); }
.form-control-sm { padding: 6px 10px; font-size: 13px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-group { margin-bottom: 0; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.input-with-icon { position: relative; }
.input-with-icon .form-control { padding-right: 44px; }
.input-icon-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: rgba(16,185,129,.15); border: 1px solid rgba(16,185,129,.3); color: #6EE7B7; }
.alert-danger  { background: rgba(239,68,68,.15);  border: 1px solid rgba(239,68,68,.3);  color: #FCA5A5; }
.alert-warning { background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.3); color: #FCD34D; }
.alert-info    { background: rgba(0,212,255,.12);  border: 1px solid rgba(0,212,255,.3);  color: var(--cyan); }

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.badge-primary   { background: var(--cyan-dim);             color: var(--cyan);   }
.badge-success   { background: rgba(16,185,129,.15);        color: var(--green);  }
.badge-danger    { background: rgba(239,68,68,.15);         color: var(--red);    }
.badge-warning   { background: rgba(245,158,11,.15);        color: var(--yellow); }
.badge-info      { background: rgba(59,130,246,.15);        color: #60A5FA;       }
.badge-secondary { background: var(--bg-surface);           color: var(--text-muted); }

/* ── Tables ──────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 12px 16px; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); text-align: left; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255,255,255,.02); }
.table-actions { display: flex; gap: 6px; align-items: center; }
.row-active td { background: var(--cyan-dim) !important; }
.empty-state { text-align: center; color: var(--text-muted); padding: 40px 16px; font-size: 14px; }
.link-primary { color: var(--cyan); }
.link-primary:hover { text-decoration: underline; }

/* ── Pagination ──────────────────────────────────────────── */
.pagination { display: flex; justify-content: center; gap: 6px; padding: 16px; }
.page-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 6px; font-size: 13px; color: var(--text-muted); border: 1px solid var(--border); }
.page-btn:hover { background: var(--bg-surface); }
.page-btn.active { background: var(--cyan); color: #0A0F2C; border-color: var(--cyan); font-weight: 700; }

/* ── Search ──────────────────────────────────────────────── */
.search-form { display: flex; gap: 8px; }
.search-form .form-control { width: 280px; }

/* ── Plan bars ───────────────────────────────────────────── */
.plan-bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.plan-bar-label { width: 70px; font-size: 13px; }
.plan-bar-track { flex: 1; height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.plan-bar-fill  { height: 100%; background: var(--cyan); border-radius: 99px; transition: width .5s; }
.plan-bar-count { font-size: 13px; font-weight: 600; width: 24px; text-align: right; }

/* ── Log rows ────────────────────────────────────────────── */
.log-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.log-row:last-child { border-bottom: none; }
.log-badge { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.log-success { background: var(--green); }
.log-failed  { background: var(--red); }
.log-skipped { background: var(--text-muted); }
.log-msg  { flex: 1; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

/* ── Post list ───────────────────────────────────────────── */
.post-list { padding: 0 4px; }
.post-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.post-row:last-child { border-bottom: none; }
.post-thumb { width: 46px; height: 46px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.post-thumb-empty { width: 46px; height: 46px; border-radius: 6px; background: var(--bg-surface); display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; }
.post-row-info { flex: 1; min-width: 0; }
.post-row-account { font-size: 12px; color: var(--cyan); display: block; }
.post-row-caption { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.post-row-date { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

/* ── Published grid ──────────────────────────────────────── */
.published-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 16px; }
.published-card { border-radius: 8px; overflow: hidden; position: relative; aspect-ratio: 1; display: block; }
.published-img  { width: 100%; height: 100%; object-fit: cover; }
.published-img-empty { width: 100%; height: 100%; background: var(--bg-surface); display: flex; align-items: center; justify-content: center; color: var(--text-muted); aspect-ratio: 1; }
.published-meta { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,.8)); padding: 20px 8px 8px; display: flex; gap: 8px; font-size: 11px; }

/* ── Filters ─────────────────────────────────────────────── */
.filter-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-tab { padding: 6px 14px; border-radius: 6px; font-size: 13px; color: var(--text-muted); border: 1px solid var(--border); transition: all .15s; }
.filter-tab:hover { background: var(--bg-surface); }
.filter-tab.active { background: var(--cyan-dim); color: var(--cyan); border-color: var(--cyan); }

/* ── Section divider ─────────────────────────────────────── */
.section-divider { display: flex; align-items: center; gap: 12px; }
.section-divider::before, .section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.section-divider-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }

/* ── Post detail panel ───────────────────────────────────── */
.post-detail-panel { margin-bottom: 20px; }
.detail-images { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-thumb { width: 100px; height: 100px; object-fit: cover; border-radius: 8px; }
.detail-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 14px; }
.detail-caption { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 14px; line-height: 1.7; }

/* ── Metrics mini ────────────────────────────────────────── */
.metrics-mini { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.metric-item { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--text-muted); }
.metric-val  { font-size: 18px; font-weight: 700; color: var(--text); }

/* ── Plans grid ──────────────────────────────────────────── */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.plan-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.plan-card:hover { border-color: var(--cyan); }
.plan-inactive { opacity: .55; }
.plan-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.plan-name { font-size: 18px; font-weight: 700; }
.plan-price { font-size: 28px; font-weight: 700; color: var(--cyan); margin-bottom: 16px; }
.plan-price span { font-size: 14px; color: var(--text-muted); }
.plan-features { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.plan-features li { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-muted); }
.plan-features li svg { color: var(--cyan); flex-shrink: 0; }
.plan-meta { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--border); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 22px; line-height: 1; }
.modal-body { padding: 22px; }

/* ── Calendar ────────────────────────────────────────────── */
.calendar-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.calendar-month { font-size: 18px; font-weight: 700; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-header { padding: 10px; text-align: center; font-size: 12px; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.cal-cell { min-height: 90px; padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); overflow: hidden; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-empty { background: rgba(0,0,0,.1); }
.cal-today { background: var(--cyan-dim); }
.cal-day { display: inline-block; font-size: 13px; font-weight: 600; width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 50%; }
.cal-today .cal-day { background: var(--cyan); color: #0A0F2C; }
.cal-post { display: flex; align-items: center; gap: 4px; border-radius: 4px; padding: 2px 4px; margin-top: 4px; font-size: 11px; cursor: pointer; overflow: hidden; }
.cal-post-thumb { width: 16px; height: 16px; object-fit: cover; border-radius: 2px; flex-shrink: 0; }
.cal-post-time  { color: #fff; font-weight: 600; flex-shrink: 0; }
.cal-post-user  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgba(255,255,255,.7); }
.cal-post-scheduled        { background: #1E3A5F; border-left: 2px solid var(--cyan); }
.cal-post-published        { background: #064E3B; border-left: 2px solid var(--green); }
.cal-post-failed           { background: #7F1D1D; border-left: 2px solid var(--red); }
.cal-post-pending_approval { background: #451A03; border-left: 2px solid var(--yellow); }
.cal-post-draft            { background: var(--bg-surface); border-left: 2px solid var(--text-muted); }
.cal-post-approved         { background: #1E3A5F; border-left: 2px solid #60A5FA; }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--text-muted); }
.cal-leg-item { display: flex; align-items: center; gap: 6px; }
.cal-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

/* ── Accounts ────────────────────────────────────────────── */
.accounts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.account-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.account-inactive { opacity: .6; }
.account-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.account-avatar { width: 44px; height: 44px; border-radius: 12px; background: var(--cyan-dim); color: var(--cyan); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.account-info { flex: 1; min-width: 0; }
.account-meta { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }

/* ── Users perm grid ─────────────────────────────────────── */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.perm-item p { font-size: 13px; margin-top: 4px; }

/* ── Top posts ───────────────────────────────────────────── */
.top-posts { padding: 4px; }
.top-post-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.top-post-row:last-child { border-bottom: none; }
.top-rank { font-size: 18px; font-weight: 700; color: var(--cyan); width: 28px; flex-shrink: 0; }
.top-post-info { flex: 1; min-width: 0; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.top-post-metrics { display: flex; gap: 10px; font-size: 12px; color: var(--text-muted); flex-shrink: 0; }

/* ── Post editor (new-post) ──────────────────────────────── */
.post-editor { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
.post-editor .card { margin-bottom: 16px; }

/* ── Upload zone ─────────────────────────────────────────── */
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); min-height: 140px; cursor: pointer; transition: border-color .15s; }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--cyan); }
.upload-zone input[type=file] { display: none; }
.upload-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 32px 16px; color: var(--text-muted); text-align: center; min-height: 140px; }
.upload-preview { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; }
.upload-thumb { position: relative; }
.upload-thumb img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; }
.upload-thumb span { position: absolute; top: 3px; left: 3px; background: rgba(0,0,0,.7); color: #fff; font-size: 10px; font-weight: 700; width: 16px; height: 16px; border-radius: 4px; display: flex; align-items: center; justify-content: center; }

/* ── AI panel ────────────────────────────────────────────── */
.ai-btn { padding: 3px 8px; font-size: 11px; }
.ai-panel { position: fixed; right: 0; top: 0; bottom: 0; width: 380px; background: var(--bg-card); border-left: 1px solid var(--border); z-index: 150; flex-direction: column; padding: 0; overflow-y: auto; box-shadow: var(--shadow); }
.ai-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-card); }
#aiCaptionSection { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.ai-result { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.ai-text { font-size: 14px; line-height: 1.6; white-space: pre-wrap; max-height: 220px; overflow-y: auto; }
.ai-actions { display: flex; gap: 8px; margin-top: 12px; }
.ai-tones h4 { font-size: 13px; margin: 12px 0 8px; }
.tone-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-loading { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 14px; }
.ai-analysis h4 { color: var(--cyan); margin: 16px 0 6px; }
.ai-analysis p { font-size: 14px; color: var(--text-muted); line-height: 1.7; }

/* ── Spinner ─────────────────────────────────────────────── */
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--cyan); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Instagram Preview ───────────────────────────────────── */
.ig-preview { background: #fff; border-radius: 12px; color: #111; overflow: hidden; box-shadow: var(--shadow); position: sticky; top: 20px; }
.ig-preview-header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid #eee; }
.ig-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; }
.ig-preview-image { aspect-ratio: 1; background: #f5f5f5; overflow: hidden; }
.ig-preview-empty { width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; color: #bbb; font-size: 13px; }
.ig-preview-actions { display: flex; align-items: center; gap: 14px; padding: 10px 12px; }
.ig-preview-actions svg { stroke: #111; cursor: pointer; }
.ig-preview-caption { padding: 4px 12px 16px; font-size: 13px; line-height: 1.5; }

/* ── Text helpers ────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.d-block { display: block; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .topbar { display: flex; }
  .main-content { margin-left: 0; padding: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .post-editor { grid-template-columns: 1fr; }
  .ig-preview { position: static; margin-top: 16px; }
  .ai-panel { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .calendar-grid { font-size: 11px; }
  .cal-cell { min-height: 60px; padding: 4px; }
  .published-grid { grid-template-columns: repeat(2, 1fr); }
  .page-title { font-size: 18px; }
}
