:root {
  --bg: #f6f6f6;
  --bg-accent: #eff5ff;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-strong: #ffffff;
  --surface-subtle: #f0f0f2;
  --line: #dedee3;
  --line-strong: #cacad1;
  --text: #1b1b1f;
  --muted: #5c5c66;
  --text-subtle: #6f727b;
  --accent: #0063fb;
  --accent-hover: #004bbd;
  --accent-soft: #e1edfe;
  --secondary: #0386bf;
  --secondary-soft: #e0f6ff;
  --good: #059e6f;
  --good-soft: #ebfff6;
  --warn: #d5840b;
  --warn-soft: #fff8e6;
  --danger: #d91f0a;
  --danger-soft: #fff5f5;
  --shadow: 0 8px 18px rgba(13, 24, 43, 0.08), 0 18px 38px rgba(13, 24, 43, 0.08);
  --shell-width: min(1080px, calc(100% - 32px));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Finntype", "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  background:
    radial-gradient(circle at top left, rgba(6, 190, 251, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(0, 99, 251, 0.14), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 72%, var(--bg-accent) 100%);
}

.page-shell {
  width: var(--shell-width);
  margin: 0 auto;
  padding: 40px 0;
}

/* ------------------------------------------------------------------ */
/* Hero                                                                */
/* ------------------------------------------------------------------ */

.hub-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 48px 0 32px;
}

.hub-hero-copy .eyebrow {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 8px;
}

.hub-hero-copy h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}

.hub-hero-copy .hero-text {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 540px;
  margin: 0;
}

.hub-hero-meta {
  display: flex;
  gap: 12px;
}

.hero-chip {
  display: grid;
  gap: 2px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: center;
}

.hero-chip span {
  color: var(--text-subtle);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-chip strong {
  font-size: 1.15rem;
  font-weight: 700;
}

/* ------------------------------------------------------------------ */
/* Module Grid                                                         */
/* ------------------------------------------------------------------ */

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
  gap: 20px;
  padding: 12px 0 40px;
}

.hub-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
  cursor: pointer;
}

.hub-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.hub-card-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  flex-shrink: 0;
}

.hub-card-icon-listing {
  background: var(--accent-soft);
  color: var(--accent);
}

.hub-card-icon-jobs {
  background: var(--secondary-soft);
  color: var(--secondary);
}

.hub-card-icon-survey {
  background: var(--good-soft);
  color: var(--good);
}

.hub-card-icon-finn {
  background: var(--accent-soft);
  color: var(--accent);
}

.hub-card-icon-social {
  background: #f3e5f5;
  color: #8e24aa;
}

/* Expandable card */
.hub-card-expandable {
  cursor: pointer;
}

.hub-card-arrow {
  display: inline-block;
  font-size: 1rem;
  color: var(--text-subtle);
  transition: transform 0.2s;
}

.hub-card-expandable.expanded .hub-card-arrow {
  transform: rotate(90deg);
}

/* Sub-section */
.hub-sub-section {
  padding: 0 0 32px;
}

.hub-grid-sub {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.hub-card-icon-posting {
  background: var(--warn-soft);
  color: var(--warn);
}

.hub-card-body h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.hub-card-body p {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 12px;
  line-height: 1.5;
}

.hub-card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-subtle);
  letter-spacing: 0.02em;
}

.hub-card-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line-strong);
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--good);
  box-shadow: 0 0 6px rgba(5, 158, 111, 0.5);
}

.status-dot.offline {
  background: var(--line-strong);
}

.status-label {
  color: var(--text-subtle);
  font-size: 0.8rem;
}

/* ------------------------------------------------------------------ */
/* Detail Section (Survey Automation inline view)                      */
/* ------------------------------------------------------------------ */

.hub-detail-section {
  padding: 24px 0;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.detail-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.back-button {
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}

.back-button:hover {
  background: var(--surface-subtle);
}

.detail-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-subtle);
  border-radius: 12px;
  margin-bottom: 20px;
  width: fit-content;
}

