/* ===== CSS Variables & Reset ===== */
:root {
  --bg-base: #f5f6fa;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f3ff;
  --border: rgba(99, 102, 241, 0.12);
  --border-bright: rgba(99, 102, 241, 0.3);
  --text-primary: #1a1d3a;
  --text-secondary: #4b5080;
  --text-muted: #9296b8;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-3: #06b6d4;
  --accent-4: #10b981;
  --accent-5: #f59e0b;
  --accent-6: #ef4444;
  --gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(99, 102, 241, 0.08);
  --shadow-card: 0 2px 16px rgba(99, 102, 241, 0.1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f0f1fa;
}

::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 3px;
}

/* ===== LOGIN SCREEN ===== */
/* ===== INFO SCREEN (no token) ===== */
.info-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 65% 25%, rgba(99, 102, 241, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 15% 75%, rgba(139, 92, 246, 0.05) 0%, transparent 50%),
    #f5f6fa;
  padding: 32px 24px;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: 28px;
  padding: 52px 52px 44px;
  max-width: 560px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(99, 102, 241, 0.1);
  animation: fadeInUp 0.6s ease;
}

.info-logo {
  height: 36px;
  max-width: 180px;
  object-fit: contain;
  margin-bottom: 28px;
  display: inline-block;
}

.info-title {
  font-size: 1.7rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 14px;
}

.info-lead {
  color: var(--text-secondary);
  font-size: 0.97rem;
  line-height: 1.65;
  margin-bottom: 32px;
}

.info-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
  margin-bottom: 36px;
}

.info-feature {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: rgba(99, 102, 241, 0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
}

.info-feature-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.info-feature strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.info-feature p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.info-contact {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(139, 92, 246, 0.04));
  border: 1px solid var(--border-bright);
  border-radius: 16px;
  padding: 24px 24px 20px;
}

.info-contact-title {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
  font-size: 1rem;
}

.info-contact p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.info-contact-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.info-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--accent);
  color: #fff;
  transition: opacity 0.2s, transform 0.15s;
}

.info-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.info-btn-outline {
  background: transparent;
  border: 1.5px solid var(--accent);
  color: var(--accent);
}

.info-btn-outline:hover {
  background: rgba(99, 102, 241, 0.06);
}

/* ===== ERROR SCREEN (invalid token) ===== */
.error-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 60% 30%, rgba(239, 68, 68, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 70%, rgba(239, 68, 68, 0.04) 0%, transparent 50%),
    #f9f9f9;
  padding: 24px;
}

.error-card {
  background: var(--bg-card);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 24px;
  padding: 52px 48px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(239, 68, 68, 0.08), 0 0 0 1px rgba(239, 68, 68, 0.05);
  animation: fadeInUp 0.6s ease;
}

.error-icon {
  font-size: 3.5rem;
  margin-bottom: 20px;
  display: block;
}

.error-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #dc2626;
  margin-bottom: 12px;
}

.error-message {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 12px;
  line-height: 1.6;
}

.error-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 32px;
  line-height: 1.6;
}

.error-hint a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.error-hint a:hover {
  text-decoration: underline;
}

.error-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.error-logo-link:hover {
  opacity: 1;
}

.error-logo-img {
  height: 30px;
  max-width: 160px;
  object-fit: contain;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 60% 30%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 70%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
    #f5f6fa;
  padding: 24px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: 24px;
  padding: 52px 48px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(99, 102, 241, 0.1), 0 0 0 1px rgba(99, 102, 241, 0.05);
  animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 50%;
  margin-bottom: 24px;
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.login-title {
  font-size: 1.75rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 36px;
  line-height: 1.6;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1.5px solid #e0e3f5;
  color: var(--text-primary);
  padding: 14px 28px;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  width: 100%;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}

.btn-google:hover {
  background: #f5f6ff;
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
}

.login-note {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 20px;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 12px rgba(99, 102, 241, 0.07);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  flex-shrink: 0;
}

.header-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f0f0f;
}

.header-subtitle {
  font-size: 12px;
  color: #6b7280;
  font-weight: 400;
  margin-top: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dashboard-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 9%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, #fff);
  border-radius: 8px;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 13px;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
}

