/* =========================================================
   WEBDOCS PAID / CRM DASHBOARD
   Clean final version
========================================================= */

:root {
  --pd-bg: #f7f4fb;
  --pd-bg-soft: #fbf9ff;
  --pd-surface: rgba(255, 255, 255, 0.94);
  --pd-surface-strong: #ffffff;
  --pd-surface-tint: #f5efff;

  --pd-text: #16052f;
  --pd-text-strong: #100320;
  --pd-muted: #60597a;
  --pd-soft: #847d98;

  --pd-line: rgba(91, 25, 216, 0.12);
  --pd-line-strong: rgba(91, 25, 216, 0.2);

  --pd-purple: #5b19d8;
  --pd-purple-deep: #2d0058;
  --pd-pink: #ff2d9a;
  --pd-blue: #1570ef;
  --pd-green: #15803d;
  --pd-red: #c81e1e;
  --pd-gold: #b7791f;

  --pd-shadow-sm: 0 12px 30px rgba(22, 5, 47, 0.06);
  --pd-shadow-md: 0 18px 48px rgba(22, 5, 47, 0.09);
  --pd-shadow-lg: 0 28px 80px rgba(22, 5, 47, 0.12);

  --pd-radius-xl: 30px;
  --pd-radius-lg: 24px;
  --pd-radius-md: 18px;
  --pd-radius-sm: 14px;

  --pd-shell: 1860px;
  --pd-header-h: 84px;
}

/* =========================================================
   BASE
========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
}

body {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  color: var(--pd-text);
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(circle at 8% 7%, rgba(91, 25, 216, 0.12), transparent 28%),
    radial-gradient(circle at 91% 9%, rgba(255, 45, 154, 0.08), transparent 24%),
    radial-gradient(circle at 80% 90%, rgba(21, 112, 239, 0.07), transparent 22%),
    linear-gradient(180deg, #faf8ff 0%, #f4effb 48%, #f8f8fc 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

img {
  display: block;
  max-width: 100%;
}

.wd-hidden {
  display: none !important;
}

.pd-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.pd-shell {
  width: min(var(--pd-shell), calc(100% - 34px));
  margin: 0 auto;
}

/* =========================================================
   AUTH VISIBILITY
   Before login: login only
   After login: header + dashboard + footer
========================================================= */

body.pd-auth-locked .aih-header,
body.pd-auth-locked .ai-footer,
body.pd-auth-locked #dashboardSection {
  display: none !important;
}

body.pd-auth-locked #loginSection {
  display: block !important;
}

body.pd-auth-locked .pd-main {
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 34px 0;
}

body.pd-auth-locked .pd-shell {
  width: min(100% - 28px, 1040px);
}

body.pd-authenticated .aih-header,
body.pd-authenticated .ai-footer {
  display: block;
}

body.pd-authenticated #loginSection {
  display: none !important;
}

body.pd-authenticated #dashboardSection {
  display: grid !important;
}

body.pd-authenticated .pd-main {
  min-height: auto;
  display: block;
  padding: 28px 0 34px;
}

body.pd-authenticated .pd-shell {
  width: min(var(--pd-shell), calc(100% - 34px));
}

body.pd-auth-locked .pd-login-wrap {
  padding: 0;
}

body.pd-auth-locked .pd-login-card {
  position: relative;
  overflow: hidden;
}

body.pd-auth-locked .pd-login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, #5b19d8 0%, #ff2d9a 48%, #1570ef 100%);
}

body.pd-auth-locked .pd-login-note {
  background:
    radial-gradient(circle at 0% 0%, rgba(91, 25, 216, 0.08), transparent 34%),
    linear-gradient(135deg, rgba(91, 25, 216, 0.05), rgba(255, 45, 154, 0.05));
}

/* =========================================================
   MAIN
========================================================= */

.pd-main {
  flex: 1;
  padding: 28px 0 34px;
}

/* =========================================================
   BUTTONS
========================================================= */

.pd-btn,
.ai-product-logout {
  appearance: none;
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    color 180ms ease,
    border-color 180ms ease;
}

