:root {
  --primary: #33498f;
  --primary-dark: #33498f;
  --primary-soft: #eef2ff;
  --ink: #171f31;
  --muted: #697386;
  --line: #dfe6f2;
  --page: #f6f8fc;
  --surface: #ffffff;
  --green: #18765a;
  --amber: #98640a;
  --red: #b42318;
  --soft-green: #e8f7f1;
  --soft-amber: #fff4df;
  --soft-red: #fff0ee;
  --shadow: 0 10px 28px rgba(30, 42, 70, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  overflow-x: hidden;
}

html {
  background: var(--page);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

[hidden] {
  display: none !important;
}

.school-logo {
  display: block;
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 50%;
  background: #ffffff;
}

.school-logo.hero-logo {
  width: 88px;
  height: 88px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 22px rgba(51, 73, 143, 0.18);
}

.school-logo.small {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
}

.school-name {
  display: block;
  color: var(--primary);
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f5f7fb 55%, #eef2ff 100%);
}

.login-panel {
  width: min(100%, 430px);
  padding: 28px 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin: 4px 0 8px;
  font-size: 28px;
  line-height: 1.2;
  text-align: center;
}

.login-panel p {
  margin: 0 0 24px;
  color: var(--muted);
  text-align: center;
}

.stack,
.grid {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #d5deea;
  border-radius: 8px;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(51, 73, 143, 0.14);
}

.primary,
.secondary,
.ghost,
.danger,
.text-button,
.icon-button {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 900;
}

.primary {
  color: #ffffff;
  background: var(--primary);
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #cdd7ff;
}

.ghost,
.text-button {
  color: #344054;
  background: #ffffff;
  border-color: var(--line);
}

.danger {
  color: var(--red);
  background: var(--soft-red);
  border-color: #ffc9c1;
}

.wide {
  width: 100%;
}

.app-shell {
  min-height: 100vh;
  display: block;
}

.sidebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(30, 42, 70, 0.08);
  backdrop-filter: blur(16px);
}

.sidebar > div {
  min-width: 0;
  flex: 1;
}

.app-brand,
.user-box,
.desktop-download-card {
  display: none;
}

#logoutButton {
  position: static;
  flex: 0 0 auto;
  z-index: 25;
  width: auto;
  min-height: 48px;
  padding: 7px 11px;
  color: var(--primary);
  background: #ffffff;
  border-color: var(--line);
  box-shadow: none;
}

.nav-list {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-list::-webkit-scrollbar {
  display: none;
}

.nav-list button {
  min-width: 50px;
  min-height: 56px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  padding: 6px 8px;
  color: #7a8495;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 900;
}

.nav-list button.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: inherit;
  background: rgba(51, 73, 143, 0.08);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
}

.nav-list button.active .nav-icon {
  color: #ffffff;
  background: var(--primary);
}

.content {
  min-width: 0;
  width: 100%;
  overflow-x: hidden;
  padding: 20px 16px 96px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin-bottom: 14px;
}

.topbar > div {
  min-width: 0;
}

.topbar-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(51, 73, 143, 0.14);
}

.topbar-school {
  display: block;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.topbar h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  word-break: keep-all;
}

.kicker {
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
}

.icon-button {
  display: none;
}

.view {
  display: grid;
  gap: 14px;
}

.school-site-link,
.discord-link {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 16px;
  color: var(--primary);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(30, 42, 70, 0.04);
  text-decoration: none;
  font-weight: 900;
}

.panel {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(30, 42, 70, 0.04);
}

.panel h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.panel-head {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-head h3,
.panel-head p {
  margin: 0;
}

.panel-head p {
  color: var(--muted);
}

.grid.two,
.grid.three,
.grid.four,
.stats,
.detail-list {
  grid-template-columns: 1fr;
}

.stats {
  display: grid;
  gap: 10px;
}

.stat {
  min-height: 92px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(30, 42, 70, 0.04);
}

.stat span {
  color: var(--muted);
  font-weight: 900;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1.1;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

td.wrap,
th.wrap {
  white-space: normal;
}

th {
  color: #344054;
  background: #f8faff;
  font-size: 13px;
}

tr:last-child td {
  border-bottom: 0;
}

tr.selected td {
  background: var(--primary-soft);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  color: #344054;
  background: #eef2f6;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.approved {
  color: var(--green);
  background: var(--soft-green);
}

.badge.pending {
  color: var(--amber);
  background: var(--soft-amber);
}

.badge.rejected {
  color: var(--red);
  background: var(--soft-red);
}

.badge.hold {
  color: var(--amber);
  background: var(--soft-amber);
}

.badge.blue {
  color: var(--primary);
  background: var(--primary-soft);
}

.badge.gray {
  color: #667085;
  background: #eef2f6;
}

.tabs,
.toolbar,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-toolbar {
  margin: 0 0 14px;
}

.search-toolbar input {
  flex: 1 1 190px;
}

.search-toolbar button {
  flex: 0 0 auto;
}

.sub-tabs {
  padding: 4px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(30, 42, 70, 0.04);
}

.tabs button,
.toolbar button {
  min-height: 38px;
  padding: 8px 12px;
  color: #344054;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.tabs button.active,
.toolbar button.active {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #cdd7ff;
}

.split {
  display: grid;
  gap: 14px;
  align-items: start;
}

.detail-list {
  display: grid;
  gap: 10px;
}

.detail-item {
  padding: 12px;
  background: #f8faff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.detail-item strong {
  display: block;
  margin-top: 4px;
  word-break: keep-all;
}

.timeline,
.notice-list,
.approval-list {
  display: grid;
  gap: 10px;
}

.list-row {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
}

.row-title {
  font-size: 16px;
  font-weight: 900;
  word-break: keep-all;
}

.row-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  word-break: keep-all;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.attachment-list a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #cdd7ff;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
  word-break: break-all;
}

.date-group,
.notice-item,
.approval-item {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.date-group > strong {
  display: block;
  padding: 11px 12px;
  color: var(--primary);
  background: var(--primary-soft);
  border-bottom: 1px solid var(--line);
}

.log-item,
.approval-item,
.notice-item {
  padding: 14px;
}

.date-group .log-item {
  border-bottom: 1px solid var(--line);
}

.date-group .log-item:last-child {
  border-bottom: 0;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.item-title {
  margin: 8px 0 6px;
  font-size: 17px;
  font-weight: 900;
}

.item-body {
  margin: 0;
  color: #344054;
  white-space: pre-wrap;
}

.decision-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}

.inline-form,
.user-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: end;
}

.check-line {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
}

.check-line input {
  width: auto;
  min-height: 0;
}

.empty {
  padding: 26px 16px;
  color: var(--muted);
  text-align: center;
  background: #ffffff;
  border: 1px dashed #cbd5df;
  border-radius: 8px;
}

.welcome-panel {
  padding: 18px;
  color: #ffffff;
  background: var(--primary);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(51, 73, 143, 0.18);
}

.welcome-panel h3 {
  margin: 0 0 6px;
  font-size: 22px;
}

.welcome-panel p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 800;
}

.wide-field {
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
}

.approval-target-select {
  max-width: 520px;
}

.target-help {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px;
}

.permissions-grid .check-line {
  min-height: 36px;
  padding: 7px 9px;
  background: #f8faff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.toast {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 96px;
  z-index: 30;
  padding: 12px 14px;
  color: #ffffff;
  background: #26343f;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--red);
}

.loading {
  padding: 36px;
  color: var(--muted);
  text-align: center;
}

.muted {
  color: var(--muted);
}

@media (max-width: 639px) {
  .panel {
    padding: 14px;
  }

  .panel-head {
    gap: 8px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .toolbar input,
  .toolbar select {
    min-width: 0;
  }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tabs button {
    flex: 0 0 auto;
  }

  .sub-tabs {
    width: 100%;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  table {
    min-width: 0;
    background: transparent;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    padding: 12px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  tr.selected {
    background: var(--primary-soft);
    border-color: #cdd7ff;
  }

  tr.selected td {
    background: transparent;
  }

  td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid #eef2f6;
    white-space: normal;
    word-break: keep-all;
  }

  td:last-child {
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
  }

  td[data-label="선택"] {
    justify-content: flex-end;
  }

  td[data-label="선택"]::before {
    display: none;
  }
}

@media (min-width: 640px) {
  .content {
    padding: 26px 24px 104px;
  }

  .stats,
  .grid.two,
  .detail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
  }

  .decision-form {
    grid-template-columns: minmax(180px, 1fr) auto auto;
  }
}

@media (min-width: 920px) {
  .app-shell {
    display: grid;
    grid-template-columns: 282px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    bottom: auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 22px;
    padding: 22px;
    color: #ffffff;
    background: var(--primary);
    border-top: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: none;
    backdrop-filter: none;
  }

  .app-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
  }

  .app-brand strong,
  .app-brand span {
    display: block;
  }

  .app-brand span {
    color: rgba(255, 255, 255, 0.76);
    font-size: 13px;
  }

  .user-box {
    display: block;
    padding: 14px;
    margin-bottom: 18px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
  }

  .user-box strong,
  .user-box span {
    display: block;
  }

  .user-box span {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.76);
    font-size: 13px;
  }

  #logoutButton {
    position: static;
    width: 100%;
    min-height: 42px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: none;
  }

  .nav-list {
    display: grid;
    gap: 6px;
    overflow: visible;
  }

  .nav-list button {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    text-align: left;
    font-size: 15px;
  }

  .nav-list button:hover,
  .nav-list button.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
  }

  .nav-icon {
    background: rgba(255, 255, 255, 0.16);
  }

  .nav-list button.active .nav-icon {
    color: var(--primary);
    background: #ffffff;
  }

  .content {
    padding: 28px;
  }

  .topbar {
    padding-right: 0;
  }

  .topbar h2 {
    font-size: 28px;
  }

  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .split {
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  }

  .inline-form {
    grid-template-columns: repeat(6, minmax(100px, 1fr)) auto;
  }

  .user-form {
    grid-template-columns: minmax(110px, 1fr) minmax(110px, 1fr) minmax(150px, 1.2fr) minmax(110px, 1fr) 82px;
  }
}

/* Simple, operation-first UI refinements */
body {
  background: #f6f8fb;
}

.content {
  max-width: 1160px;
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  padding: 8px 0 10px;
  background: rgba(246, 248, 251, 0.94);
  backdrop-filter: blur(14px);
}

.topbar-logo {
  width: 38px;
  height: 38px;
  box-shadow: none;
}

.topbar h2 {
  font-size: 22px;
}

.kicker,
.topbar-school {
  color: #5b6680;
}

.panel,
.stat,
.notice-item,
.approval-item,
.date-group,
.detail-item,
.sub-tabs,
.school-site-link,
.discord-link {
  box-shadow: none;
}

.panel {
  padding: 14px;
}

.panel-head {
  gap: 8px;
  margin-bottom: 12px;
}

.panel h3,
.panel-head h3 {
  margin-bottom: 4px;
  font-size: 17px;
}

.panel-head p {
  font-size: 13px;
}

input,
select,
textarea {
  min-height: 44px;
  background: #fbfcff;
}

