/* linkedin-review — editorial-analytics system.
   Direction: ink on warm paper, typographic hierarchy over card piles,
   hairline rules, semantic color only (mint=organic, violet=paid/views,
   LinkedIn blue=platform identity). One staged load reveal; no sidebar.
   Brand tokens: ink #0e0e0e · red #ff3c5e · violet #5200ff · mint #3cffd0. */

:root {
  --ink: #101012;
  --ink-2: #43434a;
  --ink-3: #7b7b85;
  --ink-4: #a9a9b2;
  --paper: #f7f6f2;
  --surface: #fffefb;
  --line: #e6e4dd;
  --line-strong: #d5d3ca;

  --brand-red: #ff3c5e;
  --brand-violet: #5200ff;
  --brand-mint: #3cffd0;
  --mint-ink: #0a8f6f;
  --li-blue: #0a66c2;
  --li-blue-soft: #e9f1fa;
  --up: #0a8f6f;
  --down: #d13c4b;

  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --text-2xs: 0.6875rem;
  --text-xs: 0.75rem;
  --text-sm: 0.8438rem;
  --text-md: 0.9375rem;
  --text-display: clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem);
  --text-stat: clamp(1.7rem, 1.35rem + 1.1vw, 2.25rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-panel: 0 1px 2px rgb(16 16 18 / 0.04), 0 8px 28px rgb(16 16 18 / 0.05);
  --shadow-float: 0 2px 8px rgb(16 16 18 / 0.08), 0 20px 60px rgb(16 16 18 / 0.14);

  --dur: 170ms;
  --dur-slow: 550ms;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(60rem 34rem at 88% -12%, rgb(82 0 255 / 0.05), transparent 62%),
    radial-gradient(46rem 30rem at -12% 16%, rgb(60 255 208 / 0.07), transparent 58%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.015em; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
.num, .stat-value, .posts-table td.num { font-variant-numeric: tabular-nums; }

/* ── Shared atoms ──────────────────────────────────────────────────── */
.mark { width: 26px; height: 26px; flex: none; display: block; }
.wordmark { font-weight: 800; letter-spacing: -0.02em; font-size: 0.98rem; white-space: nowrap; }
.wordmark em { font-style: normal; font-weight: 500; color: var(--ink-3); }

.li-chip {
  display: inline-flex; align-items: center; gap: 0.34rem;
  background: var(--li-blue-soft); color: var(--li-blue);
  font-size: var(--text-xs); font-weight: 700;
  padding: 0.24rem 0.62rem; border-radius: 999px;
}
.li-chip svg { width: 13px; height: 13px; }
.li-chip--big { font-size: 0.85rem; padding: 0.42rem 0.95rem; }
.li-chip--big svg { width: 16px; height: 16px; }

.btn-primary {
  display: inline-block;
  border: none;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-weight: 650;
  font-size: var(--text-md);
  padding: 0.78rem 1.9rem;
  text-decoration: none;
  text-align: center;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn-primary:hover { background: #26262c; transform: translateY(-1px); box-shadow: 0 6px 18px rgb(16 16 18 / 0.18); }
.btn-primary:active { transform: translateY(0); box-shadow: none; }
.btn-primary:focus-visible { outline: 3px solid rgb(82 0 255 / 0.35); outline-offset: 2px; }

.form-error {
  background: #fdeef0;
  border: 1px solid #f4c6cd;
  color: var(--down);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-size: var(--text-sm);
}

/* ── Top app bar ───────────────────────────────────────────────────── */
.appbar {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(10px);
  background: rgb(247 246 242 / 0.86);
  border-bottom: 1px solid var(--line);
}
.appbar-inner {
  max-width: 1120px; margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
}
.appbar-brand { display: flex; align-items: center; gap: 0.55rem; }
.appbar-spacer { flex: 1; }

.status-pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: var(--text-2xs); font-weight: 650;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-3);
  border: 1px solid var(--line-strong);
  padding: 0.3rem 0.7rem; border-radius: 999px;
  white-space: nowrap;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-4); }
.status-pill.is-live { color: var(--mint-ink); border-color: rgb(10 143 111 / 0.35); }
.status-pill.is-live .status-dot { background: var(--mint-ink); box-shadow: 0 0 0 3px rgb(10 143 111 / 0.15); }

.range-switch {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 2px;
  background: var(--surface);
}
.range-switch button {
  border: none; background: transparent;
  padding: 0.28rem 0.8rem; border-radius: 999px;
  font-size: var(--text-xs); font-weight: 650; color: var(--ink-3);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.range-switch button:hover { color: var(--ink); }
.range-switch button.active { background: var(--ink); color: #fff; }
.range-switch button:focus-visible { outline: 2px solid rgb(82 0 255 / 0.4); }
.range-switch[hidden] { display: none; }

.appbar-menu { display: flex; align-items: center; gap: 0.9rem; }
.appbar-link {
  font-size: var(--text-xs); font-weight: 550; color: var(--ink-3);
  text-decoration: none;
  padding: 0.3rem 0.15rem;
  border-bottom: 1px solid transparent;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.appbar-link:hover { color: var(--ink); border-color: var(--ink-4); }
.appbar-link[hidden] { display: none; }

/* ── Page column ───────────────────────────────────────────────────── */
.page { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem 4rem; }

/* Staged reveal — one directed load sequence. */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(12px); animation: rise var(--dur-slow) var(--ease) forwards; }
  .reveal:nth-child(2) { animation-delay: 60ms; }
  .reveal:nth-child(3) { animation-delay: 120ms; }
  .reveal:nth-child(4) { animation-delay: 180ms; }
  .reveal:nth-child(5) { animation-delay: 240ms; }
  .reveal:nth-child(6) { animation-delay: 300ms; }
  @keyframes rise { to { opacity: 1; transform: none; } }
}

/* ── Empty / connect hero ──────────────────────────────────────────── */
.empty-hero { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 3rem 0; }
.empty-hero[hidden] { display: none; }
.empty-hero-card { max-width: 620px; text-align: center; padding: 0 1rem; }
.empty-hero-card h1 {
  font-size: var(--text-display);
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 1.3rem 0 1rem;
}
.empty-hero-card > p { color: var(--ink-2); font-size: var(--text-md); margin: 0 auto 2rem; max-width: 48ch; }
.empty-hero-card .form-error { margin: 0 0 1.4rem; display: inline-block; }
.empty-hero-card .form-error[hidden] { display: none; }
.btn-hero { font-size: 1.02rem; padding: 0.9rem 2.4rem; }
.empty-hero-note { margin: 1.5rem 0 0; font-size: var(--text-xs); color: var(--ink-3); }
.empty-hero-note code {
  font-family: var(--font-mono); font-size: 0.68rem;
  background: var(--li-blue-soft); color: var(--li-blue);
  padding: 0.14rem 0.45rem; border-radius: 999px;
}

/* ── Page tabs (multi-org) ─────────────────────────────────────────── */
.page-tabs {
  display: flex; gap: 1.4rem;
  border-bottom: 1px solid var(--line);
  margin-top: var(--space-6);
}
.page-tabs[hidden] { display: none; }
.page-tabs button {
  border: none; background: transparent;
  padding: 0.55rem 0.1rem 0.7rem;
  font-size: var(--text-sm); font-weight: 600; color: var(--ink-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.page-tabs button:hover { color: var(--ink); }
.page-tabs button.active { color: var(--ink); border-color: var(--ink); }

/* ── Masthead ──────────────────────────────────────────────────────── */
.masthead {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 2rem; flex-wrap: wrap;
  padding: var(--space-12) 0 var(--space-8);
}
.masthead-id { display: flex; align-items: center; gap: 1.1rem; min-width: 0; }
.page-avatar {
  width: 64px; height: 64px; flex: none;
  border-radius: 16px;
  display: grid; place-items: center;
  font-size: 1.6rem; font-weight: 800; color: #fff;
  background: var(--li-blue);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.2), var(--shadow-panel);
}
.masthead h1 {
  font-size: var(--text-display);
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.page-meta {
  margin: 0.45rem 0 0;
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
}
.page-url {
  font-size: var(--text-xs); color: var(--ink-3);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
}
.page-url:hover { color: var(--ink); border-color: var(--ink-4); }

.masthead-stat { text-align: right; flex: none; }
.masthead-stat .stat-label {
  font-size: var(--text-2xs); font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3);
}
.masthead-stat .stat-value {
  font-size: var(--text-stat); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1;
  margin: 0.2rem 0 0.1rem;
}
.masthead-stat .stat-sub { font-size: var(--text-xs); color: var(--mint-ink); font-weight: 600; }

/* ── KPI strip: numbers over hairlines, not card piles ─────────────── */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--space-8);
}
.kpi {
  padding: 1.1rem 1.4rem 1.2rem 0;
  border-left: 1px solid var(--line);
  padding-left: 1.4rem;
}
.kpi:first-child { border-left: none; padding-left: 0; }
.kpi-label {
  font-size: var(--text-2xs); font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3);
}
.kpi-value {
  font-size: var(--text-stat); font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.15;
  margin: 0.2rem 0 0.1rem;
}
.kpi-delta { font-size: var(--text-xs); font-weight: 600; }
.kpi-delta.up { color: var(--up); }
.kpi-delta.down { color: var(--down); }
.kpi-delta .vs { color: var(--ink-4); font-weight: 450; }

