/* ── Shared sticky top toolbar (CRM / Schedule / Finance / Teachers / Admin) ── */

.db-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(8, 8, 8, 0.82);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 200;
  flex-wrap: wrap;
}

.db-toolbar__left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.db-title {
  margin: 0;
  font-family: 'Oswald', sans-serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.db-toolbar__center {
  flex: 1;
  max-width: 560px;
  min-width: 320px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.db-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 230px;
  min-width: 160px;
}

.db-search-icon {
  position: absolute;
  left: 10px;
  color: rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.db-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 7px 12px 7px 32px;
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.db-search-input:focus { border-color: rgba(255, 255, 255, 0.25); }
.db-search-input::placeholder { color: rgba(255, 255, 255, 0.3); }

.db-toolbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.db-org-switch {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px 10px;
  color: #fff;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.db-org-switch:focus { border-color: rgba(255, 255, 255, 0.25); }
.db-org-switch:disabled { opacity: 0.5; cursor: wait; }
.db-org-switch option { background: #181818; color: #fff; }

/* ── Toolbar inline nav ────────────────────────────────────────────── */

.db-tb-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.db-tb-nav__link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.38);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.db-tb-nav__link svg { flex-shrink: 0; transition: stroke 0.15s; }
.db-tb-nav__label {
  font-family: 'Oswald', sans-serif;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
}
.db-tb-nav__badge {
  position: absolute;
  top: 2px;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e05a52;
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}
.db-tb-nav__badge[hidden] { display: none; }
.db-tb-nav__link:hover { color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.07); }
.db-tb-nav__link--active { color: #fff; background: rgba(194,53,43,0.2); }
.db-tb-nav__link--active svg { stroke: #e05a52; }
.db-tb-nav.is-hidden { display: none !important; }

/* Separator between nav and action buttons */
.db-tb-sep {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  margin: 0 2px;
}

/* Toolbar toggle button */
.db-tb-toggle {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.35);
  border-radius: 7px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 11px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.db-tb-toggle:hover { color: #fff; border-color: rgba(255,255,255,0.28); background: rgba(255,255,255,0.07); }

/* ── Personal settings burger (teacher cabinet) ────────────────────── */
.tc-burger { position: relative; flex-shrink: 0; }
.tc-burger__trigger {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.55);
  border-radius: 7px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.tc-burger__trigger:hover,
.tc-burger[data-open="1"] .tc-burger__trigger {
  color: #fff;
  border-color: rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.07);
}
.tc-burger__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 24px);
  max-height: 80vh;
  overflow-y: auto;
  background: #161616;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  padding: 14px;
  z-index: 60;
}
.tc-burger__section + .tc-burger__section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.tc-burger__section-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.45);
}
.tc-burger__toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}
.tc-burger__toggle-row input[type="checkbox"] { flex-shrink: 0; width: 16px; height: 16px; }
.tc-burger__theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.tc-burger__theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 9px;
  padding: 8px 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.tc-burger__theme-option:hover { border-color: rgba(255,255,255,0.28); background: rgba(255,255,255,0.07); }
