:root {
  --sph-crm-bg: #f4f1ea;
  --sph-crm-surface: #ffffff;
  --sph-crm-surface-2: #faf8f2;
  --sph-crm-panel: #ffffff;
  --sph-crm-border: #e8dfce;
  --sph-crm-text: #1c1c1c;
  --sph-crm-text-soft: #5d5a54;
  --sph-crm-muted: #8f6a1f;
  --sph-crm-accent: #c8a24c;
  --sph-crm-accent-2: #e0be72;
  --sph-crm-shadow: 0 14px 36px rgba(18,18,18,.06);
  --sph-crm-sidebar-bg: #0f0f10;
  --sph-crm-sidebar-text: #f3f1ec;
}

.sph-crm-shell[data-theme="dark"] {
  --sph-crm-bg: #111315;
  --sph-crm-surface: #181b1f;
  --sph-crm-surface-2: #20252b;
  --sph-crm-panel: #1a1f24;
  --sph-crm-border: #31363d;
  --sph-crm-text: #f3f1ec;
  --sph-crm-text-soft: #c9c4b8;
  --sph-crm-muted: #c8a24c;
  --sph-crm-accent: #c8a24c;
  --sph-crm-accent-2: #e0be72;
  --sph-crm-shadow: 0 18px 44px rgba(0,0,0,.22);
  --sph-crm-sidebar-bg: #0b0d0f;
  --sph-crm-sidebar-text: #f3f1ec;
}

.sph-crm-shell {
  display: grid;
  grid-template-columns: 290px 1fr;
  min-height: 100vh;
  background: var(--sph-crm-bg);
  color: var(--sph-crm-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  position: relative;
}

.sph-crm-main {
  min-width: 0;
}

.sph-crm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,.48);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: .22s ease;
  z-index: 998;
}

.sph-crm-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.sph-crm-sidebar {
  background: var(--sph-crm-sidebar-bg);
  color: var(--sph-crm-sidebar-text);
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 999;
}

.sph-crm-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.sph-crm-brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--sph-crm-accent) 0%, var(--sph-crm-accent-2) 100%);
  color: #111;
  font-weight: 900;
  letter-spacing: .08em;
}

.sph-crm-brand h2 { margin: 0; font-size: 22px; color: var(--sph-crm-sidebar-text); }
.sph-crm-brand p { margin: 4px 0 0; color: rgba(255,255,255,.68); font-size: 14px; }

.sph-crm-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sph-crm-nav-item {
  display: block;
  text-decoration: none;
  color: rgba(255,255,255,.82);
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 700;
  transition: .18s ease;
}

.sph-crm-nav-item:hover,
.sph-crm-nav-item.is-active {
  background: var(--sph-crm-accent);
  color: #111;
  border-color: var(--sph-crm-accent);
}

.sph-crm-sidebar-footer { margin-top: 22px; }
.sph-crm-theme-card {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
}
.sph-crm-theme-card span {
  display: block;
  color: rgba(255,255,255,.72);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 10px;
}
.sph-crm-theme-toggle {
  width: 100%;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.sph-crm-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 22px 28px 0;
  background: color-mix(in srgb, var(--sph-crm-bg) 86%, transparent);
  backdrop-filter: blur(10px);
}

.sph-crm-topbar-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.sph-crm-topbar-row-bottom { padding: 14px 0 18px; }

.sph-crm-topbar-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sph-crm-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sph-crm-text-soft);
  font-size: 13px;
}
.sph-crm-breadcrumbs a {
  color: var(--sph-crm-muted);
  text-decoration: none;
  font-weight: 700;
}

.sph-crm-eyebrow {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sph-crm-muted);
}

.sph-crm-headings h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.06;
  color: var(--sph-crm-text);
}

.sph-crm-topbar-right {
  display: flex;
  gap: 14px;
  align-items: center;
}

.sph-crm-user {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--sph-crm-surface-2);
  border: 1px solid var(--sph-crm-border);
  border-radius: 16px;
  padding: 10px 14px;
}

.sph-crm-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--sph-crm-accent) 0%, var(--sph-crm-accent-2) 100%);
  color: #111;
  font-weight: 900;
}
.sph-crm-user-meta { display:flex; flex-direction:column; line-height:1.14; }
.sph-crm-user-meta span { font-weight: 700; }
.sph-crm-user-meta small { color: var(--sph-crm-text-soft); }
.sph-crm-user a { color: var(--sph-crm-muted); text-decoration:none; font-weight:700; }