.pd-btn {
  min-height: 48px;
  padding: 0 18px;
  font-size: 0.94rem;
  font-weight: 800;
}

.pd-btn:hover,
.pd-btn:focus-visible,
.ai-product-logout:hover,
.ai-product-logout:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.pd-btn-primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--pd-purple) 0%, var(--pd-purple-deep) 100%);
  box-shadow: 0 16px 34px rgba(45, 0, 88, 0.24);
}

.pd-btn-primary:hover,
.pd-btn-primary:focus-visible {
  box-shadow: 0 20px 42px rgba(45, 0, 88, 0.3);
}

.pd-btn-soft {
  color: var(--pd-text-strong);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--pd-line);
  box-shadow: var(--pd-shadow-sm);
}

.pd-btn-soft:hover,
.pd-btn-soft:focus-visible {
  background: #ffffff;
  border-color: var(--pd-line-strong);
  box-shadow: var(--pd-shadow-md);
}

.ai-product-logout {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(251, 113, 133, 0.28);
  color: #ffffff;
  background: rgba(251, 113, 133, 0.88);
  font-size: 0.82rem;
  font-weight: 850;
}

.ai-product-logout:hover,
.ai-product-logout:focus-visible {
  background: #fb7185;
}

#logoutBtn.wd-hidden {
  display: none !important;
}

/* =========================================================
   KICKER / STATUS
========================================================= */

.pd-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(91, 25, 216, 0.1), rgba(255, 45, 154, 0.08));
  color: var(--pd-purple);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pd-status {
  min-height: 24px;
  margin-top: 14px;
  font-size: 0.92rem;
  font-weight: 700;
}

.pd-status-inline {
  margin-top: 0;
  margin-bottom: 14px;
}

.pd-status.is-success {
  color: var(--pd-green);
}

.pd-status.is-error {
  color: var(--pd-red);
}

.pd-status.is-warning {
  color: var(--pd-gold);
}

.pd-status.is-loading {
  color: var(--pd-blue);
}

/* =========================================================
   LOGIN
========================================================= */

.pd-login-wrap {
  padding-top: 8px;
}

.pd-login-card {
  max-width: 980px;
  margin: 0 auto;
  padding: 34px;
  border-radius: var(--pd-radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.89) 100%);
  box-shadow: var(--pd-shadow-lg);
}

.pd-login-head h1 {
  margin: 16px 0 10px;
  color: var(--pd-text-strong);
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.pd-login-head p {
  margin: 0;
  max-width: 60ch;
  color: var(--pd-muted);
  font-size: 1rem;
  line-height: 1.7;
}

.pd-form {
  margin-top: 26px;
}

.pd-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.pd-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pd-field span {
  color: var(--pd-text-strong);
  font-size: 0.92rem;
  font-weight: 800;
}

.pd-field input {
  width: 100%;
  min-height: 58px;
  padding: 0 18px;
  border-radius: 18px;
  border: 1px solid rgba(91, 25, 216, 0.12);
  background: rgba(255, 255, 255, 0.96);
  color: var(--pd-text);
  outline: none;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.pd-field input:focus {
  border-color: rgba(91, 25, 216, 0.3);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(91, 25, 216, 0.08);
}

.pd-form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.pd-login-note {
  margin-top: 24px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(91, 25, 216, 0.1);
  background: linear-gradient(135deg, rgba(91, 25, 216, 0.05), rgba(255, 45, 154, 0.05));
}

.pd-login-note strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.96rem;
}

.pd-login-note p {
  margin: 0;
  color: var(--pd-muted);
  line-height: 1.7;
}

/* =========================================================
   DASHBOARD TOP
========================================================= */

.pd-dashboard {
  display: grid;
  gap: 18px;
}

.pd-utility-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  padding: 24px 26px;
  border-radius: var(--pd-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.75);
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 45, 154, 0.22), transparent 34%),
    linear-gradient(135deg, #23003d 0%, #39096d 55%, #5b19d8 100%);
  color: #ffffff;
  box-shadow: var(--pd-shadow-lg);
}

