/* ============================================================
   Affinis LinkedIn Content Tool — styles.css
   Brand: Deep Ocean Blue #1F3A5F / Slate Blue #4A6C8C
   Mist Blue #D6E2EB / Off-White #F6F8FA / Charcoal #2A2F33
   Muted #6B7280 / Font: Inter
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  --bg:           #F6F8FA;
  --surface:      #ffffff;
  --surface-2:    #D6E2EB;
  --surface-3:    #c4d4e0;
  --text:         #2A2F33;
  --muted:        #6B7280;
  --primary:      #1F3A5F;
  --primary-hover:#162d4a;
  --accent:       #4A6C8C;
  --accent-hover: #1F3A5F;
  --line:         rgba(31, 58, 95, 0.10);
  --line-strong:  rgba(31, 58, 95, 0.20);
  --posted-bg:    rgba(74, 108, 140, 0.10);
  --posted-text:  #1F3A5F;
  --scheduled-bg: rgba(214, 226, 235, 0.60);
  --scheduled-text: #4A6C8C;
  --draft-bg:     rgba(107, 114, 128, 0.10);
  --draft-text:   #6B7280;
  --danger:       #b0553d;
  --shadow:       0 4px 24px rgba(31, 58, 95, 0.08);
  --radius:       14px;
  --radius-sm:    10px;
  --max:          1240px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.55;
}

button, input, select, textarea { font: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* ── Shell ── */
.app-shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 0 64px;
}

/* ── Header ── */
.site-header {
  background: var(--primary);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--surface-2);
  margin-bottom: 6px;
  font-weight: 500;
}

h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #ffffff;
}

h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--primary);
}

h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
}

.site-header h1 { color: #ffffff; }
.site-header .subtle { color: var(--surface-2); margin: 4px 0 0; font-size: 13px; }

.subtle {
  color: var(--muted);
  margin: 4px 0 0;
  line-height: 1.5;
  font-size: 13px;
}

/* ── Auth ── */
.auth-summary {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  color: #ffffff;
  font-size: 13px;
  white-space: nowrap;
}

/* ── Notices ── */
.global-notice {
  margin: 0 32px 16px;
  padding: 12px 16px;
  border: 1px solid rgba(74,108,140,0.25);
  background: rgba(74,108,140,0.08);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 32px;
  margin: 0 0 24px;
}

/* ── Buttons & Tabs & Pills shared base ── */
.tab,
.btn,
.pill {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  white-space: nowrap;
}

.tab:hover,
.btn:hover,
.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
}

/* Active tab / active pill */
.tab.active,
.pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 500;
}

/* Primary button */
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 500;
}
.btn.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
}

/* Secondary button (default .btn without .primary) */
.btn {
  color: var(--accent);
  border-color: var(--accent);
  background: transparent;
}
.btn:hover {
  background: rgba(74,108,140,0.06);
  color: var(--primary);
  border-color: var(--primary);
}

/* Ghost */
.btn.ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--muted);
}
.btn.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn:disabled { opacity: .5; cursor: not-allowed; }
.hidden { display: none !important; }

/* ── Panels ── */
.panel { display: none; }
.panel.active { display: block; padding: 0 32px; }

/* ── Flex helpers ── */
.site-header,
.header-actions,
.panel-head,
.panel-actions,
.button-row,
.dialog-head,
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head { margin-bottom: 18px; }
.button-row { flex-wrap: wrap; margin-top: 20px; }

/* ── Cards ── */
.card,
.compact-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card { padding: 20px; margin: 0 0 18px; }
.compact-card { padding: 14px 16px; margin: 0 0 18px; }

/* ── Metric grid ── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 20px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.metric-label {
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.metric-value {
  margin-top: 8px;
  font-size: 28px;
  letter-spacing: -0.03em;
  font-weight: 600;
  color: var(--primary);
}

.metric-sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

/* ── Two-col layout ── */
.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* ── Form grids ── */
.form-grid.one-col   { display: grid; gap: 16px; }
.form-grid.two-col   { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* ── Filter row ── */
.filter-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr)) auto;
  gap: 14px;
  align-items: end;
}
.filter-control label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--muted); }

/* ── Bar charts ── */
.bars, .stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 220px 1fr 70px;
  gap: 12px;
  align-items: center;
}