.sph-crm-notifications { position: relative; }
.sph-crm-notification-button {
  position: relative;
  width: 46px; height: 46px;
  border-radius: 14px;
  border: 1px solid var(--sph-crm-border);
  background: var(--sph-crm-surface-2);
  color: var(--sph-crm-text);
  cursor: pointer;
}
.sph-crm-notification-button strong {
  position: absolute;
  top: -6px; right: -4px;
  min-width: 22px; height: 22px;
  border-radius: 999px;
  background: var(--sph-crm-accent);
  color: #111;
  font-size: 11px;
  display: grid; place-items: center;
}
.sph-crm-notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 40px);
  background: var(--sph-crm-surface);
  border: 1px solid var(--sph-crm-border);
  border-radius: 18px;
  box-shadow: var(--sph-crm-shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: .18s ease;
}
.sph-crm-notifications.is-open .sph-crm-notification-panel {
  opacity:1; pointer-events:auto; transform: translateY(0);
}
.sph-crm-notification-head { display:flex; justify-content:space-between; padding:14px 16px; border-bottom:1px solid var(--sph-crm-border); }
.sph-crm-notification-list { padding:10px; max-height:340px; overflow:auto; }
.sph-crm-notification-item {
  display:flex; flex-direction:column; gap:4px;
  padding:12px; border-radius:14px;
  text-decoration:none; color:var(--sph-crm-text);
  background: var(--sph-crm-surface-2);
  margin-bottom:8px; border:1px solid transparent;
}
.sph-crm-notification-item span { color: var(--sph-crm-text-soft); font-size:13px; }
.sph-crm-notification-item.is-danger { border-color: rgba(197,106,106,.25); }
.sph-crm-notification-item.is-info { border-color: rgba(110,166,216,.25); }
.sph-crm-notification-item.is-finance { border-color: rgba(95,167,119,.25); }

.sph-crm-context-chips {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}
.sph-crm-context-chip {
  min-width: 145px;
  background: var(--sph-crm-surface-2);
  border: 1px solid var(--sph-crm-border);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sph-crm-context-chip span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--sph-crm-muted);
  font-weight: 700;
}
.sph-crm-context-chip strong { font-size: 18px; }

.sph-crm-content { padding: 26px 28px 34px; }

.sph-crm-card {
  background: var(--sph-crm-surface);
  border: 1px solid var(--sph-crm-border);
  border-radius: 24px;
  box-shadow: var(--sph-crm-shadow);
}

.sph-crm-hero {
  display: grid;
  grid-template-columns: 1.25fr .95fr;
  gap: 22px;
  padding: 28px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}

.sph-crm-hero::after {
  content: '';
  position: absolute;
  right: -80px;
  bottom: -80px;
  width: 240px;
  height: 240px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(200,162,76,.18) 0%, rgba(200,162,76,0) 70%);
  pointer-events: none;
}

.sph-crm-pill, .sph-crm-chip {
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 12px; border-radius:999px;
  background: color-mix(in srgb, var(--sph-crm-accent) 18%, var(--sph-crm-surface-2));
  color: var(--sph-crm-muted);
  font-weight:800; font-size:12px; text-transform:uppercase; letter-spacing:.05em;
}
.sph-crm-hero h2 { margin: 14px 0 10px; font-size: 36px; line-height:1.05; color: var(--sph-crm-text); }
.sph-crm-hero p { color: var(--sph-crm-text-soft); margin:0; }
.sph-crm-role-badge-row { display:flex; gap:12px; flex-wrap:wrap; align-items:center; margin-top:16px; }
.sph-crm-role-badge {
  display:inline-flex; padding:8px 12px; border-radius:999px;
  background: var(--sph-crm-surface-2); border:1px solid var(--sph-crm-border);
  color: var(--sph-crm-muted); font-weight:700; font-size:13px;
}
.sph-crm-inline-link { color: var(--sph-crm-muted); text-decoration:none; font-weight:800; }

.sph-crm-hero-actions,
.sph-crm-module-footer { display:flex; gap:12px; flex-wrap:wrap; align-content:flex-start; }

