/* ============================================================
   InstaApp — nowoczesny dashboard
   ============================================================ */

:root {
  --bg: #f2f4f8;
  --surface: #ffffff;
  --border: #e6e9f0;
  --text: #1c2333;
  --text-muted: #667085;

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --success: #16a34a;
  --success-hover: #15803d;
  --warning: #f59e0b;
  --warning-hover: #d97706;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --info: #0ea5e9;
  --info-hover: #0284c7;
  --purple: #9333ea;
  --purple-hover: #7e22ce;

  --ig-gradient: linear-gradient(45deg, #f09433, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888);

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
  --shadow-hover: 0 4px 8px rgba(16, 24, 40, 0.08), 0 12px 32px rgba(16, 24, 40, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6, p, ul, ol, li, figure {
  margin: 0;
  padding: 0;
}

ol, ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

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

a:hover {
  text-decoration: underline;
}

/* ------------------------------------------------------------
   Szkielet aplikacji
   ------------------------------------------------------------ */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand .brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ig-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 17px;
}

.brand .brand-name {
  background: var(--ig-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-muted);
}

.header-user .user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
}

.header-user .user-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.app-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 24px 64px;
}

/* ------------------------------------------------------------
   Zakładki
   ------------------------------------------------------------ */

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-btn {
  flex-shrink: 0;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.panel-section {
  display: none;
}

.panel-section.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

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

/* ------------------------------------------------------------
   Karty / sekcje
   ------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.section-head h3 {
  font-size: 18px;
  font-weight: 700;
}

.section-head .muted,
.muted {
  color: var(--text-muted);
  font-size: 14px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
  border: 0;
}

/* ------------------------------------------------------------
   Przyciski
   ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--primary);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.btn:hover {
  background: var(--primary-hover);
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-success { background: var(--success); }
.btn-success:hover { background: var(--success-hover); }
.btn-warning { background: var(--warning); }
.btn-warning:hover { background: var(--warning-hover); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-info { background: var(--info); }
.btn-info:hover { background: var(--info-hover); }
.btn-purple { background: var(--purple); }
.btn-purple:hover { background: var(--purple-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg);
  color: var(--text);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
}

.btn-block {
  width: 100%;
}

/* Duży przycisk łączenia z Facebookiem */
.join_fb {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 14px 28px;
  background: #1877f2;
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(24, 119, 242, 0.4);
  transition: background 0.15s ease, transform 0.1s ease;
  user-select: none;
}

.join_fb:hover {
  background: #166fe5;
  transform: translateY(-1px);
}

.join_fb::before {
  content: "f";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: #fff;
  color: #1877f2;
  border-radius: 50%;
  font-weight: 900;
  font-family: Georgia, serif;
}

.connect-card {
  max-width: 460px;
  margin: 48px auto;
  text-align: center;
}

.connect-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.connect-card p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ------------------------------------------------------------
   Formularze
   ------------------------------------------------------------ */

.form-control,
input[type="text"],
input[type="password"],
input[type="file"],
select,
textarea {
  width: auto;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

textarea {
  resize: vertical;
  min-height: 70px;
}

label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.toolbar .grow {
  flex: 1;
  min-width: 180px;
}

/* ------------------------------------------------------------
   Logowanie
   ------------------------------------------------------------ */

.login-wrap {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
}

.login-card h3 {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 24px;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-card input {
  width: 100%;
  margin-bottom: 8px;
}

.login-card button {
  margin-top: 8px;
}

.form-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ------------------------------------------------------------
   Hashtagi — siatka zdjęć
   ------------------------------------------------------------ */

.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.photo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.photo-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.photo-card .imgW {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg);
}

.photo-card .imgW img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-card .content {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.photo-card .content h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  word-break: break-all;
}

.photo-stats {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.photo-stats strong {
  color: var(--text);
}

.photo-actions {
  display: flex;
  gap: 8px;
}

.photo-actions .btn,
.photo-actions button {
  flex: 1;
}

.like-btn,
.view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}

.like-btn { background: var(--success); }
.like-btn:hover { background: var(--success-hover); }
.like-btn.liked { background: var(--danger); }
.like-btn.liked:hover { background: var(--danger-hover); }
.view-btn { background: var(--info); }
.view-btn:hover { background: var(--info-hover); }

.add_comment form ul li {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.add_comment textarea {
  width: 100%;
}

.add_comment button {
  align-self: stretch;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.add_comment button:hover {
  background: var(--primary-hover);
}

.add_comment button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.addHastag {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.addHastag form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.addHastag .links {
  margin-top: 14px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 13px;
}

/* ------------------------------------------------------------
   Statystyki / boksy informacyjne
   ------------------------------------------------------------ */

.stat-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 14px;
}

.stat-box strong {
  color: var(--text);
}

.result-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 14px;
}

.upload-box {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-bottom: 18px;
  transition: border-color 0.15s ease;
}

.upload-box:hover {
  border-color: var(--primary);
}

.upload-box label {
  display: block;
  margin-bottom: 10px;
  font-weight: 500;
  color: var(--text-muted);
}

.upload-box form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* ------------------------------------------------------------
   Tabele
   ------------------------------------------------------------ */

.table-modern {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table-modern th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}

.table-modern th:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.table-modern th:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.table-modern td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table-modern tr:hover td {
  background: #fafbff;
}

.table-wrap {
  overflow-x: auto;
}

/* ------------------------------------------------------------
   Obserwowane profile — lista postów
   ------------------------------------------------------------ */

.posts-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.post-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: box-shadow 0.2s ease;
}

.post-card:hover {
  box-shadow: var(--shadow-hover);
}

.post-thumb {
  position: relative;
  flex-shrink: 0;
  width: 130px;
  height: 130px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
}

.post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-thumb .badge-video {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
}

.post-body {
  flex: 1;
  min-width: 0;
}

.post-body h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}

.post-caption {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 8px;
  overflow-wrap: break-word;
}

.post-stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
  margin-bottom: 6px;
}