.detail-tab {
  padding: 8px 20px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-subtle);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.detail-tab.active {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.detail-tab:hover:not(.active) {
  color: var(--text);
}

.detail-panel {
  display: none;
}

.detail-panel.active {
  display: block;
}

/* ------------------------------------------------------------------ */
/* Panel / Forms                                                       */
/* ------------------------------------------------------------------ */

.panel {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.panel h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 20px;
}

.panel h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 16px 0 12px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-subtle);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--surface-strong);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus {
  border-color: var(--accent);
}

.form-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.action-button {
  padding: 10px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.action-button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.action-button.primary:hover {
  background: var(--accent-hover);
}

.action-button.secondary {
  background: var(--surface);
  color: var(--text);
}

.action-button.secondary:hover {
  background: var(--surface-subtle);
}

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 20px 0;
}

/* ------------------------------------------------------------------ */
/* Data Table                                                          */
/* ------------------------------------------------------------------ */

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  border-bottom: 2px solid var(--line);
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}

.data-table .empty-state {
  text-align: center;
  color: var(--text-subtle);
  padding: 32px 12px;
}

.log-output {
  margin-top: 16px;
  padding: 16px;
  background: #1b1b1f;
  color: #d4d4d8;
  border-radius: 12px;
  font-family: "Cascadia Code", "Fira Code", monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ------------------------------------------------------------------ */
/* Platform overview cards                                             */
/* ------------------------------------------------------------------ */

.platform-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.platform-card {
  padding: 16px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.platform-card h4 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.platform-card .stat {
  color: var(--text-subtle);
  font-size: 0.8rem;
}

.platform-card .stat strong {
  color: var(--text);
}

/* ------------------------------------------------------------------ */
/* Status badges                                                       */
/* ------------------------------------------------------------------ */

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.completed { background: var(--good-soft); color: var(--good); }
.status-badge.failed { background: var(--danger-soft); color: var(--danger); }
.status-badge.in_progress { background: var(--accent-soft); color: var(--accent); }
.status-badge.needs_review { background: var(--warn-soft); color: var(--warn); }
.status-badge.pending { background: var(--surface-subtle); color: var(--muted); }

/* ------------------------------------------------------------------ */
/* Provider Grid (survey page)                                         */
/* ------------------------------------------------------------------ */

.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.provider-card {
  padding: 20px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.provider-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.provider-card-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.provider-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.provider-card-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.provider-url {
  color: var(--text-subtle);
  font-size: 0.75rem;
}

.provider-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  flex-shrink: 0;
}

.provider-icon-ipsos { background: #e8e0f7; color: #6b3fa0; }
.provider-icon-yougov { background: #fce8ef; color: #ad1457; }
.provider-icon-google { background: #e8f5e9; color: #2e7d32; }
.provider-icon-surveymonkey { background: #fff8e1; color: #f57f17; }
.provider-icon-typeform { background: #e3f2fd; color: #1565c0; }
.provider-icon-msforms { background: #fce4ec; color: #c62828; }
.provider-icon-qualtrics { background: #e0f7fa; color: #00695c; }

.provider-card p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0 0 12px;
}

.provider-stats {
  display: flex;
  gap: 12px;
}

.provider-stat {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-subtle);
  padding: 3px 10px;
  background: var(--surface-subtle);
  border-radius: 6px;
}

.provider-detail-section {
  padding: 0 0 24px;
}

.panel-desc {
  color: var(--muted);
  font-size: 0.88rem;
  margin: -12px 0 20px;
}

/* Toggle label */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* Credentials box */
.credentials-box {
  margin-top: 20px;
  padding: 20px;
  background: var(--good-soft);
  border: 1px solid var(--good);
  border-radius: 14px;
}

.credentials-box h4 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--good);
}

.credentials-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.credential-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.credential-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.credential-value {
  font-size: 0.85rem;
  font-family: "Cascadia Code", "Fira Code", monospace;
  color: var(--text);
  background: var(--surface);
  padding: 4px 8px;
  border-radius: 6px;
  word-break: break-all;
}

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */

.hub-footer {
  padding: 24px 0;
  text-align: center;
  color: var(--text-subtle);
  font-size: 0.8rem;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 560px) {
  .hub-grid {
    grid-template-columns: 1fr;
  }

  .hub-hero {
    flex-direction: column;
    align-items: flex-start;
  }
}