.sph-crm-btn {
  display:inline-flex; align-items:center; justify-content:center;
  padding:12px 16px; border-radius:14px; min-height:46px;
  text-decoration:none; font-weight:800; border:1px solid transparent;
}
.sph-crm-btn-primary { background:#111; color:#fff; }
.sph-crm-btn-primary:hover { background: var(--sph-crm-accent); color:#111; }
.sph-crm-btn-secondary { background: var(--sph-crm-surface-2); color: var(--sph-crm-text); border-color: var(--sph-crm-border); }
.sph-crm-btn-secondary:hover { border-color: var(--sph-crm-accent); color: var(--sph-crm-muted); }

.sph-crm-grid { display:grid; gap:18px; }
.sph-crm-grid-metrics { grid-template-columns: repeat(4, minmax(0,1fr)); margin-bottom: 22px; }
.sph-crm-grid-panels { grid-template-columns: repeat(2, minmax(0,1fr)); margin-bottom: 22px; }
.sph-crm-grid-radar { grid-template-columns: 1fr; }
.sph-crm-grid-modules { grid-template-columns: repeat(2, minmax(0,1fr)); }

.sph-crm-metric-card { padding: 20px; }
.sph-crm-metric-label { font-size: 12px; text-transform:uppercase; color: var(--sph-crm-muted); font-weight:800; letter-spacing:.05em; }
.sph-crm-metric-value { font-size: 38px; font-weight:900; margin-top:10px; }
.sph-crm-metric-hint { margin-top:8px; color: var(--sph-crm-text-soft); font-size:14px; }

.sph-crm-panel-card, .sph-crm-section-card { padding: 22px; }
.sph-crm-panel-head, .sph-crm-section-head, .sph-crm-module-top {
  display:flex; justify-content:space-between; gap:12px; align-items:center; flex-wrap:wrap; margin-bottom:14px;
}
.sph-crm-panel-head h3, .sph-crm-section-head h3, .sph-crm-module-top h4 { margin:0; color: var(--sph-crm-text); }
.sph-crm-section-head p { margin:0; color: var(--sph-crm-text-soft); }
.sph-crm-module-card { padding: 20px; position:relative; overflow:hidden; }
.sph-crm-module-card::after {
  content:''; position:absolute; inset:auto 0 0 0; height:4px;
  background: linear-gradient(90deg, #111 0%, var(--sph-crm-accent) 100%);
}
.sph-crm-module-card p { color: var(--sph-crm-text-soft); margin:0 0 14px; }

.sph-crm-list-clean { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:12px; }
.sph-crm-list-clean li {
  display:flex; flex-direction:column; gap:4px;
  background: var(--sph-crm-surface-2);
  border: 1px solid var(--sph-crm-border);
  border-radius: 16px;
  padding: 13px 14px;
}
.sph-crm-list-clean li span { color: var(--sph-crm-text-soft); }
.sph-crm-list-clean li small { color: var(--sph-crm-muted); font-weight:700; }

.sph-crm-radar-grid { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:14px; }
.sph-crm-radar-item {
  background: var(--sph-crm-surface-2);
  border:1px solid var(--sph-crm-border);
  border-radius:18px; padding:14px 16px;
  display:flex; flex-direction:column; gap:6px;
}
.sph-crm-radar-item span { font-size: 12px; text-transform:uppercase; color: var(--sph-crm-muted); font-weight:800; letter-spacing:.04em; }
.sph-crm-radar-item strong { font-size:24px; }

.sph-crm-empty { margin: 0; color: var(--sph-crm-text-soft); }

.sph-crm-guard {
  min-height: 70vh;
  display:grid; place-items:center;
  background: var(--sph-crm-bg);
}
.sph-crm-guard-card {
  width:min(560px, calc(100% - 32px));
  background: var(--sph-crm-surface);
  border:1px solid var(--sph-crm-border);
  border-radius: 24px;
  box-shadow: var(--sph-crm-shadow);
  padding: 30px;
  text-align: center;
}
.sph-crm-guard-card h2 { margin: 14px 0 10px; font-size: 30px; }
.sph-crm-guard-card p { color: var(--sph-crm-text-soft); }

.sph-crm-menu-toggle {
  width: 46px; height: 46px; padding: 0;
  border-radius: 14px; border:1px solid var(--sph-crm-border);
  background: var(--sph-crm-surface-2);
  display:none; align-items:center; justify-content:center; flex-direction:column; gap:4px; cursor:pointer;
}
.sph-crm-menu-toggle span { width:18px; height:2px; background: var(--sph-crm-text); border-radius:2px; }

body.sph-crm-body-lock { overflow:hidden; }

@media (max-width: 1200px) {
  .sph-crm-grid-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sph-crm-radar-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sph-crm-grid-modules, .sph-crm-grid-panels { grid-template-columns: 1fr; }
  .sph-crm-topbar-right { width:100%; justify-content:space-between; }
}

@media (max-width: 920px) {
  .sph-crm-shell { grid-template-columns: 1fr; min-height: 100dvh; }
  .sph-crm-sidebar {
    position: fixed; left: -320px; top:0; width:min(88vw,300px); height:100dvh;
    transition:left .24s ease; box-shadow: 16px 0 40px rgba(0,0,0,.18);
  }
  .sph-crm-sidebar.is-open { left: 0; }
  .sph-crm-menu-toggle { display:inline-flex; }
  .sph-crm-topbar { padding: 16px 16px 0; }
  .sph-crm-topbar-right, .sph-crm-topbar-left { width:100%; }
  .sph-crm-context-chip { flex: 1 1 calc(50% - 12px); min-width:0; }
  .sph-crm-content { padding: 16px; }
  .sph-crm-hero { grid-template-columns: 1fr; padding: 22px; }
  .sph-crm-hero h2 { font-size: 28px; }
  .sph-crm-grid-metrics, .sph-crm-radar-grid { grid-template-columns: 1fr; }
  .sph-crm-btn { width:100%; }
  .sph-crm-notification-panel { width: min(92vw, 360px); }
}

@media (max-width: 640px) {
  .sph-crm-headings h1 { font-size: 24px; }
  .sph-crm-context-chip { flex:1 1 100%; }
  .sph-crm-brand h2 { font-size: 20px; }
  .sph-crm-user { width:100%; justify-content:space-between; }
  .sph-crm-user-meta { flex:1; }
  .sph-crm-role-badge-row, .sph-crm-hero-actions, .sph-crm-module-footer { flex-direction:column; align-items:stretch; }
}


.sph-crm-shell h1,
.sph-crm-shell h2,
.sph-crm-shell h3,
.sph-crm-shell h4,
.sph-crm-shell h5,
.sph-crm-shell strong {
  color: var(--sph-crm-text);
}

.sph-crm-subnav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 0 18px;
  border-top: 1px solid var(--sph-crm-border);
}

.sph-crm-subnav-item {
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--sph-crm-surface-2);
  border: 1px solid var(--sph-crm-border);
  color: var(--sph-crm-text-soft);
  font-weight: 700;
}

.sph-crm-subnav-item.is-active,
.sph-crm-subnav-item:hover {
  background: var(--sph-crm-accent);
  color: #111;
  border-color: var(--sph-crm-accent);
}

.sph-crm-alert {
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 18px;
  border: 1px solid var(--sph-crm-border);
  background: var(--sph-crm-surface-2);
  color: var(--sph-crm-text);
}

.sph-crm-alert.is-success {
  border-color: rgba(95,167,119,.35);
}

.sph-crm-alert.is-error {
  border-color: rgba(197,106,106,.35);
}

.sph-crm-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.sph-crm-filter-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  flex: 1 1 780px;
}

