/**
 * Club Command — desk shell matching wiki mock (portal-desk.jpg)
 * Dark navy rail · light main canvas · cyan accents · glass setup cards
 * Brand overrides via --sky / --bg / --panel when ClubBrandTheme runs.
 */

:root {
  /* Fallbacks = 100 Club family (premium sky on deep navy).
     Brand desks overwrite via brand-theme.js — never hardcode navy/white on components. */
  --cc-ink: #080e18;
  --cc-ink-2: #0c1524;
  --cc-rail: #0a1220;
  /* Bright → Accent → Deep (Settings colors on brand desks) */
  --cc-top-bg: linear-gradient(
    105deg,
    color-mix(in srgb, var(--cc-accent-2, #94a3b8) 55%, #0e1726) 0%,
    color-mix(in srgb, var(--cc-accent, #64748b) 50%, #0a1220) 50%,
    color-mix(in srgb, var(--cc-accent-deep, #475569) 55%, #080e18) 100%
  );
  --cc-panel: #ffffff;
  --cc-panel-2: #f1f5f9;
  --cc-line: color-mix(in srgb, var(--sky, #64748b) 24%, transparent);
  --cc-line-soft: rgba(15, 23, 42, 0.08);
  --cc-text: #0f172a;
  --cc-text-on-dark: #f1f5f9;
  --cc-muted: #64748b;
  --cc-muted-on-dark: #94a3b8;
  --cc-accent: var(--sky, #64748b);
  --cc-accent-2: var(--sky3, #7dd3fc);
  --cc-accent-deep: var(--sky2, #0ea5e9);
  --cc-ok: var(--ok, #34d399);
  --cc-rail-w: 240px;
  --cc-radius: 14px;
  --cc-font: var(--font, "DM Sans", "Segoe UI", system-ui, sans-serif);
  --cc-display: var(--display, "Outfit", "DM Sans", system-ui, sans-serif);
  --cc-main-bg: #f0f5fb;
  --cc-card-dark: linear-gradient(145deg, #1a2a42 0%, #122033 55%, #0e1a2c 100%);
  --cc-tile-text: #e8eef7;
  --cc-hero-title: var(--cc-text);
}

/* Studio (100 Club) desks — slightly richer sky rail glow */
body.cc-body[data-desk-theme="studio"] .cc-rail,
body.cc-body.studio-themed .cc-rail {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--cc-accent) 16%, transparent) 0%, transparent 40%),
    var(--cc-rail);
}
body.cc-body[data-desk-theme="studio"] .cc-tile,
body.cc-body.studio-themed .cc-tile {
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

/* Full-bleed shell */
body.cc-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--cc-font);
  color: var(--cc-text);
  background: var(--cc-ink);
  line-height: 1.5;
}

body.cc-body .cc-app {
  display: grid;
  grid-template-columns: var(--cc-rail-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--studio-bar-h, 0px));
  align-items: stretch;
}

/* ---------- Rail (always dark — matches mock) ---------- */
body.cc-body .cc-rail {
  position: relative;
  top: auto;
  align-self: stretch;
  height: auto;
  min-height: 100%;
  overflow: visible;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--cc-accent) 12%, transparent) 0%, transparent 36%),
    var(--cc-rail);
  border-right: 1px solid rgba(148, 163, 184, 0.1);
  padding: 1rem 0.7rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  z-index: 30;
  color: var(--cc-text-on-dark);
}

body.cc-body .cc-rail__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.55rem 0.55rem;
  border-bottom: none;
  margin-bottom: 0.35rem;
  min-width: 0;
}
body.cc-body .cc-rail__brand-text {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  justify-content: center;
}

body.cc-body .cc-rail__mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--cc-display);
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: -0.02em;
  color: #041018;
  background: linear-gradient(145deg, var(--cc-accent-2), var(--cc-accent-deep));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--cc-accent) 35%, transparent);
  flex-shrink: 0;
}


/* Product logo: Portal mark FULL COLOR (no theme recolor / no mask)
   Soft-edged app icon — use contain (not cover) so corners aren't shaved/glitched. */