.primary,
.secondary,
.ghost,
.danger,
.text-button,
.icon-button {
  min-height: 44px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-card {
  display: grid;
  gap: 3px;
  min-height: 76px;
  padding: 14px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.quick-card strong {
  font-size: 16px;
}

.quick-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.quick-card:active,
.list-row:active,
.nav-list button:active {
  transform: translateY(1px);
}

.welcome-panel {
  display: grid;
  gap: 4px;
  padding: 16px;
  box-shadow: none;
}

.sub-tabs {
  position: sticky;
  top: 62px;
  z-index: 11;
  margin: -2px 0 2px;
  overflow-x: auto;
}

.tabs button,
.toolbar button {
  min-height: 40px;
}

.toolbar input,
.toolbar select {
  flex: 1 1 180px;
}

.summary-list {
  display: grid;
  gap: 8px;
}

.entity-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.entity-card summary {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.entity-card summary::-webkit-details-marker {
  display: none;
}

.entity-card summary::after {
  content: "열기";
  flex: 0 0 auto;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.entity-card[open] summary {
  border-bottom: 1px solid var(--line);
}

.entity-card[open] summary::after {
  content: "닫기";
}

.entity-card summary > span:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.entity-card summary strong,
.entity-card summary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-card summary small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.entity-edit {
  padding: 14px;
  background: #fbfcff;
}

.notice-list,
.approval-list,
.timeline {
  gap: 8px;
}

.item-title,
.row-title {
  font-size: 16px;
}

.item-body {
  word-break: keep-all;
}

.actions {
  align-items: center;
}

@media (max-width: 639px) {
  .content {
    padding: 12px 12px 92px;
  }

  .topbar {
    min-height: 48px;
    margin-bottom: 10px;
  }

  .topbar h2 {
    font-size: 21px;
  }

  .sub-tabs {
    top: 58px;
  }

  .actions button {
    flex: 1 1 110px;
  }

  .quick-card {
    min-height: 72px;
    padding: 12px;
  }

  .nav-list button {
    min-width: 54px;
  }

  .nav-icon {
    width: 27px;
    height: 27px;
    font-size: 10px;
  }

  .entity-card summary {
    align-items: flex-start;
  }
}

@media (min-width: 640px) {
  .quick-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 920px) {
  .content {
    max-width: none;
  }

  .topbar {
    top: 0;
  }

  .sub-tabs {
    top: 84px;
  }
}

/* Jeonnam school-site inspired theme */
:root {
  --school-blue: #33498f;
  --school-blue-dark: #33498f;
  --school-sky: #f4f6fc;
  --school-green: #33498f;
  --school-yellow: #33498f;
  --school-yellow-soft: #eef2ff;
  --school-line: #dfe6f2;
}

.app-shell {
  min-height: 100vh;
  display: block;
  background: #ffffff;
}

.topbar {
  position: relative;
  top: auto;
  z-index: 30;
  max-width: 1480px;
  min-height: 70px;
  margin: 0 auto;
  padding: 12px 18px;
  background: #ffffff;
  border-bottom: 0;
  backdrop-filter: none;
}

.topbar-logo {
  width: 48px;
  height: 48px;
}

.topbar > div {
  display: grid;
  gap: 0;
}

.topbar-school {
  color: #111827;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 900;
}

.kicker {
  order: 3;
  color: #7a8495;
  font-size: 12px;
}

.topbar h2 {
  margin-top: 2px;
  color: var(--school-blue);
  font-size: 14px;
  font-weight: 900;
}

.top-theme-toggle {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  bottom: auto;
  z-index: 25;
  height: auto;
  min-height: 0;
  display: block;
  padding: 0;
  background: var(--school-blue);
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.sidebar > div {
  max-width: 1480px;
  margin: 0 auto;
}

.app-brand,
.user-box {
  display: none;
}

.nav-list {
  display: flex;
  justify-content: center;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-list button {
  flex: 0 0 auto;
  width: auto;
  min-width: 106px;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 12px 18px;
  color: #ffffff;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 17px;
  font-weight: 900;
}

.nav-list button:hover,
.nav-list button.active {
  color: #ffffff;
  background: var(--school-blue-dark);
}

.nav-list button.active {
  box-shadow: inset 0 -4px 0 #ffffff;
}

.nav-icon {
  display: none;
}

.content {
  max-width: 1480px;
  margin: 0 auto;
  padding: 48px 18px 56px;
  background: #ffffff;
}

.view {
  gap: 28px;
}

.school-home-top {
  display: grid;
  gap: 22px;
  align-items: start;
}

.school-hero {
  min-height: 0;
  padding: 0;
  background: #ffffff;
  border: 1px solid var(--school-line);
  border-radius: 24px;
  overflow: hidden;
}

.school-hero .school-hero-banner {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: #ffffff;
  border-radius: 0;
  box-shadow: none;
}

.school-side {
  display: grid;
  gap: 12px;
}

.home-account-row {
  display: grid;
  gap: 12px;
}

.home-welcome,
.school-site-link,
.side-user {
  width: 100%;
  justify-self: stretch;
  display: grid;
  align-content: center;
  min-height: 72px;
  padding: 18px 20px;
  background: #ffffff;
  border: 1px solid var(--school-line);
  border-radius: 18px;
  box-shadow: 0 5px 16px rgba(30, 42, 70, 0.12);
}

.home-welcome,
.side-user,
.detail-item,
.stat {
  text-align: center;
}

.home-welcome strong {
  color: var(--primary);
  font-size: 22px;
  line-height: 1.25;
}

.home-welcome span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.school-site-link {
  color: #111827;
  text-align: left;
  text-decoration: none;
}

.school-site-link::before {
  content: "바로가기";
  display: block;
  margin-bottom: 3px;
  color: var(--school-blue);
  font-size: 13px;
}

.side-user strong {
  color: #111827;
  font-size: 20px;
}

.side-user {
  font: inherit;
  cursor: pointer;
}

.side-user:hover,
.side-user:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 7px 18px rgba(51, 73, 143, 0.16);
}

.side-user span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.home-shortcuts {
  display: grid;
  gap: 10px;
}

.student-mobile-list {
  display: none;
}

.status-filter {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.filter-row > span {
  flex: 0 0 auto;
  min-width: 38px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.filter-row button {
  min-height: 34px;
  padding: 7px 11px;
  color: var(--primary);
  background: #ffffff;
  border: 1px solid var(--school-line);
  border-radius: 999px;
  font-weight: 900;
}

.filter-row button.active {
  color: #ffffff;
  background: var(--primary);
}

.student-badges {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.approval-clear-actions {
  justify-content: flex-end;
  margin: 0 0 12px;
}

.approval-select {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.approval-select input {
  width: auto;
  min-height: 0;
}

.guidance-delete-actions {
  justify-content: flex-end;
  margin: 0 0 10px;
}

.duty-filter {
  justify-content: flex-end;
}

.small-danger {
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
}

.quick-grid {
  gap: 14px;
}

.quick-card {
  min-height: 92px;
  padding: 20px;
  background: var(--school-sky);
  border: 1px solid var(--school-line);
  border-left: 5px solid var(--primary);
  border-radius: 28px 28px 28px 8px;
}

.quick-card:nth-child(odd) {
  background: var(--primary-soft);
}

.quick-card strong {
  color: #111827;
  font-size: 18px;
}

.panel {
  padding: 26px 30px;
  border: 0;
  border-radius: 30px 30px 30px 8px;
  background: #f7fafc;
}

.panel-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--school-line);
}

.panel h3,
.panel-head h3 {
  color: #111827;
  font-size: 22px;
}

.panel-head p {
  color: #5b6680;
}

.tabs {
  align-items: center;
  gap: 6px;
}

.panel > .tabs:first-child {
  padding: 6px;
  background: #f2f5fb;
  border-radius: 20px;
  overflow-x: auto;
  overflow-y: hidden;
}

.sub-tabs {
  position: static;
  top: auto;
  z-index: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  width: 100%;
  min-height: 56px;
  margin: 0 0 4px;
  padding: 6px;
  background: #f2f5fb;
  border: 0;
  border-radius: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  isolation: isolate;
}

.tabs button,
.toolbar button {
  min-height: 46px;
  padding: 10px 20px;
  border-radius: 16px;
}

.tabs button {
  flex: 0 0 auto;
  white-space: nowrap;
  line-height: 1.2;
  border: 0;
  background: transparent;
}

.tabs button.active {
  color: #ffffff;
  background: var(--primary);
  border-color: transparent;
  box-shadow: 0 6px 14px rgba(51, 73, 143, 0.16);
}

.primary {
  color: #ffffff;
  background: var(--school-blue);
}

.primary:hover {
  background: var(--school-blue-dark);
  box-shadow: 0 6px 14px rgba(51, 73, 143, 0.16);
}

.secondary {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #cfd8f5;
}

.ghost,
.text-button {
  background: #ffffff;
}

.notice-item,
.approval-item,
.entity-card,
.detail-item,
.date-group,
.stat {
  border: 1px solid var(--school-line);
  border-radius: 18px;
  background: #ffffff;
}

.badge.blue,
.badge.pending,
.badge.hold {
  color: var(--primary);
  background: var(--primary-soft);
}

.badge.approved {
  color: #0f7a52;
  background: #e8f7f1;
}

.table-wrap {
  border-color: var(--school-line);
  border-radius: 18px;
}

th {
  background: #edf5f8;
}

.entity-card summary::after {
  color: var(--school-blue);
}

.theme-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.theme-toggle button {
  min-height: 48px;
  color: var(--primary);
  background: #ffffff;
  border: 1px solid var(--school-line);
  border-radius: 14px;
  font-weight: 900;
}

.theme-toggle button.active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 6px 14px rgba(51, 73, 143, 0.18);
}

.theme-fixed-note {
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 12px 14px;
  color: var(--primary);
  background: rgba(51, 73, 143, 0.08);
  border: 1px solid rgba(51, 73, 143, 0.16);
  border-radius: 14px;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.password-required-panel {
  border-color: rgba(51, 73, 143, 0.24);
  background:
    linear-gradient(135deg, rgba(51, 73, 143, 0.12), rgba(51, 73, 143, 0.04)),
    var(--surface);
}

.password-required-panel .panel-head p {
  color: var(--ink);
  font-weight: 800;
}

.password-reset-view {
  max-width: 720px;
  margin: 0 auto;
}

.password-reset-panel {
  display: grid;
  gap: 16px;
}

.password-reset-panel .actions {
  justify-content: stretch;
}

.password-reset-panel .actions button {
  width: 100%;
}

.admin-reauth-layer {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
}

.admin-reauth-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 8, 18, 0.64);
  border: 0;
  border-radius: 0;
}

.admin-reauth-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  display: grid;
  gap: 16px;
  padding: 20px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.admin-reauth-panel form {
  display: grid;
  gap: 14px;
}

.admin-reauth-panel .actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.app-popup-open {
  overflow: hidden;
}

.app-popup-layer {
  position: fixed;
  z-index: 2200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

.app-popup-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 8, 18, 0.66);
  border: 0;
  border-radius: 0;
}

.app-popup-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  max-height: min(760px, calc(100dvh - 36px));
  display: grid;
  gap: 14px;
  padding: 20px;
  overflow: auto;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

.app-popup-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}

.app-popup-head h3 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.2;
}

.app-popup-image {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: rgba(51, 73, 143, 0.08);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.app-popup-content {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.app-popup-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.app-popup-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.app-popup-actions button:only-child {
  grid-column: 1 / -1;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #8ea2f5;
  --primary-dark: #a9b8ff;
  --primary-soft: #1d2a52;
  --ink: #eef3ff;
  --muted: #a9b5ce;
  --line: #2d3953;
  --page: #0d1424;
  --surface: #151f33;
  --green: #65d6a4;
  --amber: #f6c76d;
  --red: #ff9d91;
  --soft-green: #102f26;
  --soft-amber: #332711;
  --soft-red: #351c20;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.26);
  --school-blue: #33498f;
  --school-blue-dark: #263a78;
  --school-sky: #121d32;
  --school-green: #8ea2f5;
  --school-yellow: #8ea2f5;
  --school-yellow-soft: #1d2a52;
  --school-line: #2d3953;
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] .app-shell,
:root[data-theme="dark"] .content {
  color: var(--ink);
  background: var(--page);
}

:root[data-theme="dark"] .login-shell {
  background: linear-gradient(180deg, #0d1424 0%, #101a2e 62%, #151f33 100%);
}

:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] .login-panel,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .school-hero,
:root[data-theme="dark"] .home-welcome,
:root[data-theme="dark"] .side-user,
:root[data-theme="dark"] .notice-item,
:root[data-theme="dark"] .approval-item,
:root[data-theme="dark"] .entity-card,
:root[data-theme="dark"] .detail-item,
:root[data-theme="dark"] .date-group,
:root[data-theme="dark"] .stat,
:root[data-theme="dark"] .student-card,
:root[data-theme="dark"] tr,
:root[data-theme="dark"] .table-wrap {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}

:root[data-theme="dark"] .sidebar {
  background: #10182a;
  border-color: var(--line);
}

:root[data-theme="dark"] .topbar {
  border-bottom-color: var(--line);
}

:root[data-theme="dark"] .topbar-school,
:root[data-theme="dark"] .panel h3,
:root[data-theme="dark"] .panel-head h3,
:root[data-theme="dark"] .quick-card strong,
:root[data-theme="dark"] .side-user strong,
:root[data-theme="dark"] .school-site-link,
:root[data-theme="dark"] .item-title,
:root[data-theme="dark"] .detail-item strong,
:root[data-theme="dark"] label {
  color: var(--ink);
}

:root[data-theme="dark"] .topbar h2,
:root[data-theme="dark"] .school-name,
:root[data-theme="dark"] .home-welcome strong,
:root[data-theme="dark"] .filter-row button,
:root[data-theme="dark"] .approval-select {
  color: var(--primary);
}

:root[data-theme="dark"] .kicker,
:root[data-theme="dark"] .panel-head p,
:root[data-theme="dark"] .home-welcome span,
:root[data-theme="dark"] .side-user span,
:root[data-theme="dark"] .quick-card span,
:root[data-theme="dark"] .item-body,
:root[data-theme="dark"] .muted,
:root[data-theme="dark"] .filter-row > span,
:root[data-theme="dark"] .login-panel p {
  color: var(--muted);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  color: var(--ink);
  background: #0f1728;
  border-color: var(--line);
}

:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
  color: #71809c;
}

:root[data-theme="dark"] .school-logo,
:root[data-theme="dark"] .school-hero .school-hero-banner {
  background: #ffffff;
}

:root[data-theme="dark"] .quick-card,
:root[data-theme="dark"] .quick-card:nth-child(odd),
:root[data-theme="dark"] .sub-tabs,
:root[data-theme="dark"] .panel > .tabs:first-child {
  background: #121d32;
  border-color: var(--line);
}

:root[data-theme="dark"] .tabs button {
  color: var(--muted);
}

:root[data-theme="dark"] .tabs button.active,
:root[data-theme="dark"] .filter-row button.active,
:root[data-theme="dark"] .theme-toggle button.active {
  color: #ffffff;
  background: #33498f;
}

:root[data-theme="dark"] .secondary,
:root[data-theme="dark"] .badge.blue,
:root[data-theme="dark"] .badge.pending,
:root[data-theme="dark"] .badge.hold {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #3a4d82;
}

:root[data-theme="dark"] .badge.gray {
  color: #b6c1d5;
  background: rgba(182, 193, 213, 0.14);
}

:root[data-theme="dark"] .popup-admin-item,
:root[data-theme="dark"] .inline-check {
  background: #121d32;
  border-color: var(--line);
}

:root[data-theme="dark"] .ghost,
:root[data-theme="dark"] .text-button,
:root[data-theme="dark"] .theme-toggle button,
:root[data-theme="dark"] .filter-row button {
  color: var(--ink);
  background: #111a2d;
  border-color: var(--line);
}

:root[data-theme="dark"] .danger,
:root[data-theme="dark"] .badge.rejected {
  color: #ffb1a8;
  background: var(--soft-red);
  border-color: #5b2830;
}

:root[data-theme="dark"] .badge.approved {
  color: #8be7bd;
  background: var(--soft-green);
}

:root[data-theme="dark"] .badge.approved,
:root[data-theme="dark"] .badge.rejected,
:root[data-theme="dark"] .badge.pending,
:root[data-theme="dark"] .badge.hold {
  border-color: transparent;
}

:root[data-theme="dark"] th {
  color: var(--ink);
  background: #101a2e;
}

:root[data-theme="dark"] td,
:root[data-theme="dark"] .panel-head {
  border-color: var(--line);
}

:root[data-theme="dark"] .student-card.selected,
:root[data-theme="dark"] tr.selected {
  background: #1d2a52;
  border-color: #5267aa;
}

:root[data-theme="dark"] .empty {
  color: var(--muted);
  background: #101a2e;
  border-color: var(--line);
}

@media (min-width: 980px) {
  .school-home-top {
    grid-template-columns: minmax(0, 760px) minmax(420px, 520px);
    justify-content: start;
    align-items: start;
    gap: 24px;
  }

  .school-hero {
    max-width: 760px;
    align-self: start;
  }

  .school-hero .school-hero-banner {
    max-height: none;
  }

  .school-side {
    width: 100%;
    align-self: start;
    align-content: start;
  }

  .home-account-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .home-account-row .side-user {
    display: none;
  }

  .home-account-row .home-welcome {
    min-height: 132px;
    padding: 24px 28px;
  }

  .home-account-row .home-welcome-logo {
    width: 86px;
    height: 86px;
  }

  .home-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-shortcuts .quick-card {
    min-height: 72px;
    padding: 16px 18px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    min-height: 100vh;
    background: var(--page);
  }

  .topbar {
    position: sticky;
    top: 0;
    max-width: none;
    min-height: 58px;
    margin: 0;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 22px rgba(30, 42, 70, 0.06);
    backdrop-filter: blur(14px);
  }

  .topbar-logo {
    width: 38px;
    height: 38px;
  }

  .topbar-school {
    color: var(--primary);
    font-size: 12px;
  }

  .topbar h2 {
    margin: 0;
    color: var(--ink);
    font-size: 20px;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    z-index: 40;
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 26px rgba(30, 42, 70, 0.1);
    backdrop-filter: blur(16px);
  }

  .sidebar > div {
    max-width: none;
    min-width: 0;
    margin: 0;
    flex: 1;
  }

  .nav-list {
    justify-content: space-between;
    gap: 4px;
  }

  .nav-list button {
    flex: 1 0 58px;
    min-width: 58px;
    min-height: 54px;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 4px;
    padding: 6px;
    color: #6b7280;
    background: transparent;
    border-radius: 14px;
    font-size: 11px;
    box-shadow: none;
  }

  .nav-list button.active {
    color: var(--primary);
    background: var(--primary-soft);
    box-shadow: none;
  }

  .nav-icon {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    color: inherit;
    background: rgba(51, 73, 143, 0.08);
    border-radius: 50%;
    font-size: 10px;
  }

  .nav-list button.active .nav-icon {
    color: #ffffff;
    background: var(--primary);
  }

  .content {
    max-width: none;
    padding: 14px 12px calc(96px + env(safe-area-inset-bottom));
    background: var(--page);
  }

  .view {
    gap: 14px;
  }

  .school-home-top {
    display: grid;
    gap: 12px;
  }

  .school-hero {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 8px 20px rgba(30, 42, 70, 0.08);
  }

  .school-hero .school-hero-banner {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 0;
  }

  .school-side {
    gap: 10px;
  }

  .home-account-row {
    gap: 10px;
  }

  .home-welcome,
  .side-user {
    min-height: 60px;
    padding: 14px 16px;
    border-radius: 18px;
    box-shadow: none;
  }

  .home-welcome strong {
    font-size: 20px;
  }

  .home-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .student-mobile-list {
    display: grid;
    gap: 10px;
  }

  .student-table-wrap {
    display: none;
  }

  .student-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px 10px;
    align-items: center;
    padding: 13px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 16px;
  }

  .student-card.selected {
    border-color: rgba(51, 73, 143, 0.35);
    background: var(--primary-soft);
  }

  .student-card div {
    min-width: 0;
    display: grid;
    gap: 2px;
  }

  .student-card strong {
    font-size: 16px;
  }

  .student-card span:not(.badge) {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
  }

  .student-card .text-button {
    min-height: 38px;
    justify-self: stretch;
  }

  .mobile-student-detail {
    grid-column: 1 / -1;
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }

  .mobile-student-detail .panel-head {
    margin-bottom: 10px;
  }

  .mobile-student-detail .detail-list {
    grid-template-columns: 1fr;
  }

  .student-detail-panel {
    gap: 12px;
  }

  .status-filter {
    margin-bottom: 12px;
  }

  .filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .filter-row::-webkit-scrollbar {
    display: none;
  }

  .filter-row button {
    flex: 0 0 auto;
  }

  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .quick-card {
    min-height: 78px;
    padding: 14px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-left: 0;
    border-radius: 18px;
  }

  .panel {
    padding: 16px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 18px;
  }

  .panel h3,
  .panel-head h3 {
    font-size: 18px;
  }

  .panel-head {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .panel > .tabs:first-child,
  .sub-tabs {
    min-height: 0;
    margin-bottom: 8px;
    padding: 5px;
    background: #eef2ff;
    border-radius: 16px;
  }

  .tabs button,
  .toolbar button {
    min-height: 40px;
    padding: 9px 13px;
    border-radius: 12px;
    font-size: 14px;
  }

  .sub-tabs {
    top: auto;
  }
}

/* Legacy hosting migration notice */
body.migration-notice-open {
  box-sizing: border-box;
  display: grid;
  min-height: 100dvh;
  margin: 0;
  padding:
    calc(24px + env(safe-area-inset-top))
    calc(20px + env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom))
    calc(20px + env(safe-area-inset-left));
  place-items: center;
  background: #f3f6fb !important;
  color: #182033;
}

.migration-notice {
  box-sizing: border-box;
  width: min(100%, 440px);
  padding: 32px;
  text-align: center;
  background: #ffffff;
  border: 1px solid #dce3f0;
  border-radius: 20px;
  box-shadow: 0 18px 48px rgba(36, 51, 86, 0.12);
}

.migration-logo {
  display: block;
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  object-fit: contain;
}

.migration-kicker {
  display: block;
  margin-bottom: 8px;
  color: #33498f;
  font-size: 13px;
  font-weight: 800;
}

.migration-notice h1 {
  margin: 0 0 12px;
  font-size: clamp(24px, 6vw, 30px);
  line-height: 1.25;
  letter-spacing: 0;
}

.migration-notice p {
  margin: 0;
  color: #5a6579;
  font-size: 15px;
  line-height: 1.65;
  word-break: keep-all;
}

.migration-actions {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.migration-primary,
.migration-secondary {
  box-sizing: border-box;
  display: grid;
  width: 100%;
  min-height: 50px;
  padding: 0 18px;
  place-items: center;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  border-radius: 12px;
  cursor: pointer;
}

.migration-primary {
  color: #ffffff;
  background: #33498f;
  border: 1px solid #33498f;
}

.migration-secondary {
  color: #33498f;
  background: #ffffff;
  border: 1px solid #c9d2e4;
}

.migration-notice small {
  display: block;
  margin-top: 18px;
  color: #7a8497;
  font-size: 12px;
  overflow-wrap: anywhere;
}

:root[data-theme="dark"] body.migration-notice-open {
  background: #0e1524 !important;
  color: #f3f6fb;
}

:root[data-theme="dark"] .migration-notice {
  background: #151e2f;
  border-color: #2c3850;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
}

:root[data-theme="dark"] .migration-notice p {
  color: #b4bfd1;
}

:root[data-theme="dark"] .migration-secondary {
  color: #dce4ff;
  background: #1a2538;
  border-color: #34415a;
}

:root[data-theme="dark"] .migration-notice small {
  color: #929db0;
}

@media (max-width: 520px) {
  .migration-notice {
    padding: 26px 22px;
    border-radius: 18px;
  }
}

/* Softer corners */
.panel,
.notification-panel {
  border-radius: 16px;
}

.home-welcome {
  border-radius: 18px;
}

.school-hero,
.quick-card,
.notice-item .list-row,
.approval-item,
.entity-card,
.date-group,
.student-card,
.status-group,
.status-filter,
.table-wrap,
.detail-item,
.stat,
.guidance-selected,
.guidance-results button {
  border-radius: 13px;
}

input,
select,
textarea,
.primary,
.secondary,
.ghost,
.danger,
.text-button,
.toolbar button,
.filter-row button,
.theme-toggle button {
  border-radius: 10px;
}

.sub-tabs,
.panel > .tabs:first-child {
  border-radius: 13px 13px 0 0;
}

.tabs button,
.sub-tabs button {
  border-radius: 9px 9px 0 0;
}

.quick-card .quick-icon {
  border-radius: 11px;
}

.badge {
  border-radius: 8px;
}

.side-user {
  border-radius: 13px;
}

@media (max-width: 760px) {
  .panel,
  .home-welcome,
  .notification-panel {
    border-radius: 16px;
  }

  .quick-card,
  .approval-item,
  .entity-card,
  .date-group,
  .student-card,
  .status-group,
  .status-filter,
  .detail-item,
  .stat,
  .side-user {
    border-radius: 13px;
  }

  input,
  select,
  textarea,
  .primary,
  .secondary,
  .ghost,
  .danger,
  .text-button {
    border-radius: 10px;
  }
}

/* Mobile financial-app navigation */
@media (max-width: 760px) {
  .content {
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .sidebar {
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    padding: 6px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(218, 224, 235, 0.94);
    border-radius: 22px;
    box-shadow: 0 14px 34px rgba(30, 42, 70, 0.16);
    backdrop-filter: blur(18px);
  }

  .nav-list {
    gap: 2px;
  }

  .nav-list button {
    min-height: 52px;
    padding: 5px 2px;
    color: #7c8596;
    background: transparent;
    border: 0;
    border-radius: 16px;
    box-shadow: none;
  }

  .nav-list button:hover {
    color: var(--primary);
    background: var(--primary-soft);
  }

  .nav-list button.active {
    color: #ffffff;
    background: var(--primary);
    box-shadow: 0 7px 16px rgba(51, 73, 143, 0.22);
  }

  .nav-list button.active .nav-icon,
  .nav-icon {
    color: inherit;
    background: transparent !important;
    box-shadow: none !important;
  }

  .nav-badge {
    top: 1px;
    right: 6px;
    border-color: #ffffff;
  }

  :root[data-theme="dark"] .sidebar {
    background: rgba(20, 29, 47, 0.95);
    border-color: rgba(58, 70, 94, 0.94);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3);
  }

  :root[data-theme="dark"] .nav-list button {
    color: #a8b2c5;
  }

  :root[data-theme="dark"] .nav-list button:hover {
    color: #ffffff;
    background: #1d2a45;
  }

  :root[data-theme="dark"] .nav-list button.active {
    color: #ffffff;
    background: var(--primary);
  }

  :root[data-theme="dark"] .nav-badge {
    border-color: #141d2f;
  }
}

:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] .sidebar,
:root[data-theme="dark"] .content,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .student-card,
:root[data-theme="dark"] .quick-card,
:root[data-theme="dark"] .school-hero,
:root[data-theme="dark"] .home-welcome,
:root[data-theme="dark"] .side-user {
  background-color: var(--surface);
  border-color: var(--line);
}

:root[data-theme="dark"] .app-shell,
:root[data-theme="dark"] .content {
  background: var(--page);
}

:root[data-theme="dark"] .sidebar {
  background: rgba(16, 24, 42, 0.96);
}

:root[data-theme="dark"] .topbar {
  background: rgba(16, 24, 42, 0.96);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

:root[data-theme="dark"] .panel > .tabs:first-child,
:root[data-theme="dark"] .sub-tabs {
  background: #121d32;
}

:root[data-theme="dark"] .nav-list button {
  color: var(--muted);
}

:root[data-theme="dark"] .nav-list button:hover,
:root[data-theme="dark"] .nav-list button.active {
  color: #ffffff;
  background: #33498f;
}

:root[data-theme="dark"] .nav-icon {
  background: rgba(142, 162, 245, 0.14);
}

.student-status-split {
  grid-template-columns: minmax(0, 1fr);
}

.desktop-student-detail-row td {
  padding: 0;
  white-space: normal;
  background: #ffffff;
}

.desktop-student-detail {
  padding: 20px;
  background: #ffffff;
  border-top: 1px solid var(--school-line);
}

.desktop-student-detail .panel-head {
  margin-bottom: 12px;
}

:root[data-theme="dark"] .desktop-student-detail-row td,
:root[data-theme="dark"] .desktop-student-detail {
  background: var(--surface);
}

@media (max-width: 760px) {
  :root {
    --mobile-card: #ffffff;
    --mobile-page: #f3f6fb;
    --mobile-shadow: 0 12px 28px rgba(30, 42, 70, 0.08);
  }

  html,
  body {
    background: #ffffff;
  }

  .app-shell {
    background:
      radial-gradient(circle at 20% 0%, rgba(51, 73, 143, 0.12), transparent 34%),
      var(--mobile-page);
  }

  .login-shell {
    min-height: 100dvh;
    padding:
      calc(20px + env(safe-area-inset-top))
      calc(20px + env(safe-area-inset-right))
      calc(20px + env(safe-area-inset-bottom))
      calc(20px + env(safe-area-inset-left));
    background:
      radial-gradient(circle at 18% 0%, rgba(51, 73, 143, 0.12), transparent 34%),
      var(--mobile-page);
  }

  .topbar {
    min-height: 64px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 0;
    box-shadow: none;
    backdrop-filter: blur(18px);
  }

  .topbar::before {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    height: env(safe-area-inset-top);
    background: #ffffff;
    pointer-events: none;
    z-index: -1;
  }

  .topbar > div {
    flex: 1;
  }

  .top-theme-toggle {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    min-width: 50px;
    min-height: 36px;
    padding: 8px 11px;
    color: var(--primary);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(223, 230, 242, 0.95);
    border-radius: 999px;
    box-shadow: 0 8px 18px rgba(30, 42, 70, 0.08);
    font-size: 12px;
    font-weight: 900;
  }

  #menuButton {
    display: none;
  }

  .topbar-logo {
    width: 34px;
    height: 34px;
    box-shadow: 0 4px 12px rgba(51, 73, 143, 0.18);
  }

  .topbar-school {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
  }

  .kicker {
    display: none;
  }

  .topbar h2 {
    color: var(--ink);
    font-size: 19px;
    letter-spacing: 0;
  }

  .content {
    padding: 10px calc(16px + env(safe-area-inset-right)) calc(88px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
    background: transparent;
  }

  .view {
    gap: 16px;
  }

  .school-home-top {
    gap: 14px;
  }

  .school-hero {
    display: none;
  }

  .school-side {
    order: 1;
    gap: 12px;
  }

  .home-account-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .home-welcome {
    min-height: 142px;
    align-content: end;
    justify-items: start;
    padding: 22px;
    color: #ffffff;
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 38%),
      linear-gradient(145deg, #33498f 0%, #425fb4 55%, #263a78 100%);
    border: 0;
    border-radius: 26px;
    box-shadow: 0 16px 34px rgba(51, 73, 143, 0.26);
    text-align: left;
    overflow: hidden;
  }

  .home-welcome::before {
    content: "TODAY";
    width: max-content;
    margin-bottom: 18px;
    padding: 5px 9px;
    color: rgba(255, 255, 255, 0.86);
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
  }

  .home-welcome strong {
    color: #ffffff;
    font-size: 23px;
    line-height: 1.24;
  }

  .home-welcome span {
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
  }

  .side-user {
    min-height: 58px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    justify-items: start;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(223, 230, 242, 0.95);
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(30, 42, 70, 0.06);
    text-align: left;
  }

  .side-user::after {
    content: "MY";
    padding: 6px 9px;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
  }

  .side-user strong {
    color: var(--ink);
    font-size: 16px;
  }

  .side-user span {
    font-size: 12px;
  }

  .home-shortcuts,
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .quick-card {
    position: relative;
    min-height: 92px;
    align-content: end;
    padding: 15px;
    background: var(--mobile-card);
    border: 0;
    border-radius: 22px;
    box-shadow: var(--mobile-shadow);
    overflow: hidden;
  }

  .quick-card::before {
    content: "";
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    background:
      linear-gradient(135deg, rgba(51, 73, 143, 0.14), rgba(51, 73, 143, 0.04));
    border-radius: 11px;
  }

  .quick-card::after {
    content: "›";
    position: absolute;
    top: 15px;
    right: 25px;
    color: var(--primary);
    font-size: 22px;
    line-height: 1;
    font-weight: 900;
  }

  .quick-card strong {
    color: var(--ink);
    font-size: 16px;
    line-height: 1.25;
  }

  .quick-card span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
  }

  .panel {
    padding: 18px;
    background: rgba(255, 255, 255, 0.9);
    border: 0;
    border-radius: 24px;
    box-shadow: var(--mobile-shadow);
  }

  .panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 0;
  }

  .panel-head > div {
    min-width: 0;
    flex: 1;
  }

  .panel h3,
  .panel-head h3 {
    color: var(--ink);
    font-size: 18px;
    line-height: 1.25;
  }

  .panel-head p {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.35;
  }

  .panel-head .text-button,
  .text-button {
    min-height: 34px;
    padding: 7px 10px;
    color: var(--primary);
    background: var(--primary-soft);
    border: 0;
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
  }

  .notice-list,
  .approval-list {
    display: grid;
    gap: 8px;
  }

  .notice-item,
  .approval-item,
  .entity-card,
  .date-group {
    padding: 14px;
    background: transparent;
    border: 1px solid rgba(223, 230, 242, 0.9);
    border-radius: 18px;
    box-shadow: none;
  }

  .item-meta {
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
  }

  .item-title {
    margin-top: 6px;
    color: var(--ink);
    font-size: 15px;
    line-height: 1.35;
  }

  .item-body {
    margin-top: 5px;
    font-size: 13px;
    line-height: 1.45;
  }

  .badge {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
  }

  .sub-tabs,
  .panel > .tabs:first-child {
    margin: 0 0 10px;
    padding: 4px;
    background: rgba(230, 235, 248, 0.92);
    border: 0;
    border-radius: 16px;
    box-shadow: inset 0 0 0 1px rgba(223, 230, 242, 0.7);
  }

  .tabs button,
  .toolbar button {
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 13px;
    font-size: 13px;
  }

  .tabs button.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 5px 13px rgba(30, 42, 70, 0.1);
  }

  input,
  select,
  textarea {
    min-height: 48px;
    padding: 12px 13px;
    background: #f8fafd;
    border: 1px solid #e0e7f2;
    border-radius: 14px;
  }

  textarea {
    min-height: 112px;
  }

  .primary,
  .secondary,
  .ghost,
  .danger {
    min-height: 46px;
    border-radius: 14px;
  }

  .student-card {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 15px;
    background: var(--mobile-card);
    border: 0;
    border-radius: 20px;
    box-shadow: var(--mobile-shadow);
  }

  .student-card .student-badges {
    justify-content: flex-start;
  }

  .student-card .text-button {
    grid-column: 1 / -1;
    min-height: 40px;
  }

  .mobile-student-detail {
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }

  .detail-list {
    gap: 8px;
  }

  .detail-item,
  .stat {
    padding: 14px;
    background: #f8fafd;
    border: 0;
    border-radius: 17px;
  }

  .filter-row {
    gap: 7px;
  }

  .filter-row > span {
    min-width: auto;
    padding-right: 2px;
  }

  .filter-row button {
    min-height: 34px;
    border: 0;
    background: #eef2ff;
  }

  .sidebar {
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    padding: 6px calc(7px + env(safe-area-inset-right)) 6px calc(7px + env(safe-area-inset-left));
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(223, 230, 242, 0.92);
    border-radius: 22px;
    box-shadow: 0 18px 36px rgba(30, 42, 70, 0.18);
  }

  .nav-list {
    gap: 2px;
  }

  .nav-list button {
    min-width: 0;
    min-height: 50px;
    border-radius: 16px;
    color: #8a94a8;
    font-size: 10px;
  }

  .nav-icon {
    width: 24px;
    height: 24px;
    background: transparent;
    font-size: 10px;
  }

  .nav-list button.active {
    color: #ffffff;
    background: var(--primary);
    box-shadow: 0 8px 16px rgba(51, 73, 143, 0.18);
  }

  .nav-list button.active .nav-icon {
    background: rgba(255, 255, 255, 0.16);
  }

  .theme-toggle {
    padding: 4px;
    background: #eef2ff;
    border-radius: 16px;
  }

  .theme-toggle button {
    border: 0;
    border-radius: 13px;
    background: transparent;
  }
}