.sph-crm-form input,
.sph-crm-form select,
.sph-crm-form textarea,
.sph-crm-filter-form input,
.sph-crm-filter-form select {
  width: 100%;
  border: 1px solid var(--sph-crm-border);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--sph-crm-surface-2);
  color: var(--sph-crm-text);
  box-sizing: border-box;
}

.sph-crm-form input::placeholder,
.sph-crm-form textarea::placeholder,
.sph-crm-filter-form input::placeholder {
  color: var(--sph-crm-text-soft);
}

.sph-crm-form label {
  display: block;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--sph-crm-text);
}

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

.sph-crm-form-block {
  margin-top: 16px;
}

.sph-crm-form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.sph-crm-table-wrap {
  overflow-x: auto;
}

.sph-crm-table {
  width: 100%;
  border-collapse: collapse;
}

.sph-crm-table th,
.sph-crm-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--sph-crm-border);
  text-align: left;
  vertical-align: top;
  color: var(--sph-crm-text);
}

.sph-crm-table th {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--sph-crm-muted);
  background: var(--sph-crm-surface-2);
}

.sph-crm-table tbody tr:hover {
  background: color-mix(in srgb, var(--sph-crm-surface-2) 82%, transparent);
}

.sph-crm-cell-sub {
  font-size: 13px;
  color: var(--sph-crm-text-soft);
  margin-top: 6px;
}

.sph-crm-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sph-crm-accent) 16%, var(--sph-crm-surface-2));
  color: var(--sph-crm-muted);
  font-size: 12px;
  font-weight: 800;
}

.sph-crm-badge.is-soft {
  background: var(--sph-crm-surface-2);
  color: var(--sph-crm-text-soft);
}

.sph-crm-detail-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 18px;
}

.sph-crm-detail-card {
  padding: 20px;
}

.sph-crm-detail-card h4,
.sph-crm-detail-card h5 {
  color: var(--sph-crm-text);
}

.sph-crm-kv {
  margin-bottom: 10px;
  color: var(--sph-crm-text-soft);
}

.sph-crm-kv strong {
  color: var(--sph-crm-text);
}

.sph-crm-detail-block {
  margin-top: 18px;
}

.sph-crm-detail-box {
  background: var(--sph-crm-surface-2);
  border: 1px solid var(--sph-crm-border);
  border-radius: 14px;
  padding: 14px;
  color: var(--sph-crm-text);
}

.sph-crm-detail-card-history {
  margin-top: 18px;
}

.sph-crm-timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sph-crm-timeline-item {
  border: 1px solid var(--sph-crm-border);
  border-radius: 16px;
  padding: 16px;
  background: var(--sph-crm-surface-2);
}

.sph-crm-timeline-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.sph-crm-timeline-meta,
.sph-crm-timeline-head span {
  color: var(--sph-crm-text-soft);
  font-size: 13px;
}

.sph-crm-timeline-values {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--sph-crm-text-soft);
}

.sph-crm-timeline-comment {
  background: var(--sph-crm-surface);
  border: 1px solid var(--sph-crm-border);
  border-radius: 12px;
  padding: 12px;
  color: var(--sph-crm-text);
}

