/* Sunground School ERP — UI (no build step needed) */
:root {
  --primary: #4f46e5;
  --primary-600: color-mix(in srgb, var(--primary) 85%, #000);
  --primary-50: color-mix(in srgb, var(--primary) 8%, #fff);
  --bg: #e2e6ed;
  --surface: #fbfbfc;
  --surface-2: #f2f4f7;
  --border: #dde1e8;
  --text: #1e293b;
  --muted: #64748b;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0284c7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
  --sidebar: #000000;
  --sidebar-border: rgba(255, 255, 255, 0.07);
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #f1f5f9;
  --sidebar-label: #64748b;
  --accent: #6366f1;
  --sidebar-w: 228px;
  --sidebar-collapsed-w: 58px;
  --scrollbar-thumb: #cbd5e1;
  --scrollbar-thumb-hover: #94a3b8;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #0f172a;
  --border: #1f2937;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --primary-50: color-mix(in srgb, var(--primary) 18%, #111827);
  --sidebar: #000000;
  --scrollbar-thumb: #334155;
  --scrollbar-thumb-hover: #475569;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px
}

::-webkit-scrollbar-track {
  background: transparent
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
  transition: background .15s ease
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover)
}

::-webkit-scrollbar-corner {
  background: transparent
}

html,
body {
  margin: 0;
  height: 100%
}

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased
}

a {
  color: var(--primary);
  text-decoration: none
}

h1,
h2,
h3 {
  margin: 0 0 .5rem;
  font-weight: 650;
  letter-spacing: -.01em
}

h1 {
  font-size: 1.4rem
}

h2 {
  font-size: 1.1rem
}

h3 {
  font-size: .95rem
}

.muted {
  color: var(--muted)
}

.small {
  font-size: 12px
}

.svg {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round
}

/* Layout */
.app {
  display: flex;
  min-height: 100vh
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform .25s ease, width .2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow .2s ease;
  user-select: none;
}

/* Header / Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  min-height: 56px;
  border-bottom: 1px solid var(--sidebar-border);
  overflow: hidden;
  transition: padding .2s ease;
  box-sizing: border-box;
}

.brand img,
.brand .brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  object-fit: contain;
  background: #fff;
  padding: 2px;
  flex: none;
}

.brand .logo-fallback {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex: none;
}

.brand-text {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.session-text,
.session-badge {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #64748b;
  background: none;
  border: none;
  padding: 0;
  line-height: 1.2;
}

/* Search Box */
.nav-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin: 10px 12px 4px;
  height: 34px;
  background: rgba(255, 255, 255, 0.04);
  border: none;
  border-radius: 4px;
  padding: 0 10px;
  transition: background .15s ease;
}

.nav-search-wrap:focus-within {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  box-shadow: none;
}

.nav-search-icon {
  width: 13px;
  height: 13px;
  color: #64748b;
  flex: none;
  margin-right: 7px;
  pointer-events: none;
}

.nav-search {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: #f1f5f9;
  font-size: 12px;
  font-family: inherit;
  padding: 0;
  margin: 0;
}

.nav-search::placeholder {
  color: #64748b;
}

.nav-search-kbd {
  font-size: 9.5px;
  font-family: inherit;
  font-weight: 600;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: 3px;
  padding: 1px 5px;
  line-height: 1.2;
  flex: none;
  pointer-events: none;
}

/* Navigation Scroll Area */
.nav {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 8px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: padding .2s ease;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.nav:hover {
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.nav::-webkit-scrollbar {
  width: 4px;
}

.nav::-webkit-scrollbar-track {
  background: transparent;
}

.nav::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 3px;
  transition: background .2s ease;
}

.nav:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
}

.nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Section Header */
.nav-section {
  display: flex;
  flex-direction: column;
}

.nav-section-label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sidebar-label);
  padding: 8px 8px 4px 10px;
  user-select: none;
}

.nav-section-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Nav Item (Parent / Solo Link) */
.nav-link,
.nav-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 4px;
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
  outline: none;
}

.nav-summary::-webkit-details-marker {
  display: none;
}

.nav-link:hover,
.nav-summary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--sidebar-text-hover);
}

.nav-link:focus-visible,
.nav-summary:focus-visible {
  outline: 1px solid var(--accent);
}

.nav-icon {
  width: 15px;
  height: 15px;
  flex: none;
  color: #818cf8;
  opacity: 0.8;
  transition: opacity .15s ease, color .15s ease, transform .15s ease;
}

.nav-link:hover .nav-icon,
.nav-summary:hover .nav-icon {
  opacity: 1;
  color: #a5b4fc;
}

.nav-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-summary .chev {
  margin-left: auto;
  width: 12px;
  height: 12px;
  flex: none;
  color: #64748b;
  transition: transform .2s cubic-bezier(0.4, 0, 0.2, 1), color .15s ease;
}

.nav-group[open]>.nav-summary .chev {
  transform: rotate(90deg);
  color: #cbd5e1;
}

/* Solo Active Item (Dashboard) */
.nav-link.active {
  background: #ffffff;
  color: #000000;
  font-weight: 600;
  border: none;
  border-radius: 4px;
}

.nav-link.active .nav-icon {
  color: #000000;
  opacity: 1;
}

/* Parent Active State (When child is active) - Distinct elevated highlight without left border */
.nav-group.parent-active>.nav-summary,
.nav-summary.active-parent {
  background: #141c2b;
  color: #ffffff;
  font-weight: 600;
  border: none;
  border-radius: 4px;
}

.nav-group.parent-active>.nav-summary .nav-icon,
.nav-summary.active-parent .nav-icon {
  color: #cbd5e1;
  opacity: 1;
}

/* Submenu container */
.nav-sub {
  position: relative;
  margin: 2px 0 4px 14px;
  padding: 2px 0 2px 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Child item */
.nav-sub-link {
  display: block;
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 4px;
  border: none;
  color: #94a3b8;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .15s ease, color .15s ease;
  outline: none;
}

.nav-sub-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #f1f5f9;
}

.nav-sub-link:focus-visible {
  outline: 1px solid var(--accent);
}

/* Active Child Item - Clean tint without left border */
.nav-sub-link.child-active {
  background: #ffffff;
  color: #000000;
  font-weight: 600;
  border: none;
  border-radius: 4px;
}

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-top: 46px;
  transition: margin-left .2s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  z-index: 30;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: left .2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed .topbar {
  left: var(--sidebar-collapsed-w);
}

@media (max-width:900px) {
  .topbar {
    left: 0
  }

  .main {
    margin-left: 0;
    padding-top: 46px
  }
}

.topbar .spacer {
  flex: 1
}

.content {
  padding: 22px;
  max-width: 1500px;
  width: 100%
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap
}

.crumb {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all .15s ease
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: color-mix(in srgb, var(--border) 80%, var(--text))
}

.menu-toggle {
  display: grid
}

/* Topbar Buttons & Controls */
.topbar-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  transition: color .15s ease, background .15s ease;
}

.topbar-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.topbar-btn .svg {
  width: 16px;
  height: 16px;
}

/* Notification Button */
.notif-icon-wrap {
  position: relative;
  display: grid;
  place-items: center;
}

.notif-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 6px;
  height: 6px;
  background: #ef4444;
  border-radius: 50%;
}

/* Admin Profile Avatar Button (Orange SA circle) */
.topbar-avatar-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
}

.avatar-sa {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f97316;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 3px rgba(249, 115, 22, 0.35);
  letter-spacing: -0.02em;
  transition: transform .15s ease;
}

.topbar-avatar-btn:hover .avatar-sa {
  transform: scale(1.05);
}

/* Dropdown */
.dropdown {
  position: relative
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .12);
  min-width: 200px;
  padding: 5px;
  display: none;
  z-index: 50
}

.dropdown.open .dropdown-menu {
  display: block
}

.dropdown-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 6px 10px 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px
}

.dropdown-menu a,
.dropdown-menu button {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 7px 10px;
  border-radius: 4px;
  color: var(--text);
  background: none;
  border: 0;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background .15s ease
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
  background: var(--surface-2);
  color: var(--primary)
}

/* Quick Add Dropdown Menu */
.quick-add-dropdown {
  min-width: 210px;
  padding: 6px;
}

.quick-add-dropdown a .svg {
  width: 15px;
  height: 15px;
  flex: none;
}

/* Notification Dropdown Menu */
.notif-dropdown {
  min-width: 260px;
  max-width: 320px;
  padding: 6px;
}

/* Mega Menu Dropdown */
/* Components */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .02), 0 4px 16px rgba(0, 0, 0, .02);
  padding: 20px;
  overflow: hidden
}

.card+.card {
  margin-top: 16px
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 10px
}

.grid {
  display: grid;
  gap: 16px
}

.g-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr))
}

.g-2 > :only-child { grid-column: 1 / -1; }

.g-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr))
}

.g-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr))
}

.stat {
  display: flex;
  gap: 14px;
  align-items: center
}

.stat .ic {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--primary-50);
  color: var(--primary)
}

.stat b {
  font-size: 1.4rem;
  display: block;
  line-height: 1.1
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 4px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: .15s ease;
  white-space: nowrap
}

.btn:hover {
  background: var(--primary-600)
}

.btn-light {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border)
}

.btn-light:hover {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--border) 80%, var(--text))
}

.btn-danger {
  background: var(--danger)
}

.btn-danger:hover {
  background: #b91c1c
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 4px
}

.btn[disabled] {
  opacity: .6;
  cursor: not-allowed
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px
}

.field.full {
  grid-column: 1/-1
}

label {
  font-weight: 600;
  font-size: 13px
}

.input,
select.input,
textarea.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition: .15s
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent)
}

textarea.input {
  min-height: 90px;
  resize: vertical
}

.err {
  color: var(--danger);
  font-size: 12px
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 500
}

.switch input {
  appearance: none;
  flex-shrink: 0;   /* a long label must not squeeze the switch */
  width: 40px;
  height: 22px;
  background: #cbd5e1;
  border-radius: 99px;
  position: relative;
  cursor: pointer;
  transition: .2s;
  margin: 0
}

.switch input::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: .2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2)
}

.switch input:checked {
  background: var(--primary)
}

.switch input:checked::after {
  left: 20px
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 5px
}

/* Tables connected directly to outer card box (Zero wasted padding around table) */
.card>.table-wrap,
.card>form+.table-wrap,
.card>.card-head+.table-wrap,
.card>h2+.table-wrap {
  margin-left: -20px;
  margin-right: -20px;
  border-left: none;
  border-right: none;
  border-radius: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.card>.table-wrap:first-child {
  margin-top: -20px;
  border-top: none;
}

.card>.table-wrap:last-child {
  margin-bottom: -20px;
  border-bottom: none;
}

.card .table th:first-child,
.card .table td:first-child {
  padding-left: 20px;
}

.card .table th:last-child,
.card .table td:last-child {
  padding-right: 20px;
}

.card>.table-wrap+.pagination,
.card>.table-wrap+nav {
  margin-top: 16px;
}

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px
}

.table th {
  background: var(--surface-2);
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .04em
}

.table th,
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle
}

.table tr:last-child td {
  border-bottom: 0
}

.table tbody tr:hover {
  background: var(--surface-2)
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border)
}

.badge.green {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0
}

.badge.red {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca
}

.badge.amber {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a
}

.badge.blue {
  background: var(--primary-50);
  color: var(--primary);
  border-color: transparent
}

:root[data-theme="dark"] .badge.green {
  background: #052e16;
  color: #86efac;
  border-color: #14532d
}

:root[data-theme="dark"] .badge.red {
  background: #450a0a;
  color: #fca5a5;
  border-color: #7f1d1d
}

:root[data-theme="dark"] .badge.amber {
  background: #451a03;
  color: #fcd34d;
  border-color: #78350f
}

.alert {
  padding: 12px 16px;
  border-radius: 5px;
  margin-bottom: 16px;
  border: 1px solid;
  display: flex;
  gap: 10px;
  align-items: flex-start
}

.alert-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534
}

.alert-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b
}

.alert-warn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e
}

.alert-info {
  background: var(--primary-50);
  border-color: transparent;
  color: var(--text)
}

:root[data-theme="dark"] .alert-success {
  background: #052e16;
  border-color: #14532d;
  color: #bbf7d0
}

:root[data-theme="dark"] .alert-error {
  background: #450a0a;
  border-color: #7f1d1d;
  color: #fecaca
}

:root[data-theme="dark"] .alert-warn {
  background: #451a03;
  border-color: #78350f;
  color: #fde68a
}

/* Enhanced Dashboard Layout Styles (Vibrant Color Fill & Wave Sparklines) */
.page-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap
}

.page-title-text h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
  letter-spacing: -0.015em
}

.page-title-sub {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px
}

.page-title-actions {
  display: flex;
  align-items: center;
  gap: 8px
}

.page-title-actions form { display: flex; margin: 0; }

/* small switch, e.g. inside a .btn (dashboard Admission Open / Closed) */
.switch.switch-sm { gap: 8px; }
.switch.switch-sm input { width: 30px; height: 16px; }
.switch.switch-sm input::after { width: 12px; height: 12px; }
.switch.switch-sm input:checked { background: var(--success); }
.switch.switch-sm input:checked::after { left: 16px; }

/* 5-Column Responsive KPI Row */
.kpi-row-5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

@media (max-width:1200px) {
  .kpi-row-5 {
    grid-template-columns: repeat(3, 1fr)
  }
}

@media (max-width:768px) {
  .kpi-row-5 {
    grid-template-columns: repeat(2, 1fr)
  }
}

@media (max-width:480px) {
  .kpi-row-5 {
    grid-template-columns: 1fr
  }
}

/* fewer than 5 cards (staff sees only what their role allows): fill the row */
.kpi-row-5:not(:has(> :nth-child(5))) { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  color: inherit;
  position: relative;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color .15s ease, box-shadow .15s ease;
  min-height: 108px;
}

.kpi-card:hover {
  border-color: color-mix(in srgb, var(--border) 60%, var(--text));
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
}

.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  position: relative;
}

.kpi-squircle {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  flex: none;
}

.kpi-squircle .svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.kpi-squircle.sky {
  background: #f0f9ff;
  color: #0284c7;
}

.kpi-squircle.sky .svg {
  stroke: #0284c7;
}

.kpi-squircle.green {
  background: #f0fdf4;
  color: #16a34a;
}

.kpi-squircle.green .svg {
  stroke: #16a34a;
}

.kpi-squircle.indigo {
  background: #eef2ff;
  color: #4f46e5;
}

.kpi-squircle.indigo .svg {
  stroke: #4f46e5;
}

.kpi-squircle.violet {
  background: #f5f3ff;
  color: #7c3aed;
}

.kpi-squircle.violet .svg {
  stroke: #7c3aed;
}

.kpi-squircle.rose {
  background: #fff1f2;
  color: #e11d48;
}

.kpi-squircle.rose .svg {
  stroke: #e11d48;
}

:root[data-theme="dark"] .kpi-squircle.sky {
  background: #082f49;
  color: #38bdf8
}