@media (max-width: 760px) {
  :root[data-theme="dark"] {
    --mobile-card: #151f33;
    --mobile-page: #0d1424;
    --mobile-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  }

  :root[data-theme="dark"] body,
  :root[data-theme="dark"],
  :root[data-theme="dark"] .app-shell {
    background:
      radial-gradient(circle at 20% 0%, rgba(142, 162, 245, 0.16), transparent 34%),
      var(--mobile-page);
  }

  :root[data-theme="dark"] .topbar {
    background: rgba(13, 20, 36, 0.88);
  }

  :root[data-theme="dark"] .top-theme-toggle {
    color: #ffffff;
    background: rgba(51, 73, 143, 0.82);
    border-color: rgba(142, 162, 245, 0.28);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
  }

  :root[data-theme="dark"] .panel,
  :root[data-theme="dark"] .side-user,
  :root[data-theme="dark"] .school-hero,
  :root[data-theme="dark"] .quick-card,
  :root[data-theme="dark"] .student-card {
    background: rgba(21, 31, 51, 0.92);
    box-shadow: var(--mobile-shadow);
  }

  :root[data-theme="dark"] .home-welcome {
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 38%),
      linear-gradient(145deg, #283b78 0%, #33498f 58%, #1a2548 100%);
  }

  :root[data-theme="dark"] .notice-item,
  :root[data-theme="dark"] .approval-item,
  :root[data-theme="dark"] .entity-card,
  :root[data-theme="dark"] .date-group {
    background: transparent;
    border-color: rgba(45, 57, 83, 0.9);
  }

  :root[data-theme="dark"] .tabs button.active {
    color: #ffffff;
    background: #33498f;
  }

  :root[data-theme="dark"] input,
  :root[data-theme="dark"] select,
  :root[data-theme="dark"] textarea,
  :root[data-theme="dark"] .detail-item,
  :root[data-theme="dark"] .stat {
    background: #101a2e;
    border-color: #2d3953;
  }

  :root[data-theme="dark"] .sidebar {
    background: rgba(16, 24, 42, 0.94);
    border-color: rgba(45, 57, 83, 0.9);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.34);
  }

  :root[data-theme="dark"] .nav-list button {
    color: #8793ad;
  }

  :root[data-theme="dark"] .nav-list button.active {
    color: #ffffff;
    background: #33498f;
  }

  :root[data-theme="dark"] .theme-toggle,
  :root[data-theme="dark"] .sub-tabs,
  :root[data-theme="dark"] .panel > .tabs:first-child {
    background: #101a2e;
  }
}

@media (max-width: 760px) {
  :root {
    --mobile-border: rgba(215, 224, 239, 0.92);
    --mobile-muted-bg: #f7f9fd;
  }

  body {
    font-size: 14px;
  }

  .app-shell {
    min-height: 100dvh;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 62px;
    margin: 0;
    padding:
      calc(10px + env(safe-area-inset-top))
      calc(14px + env(safe-area-inset-right))
      10px
      calc(14px + env(safe-area-inset-left));
    border-bottom: 1px solid rgba(223, 230, 242, 0.78);
  }

  .topbar > div {
    min-width: 0;
  }

  .topbar-school,
  .topbar h2 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-school {
    font-size: 11px;
  }

  .topbar h2 {
    font-size: 18px;
  }

  .top-theme-toggle {
    min-width: 46px;
    min-height: 34px;
    padding: 7px 10px;
  }

  .content {
    padding:
      12px
      calc(14px + env(safe-area-inset-right))
      calc(84px + env(safe-area-inset-bottom))
      calc(14px + env(safe-area-inset-left));
  }

  .view {
    gap: 12px;
  }

  .panel,
  .notice-item,
  .approval-item,
  .entity-card,
  .date-group,
  .student-card,
  .side-user {
    border: 1px solid var(--mobile-border);
  }

  .panel {
    padding: 16px;
    border-radius: 22px;
  }

  .panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(223, 230, 242, 0.72);
  }

  .panel-head > div {
    min-width: 0;
  }

  .panel h3,
  .panel-head h3 {
    margin: 0;
    font-size: 17px;
    line-height: 1.3;
  }

  .panel-head p {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.4;
  }

  .panel-head .text-button {
    flex: 0 0 auto;
  }

  .sub-tabs,
  .panel > .tabs:first-child {
    position: static;
    top: auto;
    z-index: auto;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    width: 100%;
    margin: 0 0 12px;
    padding: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 17px;
    isolation: isolate;
    scrollbar-width: none;
  }

  .sub-tabs::-webkit-scrollbar,
  .panel > .tabs:first-child::-webkit-scrollbar {
    display: none;
  }

  .tabs button,
  .toolbar button {
    min-height: 38px;
    padding: 8px 12px;
    white-space: nowrap;
  }

  .sub-tabs button,
  .panel > .tabs:first-child button {
    flex: 0 0 auto;
    min-width: max-content;
    line-height: 1.2;
  }

  .toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 8px;
  }

  .toolbar input,
  .toolbar select {
    min-width: 0;
  }

  .grid,
  .grid.two,
  .grid.three,
  .grid.four,
  .inline-form,
  .user-form {
    grid-template-columns: 1fr;
  }

  label {
    gap: 6px;
    font-size: 13px;
  }

  input,
  select,
  textarea {
    min-height: 47px;
    font-size: 15px;
  }

  .actions {
    gap: 8px;
  }

  .actions button,
  .decision-form button {
    flex: 1 1 120px;
  }

  .notice-list,
  .approval-list,
  .timeline {
    gap: 9px;
  }

  .notice-item,
  .approval-item,
  .date-group {
    padding: 14px;
    border-radius: 18px;
  }

  .list-row {
    min-height: 44px;
    align-content: center;
    gap: 5px;
  }

  .row-title,
  .item-title {
    font-size: 15px;
    line-height: 1.35;
    word-break: keep-all;
  }

  .row-meta,
  .item-meta {
    gap: 5px 7px;
    font-size: 12px;
    line-height: 1.4;
  }

  .item-body {
    font-size: 13px;
    line-height: 1.5;
    word-break: keep-all;
  }

  .empty {
    padding: 22px 14px;
    border-radius: 18px;
  }

  .home-welcome {
    min-height: 128px;
    border-radius: 24px;
  }

  .home-welcome strong {
    font-size: 22px;
  }

  .quick-card {
    min-height: 86px;
    padding: 14px;
    border-radius: 20px;
  }

  .quick-card strong {
    font-size: 15px;
  }

  .quick-card span {
    font-size: 12px;
  }

  .status-filter {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
    padding: 12px;
    background: var(--mobile-muted-bg);
    border: 1px solid var(--mobile-border);
    border-radius: 18px;
  }

  .filter-row {
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .filter-row::-webkit-scrollbar {
    display: none;
  }

  .filter-row > span {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 38px;
    padding: 7px 8px 7px 0;
    background: var(--mobile-muted-bg);
    text-align: left;
  }

  .filter-row button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 11px;
  }

  .student-mobile-list {
    display: grid;
    gap: 10px;
  }

  .student-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
    padding: 14px;
    border-radius: 20px;
  }

  .student-card > div:first-child {
    min-width: 0;
  }

  .student-card strong {
    display: block;
    font-size: 16px;
    line-height: 1.25;
  }

  .student-card span:not(.badge) {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.35;
  }

  .student-card .student-badges {
    justify-content: flex-end;
    max-width: 128px;
  }

  .student-card .text-button {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 38px;
  }

  .mobile-student-detail {
    grid-column: 1 / -1;
    margin-top: 2px;
    padding: 14px;
    background: var(--mobile-muted-bg);
    border: 1px solid var(--mobile-border);
    border-radius: 18px;
  }

  .mobile-student-detail .panel-head {
    display: grid;
    grid-template-columns: 1fr;
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .mobile-student-detail .student-badges {
    justify-content: flex-start;
    max-width: none;
  }

  .student-detail-content > h3 {
    margin: 14px 0 8px;
    font-size: 16px;
    text-align: center;
  }

  .detail-list {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .detail-item,
  .stat {
    min-width: 0;
    padding: 13px;
    border: 1px solid var(--mobile-border);
    border-radius: 16px;
    overflow: hidden;
  }

  .detail-item strong,
  .stat strong {
    word-break: break-word;
  }

  .date-group > strong {
    margin: -14px -14px 12px;
    padding: 11px 14px;
    border-radius: 18px 18px 0 0;
  }

  .date-group .log-item {
    padding: 12px 0;
  }

  .date-group .log-item:first-of-type {
    padding-top: 0;
  }

  .date-group .log-item:last-child {
    padding-bottom: 0;
  }

  .table-wrap:not(.student-table-wrap) {
    overflow: visible;
    border: 0;
  }

  .table-wrap:not(.student-table-wrap) table,
  .table-wrap:not(.student-table-wrap) thead,
  .table-wrap:not(.student-table-wrap) tbody,
  .table-wrap:not(.student-table-wrap) tr,
  .table-wrap:not(.student-table-wrap) th,
  .table-wrap:not(.student-table-wrap) td {
    display: block;
  }

  .table-wrap:not(.student-table-wrap) table {
    min-width: 0;
    background: transparent;
  }

  .table-wrap:not(.student-table-wrap) thead {
    display: none;
  }

  .table-wrap:not(.student-table-wrap) tbody {
    display: grid;
    gap: 10px;
  }

  .table-wrap:not(.student-table-wrap) tr {
    padding: 13px;
    background: var(--mobile-card);
    border: 1px solid var(--mobile-border);
    border-radius: 18px;
  }

  .table-wrap:not(.student-table-wrap) td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(223, 230, 242, 0.76);
    white-space: normal;
    text-align: right;
  }

  .table-wrap:not(.student-table-wrap) td:last-child {
    border-bottom: 0;
  }

  .table-wrap:not(.student-table-wrap) td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-align: left;
  }

  .sidebar {
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    padding: 6px;
    border-radius: 22px;
  }

  .nav-list {
    display: flex;
    justify-content: stretch;
    gap: 2px;
    overflow: hidden;
  }

  .nav-list button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 50px;
    padding: 5px 3px;
    border-radius: 16px;
    font-size: 10px;
  }

  .nav-icon {
    width: 23px;
    height: 23px;
  }
}

@media (max-width: 760px) {
  :root[data-theme="dark"] {
    --mobile-border: rgba(54, 68, 98, 0.92);
    --mobile-muted-bg: #101a2e;
  }

  :root[data-theme="dark"] .topbar {
    border-bottom-color: rgba(54, 68, 98, 0.72);
  }

  :root[data-theme="dark"] .panel-head,
  :root[data-theme="dark"] .mobile-student-detail,
  :root[data-theme="dark"] .date-group .log-item,
  :root[data-theme="dark"] .table-wrap:not(.student-table-wrap) td {
    border-color: rgba(54, 68, 98, 0.8);
  }

  :root[data-theme="dark"] .status-filter,
  :root[data-theme="dark"] .filter-row > span,
  :root[data-theme="dark"] .mobile-student-detail,
  :root[data-theme="dark"] .table-wrap:not(.student-table-wrap) tr {
    background: var(--mobile-muted-bg);
  }
}

.home-welcome {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: stretch;
  gap: 16px;
  text-align: left;
}

.home-welcome > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.home-welcome .today-label {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  min-height: 28px;
  margin: 0 0 4px;
  padding: 5px 10px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.home-welcome-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(51, 73, 143, 0.16);
}

@media (max-width: 760px) {
  .home-welcome {
    grid-template-columns: minmax(0, 1fr) 72px;
    align-content: center;
    align-items: center;
    justify-items: stretch;
    min-height: 132px;
  }

  .home-welcome::before {
    content: none;
    display: none;
  }

  .home-welcome .today-label {
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.92);
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.18);
  }

  .home-welcome-logo {
    width: 72px;
    height: 72px;
    box-shadow: 0 10px 22px rgba(16, 24, 42, 0.18);
  }
}