/* ── Panels ────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 1.1rem; margin-bottom: 1.1rem; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem 1.4rem;
  box-shadow: var(--shadow-panel);
}
.panel[hidden] { display: none; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.8rem; margin-bottom: 1rem; }
.panel-head h3 {
  font-size: var(--text-2xs); font-weight: 750;
  letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-2);
}
.panel-sub { margin: 0.2rem 0 0; font-size: var(--text-xs); color: var(--ink-3); font-weight: 400; letter-spacing: 0; text-transform: none; }
.api-tag {
  flex: none;
  font-family: var(--font-mono); font-size: 0.64rem;
  color: var(--ink-3);
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 0.18rem 0.5rem; border-radius: 999px;
  white-space: nowrap;
}
.legend { font-weight: 700; }
.legend.organic { color: var(--mint-ink); }
.legend.paid { color: var(--brand-violet); }

.chart-area { width: 100%; }
.chart-area svg { display: block; width: 100%; height: auto; }

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  padding: 2.1rem 1.2rem;
  text-align: center;
  color: var(--ink-3);
  font-size: var(--text-sm);
}

.split-bar { margin-top: 0.85rem; }
.split-track { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--line); }
.split-organic { background: var(--brand-mint); }
.split-paid { background: var(--brand-violet); }
.split-caption { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--ink-3); margin-top: 0.4rem; }

.mini-bars { display: grid; gap: 0.5rem; margin-top: 0.9rem; }
.hbar-list { display: grid; gap: 0.62rem; }
.hbar { display: grid; grid-template-columns: 130px 1fr 52px; gap: 0.7rem; align-items: center; font-size: var(--text-sm); }
.hbar .label { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.hbar .fill { display: block; height: 100%; border-radius: 999px; background: var(--hbar-color, var(--li-blue)); transition: width 500ms var(--ease); }
.hbar .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: var(--text-xs); }

/* ── Posts table ───────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; margin: 0 -0.25rem; }
.posts-table { width: 100%; border-collapse: collapse; min-width: 820px; }
.posts-table th, .posts-table td { padding: 0.72rem 0.7rem; text-align: left; }
.posts-table th {
  font-size: var(--text-2xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
.posts-table td { border-bottom: 1px solid var(--line); font-size: var(--text-sm); vertical-align: top; }
.posts-table td:nth-child(2) { white-space: nowrap; }
.posts-table tbody tr:last-child td { border-bottom: none; }
.posts-table tbody tr { transition: background var(--dur) var(--ease); }
.posts-table tbody tr:hover { background: rgb(16 16 18 / 0.025); }
.posts-table .num { text-align: right; }
.post-text { max-width: 360px; }
.post-text span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); font-weight: 480; }
.post-text a { color: inherit; text-decoration: none; }
.post-text a:hover { color: var(--brand-violet); }
.type-chip {
  font-family: var(--font-mono); font-size: 0.6rem; font-weight: 600;
  letter-spacing: 0.05em;
  border: 1px solid var(--line-strong);
  padding: 0.15rem 0.45rem; border-radius: 999px; color: var(--ink-3);
  white-space: nowrap;
}
.er-cell { display: inline-flex; align-items: center; gap: 0.5rem; justify-content: flex-end; }
.er-bar { display: block; width: 44px; height: 6px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); overflow: hidden; flex: none; }
.er-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-mint), var(--mint-ink)); }
.table-note { font-size: var(--text-xs); color: var(--ink-3); margin: 1rem 0 0; }

/* ── Footer ────────────────────────────────────────────────────────── */
.page-foot {
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--line);
  font-size: var(--text-xs); color: var(--ink-3);
  display: grid; gap: 0.35rem;
}
.page-foot a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.page-foot a:hover { color: var(--ink); }