.tc-burger__theme-option.is-selected { border-color: rgba(194,53,43,0.6); background: rgba(194,53,43,0.14); }
.tc-burger__theme-swatch {
  display: flex;
  width: 100%;
  height: 18px;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
}
.tc-burger__theme-swatch span { flex: 1; }
.tc-burger__theme-option small {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  text-align: center;
  line-height: 1.2;
}
.tc-burger__theme-option.is-selected small { color: #fff; }
.tc-burger__logout {
  width: 100%;
  background: rgba(194, 53, 43, 0.14);
  border: 1px solid rgba(194, 53, 43, 0.32);
  color: rgba(255, 120, 110, 0.95);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.tc-burger__logout:hover { background: rgba(194, 53, 43, 0.26); color: #fff; }

/* ── Toolbar density states ────────────────────────────────────────── */

/* Elements hidden in slim + mini */
.db-toolbar--slim .db-tb-full-only,
.db-toolbar--mini .db-tb-full-only { display: none !important; }

/* Labels hidden in slim + mini */
.db-toolbar--slim .db-tb-nav__label,
.db-toolbar--mini .db-tb-nav__label { display: none !important; }

/* Elements hidden only in mini */
.db-toolbar--mini .db-tb-no-mini { display: none !important; }

/* Mini mode: compact toolbar */
.db-toolbar--mini { padding: 4px 10px; }
.db-toolbar--mini .db-toolbar__center { display: none !important; }

/* Toolbar action buttons */
.db-toolbar-action {
  font-family: inherit;
  font-size: 12px;
  padding: 6px 11px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
}
.db-toolbar-action--sched {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.55);
}
.db-toolbar-action--sched:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
}
.db-toolbar-action--add {
  background: rgba(194, 53, 43, 0.18);
  border: 1px solid rgba(194, 53, 43, 0.35);
  color: rgba(255, 120, 110, 0.95);
}
.db-toolbar-action--add:hover {
  background: rgba(194, 53, 43, 0.3);
  border-color: rgba(194, 53, 43, 0.6);
  color: #fff;
}

/* ── Live clock widget ─────────────────────────────────────────────── */
.db-tb-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  line-height: 1.15;
  flex-shrink: 0;
  padding: 0 2px;
}
.db-tb-clock__time {
  display: inline-block;
  min-width: 8.5ch;
  font-family: 'Oswald', sans-serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
  white-space: nowrap;
  text-align: right;
}
.db-tb-clock__date {
  display: inline-block;
  min-width: 15ch;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.45);
  text-transform: capitalize;
  white-space: nowrap;
  text-align: right;
}
.db-toolbar--mini .db-tb-clock__date { display: none; }
.db-toolbar--mini .db-tb-clock__time { font-size: 15px; }