:root[data-theme="dark"] .home-welcome .today-label {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

input[type="date"] {
  width: 150px;
  max-width: 100%;
}

input[type="time"] {
  width: 118px;
  max-width: 100%;
}

:root[data-theme="dark"] .entity-edit {
  background: #101a2e;
}

:root[data-theme="dark"] .entity-card[open] summary {
  border-bottom-color: var(--line);
}

:root[data-theme="dark"] .entity-card summary::after {
  color: var(--primary);
}

:root[data-theme="dark"] .duty-filter button {
  color: var(--muted);
  background: #101a2e;
  border-color: #2d3953;
}

:root[data-theme="dark"] .duty-filter button.active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.permissions-grid input[type="checkbox"] {
  accent-color: var(--primary);
}

:root[data-theme="dark"] .permissions-grid .check-line {
  color: var(--ink);
  background: #101a2e;
  border-color: #2d3953;
}

:root[data-theme="dark"] .permissions-grid .check-line:has(input:checked) {
  color: #ffffff;
  background: rgba(51, 73, 143, 0.34);
  border-color: var(--primary);
}

.pull-refresh-indicator {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  left: 50%;
  z-index: 120;
  min-height: 36px;
  display: grid;
  place-items: center;
  padding: 8px 14px;
  color: var(--primary);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(30, 42, 70, 0.16);
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -58px);
  transition: opacity 0.16s ease, transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.pull-refresh-indicator.show {
  opacity: 1;
}

.pull-refresh-indicator.ready {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

:root[data-theme="dark"] .pull-refresh-indicator {
  color: #ffffff;
  background: #101a2e;
  border-color: #2d3953;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

:root[data-theme="dark"] .pull-refresh-indicator.ready {
  background: var(--primary);
  border-color: var(--primary);
}

.people-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.people-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.48fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
}

.people-row:last-child {
  border-bottom: 0;
}

.people-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.people-main strong {
  min-width: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.people-meta {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.people-meta div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.people-meta dt,
.people-meta dd {
  margin: 0;
}

.people-meta dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.people-meta dd {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-groups {
  display: grid;
  gap: 22px;
}

.status-group {
  padding: 14px 16px 12px;
  background: #f8faff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: 16px;
}

.status-group h4 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 16px;
  line-height: 1.35;
}

.status-group h4 span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.guidance-picker {
  display: grid;
  gap: 10px;
}

.guidance-selected {
  min-height: 44px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f8faff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.guidance-selected.is-empty {
  display: none;
}

.guidance-selected strong {
  color: var(--ink);
  font-size: 14px;
}

.guidance-results {
  display: grid;
  gap: 6px;
}

.guidance-results button {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
}

.guidance-results button strong,
.guidance-results button span {
  min-width: 0;
}

.guidance-results button span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.empty.mini {
  padding: 12px;
  border-radius: 12px;
}

:root[data-theme="dark"] .status-group,
:root[data-theme="dark"] .guidance-selected {
  background: #101a2e;
  border-color: var(--line);
}

:root[data-theme="dark"] .guidance-results button {
  color: var(--ink);
  background: #101a2e;
  border-color: var(--line);
}

:root[data-theme="dark"] .guidance-selected strong {
  color: var(--ink);
}

:root[data-theme="dark"] .people-list,
:root[data-theme="dark"] .people-row {
  border-color: var(--line);
}

:root[data-theme="dark"] .people-main strong,
:root[data-theme="dark"] .people-meta dd {
  color: var(--ink);
}

.nav-list button {
  position: relative;
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  min-width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  color: #ffffff;
  background: #e64242;
  border: 2px solid #ffffff;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 5px 12px rgba(230, 66, 66, 0.25);
}

:root[data-theme="dark"] .nav-badge {
  border-color: #0b1220;
}

@media (min-width: 761px) {
  .nav-badge {
    display: none;
  }
}

@media (max-width: 760px) {
  .nav-badge {
    top: 2px;
    right: 6px;
  }
}

.topbar-title {
  flex: 1;
  min-width: 0;
}

.topbar .topbar-actions {
  flex: 0 0 auto;
  display: flex !important;
  align-items: center;
  gap: 8px !important;
}

.topbar .top-action-button {
  position: relative;
  min-width: 76px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  place-items: center;
  gap: 5px;
  padding: 8px 12px;
  color: var(--primary);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(30, 42, 70, 0.08);
  font-size: 12px;
  font-weight: 900;
}

.nav-icon,
.topbar .top-action-button,
.icon-button,
.icon-close-button,
.notification-item-icon {
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.nav-icon {
  font-size: 17px;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.nav-list button.active .nav-icon,
:root[data-theme="dark"] .nav-icon,
:root[data-theme="dark"] .nav-list button.active .nav-icon {
  color: inherit;
  background: transparent !important;
  box-shadow: none !important;
}

.topbar .top-theme-toggle {
  display: grid;
}

.top-notification-badge {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 19px;
  height: 19px;
  place-items: center;
  padding: 0 5px;
  color: #ffffff;
  background: #e64242;
  border: 2px solid #ffffff;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.top-notification-badge:not([hidden]) {
  display: inline-grid;
}

.notification-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.notification-layer[hidden] {
  display: none;
}

.notification-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  background: rgba(15, 23, 42, 0.38);
  border: 0;
  border-radius: 0;
  backdrop-filter: blur(3px);
}

.notification-panel {
  position: absolute;
  top: 78px;
  right: max(18px, calc((100vw - 1480px) / 2 + 18px));
  width: min(420px, calc(100vw - 36px));
  max-height: min(680px, calc(100vh - 98px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.26);
}

.notification-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.notification-panel-head h3,
.notification-panel-head .kicker {
  margin: 0;
}

.notification-panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.web-push-control {
  margin: 12px 20px;
}

.web-push-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid #c9d8fb;
  border-radius: 12px;
  background: #f4f7ff;
  color: #16254b;
}

.web-push-status > div,
.web-push-status strong,
.web-push-status span {
  display: block;
}

.web-push-status span {
  margin-top: 3px;
  font-size: 12px;
  color: #657493;
}

.web-push-status.is-warning {
  border-color: #f0cf94;
  background: #fff8eb;
}

button.compact {
  min-height: 36px;
  padding: 7px 12px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .notification-panel-actions {
    gap: 6px;
  }

  .web-push-control {
    margin: 0 14px 10px;
  }

  .web-push-status {
    align-items: flex-start;
    flex-direction: column;
    padding: 11px 12px;
  }

  .web-push-status button {
    width: 100%;
  }
}

.icon-close-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: inherit;
  font-size: 24px;
  line-height: 1;
}

.notification-list {
  min-height: 160px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.notification-item {
  width: 100%;
  min-height: 88px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 11px;
  padding: 15px 18px;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  text-align: left;
}

.notification-item:last-child {
  border-bottom: 0;
}

.notification-item.unread {
  background: var(--primary-soft);
}

.notification-item-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}

.notification-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.notification-copy strong,
.notification-copy span {
  overflow-wrap: anywhere;
}

.notification-copy span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.notification-copy time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

body.notification-open {
  overflow: hidden;
}

:root[data-theme="dark"] .topbar .top-action-button {
  color: #ffffff;
  background: #18243a;
  border-color: var(--line);
}

:root[data-theme="dark"] .top-notification-badge {
  border-color: #0d1424;
}

:root[data-theme="dark"] .notification-panel,
:root[data-theme="dark"] .notification-item {
  background: #151f33;
  border-color: var(--line);
}

:root[data-theme="dark"] .notification-item.unread {
  background: #1b2945;
}

@media (max-width: 760px) {
  .topbar .topbar-actions {
    gap: 6px !important;
  }

  .topbar .top-action-button {
    min-width: 68px;
    min-height: 36px;
    padding: 7px 9px;
    font-size: 11px;
  }

  .notification-panel {
    top: auto;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 8px;
    width: auto;
    max-height: min(76dvh, 680px);
    border-radius: 22px;
  }

  .notification-panel-head {
    padding: 16px;
  }

  .notification-item {
    min-height: 82px;
    padding: 14px 16px;
  }
}

@media (max-width: 760px) {
  html,
  body {
    overscroll-behavior-y: contain;
  }

  .people-list {
    border-top: 0;
  }

  .people-row {
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 13px 0;
  }

  .people-main {
    justify-content: space-between;
  }

  .people-main strong {
    text-align: right;
  }

  .people-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 12px;
  }

  .people-meta.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .people-meta dt,
  .people-meta dd {
    text-align: center;
  }

  .people-meta div {
    padding: 8px 6px;
    background: var(--mobile-muted-bg);
    border: 1px solid var(--mobile-border);
    border-radius: 12px;
  }

  .status-groups {
    gap: 18px;
  }

  .status-group {
    padding: 13px 12px 10px;
    border-left-width: 4px;
    border-radius: 15px;
  }

  .status-group h4 {
    margin-bottom: 4px;
    font-size: 15px;
  }

  .guidance-results button {
    display: grid;
    justify-items: start;
    gap: 2px;
  }

  .guidance-results button span {
    text-align: left;
  }

  input[type="date"] {
    width: 148px;
  }

  input[type="time"] {
    width: 116px;
  }
}

/* Simplified interface layer */
:root {
  --ui-page: #f5f7fa;
  --ui-surface: #ffffff;
  --ui-subtle: #f7f8fb;
  --ui-line: #e1e5ec;
  --ui-text: #182033;
  --ui-muted: #6b7485;
}

body {
  color: var(--ui-text);
  background: var(--ui-page);
}

.topbar,
.content,
.sidebar > div {
  max-width: 1280px;
}

.topbar {
  min-height: 72px;
  padding: 12px 20px;
}

.topbar-logo {
  width: 46px;
  height: 46px;
  box-shadow: none;
}

.topbar-school {
  font-size: 21px;
}

.content {
  padding: 32px 20px 48px;
  background: transparent;
}

.view {
  gap: 18px;
}

.sidebar {
  background: var(--primary);
}

.nav-list {
  justify-content: flex-start;
}

.nav-list button {
  min-height: 56px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 22px;
  border-radius: 0;
  font-size: 14px;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
}

.nav-list button:hover,
.nav-list button.active {
  background: rgba(0, 0, 0, 0.12);
}

.nav-list button.active {
  box-shadow: inset 0 -3px 0 #ffffff;
}

.panel {
  padding: 22px 24px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  box-shadow: none;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ui-line);
}

.panel h3,
.panel-head h3 {
  color: var(--ui-text);
  font-size: 19px;
}

.panel-head p {
  margin-top: 3px;
  color: var(--ui-muted);
  font-size: 13px;
}

input,
select,
textarea {
  min-height: 44px;
  padding: 10px 12px;
  background: var(--ui-surface);
  border: 1px solid #ccd3de;
  border-radius: 6px;
}

textarea {
  min-height: 108px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(51, 73, 143, 0.1);
}

.primary,
.secondary,
.ghost,
.danger,
.text-button,
.icon-button {
  min-height: 40px;
  padding: 9px 13px;
  border-radius: 6px;
  box-shadow: none;
}

.primary:hover,
.secondary:hover,
.ghost:hover,
.danger:hover,
.text-button:hover {
  filter: brightness(0.97);
  box-shadow: none;
}

.secondary {
  background: var(--primary-soft);
  border-color: #d5dcf4;
}

.ghost,
.text-button {
  background: transparent;
  border-color: var(--ui-line);
}

.text-button {
  min-height: 34px;
  padding: 6px 9px;
  color: var(--primary);
}

.actions {
  gap: 8px;
}

.toolbar {
  gap: 8px;
}

.toolbar input,
.toolbar select {
  min-width: 0;
}

.sub-tabs,
.panel > .tabs:first-child {
  width: 100%;
  min-height: 48px;
  margin: 0 0 14px;
  padding: 0;
  gap: 4px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ui-line);
  border-radius: 0;
  box-shadow: none;
}

.tabs button,
.sub-tabs button {
  min-height: 47px;
  padding: 10px 15px;
  color: var(--ui-muted);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  box-shadow: none;
}

.tabs button.active,
.sub-tabs button.active {
  color: var(--primary);
  background: transparent;
  border-bottom-color: var(--primary);
  box-shadow: none;
}

.school-home-top {
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.school-hero {
  border: 1px solid var(--ui-line);
  border-radius: 8px;
}

.school-side,
.home-account-row {
  gap: 10px;
}

.home-account-row .side-user {
  display: none;
}

.home-welcome {
  min-height: 118px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: start;
  padding: 20px;
  color: #ffffff;
  background: var(--primary);
  border: 0;
  border-radius: 8px;
  box-shadow: none;
  text-align: left;
}

.home-welcome strong {
  color: #ffffff;
  font-size: 22px;
}

.home-welcome span,
.home-welcome .today-label {
  color: rgba(255, 255, 255, 0.82);
}

.home-welcome-logo {
  width: 82px;
  height: 82px;
}

.home-shortcuts,
.quick-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quick-card {
  min-height: 70px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
  color: var(--ui-text);
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-left: 1px solid var(--ui-line);
  border-radius: 8px;
  box-shadow: none;
  text-align: left;
}

.quick-card:nth-child(odd) {
  background: var(--ui-surface);
}

.quick-card:hover,
.quick-card:focus-visible {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.quick-card::before,
.quick-card::after {
  display: none;
}

.quick-card .quick-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: inherit;
  background: var(--primary-soft);
  border-radius: 8px;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 19px;
}

.quick-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.quick-card strong {
  color: var(--ui-text);
  font-size: 14px;
}

.quick-card span {
  color: var(--ui-muted);
  font-size: 11px;
}

.notice-list,
.approval-list {
  gap: 0;
}

.notice-item,
.approval-item,
.entity-card,
.date-group,
.stat,
.detail-item {
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  box-shadow: none;
}

.notice-item {
  border-width: 0 0 1px;
  border-radius: 0;
}

.notice-item:last-child {
  border-bottom: 0;
}

.notice-item .list-row {
  padding: 13px 4px;
}

.approval-item {
  padding: 16px;
}

.item-meta {
  gap: 6px 10px;
  color: var(--ui-muted);
  font-size: 12px;
}

.item-title {
  margin-top: 8px;
  font-size: 16px;
}

.item-body {
  color: var(--ui-text);
  line-height: 1.55;
}

.badge {
  padding: 4px 7px;
  border-radius: 6px;
  font-size: 11px;
}

.status-filter {
  gap: 10px;
  padding: 12px;
  background: var(--ui-subtle);
  border: 1px solid var(--ui-line);
  border-radius: 8px;
}

.filter-row {
  gap: 6px;
}

.filter-row > span {
  min-width: 42px;
  color: var(--ui-muted);
  text-align: left;
}

.filter-row button {
  min-height: 32px;
  padding: 6px 10px;
  color: var(--ui-text);
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 6px;
}

.filter-row button.active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.status-group {
  padding: 0;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-left: 1px solid var(--ui-line);
  border-radius: 8px;
}

.status-group h4 {
  margin: 0;
  padding: 13px 15px;
  color: var(--ui-text);
  border-bottom: 1px solid var(--ui-line);
}

.status-group .people-list {
  padding: 0 15px;
}

.people-row {
  padding: 13px 0;
}

.people-meta div {
  background: transparent;
  border: 0;
}

.table-wrap {
  border-color: var(--ui-line);
  border-radius: 8px;
}

table {
  background: var(--ui-surface);
}

th {
  background: var(--ui-subtle);
}

th,
td {
  padding: 12px;
  border-color: var(--ui-line);
}

.entity-card summary {
  padding: 14px;
}

.entity-edit {
  border-top-color: var(--ui-line);
}

.empty,
.loading {
  color: var(--ui-muted);
  text-align: center;
}

.notification-panel {
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.2);
}

:root[data-theme="dark"] {
  --ui-page: #0e1524;
  --ui-surface: #151e2f;
  --ui-subtle: #1a2538;
  --ui-line: #2c3850;
  --ui-text: #eef2f8;
  --ui-muted: #a6b0c2;
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] .content {
  color: var(--ui-text);
  background: var(--ui-page);
}

:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .quick-card,
:root[data-theme="dark"] .quick-card:nth-child(odd),
:root[data-theme="dark"] .notice-item,
:root[data-theme="dark"] .approval-item,
:root[data-theme="dark"] .entity-card,
:root[data-theme="dark"] .date-group,
:root[data-theme="dark"] .detail-item,
:root[data-theme="dark"] .stat,
:root[data-theme="dark"] .status-group,
:root[data-theme="dark"] table {
  color: var(--ui-text);
  background: var(--ui-surface);
  border-color: var(--ui-line);
}

:root[data-theme="dark"] .panel h3,
:root[data-theme="dark"] .panel-head h3,
:root[data-theme="dark"] .quick-card strong,
:root[data-theme="dark"] .status-group h4,
:root[data-theme="dark"] .item-title,
:root[data-theme="dark"] .item-body {
  color: var(--ui-text);
}

:root[data-theme="dark"] .panel-head,
:root[data-theme="dark"] .notice-item,
:root[data-theme="dark"] .status-group h4,
:root[data-theme="dark"] th,
:root[data-theme="dark"] td {
  border-color: var(--ui-line);
}

:root[data-theme="dark"] .status-filter,
:root[data-theme="dark"] th {
  background: var(--ui-subtle);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .filter-row button {
  color: var(--ui-text);
  background: var(--ui-surface);
  border-color: var(--ui-line);
}

:root[data-theme="dark"] .quick-card:hover,
:root[data-theme="dark"] .quick-card:focus-visible {
  background: var(--primary-soft);
}

@media (max-width: 1000px) and (min-width: 761px) {
  .school-home-top {
    grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.65fr);
  }

  .nav-list button {
    padding-inline: 16px;
  }
}

@media (max-width: 760px) {
  body {
    background: var(--ui-page);
  }

  .topbar {
    position: sticky;
    top: 0;
    min-height: 62px;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--ui-line);
    backdrop-filter: blur(14px);
  }

  .topbar-logo {
    width: 32px;
    height: 32px;
  }

  .topbar-school {
    font-size: 10px;
  }

  .topbar h2 {
    font-size: 17px;
  }

  .topbar .topbar-actions {
    gap: 5px !important;
  }

  .topbar .top-action-button {
    min-width: 64px;
    min-height: 34px;
    padding: 6px 8px;
    border-radius: 999px;
    box-shadow: none;
    font-size: 10px;
  }

  .content {
    padding: 12px calc(12px + env(safe-area-inset-right)) calc(78px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
  }

  .view {
    gap: 12px;
  }

  .school-home-top {
    display: block;
  }

  .school-side {
    gap: 10px;
  }

  .home-account-row .side-user {
    display: grid;
  }

  .home-welcome {
    min-height: 124px;
    padding: 18px;
    background: var(--primary);
    border-radius: 8px;
    box-shadow: none;
  }

  .home-welcome::before {
    display: none;
  }

  .home-welcome strong {
    font-size: 21px;
  }

  .home-welcome-logo {
    width: 70px;
    height: 70px;
  }

  .side-user {
    min-height: 54px;
    padding: 12px 14px;
    background: var(--ui-surface);
    border: 1px solid var(--ui-line);
    border-radius: 8px;
    box-shadow: none;
  }

  .side-user::after {
    background: transparent;
  }

  .home-shortcuts,
  .quick-grid {
    gap: 8px;
  }

  .quick-card {
    min-height: 68px;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
    border-radius: 8px;
  }

  .quick-card .quick-icon {
    width: 34px;
    height: 34px;
    font-size: 17px;
  }

  .quick-card strong {
    font-size: 13px;
  }

  .quick-card span {
    font-size: 10px;
  }

  .panel {
    padding: 16px;
    background: var(--ui-surface);
    border: 1px solid var(--ui-line);
    border-radius: 8px;
    box-shadow: none;
  }

  .panel-head {
    margin-bottom: 12px;
    padding-bottom: 11px;
  }

  .panel h3,
  .panel-head h3 {
    font-size: 17px;
  }

  .panel-head p {
    font-size: 12px;
  }

  .sub-tabs,
  .panel > .tabs:first-child {
    margin-bottom: 10px;
  }

  .tabs button,
  .sub-tabs button {
    min-height: 43px;
    padding: 9px 12px;
    font-size: 13px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    padding: 10px 11px;
    border-radius: 6px;
  }

  .primary,
  .secondary,
  .ghost,
  .danger {
    min-height: 42px;
    border-radius: 6px;
  }

  .notice-list,
  .approval-list {
    gap: 0;
  }

  .notice-item {
    padding: 0;
  }

  .approval-item,
  .entity-card,
  .date-group {
    padding: 13px;
    border-radius: 8px;
  }

  .student-card {
    padding: 13px;
    background: var(--ui-surface);
    border: 1px solid var(--ui-line);
    border-radius: 8px;
    box-shadow: none;
  }

  .student-card .text-button {
    min-height: 36px;
    border: 1px solid var(--ui-line);
    border-radius: 6px;
  }

  .detail-item,
  .stat {
    padding: 12px;
    background: var(--ui-subtle);
    border-radius: 8px;
  }

  .status-filter {
    padding: 10px;
  }

  .filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .filter-row > span {
    position: sticky;
    left: 0;
    z-index: 1;
    padding-right: 8px;
    background: var(--ui-subtle);
  }

  .people-row {
    padding: 12px 0;
  }

  .people-meta div {
    padding: 4px 2px;
    background: transparent;
    border: 0;
    border-radius: 0;
  }

  .sidebar {
    left: 0;
    right: 0;
    bottom: 0;
    padding: 5px calc(6px + env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left));
    background: rgba(255, 255, 255, 0.97);
    border: 0;
    border-top: 1px solid var(--ui-line);
    border-radius: 0;
    box-shadow: 0 -5px 16px rgba(15, 23, 42, 0.06);
  }

  .nav-list {
    gap: 0;
  }

  .nav-list button {
    min-height: 52px;
    flex-direction: column;
    padding: 5px 2px;
    color: #7c8493;
    background: transparent;
    border-radius: 6px;
    box-shadow: none;
    font-size: 10px;
  }

  .nav-list button:hover,
  .nav-list button.active {
    color: var(--primary);
    background: transparent;
    box-shadow: none;
  }

  .nav-icon {
    width: 24px;
    height: 24px;
    font-size: 17px;
  }

  .nav-badge {
    top: 1px;
    right: 7px;
  }

  .notification-panel {
    right: 6px;
    bottom: calc(6px + env(safe-area-inset-bottom));
    left: 6px;
    border-radius: 8px;
  }

  :root[data-theme="dark"] .topbar,
  :root[data-theme="dark"] .sidebar {
    background: rgba(14, 21, 36, 0.97);
    border-color: var(--ui-line);
  }

  :root[data-theme="dark"] .side-user,
  :root[data-theme="dark"] .student-card {
    background: var(--ui-surface);
    border-color: var(--ui-line);
  }
}

/* Soft visual polish */
:root {
  --ui-soft-blue: #f0f3fb;
  --ui-soft-mint: #eef7f4;
  --ui-soft-warm: #faf6ec;
  --ui-shadow: 0 8px 24px rgba(31, 43, 76, 0.07);
  --ui-shadow-hover: 0 12px 28px rgba(31, 43, 76, 0.11);
}

.panel {
  position: relative;
  border-radius: 12px;
  box-shadow: var(--ui-shadow);
}

.panel::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 22px;
  width: 44px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}

.panel-head {
  position: relative;
}

.panel-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-head h3::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: var(--primary);
  border-radius: 50%;
}

.home-welcome {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  box-shadow: 0 12px 26px rgba(51, 73, 143, 0.18);
}

.home-welcome::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -34px;
  width: 120px;
  height: 90px;
  border: 18px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  transform: rotate(-12deg);
  pointer-events: none;
}

.home-welcome > *,
.home-welcome-logo {
  position: relative;
  z-index: 1;
}

.quick-card {
  position: relative;
  border-radius: 11px;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.quick-card:nth-child(3n + 1) .quick-icon {
  background: var(--ui-soft-blue);
}

.quick-card:nth-child(3n + 2) .quick-icon {
  background: var(--ui-soft-mint);
}

.quick-card:nth-child(3n) .quick-icon {
  background: var(--ui-soft-warm);
}

.quick-card:hover,
.quick-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--ui-shadow-hover);
}

.quick-card::after {
  content: "›";
  position: absolute;
  right: 11px;
  top: 50%;
  display: block;
  color: #9aa4b5;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  transform: translateY(-50%);
}

.quick-copy {
  padding-right: 14px;
}

.notice-item .list-row {
  position: relative;
  border-radius: 8px;
  transition:
    padding 160ms ease,
    background-color 160ms ease;
}

.notice-item .list-row:hover,
.notice-item .list-row:focus-visible {
  padding-right: 12px;
  padding-left: 12px;
  background: var(--ui-soft-blue);
}

.approval-item,
.entity-card,
.date-group,
.student-card,
.status-group {
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.approval-item:hover,
.entity-card:hover,
.student-card:hover {
  border-color: #c7d1e6;
  box-shadow: 0 6px 18px rgba(31, 43, 76, 0.06);
}

.sub-tabs,
.panel > .tabs:first-child {
  padding: 4px 4px 0;
  background: var(--ui-soft-blue);
  border: 1px solid var(--ui-line);
  border-bottom-color: var(--ui-line);
  border-radius: 10px 10px 0 0;
}

.tabs button,
.sub-tabs button {
  border-radius: 7px 7px 0 0;
}

.tabs button:hover,
.sub-tabs button:hover {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.72);
}

.tabs button.active,
.sub-tabs button.active {
  background: var(--ui-surface);
}