.dashboard-nav-btn:hover {
  background: color-mix(in srgb, var(--accent) 15%, #fff);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.menabo-logo-link {
  display: flex;
  align-items: center;
  margin-left: auto;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.menabo-logo-link:hover {
  opacity: 1;
}

.menabo-logo-img {
  height: 28px;
  max-width: 200px;
  object-fit: contain;
  display: block;
}

.header-version {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.04);
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0;
  text-decoration: none;
  transition: color 0.18s ease, background 0.18s ease;
}

.header-version:hover {
  background: color-mix(in srgb, var(--accent) 10%, #fff 90%);
  color: var(--accent);
}

.last-updated {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: #f5f6fa;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.07);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: var(--accent);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-refresh:hover {
  background: rgba(99, 102, 241, 0.14);
  border-color: var(--accent);
}

.btn-refresh svg {
  transition: transform 0.4s ease;
}

.btn-refresh:hover svg {
  transform: rotate(180deg);
}

.header-pending-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: default;
  user-select: none;
}

.header-pending-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.header-pending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 99px;
  background: #2fdc26;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
  font-family: 'Inter', sans-serif;
}

.tab-pending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: #dc2626;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  font-family: 'Inter', sans-serif;
  vertical-align: middle;
  margin-left: 3px;
}

.tab-pending-badge--note {
  background: #0ea5e9;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  border: 2px solid rgba(99, 102, 241, 0.25);
  transition: all 0.2s ease;
  overflow: hidden;
}

.user-avatar:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 32px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 65px;
  z-index: 99;
  box-shadow: 0 1px 12px rgba(99, 102, 241, 0.07);
}

/* Riga superiore: periodo + contatore righe */
.filter-bar-top {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Il filter-group dei profili occupa tutta la larghezza */
.filter-group--profiles {
  width: 100%;
}

.filter-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-select,
.filter-input {
  background: #f7f8fc;
  border: 1px solid #e0e3f5;
  color: var(--text-primary);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color 0.2s ease;
  min-width: 180px;
}

.filter-select:focus,
.filter-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

.filter-input::placeholder {
  color: var(--text-muted);
}

.btn-clear {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-clear:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: #ef4444;
}

.filter-stats {
  font-size: 0.82rem;
  color: var(--text-muted);
  align-self: center;
  padding-bottom: 2px;
}

/* ===== DASHBOARD LAYOUT ===== */
.dashboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== KPI GRID ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 24px 32px 8px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  animation: fadeInUp 0.5s ease both;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 99px 99px 0 0;
}

.kpi-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.12);
}