.post-stats .likes { color: var(--danger); }
.post-stats .comments { color: var(--info); }

.post-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-fetched {
  color: var(--text-muted);
}

.badge-close {
  font-size: 13px;
  vertical-align: middle;
  cursor: help;
}

/* Przełącznik „inspirujący" — wyłączony jest wyblakły, żeby włączone
   od razu rzucały się w oczy na długiej liście */
.inspiring-toggle {
  opacity: 0.4;
  filter: grayscale(1);
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.inspiring-toggle:hover,
.inspiring-toggle.is-on {
  opacity: 1;
  filter: none;
}

.inspiring-toggle.is-on {
  background: #fef3c7;
  border-color: var(--warning);
}

/* Podpowiadane pory publikacji — klik wypełnia pole terminu */
.slot-pick {
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
}

.slot-pick:hover {
  color: var(--primary-hover);
}

#publish-caption {
  width: 100%;
  margin-top: 4px;
}

/* Wymiana strony bez migotania: lista blednie na czas żądania */
#following-posts-container.is-loading {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
}

.check-inline input {
  margin: 0;
}

/* ------------------------------------------------------------
   Stronicowanie listy
   ------------------------------------------------------------ */

/* display:flex, nie none — jQuery .show() na ukrytym w CSS divie
   przywróciłby display:block i rozsypał układ paska */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
}

.pager:empty {
  display: none;
}

.pager-btn {
  min-width: 38px;
  padding: 7px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pager-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.pager-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  cursor: default;
}

.pager-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pager-gap {
  padding: 0 2px;
  color: var(--text-muted);
}

.pager-info {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
}

.error-state {
  text-align: center;
  color: var(--danger);
  padding: 24px 16px;
}

/* ------------------------------------------------------------
   Modal podglądu zdjęcia (sc-work.js)
   ------------------------------------------------------------ */

.photo-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(3px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.photo-modal .modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  max-width: min(640px, 95vw);
  max-height: 92vh;
  overflow: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}

.photo-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.photo-modal .modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.photo-modal .close-modal {
  background: var(--danger);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  cursor: pointer;
}

.photo-modal .modal-body {
  text-align: center;
}

.photo-modal iframe {
  width: min(540px, 88vw);
  height: min(680px, 70vh);
  border: none;
  border-radius: var(--radius-sm);
}