.status-filter {
  border-radius: 10px;
}

.filter-row button {
  transition:
    color 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

.filter-row button:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.primary,
.secondary,
.ghost,
.danger,
.text-button {
  transition:
    transform 140ms ease,
    filter 140ms ease,
    box-shadow 140ms ease;
}

.primary:hover,
.secondary:hover,
.ghost:hover,
.danger:hover,
.text-button:hover {
  transform: translateY(-1px);
}

.primary {
  box-shadow: 0 5px 12px rgba(51, 73, 143, 0.14);
}

.topbar .top-action-button {
  box-shadow: 0 5px 14px rgba(31, 43, 76, 0.07);
}

.notification-panel {
  border-radius: 12px;
}

:root[data-theme="dark"] {
  --ui-soft-blue: #1b2943;
  --ui-soft-mint: #172d2c;
  --ui-soft-warm: #2d291f;
  --ui-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  --ui-shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.25);
}

:root[data-theme="dark"] .quick-card:hover,
:root[data-theme="dark"] .quick-card:focus-visible,
:root[data-theme="dark"] .notice-item .list-row:hover,
:root[data-theme="dark"] .notice-item .list-row:focus-visible {
  background: var(--ui-soft-blue);
}

:root[data-theme="dark"] .tabs button:hover,
:root[data-theme="dark"] .sub-tabs button:hover,
:root[data-theme="dark"] .tabs button.active,
:root[data-theme="dark"] .sub-tabs button.active {
  background: var(--ui-surface);
}

@media (max-width: 760px) {
  .panel {
    border-radius: 12px;
    box-shadow: 0 5px 16px rgba(31, 43, 76, 0.05);
  }

  .panel::before {
    left: 16px;
    width: 34px;
  }

  .home-welcome {
    border-radius: 14px;
    box-shadow: 0 9px 22px rgba(51, 73, 143, 0.16);
  }

  .quick-card {
    border-radius: 11px;
  }

  .quick-card:hover,
  .quick-card:focus-visible {
    transform: none;
    box-shadow: none;
  }

  .quick-card::after {
    right: 8px;
    font-size: 16px;
  }

  .sub-tabs,
  .panel > .tabs:first-child {
    padding: 3px 3px 0;
    border-radius: 9px 9px 0 0;
  }

  .approval-item,
  .entity-card,
  .date-group,
  .student-card,
  .status-group,
  .notification-panel {
    border-radius: 10px;
  }

  .primary:hover,
  .secondary:hover,
  .ghost:hover,
  .danger:hover,
  .text-button:hover,
  .filter-row button:hover {
    transform: none;
  }
}

/* Final mobile financial-app navigation override */
@media (max-width: 760px) {
  .content {
    padding-bottom: calc(94px + env(safe-area-inset-bottom));
  }

  .app-shell .sidebar {
    position: fixed;
    z-index: 80;
    top: auto;
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: auto;
    height: auto;
    min-height: 0;
    display: block;
    padding: 6px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(218, 224, 235, 0.96);
    border-radius: 22px;
    box-shadow: 0 14px 34px rgba(30, 42, 70, 0.16);
    backdrop-filter: blur(18px);
  }

  .app-shell .sidebar > div {
    width: 100%;
    max-width: none;
  }

  .app-shell .nav-list {
    width: 100%;
    display: flex;
    justify-content: stretch;
    gap: 2px;
    overflow: visible;
  }

  .app-shell .nav-list button {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    min-height: 52px;
    flex-direction: column;
    gap: 2px;
    padding: 5px 2px;
    color: #7c8596;
    background: transparent;
    border: 0;
    border-radius: 16px;
    box-shadow: none;
    font-size: 10px;
  }

  .app-shell .nav-list button:hover {
    color: var(--primary);
    background: var(--primary-soft);
  }

  .app-shell .nav-list button.active {
    color: #ffffff;
    background: var(--primary);
    border: 0;
    box-shadow: 0 7px 16px rgba(51, 73, 143, 0.22);
  }

  .app-shell .nav-list .nav-icon,
  .app-shell .nav-list button.active .nav-icon {
    width: 24px;
    height: 24px;
    color: inherit;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: 17px;
  }

  .app-shell .nav-badge {
    top: 1px;
    right: 6px;
    border-color: #ffffff;
  }

  :root[data-theme="dark"] .app-shell .sidebar {
    background: rgba(20, 29, 47, 0.96);
    border-color: rgba(58, 70, 94, 0.96);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3);
  }

  :root[data-theme="dark"] .app-shell .nav-list button {
    color: #a8b2c5;
  }

  :root[data-theme="dark"] .app-shell .nav-list button:hover {
    color: #ffffff;
    background: #1d2a45;
  }

  :root[data-theme="dark"] .app-shell .nav-list button.active {
    color: #ffffff;
    background: var(--primary);
  }

  :root[data-theme="dark"] .app-shell .nav-badge {
    border-color: #141d2f;
  }
}

/* Student status dark-mode alignment */
:root[data-theme="dark"] .student-status-table {
  color: var(--ui-text);
  background: var(--ui-surface);
}

:root[data-theme="dark"] .student-status-table thead,
:root[data-theme="dark"] .student-status-table th {
  color: #cbd5e6;
  background: #1b2639;
  border-color: var(--ui-line);
}

:root[data-theme="dark"] .student-status-table td {
  color: var(--ui-text);
  background: var(--ui-surface);
  border-color: var(--ui-line);
}

:root[data-theme="dark"] .student-status-table tr.selected td {
  background: #1b2943;
}

.teacher-table-wrap {
  border-top: 2px solid var(--primary);
  border-radius: 0 0 14px 14px;
}

.teacher-status-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

.teacher-status-table th,
.teacher-status-table td {
  padding: 15px 14px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  text-align: center;
  vertical-align: middle;
}

.teacher-status-table th {
  color: #0f172a;
  background: #e8f1ff;
  font-weight: 950;
}

.teacher-status-table td {
  color: var(--text);
  background: var(--panel);
}

.teacher-status-table .teacher-col-order,
.teacher-status-table .teacher-order-cell {
  width: 72px;
}

.teacher-status-table .teacher-order-cell {
  color: #0f172a;
  background: #f1f6ff;
  font-weight: 950;
}

.teacher-status-table strong {
  font-weight: 950;
}

:root[data-theme="dark"] .teacher-table-wrap {
  border-color: var(--accent);
}

:root[data-theme="dark"] .teacher-status-table th {
  color: #eaf0ff;
  background: #182746;
  border-color: rgba(148, 163, 184, 0.22);
}

:root[data-theme="dark"] .teacher-status-table td {
  background: #111827;
  border-color: rgba(148, 163, 184, 0.18);
}

:root[data-theme="dark"] .teacher-status-table .teacher-order-cell {
  color: #dbe6ff;
  background: #17233c;
}

.student-status-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.student-status-table th,
.student-status-table td {
  padding: 10px 12px;
  vertical-align: middle;
  white-space: normal;
}

.student-status-table th {
  text-align: center;
}

.student-col-main {
  width: 48%;
}

.student-col-guidance {
  width: 20%;
}

.student-col-uniform {
  width: 20%;
}

.student-col-action {
  width: 12%;
}

.student-main-cell {
  min-width: 0;
}

.student-main-cell .student-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 26px;
  margin-right: 8px;
  padding: 3px 8px;
  color: var(--primary);
  background: rgba(51, 73, 143, 0.09);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
}

.student-main-cell strong {
  font-size: 15px;
  font-weight: 950;
}

.student-main-cell small {
  display: block;
  margin-top: 4px;
  color: var(--ui-muted, var(--muted));
  font-size: 12px;
  font-weight: 850;
  line-height: 1.3;
}

.student-guidance-cell,
.student-uniform-cell,
.student-action-cell {
  text-align: center;
}

.student-guidance-cell .student-badges,
.student-uniform-cell .student-badges {
  justify-content: center;
}

.student-empty-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 8px;
  color: var(--ui-muted, var(--muted));
  background: rgba(148, 163, 184, 0.12);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.student-action-cell .text-button {
  min-width: 64px;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 999px;
}

.student-grade-roster {
  display: grid;
  gap: 22px;
}

.student-grade-section {
  padding: 16px;
  background: rgba(51, 73, 143, 0.035);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 18px;
}

.student-grade-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.student-grade-head h4 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 950;
}

.student-grade-head span,
.student-class-column header span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 10px;
  color: var(--primary);
  background: rgba(51, 73, 143, 0.1);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
}

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

.student-class-column {
  min-width: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 14px;
}

.student-class-column header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(51, 73, 143, 0.08);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.student-class-column header strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 950;
}

.student-class-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.student-class-table th,
.student-class-table td {
  padding: 9px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  text-align: center;
  vertical-align: middle;
}

.student-class-table th {
  color: var(--muted);
  background: rgba(148, 163, 184, 0.08);
  font-size: 11px;
  font-weight: 950;
}

.student-class-table td {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.student-class-table tr.selected td {
  background: rgba(51, 73, 143, 0.1);
}

.student-class-table .text-button {
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.student-class-name {
  text-align: left !important;
}

.student-class-name strong {
  display: block;
  font-size: 13px;
  font-weight: 950;
}

.student-class-name > span {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.student-class-detail-row td {
  padding: 0;
  text-align: left;
}

.student-grade-detail {
  margin-top: 14px;
}

.student-grade-detail .desktop-student-detail {
  border-color: rgba(51, 73, 143, 0.22);
}

.student-class-empty {
  padding: 18px 12px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 850;
}

:root[data-theme="dark"] .student-main-cell .student-code {
  color: #dbe5ff;
  background: rgba(142, 162, 245, 0.18);
}

:root[data-theme="dark"] .student-grade-section {
  background: rgba(17, 24, 39, 0.64);
  border-color: rgba(148, 163, 184, 0.18);
}

:root[data-theme="dark"] .student-grade-head {
  border-color: rgba(148, 163, 184, 0.16);
}

:root[data-theme="dark"] .student-class-column {
  background: #111827;
  border-color: rgba(148, 163, 184, 0.18);
}

:root[data-theme="dark"] .student-class-column header {
  background: #182746;
  border-color: rgba(148, 163, 184, 0.16);
}

:root[data-theme="dark"] .student-class-table th {
  color: #aeb9cb;
  background: #142036;
}

:root[data-theme="dark"] .student-class-table th,
:root[data-theme="dark"] .student-class-table td {
  border-color: rgba(148, 163, 184, 0.14);
}

:root[data-theme="dark"] .student-class-table tr.selected td {
  background: #1b2943;
}

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

@media (max-width: 760px) {
  .student-grade-section {
    padding: 12px;
    border-radius: 18px;
  }

  .student-grade-head h4 {
    font-size: 18px;
  }

  .student-class-grid {
    grid-template-columns: 1fr;
  }

  .student-class-column {
    border-radius: 16px;
  }

  .student-class-table {
    table-layout: auto;
  }

  .student-class-table th,
  .student-class-table td {
    padding: 8px 6px;
    font-size: 12px;
  }

  .student-class-table th:nth-child(1),
  .student-class-table td:nth-child(1) {
    width: 42px;
  }

  .student-class-table th:nth-child(3),
  .student-class-table td:nth-child(3) {
    width: 42px;
  }

  .student-class-table th:nth-child(4),
  .student-class-table td:nth-child(4) {
    width: 58px;
  }

  .student-class-table th:nth-child(5),
  .student-class-table td:nth-child(5) {
    width: 58px;
  }
}

:root[data-theme="dark"] .student-empty-chip {
  color: #aeb9cb;
  background: rgba(255, 255, 255, 0.06);
}

:root[data-theme="dark"] .status-filter {
  background: #121c2d;
  border-color: var(--ui-line);
}

:root[data-theme="dark"] .status-filter .filter-row > span {
  color: #aeb9cb;
  background: transparent;
  border: 0;
}

:root[data-theme="dark"] .status-filter .filter-row button {
  color: #cbd5e6;
  background: #1a2538;
  border-color: #34415a;
}

:root[data-theme="dark"] .status-filter .filter-row button.active {
  color: #ffffff;
  background: #33498f;
  border-color: #5269b4;
}

.badge.uniform-permit {
  color: #ffffff;
  background: var(--primary);
}

.uniform-permit-panel {
  display: grid;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--ui-line);
  border-bottom: 1px solid var(--ui-line);
}

.uniform-permit-panel > .panel-head {
  margin-bottom: 0;
}

.uniform-permit-form {
  padding-top: 14px;
  border-top: 1px solid var(--ui-line);
}

.uniform-permit-form .wrap,
.uniform-permit-form .actions {
  grid-column: 1 / -1;
}

.uniform-permit-alert {
  display: grid;
  gap: 3px;
  margin: 10px 0;
  padding: 12px 14px;
  color: #26386f;
  background: #eef2ff;
  border: 1px solid #cbd5ff;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
}

.uniform-permit-alert span {
  color: #52607a;
  font-size: 13px;
  font-weight: 700;
}

:root[data-theme="dark"] .uniform-permit-panel,
:root[data-theme="dark"] .uniform-permit-form {
  border-color: var(--ui-line);
}

:root[data-theme="dark"] .uniform-permit-alert {
  color: #f2f5ff;
  background: #1b2943;
  border-color: #405482;
  border-left-color: var(--primary);
}

:root[data-theme="dark"] .uniform-permit-alert span {
  color: #c5cfe2;
}

@media (max-width: 760px) {
  :root[data-theme="dark"] .status-filter .filter-row > span {
    background: #121c2d;
  }

  :root[data-theme="dark"] .student-card {
    color: var(--ui-text);
    background: #151e2f;
    border-color: #2c3850;
  }

  :root[data-theme="dark"] .student-card.selected {
    background: #1b2943;
    border-color: #5269b4;
  }

  :root[data-theme="dark"] .student-card span:not(.badge) {
    color: #aeb9cb;
  }

  :root[data-theme="dark"] .student-card .text-button {
    color: #d7dff0;
    background: #1a2538;
    border-color: #34415a;
  }

  input[type="date"] {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 46px;
    min-width: 0;
    max-width: 100%;
    -webkit-appearance: none;
    appearance: none;
  }

  label:has(> input[type="date"]) {
    width: 100%;
    min-width: 0;
  }

  .uniform-permit-panel {
    padding: 14px 0;
  }
}

/* Android WebView scroll stability */
html.android-app,
html.android-app body {
  position: static !important;
  width: 100%;
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto !important;
  overscroll-behavior-y: auto;
  touch-action: pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
}

html.android-app .app-shell,
html.android-app .content,
html.android-app .view {
  position: relative;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-x: hidden;
  overflow-y: visible !important;
  touch-action: pan-y pinch-zoom;
}

/* iOS standalone safe-area theme synchronization */
.safe-area-top {
  display: none;
}

@media (max-width: 760px) {
  .safe-area-top {
    position: fixed;
    z-index: 59;
    top: 0;
    right: 0;
    left: 0;
    display: block;
    height: env(safe-area-inset-top);
    background: #ffffff;
    pointer-events: none;
  }

  html,
  body {
    background-color: #ffffff !important;
  }

  :root[data-theme="dark"],
  :root[data-theme="dark"] body {
    background-color: #0e1524 !important;
  }

  :root[data-theme="dark"] .safe-area-top,
  :root[data-theme="dark"] .topbar::before {
    background: #0e1524 !important;
  }
}

/* Desktop app-style refinement */
.budget-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(30, 42, 70, 0.08);
}

.budget-card-toggle {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
}

.budget-card-toggle:not(:disabled) {
  cursor: pointer;
}

.budget-card-toggle:disabled {
  cursor: default;
}

.budget-card-toggle:focus-visible {
  outline: 3px solid var(--primary-soft);
  outline-offset: 4px;
  border-radius: 14px;
}

.budget-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.budget-card-head > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.budget-card-head strong {
  color: var(--ui-text);
  font-size: 13px;
}

.budget-card-head span:not(.budget-icon) {
  color: var(--ui-muted);
  font-size: 11px;
  font-weight: 700;
}

.budget-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--primary-soft);
  border-radius: 12px;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.budget-amount {
  color: var(--primary);
  font-size: 26px;
  font-weight: 950;
  letter-spacing: 0;
}

.budget-edit-hint {
  width: fit-content;
  padding: 6px 10px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.budget-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.budget-form input {
  min-width: 0;
}

.approval-summary-main {
  width: 100%;
  display: grid;
  gap: 5px;
  margin-top: 10px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
}

.approval-summary-main strong {
  color: var(--ui-text);
  font-size: 16px;
  font-weight: 950;
}

.approval-summary-main span,
.approval-summary-main small {
  color: var(--ui-muted);
  font-size: 13px;
  font-weight: 700;
}

.approval-summary-main:hover strong,
.approval-summary-main:focus-visible strong {
  color: var(--primary);
}

.decision-form.compact {
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 8px;
}

.decision-form.compact button,
.decision-form button {
  min-width: 0;
  width: 100%;
  white-space: nowrap;
}

.approval-detail-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 16px;
}

.approval-detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.approval-detail-head h3 {
  margin: 8px 0 4px;
  color: var(--ui-text);
  font-size: 22px;
}

.approval-detail-head p {
  margin: 0;
  color: var(--ui-muted);
  font-weight: 700;
}

.approval-detail-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.approval-detail-meta div {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 12px;
  background: var(--ui-subtle);
  border: 1px solid var(--ui-line);
  border-radius: 12px;
}

.approval-detail-meta span {
  color: var(--ui-muted);
  font-size: 11px;
  font-weight: 800;
}

.approval-detail-meta strong {
  color: var(--ui-text);
  overflow-wrap: anywhere;
}

.approval-detail-body {
  min-height: 120px;
  margin: 0;
  padding: 16px;
  white-space: pre-wrap;
  background: var(--ui-subtle);
  border: 1px solid var(--ui-line);
  border-radius: 12px;
}

@media (min-width: 761px) {
  :root {
    --discord-bg: #f2f3f5;
    --discord-sidebar: #1e1f22;
    --discord-sidebar-soft: #2b2d31;
    --discord-text: #23272f;
    --discord-muted: #6d7584;
  }

  html,
  body {
    background: var(--discord-bg);
  }

  .app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    background: var(--discord-bg);
  }

  .sidebar {
    grid-column: 1;
    grid-row: 1 / span 2;
    position: sticky;
    top: 0;
    left: auto;
    right: auto;
    bottom: auto;
    width: 248px;
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    align-items: stretch;
    gap: 18px;
    padding: 18px 14px;
    background: linear-gradient(180deg, #202127 0%, #17181d 100%);
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
  }

  .sidebar > div {
    width: 100%;
    min-width: 0;
  }

  .app-brand,
  .user-box {
    display: flex;
  }

  .app-brand {
    align-items: center;
    gap: 10px;
    padding: 10px 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .app-brand strong,
  .app-brand span,
  .user-box strong,
  .user-box span {
    color: #f5f7fb;
  }

  .app-brand span,
  .user-box span {
    color: #aeb4c0;
    font-size: 12px;
  }

  .user-box {
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #15161a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
  }

  .nav-list {
    display: grid;
    gap: 6px;
    overflow: visible;
  }

  .nav-list button {
    min-height: 44px;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    color: #b5bac1;
    background: transparent;
    border: 0;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 850;
  }

  .nav-list button:hover {
    color: #ffffff;
    background: #303238;
  }

  .nav-list button.active {
    color: #ffffff;
    background: var(--primary);
    box-shadow: 0 12px 24px rgba(51, 73, 143, 0.24);
  }

  .nav-list button .nav-icon,
  .nav-list button.active .nav-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    background: transparent !important;
    border-radius: 0;
    font-size: 18px;
  }

  .content {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    max-width: none;
    padding: 24px 30px 44px;
    background: var(--discord-bg);
  }

  .topbar {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 74px;
    margin: 0;
    padding: 14px 30px;
    background: rgba(242, 243, 245, 0.92);
    border-bottom: 1px solid rgba(31, 41, 55, 0.08);
    backdrop-filter: blur(16px);
  }

  .notification-layer {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .topbar h2 {
    color: var(--discord-text);
    font-size: 24px;
  }

  .topbar-school {
    color: var(--discord-muted);
  }

  .topbar .top-action-button {
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(31, 41, 55, 0.08);
  }

  .view {
    max-width: 1280px;
    margin: 0 auto;
    gap: 18px;
  }

  .panel {
    padding: 20px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(31, 41, 55, 0.08);
    border-radius: 20px;
    box-shadow: 0 18px 44px rgba(31, 41, 55, 0.08);
  }

  .panel-head {
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(31, 41, 55, 0.08);
  }

  .school-home-top {
    align-items: stretch;
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.75fr);
  }

  .school-hero,
  .school-hero-banner {
    border-radius: 22px;
  }

  .home-welcome {
    border-radius: 20px;
    background:
      radial-gradient(circle at 82% 14%, rgba(255, 255, 255, 0.22), transparent 30%),
      linear-gradient(135deg, #33498f 0%, #5865f2 100%);
    box-shadow: 0 18px 42px rgba(51, 73, 143, 0.24);
  }

  .home-shortcuts {
    gap: 10px;
  }

  .quick-card {
    min-height: 76px;
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(31, 41, 55, 0.06);
  }

  .quick-card .quick-icon {
    border-radius: 14px;
  }

  .budget-card {
    border-radius: 18px;
  }

  .notice-list,
  .approval-list {
    display: grid;
    gap: 10px;
  }

  .notice-item,
  .approval-item {
    border: 1px solid rgba(31, 41, 55, 0.08);
    border-radius: 16px;
    box-shadow: 0 8px 22px rgba(31, 41, 55, 0.05);
  }

  .notice-item {
    overflow: hidden;
  }

  .notice-item .list-row {
    padding: 16px;
  }

  .approval-item {
    display: grid;
    gap: 10px;
    padding: 16px;
  }

  .decision-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) repeat(3, minmax(78px, 96px));
    gap: 8px;
    align-items: center;
  }

  .decision-form.compact {
    justify-self: end;
    width: min(100%, 300px);
  }

  .sub-tabs {
    padding: 6px;
    background: #e7e9ee;
    border: 1px solid rgba(31, 41, 55, 0.08);
    border-radius: 18px;
  }

  .sub-tabs button {
    border-radius: 13px;
    border-bottom: 0;
  }

  .sub-tabs button.active {
    color: #ffffff;
    background: var(--primary);
  }

  :root[data-theme="dark"],
  :root[data-theme="dark"] body,
  :root[data-theme="dark"] .app-shell,
  :root[data-theme="dark"] .content {
    background: #111318;
  }

  :root[data-theme="dark"] .topbar {
    background: rgba(17, 19, 24, 0.9);
    border-bottom-color: rgba(255, 255, 255, 0.07);
  }

  :root[data-theme="dark"] .topbar h2 {
    color: #f2f5fb;
  }

  :root[data-theme="dark"] .panel,
  :root[data-theme="dark"] .budget-card,
  :root[data-theme="dark"] .approval-detail-card,
  :root[data-theme="dark"] .notice-item,
  :root[data-theme="dark"] .approval-item {
    background: #1d2028;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
  }

  :root[data-theme="dark"] .approval-detail-body,
  :root[data-theme="dark"] .approval-detail-meta div {
    background: #161922;
    border-color: rgba(255, 255, 255, 0.08);
  }

  :root[data-theme="dark"] .sub-tabs {
    background: #171a22;
    border-color: rgba(255, 255, 255, 0.08);
  }
}