.bar-label { font-size: 13px; color: var(--muted); }

.bar-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.bar-value { text-align: right; font-weight: 600; font-size: 13px; color: var(--primary); }

/* ── SVG chart ── */
.chart-surface {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 16px;
  min-height: 280px;
}

.chart-empty { color: var(--muted); }
.chart-svg { width: 100%; height: 260px; display: block; }
.chart-axis,
.chart-grid { stroke: rgba(31,58,95,0.10); stroke-width: 1; }
.chart-label,
.chart-value { fill: var(--muted); font-size: 11px; }
.chart-bar-low  { fill: var(--surface-2); }
.chart-bar-high { fill: var(--accent); }

/* ── Post and gap cards ── */
.post-card,
.gap-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: var(--surface);
}

.post-head {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.post-preview,
.gap-desc {
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.gap-desc { margin: 6px 0 14px; }

.post-meta,
.post-kpis,
.pill-group,
.gap-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-kpis {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.kpi {
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
}

/* ── Tags and status pills ── */
.tag,
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
}

.tag { background: var(--surface-2); color: var(--accent); }
.status-pill.neutral   { background: var(--surface-2); color: var(--muted); }
.status-pill.posted    { background: var(--posted-bg); color: var(--posted-text); border-color: rgba(31,58,95,0.15); }
.status-pill.scheduled { background: var(--scheduled-bg); color: var(--scheduled-text); border-color: rgba(74,108,140,0.20); }
.status-pill.draft     { background: var(--draft-bg); color: var(--draft-text); border-color: rgba(107,114,128,0.15); }

/* ── Form inputs ── */
label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  padding: 10px 13px;
  color: var(--text);
  font-size: 14px;
}

textarea { resize: vertical; min-height: 120px; }
textarea#promptPreview { min-height: 340px; }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 108, 140, 0.14);
}

/* ── Notices (inline form) ── */
.notice {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(74,108,140,0.08);
  color: var(--text);
  border: 1px solid rgba(74,108,140,0.18);
  font-size: 13px;
}

/* ── Big value (engagement rate preview) ── */
.big-value {
  padding-top: 8px;
  font-size: 26px;
  letter-spacing: -0.03em;
  font-weight: 600;
  color: var(--primary);
}

/* ── Pill group (practice context) ── */
.pill-group { margin-bottom: 18px; }

/* ── Notes list ── */
.notes-list {
  margin: 12px 0;
  padding-left: 18px;
  line-height: 1.75;
  color: var(--muted);
}

/* ── Next slot banner ── */
#slotBanner {
  color: var(--accent);
  font-weight: 500;
}

/* ── Dialog ── */
dialog {
  width: min(920px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 24px;
  box-shadow: 0 16px 48px rgba(31,58,95,0.14);
}

dialog::backdrop {
  background: rgba(31,58,95,0.28);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .metric-grid,
  .two-col,
  .form-grid.two-col,
  .form-grid.three-col,
  .filter-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell { padding-bottom: 48px; }
  .site-header { padding: 16px 20px; }
  .panel.active { padding: 0 20px; }
  .tabs { padding: 0 20px; }
  .global-notice { margin: 0 20px 16px; }

  .site-header,
  .panel-head,
  .dialog-head,
  .header-actions,
  .button-row,
  .card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .bar-row { grid-template-columns: 1fr; }
}
.pipeline-sync-btn {

  margin-left: auto;

  white-space: nowrap;

  flex: 0 0 auto;

}

#pipelineCount {

  flex: 0 0 auto;

}

.filter-row {

  align-items: end;

}
.pipeline-actions {
  margin-left: auto;
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
  flex: 0 0 auto;
  white-space: nowrap;
}

#pipelineCount,
#syncOverdueBtn {
  white-space: nowrap;
}

@media (max-width: 1024px) {
  .pipeline-actions {
    margin-left: 0;
    justify-content: flex-start;
  }
}
.global-notice.error {
  background: rgba(176, 85, 61, 0.08);
  border-color: rgba(176, 85, 61, 0.22);
}

.global-notice.info {
  background: rgba(74, 108, 140, 0.08);
  border-color: rgba(74, 108, 140, 0.22);
}
