:root {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-2: #edf3f8;
  --surface-3: #e3edf6;
  --border: rgba(10, 102, 194, 0.18);
  --text: #1f2937;
  --muted: #64748b;
  --muted-2: #334155;
  --linkedin: #0a66c2;
  --linkedin-light: #378fe9;
  --accent: #f59e0b;
  --accent-2: #ea580c;
  --good: #057642;
  --bad: #cc3148;
  --shadow: 0 18px 45px rgba(8, 27, 53, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background:
    radial-gradient(circle at 18% -12%, rgba(10, 102, 194, 0.18), transparent 34%),
    radial-gradient(circle at 86% 0%, rgba(245, 158, 11, 0.18), transparent 28%),
    linear-gradient(180deg, #eef6ff 0%, var(--bg) 44%);
  color: var(--text);
  min-height: 100vh;
}

.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 12px;
  opacity: 0.9;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.32));
}

.header-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
}

.toggle input { accent-color: var(--linkedin-light); }
.geo-filter {
  width: min(320px, 100%);
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 24px rgba(8, 27, 53, 0.08);
}

.geo-filter__label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.geo-filter__search,
.geo-filter__select {
  width: 100%;
  border: 1px solid rgba(10, 102, 194, 0.2);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  font: inherit;
}

.geo-filter__search {
  margin-bottom: 7px;
  padding: 8px 10px;
}

.geo-filter__select {
  min-height: 120px;
  padding: 6px;
}

.geo-filter__select option {
  padding: 5px 6px;
  border-radius: 6px;
}

.geo-filter__hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}


.toggle--strong {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.36);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.08);
  font-weight: 600;
}

.eyebrow {
  margin: 0;
  color: var(--linkedin);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 11px;
  font-weight: 800;
}

h1 {
  margin: 3px 0 0;
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.intro {
  margin: 7px 0 0;
  color: var(--muted-2);
  max-width: 680px;
  line-height: 1.42;
  font-size: 15px;
}

main {
  display: grid;
  grid-template-columns: minmax(360px, 420px) minmax(0, 1fr);
  grid-template-areas:
    "stats feed"
    "profile feed";
  align-items: start;
  gap: 16px;
}

.api-stats-board,
.profile-setup,
.profile-summary,
.widget,
.links-showcase {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.api-stats-board {
  grid-area: stats;
  margin: 0;
  padding: 14px;
  border-top: 3px solid var(--accent);
}

.api-stats-board.is-error { border-top-color: var(--bad); }

.api-stats-board__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.api-stats-board__updated {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.api-stats-board__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.api-stat-card {
  background: rgba(10, 102, 194, 0.045);
  border: 1px solid rgba(10, 102, 194, 0.14);
  border-radius: 10px;
  padding: 11px 12px;
}

.api-stat-card__label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.api-stat-card__value {
  display: block;
  color: var(--text);
  font-size: clamp(21px, 3vw, 27px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.api-stats-board.is-ok #apiStatusValue { color: var(--good); }
.api-stats-board.is-error #apiStatusValue { color: var(--bad); }

.profile-setup,
.profile-summary {
  grid-area: profile;
  margin: 0;
  padding: 14px;
}

.profile-setup h2 {
  margin: 5px 0 7px;
  font-size: 21px;
  line-height: 1.15;
}

.profile-setup p {
  color: var(--muted-2);
  line-height: 1.45;
  margin: 0;
  font-size: 14px;
}

.profile-empty-callout {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 2px solid rgba(245, 158, 11, 0.48);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(10, 102, 194, 0.08));
  color: #7c2d12;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(245, 158, 11, 0.18);
}

.profile-empty-callout__arrow {
  flex: 0 0 auto;
  color: var(--accent-2);
  font-size: 34px;
  line-height: 1;
  animation: pointToProfileInput 1.1s ease-in-out infinite;
}

.profile-form {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.profile-form input {
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
}

.profile-form input::placeholder { color: var(--muted); }
.profile-form button:disabled { cursor: progress; opacity: 0.65; }
.profile-status { margin-top: 12px !important; color: var(--muted) !important; }
.profile-status.is-error { color: var(--bad) !important; }
.profile-status.is-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--linkedin) !important;
  font-weight: 800;
}

.profile-status.is-loading::before,
.widget__state::before {
  content: '';
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid rgba(10, 102, 194, 0.18);
  border-top-color: var(--accent-2);
  animation: spin 0.7s linear infinite;
}

.profile-summary {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  color: var(--muted-2);
}

.profile-summary > .ghost-btn {
  align-self: flex-start;
  margin-top: 8px;
}

.profile-summary__main { flex: 1; min-width: 0; }
.profile-insights { margin-top: 12px; }

.profile-summary { min-width: 0; }

.profile-editor {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.profile-insights__block {
  background: rgba(10, 102, 194, 0.045);
  border: 1px solid rgba(10, 102, 194, 0.14);
  border-radius: 10px;
  padding: 11px;
}

.profile-insights__block strong,
.profile-insights__block label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.profile-insights__block--geo {
  border-color: rgba(245, 158, 11, 0.28);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(10, 102, 194, 0.045));
}

.profile-insights__block p {
  margin: 0;
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.45;
}

.profile-comment-list {
  margin: 0;
  padding-left: 17px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.45;
  max-height: 260px;
  overflow: auto;
}

.profile-comment-list li + li { margin-top: 7px; }

.profile-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-chip {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.32);
  color: #7c2d12;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
}

.profile-insights__empty { color: var(--muted); font-size: 13px; }

.profile-editor textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 14px;
}

.profile-editor textarea::placeholder { color: var(--muted); }
.profile-editor__hint { margin-top: 8px !important; }
.profile-editor__hint code { color: var(--text); background: rgba(10, 102, 194, 0.08); border-radius: 6px; padding: 1px 5px; }
.profile-editor__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.profile-editor__status { color: var(--good); font-size: 13px; }

.widget {
  grid-area: feed;
  padding: 14px;
}

.widget__state {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(10, 102, 194, 0.12), rgba(245, 158, 11, 0.16));
  border: 2px solid rgba(245, 158, 11, 0.34);
  border-radius: 14px;
  padding: 20px;
  color: var(--linkedin);
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 14px 32px rgba(10, 102, 194, 0.14);
  animation: loadingGlow 1.25s ease-in-out infinite;
}