@media (max-width: 1100px) {
  .sph-crm-filter-form,
  .sph-crm-detail-grid,
  .sph-crm-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .sph-crm-subnav {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .sph-crm-subnav::-webkit-scrollbar { display: none; }
  .sph-crm-subnav-item { white-space: nowrap; }

  .sph-crm-filter-form {
    grid-template-columns: 1fr;
  }

  .sph-crm-table-wrap {
    overflow: visible;
  }

  .sph-crm-table,
  .sph-crm-table thead,
  .sph-crm-table tbody,
  .sph-crm-table tr,
  .sph-crm-table th,
  .sph-crm-table td {
    display: block;
    width: 100%;
  }

  .sph-crm-table thead { display: none; }
  .sph-crm-table tbody { display: grid; gap: 14px; }
  .sph-crm-table tr {
    background: var(--sph-crm-surface);
    border: 1px solid var(--sph-crm-border);
    border-radius: 18px;
    padding: 10px 12px;
    box-shadow: var(--sph-crm-shadow);
  }

  .sph-crm-table td {
    border: 0;
    padding: 10px 0;
  }

  .sph-crm-table td + td {
    border-top: 1px solid var(--sph-crm-border);
  }

  .sph-crm-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--sph-crm-muted);
    font-weight: 800;
    margin-bottom: 6px;
  }
}

.sph-crm-toolbar-actions {
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}

.sph-crm-inline-form {
  display:grid;
  grid-template-columns: 180px 1fr auto;
  gap:10px;
  align-items:center;
}

.sph-crm-inline-form input,
.sph-crm-inline-form select {
  width:100%;
  border:1px solid var(--sph-crm-border);
  border-radius:12px;
  padding:10px 12px;
  background: var(--sph-crm-surface-2);
  color: var(--sph-crm-text);
  box-sizing:border-box;
}

.sph-crm-shell[data-theme="dark"] .sph-crm-headings h1,
.sph-crm-shell[data-theme="dark"] .sph-crm-hero h2,
.sph-crm-shell[data-theme="dark"] .sph-crm-panel-head h3,
.sph-crm-shell[data-theme="dark"] .sph-crm-section-head h3,
.sph-crm-shell[data-theme="dark"] .sph-crm-module-top h4,
.sph-crm-shell[data-theme="dark"] .sph-crm-detail-card h4,
.sph-crm-shell[data-theme="dark"] .sph-crm-detail-card h5,
.sph-crm-shell[data-theme="dark"] .sph-crm-guard-card h2,
.sph-crm-shell[data-theme="dark"] .sph-crm-table td,
.sph-crm-shell[data-theme="dark"] .sph-crm-form label,
.sph-crm-shell[data-theme="dark"] .sph-crm-list-clean li strong,
.sph-crm-shell[data-theme="dark"] .sph-crm-radar-item strong,
.sph-crm-shell[data-theme="dark"] .sph-crm-user-meta span,
.sph-crm-shell[data-theme="dark"] .sph-crm-notification-item strong {
  color: #f3f1ec !important;
}

.sph-crm-shell[data-theme="dark"] .sph-crm-table th,
.sph-crm-shell[data-theme="dark"] .sph-crm-breadcrumbs strong,
.sph-crm-shell[data-theme="dark"] .sph-crm-feed-time,
.sph-crm-shell[data-theme="dark"] .sph-crm-notification-head strong {
  color: #e6d7b0 !important;
}

.sph-crm-shell[data-theme="dark"] .sph-crm-module-card p,
.sph-crm-shell[data-theme="dark"] .sph-crm-section-head p,
.sph-crm-shell[data-theme="dark"] .sph-crm-kv,
.sph-crm-shell[data-theme="dark"] .sph-crm-cell-sub,
.sph-crm-shell[data-theme="dark"] .sph-crm-timeline-meta,
.sph-crm-shell[data-theme="dark"] .sph-crm-timeline-values,
.sph-crm-shell[data-theme="dark"] .sph-crm-notification-item span,
.sph-crm-shell[data-theme="dark"] .sph-crm-guard-card p {
  color: #c9c4b8 !important;
}

@media (max-width: 920px) {
  .sph-crm-inline-form {
    grid-template-columns: 1fr;
  }
}

.sph-crm-row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sph-crm-inline-form-compact {
  grid-template-columns: 1fr auto;
}

@media (max-width: 920px) {
  .sph-crm-inline-form-compact {
    grid-template-columns: 1fr;
  }
}


.sph-crm-embed-section {
  overflow: hidden;
}

.sph-crm-embed-toolbar {
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
  margin-bottom:14px;
}

.sph-crm-embed-wrap {
  border:1px solid var(--sph-crm-border);
  border-radius:18px;
  overflow:hidden;
  background:#fff;
  min-height:900px;
}

.sph-crm-embed-frame {
  display:block;
  width:100%;
  min-height:900px;
  border:0;
  background:#fff;
}

