.jc-page-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background: var(--bg);
}

/* Sidebar in secondary pages inherits same rules from workspace-redesign.css */
.jc-page-shell .jc-sidebar {
  background: #f5f7fa;
}

.jc-page-content {
  padding: 28px;
}

.jc-page-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 26px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--blue);
  border-radius: 24px;
  background: linear-gradient(160deg, #f0f5ff 0%, #fff 55%);
  box-shadow: var(--shadow);
}

.jc-page-hero h1 {
  margin: 6px 0 10px;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 1;
}

.jc-page-hero p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.jc-page-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.jc-page-card {
  min-height: 160px;
  display: grid;
  align-content: space-between;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.05);
  transition: transform .16s ease, box-shadow .16s ease;
}
.jc-page-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.09);
}
/* Nth-child color coding */
.jc-page-card:nth-child(3n+1) { border-top-color: var(--blue); background: linear-gradient(160deg, #f0f5ff 0%, #fff 55%); }
.jc-page-card:nth-child(3n+2) { border-top-color: var(--green); background: linear-gradient(160deg, #f0fdf8 0%, #fff 55%); }
.jc-page-card:nth-child(3n+3) { border-top-color: #d97706; background: linear-gradient(160deg, #fffbeb 0%, #fff 55%); }

.jc-page-card:nth-child(3n+1) strong { color: var(--blue); }
.jc-page-card:nth-child(3n+2) strong { color: var(--green); }
.jc-page-card:nth-child(3n+3) strong { color: #b76e00; }

.jc-page-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.jc-page-card span {
  font-weight: 850;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.jc-page-empty {
  margin-top: 18px;
  padding: 48px 28px 40px;
  border: 1px dashed var(--border);
  border-radius: 20px;
  background: #fbfcfe;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}
.jc-page-empty svg { margin-bottom: 4px; }
.jc-page-empty strong { color: var(--text); font-size: 1.05rem; display: block; }
.jc-page-empty p { margin: 0; max-width: 340px; line-height: 1.6; }

@media (max-width: 900px) {
  .jc-page-shell {
    grid-template-columns: 1fr;
  }

  .jc-sidebar {
    display: none;
  }

  .jc-page-content {
    padding: 16px 16px 84px;
  }

  .jc-page-hero {
    flex-direction: column;
  }

  .jc-page-grid {
    grid-template-columns: 1fr;
  }
}

/* Premium settings + analytics screens */
.workspace-premium-page {
  background:
    radial-gradient(circle at top left, rgba(21, 94, 239, .08), transparent 32rem),
    linear-gradient(180deg, #f8fafc 0%, #f4f7fb 100%);
}

.premium-content {
  max-width: 1540px;
  width: 100%;
  margin: 0 auto;
  padding: 28px clamp(18px, 3vw, 40px) 56px;
}

.premium-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 18px;
  padding: 28px;
  border: 1px solid rgba(203, 213, 225, .78);
  border-radius: 24px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 18px 55px rgba(15, 23, 42, .07);
  backdrop-filter: blur(14px);
}

.premium-header h1 {
  margin: 5px 0 8px;
  font-size: clamp(2rem, 4.4vw, 4.7rem);
  letter-spacing: -.04em;
  line-height: .96;
}

.premium-header p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.6;
}

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

.autosave-pill,
.status-ok,
.status-warn {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 820;
}

.autosave-pill {
  color: #0f766e;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.autosave-pill[data-mode="saving"] {
  color: #175cd3;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.autosave-pill[data-mode="saved"] {
  color: #067647;
  background: #ecfdf3;
  border-color: #abefc6;
}

.status-ok { color: #067647; background: #ecfdf3; border: 1px solid #abefc6; }
.status-warn { color: #b54708; background: #fffaeb; border: 1px solid #fedf89; }

.settings-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.settings-nav-panel {
  position: sticky;
  top: 18px;
  padding: 14px;
  border: 1px solid rgba(203, 213, 225, .78);
  border-radius: 22px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 14px 42px rgba(15, 23, 42, .06);
  backdrop-filter: blur(14px);
}

.settings-search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fafc;
  color: var(--muted);
}

.settings-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-weight: 720;
}

.settings-nav-list {
  display: grid;
  gap: 2px;
  margin-top: 12px;
  max-height: calc(100vh - 160px);
  overflow: auto;
}

.settings-nav-list a {
  padding: 10px 12px;
  border-radius: 12px;
  color: #475467;
  text-decoration: none;
  font-size: .92rem;
  font-weight: 760;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}

.settings-nav-list a:hover,
.settings-nav-list a.is-active {
  color: var(--blue);
  background: #eef4ff;
  transform: translateX(2px);
}

.settings-content {
  display: grid;
  gap: 18px;
}

.settings-section {
  scroll-margin-top: 24px;
  display: grid;
  grid-template-columns: minmax(190px, 270px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.section-heading span,
.card-head span {
  color: var(--blue);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.section-heading h2,
.card-head h2 {
  margin: 6px 0 6px;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  letter-spacing: -.03em;
}

.section-heading p,
.settings-card p,
.analytics-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.settings-card,
.analytics-card {
  border: 1px solid rgba(203, 213, 225, .82);
  border-radius: 20px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 12px 34px rgba(15, 23, 42, .055);
}

.settings-card {
  padding: 18px;
}

.profile-card {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 18px;
}

.avatar-upload {
  display: grid;
  gap: 10px;
  justify-items: center;
  align-content: start;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 18px;
  background: #f8fafc;
}

.avatar-upload img {
  width: 82px;
  height: 82px;
  object-fit: contain;
  border-radius: 18px;
  background: #fff;
}

.avatar-upload button,
.integration-grid button {
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: #334155;
  font-weight: 820;
}

.settings-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-form-grid label {
  display: grid;
  gap: 7px;
  color: #475467;
  font-size: .86rem;
  font-weight: 820;
}

.settings-form-grid input,
.settings-form-grid select {
  min-height: 46px;
  border: 1px solid #d6deeb;
  border-radius: 13px;
  padding: 0 13px;
  background: #fbfdff;
  color: var(--text);
  outline: 0;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.settings-form-grid input:focus,
.settings-form-grid select:focus,
.settings-search:focus-within {
  border-color: #9db7ff;
  box-shadow: 0 0 0 4px rgba(21, 94, 239, .11);
  background: #fff;
}

.setting-row,
.team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  padding: 14px 0;
  border-bottom: 1px solid #eef2f6;
}

.setting-row:first-child { padding-top: 0; }
.setting-row:last-child,
.team-row:last-child { border-bottom: 0; padding-bottom: 0; }

.setting-row strong,
.team-row strong { display: block; margin-bottom: 3px; }

.setting-toggle {
  position: relative;
  flex: 0 0 auto;
  width: 50px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: #d8e0ec;
  cursor: pointer;
  transition: background .18s ease, box-shadow .18s ease;
}

.setting-toggle span {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, .18);
  transition: transform .18s ease;
}

.setting-toggle.is-on {
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(21, 94, 239, .22);
}

.setting-toggle.is-on span {
  transform: translateX(20px);
}

.tag-cloud,
.billing-summary,
.integration-grid,
.radial-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-cloud span {
  padding: 8px 11px;
  border: 1px solid #d6e4ff;
  border-radius: 999px;
  background: #eef4ff;
  color: #155eef;
  font-weight: 820;
  font-size: .84rem;
}

.security-card {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 18px;
}

.security-score {
  display: grid;
  place-items: center;
  min-height: 150px;
  border-radius: 18px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.security-score strong { font-size: 3rem; letter-spacing: -.08em; color: #067647; }
.security-score span { color: #067647; font-weight: 900; }

.security-list {
  display: grid;
  align-content: center;
}

.security-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid #eef2f6;
}

.billing-summary > div {
  flex: 1 1 150px;
  padding: 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.billing-summary span,
.subscription-card span { display: block; color: var(--muted); font-size: .82rem; font-weight: 780; }
.billing-summary strong,
.subscription-card strong { display: block; margin-top: 4px; font-size: 1.45rem; letter-spacing: -.03em; }

.billing-table,
.metric-table {
  width: 100%;
  margin-top: 14px;
  border-collapse: collapse;
  font-size: .93rem;
}

.billing-table th,
.billing-table td,
.metric-table th,
.metric-table td {
  padding: 13px 10px;
  border-bottom: 1px solid #eef2f6;
  text-align: left;
}

.billing-table th,
.metric-table th {
  color: #667085;
  font-size: .77rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.integration-grid > div {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fbfdff;
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid #d8e0ec;
  border-radius: 999px;
  background: #f8fafc;
}

.segmented-control button {
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  background: transparent;
  color: #475467;
  font-weight: 820;
  cursor: pointer;
}

.segmented-control button.is-active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 4px 14px rgba(15, 23, 42, .1);
}

.segmented-control.compact button { padding: 8px 12px; }

.team-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue);
  font-weight: 900;
}

.api-card,
.subscription-card,
.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.api-card code {
  padding: 12px 14px;
  border-radius: 13px;
  background: #0f172a;
  color: #dbeafe;
  overflow: auto;
}

.jc-btn.danger {
  border: 1px solid #fecaca;
  background: #fff;
  color: #b42318;
}

.danger-zone {
  margin-top: 12px;
  border-color: #fecaca;
  background: #fffafa;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  min-height: 154px;
  padding: 18px;
  border: 1px solid rgba(203, 213, 225, .82);
  border-radius: 20px;
  background: rgba(255, 255, 255, .93);
  box-shadow: 0 12px 30px rgba(15, 23, 42, .055);
  transition: transform .16s ease, box-shadow .16s ease;
}

.kpi-card:hover,
.analytics-card:hover,
.settings-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

.kpi-card span {
  color: #667085;
  font-size: .82rem;
  font-weight: 850;
}

.kpi-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 2rem;
  letter-spacing: -.05em;
}

.kpi-card small {
  font-weight: 860;
}

.trend-up { color: #067647; }
.trend-flat { color: #667085; }

.kpi-card svg {
  width: 100%;
  height: 34px;
  margin-top: 14px;
}

.kpi-card path {
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
  stroke-linecap: round;
}

.analytics-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.analytics-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.analytics-card {
  padding: 18px;
  transition: transform .16s ease, box-shadow .16s ease;
}

.revenue-card,
.table-card,
.activity-card {
  grid-column: 1 / -1;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.card-head strong {
  color: #067647;
  font-size: .9rem;
  white-space: nowrap;
}

.area-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.grid-line {
  stroke: #e9eef5;
  stroke-width: 1;
}

.area-fill { fill: url(#revGradient); }
.chart-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 4;
  stroke-linecap: round;
}

.chart-points circle {
  fill: #fff;
  stroke: var(--blue);
  stroke-width: 3;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-weight: 760;
}

.chart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--blue);
}

.funnel-bars {
  display: grid;
  gap: 12px;
}

.funnel-bars div {
  position: relative;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-radius: 14px;
  overflow: hidden;
  background: #f3f6fb;
}

.funnel-bars div::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w);
  background: linear-gradient(90deg, #eaf1ff, #c7d7fe);
}

.funnel-bars span,
.funnel-bars b {
  position: relative;
  z-index: 1;
}

.radial {
  --size: 132px;
  width: var(--size);
  height: var(--size);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 56%, transparent 58%),
    conic-gradient(var(--blue) calc(var(--p) * 1%), #e5eaf3 0);
}

.radial span {
  font-size: 1.35rem;
  font-weight: 900;
}

.radial small {
  margin-top: -34px;
  color: var(--muted);
  font-weight: 820;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.heatmap-grid span {
  aspect-ratio: 1;
  border-radius: 9px;
  background: #eef2f7;
}

.heatmap-grid .h1 { background: #dbeafe; }
.heatmap-grid .h2 { background: #bfdbfe; }
.heatmap-grid .h3 { background: #93c5fd; }
.heatmap-grid .h4 { background: #60a5fa; }
.heatmap-grid .h5 { background: #155eef; }

.insights-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 18px;
}

.ai-insights {
  background: linear-gradient(160deg, #0f172a 0%, #172554 100%);
  color: #fff;
  border-color: rgba(255,255,255,.14);
}

.ai-insights span { color: #93c5fd; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; }
.ai-insights h2 { margin: 8px 0; letter-spacing: -.03em; }
.ai-insights p { color: #cbd5e1; }

.suggestion-list,
.growth-metrics {
  display: grid;
  gap: 13px;
}

.suggestion-list h3,
.growth-metrics h3 {
  margin: 0;
  font-size: 1.15rem;
}

.suggestion-list div {
  padding: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 15px;
  background: #fbfdff;
}

.suggestion-list b,
.suggestion-list span {
  display: block;
}

.suggestion-list span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.5;
}

.score-ring {
  width: 150px;
  height: 150px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 57%, transparent 59%),
    conic-gradient(#16a34a calc(var(--p) * 1%), #e5eaf3 0);
}

.score-ring span {
  font-size: 2.3rem;
  font-weight: 950;
  color: #067647;
}

.activity-feed {
  display: grid;
  gap: 10px;
}

.activity-feed > div {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid #eef2f6;
  border-radius: 15px;
  background: #fbfdff;
}

.activity-feed i {
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 4px #eaf1ff;
}

.activity-feed p {
  margin: 0;
}

.activity-feed span,
.activity-feed time {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .88rem;
}

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

@media (max-width: 1180px) {
  .settings-shell,
  .analytics-shell {
    grid-template-columns: 1fr;
  }

  .settings-nav-panel,
  .insights-panel {
    position: static;
  }

  .settings-nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .premium-header,
  .settings-section,
  .profile-card,
  .security-card,
  .api-card,
  .subscription-card,
  .danger-zone {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .settings-form-grid,
  .integration-grid,
  .analytics-main,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .settings-nav-list {
    grid-template-columns: 1fr;
  }

  .premium-header {
    padding: 20px;
  }

  .premium-header h1 {
    font-size: 2.25rem;
  }

  .billing-table,
  .metric-table {
    display: block;
    overflow-x: auto;
  }
}