/* Small filter chips (e.g. Finance month shortcuts) */
.db-toolbar-chip {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.55);
  font-family: inherit;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.db-toolbar-chip:hover { color: #fff; border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.1); }

/* Shared left application sidebar */

/* Keep the application shell visually persistent during same-origin page
   navigation. The page content may transition, but the sidebar is swapped
   atomically and never participates in the document cross-fade. */
@view-transition {
  navigation: auto;
}

.app-sidebar {
  view-transition-name: app-sidebar;
}

::view-transition-group(app-sidebar),
::view-transition-new(app-sidebar) {
  animation: none;
}

::view-transition-old(app-sidebar) {
  z-index: 2;
  animation: app-sidebar-hold 280ms linear both;
}

::view-transition-new(app-sidebar) {
  z-index: 1;
  opacity: 1;
  mix-blend-mode: normal;
}

@keyframes app-sidebar-hold {
  from,
  to { opacity: 1; }
}

body.has-app-sidebar {
  --app-sidebar-width: 176px;
  padding-left: var(--app-sidebar-width);
  transition: padding-left 0.2s ease;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 420;
  display: flex;
  width: var(--app-sidebar-width);
  min-width: 0;
  flex-direction: column;
  background: color-mix(in srgb, var(--ui-page, #080808) 97%, transparent);
  border-right: 1px solid var(--ui-border-soft, rgba(255, 255, 255, 0.08));
  box-shadow: 14px 0 36px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px);
  transition: width 0.2s ease, transform 0.2s ease;
  overflow: visible;
}

.app-sidebar__brand {
  display: flex;
  min-height: 74px;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ui-border-soft, rgba(255, 255, 255, 0.07));
  overflow: hidden;
}

.app-sidebar__brand-mark {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--ui-accent, #c2352b) 42%, transparent);
  border-radius: 11px;
  background: var(--ui-accent-soft, rgba(194, 53, 43, 0.16));
  color: var(--ui-accent-text, #e05a52);
  font-family: 'Oswald', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.app-sidebar__brand-name {
  min-width: 0;
  color: var(--ui-text, #fff);
  font-family: 'Oswald', sans-serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.035em;
  line-height: 1.15;
}

.app-sidebar__brand-name-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-sidebar__nav {
  min-height: 0;
  flex: 1;
  padding: 14px 10px;
  overflow: hidden auto;
}

.app-sidebar__organization {
  flex: 0 0 auto;
  padding: 10px;
  border-top: 1px solid var(--ui-border-soft, rgba(255, 255, 255, 0.07));
  overflow: hidden;
}

.app-sidebar__organization:empty {
  display: none;
}

.app-sidebar__footer {
  flex: 0 0 auto;
  padding: 10px;
  border-top: 1px solid var(--ui-border-soft, rgba(255, 255, 255, 0.07));
}

.app-sidebar-logout {
  width: 100%;
}

.app-sidebar-logout:hover {
  color: var(--ui-accent-text, #e05a52);
}

.app-sidebar-org {
  position: relative;
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border: 1px solid var(--ui-border-soft, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  background: var(--ui-surface-soft, rgba(255, 255, 255, 0.035));
  color: var(--ui-muted, rgba(255, 255, 255, 0.48));
}

.app-sidebar-org__icon {
  flex: 0 0 18px;
}

.app-sidebar-org__content {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.app-sidebar-org__label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-sidebar-org .app-sidebar-org__select {
  width: 100%;
  min-width: 0;
  padding: 3px 20px 3px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ui-text, rgba(255, 255, 255, 0.82));
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
}

.app-sidebar .db-tb-nav {
  display: flex;
  width: 100%;
  align-items: stretch;
  flex-direction: column;
  gap: 5px;
}

.app-sidebar .db-tb-nav__link {
  min-height: 46px;
  flex-direction: row;
  justify-content: flex-start;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ui-muted, rgba(255, 255, 255, 0.38));
}

.app-sidebar .db-tb-nav__link:hover {
  border-color: var(--ui-border-soft, rgba(255, 255, 255, 0.08));
  background: var(--ui-surface-soft, rgba(255, 255, 255, 0.07));
  color: var(--ui-text, rgba(255, 255, 255, 0.8));
}

.app-sidebar .db-tb-nav__link svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.app-sidebar .db-tb-nav__label {
  overflow: hidden;
  font-family: Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
  text-overflow: ellipsis;
  text-transform: none;
}

.app-sidebar .db-tb-nav__link--active {
  border-color: color-mix(in srgb, var(--ui-accent, #c2352b) 48%, transparent);
  background: var(--ui-accent-soft, rgba(194, 53, 43, 0.2));
  color: var(--ui-accent-text, #fff);
}

.app-sidebar .db-tb-nav__link--active svg {
  stroke: var(--ui-accent-text, #e05a52);
}

.app-sidebar-compact .app-sidebar__brand {
  justify-content: center;
  padding-inline: 8px;
}

.app-sidebar-compact .app-sidebar__brand-name,
.app-sidebar-compact .app-sidebar .db-tb-nav__label {
  display: none;
}

.app-sidebar-compact .app-sidebar__nav {
  padding-inline: 8px;
}

.app-sidebar-compact .app-sidebar .db-tb-nav__link {
  justify-content: center;
  padding-inline: 8px;
}

.app-sidebar-compact .app-sidebar__organization,
.app-sidebar-compact .app-sidebar__footer {
  padding-inline: 8px;
}

.app-sidebar-compact .app-sidebar-org {
  min-height: 46px;
  justify-content: center;
  padding: 8px;
}

.app-sidebar-compact .app-sidebar-org__content {
  position: absolute;
  inset: 0;
}

.app-sidebar-compact .app-sidebar-org__label {
  display: none;
}

.app-sidebar-compact .app-sidebar-org .app-sidebar-org__select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.app-sidebar-hidden .app-sidebar__brand,
.app-sidebar-hidden .app-sidebar__nav,
.app-sidebar-hidden .app-sidebar__organization {
  opacity: 0;
  pointer-events: none;
}

.app-sidebar__resizer {
  position: absolute;
  top: 0;
  right: -10px;
  bottom: 0;
  z-index: 2;
  width: 16px;
  cursor: col-resize;
  touch-action: none;
  outline: none;
}

.app-sidebar__resizer::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 46px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--ui-text, #fff) 24%, transparent);
  transform: translate(-50%, -50%);
  transition: background 0.15s ease, height 0.15s ease;
}

.app-sidebar__resizer:hover::before,
.app-sidebar__resizer.is-dragging::before,
.app-sidebar__resizer:focus-visible::before {
  height: 72px;
  background: color-mix(in srgb, var(--ui-accent-2, #d6463d) 75%, transparent);
}

.app-sidebar-hidden .app-sidebar__resizer::before {
  background: color-mix(in srgb, var(--ui-accent, #c2352b) 55%, transparent);
}

.app-sidebar-resizing,
.app-sidebar-resizing .app-sidebar {
  transition: none !important;
}

.has-app-sidebar .db-toolbar {
  z-index: 400;
  min-height: 54px;
  padding: 8px 12px;
  align-items: center;
}

.has-app-sidebar .db-toolbar > .db-toolbar__left > .db-title {
  display: none !important;
}

.has-app-sidebar .db-toolbar > .db-toolbar__left > .db-title + .db-tb-sep {
  display: none !important;
}

.has-app-sidebar .db-toolbar__center {
  max-width: none;
  min-width: 260px;
}

.has-app-sidebar .db-toolbar__right {
  flex-wrap: nowrap;
}

.has-app-sidebar .db-tb-clock__time {
  font-size: 17px;
}

.has-app-sidebar .db-tb-clock__date {
  font-size: 9px;
}

.app-toolbar-filter-row {
  display: flex;
  order: 20;
  width: 100%;
  min-width: 0;
  flex: 1 0 100%;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 7px 2px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
  overflow: visible;
}

.app-filter-group {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.app-filter-group--wide {
  flex: 0 1 auto;
}

.app-filter-group__label {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.33);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.app-filter-select,
.app-toolbar-filter-row select {
  min-height: 32px;
  padding: 6px 28px 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  outline: none;
  background-color: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.76);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.app-filter-select:hover,
.app-filter-select:focus,
.app-toolbar-filter-row select:hover,
.app-toolbar-filter-row select:focus {
  border-color: rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.08);
}

.app-filter-select option,
.app-toolbar-filter-row select option {
  background: #181818;
  color: #fff;
}

/* Custom toolbar select. Native select stays hidden for existing JS APIs, while
   the popup is rendered by the app instead of the operating system. */
.app-custom-select {
  position: relative;
  width: 100%;
  min-width: 150px;
  max-width: 100%;
}

.app-custom-select.is-source-hidden {
  display: none !important;
}

.app-custom-select__native {
  display: none !important;
}

.app-custom-select__trigger {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  outline: none;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.76);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.app-custom-select__search {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: none;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  outline: none;
  background: #171717;
  color: rgba(255, 255, 255, 0.9);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
}

.app-custom-select__search::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.app-custom-select.is-searching .app-custom-select__trigger {
  visibility: hidden;
}

.app-custom-select.is-searching .app-custom-select__search {
  display: block;
}

.app-custom-select__trigger:hover,
.app-custom-select__trigger:focus-visible,
.app-custom-select.is-open .app-custom-select__trigger {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.app-custom-select__value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-custom-select__chevron {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.42);
  font-size: 13px;
  line-height: 1;
  transform: translateY(-1px);
  transition: transform 0.16s ease;
}

.app-custom-select.is-open .app-custom-select__chevron {
  transform: translateY(1px) rotate(180deg);
}

.app-custom-select.is-disabled {
  opacity: 0.45;
}

.app-custom-select__menu {
  position: fixed;
  z-index: 10050;
  display: none;
  max-height: min(300px, calc(100vh - 20px));
  padding: 5px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(18, 18, 18, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(18px);
}

.app-custom-select__menu.is-open {
  display: grid;
  gap: 2px;
}

.app-custom-select__option {
  width: 100%;
  min-height: 32px;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.app-custom-select__option:hover,
.app-custom-select__option:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.94);
}

.app-custom-select__option.is-selected {
  background: rgba(184, 71, 43, 0.16);
  color: rgba(255, 184, 157, 0.96);
}

.app-custom-select__option:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.app-custom-select__empty {
  padding: 12px 9px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 11px;
  text-align: center;
}

.app-sidebar-org .app-custom-select {
  width: 100%;
  min-width: 0;
}

.app-filter-group .app-custom-select {
  width: auto;
}

/* ── Notification bell (topbar.js) ───────────────────────────────────── */
.db-notif {
  position: relative;
}

.db-notif__bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.db-notif__bell:hover { color: rgba(255, 255, 255, 0.9); background: rgba(255, 255, 255, 0.07); }

.db-notif__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e05a52;
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}
.db-notif__badge[hidden] { display: none; }

.db-notif__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10050;
  display: none;
  width: min(340px, calc(100vw - 24px));
  max-height: min(420px, calc(100vh - 80px));
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(18, 18, 18, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(18px);
  overflow: hidden;
}
.db-notif__panel.is-open { display: flex; }

.db-notif__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  font-family: 'Oswald', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.db-notif__head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.db-notif__mark-all {
  border: 0;
  background: transparent;
  color: rgba(224, 90, 82, 0.9);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.db-notif__mark-all:hover { color: #e05a52; }

.db-notif__sound-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
}
.db-notif__sound-toggle:hover { color: rgba(255, 255, 255, 0.95); background: rgba(255, 255, 255, 0.08); }
.db-notif__sound-toggle.is-muted { color: rgba(224, 90, 82, 0.9); }

.db-notif__desktop-prompt {
  display: block;
  width: 100%;
  padding: 7px 12px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(224, 90, 82, 0.12);
  color: rgba(255, 255, 255, 0.85);
  font-family: Arial, sans-serif;
  font-size: 11.5px;
  text-align: left;
  cursor: pointer;
}
.db-notif__desktop-prompt:hover { background: rgba(224, 90, 82, 0.2); }
.db-notif__desktop-prompt[hidden] { display: none; }

.db-notif__list {
  overflow-y: auto;
  padding: 5px;
}

.db-notif__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  text-align: left;
  cursor: pointer;
}
.db-notif__item:hover { background: rgba(255, 255, 255, 0.07); }
.db-notif__item.is-unread { background: rgba(194, 53, 43, 0.12); }
.db-notif__item.is-unread:hover { background: rgba(194, 53, 43, 0.2); }

.db-notif__item-title {
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 600;
}
.db-notif__item-body {
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
}
.db-notif__item-time {
  color: rgba(255, 255, 255, 0.35);
  font-size: 10px;
}

.db-notif__empty {
  margin: 0;
  padding: 18px 9px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 11px;
  text-align: center;
}

/* ── Inbox toast: fades in under the bell for a brand-new message ──────── */
.db-notif-toast {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10051;
  width: min(280px, calc(100vw - 24px));
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border: 1px solid rgba(194, 53, 43, 0.35);
  border-radius: 10px;
  background: rgba(24, 16, 16, 0.98);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.db-notif-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.db-notif-toast__title {
  color: rgba(255, 255, 255, 0.94);
  font-size: 12px;
  font-weight: 700;
}
.db-notif-toast__body {
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
}

/* ── Reply panel: floating mini conversation window, top-right ─────────── */
.db-reply-panel {
  position: fixed;
  top: 66px;
  right: 16px;
  z-index: 10052;
  display: none;
  flex-direction: column;
  width: min(320px, calc(100vw - 24px));
  max-height: min(440px, calc(100vh - 90px));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(18, 18, 18, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(18px);
  overflow: hidden;
}
.db-reply-panel.is-open { display: flex; }

.db-reply-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.db-reply-panel__name {
  display: block;
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 700;
}
.db-reply-panel__provider {
  display: block;
  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.db-reply-panel__head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.db-reply-panel__open,
.db-reply-panel__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.db-reply-panel__open:hover,
.db-reply-panel__close:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

.db-reply-panel__body {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.db-reply-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 85%;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.88);
}
.db-reply-msg--in {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.07);
  border-bottom-left-radius: 3px;
}
.db-reply-msg--out {
  align-self: flex-end;
  background: rgba(194, 53, 43, 0.28);
  border-bottom-right-radius: 3px;
}
.db-reply-msg__text { white-space: pre-wrap; word-break: break-word; }
.db-reply-msg__time {
  align-self: flex-end;
  color: rgba(255, 255, 255, 0.38);
  font-size: 9px;
}

.db-reply-panel__composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.db-reply-panel__composer textarea {
  flex: 1;
  resize: none;
  max-height: 90px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font: inherit;
  font-size: 12px;
}
.db-reply-panel__composer textarea:focus { outline: none; border-color: rgba(194, 53, 43, 0.5); }
.db-reply-panel__composer button {
  flex-shrink: 0;
  padding: 7px 12px;
  border: 0;
  border-radius: 8px;
  background: #c2352b;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.db-reply-panel__composer button:hover { background: #d6453a; }
.db-reply-panel__composer button:disabled { opacity: 0.5; cursor: not-allowed; }

.app-filter-group .app-custom-select__trigger,
.db-toolbar__right > .app-custom-select .app-custom-select__trigger {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 11px;
}

.app-sidebar-org .app-custom-select__trigger {
  min-height: 22px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--ui-text, rgba(255, 255, 255, 0.82));
}

.app-sidebar-org .app-custom-select__chevron {
  color: var(--ui-muted, rgba(255, 255, 255, 0.42));
}

.db-toolbar__right > .app-custom-select {
  min-width: 72px;
  width: auto;
}

.org-field .app-custom-select__trigger {
  min-height: 44px;
  padding: 10px 12px;
  border-color: rgba(255, 255, 255, 0.11);
  border-radius: 9px;
  background: #111;
  color: #fff;
}

.org-field .app-custom-select__trigger:hover,
.org-field .app-custom-select__trigger:focus-visible,
.org-field .app-custom-select.is-open .app-custom-select__trigger {
  border-color: #c95850;
  background: #111;
}

.app-custom-select:has(> select.dir-inline-input) .app-custom-select__trigger {
  min-height: 36px;
  height: 36px;
  padding: 0 10px;
  border-color: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-size: 14px;
}

.app-filter-source {
  display: none !important;
}

.app-filter-select-source {
  display: flex;
  align-items: center;
}

.app-filter-reset {
  min-height: 30px;
  margin-left: auto;
  padding: 5px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.34);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
  white-space: nowrap;
}

.app-filter-reset:hover {
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.7);
}

.app-toolbar-secondary-action {
  min-height: 32px !important;
  margin: 0 !important;
  padding: 6px 11px !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  font-size: 11px !important;
  white-space: nowrap;
}

.app-toolbar-utility {
  flex: 0 0 auto;
}

.app-toolbar-filter-toggle {
  display: none;
  min-height: 32px;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.64);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.app-toolbar-filter-toggle:hover,
.app-toolbar-filter-toggle[aria-expanded="true"] {
  border-color: rgba(194, 53, 43, 0.36);
  background: rgba(194, 53, 43, 0.14);
  color: rgba(255, 255, 255, 0.86);
}

.has-tiered-toolbar .finance-section,
.has-tiered-toolbar .finance-group,
.has-tiered-toolbar .analytics-section {
  scroll-margin-top: 120px;
}

.app-sidebar-mobile-toggle {
  display: none;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ui-border, rgba(255, 255, 255, 0.1));
  border-radius: 9px;
  background: var(--ui-surface-soft, rgba(255, 255, 255, 0.05));
  color: var(--ui-muted, rgba(255, 255, 255, 0.72));
  cursor: pointer;
}

.app-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 410;
  padding: 0;
  border: 0;
  background: var(--ui-backdrop, rgba(0, 0, 0, 0.64));
}

/* Existing page filters are moved here as the same live DOM nodes. */
.has-app-sidebar .app-toolbar-filter {
  margin: 0;
  box-shadow: none;
}

.has-app-sidebar .teachers-filters.app-toolbar-filter {
  flex: 0 1 auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.has-app-sidebar .teachers-filters.app-toolbar-filter .teachers-filters__row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
}

.has-app-sidebar .teachers-filters.app-toolbar-filter .cs-wrap,
.has-app-sidebar .teachers-filters.app-toolbar-filter select {
  width: auto;
  min-width: 150px;
}

.has-app-sidebar .teachers-filters.app-toolbar-filter .cs-trigger {
  min-height: 34px !important;
  padding-block: 6px !important;
}

.has-app-sidebar :is(.finance-filter-bar, .finance-dashboard-filterbar).app-toolbar-filter {
  width: auto;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.has-app-sidebar .admin-tab-bar.app-toolbar-filter {
  flex: 1 1 auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow-x: auto;
  scrollbar-width: thin;
}

.has-app-sidebar .analytics-btn.app-toolbar-filter,
.has-app-sidebar .org-primary.app-toolbar-filter {
  flex: 0 0 auto;
}

@media (max-width: 1180px) {
  .app-toolbar-filter-toggle {
    display: inline-flex;
  }

  .app-toolbar-filter-row {
    display: none;
  }

  .app-toolbar-filters-open .app-toolbar-filter-row {
    display: flex;
  }
}

@media (max-width: 900px) {
  body.has-app-sidebar {
    padding-left: 0;
  }

  .app-sidebar {
    width: min(240px, calc(100vw - 52px));
    transform: translateX(-102%);
  }

  body.has-app-sidebar .app-sidebar__brand {
    justify-content: flex-start;
    padding-inline: 14px;
  }

  body.has-app-sidebar .app-sidebar__brand-name,
  body.has-app-sidebar .app-sidebar .db-tb-nav__label {
    display: block;
  }

  body.has-app-sidebar .app-sidebar__brand,
  body.has-app-sidebar .app-sidebar__nav,
  body.has-app-sidebar .app-sidebar__organization {
    opacity: 1;
    pointer-events: auto;
  }

  body.has-app-sidebar .app-sidebar__organization {
    padding-inline: 10px;
  }

  body.has-app-sidebar .app-sidebar-org {
    min-height: 58px;
    justify-content: flex-start;
    padding: 8px 9px;
  }

  body.has-app-sidebar .app-sidebar-org__content {
    position: static;
    display: flex;
  }

  body.has-app-sidebar .app-sidebar-org__label {
    display: block;
  }

  body.has-app-sidebar .app-sidebar-org .app-sidebar-org__select {
    position: static;
    width: 100%;
    height: auto;
    padding: 3px 20px 3px 0;
    opacity: 1;
  }

  body.has-app-sidebar .app-sidebar__nav {
    padding-inline: 10px;
  }

  body.has-app-sidebar .app-sidebar .db-tb-nav__link {
    justify-content: flex-start;
    padding-inline: 12px;
  }

  .app-sidebar__resizer {
    display: none;
  }

  .app-sidebar-mobile-open .app-sidebar {
    transform: translateX(0);
  }

  .app-sidebar-mobile-open .app-sidebar-overlay {
    display: block;
  }

  .app-sidebar-mobile-toggle {
    display: inline-flex;
  }

  .has-app-sidebar .db-toolbar__center {
    order: 3;
    width: 100%;
    min-width: 0;
    flex-basis: 100%;
  }

  .has-app-sidebar .db-toolbar__right {
    margin-left: auto;
  }

  .app-toolbar-filter-row {
    order: 4;
    gap: 12px;
    padding-bottom: 2px;
  }

  .app-filter-group__label {
    display: none;
  }

  .has-app-sidebar .db-tb-clock__date {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.has-app-sidebar,
  .app-sidebar,
  .app-sidebar__resizer::before {
    transition: none;
  }
}