.sph-crm-shell[data-theme="dark"] .sph-crm-embed-wrap {
  background:#0f1215;
  border-color: var(--sph-crm-border);
}

.sph-crm-shell[data-theme="dark"] .sph-crm-embed-frame {
  background:#0f1215;
}

.sph-crm-shell[data-theme="dark"] .sph-crm-module-card strong,
.sph-crm-shell[data-theme="dark"] .sph-crm-module-footer,
.sph-crm-shell[data-theme="dark"] .sph-crm-detail-box,
.sph-crm-shell[data-theme="dark"] .sph-crm-placeholder h4,
.sph-crm-shell[data-theme="dark"] .sph-crm-empty-state,
.sph-crm-shell[data-theme="dark"] .sph-crm-search-item strong,
.sph-crm-shell[data-theme="dark"] .sph-crm-search-item-main strong,
.sph-crm-shell[data-theme="dark"] .sph-crm-feed-body strong,
.sph-crm-shell[data-theme="dark"] .sph-crm-topbar,
.sph-crm-shell[data-theme="dark"] .sph-crm-subnav-item,
.sph-crm-shell[data-theme="dark"] .sph-crm-role-badge {
  color: #f3f1ec !important;
}

.sph-crm-shell[data-theme="dark"] .sph-crm-search-item,
.sph-crm-shell[data-theme="dark"] .sph-crm-search-results,
.sph-crm-shell[data-theme="dark"] .sph-crm-notification-panel,
.sph-crm-shell[data-theme="dark"] .sph-crm-subnav-item,
.sph-crm-shell[data-theme="dark"] .sph-crm-role-badge {
  background: var(--sph-crm-surface-2);
  border-color: var(--sph-crm-border);
}

.sph-crm-shell[data-theme="dark"] .sph-crm-subnav-item.is-active,
.sph-crm-shell[data-theme="dark"] .sph-crm-subnav-item:hover {
  background:#f3f1ec;
  color:#111315 !important;
}

@media (max-width: 920px) {
  .sph-crm-embed-wrap,
  .sph-crm-embed-frame {
    min-height: 78vh;
  }
}

.sph-crm-finance-toolbar {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.sph-crm-finance-toolbar-copy h4 {
  margin: 0 0 6px;
  color: var(--sph-crm-text);
  font-size: 22px;
}

.sph-crm-finance-toolbar-copy p {
  margin: 0;
  color: var(--sph-crm-text-soft);
}

.sph-crm-modal {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: none;
}

.sph-crm-modal.is-open {
  display: block;
}

.sph-crm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10,10,10,.58);
  backdrop-filter: blur(4px);
}

.sph-crm-modal-dialog {
  position: relative;
  width: min(92vw, 760px);
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  background: var(--sph-crm-surface);
  color: var(--sph-crm-text);
  border: 1px solid var(--sph-crm-border);
  border-radius: 24px;
  box-shadow: var(--sph-crm-shadow);
  overflow: hidden;
}

.sph-crm-modal-dialog-lg {
  width: min(94vw, 980px);
}

.sph-crm-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--sph-crm-border);
  background: var(--sph-crm-surface-2);
}

.sph-crm-modal-header h4 {
  margin: 10px 0 6px;
  color: var(--sph-crm-text);
  font-size: 28px;
  line-height: 1.08;
}

.sph-crm-modal-header p {
  margin: 0;
  color: var(--sph-crm-text-soft);
}

.sph-crm-modal-close {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  text-decoration: none;
  background: var(--sph-crm-surface);
  border: 1px solid var(--sph-crm-border);
  color: var(--sph-crm-text);
  font-size: 28px;
  line-height: 1;
  flex: 0 0 auto;
}

.sph-crm-modal-body {
  padding: 24px;
  max-height: calc(100vh - 180px);
  overflow: auto;
}

.sph-crm-shell[data-theme="dark"] .sph-crm-modal-header h4,
.sph-crm-shell[data-theme="dark"] .sph-crm-finance-toolbar-copy h4,
.sph-crm-shell[data-theme="dark"] .sph-crm-modal-close,
.sph-crm-shell[data-theme="dark"] .sph-crm-modal-header p {
  color: var(--sph-crm-text) !important;
}

@media (max-width: 920px) {
  .sph-crm-finance-toolbar {
    align-items: stretch;
  }

  .sph-crm-modal-dialog,
  .sph-crm-modal-dialog-lg {
    width: min(96vw, 96vw);
    margin: 12px auto;
    border-radius: 18px;
    max-height: calc(100vh - 24px);
  }

  .sph-crm-modal-header {
    padding: 18px 18px 14px;
  }

  .sph-crm-modal-header h4 {
    font-size: 24px;
  }

  .sph-crm-modal-body {
    padding: 18px;
    max-height: calc(100vh - 150px);
  }
}