.pd-utility-copy h2 {
  margin: 12px 0 8px;
  font-size: clamp(1.55rem, 2.2vw, 2.2rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.pd-utility-copy p {
  margin: 0;
  max-width: 60ch;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.7;
}

.pd-utility-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pd-utility-bar .pd-kicker {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.pd-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.pd-stat-card {
  padding: 22px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(255, 255, 255, 0.9) 100%);
  border: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: var(--pd-shadow-md);
}

.pd-stat-label {
  display: block;
  margin-bottom: 10px;
  color: var(--pd-soft);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pd-stat-card strong {
  display: block;
  color: var(--pd-text-strong);
  font-size: 1.52rem;
  line-height: 1.04;
  letter-spacing: -0.04em;
  word-break: break-word;
}

.pd-stat-card small {
  display: block;
  margin-top: 10px;
  color: var(--pd-muted);
  line-height: 1.5;
}

/* =========================================================
   APP SHELL / SIDEBAR
========================================================= */

.pd-app-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.pd-sidebar {
  display: grid;
  gap: 18px;
  align-self: start;
  position: sticky;
  top: 96px;
}

.pd-sidebar-card {
  padding: 20px;
  border-radius: var(--pd-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.76);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(255, 255, 255, 0.9) 100%);
  box-shadow: var(--pd-shadow-md);
}

.pd-sidebar-label {
  margin: 0 0 14px;
  color: var(--pd-soft);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pd-nav-link {
  width: 100%;
  border: 0;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px;
  margin-bottom: 10px;
  border-radius: 16px;
  background: rgba(91, 25, 216, 0.05);
  color: var(--pd-text);
  font-size: 0.92rem;
  font-weight: 800;
  transition:
    background 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.pd-nav-link:hover,
.pd-nav-link:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.pd-nav-link span {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(91, 25, 216, 0.09);
  color: var(--pd-purple);
  font-size: 0.76rem;
  font-weight: 900;
}

.pd-nav-link.is-active {
  background: linear-gradient(135deg, rgba(91, 25, 216, 0.12), rgba(255, 45, 154, 0.07));
  box-shadow: var(--pd-shadow-sm);
}

.pd-action-stack {
  display: grid;
  gap: 12px;
}

/* =========================================================
   CONTENT / VIEWS
========================================================= */

.pd-content {
  display: grid;
  min-width: 0;
}

.pd-view {
  display: none;
  gap: 18px;
  min-width: 0;
}

.pd-view.is-active {
  display: grid;
}

.pd-view-head {
  padding: 24px 26px;
  border-radius: var(--pd-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.76);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(255, 255, 255, 0.9) 100%);
  box-shadow: var(--pd-shadow-md);
}

.pd-view-head h3 {
  margin: 12px 0 8px;
  color: var(--pd-text-strong);
  font-size: 1.5rem;
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.pd-view-head p {
  margin: 0;
  color: var(--pd-muted);
  line-height: 1.7;
}

/* =========================================================
   CARDS
========================================================= */

.pd-card-grid {
  display: grid;
  gap: 16px;
}

.pd-card-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pd-card-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pd-card {
  min-width: 0;
  padding: 24px;
  border-radius: var(--pd-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.76);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(255, 255, 255, 0.9) 100%);
  box-shadow: var(--pd-shadow-md);
}

.pd-card-head h4 {
  margin: 10px 0 8px;
  color: var(--pd-text-strong);
  font-size: 1.18rem;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.pd-card-head p {
  margin: 0;
  color: var(--pd-muted);
  line-height: 1.65;
}

.pd-guide-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--pd-text-strong);
  font-size: 0.98rem;
  letter-spacing: -0.02em;
}

.pd-guide-card p {
  margin: 0;
  color: var(--pd-muted);
  line-height: 1.72;
}

/* =========================================================
   DETAILS / MINI ITEMS
========================================================= */

.pd-detail-grid,
.pd-mini-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pd-detail-item,
.pd-mini-item {
  min-width: 0;
  padding: 18px;
  border-radius: 18px;
  background: var(--pd-surface-tint);
  border: 1px solid rgba(91, 25, 216, 0.08);
}

.pd-mini-item {
  background: #fbf9ff;
}

.pd-detail-item span,
.pd-mini-item span {
  display: block;
  margin-bottom: 8px;
  color: var(--pd-soft);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pd-detail-item strong,
.pd-mini-item strong {
  display: block;
  color: var(--pd-text-strong);
  font-size: 0.98rem;
  line-height: 1.55;
  word-break: break-word;
}

/* =========================================================
   CONVERSATIONS
========================================================= */

.pd-conversation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.94fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.pd-conversation-layout > .pd-card {
  min-height: 0;
}

.pd-conversation-list {
  display: grid;
  gap: 12px;
}

.wd-conversation-item {
  width: 100%;
  text-align: left;
  cursor: pointer;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(91, 25, 216, 0.1);
  background: rgba(255, 255, 255, 0.95);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.wd-conversation-item:hover,
.wd-conversation-item:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(91, 25, 216, 0.2);
  box-shadow: var(--pd-shadow-sm);
  outline: none;
}

.wd-conversation-item.is-active {
  background: linear-gradient(180deg, #ffffff 0%, #f7f2ff 100%);
  border-color: rgba(91, 25, 216, 0.24);
  box-shadow: 0 16px 34px rgba(91, 25, 216, 0.1);
}

.wd-conversation-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.wd-conversation-title {
  color: var(--pd-text-strong);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.wd-conversation-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.wd-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(91, 25, 216, 0.08);
  color: var(--pd-purple);
  font-size: 0.76rem;
  font-weight: 800;
}

.wd-badge-accent {
  background: rgba(255, 45, 154, 0.08);
  color: #c01772;
}

.wd-conversation-snippet {
  margin-top: 12px;
  color: var(--pd-muted);
  line-height: 1.65;
  font-size: 0.92rem;
}

/* Right-side selected conversation scroll panel */
.pd-conversation-layout > .pd-card:nth-child(2) {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pd-conversation-layout > .pd-card:nth-child(2) .pd-card-head {
  flex: 0 0 auto;
}

.pd-viewer {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  gap: 12px;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(91, 25, 216, 0.34) rgba(91, 25, 216, 0.06);
}

.pd-viewer::-webkit-scrollbar {
  width: 8px;
}

.pd-viewer::-webkit-scrollbar-track {
  background: rgba(91, 25, 216, 0.06);
  border-radius: 999px;
}

.pd-viewer::-webkit-scrollbar-thumb {
  background: rgba(91, 25, 216, 0.28);
  border-radius: 999px;
}

.pd-viewer::-webkit-scrollbar-thumb:hover {
  background: rgba(91, 25, 216, 0.42);
}

.wd-conversation-block {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(91, 25, 216, 0.1);
}

.wd-conversation-block h3 {
  margin: 0 0 10px;
  color: var(--pd-text-strong);
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.wd-conversation-block p {
  margin: 0 0 8px;
  color: var(--pd-muted);
  line-height: 1.6;
}

.wd-message-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.wd-message {
  padding: 14px 16px;
  border-radius: 16px;
  background: #faf7ff;
  border: 1px solid rgba(91, 25, 216, 0.08);
}

.wd-message-role {
  display: block;
  margin-bottom: 8px;
  color: var(--pd-purple);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.wd-message-text {
  color: var(--pd-text);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

/* =========================================================
   INSIGHTS / PLACEHOLDERS / NOTES
========================================================= */

.pd-insight-grid,
.pd-placeholder-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.pd-note-block {
  margin-top: 18px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(91, 25, 216, 0.05), rgba(255, 45, 154, 0.04));
  border: 1px solid rgba(91, 25, 216, 0.08);
}

.pd-note-block p {
  margin: 0;
  color: var(--pd-muted);
  line-height: 1.75;
}

.pd-empty {
  padding: 22px;
  border-radius: 18px;
  border: 1px dashed rgba(91, 25, 216, 0.18);
  background: rgba(255, 255, 255, 0.76);
}

.pd-empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--pd-text-strong);
  font-size: 0.96rem;
}

.pd-empty p {
  margin: 0;
  color: var(--pd-muted);
  line-height: 1.65;
}

/* =========================================================
   CLIENT GUIDANCE
========================================================= */

.pd-dashboard-guidance {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.pd-dashboard-guidance-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 22px;
  border-radius: var(--pd-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.76);
  background:
    radial-gradient(circle at 0% 0%, rgba(91, 25, 216, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(255, 255, 255, 0.9) 100%);
  box-shadow: var(--pd-shadow-md);
}

/* =========================================================
   OLD LOCAL FOOTER SUPPORT
   If old .pd-footer exists anywhere, keep it clean.
========================================================= */

.pd-footer {
  padding: 0 0 24px;
}

.pd-footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 74px;
  padding: 18px 22px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--pd-shadow-sm);
}

.pd-footer-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pd-footer-copy strong {
  color: var(--pd-text-strong);
  font-size: 0.96rem;
}

.pd-footer-copy span {
  color: var(--pd-muted);
  font-size: 0.88rem;
}

.pd-footer-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.pd-footer-links a {
  color: var(--pd-purple);
  font-size: 0.88rem;
  font-weight: 800;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1260px) {
  .pd-app-shell {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .pd-card-grid-three {
    grid-template-columns: 1fr;
  }

  .pd-conversation-layout {
    grid-template-columns: 1fr;
  }

  .pd-conversation-layout > .pd-card:nth-child(2) {
    position: relative;
    top: auto;
    max-height: 72vh;
  }
}

@media (max-width: 1080px) {
  .pd-stats,
  .pd-card-grid-two {
    grid-template-columns: 1fr 1fr;
  }

  .pd-app-shell {
    grid-template-columns: 1fr;
  }

  .pd-sidebar {
    position: static;
  }
}

@media (max-width: 760px) {
  .pd-shell {
    width: min(var(--pd-shell), calc(100% - 22px));
  }

  body.pd-auth-locked .pd-shell {
    width: min(100% - 22px, 1040px);
  }

  .pd-form-grid,
  .pd-detail-grid,
  .pd-mini-grid,
  .pd-stats,
  .pd-card-grid-two {
    grid-template-columns: 1fr;
  }

  .pd-login-card,
  .pd-card,
  .pd-view-head,
  .pd-sidebar-card,
  .pd-utility-bar {
    padding: 20px;
  }

  .pd-login-card {
    border-radius: 24px;
  }

  .pd-login-head h1 {
    font-size: 2rem;
  }

  .pd-btn,
  .pd-form-actions .pd-btn,
  .pd-utility-actions .pd-btn,
  .pd-dashboard-guidance-actions .pd-btn {
    width: 100%;
  }

  .pd-form-actions,
  .pd-utility-actions,
  .pd-dashboard-guidance-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .pd-utility-bar {
    border-radius: 22px;
  }

  .pd-sidebar-card {
    border-radius: 22px;
  }

  .pd-conversation-layout > .pd-card:nth-child(2) {
    max-height: 68vh;
  }

  .pd-viewer {
    padding-right: 4px;
  }

  .pd-footer-inner {
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  body.pd-auth-locked .pd-main {
    padding: 22px 0;
  }

  .pd-login-card,
  .pd-card,
  .pd-view-head,
  .pd-sidebar-card,
  .pd-utility-bar {
    padding: 18px;
  }

  .pd-nav-link {
    min-height: 46px;
    padding: 0 12px;
  }

  .pd-nav-link span {
    width: 30px;
    height: 30px;
  }

  .pd-stat-card strong {
    font-size: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .pd-btn,
  .ai-product-logout,
  .pd-nav-link,
  .wd-conversation-item,
  .pd-field input {
    transition: none;
  }
}

/* =========================================================
   CRM DASHBOARD INSTITUTIONAL COLOR SYSTEM
   Serious, distinct, non-gamer palette
========================================================= */

:root {
  --pd-navy: #172033;
  --pd-navy-2: #243047;
  --pd-ink: #111827;
  --pd-slate: #475569;
  --pd-border-calm: rgba(31, 41, 55, 0.10);

  --pd-blue-soft: #eef4ff;
  --pd-blue-line: #bfd4ff;
  --pd-blue-text: #1d4ed8;

  --pd-green-soft: #edf7f1;
  --pd-green-line: #b9dec7;
  --pd-green-text: #166534;

  --pd-gold-soft: #fff7e6;
  --pd-gold-line: #efd08a;
  --pd-gold-text: #92400e;

  --pd-red-soft: #fff1f2;
  --pd-red-line: #fecdd3;
  --pd-red-text: #be123c;

  --pd-purple-soft: #f3efff;
  --pd-purple-line: #d7c9ff;
  --pd-purple-text: #5b21b6;

  --pd-stone-soft: #f5f3ef;
  --pd-stone-line: #ddd6c8;
  --pd-stone-text: #57534e;
}

/* Top bar: serious institutional command strip */
.pd-utility-bar {
  background:
    linear-gradient(135deg, #172033 0%, #243047 58%, #303b52 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18) !important;
}

.pd-utility-bar .pd-kicker {
  background: rgba(255, 255, 255, 0.10) !important;
  color: #dbeafe !important;
}

.pd-utility-copy h2 {
  color: #ffffff !important;
}

.pd-utility-copy p {
  color: rgba(255, 255, 255, 0.78) !important;
}

/* Buttons */
.pd-btn-primary {
  background: linear-gradient(135deg, #1e3a8a 0%, #172554 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 16px 34px rgba(30, 58, 138, 0.22) !important;
}

.pd-btn-soft {
  background: #ffffff !important;
  border: 1px solid rgba(31, 41, 55, 0.12) !important;
  color: #172033 !important;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06) !important;
}

.pd-btn-soft:hover,
.pd-btn-soft:focus-visible {
  background: #f8fafc !important;
  border-color: rgba(30, 58, 138, 0.20) !important;
}

/* Sidebar */
.pd-sidebar-card,
.pd-card,
.pd-view-head,
.pd-stat-card {
  border-color: rgba(31, 41, 55, 0.10) !important;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%) !important;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.07) !important;
}

.pd-nav-link {
  background: #f8fafc !important;
  color: #172033 !important;
  border: 1px solid transparent !important;
}

.pd-nav-link span {
  background: #eef2f7 !important;
  color: #334155 !important;
}

.pd-nav-link.is-active {
  background: #eef4ff !important;
  border-color: #bfd4ff !important;
  box-shadow: 0 10px 24px rgba(29, 78, 216, 0.08) !important;
}

.pd-nav-link.is-active span {
  background: #1d4ed8 !important;
  color: #ffffff !important;
}

/* Kicker */
.pd-kicker {
  background: #eef4ff !important;
  color: #1d4ed8 !important;
  border: 1px solid #d7e5ff !important;
}

/* Stats card tone */
.pd-stat-card {
  position: relative;
  overflow: hidden;
}

.pd-stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: #cbd5e1;
}

.pd-stat-card-identity::before {
  background: #1d4ed8;
}

.pd-stat-card-plan::before {
  background: #166534;
}

.pd-stat-card-activity::before {
  background: #92400e;
}

.pd-stat-card-events::before {
  background: #5b21b6;
}

.pd-stat-label {
  color: #64748b !important;
}

.pd-stat-card strong,
.pd-card-head h4,
.pd-view-head h3,
.pd-detail-item strong,
.pd-mini-item strong {
  color: #172033 !important;
}

.pd-stat-card small,
.pd-card-head p,
.pd-view-head p,
.pd-detail-item span,
.pd-mini-item span,
.pd-empty p,
.pd-note-block p,
.pd-guide-card p {
  color: #64748b !important;
}

/* Detail item tones */
.pd-detail-item,
.pd-mini-item {
  background: #f8fafc !important;
  border: 1px solid rgba(31, 41, 55, 0.08) !important;
}

.pd-tone-success {
  background: var(--pd-green-soft) !important;
  border-color: var(--pd-green-line) !important;
}

.pd-tone-success strong {
  color: var(--pd-green-text) !important;
}

.pd-tone-info {
  background: var(--pd-blue-soft) !important;
  border-color: var(--pd-blue-line) !important;
}

.pd-tone-info strong {
  color: var(--pd-blue-text) !important;
}

.pd-tone-gold {
  background: var(--pd-gold-soft) !important;
  border-color: var(--pd-gold-line) !important;
}

.pd-tone-gold strong {
  color: var(--pd-gold-text) !important;
}

.pd-tone-neutral {
  background: var(--pd-stone-soft) !important;
  border-color: var(--pd-stone-line) !important;
}

.pd-tone-neutral strong {
  color: var(--pd-stone-text) !important;
}

/* Feature access */
.pd-access-scale {
  display: grid;
  gap: 10px;
}

.pd-access-scale > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid rgba(31, 41, 55, 0.08);
}

.pd-access-scale span {
  color: #64748b;
  font-size: 0.86rem;
  font-weight: 800;
}

.pd-access-scale strong {
  color: #172033;
  font-size: 0.9rem;
  font-weight: 900;
}

.pd-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.pd-feature-pill {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 76px;
  padding: 15px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid rgba(31, 41, 55, 0.08);
}

.pd-feature-pill strong {
  display: block;
  color: #172033;
  font-size: 0.88rem;
  line-height: 1.35;
}

.pd-feature-pill span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.pd-feature-pill.is-unlocked {
  background: var(--pd-green-soft);
  border-color: var(--pd-green-line);
}

.pd-feature-pill.is-unlocked span {
  background: #166534;
  color: #ffffff;
}

.pd-feature-pill.is-locked {
  background: var(--pd-stone-soft);
  border-color: var(--pd-stone-line);
}

.pd-feature-pill.is-locked strong {
  color: #78716c;
}

.pd-feature-pill.is-locked span {
  background: #78716c;
  color: #ffffff;
}

/* Locked feature cards */
.pd-feature-locked {
  position: relative;
  opacity: 0.72;
}

.pd-feature-locked::after {
  content: "Plan locked";
  position: absolute;
  top: 18px;
  right: 18px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #57534e;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

/* Billing lists */
#billingUsageList,
#billingAlertList {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.pd-billing-row {
  padding: 14px 16px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid rgba(31, 41, 55, 0.08);
}

.pd-billing-row strong {
  display: block;
  color: #172033;
  font-size: 0.92rem;
  margin-bottom: 5px;
}

.pd-billing-row span {
  display: block;
  color: #64748b;
  font-size: 0.82rem;
  line-height: 1.55;
}

/* Guidance actions */
.pd-dashboard-guidance-actions {
  background:
    radial-gradient(circle at 0% 0%, rgba(30, 58, 138, 0.06), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  border: 1px solid rgba(31, 41, 55, 0.10) !important;
}

/* Responsive */
@media (max-width: 1100px) {
  .pd-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .pd-feature-grid {
    grid-template-columns: 1fr;
  }

  .pd-access-scale > div {
    flex-direction: column;
  }
}

/* =========================================================
   FEATURE LOCK NOTE
========================================================= */

.pd-locked-note {
  margin-top: 18px;
  padding: 16px;
  border-radius: 16px;
  background: #f5f3ef;
  border: 1px solid #ddd6c8;
}

.pd-locked-note strong {
  display: block;
  color: #57534e;
  font-size: 0.92rem;
  margin-bottom: 6px;
}

.pd-locked-note p {
  margin: 0 0 12px;
  color: #78716c;
  font-size: 0.88rem;
  line-height: 1.6;
}

.pd-feature-locked .pd-placeholder-list,
.pd-feature-locked .pd-insight-grid,
.pd-feature-locked .pd-detail-grid,
.pd-feature-locked .pd-note-block {
  filter: grayscale(0.25);
}