.kpi-card--ai {
  border-color: rgba(99, 102, 241, 0.22);
  grid-column: 1 / -1;
  /* full row width */
  --kpi-color: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.kpi-ai-body {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-top: 2px;
  white-space: pre-line;
}

.kpi-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-icon {
  font-size: 1.1rem;
  opacity: 0.8;
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.kpi-value--small {
  font-size: 1.15rem;
  word-break: break-word;
  white-space: normal;
  line-height: 1.3;
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ===== PROFILE HEADER WIDGETS ===== */
.profile-header-widgets {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 16px;
  padding: 8px 32px 4px;
  animation: fadeInUp 0.35s ease both;
}

.profile-info-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-card);
}

.profile-info-avatar {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.profile-info-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* Badge nome gruppo (INDUSTRY NARRATIVE SHAPER / ORG / MEDIA) */
.profile-group-badge {
  display: inline-block;
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #3d3d3d;
  background: color-mix(in srgb, var(--group-color, #9ca3af) 30%, transparent);
  border: 1.5px solid var(--group-color, #9ca3af);
  border-radius: 4px;
  padding: 2px 8px;
  margin-bottom: 4px;
  width: fit-content;
}

.profile-info-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.profile-pending-count-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.profile-pending-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: #dc2626;
}

.profile-pending-count--note {
  color: #0ea5e9;
}

.profile-pending-count--note {
  color: #0ea5e9;
}

.profile-pending-anchors {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.profile-pending-anchor {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 1rem;
  color: #dc2626;
  transition: transform 0.2s ease;
  line-height: 1;
}

.profile-pending-anchor:hover {
  transform: scale(1.25);
}

.profile-info-company {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.profile-info-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.09);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 99px;
  padding: 2px 8px;
  margin-top: 2px;
  width: fit-content;
}

.profile-info-bio {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.profile-info-bio--empty {
  color: var(--text-muted);
  font-style: italic;
}

.profile-info-link {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  margin-top: 4px;
  opacity: 0.8;
  transition: opacity 0.15s ease;
  width: fit-content;
}

.profile-info-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.profile-priority-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.profile-priority-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.profile-priority-select {
  appearance: none;
  -webkit-appearance: none;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  padding: 3px 24px 3px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--border-bright);
  background: var(--bg-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239ca3af' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 8px center;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  outline: none;
}

.profile-priority-select:hover {
  border-color: var(--accent);
}

.profile-priority-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.profile-priority-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


.profile-followers-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-card);
  text-align: center;
}

.profile-followers-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.profile-followers-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.profile-followers-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.profile-ai-card {
  background: var(--bg-card);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 220px;
}

.profile-ai-header {
  display: flex;
  align-items: center;
  gap: 7px;
}

.profile-ai-icon {
  font-size: 1rem;
  line-height: 1;
}

.profile-ai-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.profile-ai-body {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ===== RANKING WIDGET ===== */

.rankings-row {
  display: flex;
  gap: 16px;
  margin: 0 32px 8px;
}

.rankings-row .ranking-section {
  margin: 0;
  flex: 1 1 0;
  min-width: 0;
}

.ranking-section {
  margin: 0 32px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow-card);
  animation: fadeInUp 0.5s ease both;
}

.ranking-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.ranking-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.ranking-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.period-tabs {
  display: flex;
  gap: 6px;
  background: #f5f6fa;
  border-radius: 8px;
  padding: 4px;
  border: 1px solid var(--border);
}

.priority-tabs {
  flex-wrap: wrap;
  max-width: 390px;
}

.priority-tabs .period-btn {
  min-width: 38px;
  padding: 6px 12px;
}

.priority-tabs .priority-all-btn {
  min-width: auto;
}

/* Barra profili: pulsanti singoli che vanno a capo su più righe */
.profile-tabs-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
}

.period-btn {
  background: transparent;
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.period-btn:hover {
  color: var(--accent);
}

.period-btn.active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 6px rgba(99, 102, 241, 0.15);
}

/* Pulsanti profilo: variante standalone con bordo */
.profile-tabs-wrap .period-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 14px;
  border-radius: 20px;
  white-space: nowrap;
}

.profile-tabs-wrap .period-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(99, 102, 241, 0.06);
}

.profile-tabs-wrap .period-btn.active {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
  /* Il box-shadow del gruppo (applicato via inline style) viene preservato
     combinando con il box-shadow di elevazione tramite JS */
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.profile-tabs-wrap .relevance-filter-btn.relevance-high.active {
  background: #b91c1c;
}

.profile-tabs-wrap .relevance-filter-btn.relevance-medium.active {
  background: #b45309;
}

.profile-tabs-wrap .relevance-filter-btn.relevance-low.active {
  background: #0369a1;
}

.profile-tabs-wrap .relevance-filter-btn.relevance-none.active {
  background: #475569;
}

.profile-tabs-empty {
  align-items: center;
  color: var(--text-muted);
  display: inline-flex;
  font-size: 0.82rem;
  min-height: 32px;
  padding: 0 8px;
}

.ranking-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ranking-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
}

.rank-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  width: 28px;
}

.rank-num.rank-1 {
  color: #f59e0b;
}

.rank-num.rank-2 {
  color: #9296b8;
}

.rank-num.rank-3 {
  color: #cd7c3a;
}

.rank-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rank-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.rank-bar-bg {
  height: 6px;
  background: #f0f1fa;
  border-radius: 99px;
  overflow: hidden;
}

.rank-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--gradient);
  transition: width 0.6s ease;
}

.rank-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.07);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 20px;
  padding: 4px 12px;
  white-space: nowrap;
}

.ranking-row--multi {
  align-items: flex-start;
}

.rank-metric-row {
  display: grid;
  grid-template-columns: 80px 1fr 48px;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}

.rank-metric-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.rank-metric-val {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: right;
}

.rank-details {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ===== TOP POSTS WIDGETS ===== */
.top-posts-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  padding: 8px 32px 0;
}

.top-post-widget {
  margin: 0 !important;
}

/* ===== AI INSIGHT WIDGETS ===== */
.ai-insights-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px 32px 0;
}

.ai-insight-widget {
  margin: 0 !important;
  min-height: 180px;
}

