:root {
  --bg: #f1f3f9;
  --panel: #ffffff;
  --line: #dde3f1;
  --text: #2f3557;
  --muted: #7b85a9;
  --brand-a: #1f2ec5;
  --brand-b: #5d59f4;
  --brand-soft: #e8ebff;
  --ok-bg: #e8f7ee;
  --ok-text: #178648;
  --warn-bg: #fff3e5;
  --warn-text: #b66f21;
  --danger-bg: #ffe9e9;
  --danger-text: #bf3e3e;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  line-height: 1.4;
  font-weight: 400;
}

a {
  color: #335dd6;
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 290px 1fr;
  min-height: 100vh;
}

.sidebar-shell {
  background: linear-gradient(180deg, #18235b, #131c49 42%, #10173d);
  color: #eef1ff;
  padding: 26px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: .2px;
  color: #ffffff;
}

.platform-brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
  padding: 4px;
}

.brand-side {
  margin-bottom: 4px;
}

.sidebar-caption {
  margin: 0 0 20px;
  color: #b9c2ee;
  font-size: .9rem;
}

.side-section-title {
  margin: 16px 0 8px;
  color: #95a3dd;
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  color: #d6ddff;
  border: 1px solid transparent;
  font-weight: 500;
}

.side-link:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.side-link.active {
  background: linear-gradient(135deg, var(--brand-b), var(--brand-a));
  color: #fff;
  box-shadow: 0 10px 24px rgba(35, 46, 146, .35);
}

.nav-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  color: currentColor;
  opacity: .92;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.nav-label {
  line-height: 1;
}

.health-link {
  display: inline-block;
  margin-top: 20px;
  font-size: .84rem;
  color: #9fc1ff;
}

.workspace-shell {
  min-width: 0;
}

.workspace-top {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.workspace-top-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 26px;
}

.workspace-top h1 {
  margin: 0;
  font-size: 2rem;
  line-height: .95;
  color: #30375e;
  font-weight: 600;
}

.workspace-top p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .95rem;
}

.muted {
  color: var(--muted);
  font-size: .92rem;
}

.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.top-notification {
  appearance: none;
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid #d9e0f4;
  background: #f7f9ff;
  color: #485488;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: .15s ease;
  cursor: pointer;
}

.top-notification-wrap {
  position: relative;
}

.top-notification:hover {
  border-color: #b9c7f3;
  background: #edf2ff;
}

.top-notification.has-new {
  border-color: #c6d6ff;
  background: linear-gradient(180deg, #edf3ff, #f8fbff);
}

.top-notification-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
}

.top-notification-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.top-notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  padding: 0 5px;
  background: #cf2f45;
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border: 2px solid #fff;
}

.top-notification-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(360px, 88vw);
  border-radius: 12px;
  border: 1px solid #d8deef;
  background: #fff;
  box-shadow: 0 16px 30px rgba(17, 29, 76, .18);
  overflow: hidden;
  z-index: 80;
}