body.cc-body .cc-rail__mark--portal,
.cc-rail__mark--portal {
  position: relative !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: transparent;
  font-size: 0 !important;
  border-radius: 0 !important;
}
body.cc-body .cc-rail__mark--portal::before,
.cc-rail__mark--portal::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("/portal/images/portal-appicon.png?v=portalFill3") center / contain no-repeat;
  border-radius: 0;
  box-shadow: none;
  -webkit-mask: none !important;
  mask: none !important;
  /* crisp small-size render without harsh pixel fringe */
  image-rendering: auto;
  transform: translateZ(0);
}
body.desk-themed:not(.studio-themed) .cc-rail__mark--portal::before,
body.brand-portal:not(.studio-themed) .cc-rail__mark--portal::before,
body[data-desk-theme="brand"] .cc-rail__mark--portal::before {
  background: url("/portal/images/portal-appicon.png?v=portalFill3") center / contain no-repeat !important;
  -webkit-mask: none !important;
  mask: none !important;
}
/* Prefer real <img> when present (full-color, contain) */
body.cc-body .cc-rail__mark--portal img,
.cc-rail__mark--portal img,
body.cc-body .cc-rail__mark--portal .portal-product-logo,
.portal-product-logo,
body.studio-themed .cc-rail__mark--portal img,
body.studio-themed .portal-product-logo {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  -webkit-mask: none !important;
  mask: none !important;
  image-rendering: auto;
}
/* Studio / IT: never recolor Portal product logo */
body.studio-themed .cc-rail__mark--portal,
body.studio-themed .cc-rail__mark.mark--portal-product,
body[data-desk-theme="studio"] .cc-rail__mark--portal {
  background: transparent !important;
  box-shadow: none !important;
  color: transparent !important;
  overflow: visible !important;
}
/* Hide pseudo plate when img is present */
body.cc-body .cc-rail__mark--portal:has(img)::before,
.cc-rail__mark--portal:has(img)::before,
body.studio-themed .cc-rail__mark--portal:has(img)::before {
  display: none !important;
}

/* Sign-in / gate large Portal icon */
.portal-app-icon,
.portal-app-icon img,
.portal-app-icon .portal-product-logo {
  display: block;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  object-fit: contain !important;
  image-rendering: auto;
}
.portal-app-icon {
  overflow: visible !important;
  line-height: 0;
}
.portal-app-icon--sm { width: 48px; height: 48px; }
.portal-app-icon--lg { width: 88px; height: 88px; }
.portal-app-icon--lg img,
.portal-app-icon--sm img {
  width: 100%;
  height: 100%;
}
.portal-app-icon--center {
  margin-left: auto;
  margin-right: auto;
}

/* Lumina Apple app icon — larger product mark on desk + embeds */
.app-logo--lumina,
.lumina-logo-mask,
.lumina-logo-full,
.lumina-app-icon,
.lumina-app-icon img {
  display: block;
  flex-shrink: 0;
  border: 0 !important;
  background: transparent !important;
  -webkit-mask: none !important;
  mask: none !important;
  filter: none !important;
  object-fit: contain !important;
  image-rendering: auto;
}
.app-logo--lumina,
.lumina-logo-full {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background: url("/book-app/img/lumina-mark.png?v=luminaNeutral2") center / contain no-repeat;
  box-shadow: 0 6px 16px rgba(40, 16, 90, 0.35);
}
.lumina-logo-full { background: none; }
.lumina-logo-mask { display: none !important; }
/* Sized variants */
.lumina-app-icon {
  width: 44px;
  height: 44px;
  line-height: 0;
  overflow: visible;
}
.lumina-app-icon--sm { width: 40px; height: 40px; }
.lumina-app-icon--md { width: 52px; height: 52px; }
.lumina-app-icon--lg { width: 88px; height: 88px; }
.lumina-app-icon img {
  width: 100%;
  height: 100%;
  border-radius: 0; /* PNG already has Apple squircle */
}
/* Rail / feature icons */
.cc-rail__ico--lumina,
.feature-card__icon--lumina {
  display: inline-grid !important;
  place-items: center;
  width: 1.65rem !important;
  height: 1.65rem !important;
  min-width: 1.65rem;
  padding: 0 !important;
  border-radius: 0.42rem;
  overflow: visible;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 0 !important;
  line-height: 0 !important;
  color: transparent !important;
}
.cc-rail__ico--lumina img,
.feature-card__icon--lumina img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: 0;
}
.feature-card__icon--lumina {
  width: 2.35rem !important;
  height: 2.35rem !important;
  min-width: 2.35rem;
}