/* Word Cloud */
.sentiment-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  padding: 14px 4px 4px;
  min-height: 100px;
}

.sentiment-word {
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: default;
  transition: transform 0.18s ease, opacity 0.18s ease;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.sentiment-word em {
  font-style: normal;
  font-size: 0.7em;
  font-weight: 500;
  opacity: 0.7;
  margin-left: 3px;
}

.sentiment-word:hover {
  transform: scale(1.12);
  opacity: 1 !important;
}

.keyword-word,
.cloud-word {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  padding: 2px 4px;
  cursor: pointer;
  text-align: left;
}

.keyword-word:focus-visible,
.cloud-word:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.keyword-word.is-active,
.cloud-word.is-active {
  color: var(--accent) !important;
  opacity: 1 !important;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.keyword-clear-btn {
  margin-top: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 10%, white);
  color: var(--accent);
  font: 700 12px/1.2 'Inter', sans-serif;
  padding: 8px 10px;
  cursor: pointer;
}

.keyword-clear-btn:hover {
  background: color-mix(in srgb, var(--accent) 16%, white);
}

/* ===== KEYWORD DASHBOARD ===== */
.dashboard-view {
  width: 100%;
}

.keyword-filter-bar {
  top: 65px;
}

.keyword-primary-filter {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 32px 0;
}

.keyword-primary-filter .keyword-tabs-wrap {
  gap: 8px;
}

.keyword-primary-filter .period-btn {
  font-size: 0.84rem;
  padding: 7px 15px;
}

.keyword-week-select {
  min-width: 240px;
}

.filter-group--keyword {
  min-width: 220px;
}

.keyword-tabs-wrap {
  max-width: 100%;
}

.keyword-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.keyword-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
  padding: 8px 32px 0;
}

.keyword-panel {
  margin: 0 !important;
}

.keyword-panel--wide {
  min-width: 0;
}

.keyword-table-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 420px;
  overflow: auto;
}

.keyword-table {
  border-collapse: collapse;
  font-size: 0.8rem;
  width: 100%;
}

.keyword-table th {
  background: #f7f8fc;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  position: sticky;
  text-align: right;
  text-transform: uppercase;
  top: 0;
  white-space: nowrap;
}

.keyword-table th:first-child,
.keyword-table td:first-child {
  text-align: left;
}

.keyword-table td {
  border-bottom: 1px solid #f0f2fa;
  color: var(--text-secondary);
  padding: 10px 12px;
  text-align: right;
  white-space: nowrap;
}

.keyword-table tr:last-child td {
  border-bottom: 0;
}

.keyword-table tr.is-active td,
.keyword-table tbody tr:hover td {
  background: color-mix(in srgb, var(--accent) 7%, #fff);
}

.keyword-link-btn {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0;
  text-align: left;
}

.keyword-cloud {
  min-height: 240px;
}

.keyword-charts-row {
  padding-top: 16px;
}

.keyword-top-row {
  padding-top: 0;
}

.keyword-mini-card {
  min-height: 0;
}

.keyword-mini-card .top-post-date {
  margin-left: 0;
}

.keyword-mini-card .keyword-favorite-btn {
  height: 28px;
  margin-left: auto;
  width: 28px;
}

.keyword-badge {
  background: color-mix(in srgb, var(--accent) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, #fff);
  border-radius: 99px;
  color: var(--accent);
  display: inline-flex;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 8px;
  padding: 3px 9px;
  width: fit-content;
}

.keyword-intel-meta {
  display: grid;
  gap: 6px;
  margin: 2px 0 4px;
}

.keyword-intel-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.keyword-intel-badge {
  border-radius: 6px;
  cursor: help;
  display: inline-flex;
  font-size: 0.66rem;
  font-weight: 850;
  line-height: 1.2;
  padding: 3px 7px;
  text-transform: uppercase;
  width: fit-content;
}

.keyword-intel-badge--relevance {
  background: #f5f6fa;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.keyword-relevance-high {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.25);
  color: #b91c1c;
}

.keyword-relevance-medium {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #b45309;
}

.keyword-relevance-low {
  background: rgba(14, 165, 233, 0.1);
  border-color: rgba(14, 165, 233, 0.28);
  color: #0369a1;
}

.keyword-relevance-none {
  background: rgba(100, 116, 139, 0.1);
  border-color: rgba(100, 116, 139, 0.24);
  color: #475569;
}

.keyword-intel-badge--tag {
  background: color-mix(in srgb, var(--accent) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, #fff);
  color: var(--accent);
}

.keyword-intel-badge--sentiment {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
}

.keyword-sentiment-positive {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.28);
  color: #047857;
}

.keyword-sentiment-critical {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.28);
  color: #b91c1c;
}

.keyword-sentiment-mixed {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.28);
  color: #6d28d9;
}