@media (max-width: 760px) {
  .approval-detail-meta {
    grid-template-columns: 1fr;
  }

  .approval-detail-head {
    grid-template-columns: 1fr;
  }

  .decision-form,
  .decision-form.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .decision-form input:not([type="hidden"]) {
    grid-column: 1 / -1;
  }

  .budget-form {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 761px) {
  :root {
    --desktop-bg: #f4f7fb;
    --desktop-bg-soft: #eef3f8;
    --desktop-sidebar: #151a24;
    --desktop-sidebar-2: #20283a;
    --desktop-line: rgba(31, 45, 72, 0.1);
    --desktop-text: #111827;
    --desktop-muted: #667085;
    --desktop-primary: #33498f;
    --desktop-primary-2: #2f6f9f;
    --desktop-green: #4f8f84;
  }

  html,
  body,
  .app-shell,
  .content {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.62) 0%, rgba(255, 255, 255, 0) 280px),
      var(--desktop-bg);
  }

  .app-shell {
    grid-template-columns: 264px minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: 264px;
    height: 100dvh;
    min-height: 100dvh;
    overflow-y: auto;
    grid-template-rows: auto auto 1fr;
    gap: 20px;
    padding: 22px 16px;
    background:
      linear-gradient(135deg, rgba(51, 73, 143, 0.22) 0%, rgba(51, 73, 143, 0) 38%),
      linear-gradient(180deg, var(--desktop-sidebar-2) 0%, var(--desktop-sidebar) 52%, #10141d 100%);
    box-shadow: 18px 0 42px rgba(17, 24, 39, 0.14);
  }

  .sidebar::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 16px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  }

  .topbar,
  .content,
  .notification-layer {
    grid-column: 2;
  }

  .topbar {
    min-height: 88px;
    padding: 16px clamp(24px, 2.4vw, 42px);
    background:
      linear-gradient(90deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.68)),
      linear-gradient(135deg, rgba(51, 73, 143, 0.08), rgba(79, 143, 132, 0.08));
    border-bottom: 1px solid var(--desktop-line);
    overflow: hidden;
  }

  .topbar::after {
    content: "";
    position: absolute;
    top: 18px;
    right: clamp(24px, 2.4vw, 42px);
    width: min(360px, 28vw);
    height: 48px;
    border-radius: 999px;
    background:
      repeating-linear-gradient(135deg, rgba(51, 73, 143, 0.12) 0 10px, rgba(47, 111, 159, 0.06) 10px 20px);
    opacity: 0.55;
    pointer-events: none;
  }

  .topbar > div,
  .topbar .topbar-actions {
    position: relative;
    z-index: 1;
  }

  .topbar h2 {
    color: var(--desktop-primary);
    font-size: 23px;
    letter-spacing: 0;
  }

  .topbar-school,
  .kicker {
    color: var(--desktop-muted);
  }

  .topbar .top-action-button {
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(51, 73, 143, 0.12);
    box-shadow: 0 10px 24px rgba(31, 45, 72, 0.1);
  }

  .content {
    padding: 24px clamp(24px, 2.4vw, 42px) 56px;
  }

  .view {
    width: min(100%, 1500px);
    max-width: 1500px;
    gap: 22px;
  }

  .app-brand {
    gap: 12px;
    padding: 10px 10px 18px;
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }

  .app-brand img {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
  }

  .app-brand strong {
    font-size: 15px;
    word-break: keep-all;
  }

  .user-box {
    display: grid;
    gap: 10px;
    align-items: start;
    padding: 14px;
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
      rgba(9, 12, 18, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
  }

  .user-box strong {
    color: #ffffff;
    font-size: 17px;
    line-height: 1.25;
    word-break: keep-all;
  }

  .user-box-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .user-box-meta b {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    padding: 5px 9px;
    color: #dce7ff;
    background: rgba(51, 73, 143, 0.38);
    border: 1px solid rgba(150, 169, 220, 0.28);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
  }

  .nav-list {
    gap: 8px;
  }

  .nav-list button {
    min-height: 48px;
    padding: 11px 13px;
    color: #c7d0df;
    border-radius: 14px;
  }

  .nav-list button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
  }

  .nav-list button.active {
    background:
      linear-gradient(135deg, var(--desktop-primary), #3e62ad);
    box-shadow: 0 14px 30px rgba(51, 73, 143, 0.34);
  }

  .nav-list button .nav-icon,
  .nav-list button.active .nav-icon {
    width: 30px;
    height: 30px;
    font-size: 19px;
  }

  .school-home-top {
    gap: 28px;
    align-items: stretch;
    grid-template-columns: minmax(620px, 1.42fr) minmax(390px, 0.78fr);
  }

  .school-hero {
    min-height: clamp(520px, 38vw, 660px);
    height: 100%;
    background: #dbe8ef;
    border: 0;
    border-radius: 26px;
    box-shadow: 0 24px 54px rgba(31, 45, 72, 0.12);
  }

  .school-hero .school-hero-banner,
  .school-hero-banner {
    width: 100%;
    height: 100%;
    min-height: inherit;
    object-fit: cover;
    object-position: center;
    border-radius: 26px;
  }

  .school-side {
    gap: 12px;
  }

  .home-account-row {
    gap: 12px;
  }

  .home-welcome {
    min-height: 140px;
    padding: 24px 28px;
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 44%),
      linear-gradient(135deg, var(--desktop-primary) 0%, var(--desktop-primary-2) 58%, var(--desktop-green) 100%);
    border: 0;
    box-shadow: 0 20px 44px rgba(51, 73, 143, 0.24);
  }

  .home-welcome strong {
    color: #ffffff;
    font-size: 24px;
  }

  .home-welcome span {
    color: rgba(255, 255, 255, 0.86);
  }

  .budget-card,
  .quick-card,
  .panel {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(31, 45, 72, 0.09);
    box-shadow: 0 18px 38px rgba(31, 45, 72, 0.08);
  }

  .budget-card {
    border-radius: 22px;
  }

  .budget-amount {
    color: var(--desktop-primary);
  }

  .home-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .quick-card {
    min-height: 82px;
    border-radius: 18px;
  }

  .quick-card:hover,
  .quick-card:focus-visible {
    border-color: rgba(51, 73, 143, 0.26);
    transform: translateY(-1px);
  }

  .panel {
    border-radius: 22px;
  }

  :root[data-theme="dark"],
  :root[data-theme="dark"] body,
  :root[data-theme="dark"] .app-shell,
  :root[data-theme="dark"] .content {
    background:
      linear-gradient(180deg, rgba(35, 48, 78, 0.28) 0%, rgba(17, 19, 24, 0) 290px),
      #111318;
  }

  :root[data-theme="dark"] .topbar {
    background:
      linear-gradient(90deg, rgba(17, 19, 24, 0.94), rgba(17, 19, 24, 0.78)),
      linear-gradient(135deg, rgba(51, 73, 143, 0.14), rgba(79, 143, 132, 0.08));
  }

  :root[data-theme="dark"] .sidebar {
    background:
      linear-gradient(135deg, rgba(51, 73, 143, 0.24) 0%, rgba(51, 73, 143, 0) 38%),
      linear-gradient(180deg, #1c2434 0%, #111722 58%, #0d1119 100%);
  }
}

@media (min-width: 761px) {
  .topbar {
    width: auto;
    max-width: none;
    margin: 0;
  }

  .sidebar > div,
  .user-box {
    width: 232px;
    max-width: 232px;
    box-sizing: border-box;
  }

  .school-hero {
    position: relative;
    min-height: clamp(520px, 32vw, 590px);
    background: #dbe8ef;
  }

  .school-hero .school-hero-banner,
  .school-hero-banner {
    position: relative;
    z-index: 1;
    object-fit: cover;
    object-position: left center;
    background: transparent;
  }
}

