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

:root {
  --bg: #e6e9ef;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --ink: #14171f;
  --ink-soft: #4b5160;
  --muted: #8b92a3;
  --border: #e4e7ed;

  --ig: #ff6b4a;
  --ig-tint: #ffede7;
  --ig-deep: #c7431f;
  --tt: #0ea5a0;
  --tt-tint: #dff5f3;
  --tt-deep: #0a6e6a;
  --dark: #1b1e27;

  --pos: #1e8e5a;
  --pos-tint: #e6f5ee;
  --neg: #d64545;
  --neg-tint: #fbeaea;
  --neg-deep: #a4302f;
  --warn: #c17a1f;
  --warn-tint: #fbf1e0;
  --cute: #c23a72;
  --cute-tint: #fceaf1;
  --cute-deep: #8f2a55;

  --r-lg: 28px;
  --r-md: 18px;
  --r-sm: 12px;
  --r-full: 999px;

  --shadow: 0 2px 4px rgba(20, 23, 31, .04), 0 16px 32px -12px rgba(20, 23, 31, .12);
  --shadow-hover: 0 4px 10px rgba(20, 23, 31, .06), 0 22px 40px -14px rgba(20, 23, 31, .16);

  --font-display: "Urbanist", -apple-system, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  margin: 0;
  background:
    radial-gradient(1100px 640px at 12% -8%, #eef1f8 0%, transparent 60%),
    radial-gradient(900px 620px at 100% 0%, #e9f7f5 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-feature-settings: "tnum" 1;
}

.shell { display: flex; min-height: 100vh; align-items: flex-start; }

.sidebar {
  flex: 0 0 auto; width: 76px; min-height: 100vh; position: sticky; top: 0;
  background: var(--dark); display: flex; flex-direction: column; align-items: center;
  padding: 1.4rem 0; gap: 1.75rem;
}
.sidebar__logo { font-size: 1.5rem; line-height: 1; }
.sidebar__nav { display: flex; flex-direction: column; gap: .55rem; }
.sidebar__item {
  width: 44px; height: 44px; border-radius: var(--r-md); display: flex;
  align-items: center; justify-content: center; color: rgba(255, 255, 255, .5);
  transition: background .15s ease, color .15s ease;
}
.sidebar__item:hover { color: #fff; background: rgba(255, 255, 255, .1); text-decoration: none; }
.sidebar__item.is-active { color: #fff; background: linear-gradient(135deg, var(--ig), var(--tt)); }

.shell__main { flex: 1; min-width: 0; }

.wrap { max-width: 1360px; margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2.5rem) 3rem; }

.topbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1.35rem clamp(1rem, 3vw, 2.5rem); position: sticky; top: 0; z-index: 5;
  background: rgba(230, 233, 239, .72); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__brand { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem;
                 letter-spacing: -.01em; color: var(--ink); text-decoration: none;
                 display: inline-flex; align-items: center; gap: .5rem; flex: 0 0 auto; }
.topbar__brand:hover { text-decoration: none; }
.topbar__spacer { flex: 1; }
.brand-mark { width: 12px; height: 12px; border-radius: 4px;
              background: linear-gradient(135deg, var(--ig), var(--tt)); }
.crumb { color: var(--muted); font-size: .9rem; }
.crumb a { color: var(--muted); }

.topbar-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.select-pill, .search-input {
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-full);
  padding: .55rem 1rem; font-size: .84rem; font-family: var(--font-body); color: var(--ink);
  height: 40px;
}
.search-input { width: 200px; }
.search-input::placeholder { color: var(--muted); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); position: relative; flex: 0 0 auto;
}
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px;
                 border-radius: 50%; background: var(--ig); border: 1.5px solid var(--surface); }
.avatar-circle {
  width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; color: var(--ink-soft);
  font-weight: 700; font-size: .85rem; flex: 0 0 auto;
}