body.cc-body .cc-rail__brand h1 {
  margin: 0;
  font-family: var(--cc-display);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

body.cc-body .cc-rail__brand p {
  margin: 0;
  font-size: 0.68rem;
  color: var(--cc-muted-on-dark);
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}

body.cc-body .cc-rail__sec {
  margin: 0.65rem 0.55rem 0.3rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--cc-accent) 70%, var(--cc-muted-on-dark));
}

body.cc-body .cc-rail__item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #c5cdd9;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.58rem 0.7rem;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  margin: 0;
  transition: background 0.12s ease, color 0.12s ease;
  position: relative;
}

body.cc-body .cc-rail__item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

body.cc-body .cc-rail__item {
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
body.cc-body .cc-rail__item:focus,
body.cc-body .cc-rail__item:focus-visible {
  outline: none;
  box-shadow: none;
}
body.cc-body .cc-rail__item:active:not(.is-active) {
  background: color-mix(in srgb, var(--cc-accent, #94a3b8) 14%, transparent);
  color: #fff;
}
body.cc-body .cc-rail__item.is-active {
  background: linear-gradient(
    105deg,
    color-mix(in srgb, var(--cc-accent-2, #94a3b8) 22%, transparent) 0%,
    color-mix(in srgb, var(--cc-accent, #64748b) 28%, transparent) 100%
  );
  color: #f1f5f9;
  box-shadow: inset 3px 0 0 var(--cc-accent, #94a3b8);
}

body.cc-body .cc-rail__item.is-quiet {
  color: var(--cc-muted-on-dark);
  font-weight: 500;
  font-size: 0.84rem;
}

body.cc-body .cc-rail__ico {
  width: 1.1rem;
  text-align: center;
  opacity: 0.8;
  font-size: 0.9rem;
  flex-shrink: 0;
}

body.cc-body .cc-rail__badge {
  margin-left: auto;
  min-width: 1.2rem;
  padding: 0.08rem 0.38rem;
  border-radius: 999px;
  background: var(--cc-accent);
  color: #041018;
  font-size: 0.65rem;
  font-weight: 800;
}

body.cc-body .cc-rail__foot {
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

body.cc-body .cc-rail__hint {
  margin: 0.4rem 0.55rem 0;
  font-size: 0.7rem;
  color: var(--cc-muted-on-dark);
  line-height: 1.35;
}

/* ---------- Main column (light canvas like mock) ---------- */
body.cc-body .cc-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background:
    radial-gradient(700px 280px at 90% -5%, color-mix(in srgb, var(--cc-accent) 10%, transparent), transparent 55%),
    var(--cc-main-bg, var(--cc-ink-2, #0c1524));
  color: var(--cc-text);
}

body.cc-body .cc-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding: 0.9rem 1.4rem;
  border-bottom: 1px solid var(--cc-line-soft, rgba(15, 23, 42, 0.06));
  background: linear-gradient(
    105deg,
    color-mix(in srgb, var(--cc-accent-2, #94a3b8) 55%, #0e1726) 0%,
    color-mix(in srgb, var(--cc-accent, #64748b) 50%, #0a1220) 50%,
    color-mix(in srgb, var(--cc-accent-deep, #475569) 55%, #080e18) 100%
  );
  color: var(--cc-text-on-dark);
  position: sticky;
  top: var(--studio-bar-h, 0px);
  z-index: 20;
  box-shadow: 0 8px 24px color-mix(in srgb, #000 18%, transparent);
}

body.cc-body .cc-top__title {
  margin: 0;
  font-family: var(--cc-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--cc-text-on-dark, #fff);
}

body.cc-body .cc-top__sub {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--cc-muted-on-dark);
}

body.cc-body .cc-top__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

/* Chips on dark top bar */
body.cc-body .cc-top .cc-chip {
  color: var(--cc-accent-2);
  border-color: color-mix(in srgb, var(--cc-accent) 40%, transparent);
  background: color-mix(in srgb, var(--cc-accent) 12%, transparent);
}

body.cc-body .cc-body-area {
  flex: 1;
  padding: 1.25rem 1.4rem 2.5rem;
  max-width: 1120px;
  color: var(--cc-text);
}

body.cc-body .cc-alert {
  margin: 0 1.35rem;
  margin-top: 0.75rem;
}

/* ---------- Panels / cards (token-driven — brand themes paint these) ---------- */
body.cc-body .cc-hero {
  padding: 1.2rem 1.3rem;
  border-radius: var(--cc-radius);
  border: 1px solid var(--cc-line-soft);
  background: var(--cc-panel, #fff);
  margin-bottom: 1rem;
  box-shadow: 0 4px 18px color-mix(in srgb, #000 8%, transparent);
  color: var(--cc-text);
}

body.cc-body .cc-hero h2 {
  margin: 0 0 0.3rem;
  font-family: var(--cc-display);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--cc-hero-title, var(--cc-text, #0f172a));
  /* accent underline like mock */
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--cc-accent) 55%, transparent);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.28em;
}

body.cc-body .cc-hero p {
  margin: 0.45rem 0 0;
  color: var(--cc-muted);
  font-size: 0.92rem;
  max-width: 38rem;
}

body.cc-body .cc-chip {
  display: inline-block;
  margin-top: 0.65rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  color: var(--cc-accent-deep);
  border: 1px solid color-mix(in srgb, var(--cc-accent) 40%, transparent);
  background: color-mix(in srgb, var(--cc-accent) 10%, #fff);
}

body.cc-body .cc-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  body.cc-body .cc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1000px) {
  body.cc-body .cc-grid.cc-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Setup tiles — brand-theme sets --cc-card-dark + --cc-tile-text (dark glass or light paper) */
body.cc-body .cc-tile {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
  padding: 1.1rem 1.15rem;
  border-radius: 1rem;
  border: 1px solid color-mix(in srgb, var(--cc-accent) 18%, transparent);
  background: var(--cc-card-dark);
  color: var(--cc-tile-text, #e8eef7);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  min-height: 7.25rem;
  transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 10px 28px color-mix(in srgb, #000 18%, transparent);
}

body.cc-body .cc-tile:hover {
  border-color: color-mix(in srgb, var(--cc-accent) 50%, transparent);
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(10, 18, 32, 0.32);
}

body.cc-body .cc-tile.is-off {
  opacity: 0.48;
  pointer-events: none;
}

body.cc-body .cc-tile__kicker {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cc-accent);
  opacity: 0.95;
}

body.cc-body .cc-tile__title {
  font-family: var(--cc-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--cc-tile-text, #fff);
}

body.cc-body .cc-tile__desc {
  margin: 0;
  font-size: 0.84rem;
  color: var(--cc-muted-on-dark, #94a3b8);
  line-height: 1.4;
  flex: 1;
}

body.cc-body .cc-tile__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

/* Panel cards for forms / content — token paint */
body.cc-body .cc-panel-card {
  border: 1px solid var(--cc-line-soft);
  border-radius: var(--cc-radius);
  background: var(--cc-panel, #fff);
  padding: 1.15rem 1.2rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 4px 18px color-mix(in srgb, #000 8%, transparent);
  color: var(--cc-text);
}

body.cc-body .cc-panel-card h2 {
  margin: 0 0 0.65rem;
  font-family: var(--cc-display);
  font-size: 1.05rem;
  color: var(--cc-hero-title, var(--cc-text, #0f172a));
}

body.cc-body .cc-panel-card .muted,
body.cc-body .cc-body-area .muted {
  color: var(--cc-muted);
}

/* Form controls follow brand surface/text (exclude checkbox/radio — they get a black box otherwise) */
body.cc-body .cc-body-area input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="range"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]),
body.cc-body .cc-body-area select,
body.cc-body .cc-body-area textarea {
  background: var(--cc-panel, #fff);
  color: var(--cc-text, #0f172a);
  border: 1px solid var(--cc-line-soft, rgba(15, 23, 42, 0.12));
  border-radius: 12px;
}
body.cc-body .cc-body-area input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="range"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]):focus,
body.cc-body .cc-body-area select:focus,
body.cc-body .cc-body-area textarea:focus {
  outline: none;
  border-color: var(--cc-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cc-accent) 20%, transparent);
}

/* Native checkboxes / radios — no dark fill or radius from text-field rules */
body.cc-body .cc-body-area input[type="checkbox"],
body.cc-body .cc-body-area input[type="radio"] {
  appearance: auto;
  -webkit-appearance: auto;
  width: 1.1em;
  height: 1.1em;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  accent-color: var(--cc-accent, #0ea5e9);
  flex-shrink: 0;
  cursor: pointer;
  vertical-align: middle;
}

body.cc-body .cc-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}

body.cc-body .cc-checklist li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--cc-line-soft);
}

body.cc-body .cc-checklist li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

body.cc-body .cc-checklist li:first-child {
  padding-top: 0;
}

body.cc-body .cc-check-label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: #0f172a;
}

body.cc-body .cc-check-dot {
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--cc-accent) 55%, transparent);
  flex-shrink: 0;
  margin-top: 0.1rem;
}

body.cc-body .cc-check-dot.is-done {
  background: var(--cc-accent);
  border-color: var(--cc-accent);
  box-shadow: inset 0 0 0 3px #fff;
  position: relative;
}

body.cc-body .cc-check-meta {
  font-size: 0.8rem;
  color: var(--cc-muted);
  font-weight: 500;
  margin-top: 0.15rem;
}

/* Buttons — sky cyan like mock */
body.cc-body .cc-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  padding: 0.52rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  color: #041018;
  background: linear-gradient(145deg, var(--cc-accent-2), var(--cc-accent-deep));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--cc-accent) 25%, transparent);
}

body.cc-body .cc-btn:hover {
  filter: brightness(1.06);
}

body.cc-body .cc-btn--ghost {
  background: transparent;
  color: inherit;
  border-color: color-mix(in srgb, currentColor 18%, transparent);
  box-shadow: none;
}

body.cc-body .cc-top .cc-btn--ghost {
  color: var(--cc-text-on-dark, #e2e8f0);
  border-color: color-mix(in srgb, var(--cc-text-on-dark, #e2e8f0) 28%, transparent);
}

body.cc-body .cc-btn--ghost:hover {
  border-color: color-mix(in srgb, var(--cc-accent) 45%, transparent);
  filter: none;
}

body.cc-body .cc-panel-card .cc-btn--ghost,
body.cc-body .cc-body-area .cc-btn--ghost {
  color: var(--cc-text, #0f172a);
  border-color: var(--cc-line-soft, rgba(15, 23, 42, 0.14));
  background: var(--cc-panel, #fff);
}

body.cc-body .cc-btn--sky {
  background: linear-gradient(145deg, var(--cc-accent-2), var(--cc-accent-deep));
  color: #041018;
}

body.cc-body .cc-menu-toggle {
  display: none;
}

/* Links in light area */
body.cc-body .cc-body-area a:not(.cc-btn):not(.cc-tile) {
  color: var(--cc-accent-deep);
  font-weight: 600;
}

/* ---------- Studio desks: keep dark option via data attr ---------- */
body.cc-body.studio-themed {
  --cc-main-bg: #0c1524;
  --cc-text: #f1f5f9;
  --cc-muted: #94a3b8;
}
body.cc-body.studio-themed .cc-main {
  background:
    radial-gradient(700px 280px at 90% -5%, color-mix(in srgb, var(--cc-accent) 8%, transparent), transparent 55%),
    var(--cc-ink-2);
  color: var(--cc-text-on-dark);
}
body.cc-body.studio-themed .cc-top {
  background: color-mix(in srgb, var(--cc-ink) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: none;
}
body.cc-body.studio-themed .cc-hero,
body.cc-body.studio-themed .cc-panel-card {
  background: #151c27;
  border-color: rgba(148, 163, 184, 0.14);
  color: var(--cc-text-on-dark);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
}
body.cc-body.studio-themed .cc-hero h2,
body.cc-body.studio-themed .cc-panel-card h2 {
  color: #f1f5f9;
  text-decoration: none;
}
body.cc-body.studio-themed .cc-tile {
  background: linear-gradient(165deg, rgba(30, 48, 72, 0.92), rgba(17, 28, 46, 0.98));
}
body.cc-body.studio-themed .cc-body-area input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="range"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]),
body.cc-body.studio-themed .cc-body-area select,
body.cc-body.studio-themed .cc-body-area textarea {
  background: #0f172a;
  color: #f1f5f9;
  border-color: rgba(148, 163, 184, 0.22);
}
body.cc-body.studio-themed .cc-body-area input[type="checkbox"],
body.cc-body.studio-themed .cc-body-area input[type="radio"] {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  accent-color: var(--cc-accent, #7dd3fc);
}
body.cc-body.studio-themed .cc-check-label {
  color: #f1f5f9;
}
body.cc-body.studio-themed .cc-panel-card .cc-btn--ghost,
body.cc-body.studio-themed .cc-body-area .cc-btn--ghost {
  color: #f1f5f9 !important;
  border-color: rgba(148, 163, 184, 0.35) !important;
  background: transparent !important;
}
body.cc-body.studio-themed .cc-body-area .cc-btn:not(.cc-btn--ghost) {
  color: #041018 !important;
  background: linear-gradient(145deg, #7dd3fc, #0ea5e9) !important;
}

/* Mobile — owner & client desks (match portal admin drawer at 900px) */
@media (max-width: 900px) {
  body.cc-body {
    overflow-x: clip;
    max-width: 100%;
  }
  body.cc-body .cc-app {
    grid-template-columns: 1fr !important;
    min-height: 100dvh;
    width: 100%;
    max-width: 100%;
    /* Do NOT set transform/filter here — it traps position:fixed rail */
    overflow: visible !important;
  }
  /* Drawer off-canvas — high z-index so it is not trapped under main content */
  body.cc-body .cc-rail {
    position: fixed !important;
    left: 0;
    top: var(--studio-bar-h, 0px);
    bottom: 0;
    width: min(300px, 86vw);
    height: auto;
    max-height: none;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    transform: translate3d(-105%, 0, 0);
    transition: transform 0.2s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    z-index: 10050 !important;
    margin: 0;
    pointer-events: auto !important;
    visibility: visible !important;
  }
  body.cc-body .admin-nav-open .cc-rail,
  body.cc-body .cc-nav-open .cc-rail,
  body.cc-body .cc-rail.is-open {
    transform: translate3d(0, 0, 0) !important;
    pointer-events: auto !important;
  }
  body.cc-body .cc-menu-toggle,
  body.cc-body .admin-nav-toggle {
    display: inline-flex !important;
    min-width: 48px !important;
    min-height: 48px !important;
    align-items: center;
    justify-content: center;
    padding: 0 0.85rem;
    position: relative;
    z-index: 10060 !important;
    pointer-events: auto !important;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  /* Phase 3: 44px rail targets */
  body.cc-body .cc-rail .cc-rail__item,
  body.cc-body .cc-rail .admin-nav__item {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.55rem;
  }
  body.cc-body .cc-backdrop {
    display: none !important;
    position: fixed;
    inset: 0;
    top: var(--studio-bar-h, 0px);
    background: rgba(0, 0, 0, 0.55);
    z-index: 10040 !important;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    pointer-events: none;
  }
  /* Only show when nav is open AND backdrop is not [hidden] */
  body.cc-body .admin-nav-open .cc-backdrop:not([hidden]),
  body.cc-body .cc-nav-open .cc-backdrop:not([hidden]) {
    display: block !important;
    pointer-events: auto !important;
    visibility: visible !important;
    z-index: 10040 !important;
  }
  body.cc-body .cc-body-area {
    padding: 0.85rem max(0.75rem, env(safe-area-inset-right)) 2.5rem max(0.75rem, env(safe-area-inset-left));
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  body.cc-body .cc-top {
    padding: 0.65rem max(0.75rem, env(safe-area-inset-right)) 0.65rem max(0.75rem, env(safe-area-inset-left));
    gap: 0.5rem;
    flex-wrap: nowrap;
    max-width: 100%;
    box-sizing: border-box;
  }
  body.cc-body .cc-top > div:first-child {
    min-width: 0;
    flex: 1 1 auto;
  }
  body.cc-body .cc-top__actions {
    flex-shrink: 0;
    flex-wrap: nowrap;
  }
  /* Hide secondary top actions on small screens — use drawer */
  body.cc-body .cc-top__actions > .cc-btn:not(.cc-menu-toggle):not(.admin-nav-toggle):not([id*="Logout"]):not([id*="logout"]) {
    display: none;
  }
  body.cc-body .cc-top h1,
  body.cc-body .cc-top .cc-top__title {
    font-size: 1.05rem;
    line-height: 1.25;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  body.cc-body .cc-top__sub {
    display: none;
  }
  body.cc-body .cc-main {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }
  body.cc-body .cc-hero {
    padding: 0.95rem 0.9rem;
  }
  body.cc-body .cc-hero h2 {
    font-size: clamp(1.15rem, 5vw, 1.45rem);
    overflow-wrap: anywhere;
  }
  body.cc-body .cc-hero p {
    max-width: 100%;
    font-size: 0.92rem;
  }
  body.cc-body .cc-panel-card {
    padding: 0.9rem 0.85rem;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
  }
  body.cc-body .cc-tile__actions {
    flex-direction: column;
    align-items: stretch;
  }
  body.cc-body .cc-tile__actions .cc-btn,
  body.cc-body .cc-tile__actions a.cc-btn,
  body.cc-body .cc-btn {
    min-height: 44px;
  }
  body.cc-body .cc-tile__actions .cc-btn,
  body.cc-body .cc-tile__actions a.cc-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
  body.cc-body .cc-checklist li {
    flex-direction: column;
    align-items: stretch;
  }
  body.cc-body .cc-checklist .cc-tile__actions {
    width: 100%;
  }
  body.cc-body input,
  body.cc-body select,
  body.cc-body textarea {
    font-size: 16px !important;
    max-width: 100%;
    box-sizing: border-box;
  }
  body.cc-body table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.cc-body .row {
    flex-wrap: wrap;
  }
  body.cc-body .grid2 {
    grid-template-columns: 1fr !important;
  }
  /* Mobile rail = same paint as desktop rail (brand/studio tokens) */
  body.cc-body .admin-nav-open,
  body.cc-body .cc-nav-open {
    overflow: hidden;
    /* Do not set touch-action:none — it blocks taps on the left drawer on iOS */
    touch-action: auto;
  }
  body.cc-body .cc-rail__item {
    min-height: 44px;
  }
  body.cc-body .cc-menu-toggle {
    border: 1px solid var(--cc-line, rgba(148, 163, 184, 0.22));
  }
  body.cc-body .cc-top,
  body.cc-body .cc-hero,
  body.cc-body .cc-panel-card {
    box-sizing: border-box;
    max-width: 100%;
  }
  body.cc-body .cc-hero h2,
  body.cc-body .cc-top h1 {
    overflow-wrap: anywhere;
  }
  /* Stack form grids that desktop shows multi-col */
  body.cc-body .biz-form-grid,
  body.cc-body .settings-grid,
  body.cc-body .form-grid,
  body.cc-body .grid3 {
    grid-template-columns: 1fr !important;
  }
  body.cc-body img,
  body.cc-body video {
    max-width: 100%;
    height: auto;
  }
  /* Don't squash full-stage embeds / fleet previews */
  body.cc-body .biz-app-frame,
  body.cc-body .ops-frame,
  body.cc-body .fleet-card__frame iframe {
    max-width: none;
    height: 100%;
  }
}

/*
 * Backdrop — always fixed + out of grid flow (desktop AND mobile).
 * Previously only styled inside max-width:900px; on desktop an un-hidden
 * .cc-backdrop could sit as a grid cell and steal layout/clicks.
 */
body.cc-body .cc-backdrop {
  display: none !important;
  position: fixed !important;
  inset: 0;
  top: var(--studio-bar-h, 0px);
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 35;
  cursor: pointer;
  pointer-events: none !important;
  -webkit-tap-highlight-color: transparent;
}
body.cc-body .admin-nav-open .cc-backdrop:not([hidden]),
body.cc-body .cc-nav-open .cc-backdrop:not([hidden]),
body.cc-body .is-mobile-nav-open .cc-backdrop:not([hidden]),
body.cc-body .cc-backdrop.is-open:not([hidden]) {
  display: block !important;
  pointer-events: auto !important;
  visibility: visible !important;
  cursor: pointer !important;
  z-index: 10040 !important;
}

/* Universal: module not live — request access */
body.cc-body .cc-request-access {
  padding: 0.35rem 0 0.25rem;
  max-width: 36rem;
}
body.cc-body .cc-request-access__kicker {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cc-accent, #38bdf8);
}
body.cc-body .cc-request-access__title {
  margin: 0 0 0.65rem;
  font-weight: 700;
  font-size: 1.08rem;
  line-height: 1.3;
  color: inherit;
}
body.cc-body .cc-request-access__body {
  margin: 0 0 0.75rem;
  line-height: 1.5;
  font-size: 0.92rem;
  color: var(--cc-muted);
}
body.cc-body .cc-request-access__lead {
  margin: 0 0 0.35rem;
}
body.cc-body .cc-request-access a {
  color: var(--cc-accent-deep);
  font-weight: 700;
}

/* Progress bar (setup checklist) */
body.cc-body .cc-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
  margin: 0.65rem 0 0.25rem;
}
body.cc-body .cc-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cc-accent), var(--cc-accent-2));
}


/* Tile grid fit reinforcement */
body.cc-body .cc-grid { gap: 1rem; align-items: stretch; }
body.cc-body .cc-tile { min-width: 0; max-width: 100%; width: 100%; box-sizing: border-box; overflow: hidden; }