.top-notification-menu-head {
  padding: 12px 14px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.top-notification-menu-head h3 {
  margin: 0;
  font-size: .96rem;
  color: #2d3968;
}

.top-notification-unread {
  font-size: .72rem;
  border-radius: 999px;
  padding: 3px 8px;
  background: #d91f3a;
  color: #fff;
  font-weight: 700;
}

.top-notification-pills {
  padding: 0 14px 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.notif-pill {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: .73rem;
  font-weight: 700;
}

.notif-pill.pending {
  background: #f4b400;
  color: #233048;
}

.notif-pill.approved {
  background: #16a35d;
  color: #fff;
}

.notif-pill.rejected {
  background: #6c22bf;
  color: #fff;
}

.top-notification-list {
  max-height: 250px;
  overflow: auto;
  border-top: 1px solid #edf1fb;
  border-bottom: 1px solid #edf1fb;
}

.top-notification-empty {
  margin: 0;
  padding: 12px 14px;
  color: #7a84a7;
}

.top-notification-item {
  display: block;
  padding: 10px 14px;
  color: #2f3a67;
  border-top: 1px solid #f0f3fb;
}

.top-notification-item:first-child {
  border-top: 0;
}

.top-notification-item.unread {
  background: #f5f8ff;
}

.top-notification-item-status {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: .66rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.top-notification-item-status.pending {
  background: #fde7af;
  color: #6c4e00;
}

.top-notification-item-status.approved {
  background: #d8f4e5;
  color: #0c7340;
}

.top-notification-item-status.rejected,
.top-notification-item-status.expired {
  background: #f0dffd;
  color: #5c228d;
}

.top-notification-item strong {
  display: block;
  font-size: .86rem;
}

.top-notification-item small {
  display: block;
  margin-top: 2px;
  color: #69759f;
  font-size: .75rem;
}

.top-notification-actions {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-notification-actions a,
.top-notification-actions button {
  text-align: left;
  border: 0;
  background: transparent;
  color: #2f3d73;
  font-size: .9rem;
  padding: 0;
  cursor: pointer;
}

.workspace-main {
  padding: 18px 24px 28px;
}

.flash {
  margin-bottom: 12px;
  border: 1px solid;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: .92rem;
}

.flash.success {
  border-color: #bde2cb;
  background: #edf9f2;
  color: #146d3b;
}

.flash.error {
  border-color: #efc0c0;
  background: #fff0f0;
  color: #8f2a2a;
}

.hero,
.section-banner {
  border-radius: 14px;
  background: linear-gradient(135deg, #5b57ef, #423cd0);
  color: #fff;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: 0 14px 28px rgba(66, 60, 208, .25);
}

.section-banner-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 600;
}

.section-banner-text {
  margin: 6px 0 0;
  color: #e3e6ff;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
}

.card-subtle {
  background: #f9fbff;
}

.card.narrow {
  max-width: 860px;
}

.card h1,
.card h2,
.card h3 {
  margin: 0 0 10px;
  color: #323a60;
  font-weight: 600;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

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

.module-card {
  border: 1px solid var(--line);
  background: #fbfcff;
  border-radius: 12px;
  padding: 12px;
}

.module-card p {
  color: #67739b;
  margin: 0 0 10px;
}

.title-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ui-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  color: #4f5ed4;
}

.ui-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

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

.kpi-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.kpi-card span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #8a94b5;
  font-size: .76rem;
  font-weight: 600;
  text-transform: uppercase;
}

.kpi-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.55rem;
  line-height: 1;
  color: #30375d;
  font-weight: 600;
}

.kpi-card small {
  color: #8a93af;
}

.kpi-grid-compact .kpi-card {
  padding: 10px 11px;
}

.kpi-grid-compact .kpi-card strong {
  font-size: 1.28rem;
}

.kpi-grid-compact .kpi-card span {
  font-size: .68rem;
}

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

.school-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.school-cover {
  height: 88px;
  background: linear-gradient(130deg, #2f63d8, #4a52ce 58%, #5d43c6);
}

.school-card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  margin-top: -40px;
  padding: 0 12px 6px;
}

.school-avatar {
  width: 78px;
  height: 78px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 600;
  border: 3px solid #fff;
  background: #2f3aaf;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(39, 57, 130, .24);
  font-size: 1.15rem;
}

.school-avatar.has-logo {
  background: linear-gradient(180deg, #ffffff, #f6f9ff);
  color: transparent;
}

.school-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  padding: 1px;
}

.school-card-head > div {
  background: linear-gradient(180deg, #ffffff, #f6f9ff);
  border: 1px solid #dbe4f7;
  border-radius: 12px;
  padding: 9px 12px;
  box-shadow: 0 10px 24px rgba(38, 55, 126, .14);
}

.school-card-head h3 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.1;
}

.school-card-head h3 a {
  color: #1f2a57;
  font-weight: 700;
  text-decoration: none;
}

.school-card-head h3 a:hover {
  color: #214db5;
}

.school-card-head p {
  margin: 3px 0 0;
  color: #61709b;
  font-size: .84rem;
}

.school-card-head .badge {
  justify-self: end;
  align-self: start;
  margin-top: 4px;
}

.school-meta {
  margin: 10px 12px;
  padding: 8px 0;
  border-top: 1px dashed #d7dced;
  border-bottom: 1px dashed #d7dced;
}

.school-meta p {
  margin: 4px 0;
  font-size: .9rem;
}

.school-actions {
  padding: 0 12px 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.school-checklist {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #5d678f;
  display: grid;
  gap: 4px;
  font-size: .85rem;
}

.school-checklist span::before {
  content: "• ";
  color: #4f5ed4;
  font-weight: 700;
}

.list {
  margin: 0;
  padding-left: 18px;
}

.list li {
  margin: 4px 0;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
  background: #edf0fd;
  color: #4c58b9;
}

.badge .badge-icon {
  display: inline-flex;
  width: 12px;
  height: 12px;
  margin-right: 5px;
  vertical-align: -2px;
}

.badge .badge-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.badge-role-type-system {
  background: #e9eefb;
  color: #2f54a7;
}

.badge-role-type-custom {
  background: #eceff4;
  color: #5a667f;
}

.badge-role-protected {
  background: #fff3d8;
  color: #9d6409;
}

.badge-role-status-active {
  background: #e7f7ee;
  color: #157a46;
}

.badge-role-status-inactive {
  background: #f3ecff;
  color: #6b1fc8;
}

.badge-user-role {
  background: #edf2ff;
  color: #3249a5;
}

.badge-user-role-superadmin {
  background: #fff3d8;
  color: #9d6409;
}

.badge-user-role-billing_admin {
  background: #e8efff;
  color: #2f58b9;
}

.badge-user-role-ops_admin {
  background: #e6f4ff;
  color: #0f6b9b;
}

.badge-user-role-support_admin {
  background: #e9f9f1;
  color: #157a46;
}

.badge-user-status-active {
  background: #e7f7ee;
  color: #157a46;
}

.badge-user-status-inactive {
  background: #f3ecff;
  color: #6b1fc8;
}

.status-draft { background: #edf1f7; color: #62708e; }
.status-trial { background: #e8efff; color: #3460c5; }
.status-active { background: var(--ok-bg); color: var(--ok-text); }
.status-suspended { background: var(--warn-bg); color: var(--warn-text); }
.status-cancelled,
.status-archived { background: var(--danger-bg); color: var(--danger-text); }

.check {
  color: #1d7f46;
  font-weight: 600;
}

.muted-danger {
  color: #b84343;
}

.inline-form,
.inline-filters {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.inline-form input,
.inline-form select {
  width: auto;
  min-width: 120px;
  flex: 1 1 140px;
}

.inline-form-status select {
  min-width: 106px;
  flex: 1 1 110px;
}

.inline-form-status .btn {
  padding: 8px 10px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 12px;
  margin: 10px 0 12px;
}

.inline-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.inline-form-inline {
  display: inline-flex;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 25, 46, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1200;
}

.modal-card {
  width: 100%;
  max-width: 560px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 28px 58px rgba(20, 26, 50, .35);
  padding: 14px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

body.modal-open {
  overflow: hidden;
}

.js-modal[hidden] {
  display: none !important;
}

.js-modal:not([hidden]) {
  display: flex !important;
}

.roles-matrix th,
.roles-matrix td {
  text-align: center;
  vertical-align: middle;
}

.roles-matrix th {
  white-space: nowrap;
}

.roles-matrix th:first-child,
.roles-matrix td:first-child {
  text-align: left;
}

.role-modal-card {
  max-width: 1020px;
}

.roles-matrix-toolbar {
  margin: 8px 0 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f9ff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.roles-template-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.roles-group-row td {
  background: #f0f3fb;
  color: #2f3760;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-size: .74rem;
}

.roles-module-row td:first-child strong {
  display: inline-block;
  margin-bottom: 2px;
}

.roles-module-code {
  color: #7c84a3;
}

.roles-matrix input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.roles-matrix .perm-master {
  width: 16px;
  height: 16px;
  margin-left: 5px;
  vertical-align: middle;
}

.roles-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 8px;
}

.roles-filters-actions {
  display: inline-flex;
  gap: 8px;
}

.roles-pagination {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.users-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px 220px auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 8px;
}

.users-filters-actions {
  display: inline-flex;
  gap: 8px;
}

.users-pagination {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mail-template-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.mail-template-form {
  min-width: 0;
  order: 1;
}

.mail-template-code-label {
  display: block;
}

.mail-template-code-help {
  display: block;
  margin: 4px 0 8px;
  font-size: .8rem;
  color: #6f7aa2;
  font-weight: 500;
}

.mail-template-code-panel {
  background: #0f131a;
  border: 1px solid #2a313f;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.mail-template-code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid #232a37;
  background: linear-gradient(180deg, #161b24 0%, #121720 100%);
}

.mail-template-code-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f0f4ff;
  font-size: .95rem;
}

.mail-template-code-glyph {
  color: #8ca7ff;
  font-weight: 700;
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .8rem;
}

.mail-template-code-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mail-template-code-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #c3cbe2;
  background: #1a2130;
  border: 1px solid #2f3748;
}

.mail-template-code-action svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.mail-template-code-input {
  min-height: 370px;
  margin-top: 0;
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .86rem;
  line-height: 1.6;
  color: #edf2ff;
  background: #101520;
  border: 0;
  border-radius: 0;
  padding: 14px 14px 15px;
  tab-size: 2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  resize: vertical;
  box-shadow: none;
}

.mail-template-code-input:focus {
  border: 0;
  background: #0f1522;
  box-shadow: inset 0 0 0 1px #4d6fff;
  outline: none;
}

.mail-template-vars-collapsible {
  margin: 10px 0 12px;
  border: 1px solid #d7def2;
  border-radius: 12px;
  background: #f9fbff;
}

.mail-template-vars-collapsible > summary {
  list-style: none;
  cursor: pointer;
  padding: 11px 12px;
  font-weight: 700;
  color: #283561;
  position: relative;
}

.mail-template-vars-collapsible > summary::-webkit-details-marker {
  display: none;
}

.mail-template-vars-collapsible > summary::after {
  content: "+";
  position: absolute;
  right: 12px;
  top: 8px;
  font-size: 1.2rem;
  color: #4d5fa8;
}

.mail-template-vars-collapsible[open] > summary::after {
  content: "-";
}

.mail-template-vars-grid {
  border-top: 1px solid #dfe5f6;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mail-template-var-item {
  border: 1px solid #dbe3f7;
  border-radius: 10px;
  background: #fff;
  padding: 9px 10px;
}

.mail-template-var-item code {
  font-size: .8rem;
}

.mail-template-var-item p {
  margin: 7px 0 9px;
  color: #5d6993;
  font-size: .8rem;
}

.widget-embed-collapsible {
  border: 1px solid #d7def2;
  border-radius: 12px;
  background: #f9fbff;
}

.widget-embed-collapsible > summary {
  list-style: none;
  cursor: pointer;
  padding: 11px 12px;
  font-weight: 700;
  color: #283561;
  position: relative;
}

.widget-embed-collapsible > summary::-webkit-details-marker {
  display: none;
}

.widget-embed-collapsible > summary::after {
  content: "+";
  position: absolute;
  right: 12px;
  top: 8px;
  font-size: 1.2rem;
  color: #4d5fa8;
}

.widget-embed-collapsible[open] > summary::after {
  content: "-";
}

.widget-copy-code {
  width: 100%;
  border: 1px dashed #c9d5f5;
  background: #fff;
  border-radius: 10px;
  padding: 10px 11px;
  text-align: left;
  cursor: pointer;
  transition: .12s ease;
}

.widget-copy-code:hover {
  border-color: #9eb0ec;
  background: #f8faff;
}

.widget-copy-code.copied {
  border-color: #39a46a;
  background: #eefaf3;
}

.widget-copy-code code {
  display: block;
  background: transparent;
  padding: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #2f3d6f;
}

.copy-sticker {
  position: fixed;
  z-index: 1200;
  pointer-events: none;
  transform: translate(-50%, 8px) scale(.96);
  opacity: 0;
  background: #182952;
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 10px 20px rgba(19, 32, 73, .28);
  transition: transform .14s ease, opacity .14s ease;
}

.copy-sticker.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.mail-template-preview {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8faff;
  padding: 12px;
  position: sticky;
  top: 80px;
  order: 2;
}

.mail-template-preview h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.mail-preview-title {
  margin: 8px 0 6px;
  font-size: .8rem;
  color: #6e7899;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-weight: 700;
}

.mail-preview-subject {
  background: #fff;
  border: 1px dashed #c8d2f3;
  border-radius: 10px;
  padding: 9px 10px;
  color: #2f3659;
  font-weight: 600;
}

.mail-preview-frame {
  width: 100%;
  height: 620px;
  border: 1px solid #d6def3;
  border-radius: 10px;
  background: #fff;
}

.mail-preview-text {
  margin: 0;
  background: #fff;
  border: 1px solid #d6def3;
  border-radius: 10px;
  padding: 9px 10px;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  color: #3a4367;
  font-size: .83rem;
}

.table-sticky-wrap {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  max-height: 62vh;
}

.table-sticky-wrap table {
  margin: 0;
  min-width: 760px;
}

.users-table thead th,
.roles-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f7f9ff;
}

.users-table th:last-child,
.users-table td:last-child,
.roles-table th:last-child,
.roles-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: #fff;
  box-shadow: -6px 0 8px -8px rgba(19, 28, 58, .45);
}

.users-table thead th:last-child,
.roles-table thead th:last-child {
  z-index: 4;
  background: #f7f9ff;
}

.users-table th:nth-child(1),
.users-table td:nth-child(1) {
  min-width: 260px;
}

.users-table th:nth-child(2),
.users-table td:nth-child(2) {
  min-width: 165px;
}

.users-table th:nth-child(3),
.users-table td:nth-child(3) {
  min-width: 130px;
}

.users-table th:nth-child(4),
.users-table td:nth-child(4) {
  min-width: 140px;
}

.users-table th:last-child,
.users-table td:last-child {
  min-width: 230px;
  white-space: nowrap;
}

.roles-table th:nth-child(1),
.roles-table td:nth-child(1) {
  min-width: 280px;
}

.roles-table th:nth-child(2),
.roles-table td:nth-child(2) {
  min-width: 220px;
}

.roles-table th:nth-child(3),
.roles-table td:nth-child(3) {
  min-width: 140px;
}

.roles-table th:last-child,
.roles-table td:last-child {
  min-width: 220px;
  white-space: nowrap;
}

.users-table td:last-child .inline-actions,
.roles-table td:last-child .inline-actions {
  flex-wrap: nowrap;
}

@media (max-width: 900px) {
  .roles-filters {
    grid-template-columns: 1fr;
  }

  .users-filters {
    grid-template-columns: 1fr;
  }

  .mail-template-editor {
    grid-template-columns: 1fr;
  }

  .mail-template-preview {
    position: static;
    order: 2;
  }

  .mail-template-form {
    order: 1;
  }

  .mail-template-vars-grid {
    grid-template-columns: 1fr;
  }

  .table-sticky-wrap {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .users-table td:last-child .btn-label,
  .roles-table td:last-child .btn-label {
    display: none;
  }

  .users-table td:last-child .btn-icon,
  .roles-table td:last-child .btn-icon {
    margin-right: 0;
  }
}

.pricing-guide .list {
  margin-top: 8px;
}

.pricing-guide li {
  margin-bottom: 6px;
}

.hero-pricing {
  background: linear-gradient(135deg, #5b57ef, #453fd8 60%, #6c5df8);
}

.hero-kicker {
  margin: 0 0 6px;
  color: #dfe3ff;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.pricing-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.pricing-kpi {
  border: 1px solid #d9dff2;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.pricing-kpi p {
  margin: 0;
  color: #7d87ad;
  font-size: .82rem;
}

.pricing-kpi strong {
  display: block;
  font-size: 1.65rem;
  color: #2f3760;
  margin-top: 4px;
}

.pricing-kpi small {
  color: #7a85ab;
}

.pricing-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pricing-toolbar .btn {
  border: 1px solid #d9def0;
}

.btn-top-plan {
  background: linear-gradient(135deg, #3769f5, #2f4dc9);
}

.btn-top-addon {
  background: linear-gradient(135deg, #19b47c, #148f63);
}

.btn-top-help {
  background: linear-gradient(135deg, #f2a12d, #cf7d13);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 58, .5);
  z-index: 999;
  display: none;
  place-items: center;
  padding: 20px;
}

.modal-overlay:target {
  display: grid;
}

.modal-card {
  width: min(760px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border: 1px solid #d9dff2;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 24px 40px rgba(16, 22, 56, .28);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid #d8def1;
  background: #f7f9ff;
  color: #3b4679;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.table-actions {
  white-space: nowrap;
}

label {
  display: block;
  color: #66739d;
  font-weight: 500;
  margin-bottom: 10px;
}

.form-help {
  margin: 0 0 10px;
  color: #7f8aae;
  font-size: .86rem;
}

.owner-summary {
  border: 1px solid #dbe1f2;
  background: #f8faff;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.owner-summary p {
  margin: 0;
  color: #38446f;
  font-size: .9rem;
}

.owner-summary p + p {
  margin-top: 3px;
  color: #5f6b94;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 4px;
  border: 1px solid #d3d9ec;
  background: #fff;
  color: #2f3557;
  border-radius: 10px;
  padding: 10px 11px;
  font-size: .92rem;
}

input[type="color"] {
  height: 44px;
  padding: 4px;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid #d3d9ec;
  background: #fff;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 7px;
}

input[type="color"]::-moz-color-swatch {
  border: 0;
  border-radius: 7px;
}

.color-row {
  display: grid;
  grid-template-columns: 56px 40px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: -6px 0 10px;
}

.color-input {
  width: 56px;
  min-width: 56px;
  padding: 2px;
  height: 36px;
}

.color-chip {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid #d3d9ec;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .5);
}

.color-text {
  margin-top: 0;
  text-transform: uppercase;
  font-size: .84rem;
  letter-spacing: .03em;
  color: #4a567f;
  background: #f5f7ff;
}

.check-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 12px;
  color: #3c4d79;
  font-weight: 500;
}

.check-inline input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #8d99ff;
  box-shadow: 0 0 0 3px rgba(103, 120, 235, .2);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 13px;
  font-size: .88rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand-b), var(--brand-a));
}

.btn-secondary {
  background: var(--brand-soft);
  color: #354086;
}

.btn-danger {
  background: linear-gradient(135deg, #d25555, #b73333);
  color: #fff;
}

.btn-sm {
  padding: 7px 10px;
  font-size: .8rem;
}

.btn-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  margin-right: 6px;
  vertical-align: middle;
}

.btn-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.btn-label {
  vertical-align: middle;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  font-size: .9rem;
}

th {
  background: #f7f9ff;
  color: #7680a4;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-weight: 600;
}

.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-nav a {
  display: inline-block;
  border: 1px solid #d6dcf0;
  border-radius: 10px;
  padding: 8px 10px;
  background: #f7f9ff;
  color: #425083;
  font-weight: 600;
  font-size: .86rem;
}

.tab-nav a.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand-b), var(--brand-a));
}

.brand-logo-preview {
  max-width: 100%;
  max-height: 110px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.brand-identity-card {
  border: 1px solid #d8def0;
  border-radius: 14px;
  background: linear-gradient(145deg, #fbfcff 0%, #f1f4ff 100%);
  padding: 12px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 12px;
}

.brand-identity-preview {
  min-height: 132px;
  border: 1px dashed #bcc7ea;
  border-radius: 12px;
  background:
    linear-gradient(45deg, #edf2ff 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(-45deg, #edf2ff 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(45deg, transparent 75%, #edf2ff 75%) -10px 0/20px 20px,
    linear-gradient(-45deg, transparent 75%, #edf2ff 75%) -10px 0/20px 20px,
    #f8faff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  position: relative;
}

.brand-logo-empty {
  display: none;
  color: #7480aa;
  font-size: .84rem;
  font-weight: 500;
}

.brand-identity-preview.is-empty .brand-logo-empty {
  display: block;
}

.brand-identity-preview.is-empty .brand-logo-preview {
  display: none;
}

.brand-identity-meta .meta-title {
  margin: 0 0 4px;
  color: #35406e;
  font-weight: 600;
  font-size: .9rem;
}

.brand-identity-meta .meta-path {
  margin: 0 0 8px;
  font-size: .82rem;
  color: #6674a4;
  overflow-wrap: anywhere;
}

.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-link {
  display: inline-block;
  border: 1px solid #d8def1;
  border-radius: 10px;
  padding: 8px 10px;
  background: #f8faff;
  color: #3f4a7d;
  font-weight: 600;
  font-size: .84rem;
}

.platform-preview-image {
  width: 220px;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid #d4dbee;
  background: #fff;
  padding: 4px;
}

.platform-preview-favicon {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #d4dbee;
  background: #fff;
  padding: 4px;
}

.auth-page {
  min-height: 100vh;
  background-color: #f5f7ff;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  font-family: "Poppins", "Avenir Next", "Nunito Sans", "Helvetica Neue", sans-serif;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr minmax(360px, 540px);
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  background: transparent;
}

.auth-brand-stage {
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 0;
  box-shadow: 0 16px 34px rgba(50, 64, 120, .12);
}

.auth-brand-logo {
  width: clamp(64px, 10vw, 98px);
  height: clamp(64px, 10vw, 98px);
  object-fit: contain;
  border-radius: 14px;
  background: rgba(255, 255, 255, .14);
  padding: 8px;
  margin-bottom: 14px;
}

.auth-brand-name {
  margin: 0;
  color: #ffffff;
  font-size: clamp(2rem, 4.3vw, 4rem);
  line-height: 1.05;
  letter-spacing: .01em;
  font-weight: 600;
  text-shadow: 0 8px 22px rgba(11, 18, 58, .45);
}

.auth-brand-legal {
  margin: 8px 0 0;
  color: #ffffff;
  font-size: clamp(.95rem, 1.5vw, 1.25rem);
  font-weight: 500;
  text-shadow: 0 6px 18px rgba(11, 18, 58, .35);
}

.auth-brand-platform {
  margin: 8px 0 0;
  color: #ffffff;
  opacity: .96;
  font-size: .88rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 600;
  text-shadow: 0 4px 14px rgba(11, 18, 58, .3);
}

.auth-card {
  width: min(520px, 96vw);
  background: #ffffff;
  border: 1px solid #dbe3f5;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 20px 42px rgba(20, 26, 73, .28);
}

.auth-card h1 {
  margin: 0 0 8px;
  color: #2d3560;
  font-weight: 600;
  font-size: 2rem;
}

.auth-card h1.auth-title-sm {
  font-size: 1.5rem;
  line-height: 1.2;
}

.auth-card .form-help {
  margin-bottom: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #dde5f8;
  background: linear-gradient(180deg, #f9fbff 0%, #f2f6ff 100%);
  color: #5a6794;
  font-size: .88rem;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 12px;
  color: #5d6a94;
  font-size: .9rem;
}

.inline-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.auth-card form {
  margin: 0;
  border: 1px solid #d9e2f6;
  border-radius: 14px;
  background: linear-gradient(180deg, #fdfefe 0%, #f6f8ff 100%);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-card form label:not(.inline-check):not(.check-inline) {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #5c688f;
  font-weight: 600;
  font-size: .78rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.auth-card form input[type="text"],
.auth-card form input[type="email"],
.auth-card form input[type="password"],
.auth-card form input[type="number"],
.auth-card form select,
.auth-card form textarea {
  margin: 0;
  min-height: 44px;
  border-radius: 11px;
  border-color: #cfd9f3;
  background: #fff;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .65);
}

.auth-card form textarea {
  min-height: 120px;
}

.auth-card form input:focus,
.auth-card form select:focus,
.auth-card form textarea:focus {
  border-color: #8393e6;
  box-shadow: 0 0 0 3px rgba(98, 118, 226, .2);
}

.auth-card form .btn {
  width: 100%;
  min-height: 44px;
  justify-content: center;
  border-radius: 11px;
  font-size: .92rem;
}

.auth-card form .auth-links {
  margin-top: 2px;
}

.auth-links {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.auth-links a {
  color: #5a66bf;
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
}

.auth-links a:hover {
  color: #4053b9;
  text-decoration: underline;
}

.auth-links.auth-links-stacked {
  justify-content: flex-start;
  gap: 16px;
}

.auth-aux-panel {
  margin-top: 16px;
  border-top: 1px dashed #d6ddf2;
  padding-top: 14px;
}

.auth-aux-title {
  margin: 0 0 10px;
  color: #64729b;
  font-size: .85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.auth-aux-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-aux-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 74px;
  border: 1px solid #d9e1f8;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfcff 0%, #f3f6ff 100%);
  padding: 10px 12px;
  color: #334177;
  text-decoration: none;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.auth-aux-link:hover {
  border-color: #b8c8f5;
  box-shadow: 0 10px 18px rgba(27, 44, 119, .12);
  transform: translateY(-1px);
}

.auth-aux-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e8eeff;
  color: #4760ce;
  flex-shrink: 0;
}

.auth-aux-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.auth-aux-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.auth-aux-content strong {
  font-size: .93rem;
  line-height: 1.2;
  color: #2f3a6c;
}

.auth-aux-content small {
  color: #6a789f;
  font-size: .79rem;
  line-height: 1.3;
}

.widget-success-panel {
  border: 1px solid #d9e3fb;
  border-radius: 16px;
  background: linear-gradient(165deg, #fcfdff 0%, #f3f7ff 100%);
  padding: 18px 16px;
  text-align: center;
}

.widget-success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e8f7ef;
  color: #0f9a5c;
  border: 1px solid #bae9ce;
}

.widget-success-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.widget-success-logo {
  width: 86px;
  height: 86px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #d8e1f6;
  padding: 8px;
  margin: 2px auto 10px;
  display: block;
}

.widget-success-panel h2 {
  margin: 0 0 8px;
  color: #253262;
  font-size: 1.28rem;
}

.widget-success-panel > p {
  margin: 0 auto 12px;
  color: #4f5d89;
  font-size: .92rem;
  line-height: 1.55;
  max-width: 44ch;
}

.widget-success-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 auto 12px;
}

.widget-success-brand strong {
  color: #2d3c75;
  font-size: .95rem;
}

.widget-success-brand span {
  color: #6a769d;
  font-size: .82rem;
}

.widget-success-meta {
  border: 1px solid #dce5fa;
  border-radius: 12px;
  background: #fff;
  padding: 10px 11px;
  text-align: left;
  margin-bottom: 12px;
}

.widget-success-meta p {
  margin: 0;
  color: #364677;
  font-size: .86rem;
}

.widget-success-meta p + p {
  margin-top: 6px;
}

.widget-success-actions {
  display: flex;
  justify-content: center;
}

.invoice-company-block {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #d7deef;
  border-radius: 10px;
  background: #fbfcff;
}

.invoice-company-legal {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  color: #20284f;
}

.invoice-company-display {
  margin: 2px 0 0;
  font-size: .92rem;
  color: #5f6b94;
}

.invoice-company-ruc {
  margin: 2px 0 0;
  font-size: .86rem;
  color: #606b8f;
}

code {
  background: #edf1fb;
  border-radius: 5px;
  padding: 1px 5px;
}

@media (max-width: 1280px) {
  .module-grid,
  .kpi-grid,
  .school-grid,
  .pricing-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar-shell {
    position: static;
    height: auto;
  }

  .workspace-top {
    position: static;
  }

  .workspace-top-inner {
    padding: 14px;
  }

  .workspace-main {
    padding: 12px;
  }

  .grid-two {
    grid-template-columns: 1fr;
  }

  .brand-identity-card {
    grid-template-columns: 1fr;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    justify-content: center;
    gap: 14px;
    padding: 16px;
  }

  .auth-brand-stage {
    min-height: 240px;
    padding: 20px;
  }

  .auth-card {
    width: min(560px, 100%);
    justify-self: center;
  }

  .auth-card form {
    padding: 12px;
  }

  .auth-aux-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .module-grid,
  .kpi-grid,
  .school-grid,
  .pricing-kpi-grid {
    grid-template-columns: 1fr;
  }

  .workspace-top h1 {
    font-size: 1.5rem;
  }
}

@media print {
  html,
  body,
  .app-shell,
  .workspace-shell,
  .workspace-main,
  .card {
    background: #fff !important;
  }

  body {
    color: #111 !important;
  }

  .invoice-company-block {
    background: #fff !important;
    border-color: #ddd !important;
  }
}