@media (max-width: 720px) {
  .sidebar { width: 60px; }
  .sidebar__item { width: 38px; height: 38px; }
  .search-input { width: 140px; }
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; color: var(--ink); margin: 0; }
h2 { font-size: 1.5rem; margin-bottom: 1.25rem; }
h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em;
     color: var(--ink-soft); font-weight: 600; margin: 2.25rem 0 .9rem; }
h3:first-of-type { margin-top: 0; }

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--ig); outline-offset: 2px; border-radius: 4px; }

.bento { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1rem; }

.card {
  background: var(--surface);
  background-image: linear-gradient(180deg, rgba(255,255,255,.6), rgba(255,255,255,0) 40%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
a.card:hover, .card--clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.card--tight { padding: 1.1rem 1.25rem; border-radius: var(--r-md); }
.card--pad-lg { padding: 1.75rem; }

.card--ig { background: var(--ig); color: #fff; border-color: transparent; }
.card--tt { background: var(--tt); color: #fff; border-color: transparent; }
.card--ig .muted, .card--ig .stat-label,
.card--tt .muted, .card--tt .stat-label { color: rgba(255, 255, 255, .75); }
.card--ig a, .card--tt a { color: #fff; }

.card--tint-ig { background: var(--ig-tint); border-color: transparent; }
.card--tint-tt { background: var(--tt-tint); border-color: transparent; }
.card--warn { background: var(--neg-tint); border-color: transparent; }
.card--warn h3 { color: var(--neg-deep); }

.platform-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: .25rem .6rem; border-radius: var(--r-full);
}
.platform-chip--ig { background: var(--ig-tint); color: var(--ig-deep); }
.platform-chip--tt { background: var(--tt-tint); color: var(--tt-deep); }
.card--ig .platform-chip, .card--tt .platform-chip { background: rgba(255, 255, 255, .22); color: #fff; }

.stat-label { color: var(--muted); font-size: .82rem; margin-bottom: .4rem; }
.stat-value { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700;
              line-height: 1; letter-spacing: -.01em; }
.stat-sub { margin-top: .55rem; font-size: .82rem; color: var(--muted); }

table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .7rem .5rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.muted { color: var(--muted); font-size: .85rem; }
.pos { color: var(--pos); font-weight: 600; }
.neg { color: var(--neg); font-weight: 600; }
.warn { color: var(--warn); }

svg polyline { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark { color: var(--ig); }
.spark--tt { color: var(--tt); }

details { margin: .5rem 0; border-radius: var(--r-md); background: var(--surface-2); padding: 0 .9rem; }
summary { cursor: pointer; padding: .75rem 0; font-weight: 500; list-style: none; }
summary::-webkit-details-marker { display: none; }
details ul { margin: 0 0 .9rem; padding-left: 1.1rem; }
details li { margin-bottom: .4rem; font-size: .88rem; }

.summary-card, .insight-card {
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: .9rem 1.1rem;
  margin: .6rem 0;
  white-space: pre-wrap;
  font-size: .9rem;
}
.insight-card { background: var(--ig-tint); color: var(--ig-deep); border-radius: var(--r-sm); }

.avatar-stack { display: flex; margin-bottom: .25rem; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2);
  border: 2px solid var(--surface); display: flex; align-items: center; justify-content: center;
  font-size: .74rem; font-weight: 700; color: var(--ink-soft); margin-left: -10px;
}
.avatar:first-child { margin-left: 0; }

.progress { height: 8px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; display: flex; }
.progress > span { display: block; height: 100%; }

.pill {
  display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .95rem;
  border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface);
  font-size: .85rem; font-weight: 500;
}

.empty { color: var(--muted); font-size: .9rem; padding: .75rem 0; }

.history-table td, .history-table th { white-space: nowrap; }
.history-table td:first-child, .history-table th:first-child { white-space: normal; }
.history-table tbody tr:hover { background: var(--surface-2); }
.history-spark { color: var(--muted); }
.history-spark--ig { color: var(--ig); }
.history-spark--tt { color: var(--tt); }

.post-thumb {
  width: 56px; height: 56px; border-radius: var(--r-sm); object-fit: cover;
  flex: 0 0 auto; background: var(--surface-2);
}

.tile-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700;
              margin-top: .9rem; line-height: 1.25; }
.icon-chip { display: inline-flex; align-items: center; gap: .35rem; }
.avatar-lg { width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
             flex: 0 0 auto; border: 2px solid var(--surface); box-shadow: var(--shadow); }
.rank-badge {
  flex: 0 0 auto; width: 2.15rem; height: 2.15rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; font-family: var(--font-display);
}
.rank-badge--ig { background: var(--ig-tint); color: var(--ig-deep); }
.rank-badge--tt { background: var(--tt-tint); color: var(--tt-deep); }
.rank-badge--warn { background: #fff; color: var(--neg-deep); }
.insight-card--warn { background: #fff; color: var(--neg-deep); }

.theme-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: start; }
.theme-card { display: flex; flex-direction: column; }

.theme-chip {
  display: inline-flex; align-items: center; gap: .5rem; align-self: flex-start;
  padding: .5rem .8rem .5rem .65rem; border-radius: var(--r-full);
  font-family: var(--font-display); font-weight: 700; font-size: .96rem;
  letter-spacing: -.005em; line-height: 1.2; margin-bottom: .9rem;
}
.theme-chip--ig { background: var(--ig-tint); color: var(--ig-deep); }
.theme-chip--tt { background: var(--tt-tint); color: var(--tt-deep); }
.theme-chip svg { flex: 0 0 auto; opacity: .8; }
.theme-chip__count {
  flex: 0 0 auto; font-family: var(--font-body); font-weight: 700; font-size: .72rem;
  background: rgba(255, 255, 255, .6); padding: .12rem .5rem; border-radius: var(--r-full);
}

.theme-desc-block {
  background: var(--surface-2); border-radius: var(--r-sm);
  padding: .75rem .9rem; margin: 0 0 1rem;
  font-size: .85rem; color: var(--ink-soft); line-height: 1.55;
}

.ideas-block__label {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin: 0 0 .5rem;
}
.idea-rows { display: flex; flex-direction: column; list-style: none; margin: 0; padding: 0; }
.idea-person { display: flex; align-items: flex-start; gap: .6rem; padding: .65rem 0; }
.idea-person + .idea-person { border-top: 1px solid var(--border); }
.idea-num {
  flex: 0 0 auto; width: 1.2rem; padding-top: .35rem; text-align: center;
  font-family: var(--font-display); font-weight: 800; font-size: .78rem; color: var(--muted);
}
.idea-avatar {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.idea-avatar--safe { background: var(--pos-tint); color: var(--pos); }
.idea-avatar--bold { background: var(--warn-tint); color: var(--warn); }
.idea-avatar--cute { background: var(--cute-tint); color: var(--cute-deep); }
.idea-person__body { flex: 1; min-width: 0; }
.idea-person__text { margin: 0 0 .35rem; font-size: .86rem; line-height: 1.45; color: var(--ink); }
.idea-pill {
  display: inline-flex; font-size: .64rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: .18rem .55rem; border-radius: var(--r-full);
}
.idea-pill--safe { background: var(--pos-tint); color: var(--pos); }
.idea-pill--bold { background: var(--warn-tint); color: var(--warn); }
.idea-pill--cute { background: var(--cute-tint); color: var(--cute-deep); }

.theme-card__comments { margin-top: .9rem; background: transparent; padding: 0; border-radius: 0; }
.theme-card__comments summary { font-size: .8rem; color: var(--muted); font-weight: 500;
                                padding: .3rem 0; display: flex; align-items: center; gap: .3rem; }
.theme-card__comments summary:hover { color: var(--ink-soft); }
.theme-card__comments ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.theme-card__comments li { font-size: .85rem; margin-bottom: .5rem; }
.post-row { display: flex; align-items: center; gap: 1rem; padding: .8rem 0; flex-wrap: wrap; }
.post-row + .post-row { border-top: 1px solid var(--border); }
.post-meta { display: flex; gap: 1.15rem; font-size: .85rem; white-space: nowrap; color: var(--ink-soft); }
.sentiment-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.sentiment-item .emoji { font-size: 1.3rem; }
.sentiment-item .count { font-weight: 700; font-size: 1.1rem; font-family: var(--font-display); }

.delta-badge {
  display: inline-flex; align-items: center; gap: .2rem; font-size: .76rem; font-weight: 700;
  padding: .2rem .55rem; border-radius: var(--r-full); font-variant-numeric: tabular-nums;
}
.delta-badge--pos { background: var(--pos-tint); color: var(--pos); }
.delta-badge--neg { background: var(--neg-tint); color: var(--neg); }

.kpi-row { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: 1.5rem; }
.kpi-card { display: flex; align-items: center; gap: 1rem; }
.kpi-card--link { color: var(--ink); }
.kpi-card--link:hover { text-decoration: none; }
.kpi-card__icon {
  flex: 0 0 auto; width: 48px; height: 48px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
}
.kpi-card__icon--blue { background: #e6f1fb; color: #185fa5; }
.kpi-card__icon--teal { background: var(--tt-tint); color: var(--tt-deep); }
.kpi-card__icon--warm { background: var(--ig-tint); color: var(--ig-deep); }
.kpi-card__body { flex: 1; min-width: 0; }
.kpi-card__label { font-size: .82rem; color: var(--muted); margin-bottom: .35rem; }
.kpi-card__value-row { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.kpi-card__value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700;
                   letter-spacing: -.01em; line-height: 1.15; }
.kpi-card__sub { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.kpi-card__chevron { flex: 0 0 auto; color: var(--muted); }

.account-card { position: relative; }
.best-badge {
  position: absolute; top: 1.1rem; right: 1.1rem; font-size: .68rem; font-weight: 700;
  background: var(--ig-tint); color: var(--ig-deep); padding: .25rem .6rem; border-radius: var(--r-full);
}
.account-card__head { display: flex; align-items: center; gap: .7rem; margin-bottom: 1rem; }
.account-card__logo {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  font-family: var(--font-display); font-weight: 700; color: var(--ink-soft);
}
.account-card__logo img { width: 100%; height: 100%; object-fit: cover; }
.account-card__name { font-family: var(--font-display); font-weight: 700; font-size: .98rem;
                      margin-top: .3rem; line-height: 1.25; }
.account-card__handle { font-size: .78rem; color: var(--muted); }
.account-card__value { font-family: var(--font-display); font-size: 1.65rem; font-weight: 700;
                       letter-spacing: -.01em; margin-bottom: .5rem; }
.account-chart { display: block; margin-top: .8rem; }

/* --- Плитки проєктів-портфоліо (Victor Pinchuk Foundation, Планета Кіно,
   Галичина) — легкий градієнт з брендового кольору в білий, іконки
   платформ в оригінальних кольорах (не app-схема coral/teal). --- */
.portfolio-tile {
  background: linear-gradient(160deg, var(--tile-color) 0%, #ffffff 76%);
  border-color: transparent;
}
.portfolio-tile__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.4rem; }
.portfolio-tile__logo {
  width: 48px; height: 48px; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .14);
  font-family: var(--font-display); font-weight: 700; color: var(--ink-soft);
}
.portfolio-tile__logo img { width: 100%; height: 100%; object-fit: cover; }
.portfolio-tile__platforms { display: flex; gap: .35rem; }
.brand-icon {
  display: flex; align-items: center; justify-content: center; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, .16);
}
.portfolio-tile__name { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
                        line-height: 1.25; margin-bottom: .25rem; }
.portfolio-tile__sub { font-size: .8rem; color: var(--ink-soft); opacity: .8; margin-bottom: .7rem; }
.portfolio-tile__value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700;
                         letter-spacing: -.01em; }

.chart-card canvas { max-height: 280px; }

.threads-post { margin-bottom: 1rem; }
.threads-post__head { display: flex; align-items: center; gap: .8rem; margin-bottom: .7rem; }

@media (max-width: 640px) {
  .bento { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.7rem; }
}