/* Final responsive polish */
@media (min-width: 761px) {
  :root {
    --desktop-bg: #f2f5f9;
    --desktop-sidebar: #101722;
    --desktop-sidebar-2: #1d2736;
    --desktop-panel: rgba(255, 255, 255, 0.92);
    --desktop-panel-dark: #171d28;
    --desktop-panel-dark-2: #151b25;
    --desktop-line: rgba(42, 55, 82, 0.12);
    --desktop-primary: #33498f;
    --desktop-accent: #6f8be8;
    --desktop-muted: #667085;
  }

  .app-shell {
    grid-template-columns: 264px minmax(0, 1fr);
  }

  .sidebar {
    width: 264px;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 16px;
    background:
      radial-gradient(circle at 20% 0%, rgba(111, 139, 232, 0.22), transparent 34%),
      linear-gradient(180deg, var(--desktop-sidebar-2) 0%, var(--desktop-sidebar) 56%, #0c111a 100%);
    box-shadow: 20px 0 46px rgba(15, 23, 42, 0.18);
  }

  .sidebar > div {
    width: 232px;
    max-width: 232px;
    min-height: calc(100vh - 48px);
    min-height: calc(100dvh - 48px);
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    align-content: start;
    gap: 18px;
  }

  .app-brand {
    padding: 4px 6px 18px;
  }

  .user-box {
    width: 232px;
    max-width: 232px;
    min-height: 96px;
    display: grid;
    align-content: center;
    gap: 12px;
    padding: 16px;
    cursor: pointer;
    color: #ffffff;
    background:
      linear-gradient(135deg, rgba(111, 139, 232, 0.18), rgba(255, 255, 255, 0.03) 44%),
      linear-gradient(180deg, rgba(25, 32, 45, 0.96), rgba(17, 22, 32, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      0 16px 30px rgba(0, 0, 0, 0.18);
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  }

  .user-box:hover,
  .user-box:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(143, 164, 232, 0.38);
    outline: none;
  }

  .user-box strong {
    color: #ffffff;
    font-size: 16px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .user-box-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
  }

  .user-box-meta b {
    min-height: 28px;
    padding: 6px 10px;
    color: #e8eeff;
    background: rgba(111, 139, 232, 0.24);
    border: 1px solid rgba(183, 197, 243, 0.18);
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
  }

  .nav-list {
    width: 232px;
    max-width: 232px;
    display: grid;
    align-self: stretch;
    align-content: start;
    gap: 10px;
    overflow: visible;
  }

  .nav-list button {
    width: 100%;
    min-height: 52px;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    justify-items: start;
    align-items: center;
    align-content: center;
    gap: 12px;
    padding: 11px 14px;
    color: #c8d2e2;
    background: transparent;
    border-radius: 15px;
  }

  .nav-list button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.07);
  }

  .nav-list button.active {
    color: #ffffff;
    background: linear-gradient(135deg, #33498f, #4f6fbd);
    box-shadow: 0 14px 28px rgba(51, 73, 143, 0.34);
  }

  .nav-list button .nav-icon,
  .nav-list button.active .nav-icon {
    width: 32px;
    height: 32px;
    background: transparent;
    border-radius: 10px;
    font-size: 19px;
  }

  .desktop-download-card {
    width: 232px;
    min-height: 74px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 12px;
    row-gap: 2px;
    padding: 14px;
    color: #e8eeff;
    text-decoration: none;
    background:
      linear-gradient(135deg, rgba(51, 73, 143, 0.34), rgba(111, 139, 232, 0.16)),
      rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(183, 197, 243, 0.18);
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  .desktop-download-card:hover,
  .desktop-download-card:focus-visible {
    color: #ffffff;
    background:
      linear-gradient(135deg, rgba(51, 73, 143, 0.52), rgba(111, 139, 232, 0.24)),
      rgba(255, 255, 255, 0.08);
    border-color: rgba(183, 197, 243, 0.36);
    outline: none;
  }

  .desktop-download-card span {
    grid-row: 1 / span 2;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    font-size: 18px;
  }

  .desktop-download-card strong {
    color: inherit;
    font-size: 14px;
    font-weight: 950;
    line-height: 1.2;
  }

  .desktop-download-card small {
    color: #aebbef;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
  }

  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 88px;
  }

  .topbar::after {
    display: none;
  }

  .topbar-title {
    min-width: 0;
  }

  .topbar .topbar-actions {
    justify-self: end;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
  }

  .topbar .top-action-button {
    min-height: 42px;
    padding: 0 18px;
    border-radius: 999px;
  }

  .school-home-top {
    grid-template-columns: minmax(600px, 1.45fr) minmax(390px, 0.8fr);
    gap: 28px;
  }

  .school-side {
    align-self: stretch;
    gap: 12px;
  }

  .home-welcome {
    min-height: 140px;
    border-radius: 22px;
    background:
      radial-gradient(circle at 86% 20%, rgba(255, 255, 255, 0.18), transparent 32%),
      linear-gradient(135deg, #33498f 0%, #4f6fbd 100%);
  }

  .budget-card,
  .quick-card,
  .panel {
    border-radius: 20px;
  }

  :root[data-theme="dark"] .budget-card,
  :root[data-theme="dark"] .quick-card,
  :root[data-theme="dark"] .quick-card:nth-child(odd) {
    background: var(--desktop-panel-dark);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
  }

  :root[data-theme="dark"] .budget-card-toggle,
  :root[data-theme="dark"] .quick-card strong,
  :root[data-theme="dark"] .budget-card-head strong {
    color: #f2f5fb;
  }

  :root[data-theme="dark"] .quick-card span,
  :root[data-theme="dark"] .budget-card-head span:not(.budget-icon) {
    color: #aab4c5;
  }

  :root[data-theme="dark"] .budget-icon,
  :root[data-theme="dark"] .quick-card .quick-icon,
  :root[data-theme="dark"] .budget-edit-hint {
    background: rgba(51, 73, 143, 0.28);
  }
}

@media (max-width: 760px) {
  .home-shortcuts .quick-card,
  .quick-grid .quick-card {
    min-height: 74px;
    align-items: center;
    align-content: center;
  }

  .home-shortcuts .quick-card .quick-icon,
  .quick-grid .quick-card .quick-icon,
  .home-shortcuts .quick-copy,
  .quick-grid .quick-copy {
    align-self: center;
  }

  .home-shortcuts .quick-copy,
  .quick-grid .quick-copy {
    justify-content: center;
  }
}

/* Sidebar fit and organization chart refinement */
@media (min-width: 761px) {
  .sidebar {
    overflow: hidden;
  }

  .sidebar > div {
    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);
    min-height: 0;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: clamp(10px, 1.45vh, 18px);
  }

  .app-brand {
    justify-content: center;
    padding-bottom: clamp(10px, 1.5vh, 18px);
  }

  .user-box {
    min-height: clamp(90px, 12vh, 112px);
    justify-items: center;
    align-content: center;
    text-align: center;
  }

  .user-box strong {
    width: 100%;
    text-align: center;
  }

  .user-box-detail {
    display: block;
    width: 100%;
    color: #b9c4db;
    font-size: 12px;
    font-weight: 850;
    line-height: 1.35;
    text-align: center;
    word-break: keep-all;
  }

  .nav-list {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-auto-rows: minmax(50px, 1fr);
    align-content: stretch;
    gap: clamp(7px, 1vh, 11px);
  }

  .nav-list button {
    min-height: 0;
    height: 100%;
    padding: clamp(10px, 1.3vh, 14px) 16px;
    font-size: 15px;
  }

  .nav-list button .nav-icon,
  .nav-list button.active .nav-icon {
    width: 36px;
    height: 36px;
    font-size: 21px;
  }

  .desktop-download-card {
    width: 100%;
    min-height: clamp(66px, 8vh, 78px);
    padding: 13px 14px;
  }
}

.council-org {
  display: grid;
  gap: 22px;
  text-align: center;
}

.org-leadership {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.org-leadership h4 {
  margin: 0;
  color: var(--primary);
  font-size: 16px;
  font-weight: 950;
  text-align: center;
}

.org-leadership-members {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.org-connector {
  width: 2px;
  height: 22px;
  justify-self: center;
  background: linear-gradient(180deg, var(--primary), rgba(51, 73, 143, 0.08));
  border-radius: 999px;
}

.org-departments {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}

.org-department {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--ui-surface, #ffffff);
  border: 1px solid var(--ui-line, #dbe3ef);
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(31, 45, 72, 0.06);
}

.org-department h4 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  color: var(--primary);
  font-size: 15px;
  line-height: 1.35;
  text-align: center;
  word-break: keep-all;
}

.org-member-list {
  display: grid;
  gap: 8px;
}

.org-member {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 12px 10px;
  background: rgba(51, 73, 143, 0.045);
  border: 1px solid rgba(51, 73, 143, 0.09);
  border-radius: 14px;
  text-align: center;
}

.org-member.featured {
  min-width: min(240px, 100%);
  padding: 15px 18px;
  background:
    radial-gradient(circle at 86% 10%, rgba(255, 255, 255, 0.24), transparent 34%),
    linear-gradient(135deg, #33498f, #4f6fbd);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 16px 34px rgba(51, 73, 143, 0.22);
}

.org-position {
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 4px 9px;
  color: var(--primary);
  background: rgba(51, 73, 143, 0.1);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 950;
}

.org-member strong {
  color: var(--ui-text, var(--ink));
  font-size: 15px;
  font-weight: 950;
  line-height: 1.25;
  text-align: center;
}

.org-member small {
  color: var(--ui-muted, var(--muted));
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

.org-member.featured .org-position {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
}

.org-member.featured strong,
.org-member.featured small {
  color: #ffffff;
}

.tabs,
.sub-tabs,
.panel-head,
.student-badges {
  text-align: center;
}

.panel-head {
  align-items: center;
}

:root[data-theme="dark"] .org-department {
  background: var(--desktop-panel-dark, #171d28);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

:root[data-theme="dark"] .org-member {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .org-member strong {
  color: #f2f5fb;
}

:root[data-theme="dark"] .org-member small {
  color: #aab4c5;
}

@media (max-width: 760px) {
  .council-org {
    gap: 16px;
  }

  .org-departments {
    grid-template-columns: 1fr;
  }

  .org-leadership {
    justify-items: stretch;
  }

  .org-leadership-members {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* Final fixes: desktop sidebar sizing, toast stacking, and full banner visibility */
.toast {
  z-index: 30000 !important;
  top: max(14px, env(safe-area-inset-top)) !important;
  left: 50% !important;
  right: auto !important;
  width: min(520px, calc(100vw - 32px));
  transform: translate(-50%, -8px);
  text-align: center;
}

.toast.show {
  transform: translate(-50%, 0);
}

@media (min-width: 761px) {
  .app-shell {
    grid-template-columns: 292px minmax(0, 1fr) !important;
  }

  .sidebar {
    width: 292px !important;
    padding: 22px 16px !important;
    overflow: hidden !important;
  }

  .sidebar > div {
    width: 260px !important;
    max-width: 260px !important;
    height: calc(100vh - 44px) !important;
    height: calc(100dvh - 44px) !important;
    min-height: 0 !important;
    grid-template-rows: auto auto minmax(0, 1fr) auto !important;
    gap: 14px !important;
  }

  .user-box,
  .nav-list,
  .desktop-download-card {
    width: 260px !important;
    max-width: 260px !important;
  }

  .user-box {
    min-height: 88px !important;
    padding: 13px 14px !important;
  }

  .nav-list {
    height: auto !important;
    min-height: 0 !important;
    align-self: start !important;
    align-content: start !important;
    grid-auto-rows: auto !important;
    gap: 8px !important;
    overflow: visible !important;
  }

  .nav-list button {
    min-height: 44px !important;
    height: 44px !important;
    padding: 7px 15px !important;
    grid-template-columns: 30px minmax(0, 1fr) auto !important;
    gap: 11px !important;
    border-radius: 14px !important;
    font-size: 14px !important;
  }

  .nav-list button span:not(.nav-icon):not(.nav-badge) {
    white-space: nowrap;
  }

  .nav-list button .nav-icon,
  .nav-list button.active .nav-icon {
    width: 30px !important;
    height: 30px !important;
    font-size: 18px !important;
  }

  .desktop-download-card {
    min-height: 66px !important;
    padding: 12px 14px !important;
  }

  .topbar,
  .content,
  .notification-layer {
    grid-column: 2 !important;
  }

  .school-hero {
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 16 / 9;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #111827 !important;
  }

  .school-hero .school-hero-banner,
  .school-hero-banner {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    object-fit: contain !important;
    object-position: center !important;
    background: #111827;
  }
}

/* Home and council layout refinement */
@media (min-width: 761px) {
  .app-shell {
    grid-template-columns: 304px minmax(0, 1fr) !important;
  }

  .sidebar {
    width: 304px !important;
  }

  .sidebar > div,
  .user-box,
  .nav-list,
  .desktop-download-card {
    width: 272px !important;
    max-width: 272px !important;
  }

  .nav-list button {
    height: 48px !important;
    min-height: 48px !important;
    grid-template-columns: 34px minmax(0, 1fr) auto !important;
    padding: 8px 16px !important;
    font-size: 15px !important;
  }

  .nav-list button .nav-icon,
  .nav-list button.active .nav-icon {
    width: 34px !important;
    height: 34px !important;
    font-size: 20px !important;
  }

  .school-home-top {
    grid-template-columns: minmax(820px, 1fr) minmax(430px, 0.55fr) !important;
    align-items: stretch !important;
    gap: 24px !important;
  }

  .school-hero {
    align-self: stretch;
    aspect-ratio: 16 / 9 !important;
    border-radius: 24px !important;
  }

  .school-hero .school-hero-banner,
  .school-hero-banner {
    border-radius: 24px !important;
  }

  .home-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
  }

  .home-summary-card {
    min-width: 0;
    align-self: stretch;
  }

  .home-summary-card .panel-head {
    min-height: 74px;
  }

  .home-summary-card .notice-list,
  .home-summary-card .approval-list,
  .home-summary-card .duty-list {
    max-height: 430px;
    overflow: auto;
    padding-right: 4px;
  }

  .home-summary-card .notice-item,
  .home-summary-card .approval-item,
  .home-summary-card .duty-item {
    min-width: 0;
  }
}

.org-leadership-board {
  width: min(100%, 980px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 1.15fr) minmax(0, 1fr);
  grid-template-areas: "left center right";
  gap: 16px;
  align-items: end;
  justify-self: center;
}

.org-leader-left {
  grid-area: left;
}

.org-leader-center {
  grid-area: center;
}

.org-leader-right {
  grid-area: right;
}

.org-leadership-extra {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.org-role-group {
  display: grid;
  gap: 8px;
}

.org-role-group + .org-role-group {
  margin-top: 6px;
}

.org-role-group h5 {
  margin: 0;
  display: inline-grid;
  justify-self: center;
  place-items: center;
  min-height: 28px;
  padding: 5px 12px;
  color: var(--primary);
  background: rgba(51, 73, 143, 0.1);
  border: 1px solid rgba(51, 73, 143, 0.12);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 950;
  text-align: center;
}

.org-member.executive:not(.featured) {
  padding: 14px 12px;
  color: #ffffff;
  background:
    radial-gradient(circle at 88% 12%, rgba(255, 255, 255, 0.22), transparent 32%),
    linear-gradient(135deg, #33498f 0%, #4f6fbd 100%);
  border-color: transparent;
  box-shadow: 0 14px 28px rgba(51, 73, 143, 0.2);
}

.org-member.executive:not(.featured) .org-position {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
}

.org-member.executive:not(.featured) strong,
.org-member.executive:not(.featured) small {
  color: #ffffff;
}

.org-position {
  min-height: 30px;
  padding: 6px 12px;
  font-size: 13px;
}

.org-member strong {
  font-size: 18px;
}

.org-member.featured {
  min-width: min(270px, 100%);
  padding: 18px 22px;
}

.org-leader-center .org-member.featured {
  min-height: 142px;
  transform: translateY(-8px);
}

.org-member.featured strong {
  font-size: 21px;
}

.org-member.featured .org-position {
  min-height: 32px;
  font-size: 13px;
}

:root[data-theme="dark"] .org-role-group h5 {
  color: #dce7ff;
  background: rgba(111, 139, 232, 0.16);
  border-color: rgba(183, 197, 243, 0.14);
}

@media (max-width: 760px) {
  .home-summary-grid {
    display: grid;
    gap: 14px;
  }

  .org-leadership-board {
    grid-template-columns: 1fr;
    grid-template-areas:
      "center"
      "left"
      "right";
    align-items: stretch;
  }

  .org-leader-center .org-member.featured {
    transform: none;
  }
}

/* Dashboard redesign: no hero image, compact summaries, slimmer desktop sidebar */
.nav-label {
  min-width: 0;
}

.nav-label-short {
  display: none;
}

.home-command-center,
.home-summary-card,
.panel,
.quick-card,
.budget-card {
  position: relative;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 22px;
  width: 48px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #8ea2ff, rgba(51, 73, 143, 0));
}

.home-command-center {
  min-width: 0;
  display: grid;
  gap: 20px;
  padding: clamp(22px, 2.4vw, 34px);
  overflow: hidden;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(142, 162, 255, 0.18) 0 22%, transparent 22% 100%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.055) 0 1px, transparent 1px 18px),
    linear-gradient(135deg, #111827 0%, #17213a 48%, #33498f 100%);
  border: 1px solid rgba(183, 197, 243, 0.18);
  border-radius: 28px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.2);
}

.home-command-center::after {
  content: "";
  position: absolute;
  inset: auto 24px 24px auto;
  width: 180px;
  height: 58px;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0 12px, transparent 12px 24px);
  opacity: 0.45;
  transform: rotate(-12deg);
  pointer-events: none;
}

.home-command-head {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 20px;
}

.home-command-head h3 {
  margin: 10px 0 8px;
  color: #ffffff;
  font-size: clamp(28px, 3vw, 46px);
  line-height: 1.08;
  letter-spacing: 0;
}

.home-command-head p {
  margin: 0;
  color: rgba(231, 237, 255, 0.86);
  font-size: 15px;
  font-weight: 850;
}

.home-command-head .today-label {
  color: #1b2a5a;
  background: #e8eeff;
  border: 0;
}

.home-command-head .home-welcome-logo {
  width: clamp(78px, 7vw, 118px);
  height: clamp(78px, 7vw, 118px);
  opacity: 0.94;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.2));
}

.home-metric-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.home-metric {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 18px;
  backdrop-filter: blur(14px);
}

.home-metric-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 12px;
}

.home-metric span:not(.home-metric-icon) {
  color: rgba(231, 237, 255, 0.78);
  font-size: 12px;
  font-weight: 900;
}

.home-metric strong {
  color: #ffffff;
  font-size: 20px;
  font-weight: 950;
  line-height: 1.15;
}

.home-metric small {
  min-width: 0;
  color: rgba(231, 237, 255, 0.72);
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-command-strip {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
}

.home-command-strip span,
.home-command-strip strong {
  color: #ffffff;
  font-weight: 950;
}

.home-command-strip span {
  color: rgba(231, 237, 255, 0.72);
  font-size: 12px;
}

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

.home-summary-card {
  min-width: 0;
  width: 100%;
  min-height: 142px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 20px;
  color: var(--ui-text, var(--ink));
  text-align: left;
  background:
    linear-gradient(135deg, rgba(142, 162, 255, 0.12), rgba(255, 255, 255, 0) 42%),
    var(--ui-surface, #ffffff);
  border: 1px solid var(--ui-line, rgba(31, 45, 72, 0.1));
  border-radius: 24px;
  box-shadow: 0 18px 42px rgba(31, 45, 72, 0.08);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.home-summary-card:hover,
.home-summary-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(142, 162, 255, 0.42);
  box-shadow: 0 24px 52px rgba(31, 45, 72, 0.12);
  outline: none;
}

.home-summary-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: rgba(51, 73, 143, 0.12);
  border-radius: 16px;
  font-size: 22px;
}

.home-summary-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.home-summary-copy > span {
  color: var(--primary);
  font-size: 13px;
  font-weight: 950;
}

.home-summary-copy strong {
  color: var(--ui-text, var(--ink));
  font-size: 17px;
  font-weight: 950;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-summary-copy small {
  color: var(--ui-muted, var(--muted));
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-summary-card b {
  align-self: start;
  padding: 6px 10px;
  color: #ffffff;
  background: var(--primary);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

:root[data-theme="dark"] .home-summary-card {
  color: #f2f5fb;
  background:
    linear-gradient(135deg, rgba(142, 162, 255, 0.12), rgba(255, 255, 255, 0) 42%),
    #171d28;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

:root[data-theme="dark"] .home-summary-copy strong {
  color: #f2f5fb;
}

:root[data-theme="dark"] .home-summary-copy small {
  color: #aab4c5;
}

@media (min-width: 761px) {
  .app-shell {
    grid-template-columns: 268px minmax(0, 1fr) !important;
  }

  .sidebar {
    width: 268px !important;
    padding-inline: 14px !important;
  }

  .sidebar > div,
  .user-box,
  .nav-list,
  .desktop-download-card {
    width: 240px !important;
    max-width: 240px !important;
  }

  .nav-list button {
    height: 46px !important;
    min-height: 46px !important;
    grid-template-columns: 32px minmax(0, 1fr) auto !important;
    padding: 8px 14px !important;
  }

  .nav-list button .nav-icon,
  .nav-list button.active .nav-icon {
    width: 32px !important;
    height: 32px !important;
    font-size: 19px !important;
  }

  .school-home-top.home-overview {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.58fr) !important;
    gap: 20px !important;
    align-items: stretch !important;
  }

  .school-side {
    align-self: stretch;
  }

  .school-side .budget-card {
    min-height: 154px;
  }

  .home-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .quick-card {
    min-height: 76px;
    border-radius: 20px;
  }
}

@media (max-width: 760px) {
  .nav-label-full {
    display: none !important;
  }

  .nav-label-short {
    display: block;
  }

  .school-home-top.home-overview {
    display: grid;
    gap: 14px;
  }

  .home-command-center {
    min-height: auto;
    padding: 20px;
    border-radius: 24px;
  }

  .home-command-head {
    grid-template-columns: minmax(0, 1fr) 68px;
    gap: 14px;
  }

  .home-command-head h3 {
    font-size: 25px;
  }

  .home-command-head .home-welcome-logo {
    width: 66px;
    height: 66px;
  }

  .home-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-summary-grid {
    grid-template-columns: 1fr;
  }

  .home-summary-card {
    min-height: 108px;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    padding: 16px;
    border-radius: 22px;
  }

  .home-summary-icon {
    width: 42px;
    height: 42px;
  }
}

/* Local polish pass: fill empty areas and fix dashboard alignment */
.sidebar-helper {
  display: none;
}

.home-priority-action {
  position: relative;
  z-index: 1;
  min-width: 0;
  width: 100%;
  min-height: 78px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  color: #ffffff;
  text-align: left;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)),
    rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.home-priority-action:hover,
.home-priority-action:focus-visible {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.23), rgba(255, 255, 255, 0.09)),
    rgba(255, 255, 255, 0.12);
  outline: none;
}

.home-priority-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  font-size: 22px;
}

.home-priority-action > span:not(.home-priority-icon) {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.home-priority-action small,
.home-priority-action em {
  color: rgba(231, 237, 255, 0.74);
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.home-priority-action strong {
  color: #ffffff;
  font-size: 18px;
  font-weight: 950;
  line-height: 1.2;
}

.home-priority-action b {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #1b2a5a;
  background: #e8eeff;
  border-radius: 999px;
  font-size: 20px;
}

.home-ops-board {
  display: grid;
  grid-template-columns: 1.05fr repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.home-ops-card {
  min-width: 0;
  min-height: 132px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(142, 162, 255, 0.1), rgba(255, 255, 255, 0) 44%),
    var(--ui-surface, #ffffff);
  border: 1px solid var(--ui-line, rgba(31, 45, 72, 0.1));
  border-radius: 24px;
  box-shadow: 0 18px 42px rgba(31, 45, 72, 0.08);
}

.home-ops-card.is-primary {
  color: #ffffff;
  background:
    radial-gradient(circle at 88% 16%, rgba(255, 255, 255, 0.16), transparent 34%),
    linear-gradient(135deg, #33498f 0%, #4f6fbd 100%);
  border-color: transparent;
}

.home-ops-card span {
  color: var(--primary);
  font-size: 13px;
  font-weight: 950;
}

.home-ops-card strong {
  min-width: 0;
  color: var(--ui-text, var(--ink));
  font-size: 20px;
  font-weight: 950;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-ops-card small {
  min-width: 0;
  color: var(--ui-muted, var(--muted));
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-ops-card.is-primary span,
.home-ops-card.is-primary strong,
.home-ops-card.is-primary small {
  color: #ffffff;
}

:root[data-theme="dark"] .home-ops-card {
  background:
    linear-gradient(135deg, rgba(142, 162, 255, 0.1), rgba(255, 255, 255, 0) 44%),
    #171d28;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

:root[data-theme="dark"] .home-ops-card strong {
  color: #f2f5fb;
}

:root[data-theme="dark"] .home-ops-card small {
  color: #aab4c5;
}

@media (min-width: 761px) {
  .sidebar > div {
    grid-template-rows: auto auto auto minmax(0, 1fr) auto !important;
    gap: 12px !important;
  }

  .nav-list {
    align-self: start !important;
  }

  .sidebar-helper {
    display: grid;
    gap: 12px;
    min-height: 176px;
    align-self: start;
    padding: 14px;
    color: #e8eeff;
    background:
      linear-gradient(135deg, rgba(142, 162, 255, 0.12), rgba(255, 255, 255, 0.03)),
      rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(183, 197, 243, 0.14);
    border-radius: 18px;
  }

  .sidebar-helper-head {
    display: grid;
    gap: 4px;
  }

  .sidebar-helper-head span {
    color: #9eadd1;
    font-size: 12px;
    font-weight: 900;
  }

  .sidebar-helper-head strong {
    color: #ffffff;
    font-size: 18px;
    font-weight: 950;
  }

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

  .sidebar-helper-grid button {
    min-width: 0;
    min-height: 58px;
    display: grid;
    place-items: center;
    gap: 3px;
    color: #dce7ff;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(183, 197, 243, 0.12);
    border-radius: 14px;
    cursor: pointer;
  }

  .sidebar-helper-grid button:hover,
  .sidebar-helper-grid button:focus-visible {
    color: #ffffff;
    background: rgba(111, 139, 232, 0.16);
    outline: none;
  }

  .sidebar-helper-grid span {
    font-size: 11px;
    font-weight: 850;
  }

  .sidebar-helper-grid strong {
    font-size: 18px;
    font-weight: 950;
  }

  .desktop-download-card {
    align-self: end;
  }

  .home-command-center {
    min-height: 390px;
    align-content: space-between;
  }

  .home-command-head {
    align-items: start;
  }

  .home-command-head .today-label {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    line-height: 1;
  }

  .home-metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .home-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .sidebar-helper {
    display: none !important;
  }

  .home-command-center {
    gap: 16px;
  }

  .home-priority-action {
    min-height: 72px;
    grid-template-columns: 42px minmax(0, 1fr) 28px;
    padding: 13px;
    border-radius: 18px;
  }

  .home-priority-icon {
    width: 42px;
    height: 42px;
  }

  .home-priority-action strong {
    font-size: 16px;
  }

  .home-ops-board {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .home-ops-card {
    min-height: 104px;
    padding: 16px;
    border-radius: 22px;
  }
}

/* Local pass: full-width banner and external link shortcuts */
.home-link-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.home-link-card {
  min-width: 0;
  min-height: 132px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 16px;
  padding: 22px;
  color: #ffffff;
  text-decoration: none;
  border: 1px solid rgba(183, 197, 243, 0.16);
  border-radius: 26px;
  box-shadow: 0 22px 52px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.home-link-card.messenger {
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 255, 255, 0.15), transparent 34%),
    linear-gradient(135deg, #33498f 0%, #5865f2 100%);
}

.home-link-card.school {
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 255, 255, 0.16), transparent 34%),
    linear-gradient(135deg, #1f6f8b 0%, #33498f 100%);
}

.home-link-card:hover,
.home-link-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 28px 62px rgba(15, 23, 42, 0.24);
  outline: none;
}

.home-link-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  font-size: 27px;
}

.home-link-card > span:not(.home-link-icon) {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.home-link-card small,
.home-link-card em {
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.home-link-card strong {
  color: #ffffff;
  font-size: 22px;
  font-weight: 950;
  line-height: 1.2;
}

.home-link-card b {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #1b2a5a;
  background: rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  font-size: 22px;
}

@media (min-width: 761px) {
  .school-home-top.home-overview {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .home-command-center {
    min-height: 430px;
  }

  .home-command-head h3 {
    font-size: clamp(34px, 3.6vw, 56px);
  }

  .home-command-head .home-welcome-logo {
    width: clamp(104px, 8vw, 150px);
    height: clamp(104px, 8vw, 150px);
  }

  .sidebar-helper {
    margin-top: 18px;
  }
}

@media (max-width: 760px) {
  .home-link-board {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .home-link-card {
    min-height: 108px;
    grid-template-columns: 46px minmax(0, 1fr) 30px;
    gap: 13px;
    padding: 16px;
    border-radius: 22px;
  }

  .home-link-icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    font-size: 23px;
  }

  .home-link-card strong {
    font-size: 18px;
  }
}

/* Home density pass: keep the dashboard visible without feeling packed */
.home-command-head .today-label {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 11px;
  color: rgba(255, 255, 255, 0.86) !important;
  background: rgba(255, 255, 255, 0.11) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  line-height: 1;
}

@media (min-width: 761px) {
  .content:has(.home-view) {
    padding-top: 22px;
    padding-bottom: 22px;
  }

  .home-view {
    gap: 12px !important;
  }

  .home-command-center {
    min-height: 312px !important;
    gap: 13px !important;
    padding: 24px !important;
    border-radius: 24px;
    align-content: stretch !important;
  }

  .home-command-center::after {
    width: 142px;
    height: 46px;
    inset: auto 18px 18px auto;
    opacity: 0.28;
  }

  .home-command-head {
    gap: 16px !important;
    align-items: start;
  }

  .home-command-head h3 {
    margin: 8px 0 5px;
    font-size: clamp(30px, 2.75vw, 44px) !important;
  }

  .home-command-head p {
    font-size: 14px;
  }

  .home-command-head .home-welcome-logo {
    width: clamp(82px, 6.4vw, 112px) !important;
    height: clamp(82px, 6.4vw, 112px) !important;
  }

  .home-priority-action {
    min-height: 62px !important;
    grid-template-columns: 38px minmax(0, 1fr) 28px;
    gap: 11px;
    padding: 10px 13px !important;
    border-radius: 17px;
  }

  .home-priority-icon {
    width: 38px;
    height: 38px;
    border-radius: 13px;
    font-size: 19px;
  }

  .home-priority-action small,
  .home-priority-action em {
    font-size: 11px;
  }

  .home-priority-action strong {
    font-size: 16px;
  }

  .home-metric-grid {
    gap: 10px !important;
  }

  .home-metric {
    gap: 3px;
    padding: 10px 11px !important;
    border-radius: 15px;
  }

  .home-metric-icon {
    width: 30px;
    height: 30px;
    border-radius: 11px;
    font-size: 17px;
  }

  .home-metric strong {
    font-size: 17px;
  }

  .home-summary-grid {
    gap: 12px !important;
  }

  .home-summary-card {
    min-height: 88px !important;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 11px;
    padding: 13px 15px !important;
    border-radius: 19px;
  }

  .home-summary-icon {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    font-size: 19px;
  }

  .home-summary-copy {
    gap: 3px;
  }

  .home-summary-copy strong {
    font-size: 15px;
  }

  .home-summary-copy small {
    font-size: 11px;
  }

  .home-link-board {
    gap: 12px;
  }

  .home-link-card {
    min-height: 84px !important;
    grid-template-columns: 40px minmax(0, 1fr) 28px;
    gap: 12px;
    padding: 13px 16px !important;
    border-radius: 20px;
  }

  .home-link-icon {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    font-size: 20px;
  }

  .home-link-card strong {
    font-size: 17px;
  }
}

@media (max-width: 760px) {
  .content:has(.home-view) {
    padding-top: 12px;
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .home-view {
    gap: 10px !important;
  }

  .home-command-center {
    gap: 12px !important;
    padding: 16px !important;
    border-radius: 22px;
  }

  .home-command-center::after {
    width: 108px;
    height: 40px;
    opacity: 0.24;
  }

  .home-command-head {
    grid-template-columns: minmax(0, 1fr) 58px !important;
    gap: 12px !important;
  }

  .home-command-head .today-label {
    min-height: 26px;
    padding: 5px 9px;
    font-size: 11px;
  }

  .home-command-head h3 {
    margin: 7px 0 4px;
    font-size: 22px !important;
  }

  .home-command-head p {
    font-size: 12px;
  }

  .home-command-head .home-welcome-logo {
    width: 58px !important;
    height: 58px !important;
  }

  .home-priority-action {
    min-height: 58px !important;
    grid-template-columns: 36px minmax(0, 1fr) 26px;
    gap: 10px;
    padding: 10px 12px !important;
    border-radius: 16px;
  }

  .home-priority-icon {
    width: 36px;
    height: 36px;
    border-radius: 13px;
    font-size: 18px;
  }

  .home-priority-action strong {
    font-size: 15px;
  }

  .home-metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  .home-metric {
    justify-items: center;
    gap: 2px;
    min-height: 68px;
    padding: 8px 6px !important;
    border-radius: 13px;
    text-align: center;
  }

  .home-metric-icon {
    width: 26px;
    height: 26px;
    border-radius: 10px;
    font-size: 15px;
  }

  .home-metric span:not(.home-metric-icon) {
    font-size: 10px;
  }

  .home-metric strong {
    max-width: 100%;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .home-metric small {
    display: none;
  }

  .home-summary-grid,
  .home-link-board {
    gap: 9px !important;
  }

  .home-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .home-summary-card {
    min-height: 82px !important;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 6px;
    padding: 10px 8px !important;
    border-radius: 18px;
    text-align: center;
  }

  .home-summary-icon {
    width: 34px;
    height: 34px;
    border-radius: 13px;
    font-size: 17px;
  }

  .home-summary-copy {
    justify-items: center;
    gap: 2px;
  }

  .home-summary-copy > span {
    font-size: 11px;
  }

  .home-summary-copy strong {
    max-width: 100%;
    font-size: 13px;
  }

  .home-summary-copy small {
    display: none;
  }

  .home-summary-card b {
    position: absolute;
    top: 7px;
    right: 7px;
    padding: 3px 6px;
    font-size: 10px;
  }

  .home-link-board {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .home-link-card {
    min-height: 68px !important;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 9px;
    padding: 10px !important;
    border-radius: 16px;
  }

  .home-link-icon {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    font-size: 16px;
  }

  .home-link-card small,
  .home-link-card em,
  .home-link-card b {
    display: none;
  }

  .home-link-card strong {
    font-size: 13px;
  }
}

/* Mobile home repair pass: compact without crushing content */
@media (max-width: 919px) {
  .topbar .top-theme-toggle,
  .top-theme-toggle {
    display: none !important;
  }

  .content:has(.home-view) {
    padding: 14px 14px calc(84px + env(safe-area-inset-bottom)) !important;
  }

  .home-view {
    width: 100% !important;
    max-width: 100% !important;
    gap: 12px !important;
  }

  .school-home-top.home-overview {
    width: 100% !important;
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important;
  }

  .home-command-center {
    width: 100% !important;
    max-width: 100% !important;
    grid-column: 1 / -1 !important;
    min-height: auto !important;
    gap: 14px !important;
    padding: 18px !important;
    border-radius: 24px;
  }

  .home-command-center::after {
    display: none;
  }

  .home-command-head {
    grid-template-columns: minmax(0, 1fr) 56px !important;
    align-items: center !important;
    gap: 12px !important;
  }

  .home-command-head .today-label {
    min-height: 28px;
    padding: 6px 10px;
    font-size: 11px;
  }

  .home-command-head h3 {
    margin: 7px 0 4px;
    font-size: 22px !important;
    line-height: 1.16;
  }

  .home-command-head p {
    font-size: 12px;
    line-height: 1.35;
  }

  .home-command-head .home-welcome-logo {
    width: 56px !important;
    height: 56px !important;
  }

  .home-priority-action {
    min-height: 62px !important;
    grid-template-columns: 38px minmax(0, 1fr) 26px;
    gap: 10px;
    padding: 10px 12px !important;
    border-radius: 17px;
  }

  .home-priority-icon {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }

  .home-priority-action strong {
    font-size: 15px;
  }

  .home-priority-action small,
  .home-priority-action em {
    font-size: 11px;
  }

  .home-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .home-metric {
    min-height: 66px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-areas:
      "icon label"
      "icon value";
    align-items: center;
    justify-items: start;
    gap: 2px 9px;
    padding: 9px 10px !important;
    border-radius: 15px;
    text-align: left;
  }

  .home-metric-icon {
    grid-area: icon;
    width: 30px;
    height: 30px;
    border-radius: 11px;
    font-size: 16px;
  }

  .home-metric span:not(.home-metric-icon) {
    grid-area: label;
    font-size: 11px;
  }

  .home-metric strong {
    grid-area: value;
    max-width: 100%;
    font-size: 16px;
  }

  .home-metric small {
    display: none;
  }

  .home-summary-grid {
    width: 100% !important;
    max-width: 100% !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .home-summary-card {
    min-height: 74px !important;
    grid-template-columns: 1fr;
    align-content: center;
    justify-items: center;
    gap: 5px;
    padding: 9px 6px !important;
    border-radius: 18px;
    text-align: center;
  }

  .home-summary-icon {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    font-size: 16px;
  }

  .home-summary-copy {
    justify-items: center;
    gap: 0;
  }

  .home-summary-copy > span {
    color: var(--ui-text, #ffffff);
    font-size: 12px;
    line-height: 1.2;
  }

  .home-summary-copy strong,
  .home-summary-copy small {
    display: none;
  }

  .home-summary-card b {
    position: static;
    align-self: auto;
    padding: 3px 7px;
    font-size: 10px;
    line-height: 1.2;
  }

  .home-link-board {
    width: 100% !important;
    max-width: 100% !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .home-link-card {
    min-height: 66px !important;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    padding: 10px !important;
    border-radius: 18px;
  }

  .home-link-icon {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    font-size: 16px;
  }

  .home-link-card small,
  .home-link-card em,
  .home-link-card b {
    display: none;
  }

  .home-link-card strong {
    font-size: 13px;
    line-height: 1.25;
    white-space: normal;
    word-break: keep-all;
  }
}

/* School information and integrated calendar */
.school-basic-card {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
  gap: 22px;
  padding: 22px 24px;
  color: var(--ui-text, var(--ink));
  background: var(--ui-surface, var(--surface));
  border: 1px solid var(--ui-line, var(--line));
  border-radius: 18px;
}

.school-basic-head {
  min-width: 0;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.school-basic-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  border-radius: 16px;
  font-size: 26px;
}

.school-basic-head small,
.school-basic-grid span {
  color: var(--ui-muted, var(--muted));
  font-size: 11px;
  font-weight: 800;
}

.school-basic-head h3 {
  margin: 2px 0 7px;
  color: var(--ui-text, var(--ink));
  font-size: 21px;
}

.school-basic-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.school-basic-tags span {
  padding: 3px 7px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
}

.school-basic-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}

.school-basic-grid > div {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 2px;
}

.school-basic-grid > div.wide {
  grid-column: 1 / -1;
}

.school-basic-grid strong {
  min-width: 0;
  color: var(--ui-text, var(--ink));
  font-size: 13px;
  overflow-wrap: anywhere;
}

.calendar-category-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  padding: 5px;
  background: color-mix(in srgb, var(--primary) 7%, var(--ui-surface, var(--surface)));
  border: 1px solid var(--ui-line, var(--line));
  border-radius: 14px;
}

.calendar-category-tabs button {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--ui-muted, var(--muted));
  background: transparent;
  border: 0;
  border-radius: 10px;
  font-weight: 900;
}

.calendar-category-tabs button.active {
  color: #ffffff;
  background: var(--primary);
}

.timetable-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px;
  background: color-mix(in srgb, var(--primary) 5%, var(--ui-surface, var(--surface)));
  border: 1px solid var(--ui-line, var(--line));
  border-radius: 12px;
}

.timetable-scope {
  display: flex;
  gap: 5px;
}

.timetable-scope button {
  min-height: 36px;
  padding: 7px 12px;
  color: var(--ui-muted, var(--muted));
  background: var(--ui-surface, var(--surface));
  border: 1px solid var(--ui-line, var(--line));
  border-radius: 9px;
  font-weight: 900;
}

.timetable-scope button.active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.timetable-class-filter {
  display: flex;
  align-items: end;
  gap: 7px;
}

.timetable-class-filter label {
  min-width: 110px;
  gap: 3px;
  color: var(--ui-muted, var(--muted));
  font-size: 10px;
}

.timetable-class-filter select,
.timetable-class-filter button {
  min-height: 36px;
}

.timetable-current-scope {
  padding: 7px 11px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 900;
}

.duty-calendar-event.timetable {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.calendar-legend > span.timetable i,
.duty-calendar-dots i.timetable {
  background: var(--primary);
}

.duty-calendar-day.is-holiday .duty-calendar-number {
  color: #d04545;
}

.duty-calendar-day.is-holiday.is-today .duty-calendar-number {
  color: #ffffff;
  background: #d04545;
}

.timetable-day-section {
  display: grid;
  gap: 9px;
}

.timetable-class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.timetable-class-card {
  min-width: 0;
  overflow: hidden;
  background: var(--ui-surface, var(--surface));
  border: 1px solid var(--ui-line, var(--line));
  border-radius: 12px;
}

.timetable-class-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  color: #ffffff;
  background: var(--primary);
}

.timetable-class-card header span {
  font-size: 10px;
  font-weight: 900;
  opacity: 0.82;
}

.timetable-lessons {
  display: grid;
}

.timetable-lessons > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--ui-line, var(--line));
}

.timetable-lessons > div:last-child {
  border-bottom: 0;
}

.timetable-lessons span {
  color: var(--ui-muted, var(--muted));
  font-size: 10px;
  font-weight: 900;
}

.timetable-lessons strong {
  color: var(--ui-text, var(--ink));
  font-size: 13px;
}

:root[data-theme="dark"] .school-basic-card,
:root[data-theme="dark"] .timetable-class-card,
:root[data-theme="dark"] .timetable-scope button {
  background: var(--ui-surface, #141d2e);
  border-color: var(--ui-line, #2d3953);
}

@media (max-width: 919px) {
  .school-basic-card {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 17px;
    border-radius: 22px;
  }

  .school-basic-grid {
    grid-template-columns: 1fr;
  }

  .school-basic-grid > div.wide {
    grid-column: auto;
  }

  .calendar-category-tabs {
    gap: 5px;
    padding: 4px;
    border-radius: 15px;
  }

  .calendar-category-tabs button {
    min-height: 40px;
    border-radius: 12px;
    font-size: 12px;
  }

  .timetable-filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .timetable-scope {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timetable-scope button:only-child {
    grid-column: 1 / -1;
  }

  .timetable-class-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timetable-class-filter label {
    min-width: 0;
  }

  .timetable-class-filter button {
    grid-column: 1 / -1;
  }

  .timetable-current-scope {
    text-align: center;
  }

  .timetable-class-grid {
    grid-template-columns: 1fr;
  }
}

/* Admin budget management */
.admin-budget-panel {
  display: grid;
  gap: 16px;
}

.admin-budget-panel .detail-list {
  margin: 0;
}

.admin-budget-panel .budget-current strong {
  color: var(--primary);
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.1;
}

.admin-budget-form {
  align-items: end;
  padding-top: 4px;
}

.admin-budget-form .actions {
  align-self: end;
}

/* Admin popup notices */
.admin-popup-panel,
.admin-popup-list-panel {
  display: grid;
  gap: 16px;
}

.popup-form {
  align-items: end;
}

.popup-form textarea {
  min-height: 132px;
}

.inline-check {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: var(--primary-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 900;
}

.popup-admin-list {
  display: grid;
  gap: 12px;
}

.popup-admin-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.popup-admin-preview {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.popup-admin-preview .app-popup-image {
  width: 112px;
  height: 76px;
  max-height: none;
  object-fit: cover;
  border-radius: 12px;
}

.popup-admin-placeholder {
  width: 112px;
  min-height: 76px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 1000;
}

.popup-admin-preview h4 {
  margin: 8px 0 6px;
  color: var(--ink);
  font-size: 17px;
}

.popup-admin-preview p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
}

.muted-text {
  color: var(--muted);
}

.popup-admin-actions {
  justify-content: flex-end;
}

@media (max-width: 760px) {
  .app-popup-layer {
    align-items: end;
    padding: 14px;
  }

  .app-popup-panel {
    width: 100%;
    max-height: calc(100dvh - 28px);
    padding: 18px;
    border-radius: 20px;
  }

  .popup-admin-item,
  .popup-admin-preview {
    grid-template-columns: 1fr;
  }

  .popup-admin-preview .app-popup-image {
    width: 100%;
    height: auto;
    max-height: 220px;
    object-fit: contain;
  }

  .popup-admin-placeholder {
    width: 100%;
  }

  .popup-admin-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Duty calendar */
.duty-calendar-panel {
  overflow: hidden;
}

.duty-calendar-toolbar {
  display: grid;
  grid-template-columns: 38px auto 38px 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.duty-calendar-toolbar > strong {
  min-width: 116px;
  color: var(--ui-text, var(--ink));
  font-size: 19px;
  text-align: center;
}

.duty-calendar-nav,
.duty-calendar-today {
  min-height: 38px;
  color: var(--ui-text, var(--ink));
  background: var(--ui-surface, var(--surface));
  border: 1px solid var(--ui-line, var(--line));
  border-radius: 10px;
  font-weight: 900;
}

.duty-calendar-nav {
  padding: 0;
  font-size: 25px;
  line-height: 1;
}

.duty-calendar-today {
  justify-self: end;
  padding: 7px 14px;
  color: var(--primary);
}

.duty-calendar-weekdays,
.duty-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.duty-calendar-weekdays {
  color: var(--ui-muted, var(--muted));
  border: 1px solid var(--ui-line, var(--line));
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}

.duty-calendar-weekdays span {
  padding: 9px 4px;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.duty-calendar-weekdays span:first-child,
.duty-calendar-day.is-sunday .duty-calendar-number {
  color: #d04545;
}

.duty-calendar-weekdays span:last-child,
.duty-calendar-day.is-saturday .duty-calendar-number {
  color: #5274c8;
}

.duty-calendar-grid {
  border-top: 1px solid var(--ui-line, var(--line));
  border-left: 1px solid var(--ui-line, var(--line));
}

.duty-calendar-day {
  position: relative;
  min-width: 0;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  padding: 9px;
  color: var(--ui-text, var(--ink));
  background: var(--ui-surface, var(--surface));
  border: 0;
  border-right: 1px solid var(--ui-line, var(--line));
  border-bottom: 1px solid var(--ui-line, var(--line));
  border-radius: 0;
  text-align: left;
}

.duty-calendar-day:not(.is-outside):hover {
  background: var(--primary-soft);
}

.duty-calendar-day.is-outside {
  background: color-mix(in srgb, var(--ui-surface, var(--surface)) 72%, var(--ui-bg, var(--page)));
}

.duty-calendar-day.is-selected {
  z-index: 1;
  background: color-mix(in srgb, var(--primary) 9%, var(--ui-surface, var(--surface)));
  box-shadow: inset 0 0 0 2px var(--primary);
}

.duty-calendar-number {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 900;
}

.duty-calendar-day.is-today .duty-calendar-number {
  color: #ffffff;
  background: var(--primary);
}

.duty-calendar-count {
  position: absolute;
  top: 10px;
  right: 9px;
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  color: #ffffff;
  background: var(--primary);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
}

.duty-calendar-events {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.duty-calendar-event {
  min-width: 0;
  padding: 4px 6px;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.duty-calendar-events em {
  color: var(--ui-muted, var(--muted));
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

.duty-day-detail {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--ui-line, var(--line));
}

.duty-day-detail-head {
  margin-bottom: 10px;
}

.duty-day-detail-head > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.duty-day-detail-head span {
  color: var(--ui-text, var(--ink));
  font-weight: 900;
}

.duty-day-detail-head strong {
  color: var(--primary);
  font-size: 13px;
}

@media (max-width: 919px) {
  .duty-calendar-panel {
    padding: 16px 12px;
  }

  .duty-calendar-panel .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .duty-calendar-panel .duty-filter {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .duty-calendar-panel .duty-filter button {
    width: 100%;
  }

  .duty-calendar-toolbar {
    grid-template-columns: 36px minmax(90px, auto) 36px 1fr;
  }

  .duty-calendar-toolbar > strong {
    min-width: 0;
    font-size: 16px;
  }

  .duty-calendar-nav,
  .duty-calendar-today {
    min-height: 36px;
    border-radius: 12px;
  }

  .duty-calendar-day {
    min-height: 58px;
    gap: 2px;
    padding: 5px 3px;
    align-items: center;
    text-align: center;
  }

  .duty-calendar-number {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .duty-calendar-count {
    position: static;
    min-width: 18px;
    height: 17px;
    padding: 0 5px;
    font-size: 9px;
  }

  .duty-calendar-events {
    display: none;
  }

  .duty-day-detail {
    margin-top: 14px;
    padding-top: 14px;
  }

  .duty-day-detail .entity-card,
  .duty-day-detail .notice-item {
    padding: 12px;
  }
}

:root[data-theme="dark"] .duty-calendar-nav,
:root[data-theme="dark"] .duty-calendar-today,
:root[data-theme="dark"] .duty-calendar-day {
  color: var(--ui-text, var(--ink));
  background-color: var(--ui-surface, #141d2e);
  border-color: var(--ui-line, #2d3953);
}

:root[data-theme="dark"] .duty-calendar-day.is-selected {
  background: color-mix(in srgb, var(--primary) 22%, var(--ui-surface, #141d2e));
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 0 0 10px;
}

.calendar-legend > span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  color: var(--ui-text, var(--ink));
  background: var(--ui-surface, var(--surface));
  border: 1px solid var(--ui-line, var(--line));
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.calendar-legend > span i,
.duty-calendar-dots i {
  width: 7px;
  height: 7px;
  display: block;
  background: var(--primary);
  border-radius: 50%;
}

.calendar-legend > span.meal i,
.duty-calendar-dots i.meal {
  background: var(--green);
}

.calendar-legend > span.schedule i,
.duty-calendar-dots i.schedule {
  background: var(--amber);
}

.calendar-legend > span.holiday i,
.duty-calendar-dots i.holiday {
  background: var(--red);
}

.calendar-legend > small {
  margin-left: auto;
  color: var(--ui-muted, var(--muted));
  font-size: 11px;
  font-weight: 800;
}

.calendar-legend > small.is-warning {
  color: var(--amber);
}

.duty-calendar-event.duty {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.duty-calendar-event.meal {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 10%, transparent);
}

.duty-calendar-event.schedule {
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 11%, transparent);
}

.duty-calendar-event.holiday {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 9%, transparent);
}

.duty-calendar-dots {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.calendar-detail-list {
  display: grid;
  gap: 10px;
}

.calendar-detail-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--ui-surface, var(--surface));
  border: 1px solid var(--ui-line, var(--line));
  border-left: 4px solid var(--primary);
  border-radius: 12px;
}

.calendar-detail-item.meal {
  border-left-color: var(--green);
}

.calendar-detail-item.schedule {
  border-left-color: var(--amber);
}

.calendar-detail-item.holiday {
  border-left-color: var(--red);
}

.calendar-detail-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  border-radius: 12px;
  font-size: 20px;
}

.calendar-detail-item > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.calendar-detail-item small {
  color: var(--ui-muted, var(--muted));
  font-size: 11px;
  font-weight: 900;
}

.calendar-detail-item strong {
  color: var(--ui-text, var(--ink));
  font-size: 15px;
}

.calendar-detail-item p,
.calendar-detail-item em {
  margin: 2px 0 0;
  color: var(--ui-muted, var(--muted));
  font-size: 13px;
  font-style: normal;
  line-height: 1.55;
}

.calendar-detail-item .meal-menu {
  color: var(--ui-text, var(--ink));
  white-space: pre-line;
}

.calendar-duty-section {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.calendar-duty-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ui-text, var(--ink));
  font-weight: 900;
}

.calendar-duty-title strong {
  color: var(--primary);
  font-size: 12px;
}

.calendar-empty {
  min-height: 92px;
}

:root[data-theme="dark"] .calendar-legend > span,
:root[data-theme="dark"] .calendar-detail-item {
  background: var(--ui-surface, #141d2e);
  border-color: var(--ui-line, #2d3953);
}

:root[data-theme="dark"] .calendar-detail-item.duty {
  border-left-color: var(--primary);
}

:root[data-theme="dark"] .calendar-detail-item.meal {
  border-left-color: var(--green);
}

:root[data-theme="dark"] .calendar-detail-item.schedule {
  border-left-color: var(--amber);
}

:root[data-theme="dark"] .calendar-detail-item.holiday {
  border-left-color: var(--red);
}

@media (max-width: 919px) {
  .calendar-legend {
    gap: 5px;
  }

  .calendar-legend > span {
    min-height: 25px;
    padding: 4px 7px;
    font-size: 10px;
  }

  .calendar-legend > small {
    width: 100%;
    margin: 1px 0 0;
    text-align: center;
  }

  .duty-calendar-dots {
    display: flex;
  }

  .calendar-detail-item {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
    border-radius: 15px;
  }

  .calendar-detail-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 18px;
  }
}