.keyword-sentiment-not_relevant {
  background: rgba(100, 116, 139, 0.1);
  border-color: rgba(100, 116, 139, 0.24);
  color: #475569;
}

.keyword-intel-reason {
  background: #fff;
  border-left: 3px solid var(--accent);
  color: var(--text-secondary);
  font-size: 0.74rem;
  line-height: 1.45;
  padding: 7px 9px;
}

.keyword-author-card {
  align-items: flex-start;
  background: #fafbff;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 24px 36px minmax(0, 1fr);
  padding: 12px;
}

.keyword-author-rank {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 900;
  padding-top: 6px;
  text-align: center;
}

.keyword-author-avatar {
  border-radius: 50%;
  height: 36px;
  object-fit: cover;
  width: 36px;
}

.keyword-author-avatar--empty {
  align-items: center;
  background: var(--gradient);
  color: #fff;
  display: inline-flex;
  font-size: 0.85rem;
  font-weight: 800;
  justify-content: center;
}

.keyword-author-body {
  min-width: 0;
}

.keyword-author-name,
.keyword-author-name a {
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.25;
  text-decoration: none;
}

.keyword-author-name a:hover {
  color: var(--accent);
}

.keyword-author-headline {
  color: var(--text-muted);
  display: -webkit-box;
  font-size: 0.72rem;
  line-height: 1.35;
  margin-top: 3px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.keyword-author-metrics {
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  margin-top: 6px;
}

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

.keyword-post-card {
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  display: grid;
  gap: 18px;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  padding: 18px 22px;
}

.keyword-post-card:hover {
  border-color: var(--border-bright);
}

.keyword-post-meta {
  align-items: flex-start;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  font-size: 0.76rem;
  font-weight: 700;
  gap: 8px;
}

.keyword-post-meta .keyword-favorite-btn {
  margin-bottom: 2px;
}

.keyword-post-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.keyword-post-author {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.keyword-post-text {
  color: var(--text-secondary);
  display: -webkit-box;
  font-size: 0.82rem;
  line-height: 1.6;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
}

.keyword-hashtags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.keyword-hashtags span {
  background: #f5f6fa;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
}

.keyword-post-side {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Topic Bar / Heatmap */
.topic-bar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 14px 0 4px;
  align-items: flex-end;
}

.topic-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 56px;
  max-width: 90px;
}

.topic-heat-square {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  cursor: default;
  position: relative;
}

.topic-heat-square:hover {
  transform: scale(1.1) translateY(-2px);
}

.topic-heat-count {
  line-height: 1;
  letter-spacing: -0.02em;
}

.topic-col-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
  max-width: 88px;
}

.top-posts-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.top-post-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  background: #fafbff;
  transition: all 0.2s ease;
}

.top-post-card:hover {
  border-color: var(--border-bright);
  background: #f0f3ff;
}

.top-post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.top-post-medal {
  font-size: 1.2rem;
}

.top-post-profile {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.top-post-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: auto;
}

.top-post-excerpt {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}

.top-post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.top-post-metrics {
  display: flex;
  gap: 8px;
}

.top-post-metric {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(99, 102, 241, 0.06);
  padding: 3px 8px;
  border-radius: 6px;
}

.top-post-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 4px 12px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.top-post-link:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--accent);
}

.top-post-anchor {
  font-size: 0.85rem;
  background: none;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--primary);
  transition: all 0.2s ease;
  line-height: 1;
}

.top-post-anchor:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--accent);
}

/* ===== CHARTS ROW ===== */
.charts-row {
  display: grid;
  gap: 16px;
  padding: 16px 32px;
}

.charts-row.cols-2 {
  grid-template-columns: 1fr 1fr;
}

.charts-row.cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.charts-row.cols-1 {
  grid-template-columns: 1fr;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.25s ease;
  animation: fadeInUp 0.5s ease both;
}