.post-card,
.suggestion-panel {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid rgba(10, 102, 194, 0.16);
  padding: 16px;
}

.post-card__meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.post-card__meta a { color: var(--linkedin); text-decoration: none; font-weight: 800; }
.post-card__meta > a { color: var(--linkedin); font-size: 13px; white-space: nowrap; }

#postDate { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.post-card__text {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
  color: #243447;
  font-size: 15px;
}

.post-card__stats { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }

.post-card__stats span {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(10, 102, 194, 0.1);
  color: #28527a;
  font-size: 12px;
  font-weight: 700;
}

.post-card__stats .suggestion {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  color: #ffffff;
  border: 1px solid rgba(234, 88, 12, 0.5);
  box-shadow: 0 10px 22px rgba(234, 88, 12, 0.22), 0 0 0 3px rgba(245, 158, 11, 0.12);
  font-size: 14px;
  letter-spacing: -0.01em;
  order: -1;
  padding: 8px 13px;
  text-transform: none;
}

.post-card__stats .suggestion--repost {
  background: linear-gradient(135deg, #0a66c2 0%, #7c3aed 100%);
  border-color: rgba(124, 58, 237, 0.46);
  box-shadow: 0 10px 22px rgba(10, 102, 194, 0.22), 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.suggestion-panel { margin-top: 10px; border-left: 3px solid var(--accent); }
.suggestion-panel h2 { margin: 0; font-size: 17px; }

.suggestion-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.copy-btn { padding: 7px 10px; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }

.suggestion-panel p { margin: 0; line-height: 1.5; color: #243447; font-size: 15px; }

.suggestion-panel p.is-loading {
  color: var(--linkedin);
  font-size: 16px;
  font-style: normal;
  font-weight: 800;
  position: relative;
}
.suggestion-panel p.is-loading::after {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-left: 8px;
  border-radius: 50%;
  border: 3px solid rgba(10, 102, 194, 0.2);
  border-top-color: var(--accent-2);
  vertical-align: text-bottom;
  animation: spin 0.8s linear infinite;
}

.actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
button { border: none; cursor: pointer; font: inherit; }

.ghost-btn {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 13px;
  font-weight: 700;
}

.ghost-btn:hover { border-color: rgba(245, 158, 11, 0.55); background: rgba(245, 158, 11, 0.14); }

.action-btn {
  padding: 10px 15px;
  border-radius: 999px;
  font-weight: 800;
  color: #fff;
}

.action-btn.primary { background: var(--linkedin); }
.action-btn.primary:hover { box-shadow: 0 8px 18px rgba(10, 102, 194, 0.22); }
.action-btn.success { background: #057642; }
.action-btn.danger { background: #cc3148; }
.action-btn:hover { filter: brightness(1.08); }

.hidden { display: none; }

.links-showcase {
  margin-top: 16px;
  padding: 14px;
}

.links-showcase h2 { margin: 0 0 12px; font-size: 20px; }

.links-showcase__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.links-showcase__grid a {
  text-decoration: none;
  color: #164e7a;
  font-weight: 800;
  background: rgba(10, 102, 194, 0.08);
  border: 1px solid rgba(10, 102, 194, 0.18);
  border-radius: 10px;
  padding: 11px 12px;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.links-showcase__grid a:hover { transform: translateY(-1px); background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.45); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.72; } }
@keyframes loadingGlow { 0%, 100% { box-shadow: 0 14px 32px rgba(10, 102, 194, 0.14); } 50% { box-shadow: 0 18px 42px rgba(245, 158, 11, 0.28); } }
@keyframes pointToProfileInput { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(8px, 8px); } }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; grid-template-areas: "stats" "profile" "feed"; }
  .api-stats-board__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .links-showcase__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .app-shell { padding: 18px 12px 36px; }
  .app-header { grid-template-columns: 1fr; align-items: flex-start; }
  .header-brand { align-items: flex-start; }
  .brand-logo { width: 48px; height: 48px; }
  .header-controls { width: 100%; justify-content: flex-start; }
  .geo-filter { width: 100%; }
  .api-stats-board__header { flex-direction: column; }
  .api-stats-board__grid,
  .links-showcase__grid { grid-template-columns: 1fr; }
  .profile-form,
  .profile-summary,
  .post-card__meta { flex-direction: column; align-items: stretch; }
}

.geo-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.geo-filter__clear,
.geo-filter__reset {
  padding: 8px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.geo-filter__toolbar {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.geo-filter__toolbar .profile-editor__hint {
  margin-top: 0 !important;
}

.geo-filter__select--native {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.geo-options {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  border: 1px solid rgba(10, 102, 194, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
}

.geo-option {
  display: grid !important;
  grid-template-columns: auto 54px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0 !important;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
}

.geo-option:hover {
  background: rgba(10, 102, 194, 0.06);
  border-color: rgba(10, 102, 194, 0.12);
}

.geo-option.is-selected {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.34);
}

.geo-option input { accent-color: var(--linkedin); }

.geo-option__code {
  color: var(--linkedin);
  font-size: 12px;
  font-weight: 900;
}

.geo-option__name {
  min-width: 0;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.geo-options__more {
  margin: 4px 2px 0 !important;
  color: var(--muted) !important;
  font-size: 12px !important;
}

.geo-selected-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.geo-selected-summary span,
.loader-detail__chips span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(10, 102, 194, 0.09);
  border: 1px solid rgba(10, 102, 194, 0.16);
  color: #164e7a;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.loader-detail {
  display: grid;
  gap: 10px;
  width: 100%;
}

.loader-detail__meta {
  color: var(--muted-2);
  font-size: 13px;
  font-weight: 700;
}

.loader-detail__section {
  display: grid;
  gap: 5px;
}

.loader-detail__label {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.loader-detail__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.loader-detail__chips span {
  background: rgba(255, 255, 255, 0.72);
}

@media (max-width: 680px) {
  .geo-filter__toolbar,
  .geo-search-row { grid-template-columns: 1fr; }
  .geo-filter__toolbar { flex-direction: column; }
}