#dashboard-content[hidden] { display: none; }

/* ── Login ─────────────────────────────────────────────────────────── */
.login-body { min-height: 100vh; display: grid; place-items: center; }
.login-wrap { width: min(430px, calc(100vw - 2.5rem)); padding: 2.5rem 0; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.2rem 2.3rem 2rem;
  box-shadow: var(--shadow-float);
}
.login-brand { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.4rem; }
.env-badge {
  display: inline-block;
  padding: 0.28rem 0.7rem; border-radius: 999px;
  background: var(--ink); color: var(--brand-mint);
  font-size: var(--text-2xs); font-weight: 650;
  letter-spacing: 0.06em; text-transform: uppercase;
  margin-bottom: 1.4rem;
}
.login-card h1 { font-size: 1.45rem; letter-spacing: -0.02em; margin-bottom: 0.4rem; }
.login-sub { color: var(--ink-3); font-size: var(--text-sm); margin: 0 0 1.5rem; }
.login-card label {
  display: block;
  font-size: var(--text-2xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-2);
  margin: 1rem 0 0.35rem;
}
.login-card input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.login-card input:focus {
  outline: none;
  border-color: var(--brand-violet);
  box-shadow: 0 0 0 3px rgb(82 0 255 / 0.12);
}
.login-card .btn-primary { width: 100%; margin-top: 1.5rem; }
.login-card .form-error { margin: 0 0 0.5rem; }
.login-note { color: var(--ink-3); font-size: var(--text-xs); margin: 1.15rem 0 0; }
.login-footer { text-align: center; margin-top: 1.4rem; font-size: var(--text-xs); color: var(--ink-3); }
.login-footer a { color: var(--ink-2); text-decoration: none; }
.login-footer a:hover { text-decoration: underline; }

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 780px) {
  .appbar-inner { padding: 0.6rem 1rem; }
  .page { padding: 0 1rem 3rem; }
  .masthead { padding: var(--space-8) 0 var(--space-6); align-items: flex-start; }
  .masthead-stat { text-align: left; }
  .page-avatar { width: 52px; height: 52px; font-size: 1.3rem; border-radius: 13px; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .kpi { padding-left: 1rem; }
  .kpi:nth-child(odd) { border-left: none; padding-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .hbar { grid-template-columns: 105px 1fr 46px; }
}