.chart-card:hover {
  border-color: var(--border-bright);
}

.chart-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.chart-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.chart-container {
  position: relative;
  width: 100%;
}

.chart-links-row {
  display: flex;
  justify-content: space-around;
  margin-top: 8px;
  padding: 6px 40px 0;
}

.chart-post-link {
  font-size: 0.82rem;
  text-decoration: none;
  padding: 2px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.chart-post-link:hover {
  background: rgba(99, 102, 241, 0.1);
  transform: scale(1.2);
}

/* ===== PROFILE POST LIST ===== */
.profile-posts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-card);
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 20px;
  align-items: start;
  transition: border-color 0.2s ease;
}

.profile-post-card:hover {
  border-color: var(--border-bright);
}

.profile-post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.post-favorite-btn {
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: #c5cadb;
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  font-size: 1.05rem;
  height: 30px;
  justify-content: center;
  line-height: 1;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  width: 30px;
}

.post-favorite-btn:hover {
  border-color: var(--accent);
  color: color-mix(in srgb, var(--accent) 62%, #c5cadb 38%);
  transform: translateY(-1px);
}

.post-favorite-btn.is-favorite {
  background: color-mix(in srgb, var(--accent) 10%, #fff 90%);
  border-color: color-mix(in srgb, var(--accent) 45%, #fff 55%);
  color: var(--accent);
}

.post-favorite-btn:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.profile-post-date {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-post-type {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(99, 102, 241, 0.07);
  padding: 2px 8px;
  border-radius: 99px;
  display: inline-block;
}

.profile-post-content {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.profile-post-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.profile-post-stat {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(99, 102, 241, 0.06);
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.profile-post-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 6px;
  margin-top: 4px;
  transition: all 0.2s ease;
}

.profile-post-link:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--accent);
}

.profile-post-link--repost {
  border-color: rgba(6, 182, 212, 0.4);
  color: #0891b2;
}

.profile-post-link--repost:hover {
  background: rgba(6, 182, 212, 0.08);
  border-color: #06b6d4;
}

/* ===== POST TAB BAR ===== */
.profile-post-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-tab-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.post-tab {
  font-size: 0.73rem;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: 'Inter', sans-serif;
}

.post-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
}

.post-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.post-tab[data-tab="pc"].active {
  background: #6366f1;
  border-color: #6366f1;
}

.post-tab[data-tab="note"].active {
  background: #b45309;
  border-color: #b45309;
}

.post-tab--insert {
  border-style: dashed;
  color: var(--text-muted);
  opacity: 0.7;
}

.post-tab--insert:hover {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
}

.post-eng-level {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.post-eng-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.post-eng-select {
  appearance: none;
  -webkit-appearance: none;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  padding: 2px 20px 2px 8px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--bg-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%239ca3af' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 6px center;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.post-eng-select:hover {
  border-color: var(--accent);
}

.post-eng-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.post-eng-select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.post-ai-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  width: 100%;
  margin-top: 4px;
}

.post-ai-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 99px;
  padding: 2px 10px;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.post-approved-icon {
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  cursor: default;
  user-select: none;
}

.post-approve-btn {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1.5px solid rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.1);
  color: #b45309;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.post-approve-btn:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  color: #92400e;
}

.post-approve-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.post-approve-btn--note {
  border-color: rgba(14, 165, 233, 0.5);
  background: rgba(14, 165, 233, 0.1);
  color: #0284c7;
}

.post-approve-btn--note:hover {
  background: rgba(14, 165, 233, 0.2);
  border-color: #0ea5e9;
  color: #0369a1;
}

.post-tab-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.post-tab-edit:hover {
  opacity: 1;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

/* ── Inline Editor ── */
.post-inline-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(99, 102, 241, 0.04);
  border: 1.5px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px;
  animation: fadeInUp 0.15s ease;
}

.post-editor-textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-family: 'Inter', sans-serif;
  line-height: 1.5;
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  background: #fff;
  color: var(--text-primary);
  resize: vertical;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s;
}

.post-editor-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.post-editor-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.post-editor-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  border: none;
  transition: all 0.18s ease;
}

.post-editor-btn--save {
  background: var(--accent);
  color: #fff;
}

.post-editor-btn--save:hover {
  background: #4f46e5;
}