:root[data-theme="dark"] .kpi-squircle.sky .svg {
  stroke: #38bdf8
}

:root[data-theme="dark"] .kpi-squircle.green {
  background: #052e16;
  color: #4ade80
}

:root[data-theme="dark"] .kpi-squircle.green .svg {
  stroke: #4ade80
}

:root[data-theme="dark"] .kpi-squircle.indigo {
  background: #1e1b4b;
  color: #818cf8
}

:root[data-theme="dark"] .kpi-squircle.indigo .svg {
  stroke: #818cf8
}

:root[data-theme="dark"] .kpi-squircle.violet {
  background: #2e1065;
  color: #a78bfa
}

:root[data-theme="dark"] .kpi-squircle.violet .svg {
  stroke: #a78bfa
}

:root[data-theme="dark"] .kpi-squircle.rose {
  background: #4c0519;
  color: #fb7185
}

:root[data-theme="dark"] .kpi-squircle.rose .svg {
  stroke: #fb7185
}

.kpi-trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  line-height: 1.2;
}

.kpi-trend-pill.down {
  background: #fee2e2;
  color: #b91c1c
}

.kpi-trend-pill.up {
  background: #dcfce7;
  color: #15803d
}

.kpi-trend-pill.neutral {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border)
}

:root[data-theme="dark"] .kpi-trend-pill.down {
  background: #450a0a;
  color: #fca5a5
}

:root[data-theme="dark"] .kpi-trend-pill.up {
  background: #052e16;
  color: #86efac
}

.kpi-card-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.kpi-data {
  flex: 1;
  min-width: 0;
}

.kpi-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.kpi-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-wave-chart {
  width: 64px;
  height: 28px;
  flex: none;
  margin-bottom: 2px;
}

.kpi-wave-chart svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

/* Quick Action Launcher ("Ecosystem Hub" style) */
.quick-launcher-wrap {
  margin-bottom: 20px
}

.quick-launcher-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px
}

.quick-launcher-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em
}

.quick-launcher-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px
}

@media (max-width:1100px) {
  .quick-launcher-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr))
  }
}

@media (max-width:560px) {
  .quick-launcher-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }
}

.quick-action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  text-align: center;
}

.quick-action-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--border) 60%, var(--primary));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.quick-action-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2
}

/* Financial Overview Stats */
.fin-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px
}

.fin-stat-box {
  border-radius: 6px;
  padding: 11px 13px
}

.fin-stat-box.green {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.18)
}

.fin-stat-box.green span {
  color: #16a34a;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  display: block;
  margin-bottom: 3px
}

.fin-stat-box.green b {
  color: #15803d;
  font-size: 1.35rem;
  line-height: 1.1;
  display: block
}

.fin-stat-box.red {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.18)
}

.fin-stat-box.red span {
  color: #dc2626;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  display: block;
  margin-bottom: 3px
}

.fin-stat-box.red b {
  color: #b91c1c;
  font-size: 1.35rem;
  line-height: 1.1;
  display: block
}

.fin-stat-box.amber {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.18)
}

.fin-stat-box.amber span {
  color: #d97706;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  display: block;
  margin-bottom: 3px
}

.fin-stat-box.amber b {
  color: #b45309;
  font-size: 1.35rem;
  line-height: 1.1;
  display: block
}

:root[data-theme="dark"] .fin-stat-box.green span {
  color: #86efac
}

:root[data-theme="dark"] .fin-stat-box.green b {
  color: #dcfce7
}

:root[data-theme="dark"] .fin-stat-box.red span {
  color: #fca5a5
}

:root[data-theme="dark"] .fin-stat-box.red b {
  color: #fee2e2
}

:root[data-theme="dark"] .fin-stat-box.amber span {
  color: #fcd34d
}

:root[data-theme="dark"] .fin-stat-box.amber b {
  color: #fef3c7
}

.fin-cashflow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12.5px
}

/* Activity / Live Activity */
.activity-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.activity-head-left h2 {
  font-size: 1.1rem;
  margin: 0 0 2px;
  font-weight: 700;
  color: var(--text);
}

.activity-head-sub {
  font-size: 12px;
  color: var(--muted);
}

.activity-head-pills {
  display: flex;
  align-items: center;
  gap: 6px;
}

.activity-pill {
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: all .15s ease;
}

.activity-pill.active {
  background: var(--surface-2);
  color: var(--text);
  border-color: color-mix(in srgb, var(--border) 80%, var(--text));
}

.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  transition: background .12s ease;
}

.activity-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.activity-item:first-child {
  padding-top: 2px;
}

.activity-icon-squircle {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #ffffff;
  flex: none;
}

.activity-icon-squircle.green {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 3px 8px rgba(22, 163, 74, 0.25);
}

.activity-icon-squircle.blue {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.25);
}

.activity-icon-squircle.amber {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  box-shadow: 0 3px 8px rgba(217, 119, 6, 0.25);
}

.activity-icon-squircle.red {
  background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  box-shadow: 0 3px 8px rgba(220, 38, 38, 0.25);
}

.activity-icon-squircle .svg {
  width: 16px;
  height: 16px;
  stroke: #ffffff;
  stroke-width: 2.2;
}

.activity-body {
  flex: 1;
  min-width: 0;
}

.activity-title {
  font-size: 13px;
  color: var(--text);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-title b {
  font-weight: 600
}

.activity-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.activity-meta .small {
  font-size: 11.5px;
  color: var(--muted)
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.3;
}

.badge-pill.green {
  background: #dcfce7;
  color: #166534
}

.badge-pill.blue {
  background: #e0f2fe;
  color: #0369a1
}

.badge-pill.amber {
  background: #fef3c7;
  color: #92400e
}

.badge-pill.red {
  background: #fee2e2;
  color: #991b1b
}

:root[data-theme="dark"] .badge-pill.green {
  background: #052e16;
  color: #86efac
}

:root[data-theme="dark"] .badge-pill.blue {
  background: #082f49;
  color: #7dd3fc
}

:root[data-theme="dark"] .badge-pill.amber {
  background: #451a03;
  color: #fcd34d
}

:root[data-theme="dark"] .badge-pill.red {
  background: #450a0a;
  color: #fca5a5
}

.activity-time-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: none;
  font-size: 11px;
  line-height: 1.3;
}

.activity-day {
  font-weight: 600;
  color: var(--text)
}

.activity-hour {
  color: var(--muted)
}

.diag-section {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 18px
}

.diag-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px
}

.diag-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text)
}

.diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px
}

.diag-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 6px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between
}

.diag-item.amber {
  border-left-color: var(--warning)
}

.diag-item.red {
  border-left-color: var(--danger)
}

.diag-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px
}

.diag-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px
}

.diag-item-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 12px
}

.diag-item-foot {
  display: flex;
  justify-content: flex-end
}

.user-meta-cell {
  display: flex;
  align-items: center;
  gap: 10px
}

.user-meta-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex: none
}

.user-meta-info b {
  font-size: 13px;
  color: var(--text);
  display: block;
  line-height: 1.2
}

.user-meta-info span {
  font-size: 11px;
  color: var(--muted);
  display: block
}

/* Attendance KPI Colored Boxes */
.attendance-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 12px 0 14px
}

.attendance-kpi-box {
  border-radius: 6px;
  padding: 12px 14px;
  transition: transform .15s ease
}

.attendance-kpi-box.marked {
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.18);
}

.attendance-kpi-box.marked span {
  color: #0284c7;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px
}

.attendance-kpi-box.marked b {
  color: #0369a1;
  font-size: 1.4rem;
  line-height: 1.1;
  display: block
}

.attendance-kpi-box.present {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.18);
}

.attendance-kpi-box.present span {
  color: #16a34a;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px
}

.attendance-kpi-box.present b {
  color: #15803d;
  font-size: 1.4rem;
  line-height: 1.1;
  display: block
}

.attendance-kpi-box.absent {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.18);
}

.attendance-kpi-box.absent span {
  color: #dc2626;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px
}

.attendance-kpi-box.absent b {
  color: #b91c1c;
  font-size: 1.4rem;
  line-height: 1.1;
  display: block
}

:root[data-theme="dark"] .attendance-kpi-box.marked span {
  color: #7dd3fc
}

:root[data-theme="dark"] .attendance-kpi-box.marked b {
  color: #e0f2fe
}

:root[data-theme="dark"] .attendance-kpi-box.present span {
  color: #86efac
}

:root[data-theme="dark"] .attendance-kpi-box.present b {
  color: #dcfce7
}

:root[data-theme="dark"] .attendance-kpi-box.absent span {
  color: #fca5a5
}

:root[data-theme="dark"] .attendance-kpi-box.absent b {
  color: #fee2e2
}

.bar-wrap {
  width: 100%;
  height: 7px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--border) 60%, transparent);
  overflow: hidden;
  margin-top: 6px
}

.bar-fill {
  height: 100%;
  border-radius: 4px
}

.bar-fill.gradient-green {
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%)
}

.gender-bar {
  display: flex;
  width: 80px;
  height: 7px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-2)
}

.gender-boys {
  background: linear-gradient(90deg, #6366f1 0%, #818cf8 100%)
}

.gender-girls {
  background: linear-gradient(90deg, #ec4899 0%, #f472b6 100%)
}

.notice-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border)
}

.notice-row:last-child {
  border-bottom: none;
  padding-bottom: 0
}

.notice-date-badge {
  font-size: 11px;
  font-weight: 600;
  color: #6366f1;
  background: rgba(99, 102, 241, 0.09);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 4px;
  padding: 3px 7px;
  white-space: nowrap;
  flex: none
}

:root[data-theme="dark"] .notice-date-badge {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.35)
}

.notice-content {
  min-width: 0;
  flex: 1
}

.notice-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px
}

.notice-pin {
  width: 13px;
  height: 13px;
  color: #6366f1;
  flex: none
}

.notice-snippet {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical
}

.security-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px
}

.security-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  gap: 12px
}

.security-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text)
}

.security-icon-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none
}

.security-icon-circle.ok {
  background: rgba(34, 197, 94, 0.14);
  color: #16a34a
}

.security-icon-circle.warn {
  background: rgba(245, 158, 11, 0.14);
  color: #d97706
}

.security-icon-circle.err {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626
}

.security-icon-circle .svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2.2
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px
}

.tabs a {
  padding: 10px 16px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .15s ease, border-color .15s ease
}

.tabs a:hover {
  color: var(--text)
}

.tabs a.active {
  color: var(--primary);
  border-color: var(--primary)
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center
}

.pagination {
  display: flex;
  gap: 4px;
  margin-top: 14px;
  flex-wrap: wrap
}

.pagination a,
.pagination span {
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text)
}

.pagination .active span {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary)
}

.draft-bar {
  position: sticky;
  top: 70px;
  z-index: 20
}

/* A card clips its overflow, so "sticky" would only push the bar down over the fields: keep it in place */
.card > .draft-bar,
.card form > .draft-bar {
  position: static
}

.perm-table td:not(:first-child),
.perm-table th:not(:first-child) {
  text-align: center;
  width: 90px
}

.perm-group td {
  background: var(--surface-2);
  font-weight: 700
}

.img-preview {
  max-height: 70px;
  border-radius: 5px;
  border: 1px solid var(--border);
  padding: 4px;
  background: #fff
}

.empty {
  text-align: center;
  padding: 40px;
  color: var(--muted)
}

.license-banner {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  color: #fff;
  padding: 8px 22px;
  font-weight: 600;
  font-size: 13px
}

.license-banner a {
  color: #fff;
  text-decoration: underline
}

.save-indicator {
  font-size: 12px;
  color: var(--muted)
}

/* Auth pages (login, 2-step, setup): flat brand panel on the left, card on the right */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(440px, 1fr);
  background: var(--bg)
}

.auth-art {
  background: color-mix(in srgb, var(--primary) 32%, #0b1020);
  color: #fff;
  padding: 40px 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px
}

.auth-brand-logo {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 4px;
  background: #fff;
  border-radius: 6px
}

.auth-brand-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain
}

.auth-brand b {
  display: block;
  font-size: 15px
}

.auth-brand span {
  font-size: 12px;
  opacity: .65
}

.auth-pitch h1 {
  font-size: 2.2rem;
  line-height: 1.15;
  max-width: 460px;
  margin-bottom: 12px
}

.auth-pitch p {
  margin: 0 0 24px;
  font-size: 15px;
  opacity: .75
}

.auth-pitch ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px
}

.auth-pitch li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px
}

.auth-pitch li .svg {
  width: 22px;
  height: 22px;
  flex: none;
  padding: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .14);
  stroke: #fff;
  stroke-width: 3
}

.auth-art-foot {
  font-size: 12px;
  opacity: .55
}

/* Own login background (Website CMS > Homepage & Contact): dark shade keeps the text readable */
.auth-has-bg .auth-art {
  background: linear-gradient(rgba(8, 11, 26, .72), rgba(8, 11, 26, .72)), var(--auth-bg) center / cover no-repeat;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .55)
}

.auth-has-bg .auth-pitch p,
.auth-has-bg .auth-brand span,
.auth-has-bg .auth-art-foot {
  opacity: .9
}

.auth-box {
  display: grid;
  place-items: center;
  padding: 32px 24px
}

.auth-card {
  width: 100%;
  max-width: 400px
}

.card.auth-panel {
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 12px 32px rgba(15, 23, 42, .08)
}

.auth-head {
  margin-bottom: 22px
}

.auth-head h1 {
  font-size: 1.5rem;
  margin-bottom: 4px
}

.auth-head p {
  margin: 0;
  font-size: 13.5px
}

.auth-school {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border)
}

.auth-school b {
  font-size: 15px;
  line-height: 1.3
}

.auth-logo {
  width: 48px;
  height: 48px;
  flex: none;
  object-fit: contain
}

.auth-form {
  display: grid;
  gap: 16px
}

.auth-form .field label {
  font-weight: 600
}

.auth-code {
  font-size: 22px;
  letter-spacing: 8px;
  text-align: center
}

.auth-help {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
  text-align: center
}

/* Input with an icon on the left: <div class="input-icon"><x-icon/><input class="input"></div> */
.input-icon {
  position: relative
}

.input-icon > .svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none
}

.input-icon > .input {
  padding-left: 38px
}

.input-icon:focus-within > .svg {
  color: var(--primary)
}

/* Full-width main button */
.btn.btn-block {
  width: 100%;
  justify-content: center;
  padding: 11px 14px;
  font-size: 14px
}

@media (max-width: 560px) {
  .auth-box {
    padding: 20px 16px
  }

  .card.auth-panel {
    padding: 24px 20px
  }
}