.sph-crm-form-block-media{margin-top:8px}
.sph-crm-media-preview{display:flex;flex-direction:column;gap:10px;margin:0 0 12px}
.sph-crm-media-preview img{display:block;width:100%;max-width:320px;height:auto;border-radius:16px;border:1px solid rgba(200,162,76,.18);box-shadow:0 10px 25px rgba(15,15,15,.08);background:#111}
.sph-crm-checkbox-inline{display:inline-flex;gap:8px;align-items:center;font-size:14px;color:#5f5a50}
.sph-crm-field-help{margin:8px 0 0;font-size:13px;color:#7b756a;line-height:1.5}
body.sph-crm-dark .sph-crm-checkbox-inline{color:#e7e2d7}
body.sph-crm-dark .sph-crm-field-help{color:#c9c4b8}

.sph-crm-newsletters-listing-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin: 6px 0 14px;
}

.sph-crm-newsletters-listing-head h4 {
  margin: 0 0 4px;
  color: var(--sph-crm-text);
}

.sph-crm-newsletters-listing-head p {
  margin: 0;
  color: var(--sph-crm-text-soft);
}

.sph-crm-table-newsletters th:first-child,
.sph-crm-table-newsletters td:first-child {
  min-width: 320px;
}

.sph-crm-newsletter-title-cell {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  align-items: center;
}

.sph-crm-newsletter-thumb {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--sph-crm-border);
  background: linear-gradient(135deg, color-mix(in srgb, var(--sph-crm-accent) 24%, var(--sph-crm-surface-2)), var(--sph-crm-surface-2));
  display: grid;
  place-items: center;
}

.sph-crm-newsletter-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sph-crm-newsletter-thumb.is-empty span {
  font-size: 24px;
  font-weight: 900;
  color: var(--sph-crm-text);
}

.sph-crm-newsletter-main strong {
  display: block;
  margin-bottom: 4px;
}

.sph-crm-newsletter-meta-block {
  display: flex;
  align-items: center;
}

.sph-crm-chip-soft {
  background: var(--sph-crm-surface-2);
  color: var(--sph-crm-text-soft);
  border: 1px solid var(--sph-crm-border);
}

.sph-crm-newsletter-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sph-crm-newsletter-author-badge {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 900;
  flex: 0 0 36px;
}

.sph-crm-newsletter-status.status-publish {
  background: color-mix(in srgb, #4ea76b 24%, var(--sph-crm-surface-2));
  color: #2d6f43;
}

.sph-crm-newsletter-status.status-draft {
  background: color-mix(in srgb, #d7a94a 24%, var(--sph-crm-surface-2));
  color: #8a6112;
}

.sph-crm-newsletter-status.status-pending {
  background: color-mix(in srgb, #7aa8d8 24%, var(--sph-crm-surface-2));
  color: #285f93;
}

.sph-crm-newsletter-time {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--sph-crm-surface-2);
  border: 1px solid var(--sph-crm-border);
  color: var(--sph-crm-text-soft);
  font-weight: 700;
}

.sph-crm-btn-sm {
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
}

.sph-crm-table-newsletters tbody tr {
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.sph-crm-table-newsletters tbody tr:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(16,16,16,.05);
}

.sph-crm-shell[data-theme="dark"] .sph-crm-newsletters-listing-head h4,
.sph-crm-shell[data-theme="dark"] .sph-crm-newsletter-main strong,
.sph-crm-shell[data-theme="dark"] .sph-crm-newsletter-author strong,
.sph-crm-shell[data-theme="dark"] .sph-crm-newsletter-thumb.is-empty span {
  color: #f3f1ec !important;
}

.sph-crm-shell[data-theme="dark"] .sph-crm-chip-soft,
.sph-crm-shell[data-theme="dark"] .sph-crm-newsletter-time {
  color: #c9c4b8;
}

.sph-crm-shell[data-theme="dark"] .sph-crm-newsletter-author-badge {
  background: var(--sph-crm-accent);
  color: #111;
}

.sph-crm-shell[data-theme="dark"] .sph-crm-newsletter-status.status-publish {
  color: #b8ebc7;
}

.sph-crm-shell[data-theme="dark"] .sph-crm-newsletter-status.status-draft {
  color: #f3dda4;
}

.sph-crm-shell[data-theme="dark"] .sph-crm-newsletter-status.status-pending {
  color: #c9e2ff;
}

@media (max-width: 920px) {
  .sph-crm-newsletters-listing-head {
    align-items: stretch;
    flex-direction: column;
  }

  .sph-crm-table-newsletters td[data-label="Newsletter"] {
    padding-top: 0;
  }

  .sph-crm-newsletter-title-cell {
    grid-template-columns: 56px 1fr;
    gap: 12px;
  }

  .sph-crm-newsletter-thumb {
    width: 56px;
    height: 56px;
    border-radius: 14px;
  }

  .sph-crm-newsletter-author {
    align-items: flex-start;
  }
}


.sph-crm-table-premium tbody tr { transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.sph-crm-table-premium tbody tr:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(16,16,16,.05); }
.sph-crm-entity-title-cell { display:grid; grid-template-columns:56px 1fr; gap:14px; align-items:center; }
.sph-crm-entity-avatar { width:56px; height:56px; border-radius:16px; display:grid; place-items:center; font-weight:900; font-size:20px; color:var(--sph-crm-text); background:linear-gradient(135deg, color-mix(in srgb, var(--sph-crm-accent) 26%, var(--sph-crm-surface-2)), var(--sph-crm-surface-2)); border:1px solid var(--sph-crm-border); }
.sph-crm-entity-main strong { display:block; margin-bottom:4px; color:var(--sph-crm-text); }
.sph-crm-entity-stack { display:flex; flex-direction:column; gap:4px; }
.sph-crm-entity-stack strong { color:var(--sph-crm-text); }
.sph-crm-entity-stack span, .sph-crm-entity-stack small { color:var(--sph-crm-text-soft); }
.sph-crm-entity-tags { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.sph-crm-status-badge.status-activo, .sph-crm-status-badge.status-pagado, .sph-crm-status-badge.status-aprobado, .sph-crm-status-badge.status-aprobada, .sph-crm-status-badge.status-alta { background:color-mix(in srgb, #4ea76b 24%, var(--sph-crm-surface-2)); color:#2d6f43; }
.sph-crm-status-badge.status-inactivo, .sph-crm-status-badge.status-rechazado, .sph-crm-status-badge.status-bloqueado, .sph-crm-status-badge.status-vencido { background:color-mix(in srgb, #cf6b6b 22%, var(--sph-crm-surface-2)); color:#8d2b2b; }
.sph-crm-status-badge.status-pendiente, .sph-crm-status-badge.status-borrador, .sph-crm-status-badge.status-media, .sph-crm-status-badge.status-por_pagar { background:color-mix(in srgb, #d7a94a 24%, var(--sph-crm-surface-2)); color:#8a6112; }
.sph-crm-status-badge.status-baja { background:color-mix(in srgb, #7aa8d8 24%, var(--sph-crm-surface-2)); color:#285f93; }
.sph-crm-shell[data-theme="dark"] .sph-crm-entity-main strong,
.sph-crm-shell[data-theme="dark"] .sph-crm-entity-stack strong,
.sph-crm-shell[data-theme="dark"] .sph-crm-entity-avatar { color:#f3f1ec !important; }
.sph-crm-shell[data-theme="dark"] .sph-crm-status-badge.status-activo,
.sph-crm-shell[data-theme="dark"] .sph-crm-status-badge.status-pagado,
.sph-crm-shell[data-theme="dark"] .sph-crm-status-badge.status-aprobado,
.sph-crm-shell[data-theme="dark"] .sph-crm-status-badge.status-aprobada,
.sph-crm-shell[data-theme="dark"] .sph-crm-status-badge.status-alta { color:#b8ebc7; }
.sph-crm-shell[data-theme="dark"] .sph-crm-status-badge.status-inactivo,
.sph-crm-shell[data-theme="dark"] .sph-crm-status-badge.status-rechazado,
.sph-crm-shell[data-theme="dark"] .sph-crm-status-badge.status-bloqueado,
.sph-crm-shell[data-theme="dark"] .sph-crm-status-badge.status-vencido { color:#ffc7c7; }
.sph-crm-shell[data-theme="dark"] .sph-crm-status-badge.status-pendiente,
.sph-crm-shell[data-theme="dark"] .sph-crm-status-badge.status-borrador,
.sph-crm-shell[data-theme="dark"] .sph-crm-status-badge.status-media,
.sph-crm-shell[data-theme="dark"] .sph-crm-status-badge.status-por_pagar { color:#f3dda4; }
.sph-crm-shell[data-theme="dark"] .sph-crm-status-badge.status-baja { color:#c9e2ff; }
@media (max-width:920px){ .sph-crm-entity-title-cell { grid-template-columns:48px 1fr; gap:12px; } .sph-crm-entity-avatar { width:48px; height:48px; border-radius:14px; font-size:18px; } }


.sph-crm-embed-wrap.is-fallback::before {
  content: 'El módulo embebido no pudo cargarse correctamente dentro del portal. Usa “Abrir en nueva pestaña” y verifica permisos del rol si persiste.';
  display: block;
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(188, 64, 64, 0.12);
  border: 1px solid rgba(188, 64, 64, 0.28);
  color: var(--sph-crm-text, #f5efe2);
  font-size: 13px;
  line-height: 1.5;
}

.sph-crm-modal-dialog-xl { width:min(1180px, calc(100vw - 40px)); }
@media (max-width:920px){ .sph-crm-modal-dialog-xl { width:min(96vw, calc(100vw - 20px)); } }