.post-editor-btn--save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.post-editor-btn--cancel {
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.post-editor-btn--cancel:hover {
  color: #ef4444;
  border-color: #ef4444;
}

/* ===== DATA TABLE ===== */
.table-section {
  padding: 8px 32px 40px;
}

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

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

.btn-export {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.07);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #059669;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-export:hover {
  background: rgba(16, 185, 129, 0.14);
  border-color: var(--accent-4);
}

.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 480px;
  box-shadow: var(--shadow-card);
}

#data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

#data-table th {
  position: sticky;
  top: 0;
  background: #f7f8fc;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

#data-table td {
  padding: 10px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid #f0f2fa;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#data-table tr:last-child td {
  border-bottom: none;
}

#data-table tbody tr {
  transition: background 0.15s ease;
}

#data-table tbody tr:hover {
  background: #f5f6ff;
}

/* ===== LOADING & STATES ===== */
.loading {
  position: fixed;
  inset: 0;
  background: rgba(245, 246, 250, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 999;
  backdrop-filter: blur(4px);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(99, 102, 241, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none !important;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 92px;
  right: 28px;
  background: #fff;
  border: 1px solid var(--border-bright);
  color: var(--text-primary);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.15);
  z-index: 9999;
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

.back-to-top {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-bright);
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.24);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 9998;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  box-shadow: 0 14px 36px rgba(99, 102, 241, 0.32);
  transform: translateY(-2px);
}

.back-to-top:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.28);
  outline-offset: 3px;
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.4);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.4);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.9rem;
}

/* ===== VERSION PAGE ===== */
.version-page {
  min-height: 100vh;
  background: linear-gradient(180deg, #fff 0%, var(--bg-base) 100%);
  color: var(--text-primary);
}

.version-shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.version-hero {
  margin-bottom: 28px;
}

.version-back {
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 28px;
  text-decoration: none;
}

.version-back:hover {
  text-decoration: underline;
}

.version-eyebrow,
.version-label {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.version-hero h1 {
  font-size: 4rem;
  line-height: 1;
  letter-spacing: 0;
  margin: 0 0 16px;
}

.version-lead {
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.7;
  max-width: 680px;
  margin: 0;
}

.version-timeline {
  display: grid;
  gap: 18px;
}

.version-release {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.version-release--current {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border) 68%);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.version-release-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px;
  border-bottom: 1px solid var(--border);
}

.version-release h2 {
  font-size: 1.8rem;
  line-height: 1;
  margin: 0;
}

.version-release time {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.version-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
}

.version-columns section {
  background: #fff;
  padding: 24px 26px 28px;
}

.version-columns h3 {
  font-size: 0.92rem;
  margin: 0 0 14px;
}

.version-columns ul {
  color: var(--text-muted);
  display: grid;
  gap: 10px;
  font-size: 0.9rem;
  line-height: 1.55;
  list-style: none;
  margin: 0;
  padding: 0;
}

.version-columns li {
  position: relative;
  padding-left: 18px;
}

.version-columns li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .header {
    padding: 14px 20px;
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }

  .header-right {
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
  }

  .filter-bar {
    padding: 14px 20px;
  }

  .kpi-grid {
    padding: 16px 20px 8px;
  }

  .charts-row {
    padding: 10px 20px;
  }

  .table-section {
    padding: 8px 20px 32px;
  }

  .charts-row.cols-2,
  .charts-row.cols-3 {
    grid-template-columns: 1fr;
  }

  .keyword-grid,
  .keyword-top-row {
    grid-template-columns: 1fr;
    padding-left: 20px;
    padding-right: 20px;
  }

  .keyword-post-card {
    grid-template-columns: 1fr;
  }

  .keyword-post-meta,
  .keyword-post-side {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .header-right .last-updated {
    display: none;
  }

  .version-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .login-card {
    padding: 36px 24px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .toast {
    right: 20px;
    bottom: 82px;
    max-width: calc(100vw - 40px);
  }

  .back-to-top {
    right: 20px;
    bottom: 20px;
    width: 48px;
    height: 48px;
  }

  .version-shell {
    width: min(100% - 32px, 1120px);
    padding: 32px 0 48px;
  }

  .version-hero h1 {
    font-size: 2.4rem;
  }

  .version-release-head {
    flex-direction: column;
    padding: 22px;
  }

  .version-columns section {
    padding: 22px;
  }
}
