/* Scoped platform layouts consume the shared Candis/Edubroker tokens. */
.cp-shell, .cp-page { min-width: 0; color: var(--text); letter-spacing: 0; }
.cp-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100dvh; background: var(--surface-subtle); }
.cp-sidebar { position: sticky; top: 0; height: 100dvh; overflow: auto; background: var(--surface-rail); border-inline-end: 1px solid var(--line); }
.cp-brand { position: relative; display: grid; gap: 3px; padding: 20px; min-height: 88px; border-bottom: 1px solid var(--line); }
.cp-brand strong { font-size: 21px; color: var(--ink); }
.cp-brand span { color: var(--muted); font-size: 13px; }
.cp-sidebar nav { display: grid; gap: 4px; padding: 16px 12px; }
.cp-sidebar nav button { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 12px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; text-align: start; line-height: 1.4; }
.cp-sidebar nav button span { min-width: 0; overflow-wrap: anywhere; }
.cp-sidebar nav button:hover { background: var(--surface); color: var(--text); }
.cp-sidebar nav button.is-active { background: var(--ink); color: var(--on-ink); }
.cp-sidebar nav button.is-active img { filter: brightness(0) invert(1); }
.cp-side-language { padding: 16px 20px; border-top: 1px solid var(--line); }
.cp-icon { width: 18px; height: 18px; flex: 0 0 18px; }
.cp-main { min-width: 0; width: 100%; max-width: 1600px; margin-inline: auto; padding: 28px 32px; align-content: start; }
.cp-page { align-content: start; }
:is(.cp-main,.cp-page) h1 { font-size: 24px; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
:is(.cp-main,.cp-page) h2 { font-size: 16px; line-height: 1.4; }
:is(.cp-main,.cp-page) h3 { font-size: 14px; line-height: 1.5; }
:is(.cp-main,.cp-page) .page-head { align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.cp-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; min-width: 0; }
:is(.cp-main,.cp-page,.cp-dialog) button:disabled { cursor: not-allowed; }
:is(.cp-main,.cp-page,.cp-dialog) .cp-tool { display: inline-grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; min-height: 36px; padding: 8px; }
:is(.cp-main,.cp-page) a.secondary { white-space: normal; text-align: center; }
.cp-section { display: grid; gap: 14px; padding: 16px; min-width: 0; background: var(--surface); }
.cp-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 14px 18px; min-width: 0; }
.cp-full { grid-column: 1 / -1; }
.cp-inline-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; }
.cp-inline-form[data-cp-form="domain"] { grid-template-columns: minmax(0, 1fr) auto; }
.cp-filter { display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, 220px) auto; gap: 8px; align-items: end; }
.cp-alerts:empty { display: none; }
.cp-alerts { display: grid; gap: 8px; }
.cp-error, .cp-notice { padding: 10px 12px; border-inline-start: 3px solid var(--danger); background: var(--danger-soft); color: var(--danger); font-size: 14px; overflow-wrap: anywhere; }
.cp-notice { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.cp-empty { padding: 24px 16px; text-align: center; color: var(--muted); }
.cp-table-wrap { min-width: 0; max-width: 100%; overflow: auto; border: 1px solid var(--line); background: var(--surface); }
.cp-table-wrap table { min-width: 650px; width: 100%; border-collapse: collapse; }
.cp-table-wrap th, .cp-table-wrap td { text-align: start; }
.cp-table-wrap code { font-size: 12px; overflow-wrap: anywhere; }
.cp-table-wrap .table-link { overflow-wrap: anywhere; text-align: start; }
.cp-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.cp-status { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 7px; border-radius: 4px; background: var(--surface-header); color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.cp-status-active, .cp-status-verified { background: var(--success-soft); color: var(--success); }
.cp-status-pending, .cp-status-invited, .cp-status-connected { background: var(--warning-soft); color: var(--warning); }
.cp-status-suspended, .cp-status-failed, .cp-status-rejected { background: var(--danger-soft); color: var(--danger); }
.cp-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; background: var(--surface); border-block: 1px solid var(--line); }
.cp-stats > div { padding: 12px 16px; min-width: 0; border-inline-end: 1px solid var(--line); }
.cp-stats > div:last-child { border: 0; }
.cp-stats dt { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.cp-stats dd { margin: 3px 0 0; font-size: 24px; line-height: 1.3; font-weight: 600; overflow-wrap: anywhere; }
.cp-school-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--muted); }
.cp-school-meta span { overflow-wrap: anywhere; }
.cp-tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); gap: 16px; }
.cp-tabs button { flex-shrink: 0; min-height: 40px; padding: 8px 2px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 14px; }
.cp-tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.cp-domain-list { display: grid; gap: 0; min-width: 0; background: var(--surface); }
.cp-domain { display: grid; gap: 12px; min-width: 0; padding: 16px; border-bottom: 1px solid var(--line); }
.cp-domain header { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.cp-domain header > div:first-child { flex: 1; min-width: 0; }
.cp-domain h2 { overflow-wrap: anywhere; }
.cp-domain .cp-table-wrap table { min-width: 440px; }
.cp-footnote { color: var(--muted); font-size: 13px; line-height: 1.5; }
.cp-branding-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.cp-branding-form { display: grid; min-width: 0; gap: 0; background: var(--surface); }
.cp-branding-form .cp-section { border-bottom: 1px solid var(--line); }
.cp-branding-form input[type="color"] { height: 40px; padding: 4px; width: 100%; }
.cp-assets { display: grid; gap: 12px; }
.cp-asset { display: grid; grid-template-columns: minmax(0, 1fr) 64px auto; gap: 8px; align-items: end; }
.cp-asset > img { width: 64px; height: 40px; object-fit: contain; }
.cp-welcome-label textarea { min-height: 120px; }
.cp-link-row { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr) 36px; gap: 8px; align-items: end; }
.cp-branding-actions { display: grid; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.cp-branding-actions > span { font-size: 12px; color: var(--muted); }
.cp-preview-section { display: grid; gap: 12px; min-width: 0; position: sticky; top: 20px; }
.cp-preview-section > header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.cp-segment { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.cp-segment button { border: 0; border-radius: 4px; color: var(--muted); background: transparent; }
.cp-segment button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.cp-preview { width: 100%; min-height: 320px; overflow: hidden; border: 1px solid var(--line-dark); border-radius: 6px; background: var(--surface); color: var(--text); }
.cp-preview-mobile { max-width: 360px; min-height: 440px; margin-inline: auto; }
.cp-preview header { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); background: var(--surface-header); }
.cp-preview header strong { font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
.cp-preview-logo { width: 72px; height: 48px; object-fit: contain; flex: 0 0 72px; }
.cp-preview-content { display: grid; gap: 16px; padding: 24px 16px; }
.cp-preview-content p { white-space: pre-wrap; overflow-wrap: anywhere; }
.cp-preview-cta { justify-self: start; max-width: 100%; border-radius: 6px; padding: 8px 12px; background: var(--cp-preview-accent); color: var(--cp-preview-on); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.cp-preview footer { display: flex; flex-wrap: wrap; gap: 8px 12px; padding: 16px; border-top: 1px solid var(--line); font-size: 12px; overflow-wrap: anywhere; }
.cp-preview footer p { width: 100%; }
.cp-preview footer a { color: var(--text); }
.cp-login { width: 100%; max-width: 420px; margin: 16px auto; display: grid; gap: 12px; }
.cp-login-form { display: grid; gap: 16px; padding: 16px; background: var(--surface); }
.cp-auth-shell { width: min(420px, calc(100% - 32px)); margin: 48px auto; min-width: 0; }
.cp-auth-brand { margin-bottom: 8px; font-size: 24px; font-weight: 650; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
.cp-auth-shell .page-head { margin: 0; padding-bottom: 12px; border: 0; }
.cp-auth-shell .page-head h1 { font-size: 16px; font-weight: 500; color: var(--muted); }
.cp-auth-shell .cp-login { margin: 8px 0 0; }
.cp-auth-shell .cp-login-form { padding: 0; background: transparent; }
.cp-dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 20px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--surface); box-shadow: var(--shadow-dialog); }
.cp-dialog::backdrop { background: var(--overlay); }
.cp-dialog > :is(p,strong,.cp-alerts) { display: block; margin-block: 12px; overflow-wrap: anywhere; }
.cp-dialog h2 { font-size: 18px; }
.cp-dialog .cp-actions { margin-top: 16px; }
.cp-mobile-head, .cp-drawer-close, .cp-backdrop { display: none; }
.cp-shell[dir="rtl"] [data-cp-action="back-schools"] img { transform: rotate(180deg); }
@media (max-width: 1100px) {
  .cp-main { padding: 24px; }
  .cp-branding-layout { grid-template-columns: minmax(0, 1fr); }
  .cp-preview-section { position: static; }
  .cp-inline-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cp-inline-form > button { justify-self: start; }
}
@media (max-width: 760px) {
  .cp-shell { display: block; }
  .cp-main { padding: 16px; }
  .cp-mobile-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
  .cp-mobile-head strong { color: var(--ink); font-size: 19px; }
  .cp-sidebar { display: none; }
  .cp-navigation-open { height: 100dvh; overflow: hidden; }
  .cp-navigation-open .cp-sidebar { display: block; position: fixed; z-index: 501; inset-block: 0; inset-inline-start: 0; width: min(288px, calc(100vw - 44px)); height: 100dvh; box-shadow: var(--shadow-menu); }
  .cp-navigation-open .cp-backdrop { display: block; position: fixed; z-index: 500; inset: 0; width: 100%; height: 100dvh; border: 0; border-radius: 0; padding: 0; background: var(--overlay); }
  .cp-drawer-close { display: grid; position: absolute; inset-inline-end: 12px; top: 16px; }
  .cp-brand { padding-inline-end: 56px; }
  .cp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cp-stats > div { border-bottom: 1px solid var(--line); }
  .cp-filter { grid-template-columns: minmax(0, 1fr) auto; }
  .cp-filter > label:first-child { grid-column: 1 / -1; }
  .cp-form { grid-template-columns: minmax(0, 1fr); }
  .cp-inline-form[data-cp-form="domain"] { grid-template-columns: minmax(0, 1fr); }
  .cp-inline-form > button { justify-self: start; }
  .cp-link-row { grid-template-columns: minmax(0, 1fr) 36px; }
  .cp-link-row > label:first-child { grid-column: 1 / -1; }
  .cp-section { padding: 14px; }
  .cp-branding-actions { position: static; }
  .cp-asset { grid-template-columns: minmax(0, 1fr) 36px; }
  .cp-asset > label { grid-column: 1 / -1; }
  .cp-asset > img { justify-self: start; }
  :is(.cp-main,.cp-page) .page-head { align-items: start; }
  :is(.cp-main,.cp-page) .page-head h1 { font-size: 22px; }
  .cp-domain .cp-actions { width: 100%; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .cp-shell button, .cp-page button, .cp-dialog button { transition: none; }
}