/* Sidebar Collapsed Mode (Desktop >= 901px) */
@media (min-width:901px) {
  body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-w);
    overflow-x: hidden;
  }

  body.sidebar-collapsed .main {
    margin-left: var(--sidebar-collapsed-w);
  }

  body.sidebar-collapsed .brand {
    padding: 12px 10px;
    justify-content: center;
  }

  body.sidebar-collapsed .brand-text {
    display: none;
  }

  body.sidebar-collapsed .nav-search-wrap {
    display: none;
  }

  body.sidebar-collapsed .nav {
    padding: 6px 6px 18px;
    overflow-x: hidden;
  }

  body.sidebar-collapsed .nav-section-label {
    display: none;
  }

  body.sidebar-collapsed .nav-link,
  body.sidebar-collapsed .nav-summary {
    padding: 8px 0;
    justify-content: center;
    gap: 0;
    min-height: 34px;
    border-radius: 0;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.sidebar-collapsed .nav-link.active,
  body.sidebar-collapsed .nav-group.parent-active>.nav-summary {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.sidebar-collapsed .nav-icon {
    width: 16px;
    height: 16px;
    margin: 0 auto;
    color: #94a3b8;
    opacity: 0.8;
  }

  body.sidebar-collapsed .nav-link.active .nav-icon,
  body.sidebar-collapsed .nav-group.parent-active>.nav-summary .nav-icon {
    color: var(--accent) !important;
    opacity: 1 !important;
  }

  body.sidebar-collapsed .brand img,
  body.sidebar-collapsed .brand .brand-logo,
  body.sidebar-collapsed .brand .logo-fallback {
    width: 26px;
    height: 26px;
    background: transparent !important;
    border-radius: 4px;
  }

  body.sidebar-collapsed .nav-text,
  body.sidebar-collapsed .nav-summary .chev {
    display: none;
  }

  body.sidebar-collapsed .nav-sub {
    display: none;
  }

  /* Hover to Expand while collapsed */
  body.sidebar-collapsed .sidebar:hover {
    width: var(--sidebar-w);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.6);
    z-index: 60;
    overflow-y: auto;
  }

  body.sidebar-collapsed .sidebar:hover .brand {
    padding: 12px 14px;
    justify-content: flex-start;
  }

  body.sidebar-collapsed .sidebar:hover .brand-text {
    display: flex;
  }

  body.sidebar-collapsed .sidebar:hover .nav-search-wrap {
    display: flex;
  }

  body.sidebar-collapsed .sidebar:hover .nav {
    padding: 6px 8px 18px;
  }

  body.sidebar-collapsed .sidebar:hover .nav-section-label {
    display: block;
  }

  body.sidebar-collapsed .sidebar:hover .nav-link,
  body.sidebar-collapsed .sidebar:hover .nav-summary {
    padding: 6px 8px;
    justify-content: flex-start;
    gap: 8px;
  }

  body.sidebar-collapsed .sidebar:hover .nav-link.active {
    border: none;
    border-radius: 4px;
  }

  body.sidebar-collapsed .sidebar:hover .nav-group.parent-active>.nav-summary {
    border: none;
    border-radius: 4px;
  }

  body.sidebar-collapsed .sidebar:hover .nav-icon {
    margin: 0;
    width: 15px;
    height: 15px;
  }

  body.sidebar-collapsed .sidebar:hover .nav-text,
  body.sidebar-collapsed .sidebar:hover .nav-summary .chev {
    display: block;
  }

  body.sidebar-collapsed .sidebar:hover .nav-group[open]>.nav-sub {
    display: flex;
  }
}

@media (max-width:1100px) {
  .g-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }
}

@media (max-width:900px) {
  .sidebar {
    transform: translateX(-100%)
  }

  body.nav-open .sidebar {
    transform: none
  }

  body.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    z-index: 35;
    backdrop-filter: blur(2px)
  }

  .main {
    margin-left: 0
  }

  .menu-toggle {
    display: grid
  }

  .g-2,
  .g-3,
  .form-grid {
    grid-template-columns: 1fr
  }

  .auth {
    grid-template-columns: 1fr
  }

  .auth-art {
    display: none
  }

  /* phone / tablet: the same picture sits behind the login card */
  .auth-has-bg {
    background: linear-gradient(rgba(12, 16, 38, .35), rgba(12, 16, 38, .35)), var(--auth-bg) center / cover no-repeat
  }

  .content {
    padding: 14px
  }
}

@media (max-width:560px) {
  .g-4 {
    grid-template-columns: 1fr
  }

  .card {
    padding: 14px
  }

  .card>.table-wrap,
  .card>form+.table-wrap,
  .card>.card-head+.table-wrap,
  .card>h2+.table-wrap {
    margin-left: -14px;
    margin-right: -14px;
  }

  .card>.table-wrap:first-child {
    margin-top: -14px
  }

  .card>.table-wrap:last-child {
    margin-bottom: -14px
  }

  .card .table th:first-child,
  .card .table td:first-child {
    padding-left: 14px
  }

  .card .table th:last-child,
  .card .table td:last-child {
    padding-right: 14px
  }
}

@media print {

  .sidebar,
  .topbar,
  .no-print {
    display: none !important
  }

  .main {
    margin: 0
  }
}

/* Phase 2 */
.form-section {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 18px;
  margin-bottom: 16px;
  background: var(--surface)
}

.form-section h3 {
  margin: 0 0 12px;
  font-size: 14px
}

.form-grid.g3 {
  grid-template-columns: repeat(3, minmax(0, 1fr))
}

.form-grid.g4 {
  grid-template-columns: repeat(4, minmax(0, 1fr))
}

.photo-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border)
}

.avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-50);
  color: var(--primary);
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex: none
}

.profile-head {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap
}

.profile-head .big {
  width: 96px;
  height: 96px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--primary-50);
  display: grid;
  place-items: center;
  font-size: 2rem;
  color: var(--primary);
  font-weight: 700
}

.kv {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 20px
}

.kv div span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em
}

.kv div b {
  font-weight: 600
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  display: none;
  place-items: center;
  z-index: 60;
  padding: 16px
}

.modal.open {
  display: grid
}

.modal .card {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: auto
}

.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap
}

.chip-row a {
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600
}

.chip-row a.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff
}

.slip-cols {
  columns: 2 320px;
  column-gap: 14px
}

.slip {
  border: 1px dashed #999;
  border-radius: 6px;
  padding: 14px;
  break-inside: avoid;
  margin-bottom: 12px
}

@media (max-width:900px) {

  .form-grid.g3,
  .form-grid.g4,
  .kv {
    grid-template-columns: 1fr 1fr
  }
}

@media (max-width:560px) {

  .form-grid.g3,
  .form-grid.g4,
  .kv {
    grid-template-columns: 1fr
  }
}

@media print {
  .slip {
    page-break-inside: avoid
  }
}

/* Phase 3: fees */
.num {
  text-align: right;
  white-space: nowrap
}

.num-input {
  width: 90px;
  text-align: right;
  padding: 6px 8px
}

.fee-table td,
.fee-table th {
  padding: 9px 10px
}

.row-paid td {
  color: var(--muted)
}

.row-overdue td:nth-child(3) {
  color: var(--danger);
  font-weight: 600
}

.row-cancel td {
  text-decoration: line-through;
  color: var(--muted)
}

.row-cancel td:last-child,
.row-cancel td:first-child {
  text-decoration: none
}

.txt-red {
  color: var(--danger)
}

.txt-green {
  color: var(--success)
}

.txt-amber {
  color: var(--warning)
}

.txt-blue {
  color: var(--primary)
}

form[data-collect]:not(.is-manual) .manual-col {
  display: none
}

form[data-collect].is-manual .auto-only {
  display: none
}

/* Receipt */
.receipt {
  background: #fff;
  color: #111;
  max-width: 760px;
  margin: 0 auto 18px;
  border: 1px solid #ccc;
  padding: 22px 26px;
  font-size: 13px
}

.receipt h2 {
  font-size: 18px;
  margin: 0
}

.receipt .rhead {
  display: flex;
  gap: 14px;
  align-items: center;
  border-bottom: 2px solid #111;
  padding-bottom: 10px;
  margin-bottom: 10px
}

.receipt .rhead img {
  height: 60px
}

.receipt table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0
}

.receipt th,
.receipt td {
  border: 1px solid #bbb;
  padding: 6px 8px;
  text-align: left
}

.receipt .r {
  text-align: right
}

.receipt .meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 20px
}

.receipt .stamp {
  color: #b91c1c;
  border: 3px solid #b91c1c;
  display: inline-block;
  padding: 4px 14px;
  font-weight: 800;
  font-size: 20px;
  transform: rotate(-8deg)
}

@media print {
  body {
    background: #fff
  }

  .content {
    padding: 0
  }

  .receipt {
    border: 0;
    margin: 0 auto;
    page-break-after: always
  }

  .receipt:last-child {
    page-break-after: auto
  }
}

.input-error {
  border-color: var(--danger) !important;
  background: color-mix(in srgb, var(--danger) 6%, var(--surface))
}
.field .err:empty { display: none; }

.marksheet {
  max-width: 820px
}

.marksheet h3 {
  font-size: 13px
}
/* ---------- Sidebar: light theme with tinted icon tiles ---------- */
.sidebar {
  --sb-bg: #f8f9fb;
  --sb-line: #e6e9ef;
  --sb-text: #2b3140;
  --sb-muted: #9aa1ae;
  --sb-hover: #eceff4;
  --sb-active-a: #7b5cf0;
  --sb-active-b: #5b47e0;
  background: var(--sb-bg);
  color: var(--sb-text);
  border-right: 1px solid var(--sb-line);
}
:root[data-theme="dark"] .sidebar {
  --sb-bg: #12141a;
  --sb-line: #22252e;
  --sb-text: #d6d9e0;
  --sb-muted: #6b7280;
  --sb-hover: #1b1e26;
}
.sidebar .brand { border-bottom-color: var(--sb-line); }
.sidebar .brand-name { color: var(--sb-text); }
.sidebar .session-text { color: var(--sb-muted); }