.photo-modal .modal-hint {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ------------------------------------------------------------
   Toast / komunikaty
   ------------------------------------------------------------ */

.message-popup {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  max-width: 320px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  word-wrap: break-word;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  animation: slideIn 0.3s ease-out;
}

.message-popup.success { background: var(--success); }
.message-popup.error   { background: var(--danger); }

@keyframes slideIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ------------------------------------------------------------
   Statystyki — KPI, wykresy, heatmapa
   ------------------------------------------------------------ */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.stat-tile .stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #898781;
}

.stat-tile .stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
}

.stat-tile .stat-delta {
  font-size: 13px;
  font-weight: 600;
}

.stat-tile .stat-delta.up   { color: #006300; }
.stat-tile .stat-delta.down { color: #d03b3b; }

.delta-up   { color: #006300; font-weight: 600; }
.delta-down { color: #d03b3b; font-weight: 600; }

.viz-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}

.viz-root {
  position: relative;
  --viz-series: #2a78d6;
  --viz-grid: #e1e0d9;
  --viz-muted: #898781;
}

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

.viz-svg .viz-grid {
  stroke: var(--viz-grid);
  stroke-width: 1;
}

.viz-svg .viz-tick {
  fill: var(--viz-muted);
  font-size: 11px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

.viz-svg .viz-line {
  fill: none;
  stroke: var(--viz-series);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.viz-svg .viz-crosshair {
  stroke: var(--viz-muted);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.viz-svg .viz-marker {
  fill: var(--viz-series);
  stroke: var(--surface);
  stroke-width: 2;
}

.viz-tooltip {
  position: absolute;
  top: 8px;
  background: var(--text);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
}

/* Heatmapa pór publikacji: etykiety + 8 bloków po 3h */
.heatmap {
  display: grid;
  grid-template-columns: 36px repeat(8, 1fr);
  gap: 3px;
  max-width: 640px;
}

.heatmap-corner {}

.heatmap-collabel,
.heatmap-rowlabel {
  font-size: 11px;
  color: #898781;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.heatmap-rowlabel {
  justify-content: flex-end;
  padding-right: 6px;
}

.heatmap-cell {
  aspect-ratio: 2 / 1;
  min-height: 22px;
  border-radius: 4px;
  cursor: default;
  transition: outline 0.1s ease;
}

.heatmap-cell.empty {
  background: var(--bg);
  border: 1px solid var(--border);
}

/* Okno z próbką za małą na wnioski: widoczne, ale wyraźnie słabsze */
.heatmap-cell.weak {
  opacity: 0.35;
  border: 1px dashed var(--border);
}

.heatmap-cell:hover {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: 12px;
}

.heatmap-swatch {
  width: 22px;
  height: 12px;
  border-radius: 3px;
}

.cell-caption {
  max-width: 320px;
  overflow-wrap: break-word;
}

/* Research hashtagów — oceny szansy i zestawy */

.tier {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.tier-pewniak,
.tier-realny {
  background: #dcfce7;
  color: #14532d;
}

.tier-graniczny {
  background: #fef3c7;
  color: #78350f;
}

.tier-bezszans {
  background: #fee2e2;
  color: #7f1d1d;
}

/* Charakter hashtagu — czy w ogóle warto w niego celować */

.char-nisza {
  background: #dcfce7;
  color: #14532d;
}

.char-cichy {
  background: #e2e8f0;
  color: #334155;
}

.char-zabetonowany {
  background: #ede9fe;
  color: #4c1d95;
}

.char-mlyn {
  background: #dbeafe;
  color: #1e3a8a;
}

.char-nieznany {
  background: #fef3c7;
  color: #78350f;
}

.tier[title] {
  cursor: help;
}

.hashtag-set {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 12px;
  background: var(--bg);
}

.hashtag-set .set-head {
  margin-bottom: 8px;
}

.hashtag-set .set-text {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  background: var(--surface);
  resize: vertical;
}

.code-dump {
  max-height: 380px;
  overflow: auto;
  padding: 14px;
  background: #1a1a19;
  color: #e8e8e4;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
}

code {
  padding: 2px 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

/* ------------------------------------------------------------
   Responsywność
   ------------------------------------------------------------ */

@media (max-width: 720px) {
  .app-header {
    padding: 12px 16px;
  }

  .app-main {
    padding: 16px 12px 48px;
  }

  .card {
    padding: 16px;
  }

  .post-card {
    flex-direction: column;
  }

  .post-thumb {
    width: 100%;
    height: 200px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar > * {
    width: 100%;
  }
}