.sidebar .nav-search-wrap { background: var(--sb-hover); border: 1px solid var(--sb-line); }
.sidebar .nav-search-wrap:focus-within { background: var(--sb-bg); border-color: #c9c2f7; }
.sidebar .nav-search { color: var(--sb-text); }
.sidebar .nav-search::placeholder { color: var(--sb-muted); }
.sidebar .nav-search-kbd { background: var(--sb-bg); color: var(--sb-muted); border: 1px solid var(--sb-line); }

.sidebar .nav:hover { scrollbar-color: #d5d8df transparent; }
.sidebar .nav:hover::-webkit-scrollbar-thumb { background: #d5d8df; }

.sidebar .nav-section + .nav-section { margin-top: 6px; }
.sidebar .nav-section-label {
  color: var(--sb-muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  padding: 10px 10px 6px;
}
.sidebar .nav-section-items { gap: 3px; }

.sidebar .nav-link,
.sidebar .nav-summary {
  gap: 11px;
  min-height: 38px;
  padding: 5px 10px 5px 7px;
  border-radius: 6px;
  color: var(--sb-text);
  font-size: 13.5px;
  font-weight: 500;
}
.sidebar .nav-link:hover,
.sidebar .nav-summary:hover { background: var(--sb-hover); color: var(--sb-text); }

.sidebar .nav-ico {
  --tone: #4f6bed;
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: color-mix(in srgb, var(--tone) 13%, transparent);
  transition: background .15s ease;
}
.sidebar .nav-ico .nav-icon,
.sidebar .nav-link:hover .nav-icon,
.sidebar .nav-summary:hover .nav-icon {
  width: 15px;
  height: 15px;
  margin: 0;
  color: var(--tone);
  opacity: 1;
}
.sidebar .nav-summary:hover .nav-ico { background: color-mix(in srgb, var(--tone) 20%, transparent); }

.sidebar .nav-summary .chev { width: 13px; height: 13px; color: #b3b8c3; }
.sidebar .nav-group[open] > .nav-summary .chev { color: var(--sb-text); }

/* Active solo link (Dashboard) */
.sidebar .nav-link.active {
  background: linear-gradient(135deg, var(--sb-active-a), var(--sb-active-b));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px -4px rgba(91, 71, 224, .55);
}
.sidebar .nav-link.active .nav-ico { background: rgba(255, 255, 255, .2); }
.sidebar .nav-link.active .nav-icon { color: #fff; }

/* Parent of active child */
.sidebar .nav-group.parent-active > .nav-summary,
.sidebar .nav-summary.active-parent {
  background: var(--sb-hover);
  color: var(--sb-text);
  font-weight: 600;
}
.sidebar .nav-group.parent-active > .nav-summary .nav-icon { color: var(--tone); }

/* Sub menu */
.sidebar .nav-sub {
  margin: 2px 0 6px 20px;
  padding-left: 12px;
  border-left: 1px solid var(--sb-line);
}
.sidebar .nav-sub-link { color: #6b7280; font-size: 13px; border-radius: 5px; }
.sidebar .nav-sub-link:hover { background: var(--sb-hover); color: var(--sb-text); }
.sidebar .nav-sub-link.child-active {
  background: color-mix(in srgb, var(--sb-active-b) 10%, transparent);
  color: var(--sb-active-b);
  font-weight: 600;
}
:root[data-theme="dark"] .sidebar .nav-sub-link { color: #9ca3af; }
:root[data-theme="dark"] .sidebar .nav-sub-link.child-active { color: #b4a8ff; }

/* Collapsed rail: keep tiles centred */
body.sidebar-collapsed .sidebar .nav-ico { margin: 0 auto; }
body.sidebar-collapsed .sidebar .nav-link.active .nav-ico { background: linear-gradient(135deg, var(--sb-active-a), var(--sb-active-b)); }
body.sidebar-collapsed .sidebar .nav-link.active .nav-icon { color: #fff !important; }
body.sidebar-collapsed .sidebar .nav-group.parent-active > .nav-summary .nav-icon { color: var(--tone) !important; }
body.sidebar-collapsed .sidebar:hover .nav-ico { margin: 0; }

/* ---------- Sidebar refinements ---------- */
/* Search sits in its own band, separated from the menu */
.sidebar .nav-search-wrap {
  margin: 12px 12px 0;
  height: 36px;
  border-radius: 6px;
  background: var(--sb-hover);
  border: 1px solid #e3e6ec;
}
.sidebar .nav-search-wrap:focus-within {
  background: var(--sb-bg);
  border-color: var(--sb-active-a);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sb-active-a) 15%, transparent);
}
.sidebar .nav-search { font-size: 12.5px; }
.sidebar .nav-search-icon { color: var(--sb-muted); }
.sidebar .nav {
  margin-top: 12px;
  padding-top: 4px;
  border-top: 1px solid var(--sb-line);
  gap: 4px;
}
:root[data-theme="dark"] .sidebar .nav-search-wrap { border-color: var(--sb-line); }

/* Section titles: smaller, lighter, with a hairline so groups read clearly */
.sidebar .nav-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 10px 6px;
  font-size: 10px;
  letter-spacing: .1em;
  color: #a3a9b5;
}
.sidebar .nav-section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--sb-line);
}
.sidebar .nav-section + .nav-section { margin-top: 0; }

/* Chevrons clearly visible */
.sidebar .nav-summary .chev {
  width: 14px;
  height: 14px;
  color: #7c8391;
  stroke-width: 2.2;
}
.sidebar .nav-summary:hover .chev { color: var(--sb-text); }
:root[data-theme="dark"] .sidebar .nav-summary .chev { color: #8b93a3; }

/* Parent of the selected page: solid tint, distinct from the gradient */
.sidebar .nav-group.parent-active > .nav-summary,
.sidebar .nav-summary.active-parent {
  background: #efeafe;
  color: #4c3bc9;
  font-weight: 600;
}
.sidebar .nav-group.parent-active > .nav-summary .nav-ico { background: #fff; }
.sidebar .nav-group.parent-active > .nav-summary .nav-icon,
.sidebar .nav-group.parent-active > .nav-summary .chev { color: #5b47e0; }
:root[data-theme="dark"] .sidebar .nav-group.parent-active > .nav-summary {
  background: #241f3d;
  color: #c9bfff;
}
:root[data-theme="dark"] .sidebar .nav-group.parent-active > .nav-summary .nav-ico { background: rgba(255,255,255,.08); }
.sidebar .nav-group.parent-active > .nav-sub { border-left-color: #d9d1fb; }

/* Selected child: same gradient as the main active item */
.sidebar .nav-sub-link.child-active,
:root[data-theme="dark"] .sidebar .nav-sub-link.child-active {
  background: linear-gradient(135deg, var(--sb-active-a), var(--sb-active-b));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 10px -4px rgba(91, 71, 224, .5);
}

/* ---------- Collapsed sidebar, hover-expanded: keep active states visible ---------- */
body.sidebar-collapsed .sidebar:hover .nav-link.active {
  background: linear-gradient(135deg, var(--sb-active-a), var(--sb-active-b)) !important;
  box-shadow: 0 4px 12px -4px rgba(91, 71, 224, .55) !important;
  border-radius: 6px !important;
}
body.sidebar-collapsed .sidebar:hover .nav-link.active .nav-ico { background: rgba(255, 255, 255, .2); }
body.sidebar-collapsed .sidebar:hover .nav-group.parent-active > .nav-summary {
  background: #efeafe !important;
  border-radius: 6px !important;
}
:root[data-theme="dark"] body.sidebar-collapsed .sidebar:hover .nav-group.parent-active > .nav-summary { background: #241f3d !important; }

/* ---------- Top bar ---------- */
.topbar { gap: 2px; padding: 0 16px 0 12px; }
.topbar .crumb { margin-left: 6px; }
.topbar-btn {
  width: 34px;
  height: 34px;
  border-radius: 5px;
  color: var(--muted);
}
.topbar-btn .svg { width: 18px; height: 18px; stroke-width: 1.7; }
.topbar-btn:hover,
.dropdown.open > .topbar-btn { background: var(--surface-2); color: var(--text); }
.notif-dot { top: -1px; right: -1px; width: 7px; height: 7px; box-shadow: 0 0 0 2px var(--surface); }
.topbar-divider { width: 1px; height: 20px; background: var(--border); margin: 0 8px 0 6px; }
.topbar-avatar-btn { margin-left: 0; }
.avatar-sa { width: 30px; height: 30px; box-shadow: none; }
.topbar-avatar-btn:hover .avatar-sa,
.dropdown.open > .topbar-avatar-btn .avatar-sa { transform: none; box-shadow: 0 0 0 3px color-mix(in srgb, #f97316 22%, transparent); }
body.sidebar-collapsed .menu-toggle .svg { transform: scaleX(-1); }

/* ---------- Dashboard ---------- */
/* Cards sitting side by side in a grid should line up */
.grid > .card + .card { margin-top: 0; }

/* KPI cards: the primary numbers, with a soft tone glow in the corner */
.kpi-row-5 { gap: 16px; margin-bottom: 26px; }
.kpi-card {
  --tone: #4f46e5;
  border-radius: 6px;
  padding: 16px 16px 14px;
  min-height: 120px;
  overflow: hidden;
  isolation: isolate;
  border-color: color-mix(in srgb, var(--tone) 14%, var(--border));
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px -12px rgba(15, 23, 42, .18);
  transition: transform .15s ease, box-shadow .15s ease;
}
.kpi-card::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -50px;
  width: 170px;
  height: 140px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--tone) 20%, transparent), transparent);
  z-index: -1;
  pointer-events: none;
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--tone) 30%, var(--border));
  box-shadow: 0 2px 4px rgba(15, 23, 42, .05), 0 14px 30px -14px color-mix(in srgb, var(--tone) 45%, transparent);
}
.kpi-value { font-size: 1.7rem; font-weight: 750; }
.kpi-label { font-size: 12px; }
.kpi-wave-chart { width: 72px; height: 30px; }

/* Section label used between blocks */
.dash-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 0 0 10px 2px;
}

/* Quick actions: compact tool shortcuts, lighter than the KPI cards */
.quick-launcher-wrap { margin-bottom: 26px; }
.quick-launcher-grid { gap: 10px; }
.quick-action-card {
  --tone: #4f46e5;
  flex-direction: row;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  text-align: left;
  box-shadow: none;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.quick-action-card:hover {
  transform: none;
  background: var(--surface);
  border-color: color-mix(in srgb, var(--tone) 35%, var(--border));
  box-shadow: 0 4px 12px -6px color-mix(in srgb, var(--tone) 40%, transparent);
}
.qa-ic {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  background: linear-gradient(140deg, color-mix(in srgb, var(--tone) 70%, #fff), var(--tone));
  box-shadow: 0 4px 10px -4px color-mix(in srgb, var(--tone) 70%, transparent);
}
.qa-ic .svg { width: 16px; height: 16px; stroke-width: 2; }
.quick-action-title { font-size: 12.5px; }

/* ---------- Tables (global) ---------- */
.table-wrap,
.card > .table-wrap,
.card > form + .table-wrap,
.card > .card-head + .table-wrap,
.card > h2 + .table-wrap,
.card > .table-wrap:first-child,
.card > .table-wrap:last-child {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}

table.table { font-size: 13px; font-variant-numeric: tabular-nums; }

.table th,
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
.card .table th:first-child,
.card .table td:first-child { padding-left: 12px; }
.card .table th:last-child,
.card .table td:last-child { padding-right: 12px; }

.table thead th {
  background: color-mix(in srgb, var(--surface-2) 40%, #e9edf3);
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  white-space: nowrap;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, #94a3b8);
}

.table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 60%, #f1f4f8); }
.table tbody tr:hover { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.table tbody tr:last-child td { border-bottom: 0; }

.table tfoot td,
.table tfoot th {
  background: color-mix(in srgb, var(--surface-2) 40%, #e9edf3);
  border-top: 1px solid color-mix(in srgb, var(--border) 70%, #94a3b8);
  border-bottom: 0;
  font-weight: 600;
}

:root[data-theme="dark"] .table thead th,
:root[data-theme="dark"] .table tfoot td,
:root[data-theme="dark"] .table tfoot th { background: #172033; color: #94a3b8; border-color: #2a3446; }
:root[data-theme="dark"] .table tbody tr:nth-child(even) { background: #0f1726; }
:root[data-theme="dark"] .table tbody tr:hover { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); }

/* ---------- Compact content area (sidebar untouched) ---------- */
.main { font-size: 13px; }
.main h1 { font-size: 1.2rem; }
.main h2 { font-size: .95rem; }
.main h3 { font-size: .875rem; }

.content { padding: 18px; }
.page-title-wrap { margin-bottom: 16px; }
.page-title-text h1 { font-size: 1.2rem; }
.page-title-sub { font-size: 12px; }

.card { padding: 16px; border-radius: 6px; }
.card-head { margin-bottom: 12px; }
.grid { gap: 14px; }

.btn { padding: 7px 12px; font-size: 12.5px; gap: 6px; }
.btn .svg { width: 15px; height: 15px; }
.btn-sm { padding: 4px 9px; font-size: 11.5px; }
.btn-sm .svg { width: 13px; height: 13px; }

label { font-size: 12px; }
.field { gap: 5px; }
.form-grid { gap: 12px 16px; }
.input, select.input, textarea.input { padding: 7px 10px; font-size: 13px; }

table.table { font-size: 12.5px; }
.table th, .table td { padding: 7px 10px; }
.card .table th:first-child, .card .table td:first-child { padding-left: 10px; }
.card .table th:last-child, .card .table td:last-child { padding-right: 10px; }
.table thead th { font-size: 10.5px; }
.badge { font-size: 10.5px; padding: 1px 6px; }

/* Dashboard */
.kpi-row-5, .quick-launcher-wrap { margin-bottom: 20px; }
.kpi-row-5 { gap: 14px; }
.kpi-card { padding: 13px 14px 12px; min-height: 104px; border-radius: 6px; }
.kpi-card-header { margin-bottom: 10px; }
.kpi-squircle { width: 28px; height: 28px; }
.kpi-squircle .svg { width: 14px; height: 14px; }
.kpi-value { font-size: 1.45rem; }
.kpi-label { font-size: 11.5px; }
.kpi-trend-pill { font-size: 10.5px; }
.quick-action-card { padding: 8px 10px; }
.qa-ic { width: 28px; height: 28px; border-radius: 5px; }
.qa-ic .svg { width: 14px; height: 14px; }
.quick-action-title { font-size: 12px; }

@media (max-width: 768px) {
  .content { padding: 14px; }
  .card { padding: 14px; }
}

/* ---------- Shared components (reuse across pages) ---------- */
.text-right { text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .95em; }
.req { color: var(--danger); }

/* Card that holds a full-width table: header, filters, table, footer */
.card.card-table { padding: 0; }
.card-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
/* rows placed straight in a card-table (staff dashboard: My class, Notices) */
.card-table > .list-row, .card-table > .notice-row, .card-table > .empty { padding-left: 16px; padding-right: 16px; }
.card-table-title { display: flex; align-items: center; gap: 8px; }
.card-table-title h2 { margin: 0; }
.card-table-filters { padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.card.card-table > .table-wrap { border: 0; border-radius: 0; }
.card.card-table .table th:first-child,
.card.card-table .table td:first-child { padding-left: 16px; }
.card.card-table .table th:last-child,
.card.card-table .table td:last-child { padding-right: 16px; }
.card-table-foot { padding: 0 16px 12px; border-top: 1px solid var(--border); }

/* Segmented status tabs */
.seg-tabs { display: inline-flex; gap: 2px; padding: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; }
.seg-tabs a { padding: 4px 11px; border-radius: 4px; font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: none; }
.seg-tabs a:hover { color: var(--text); }
.seg-tabs a.active { background: var(--text); color: var(--surface); }

/* Table cell helpers */
.ref-code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; font-weight: 600; color: var(--primary); white-space: nowrap; }
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.cell-user b { font-weight: 600; }
.avatar-initials {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--muted); font-size: 11px; font-weight: 600;
}
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; white-space: nowrap; }
.row-actions form { margin: 0; }

/* Square icon-only button; use btn-icon-danger for delete (always the trash icon) */
.btn.btn-icon { padding: 0; width: 30px; height: 30px; justify-content: center; }
.btn.btn-sm.btn-icon { width: 26px; height: 26px; }
.btn-icon-danger { color: var(--danger); }
.btn-icon-danger:hover { background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); color: var(--danger); }

/* Modal layout: head / scrollable body / footer */
.modal .card.modal-card { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.modal .card.modal-lg { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; }
.modal-card > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-body { padding: 14px 16px 16px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
.form-section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 14px 0 8px; padding-bottom: 6px; border-bottom: 1px dashed var(--border);
}
.modal-body > .form-section-title:first-child { margin-top: 0; }

/* Tooltip: <x-tip text="..."/> renders a small "i" with a hover/focus bubble */
.tip {
  position: relative; display: inline-grid; place-items: center;
  width: 14px; height: 14px; margin-left: 3px; vertical-align: -2px;
  border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); font: 600 9px/1 Georgia, serif; font-style: italic; cursor: help;
}
.tip:hover, .tip:focus { color: var(--primary); border-color: var(--primary); outline: none; }
/* the bubble is one floating element on <body> (app.js), so no card or table can cut it off */
.tip-pop {
  position: fixed; z-index: 1000; max-width: 260px; padding: 7px 10px; border-radius: 4px;
  background: #1e293b; color: #f8fafc; box-shadow: 0 6px 18px rgba(15, 23, 42, .22);
  font-family: inherit; font-size: 12.5px; font-weight: 400; font-style: normal; line-height: 1.45; letter-spacing: 0;
  text-transform: none; text-align: left; white-space: normal; overflow-wrap: break-word;
  pointer-events: none; opacity: 0; transition: opacity .12s ease;
}
.tip-pop.show { opacity: 1; }
:root[data-theme="dark"] .tip-pop { background: #f1f5f9; color: #0f172a; }

/* Back + breadcrumb (<x-page-back>): one compact line above the page title */
.page-back { display: flex; align-items: center; gap: 10px; margin: -4px 0 12px; min-height: 26px; }
.btn-back {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center;
  border-radius: 4px; border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border));
  background: var(--primary-50); color: var(--primary); text-decoration: none;
}
.btn-back .svg { width: 14px; height: 14px; stroke-width: 2.2; }
.btn-back:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; line-height: 1; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); text-decoration: underline; }
.breadcrumbs .crumb-sep { color: color-mix(in srgb, var(--muted) 55%, transparent); }
.breadcrumbs [aria-current] { color: var(--text); font-weight: 600; }

/* Login credential box (student profile) */
.cred-box { display: grid; gap: 8px; }
.cred-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2); }
.cred-row span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cred-row b { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; letter-spacing: .02em; }

/* Two-column paired inputs with row labels (father/mother, current/permanent address) */
.pair-grid { display: grid; grid-template-columns: 160px minmax(0, 1fr) minmax(0, 1fr); gap: 8px 14px; align-items: center; }
.pair-grid > label { font-size: 12px; color: var(--muted); font-weight: 500; }
.pair-head { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-bottom: 4px; border-bottom: 1px solid var(--border); }
@media (max-width: 700px) { .pair-grid { grid-template-columns: 1fr 1fr; } .pair-grid > label { grid-column: 1 / -1; margin-top: 6px; } .pair-grid > div:first-child { display: none; } }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.form-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text); padding-bottom: 8px; border-bottom: 1px solid var(--border); }

/* data-show-if boxes may use display:contents; keep the hidden attribute working */
[data-show-if][hidden] { display: none !important; }

/* Summary number tiles (fees, reports): <div class="stat-tiles"><div class="stat-tile tone-green"><span>Label</span><b>₹0</b><small>note</small></div></div> */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-tile { --tone: var(--muted); background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--tone); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.stat-tile span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.stat-tile b { font-size: 1.15rem; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-tile small { font-size: 11px; color: var(--muted); }
.stat-tile.tone-green { --tone: #16a34a; } .stat-tile.tone-green b { color: #15803d; }
.stat-tile.tone-red { --tone: #dc2626; } .stat-tile.tone-red b { color: #b91c1c; }
.stat-tile.tone-amber { --tone: #d97706; } .stat-tile.tone-amber b { color: #b45309; }
.stat-tile.tone-blue { --tone: var(--primary); } .stat-tile.tone-blue b { color: var(--primary); }
:root[data-theme="dark"] .stat-tile b { filter: brightness(1.4); }

/* Checkbox dropdown (<x-class-picker>) */
.multi-pick { position: relative; }
.multi-pick > summary { list-style: none; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 26px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
.multi-pick > summary::-webkit-details-marker { display: none; }
.multi-pick-menu { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; min-width: 180px; max-height: 240px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px; box-shadow: 0 6px 18px rgba(15, 23, 42, .12); padding: 4px; }
.multi-pick-menu label { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 4px; font-weight: 400; font-size: 13px; cursor: pointer; }
.multi-pick-menu label:hover { background: var(--surface-2); }
.multi-pick-actions { display: flex; justify-content: space-between; gap: 8px; padding: 4px 8px 6px; margin-bottom: 2px; border-bottom: 1px solid var(--border); }
.multi-pick-actions button { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; font-weight: 600; color: var(--primary); cursor: pointer; }
.multi-pick-actions button:hover { text-decoration: underline; }
.table tr.row-selected td { background: var(--primary-50); }

.badge.violet { background: #efeafe; color: #5b3fc4; }
:root[data-theme="dark"] .badge.violet { background: #2c2350; color: #c4b5fd; }

/* Form buttons aligned right */
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }

/* Fee Structure: a tinted section per fee group, a card per fee head */
.fs-status { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.fs-body { border: 0; margin: 0; padding: 0; min-width: 0; }
.fs-group { padding: 12px 16px 16px; border-top: 1px solid var(--border); --fs-tint: #f3f6ff; --fs-ink: #3f56c9; background: var(--fs-tint); }
.fs-group-tuition { --fs-tint: #f0faf3; --fs-ink: #15803d; }
.fs-group-misc { --fs-tint: #fff8ec; --fs-ink: #b45309; }
:root[data-theme="dark"] .fs-group { --fs-tint: rgba(79, 107, 237, .08); --fs-ink: #a5b4fc; }
:root[data-theme="dark"] .fs-group-tuition { --fs-tint: rgba(22, 163, 74, .08); --fs-ink: #86efac; }
:root[data-theme="dark"] .fs-group-misc { --fs-tint: rgba(217, 119, 6, .08); --fs-ink: #fcd34d; }
.fs-group-title { margin-bottom: 10px; font-size: 13.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fs-ink); }
.fs-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.fs-card { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; }
.fs-card-wide { grid-column: 1 / -1; }
.fs-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.fs-card-head b { font-size: 13px; }
.fs-card-head .input { width: auto; min-width: 130px; height: 28px; padding: 2px 26px 2px 8px; font-size: 12px; }
.fs-card-wide .fs-card-head { justify-content: flex-start; }
.fs-inst { display: flex; flex-wrap: wrap; gap: 10px 12px; border: 0; margin: 0; padding: 8px 0 0; min-width: 0; border-top: 1px dashed var(--border); }
.fs-inst[hidden] { display: none; }
.fs-field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; font-weight: 500; color: var(--muted); }
.fs-input-wrap { position: relative; display: block; }
.fs-input-wrap i { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 12px; color: var(--muted); pointer-events: none; }
.fs-input-wrap .input { width: 100%; min-width: 110px; height: 30px; padding-left: 22px; text-align: right; }
.fs-card-wide .fs-input-wrap .input { width: 130px; }
.fs-field small { font-size: 11px; min-height: 14px; }
.input.is-prev { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.input.is-saved { background: #f0fdf4; border-color: #4ade80; color: var(--text); }
:root[data-theme="dark"] .input.is-saved { background: rgba(22, 163, 74, .12); border-color: #15803d; }
.fs-body:disabled .input { opacity: .85; cursor: not-allowed; }
.fs-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border); }
.fs-foot .toolbar { margin-left: auto; }
/* Page head: title takes the free space, actions stay on the right (also when they wrap) */
.page-head > div:first-child { flex: 1 1 320px; min-width: 0; }
.page-head > .btn, .page-head > .toolbar { margin-left: auto; }
/* <x-note>: highlighted note box, reusable anywhere */
.note-box { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; border: 1px solid; border-left-width: 3px; border-radius: 4px; font-size: 12.5px; line-height: 1.5; }
.note-box-icon { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.note-box-body { min-width: 0; }
.note-box.tone-amber { background: #fffbeb; border-color: #fcd34d; border-left-color: #f59e0b; color: #78350f; }
.note-box.tone-blue { background: #eff6ff; border-color: #bfdbfe; border-left-color: #3b82f6; color: #1e3a8a; }
.note-box.tone-green { background: #f0fdf4; border-color: #bbf7d0; border-left-color: #22c55e; color: #14532d; }
.note-box.tone-red { background: #fef2f2; border-color: #fecaca; border-left-color: #ef4444; color: #7f1d1d; }
:root[data-theme="dark"] .note-box.tone-amber { background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .35); border-left-color: #f59e0b; color: #fcd34d; }
:root[data-theme="dark"] .note-box.tone-blue { background: rgba(59, 130, 246, .1); border-color: rgba(59, 130, 246, .35); border-left-color: #3b82f6; color: #93c5fd; }
:root[data-theme="dark"] .note-box.tone-green { background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .35); border-left-color: #22c55e; color: #86efac; }
:root[data-theme="dark"] .note-box.tone-red { background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .35); border-left-color: #ef4444; color: #fca5a5; }
.fs-note { flex: 1 1 320px; }
/* hidden always wins over display rules (show/hide helpers in app.js rely on it) */
[hidden] { display: none !important; }

/* Top bar search: opens in the free space left of the icons */
.topbar-search { position: relative; display: flex; align-items: center; gap: 8px; width: min(440px, 42vw); height: 34px; margin-right: 6px; padding: 0 8px 0 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; animation: topbar-search-in .15s ease; }
.topbar-search:focus-within { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px var(--primary-50); }
.topbar-search .svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.topbar-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 13px; color: var(--text); }
.topbar-search kbd { font: 600 10px/1 inherit; color: var(--muted); border: 1px solid var(--border); border-radius: 3px; padding: 3px 5px; background: var(--surface); }
.topbar-search-results { position: absolute; left: -1px; right: -1px; top: calc(100% + 4px); z-index: 70; max-height: 360px; overflow-y: auto; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 10px 28px rgba(15, 23, 42, .14); }
.topbar-search-results a { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: 4px; color: var(--text); text-decoration: none; font-size: 13px; }
.topbar-search-results a span { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.topbar-search-results a.on, .topbar-search-results a:hover { background: var(--primary-50); color: var(--primary); }
.topbar-search-results .empty { padding: 12px; text-align: center; color: var(--muted); font-size: 12.5px; }
@keyframes topbar-search-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 700px) { .topbar-search { position: absolute; left: 8px; right: 8px; width: auto; top: 50%; transform: translateY(-50%); z-index: 70; animation: none; } }

/* All modules (top bar grid icon): the sidebar's groups in one large card */
.dropdown-menu.apps-menu { position: fixed; top: 52px; right: 16px; left: calc(var(--sidebar-w) + 16px); width: auto; max-width: 1180px; margin-left: auto;
  max-height: calc(100vh - 68px); overflow-y: auto; padding: 0; z-index: 80; }
body.sidebar-collapsed .dropdown-menu.apps-menu { left: calc(var(--sidebar-collapsed-w) + 16px); }
@media (max-width: 900px) { .dropdown-menu.apps-menu { left: 12px; right: 12px; } }
.apps-head { display: flex; align-items: baseline; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
/* Masonry columns: groups flow top-to-bottom, so short and long groups pack into one screen */
.apps-body { padding: 12px 16px 8px; columns: 5 180px; column-gap: 24px; }
.apps-group { break-inside: avoid; margin-bottom: 14px; }
.apps-group-title { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; font-size: 13px; font-weight: 600; color: var(--text); }
.apps-ico { display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 4px; color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent); }
.apps-ico .svg { width: 13px; height: 13px; }
.dropdown-menu.apps-menu .apps-group a { display: block; position: relative; padding: 2px 6px 2px 27px; font-size: 12.5px; line-height: 1.45; color: var(--muted); border-radius: 3px; }
.dropdown-menu.apps-menu .apps-group a::before { content: "»"; position: absolute; left: 14px; color: var(--muted); opacity: .6; }
.dropdown-menu.apps-menu .apps-group a:hover { background: var(--surface-2); color: var(--text); }
.dropdown-menu.apps-menu .apps-group a.active { color: var(--primary); font-weight: 600; }

/* Toasts (<x-toasts>, window.toast) */
.toast-stack { position: fixed; top: 56px; right: 16px; z-index: 1100; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px 12px; overflow: hidden; pointer-events: auto;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 3px solid var(--toast); border-radius: 6px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .16); font-size: 13px; line-height: 1.45;
  opacity: 0; transform: translateX(16px); transition: opacity .2s ease, transform .2s ease; }
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateX(16px); }
.toast-success { --toast: #16a34a; } .toast-error { --toast: #dc2626; } .toast-warning { --toast: #d97706; } .toast-info { --toast: #2563eb; }
.toast-ico { width: 18px; height: 18px; flex: none; margin-top: 1px; fill: none; stroke: var(--toast); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-close { flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin: -2px -4px 0 0; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.toast-close:hover { background: var(--surface-2); color: var(--text); }
.toast-close svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--toast); opacity: .55; transform-origin: left; animation: toast-life var(--life, 4s) linear forwards; }
.toast.paused .toast-bar { animation-play-state: paused; }
@keyframes toast-life { to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .toast, .toast.out { transition: none; transform: none; } .toast-bar { animation: none; } }

/* Lessons & Topics: a card per lesson, a row per topic */
.lesson-list { border: 0; margin: 0; padding: 14px 16px; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; align-items: start; }
.lesson-list > .empty { grid-column: 1 / -1; }
.lesson-card { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 5px; }
.lesson-head { display: flex; align-items: center; gap: 8px; }
.lesson-no { flex: none; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--primary); white-space: nowrap; }
.lesson-head .lesson-name { flex: 1; min-width: 0; height: 32px; font-weight: 600; }
.lesson-head [data-topic-count] { flex: none; white-space: nowrap; }
.topic-list { display: flex; flex-direction: column; gap: 6px; }
.topic-row { display: flex; align-items: center; gap: 8px; }
.topic-row .input { flex: 1; min-width: 0; height: 30px; font-size: 12.5px; }
.topic-dot { flex: none; width: 6px; height: 6px; margin-left: 4px; border-radius: 50%; background: var(--border); }
.topic-add { align-self: flex-start; }
.lesson-list:disabled .btn, .lesson-list:disabled .topic-add { display: none; }

/* <x-progress>: done (green) + in progress (amber) on a grey track */
.progress { display: flex; height: 8px; width: 100%; overflow: hidden; border-radius: 4px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.progress span { display: block; height: 100%; transition: width .25s ease; }
.progress-done { background: #16a34a; }
.progress-doing { background: #f59e0b; }
.progress-cell { display: flex; align-items: center; gap: 10px; }
.progress-cell .progress { flex: 1; }
.progress-cell b { min-width: 38px; text-align: right; font-size: 12.5px; }
.txt-green { color: #15803d; }
.progress-legend { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.progress-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 8px; }
.progress-legend .lg-done { background: #16a34a; } .progress-legend .lg-doing { background: #f59e0b; } .progress-legend .lg-none { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.progress-summary { display: grid; gap: 6px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.progress-summary b[data-progress-pct] { font-size: 20px; }

/* .seg-choice: radio buttons shown as one segmented control (Not started / In progress / Completed) */
.seg-choice { display: inline-flex; flex: none; border: 1px solid var(--border); border-radius: 5px; overflow: hidden; background: var(--surface); }
.seg-choice label { position: relative; margin: 0; cursor: pointer; }
.seg-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg-choice span { display: block; padding: 4px 10px; font-size: 12px; font-weight: 500; color: var(--muted); border-left: 1px solid var(--border); white-space: nowrap; }
.seg-choice label:first-child span { border-left: 0; }
.seg-choice label:hover span { background: var(--surface-2); color: var(--text); }
.seg-choice input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }
.seg-choice input:checked + span { background: var(--text); color: var(--surface); }
.seg-choice .seg-in_progress input:checked + span { background: #f59e0b; color: #fff; }
.seg-choice .seg-completed input:checked + span { background: #16a34a; color: #fff; }

/* Mark Topic Progress: a row per topic */
.lesson-title { flex: 1; min-width: 0; font-size: 13.5px; }
.progress-topic { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-top: 1px dashed var(--border); }
.progress-topic-name { flex: 1 1 160px; min-width: 0; font-size: 13px; }
.progress-date { width: 140px; height: 28px; font-size: 12px; }
fieldset:disabled .seg-choice { opacity: .75; }

/* Homework check: status colours */
.seg-choice .seg-hw-done input:checked + span { background: #16a34a; color: #fff; }
.seg-choice .seg-hw-incomplete input:checked + span { background: #f59e0b; color: #fff; }
.seg-choice .seg-hw-not_done input:checked + span { background: #dc2626; color: #fff; }

/* <x-image-drop>: square (or wide) upload box with preview and drag & drop */
.image-drop { position: relative; width: 168px; height: 168px; border: 1.5px dashed var(--border); border-radius: 6px; background: var(--surface-2);
  display: grid; place-items: center; overflow: hidden; transition: border-color .15s ease, background .15s ease; }
.image-drop-wide { width: 100%; max-width: 520px; height: 120px; }
.image-drop:hover, .image-drop.dragging { border-color: var(--primary); background: var(--primary-50); }
.image-drop input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 1; }
.image-drop img { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain; }
.image-drop-empty { display: grid; justify-items: center; gap: 2px; padding: 10px; text-align: center; color: var(--muted); font-size: 11.5px; line-height: 1.35; pointer-events: none; }
.image-drop-empty svg { width: 24px; height: 24px; margin-bottom: 4px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.image-drop-empty b { color: var(--text); font-size: 12px; }
.image-drop.has-image .image-drop-empty { display: none; }
.image-drop-remove { position: absolute; top: 6px; right: 6px; z-index: 2; display: none; }
.image-drop.has-image .image-drop-remove { display: inline-flex; }

/* Settings: section menu on the left, form on the right */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.settings-layout > .card + .card { margin-top: 0; }   /* menu and form start on the same line */
.settings-nav { padding: 8px; position: sticky; top: 62px; }
.settings-nav-group { padding: 10px 10px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.settings-nav-group:first-child { padding-top: 4px; }
.settings-nav a { display: block; padding: 7px 10px; border-radius: 4px; color: var(--text); font-size: 13px; text-decoration: none; }
.settings-nav a:hover { background: var(--surface-2); }
.settings-nav a.active { background: var(--primary-50); color: var(--primary); font-weight: 600; box-shadow: inset 2px 0 0 var(--primary); }
.settings-images { display: flex; flex-wrap: wrap; gap: 16px 24px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.settings-images .field:has(.image-drop-wide) { flex: 1 1 100%; }
.settings-switch { margin-top: 22px; }
.color-field { display: flex; align-items: center; gap: 10px; height: 34px; }
.color-field input[type=color] { width: 44px; height: 32px; padding: 2px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); cursor: pointer; }
.color-field code { font-size: 12px; color: var(--muted); }
@media (max-width: 900px) { .settings-layout { grid-template-columns: 1fr; } .settings-nav { position: static; display: flex; flex-wrap: wrap; gap: 2px; } .settings-nav-group { display: none; } }
.toast.sticky .toast-bar { display: none; }
.toast.sticky .toast-msg { user-select: text; }
.toast-copy { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface-2); color: var(--text); font: 600 12px/1.2 inherit; cursor: pointer; }
.toast-copy:hover { border-color: var(--toast); }
.toast-copy svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.toast-copy.done { border-color: var(--toast); color: var(--toast); }
.toast-msg .toast-copy { display: flex; width: fit-content; }

/* <x-donut>: donut + legend. Status tones are reserved for states; 1..6 are the categorical order. */
:root { --dz-1: #2a78d6; --dz-2: #eb6834; --dz-3: #1baf7a; --dz-4: #eda100; --dz-5: #e87ba4; --dz-6: #6250d6;
  --dz-good: #0ca30c; --dz-critical: #d03b3b; --dz-warning: #fab219; --dz-muted: #b4b6bd; }
:root[data-theme="dark"] { --dz-1: #3987e5; --dz-2: #d95926; --dz-3: #199e70; --dz-4: #c98500; --dz-5: #d55181; --dz-6: #9085e9; --dz-muted: #5b606b; }
.tone-1 { --dz: var(--dz-1); } .tone-2 { --dz: var(--dz-2); } .tone-3 { --dz: var(--dz-3); } .tone-4 { --dz: var(--dz-4); } .tone-5 { --dz: var(--dz-5); } .tone-6 { --dz: var(--dz-6); }
.tone-good { --dz: var(--dz-good); } .tone-critical { --dz: var(--dz-critical); } .tone-warning { --dz: var(--dz-warning); } .tone-muted { --dz: var(--dz-muted); }
.donut { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; padding: 6px 2px 2px; }
.donut-chart { position: relative; flex: none; }
.donut-chart svg { width: 100%; height: 100%; overflow: visible; }
.donut-track { fill: none; stroke: var(--surface-2); stroke-width: 16; }
.donut-seg { fill: none; stroke: var(--dz); stroke-width: 16; cursor: pointer; transition: stroke-width .15s ease, opacity .15s ease; }
.donut.focus .donut-seg { opacity: .35; }
.donut.focus .donut-seg.on { opacity: 1; stroke-width: 19; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-center b { font-size: 19px; font-weight: 700; color: var(--text); line-height: 1.15; }
.donut-center span { font-size: 11px; color: var(--muted); max-width: 90px; margin: 0 auto; }
.donut-legend { flex: 1 1 180px; min-width: 0; list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.donut-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 40px; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 4px; font-size: 12.5px; cursor: default; }
.donut-legend li:hover, .donut-legend li.on { background: var(--surface-2); }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--dz); }
.donut-legend span { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend b { font-weight: 600; color: var(--text); }
.donut-legend em { font-style: normal; color: var(--muted); text-align: right; font-size: 11.5px; }
.split-bar { display: flex; gap: 2px; height: 8px; margin-top: 14px; border-radius: 4px; overflow: hidden; }
.split-bar span { display: block; height: 100%; background: var(--dz); }
.split-legend { display: flex; gap: 18px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.split-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; background: var(--dz); }
.split-legend b { color: var(--text); margin-left: 2px; }
/* boys / girls bar: two neutral shades, so it never repeats a category colour */
.tone-boys { --dz: #475569; } .tone-girls { --dz: #a3adbd; }
:root[data-theme="dark"] .tone-boys { --dz: #94a3b8; } :root[data-theme="dark"] .tone-girls { --dz: #475569; }
/* Leave requests / attendance by date */
.seg-tabs .seg-count { display: inline-block; min-width: 16px; margin-left: 4px; padding: 0 5px; border-radius: 8px; background: var(--surface); color: var(--text); font-size: 10.5px; line-height: 16px; text-align: center; }
.seg-tabs a.active .seg-count { background: var(--surface); color: var(--text); }
.txt-amber { color: #b45309; }
.btn-approve { color: #15803d; }
.btn-approve:hover { border-color: #16a34a; background: #f0fdf4; }
.btn.disabled { opacity: .45; pointer-events: none; }
.att-bar .att-absent { background: #dc2626; }
.btn-reject { color: #b91c1c; }
.btn-reject:hover { border-color: #dc2626; background: #fef2f2; }
/* number and action columns: header aligns with its cells (.table th sets left, which out-ranked .num) */
.table th.num, .table td.num, .table th.text-right, .table td.text-right { text-align: right; }
.table th.text-center, .table td.text-center { text-align: center; }

/* ---------- HR pages ---------- */
img.avatar-initials { object-fit: cover; padding: 0; }
/* simple label + action row inside a card (documents list) */
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); }
.list-row:first-of-type { border-top: 0; }
.list-row form { margin: 0; }
/* long forms: save bar stays at the bottom of the screen */
.form-sticky-foot { position: sticky; bottom: 0; z-index: 5; margin-top: 12px; padding: 10px 16px; }
.table tr.row-muted td { color: var(--muted); }
/* attendance status: P / L / HD / A / LV / H segmented choice */
.att-choice span { min-width: 30px; text-align: center; padding: 4px 6px; }
.seg-choice .seg-att-present input:checked + span { background: #16a34a; color: #fff; }
.seg-choice .seg-att-late input:checked + span,
.seg-choice .seg-att-half_day input:checked + span { background: #f59e0b; color: #fff; }
.seg-choice .seg-att-absent input:checked + span { background: #dc2626; color: #fff; }
.seg-choice .seg-att-leave input:checked + span { background: var(--primary); color: #fff; }
.seg-choice .seg-att-holiday input:checked + span { background: #64748b; color: #fff; }
.seg-choice input:disabled + span { cursor: default; }
/* monthly attendance register grid */
.table.att-register { font-size: 11px; }
.table.att-register th, .table.att-register td { padding: 5px 3px; text-align: center; min-width: 24px; }
.table.att-register th small { display: block; font-weight: 400; color: var(--muted); }
.table.att-register .att-name { text-align: left; white-space: nowrap; padding-left: 12px; min-width: 150px; }
.table.att-register .att-sum { font-weight: 600; background: var(--surface-2); }
.table.att-register .att-off { background: color-mix(in srgb, #f59e0b 12%, var(--surface)); }
.table.att-register .att-st-absent { color: var(--danger); font-weight: 700; }
.table.att-register .att-st-leave { color: var(--primary); font-weight: 600; }
.table.att-register .att-st-late, .table.att-register .att-st-half_day { color: #b45309; font-weight: 600; }
/* payroll: generate bar, payslip tools */
.payroll-generate { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.payslip-tools { max-width: 760px; margin: 0 auto 16px; }
.fs-foot .toolbar.payroll-pay { flex: 1; justify-content: flex-end; }
/* leave balance chips (My Profile & Leave) */
.leave-balance { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 14px; }
.leave-balance div { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2); }
.leave-balance span { font-size: 11px; color: var(--muted); }
.leave-balance b { font-size: 14px; font-variant-numeric: tabular-nums; }
.leave-balance small { font-size: 11px; color: var(--muted); }
@media print { .table.att-register .att-off { background: #fef3c7 !important; } }

/* Library: book cover thumbnail, form layout helpers, issued-book rows */
.book-cover { width: 36px; height: 48px; flex: none; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2); color: var(--muted); overflow: hidden; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-cover .svg { width: 16px; height: 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-with-image { display: grid; grid-template-columns: 168px 1fr; gap: 16px; align-items: start; }
.form-with-image > .field > label { display: block; margin-bottom: 4px; }
.issue-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.issue-row:first-of-type { border-top: 0; }
.issue-row-main { flex: 1; min-width: 0; }
.issue-row form { margin-top: 6px; }
@media (max-width: 720px) { .form-with-image { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }

/* Type-ahead picker (data-suggest): type a few words, pick from the list */
.suggest { position: relative; }
.suggest-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 2px; max-height: 240px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.suggest-item { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; cursor: pointer; font-size: 13px; }
.suggest-item small { color: var(--muted); white-space: nowrap; }
.suggest-item:hover, .suggest-item.active { background: var(--primary-50); }
.suggest-empty { padding: 8px 10px; color: var(--muted); font-size: 12.5px; }

/* ---------- Certificates & ID cards: printed card (cert/_render) ---------- */
.cert-page { position: relative; overflow: hidden; flex: none; background-size: 100% 100%; background-repeat: no-repeat; box-sizing: border-box; color: #111;
  font-family: "Segoe UI", Arial, sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.cert-el { position: absolute; box-sizing: border-box; overflow: hidden; word-wrap: break-word; }
.cert-text { display: flex; flex-direction: column; white-space: pre-line; }
.cert-el.cert-img { display: block; }
.cert-nophoto { border: 1px dashed #999; display: grid; place-items: center; color: #999; font-size: 7pt; }
.cert-cancel { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28pt; font-weight: 800; color: rgba(220, 38, 38, .55); transform: rotate(-25deg); pointer-events: none; }
.cert-sheet { display: flex; flex-wrap: wrap; gap: 4mm; justify-content: flex-start; }
.cert-sheet .cert-page { outline: 0.2mm dashed #bbb; }
.cert-full .cert-page { margin: 0 auto 10mm; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
@media print {
  .cert-sheet { gap: 3mm; }
  .cert-full .cert-page { box-shadow: none; margin: 0; page-break-after: always; }
  .cert-sheet .cert-page { page-break-inside: avoid; outline: 0.2mm dashed #ccc; }
}
/* template list: scaled-down live preview */
.tpl-thumb { display: grid; place-items: center; height: 170px; margin: -2px 0 10px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.tpl-thumb-scale { transform-origin: top left; }
.tpl-thumb-scale .cert-page { box-shadow: 0 1px 4px rgba(15, 23, 42, .18); }
/* choose a template by its preview (radio tiles) */
.tpl-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tpl-pick-item { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; background: var(--surface); }
.tpl-pick-item input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-pick-item:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.tpl-pick-item:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
.tpl-pick-name { display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; }

/* ---------- Designer page ---------- */
.designer { display: flex; flex-direction: column; gap: 12px; }
.designer-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; }
.designer-name { flex: 1 1 240px; max-width: 380px; font-weight: 600; }
.designer-body { display: grid; grid-template-columns: 220px minmax(0, 1fr) 300px; gap: 12px; align-items: start; }
.designer-panel { padding: 0 12px; position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow-y: auto; }
.designer-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.designer-tools .btn { justify-content: center; }
.input-color { height: 32px; padding: 2px 4px; cursor: pointer; }
/* property panel: groups separated by a line, small titles, compact controls */
.prop-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px; margin: 0 -12px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.prop-head > b { margin-right: auto; }
.prop-head-name { display: flex; flex-direction: column; min-width: 0; margin-right: auto; line-height: 1.25; }
.prop-head-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prop-head-name small { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; }
.prop-group { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--border); }
.prop-head + .prop-group, .designer-panel > .prop-group:first-child, [data-card-props] > .prop-group:first-of-type { border-top: 0; }
.prop-title { display: flex; align-items: baseline; gap: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.prop-title span { font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0; }
.prop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.prop-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 6px; }
.prop-btns .btn, .prop-full { justify-content: center; }
.prop-full { width: 100%; }
.prop-toggles { display: flex; gap: 6px; }
.prop-line { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 12.5px; }
.prop-line > span { color: var(--muted); }
.prop-line-top { align-items: start; }
.prop-line-top > span { padding-top: 6px; }
.prop-inline { display: flex; align-items: center; gap: 8px; }
.prop-inline .input-color { flex: 1; }
.prop-num { display: flex; align-items: center; height: 32px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); overflow: hidden; }
.prop-num span { flex: none; padding: 0 7px; height: 100%; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-right: 1px solid var(--border); }
.prop-num input { flex: 1; min-width: 0; height: 100%; border: 0; padding: 0 6px; background: transparent; color: var(--text); font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.prop-num input:focus { outline: none; }
.prop-num:focus-within { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent); }
.designer-props .note-box { margin: 0 0 12px; }
/* segmented control stretched to full width */
.seg-choice.seg-block { display: flex; width: 100%; }
.seg-choice.seg-block label { flex: 1; }
.seg-choice.seg-block span { text-align: center; padding: 5px 4px; }
/* layers: drag to reorder */
.layer-list { display: flex; flex-direction: column; gap: 2px; }
.layer-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 8px 5px 4px; border: 1px solid transparent; border-radius: 4px;
  background: none; color: var(--text); font-size: 12px; cursor: pointer; user-select: none; position: relative; }
.layer-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.layer-row small { margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.layer-row:hover { background: var(--surface-2); }
.layer-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.layer-row.active { background: var(--primary-50); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.layer-row.dragging { opacity: .45; }
.layer-row.drop-before::before, .layer-row.drop-after::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--primary); }
.layer-row.drop-before::before { top: -2px; }
.layer-row.drop-after::after { bottom: -2px; }
.layer-grip { flex: none; width: 8px; height: 14px; cursor: grab; opacity: .55;
  background-image: radial-gradient(currentColor 1.1px, transparent 1.3px); background-size: 4px 4px; background-position: 0 1px; }
.layer-row:active .layer-grip { cursor: grabbing; }
.designer-stage.is-drop { outline: 2px dashed var(--primary); outline-offset: -8px; }
/* keyboard shortcut list */
.kbd-list { display: grid; gap: 6px; }
.kbd-list > div { display: grid; grid-template-columns: 170px 1fr; gap: 10px; align-items: center; font-size: 12.5px; }
kbd { display: inline-block; padding: 2px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11.5px; color: var(--text); white-space: nowrap; }
.toggle-btn { position: relative; display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--border);
  border-radius: 4px; background: var(--surface); color: var(--text); font-size: 12px; cursor: pointer; user-select: none; }
.toggle-btn input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.toggle-btn:hover { background: var(--surface-2); }
.toggle-btn:has(input:checked) { background: var(--text); border-color: var(--text); color: var(--surface); }
.designer-canvas { position: relative; padding: 0; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.designer-canvas-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.designer-zoom { min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }
.designer-stage { display: flex; height: calc(100vh - 250px); min-height: 420px; overflow: auto; padding: 24px;
  background-color: var(--surface-2); background-image: radial-gradient(color-mix(in srgb, var(--muted) 30%, transparent) 1px, transparent 1px); background-size: 16px 16px; }
.designer-card { position: relative; flex: none; margin: auto; overflow: hidden; background-size: 100% 100%; background-repeat: no-repeat; color: #111;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .12), 0 10px 28px rgba(15, 23, 42, .14); user-select: none; touch-action: none; }
.designer-starters { position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 6px 20px rgba(15, 23, 42, .12); }
.designer-hint { padding: 6px 12px; border-top: 1px solid var(--border); }
.dz-el { position: absolute; box-sizing: border-box; overflow: hidden; word-wrap: break-word; cursor: move; }
.dz-text { display: flex; flex-direction: column; white-space: pre-line; }
.dz-image img { display: block; width: 100%; height: 100%; pointer-events: none; }
.dz-empty { opacity: .45; }
.dz-ph { display: grid; place-items: center; border: 1px dashed #94a3b8; background: rgba(148, 163, 184, .12); color: #64748b; font-size: 10px; }
.designer:not(.is-preview) .dz-el:hover { outline: 1px dashed color-mix(in srgb, var(--primary) 70%, transparent); }
.dz-el.is-sel { outline: 1.5px solid var(--primary) !important; overflow: visible; z-index: 2; }
.dz-handle { position: absolute; right: -5px; bottom: -5px; width: 10px; height: 10px; background: #fff; border: 1.5px solid var(--primary); border-radius: 2px; cursor: nwse-resize; }
.dz-guide { position: absolute; z-index: 3; background: #db2777; pointer-events: none; }
.dz-guide-v { top: 0; bottom: 0; width: 1px; }
.dz-guide-h { left: 0; right: 0; height: 1px; }
.designer.is-preview .dz-el { cursor: default; }
@media (max-width: 1100px) {
  .designer-body { grid-template-columns: 1fr; }
  .designer-panel { position: static; max-height: none; }
}

/* Spacing: card heading to its form, form to its buttons, and a card grid to the card below it */
.card > h2 + .form-grid { margin-top: 12px; }
.card > .form-grid + .form-actions { margin-top: 14px; }
.grid + .card { margin-top: 14px; }

/* Notice board: compose page (main column + "Message To" column), rich text editor, file drop */
.notice-compose-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px; align-items: start; }
.notice-compose-main, .notice-compose-side { display: grid; gap: 14px; }
.check-list { display: grid; gap: 8px; }
.check-list label { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.notice-card .card-head { align-items: flex-start; }
.notice-to { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.rich-text { font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; }
.rich-text p, .rich-text div { margin: 0 0 6px; }
.rich-text ul, .rich-text ol { margin: 4px 0 8px 20px; padding: 0; }
.rich-text ul { list-style: disc; } .rich-text ol { list-style: decimal; }
.rich-text blockquote { margin: 6px 0; padding: 4px 12px; border-left: 3px solid var(--border); color: var(--muted); }
.rich-editor { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.rich-editor:focus-within { border-color: var(--primary); }
.rich-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: 6px 6px 0 0; }
.rich-sep { width: 1px; height: 18px; background: var(--border); }
.rich-area { min-height: 260px; padding: 10px 12px; outline: none; }
.rich-area:empty::before { content: attr(data-placeholder); color: var(--muted); }
.file-drop { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 12px; border: 1.5px dashed var(--border); border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 13px; }
.file-drop:hover, .file-drop.dragging { border-color: var(--primary); background: var(--primary-50); }
.file-drop input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-drop .file-drop-icon { width: 16px; height: 16px; }
.file-drop.has-file { color: var(--text); }
@media (max-width: 820px) { .notice-compose-grid { grid-template-columns: 1fr; } }
.check-grid { grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.btn-group { display: inline-flex; }
.btn-group > .btn { border-radius: 0; margin-left: -1px; }
.btn-group > .btn:first-child { border-radius: 4px 0 0 4px; margin-left: 0; }
.btn-group > .btn:last-child { border-radius: 0 4px 4px 0; }
.rich-toolbar .rich-block { width: auto; min-width: 130px; height: 26px; padding: 0 8px; font-size: 12.5px; }
.rich-toolbar .btn .svg { width: 14px; height: 14px; }
.rich-text img { max-width: 100%; height: auto; border-radius: 4px; }
.rich-text a { color: var(--primary); text-decoration: underline; }
.rich-text h3 { font-size: 16px; margin: 8px 0 4px; } .rich-text h4 { font-size: 14px; margin: 8px 0 4px; }
.rich-text blockquote.indent, .rich-text blockquote[style*="border: none"] { border: 0 !important; padding: 0 !important; margin: 0 0 6px 32px !important; color: inherit; }
.notice-compose .draft-bar { position: static; margin-bottom: 14px; }
.notice-compose-grid.wide-side { grid-template-columns: minmax(0, 1fr) 260px; }
.list-thumb { width: 56px; height: 40px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); background: var(--surface-2); display: block; }
.card > .table-wrap + .toolbar { margin-top: 10px; }
.card > .toolbar + .switch { margin-top: 12px; }
.card > .switch + .form-actions { margin-top: 14px; }

/* ---------- Hostel ---------- */
/* rooms as cards with a line per bed */
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.room-card { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.room-card.is-off { opacity: .6; }
.room-card.is-editing { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent); }
.room-card-head { display: flex; align-items: center; gap: 8px; }
.room-card-head b { margin-right: auto; }
.bed-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); margin-top: 2px; }
.bed-row { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px; min-width: 0; }
.bed-row:last-child { border-bottom: 0; }
.bed-no { flex: none; width: 20px; height: 18px; display: inline-grid; place-items: center; border-radius: 3px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 600; }
.bed-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* allot: chosen student strip, vacate line */
.hostel-pick { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 12px 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); }
.vacate-row { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
/* collection form under a dues table */
.collect-bar { padding: 14px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
.suggest .input { min-width: 260px; }
.card.has-suggest { overflow: visible; }

/* ---------- Fee receipt: A4 sheet, student copy on top + school copy below (fees/receipt) ---------- */
@page feeA4 { size: A4; margin: 8mm; }
.fee-a4 { page: feeA4; width: 210mm; margin: 0 auto 20px; padding: 8mm; background: #fff; color: #111; box-shadow: 0 2px 12px rgba(15, 23, 42, .14);
  font-family: "Segoe UI", Arial, sans-serif; font-size: 9pt; line-height: 1.35; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.fee-copy { position: relative; height: 135mm; display: flex; flex-direction: column; gap: 2.2mm; padding: 4mm 5mm; border: 0.3mm solid #333; border-radius: 1.5mm; overflow: hidden; }
.fee-cut { height: 8mm; display: flex; align-items: center; justify-content: center; position: relative; color: #777; font-size: 7.5pt; }
.fee-cut::before { content: ""; position: absolute; left: -8mm; right: -8mm; top: 50%; border-top: 0.3mm dashed #999; }
.fee-cut span { position: relative; background: #fff; padding: 0 3mm; letter-spacing: .04em; }
/* header */
.fee-head { display: flex; align-items: center; gap: 4mm; padding-bottom: 2mm; border-bottom: 0.5mm solid #111; }
.fee-logo { width: 17mm; height: 17mm; object-fit: contain; flex: none; }
.fee-school { flex: 1; min-width: 0; text-align: center; }
.fee-school h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 17pt; font-weight: 700; letter-spacing: .02em; line-height: 1.1; color: #111; }
.fee-school > div { font-size: 8.5pt; color: #333; }
.fee-school-sub { font-size: 7.5pt !important; color: #555 !important; }
.fee-badge { flex: none; display: flex; flex-direction: column; align-items: center; gap: 1mm; }
.fee-badge b { padding: 1.2mm 3mm; background: #111; color: #fff; font-size: 8.5pt; letter-spacing: .06em; border-radius: 1mm; white-space: nowrap; }
.fee-badge span { font-size: 7pt; font-weight: 700; letter-spacing: .12em; color: #555; border: 0.25mm solid #999; padding: 0.4mm 2mm; border-radius: 1mm; }
/* student / payment info */
.fee-info { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
.fee-info th, .fee-info td { padding: 1mm 1.6mm; border: 0.25mm solid #bbb; text-align: left; vertical-align: middle; }
.fee-info th { width: 1%; white-space: nowrap; background: #f1f3f6; color: #444; font-weight: 600; font-size: 7.5pt; text-transform: uppercase; letter-spacing: .03em; }
/* fee lines */
.fee-table { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
.fee-table th { background: #111; color: #fff; font-size: 7.5pt; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 1.2mm 1.6mm; text-align: left; }
.fee-table td { padding: 1mm 1.6mm; border-bottom: 0.25mm solid #ddd; }
.fee-table tbody tr:nth-child(even) td { background: #f7f8fa; }
.fee-table .r, .fee-sum td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fee-period { color: #555; font-size: 7.8pt; }
/* totals */
.fee-bottom { display: flex; gap: 4mm; align-items: flex-start; margin-top: auto; }
.fee-words { flex: 1; display: grid; gap: 1.4mm; font-size: 8.5pt; }
.fee-words span { display: block; font-size: 7pt; text-transform: uppercase; letter-spacing: .05em; color: #666; }
.fee-sum { width: 62mm; flex: none; border-collapse: collapse; font-size: 8.5pt; }
.fee-sum th { text-align: left; font-weight: 500; color: #444; padding: 0.7mm 1.6mm; }
.fee-sum td { padding: 0.7mm 1.6mm; }
.fee-sum .fee-total th, .fee-sum .fee-total td { border-top: 0.4mm solid #111; padding-top: 1.4mm; font-size: 10.5pt; font-weight: 800; color: #111; }
/* signatures */
.fee-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 4mm; padding-top: 1mm; font-size: 8pt; }
.fee-foot > div:first-child { padding-top: 7mm; border-top: 0; min-width: 40mm; }
.fee-foot-note { flex: 1; text-align: center; font-size: 6.8pt; color: #666; line-height: 1.3; }
.fee-sign { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 40mm; }
.fee-sign img { height: 10mm; max-width: 38mm; object-fit: contain; }
.fee-sign .fee-seal { position: absolute; right: 28mm; bottom: 2mm; height: 15mm; opacity: .8; }
.fee-sign span { border-top: 0.25mm solid #333; padding-top: 0.6mm; width: 100%; text-align: center; font-weight: 600; }
.fee-void-mark { position: absolute; inset: 0; display: grid; place-items: center; font-size: 40pt; font-weight: 800; color: rgba(220, 38, 38, .22); transform: rotate(-18deg); pointer-events: none; letter-spacing: .1em; }
.fee-copy.is-void { border-color: #dc2626; }
/* many fee lines: tighter rows so the copy still fits half a page */
.fee-copy.is-compact { gap: 1.4mm; }
.fee-copy.is-compact .fee-table td { padding: 0.4mm 1.6mm; font-size: 7.8pt; }
.fee-copy.is-compact .fee-info th, .fee-copy.is-compact .fee-info td { padding: 0.6mm 1.6mm; }
.fee-copy.is-compact .fee-logo { width: 14mm; height: 14mm; }
@media print {
  .fee-a4 { width: auto; margin: 0; padding: 0; box-shadow: none; break-after: page; }
  .fee-a4:last-child { break-after: auto; }
  .content:has(.fee-a4) { padding: 0; }
  .toast-stack, [data-toast-stack] { display: none !important; }
}
@media screen and (max-width: 900px) { .fee-a4 { width: 100%; padding: 4mm; } .fee-copy { height: auto; } }

/* ---------- Chat (top bar icon + WhatsApp-style page) ---------- */
.chat-badge {
  position: absolute; top: -7px; right: -9px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 600;
  line-height: 16px; text-align: center; box-shadow: 0 0 0 2px var(--surface);
}
.chat {
  --chat-bg: #eef1f8; --chat-dot: rgba(79, 70, 229, .07); --chat-in: #fff; --chat-out: var(--primary); --chat-out-text: #fff;
  display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 130px); min-height: 420px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
:root[data-theme="dark"] .chat { --chat-bg: #0b1220; --chat-dot: rgba(148, 163, 184, .07); --chat-in: #1e293b; }

/* Left: list */
.chat-side { display: flex; flex-direction: column; border-right: 1px solid var(--border); min-height: 0; background: var(--surface); }
.chat-side-head { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 56px; background: var(--primary); color: #fff; }
.chat-side-head .input { width: 100%; background: rgba(255, 255, 255, .95); border-color: transparent; color: #0f172a; }
:root[data-theme="dark"] .chat-side-head .input { background: var(--surface-2); color: var(--text); }
.chat-list { flex: 1; overflow-y: auto; }
.chat-list-label { padding: 10px 14px 4px; font-size: 11px; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: .03em; }
.chat-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; border: 0;
  border-bottom: 1px solid var(--border); background: none; color: inherit; text-align: left; cursor: pointer; font: inherit;
}
.chat-item:hover { background: var(--surface-2); }
.chat-item.active { background: color-mix(in srgb, var(--primary) 10%, var(--surface)); box-shadow: inset 3px 0 0 var(--primary); }
.chat-item.unread .chat-item-top b { font-weight: 700; }
.chat-item.unread .chat-item-top .small { color: var(--primary); font-weight: 600; }
.chat-item.unread .chat-item-sub span:first-child { color: var(--text); }
.chat-item-body { flex: 1; min-width: 0; }
.chat-item-top { display: flex; justify-content: space-between; gap: 8px; }
.chat-item-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.chat-item-sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; color: var(--muted); font-size: 12px; }
.chat-item-sub span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #16a34a; color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; flex: none; }

/* Avatars: colour per person (av-0 … av-7, set by JS) */
.chat .avatar-initials { width: 38px; height: 38px; font-size: 13px; border: 0; color: #fff; background: #64748b; }
.chat .av-0 { background: #4f46e5; } .chat .av-1 { background: #0891b2; } .chat .av-2 { background: #16a34a; } .chat .av-3 { background: #d97706; }
.chat .av-4 { background: #db2777; } .chat .av-5 { background: #7c3aed; } .chat .av-6 { background: #dc2626; } .chat .av-7 { background: #0d9488; }

/* Empty states */
.chat-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.chat-placeholder { margin: auto; max-width: 300px; padding: 24px; text-align: center; color: var(--muted); }
.chat-placeholder-icon {
  display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 14%, var(--surface)); color: var(--primary);
}
.chat-placeholder-icon svg { width: 28px; height: 28px; }
.chat-placeholder b { display: block; margin-bottom: 4px; color: var(--text); font-size: 15px; }

/* Right: thread */
.chat-main {
  display: flex; flex-direction: column; min-height: 0;
  background-color: var(--chat-bg); background-image: radial-gradient(var(--chat-dot) 1.2px, transparent 1.2px); background-size: 18px 18px;
}
.chat-thread { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 56px; flex: none; background: var(--primary); color: #fff; }
.chat-head .muted { color: rgba(255, 255, 255, .8); }
.chat-head .avatar-initials { box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
.chat-back { display: none; background: transparent; border-color: rgba(255, 255, 255, .4); color: #fff; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px 6%; display: flex; flex-direction: column; gap: 6px; }
.chat-day { align-self: center; margin: 8px 0; padding: 3px 10px; border-radius: 4px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 600; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); }
.chat-msg {
  position: relative; max-width: 68%; padding: 6px 9px 4px; border-radius: 6px; background: var(--chat-in); color: var(--text);
  align-self: flex-start; border-top-left-radius: 0; box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-msg::before { content: ""; position: absolute; top: 0; left: -7px; border-style: solid; border-width: 0 7px 8px 0; border-color: transparent var(--chat-in) transparent transparent; }
.chat-msg.mine { align-self: flex-end; background: var(--chat-out); color: var(--chat-out-text); border-top-left-radius: 6px; border-top-right-radius: 0; }
.chat-msg.mine::before { left: auto; right: -7px; border-width: 8px 7px 0 0; border-color: var(--chat-out) transparent transparent transparent; }
.chat-msg-time { display: block; margin-top: 2px; font-size: 10px; color: var(--muted); text-align: right; }
.chat-msg.mine .chat-msg-time { color: rgba(255, 255, 255, .75); }
.chat-msg.mine .chat-msg-time.read { color: #a7f3d0; font-weight: 600; }
.chat-msg-img { display: block; max-width: 260px; max-height: 260px; margin: 2px -4px 4px; border-radius: 4px; cursor: pointer; }
.chat-msg-pdf { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; padding: 7px 9px; border-radius: 4px; background: var(--surface-2); color: var(--text); text-decoration: none; }
.chat-msg.mine .chat-msg-pdf { background: rgba(255, 255, 255, .16); color: #fff; }
.chat-msg-pdf b { padding: 2px 5px; border-radius: 3px; background: #dc2626; color: #fff; font-size: 10px; }

/* Send box */
.chat-attach-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px; background: var(--surface); border-top: 1px solid var(--border); font-size: 12px; }
.chat-attach-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-send { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--border); }
.chat-send textarea { flex: 1; resize: none; height: 40px; min-height: 40px; max-height: 120px; border-radius: 6px; background: var(--surface-2); }
.chat-send .btn-icon { width: 40px; height: 40px; flex: none; }
.chat-send-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; flex: none; display: grid; place-items: center; }
.chat-send-btn svg { width: 18px; height: 18px; }

@media (max-width: 760px) {
  .chat { grid-template-columns: 1fr; height: calc(100vh - 110px); }
  .chat.open .chat-side { display: none; }
  .chat:not(.open) .chat-main { display: none; }
  .chat-back { display: inline-flex; }
  .chat-msgs { padding: 12px; }
  .chat-msg { max-width: 85%; }
}

/* ---------- Printing lists and reports (any page with .table; Reports Center adds .print-report) ---------- */
.print-only { display: none; }
.print-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.print-bar .seg-choice { margin-left: 0; }
@page report { size: A4 portrait; margin: 10mm 9mm 12mm; @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 8pt Arial, sans-serif; color: #555; } }
@page reportWide { size: A4 landscape; margin: 9mm 9mm 11mm; @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 8pt Arial, sans-serif; color: #555; } }
@media print {
  /* always print light, even in dark mode */
  :root:root, :root:root[data-theme="dark"] { --surface: #fff; --surface-2: #f1f3f5; --text: #000; --muted: #333; --border: #b5b5b5; color-scheme: light; }
  body { background: #fff !important; color: #000 !important; }
  .content { padding: 0 !important; }
  .print-only { display: block !important; }
  .card-table-filters, .seg-tabs, .pagination, .card-table-foot, .row-actions, .print-bar { display: none !important; }
  /* tables: never cut columns, repeat the header on each page, keep rows whole, totals only once */
  .table-wrap { overflow: visible !important; border: 0 !important; margin: 0 !important; border-radius: 0 !important; }
  table.table { width: 100%; font-size: 9pt; border-collapse: collapse; }
  .table thead { display: table-header-group; }
  .table tfoot { display: table-row-group; }
  .table tr { break-inside: avoid; page-break-inside: avoid; }
  .table th, .table td { padding: 3.5pt 5pt !important; border: 0.5pt solid #b5b5b5 !important; color: #000 !important; white-space: normal !important; overflow-wrap: break-word; vertical-align: top; }
  .table th { background: #e9ecef !important; font-size: 7.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table tbody tr:nth-child(even) td { background: #f7f7f7 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table tbody tr:hover { background: none !important; }
  .table tfoot th, .table tfoot td { background: #e9ecef !important; font-weight: 700; }
  .card .table th:first-child, .card .table td:first-child, .card .table th:last-child, .card .table td:last-child { padding-left: 5pt !important; padding-right: 5pt !important; }
  /* Reports Center sheet */
  /* the whole document uses the named page, so switching pages never adds a blank first page */
  body:has(.print-report) { page: report; }
  body:has(.print-report.print-landscape) { page: reportWide; }
  .print-report { border: 0 !important; box-shadow: none !important; background: #fff !important; }
  .print-report.print-dense table.table { font-size: 7.5pt; }
  .print-report.print-dense .table th, .print-report.print-dense .table td { padding: 2.5pt 3.5pt !important; }
  .print-head { display: grid !important; grid-template-columns: 1fr 1.4fr auto; align-items: end; gap: 8pt; padding: 0 0 6pt !important; margin-bottom: 6pt; border-bottom: 1.2pt solid #000; }
  .print-head-school b { display: block; font-size: 12pt; }
  .print-head-school span, .print-head-title span { display: block; font-size: 8pt; color: #333; }
  .print-head-title { text-align: center; }
  .print-head-title b { font-size: 12pt; }
  .print-head-meta { text-align: right; font-size: 8pt; color: #333; }
}

/* thin footer strip at the bottom of every page */
.app-footer { margin-top: auto; padding: 6px 20px; border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 10.5px; text-align: right; }

/* Top bar icons: one colour each */
.topbar-btn.tb-menu { color: #475569; }
.topbar-btn.tb-search { color: #0284c7; }
.topbar-btn.tb-fees { color: #16a34a; }
.topbar-btn.tb-chat { color: #7c3aed; }
.topbar-btn.tb-add { color: #ea580c; }
.topbar-btn.tb-bell { color: #db2777; }
.topbar-btn.tb-apps { color: #4f46e5; }
.topbar-btn.tb-menu:hover, .topbar-btn.tb-search:hover, .topbar-btn.tb-fees:hover, .topbar-btn.tb-chat:hover,
.topbar-btn.tb-add:hover, .topbar-btn.tb-bell:hover, .topbar-btn.tb-apps:hover { background: color-mix(in srgb, currentColor 12%, var(--surface)); }

/* Sidebar: smaller text, icons and rows */
.sidebar .nav-link, .sidebar .nav-summary { gap: 9px; min-height: 32px; padding: 3px 8px 3px 6px; font-size: 12.5px; }
.sidebar .nav-ico { width: 22px; height: 22px; border-radius: 4px; }
.sidebar .nav-ico .nav-icon, .sidebar .nav-link:hover .nav-icon, .sidebar .nav-summary:hover .nav-icon { width: 13px; height: 13px; }
.sidebar .nav-summary .chev { width: 11px; height: 11px; }
.sidebar .nav-section-items { gap: 1px; }
.sidebar .nav-section-label { font-size: 9.5px; padding: 8px 8px 4px; }
.sidebar .nav-sub { margin: 1px 0 4px 17px; padding-left: 10px; }
.sidebar .nav-sub-link { min-height: 27px; padding: 3px 8px; font-size: 12px; line-height: 18px; }
.sidebar .nav-search-wrap { height: 32px; }
.sidebar .nav-search { font-size: 12px; }

/* Sidebar header (school name) and search: smaller */
.sidebar .brand { gap: 8px; padding: 8px 12px; min-height: 46px; }
.sidebar .brand img, .sidebar .brand .brand-logo, .sidebar .brand .logo-fallback { width: 26px; height: 26px; }
.sidebar .brand .logo-fallback { font-size: 12px; }
.sidebar .brand-name { font-size: 12px; }
.sidebar .session-text { font-size: 10px; }
.sidebar .nav-search-wrap { margin: 8px 10px 0; height: 28px; }
.sidebar .nav-search { font-size: 11.5px; }
.sidebar .nav-search-icon { width: 13px; height: 13px; }
.sidebar .nav { margin-top: 8px; }

/* Photo grids (Website CMS gallery): square-ish tiles, trash button on the corner */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo-tile { position: relative; margin: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.photo-tile img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo-tile form { position: absolute; top: 6px; right: 6px; }
.upload-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.upload-row .file-drop { flex: 1 1 320px; }
.folder-cover { width: 64px; height: 46px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); background: var(--surface-2); display: block; }
/* Website CMS: hiring on/off bar, extra form fields shown inline */
.hiring-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hiring-card h2 { margin: 0 0 2px; }
.kv-inline { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 2px 0 4px; }
/* Dashboard: Admission Open / Closed button, slider slide preview */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-dot.on { background: var(--success); }
.slide-thumb { width: 120px; height: 56px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); display: block; }
.slide-preview { max-width: 640px; position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: 6px; aspect-ratio: 16 / 7; background: var(--surface-2); }
.slide-preview img { position: absolute; right: 0; top: 0; width: 70%; height: 100%; object-fit: cover; }
.slide-preview::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #fff 30%, rgba(255,255,255,.85) 45%, rgba(255,255,255,0) 75%); }
.slide-preview-copy { position: absolute; z-index: 1; left: 16px; top: 50%; transform: translateY(-50%); width: 48%; }
.slide-preview-copy small { display: inline-block; padding: 2px 8px; border-radius: 4px; background: #FDEBDD; color: #C25A06; font-size: 10px; font-weight: 600; }
.slide-preview-copy b { display: block; margin-top: 6px; font-size: 16px; line-height: 1.25; color: #12384F; }
.slide-preview-copy b span[data-show="highlight"] { color: #E8710A; }
.slide-preview-copy p { margin: 6px 0 0; font-size: 11px; line-height: 1.45; color: #4A5B67; }
.slide-preview-copy small:empty { display: none; }
.popup-banner-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 700px) { .popup-banner-row { grid-template-columns: 1fr; } }
.popup-banner-fields { align-content: start; }
.col-thumb { width: 136px; }
.popup-thumb { width: 60px; height: 76px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); display: block; }

/* Shared form helpers: picture box on the left + fields (staff form), space above a block, hint under a field */
.media-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 700px) { .media-row { grid-template-columns: 1fr; } }
.form-gap-top { margin-top: 12px; }
.field-hint { display: block; font-size: 12px; color: var(--primary); background: var(--primary-50); border-radius: 4px; padding: 5px 8px; margin-top: 4px; }
/* Name + amount rows (salary allowances / deductions) */
.pay-block .form-section-title { margin-top: 0; }
.pay-lines { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 6px 8px; }
.pay-lines .input:nth-child(even) { text-align: right; }
/* Document name + file rows */
.doc-row { grid-template-columns: 1fr 1.4fr; }
.doc-row + .doc-row { margin-top: 8px; }

/* Profile pages (staff): meta line, tiles, two-column grid */
.profile-main { flex: 1; min-width: 220px; display: grid; gap: 6px; }
.profile-main h1 { margin: 0; }
.profile-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; }
.profile-meta .svg { width: 14px; height: 14px; vertical-align: -2px; }
.profile-alert { margin: 4px 0 0; }
.profile-tiles { margin: 16px 0; }
.profile-grid { margin-top: 16px; align-items: start; }
.profile-side { gap: 16px; }
.form-section-title.profile-first { margin-top: 0; }
.profile-note { margin: 0; white-space: pre-line; }
.kv .kv-full { grid-column: 1 / -1; }
.kv.kv-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.input.input-auto { width: auto; max-width: 220px; }
.list-row-total { font-weight: 700; border-top: 1px solid var(--border); }
.field > .seg-choice { justify-self: start; }
.field > .seg-choice span { padding: 7px 16px; font-size: 13px; }
.payslip-employer { margin-top: 4px; color: #555; }

/* <x-academic-steps>: 1 Subjects -> 2 Class Subjects -> 3 Timetable */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.step { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); text-decoration: none; }
.step:hover { border-color: var(--primary); }
.step b { display: block; font-size: 13px; }
.step small { display: block; font-size: 11.5px; color: var(--muted); }
.step-no { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: 12px; }
.step.active { border-color: var(--primary); background: var(--primary-50); }
.step.active .step-no { background: var(--primary); color: #fff; }
.step.done .step-no { background: #16a34a; color: #fff; }
@media (max-width: 700px) { .steps { grid-template-columns: 1fr; } }
/* Tick chips (Class Subjects: subjects of the class) */
.pick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pick-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); font-size: 12.5px; cursor: pointer; }
.pick-chip:has(input:checked) { border-color: var(--primary); background: var(--primary-50); color: var(--primary); font-weight: 600; }
.col-order { width: 70px; }
/* Simple two-column page: form on the left, list on the right */
.split-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); align-items: start; }
@media (max-width: 900px) { .split-form { grid-template-columns: 1fr; } }
.form-stack { gap: 12px; }
/* Class timetable grid */
.tt-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.tt-ct { display: grid; gap: 10px; }
.tt-grid th, .tt-grid td { vertical-align: top; }
.tt-head { text-align: center; min-width: 140px; }
.tt-cell { display: table-cell; }
.tt-cell .input { padding: 5px 7px; font-size: 12.5px; }
.tt-cell .input + .input, .tt-cell .input + .tt-fixed { margin-top: 4px; }
.tt-fixed { padding: 5px 7px; font-size: 12.5px; border-radius: 4px; background: var(--primary-50); color: var(--primary); font-weight: 600; }
.tt-break { text-align: center; color: var(--muted); background: var(--surface-2); font-size: 12px; }
.tt-cell option:disabled { color: #9ca3af; }

/* Exams: steps bar takes 3 or 4 steps; exam setup pages */
.steps { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
@media (max-width: 700px) { .steps { grid-auto-flow: row; } }
.exam-side { gap: 16px; }
.exam-weights { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.exam-weights .muted.small:last-child { flex-basis: 100%; }
.exam-table td { vertical-align: top; }
.exam-table td .btn { margin-top: 4px; }
.col-check { width: 36px; }
.es-marks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.es-comp { display: inline-flex; gap: 4px; }
.es-comp [data-c-label] { width: 100px; }
.es-marks[data-split="0"] .es-comp:not(:first-child), .es-marks[data-split="0"] [data-c-label] { display: none; }
.es-time { width: 110px; }
.es-room { width: 80px; }
.result-actions { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.result-alert { margin-top: 16px; }
/* split marks: show the filled parts + one empty part to add another */
.es-marks[data-split="1"] .es-comp:has([data-c-label]:placeholder-shown) ~ .es-comp:has([data-c-label]:placeholder-shown) { display: none; }
.exam-table td:first-child { min-width: 170px; }
/* locked (has marks): no empty parts */
.es-marks:not(:has([data-split-toggle])) .es-comp:has([data-c-label]:placeholder-shown) { display: none; }

/* ---------- Public form pages (Online Registration / Online Admission / Enquiry; ?embed=1 inside the school website) ---------- */
.public-wrap { max-width: 980px; margin: 0 auto; padding: 20px; }
.public-embed { background: transparent; }
.public-embed .public-wrap { max-width: none; padding: 4px; }
.public-head { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.public-head img { height: 64px; }
.public-head h1 { margin: 0; }
.public-hp { position: absolute; left: -9999px; }
.public-note { display: block; white-space: pre-line; }
.public-submit { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.public-submit .input { max-width: 90px; }
.public-submit .btn { margin-left: auto; }
.form-grid .span-full { grid-column: 1 / -1; }
.input.input-sm { height: 30px; padding: 4px 8px; width: auto; max-width: 140px; }
