:root {
  --theme: #f78c91;
  --theme-dark: #bb515a;
  --bg: #eef4f3;
  --ink: #101418;
  --muted: #7f8790;
  --line: #e8edf0;
  --surface: #ffffff;
  --button-color: #f78c91;
  --button-text: #bb515a;
  --notice-color: #9b5359;
  --notice-bg: #ffffff;
  --soft: #fff2ee;
  --shadow: 0 18px 40px rgba(31, 45, 54, 0.12);
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.public-page {
  display: flex;
  justify-content: center;
}

.phone-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  padding: 18px 22px 36px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), transparent 260px),
    var(--bg);
}

.app-header {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 10px;
  padding: 18px 0 16px;
}

.app-header h1 {
  margin: 0;
  overflow: hidden;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.72);
}

.icon-button svg {
  width: 28px;
  height: 28px;
  stroke-width: 2.8;
}

.hero-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 16px 26px rgba(218, 119, 128, 0.12);
}

.notice {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(247, 140, 145, 0.22);
  border-radius: 16px;
  color: var(--notice-color);
  background: color-mix(in srgb, var(--notice-bg) 82%, transparent);
  font-size: 14px;
  line-height: 1.5;
}

.search-panel {
  margin-bottom: 12px;
}

.campus-stack {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.campus-card {
  padding: 22px 18px 24px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.campus-card h2 {
  margin: 0 0 18px;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.25;
}

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

.building-pill {
  min-height: 36px;
  padding: 6px 8px;
  border: 0;
  border-radius: 999px;
  color: var(--button-text);
  background: color-mix(in srgb, var(--button-color) 16%, white);
  overflow: hidden;
  font-size: 18px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.building-pill:hover,
.building-pill:focus-visible {
  color: #ffffff;
  outline: none;
  background: var(--button-color);
}

.building-pill.is-hot {
  color: #ffffff;
  background: var(--button-color);
}

.empty-state {
  padding: 28px 14px;
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.7);
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  justify-items: center;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(16, 20, 24, 0.42);
}

.qr-sheet {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  padding: 10px 22px 28px;
  border-radius: 26px 26px 0 0;
  background: var(--surface);
  box-shadow: 0 -18px 50px rgba(16, 20, 24, 0.2);
}

.sheet-handle {
  width: 42px;
  height: 5px;
  margin: 0 auto 16px;
  border-radius: 999px;
  background: #d8dee3;
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.sheet-header p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14px;
}

.sheet-header h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.2;
}

.qr-frame {
  display: grid;
  min-height: 286px;
  margin: 20px 0 14px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fafafa;
}

.qr-frame img {
  width: min(78vw, 280px);
  max-width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 12px;
}

.scan-tip,
.qr-count {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.admin-page {
  background: #f4f7fa;
}

.admin-login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 420px);
  padding: 32px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.login-card h1,
.admin-sidebar h1,
.admin-topbar h2,
.panel-title h3 {
  margin: 0;
}

.login-card h1 {
  margin-bottom: 24px;
  font-size: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--theme-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.admin-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 26px;
  padding: 30px 22px;
  background: #ffffff;
  border-right: 1px solid var(--line);
}

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

.admin-sidebar a {
  padding: 12px 14px;
  border-radius: 12px;
  color: #34404a;
  text-decoration: none;
}

.admin-sidebar a:hover {
  background: #f5f7f9;
}

.admin-sidebar .ghost-button {
  margin-top: auto;
}

.admin-content {
  display: grid;
  gap: 22px;
  padding: 30px;
}

.admin-topbar,
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.stat-card,
.admin-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(31, 45, 54, 0.06);
}

.stat-card {
  display: grid;
  gap: 10px;
  padding: 20px;
}

.stat-card span {
  color: var(--muted);
  font-size: 14px;
}

.stat-card strong {
  font-size: 34px;
  line-height: 1;
}

.admin-panel {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.settings-grid,
.building-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 120px auto;
  gap: 14px;
  align-items: end;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.toggle-field span {
  color: #53606b;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #dce3e8;
  border-radius: 12px;
  color: var(--ink);
  background: #ffffff;
}

.field input:focus,
.field select:focus {
  border-color: var(--theme);
  outline: 3px solid rgba(247, 140, 145, 0.16);
}

.field.compact input {
  min-height: 42px;
}

.field.full {
  grid-column: 1 / -1;
}

.field.narrow {
  min-width: 110px;
}

.toggle-field {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
}

.toggle-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--theme);
}

.primary-button,
.ghost-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  border-radius: 12px;
  font-weight: 800;
  text-decoration: none;
}

.primary-button {
  border: 0;
  color: #ffffff;
  background: linear-gradient(135deg, var(--theme), #ff9ba0);
  box-shadow: 0 12px 22px rgba(247, 140, 145, 0.28);
}

.ghost-button {
  border: 1px solid #dce3e8;
  color: #34404a;
  background: #ffffff;
}

.primary-button svg,
.ghost-button svg {
  width: 18px;
  height: 18px;
}

.form-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: #c43c3c;
  font-size: 14px;
}

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

.data-item {
  display: grid;
  grid-template-columns: 1fr 110px auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfd;
}

.data-item strong {
  font-size: 16px;
}

.item-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid #dce3e8;
  border-radius: 10px;
  color: #34404a;
  background: #ffffff;
}

.mini-button.danger {
  color: #c43c3c;
}

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

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

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #53606b;
  font-size: 13px;
  background: #f7f9fb;
}

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

.qr-thumb {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.on {
  color: #147443;
  background: #e7f7ee;
}

.status-pill.off {
  color: #8a4d13;
  background: #fff4df;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 48px));
  padding: 12px 16px;
  border-radius: 12px;
  color: #ffffff;
  background: #16212b;
  box-shadow: var(--shadow);
}

.admin-workspace {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: 100vh;
  background: #f5f7f8;
}

.admin-nav {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px;
  border-right: 1px solid #e5eaee;
  background: #ffffff;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 14px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  color: #ffffff;
  background: var(--theme);
  font-weight: 900;
}

.admin-brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.admin-nav nav {
  display: grid;
  gap: 6px;
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 12px;
  color: #35414c;
  font-weight: 700;
  text-decoration: none;
}

.admin-nav a:hover {
  color: var(--theme-dark);
  background: color-mix(in srgb, var(--theme) 10%, white);
}

.admin-nav a svg {
  width: 18px;
  height: 18px;
}

.admin-nav .ghost-button {
  width: 100%;
  margin-top: auto;
}

.admin-main {
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 24px;
}

.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border: 1px solid #e5eaee;
  border-radius: 18px;
  background: #ffffff;
}

.admin-hero h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.admin-hero p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
}

.admin-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stats-grid.compact .stat-card {
  padding: 16px;
}

.stats-grid.compact .stat-card strong {
  font-size: 30px;
}

.designer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.settings-panel {
  align-self: stretch;
}

.settings-sections {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.plain-fieldset {
  display: grid;
  gap: 14px;
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid #e5eaee;
  border-radius: 14px;
}

.plain-fieldset legend {
  padding: 0 6px;
  color: #33404b;
  font-weight: 900;
}

.field textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid #dce3e8;
  border-radius: 12px;
  color: var(--ink);
  background: #ffffff;
}

.field textarea:focus {
  border-color: var(--theme);
  outline: 3px solid color-mix(in srgb, var(--theme) 18%, transparent);
}

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

.color-field {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e5eaee;
  border-radius: 13px;
  background: #fbfcfd;
}

.color-field span {
  color: #53606b;
  font-size: 13px;
  font-weight: 800;
}

.color-field input {
  width: 38px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

.preview-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #e5eaee;
  border-radius: 18px;
  background: #ffffff;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-toolbar h3 {
  margin: 0;
}

.preview-toolbar span {
  color: var(--muted);
  font-size: 13px;
}

.mini-phone {
  --preview-bg: #eef4f3;
  --preview-card: #ffffff;
  --preview-button: #f78c91;
  --preview-button-text: #bb515a;
  --preview-text: #101418;
  --preview-notice-color: #9b5359;
  --preview-notice-bg: #ffffff;
  display: grid;
  gap: 12px;
  max-height: 640px;
  overflow: auto;
  padding: 16px;
  border: 10px solid #1f2933;
  border-radius: 28px;
  color: var(--preview-text);
  background: var(--preview-bg);
}

.mini-phone img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
}

.mini-notice {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--preview-notice-color);
  background: color-mix(in srgb, var(--preview-notice-bg) 85%, transparent);
  font-size: 12px;
  line-height: 1.5;
}

.mini-campus-stack {
  display: grid;
  gap: 12px;
}

.mini-campus {
  padding: 14px;
  border-radius: 14px;
  background: var(--preview-card);
  box-shadow: 0 10px 22px rgba(31, 45, 54, 0.08);
}

.mini-campus h4 {
  margin: 0 0 10px;
  font-size: 17px;
}

.mini-campus div {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.mini-campus span {
  overflow: hidden;
  padding: 5px 3px;
  border-radius: 999px;
  color: var(--preview-button-text);
  background: color-mix(in srgb, var(--preview-button) 16%, white);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-campus span.active {
  color: #ffffff;
  background: var(--preview-button);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(360px, 1fr);
  gap: 18px;
  align-items: start;
}

.compact-form,
.building-editor {
  display: grid;
  gap: 12px;
}

.compact-form {
  grid-template-columns: minmax(0, 1fr) 96px auto;
  align-items: end;
}

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

.field.tiny {
  min-width: 88px;
}

.building-editor .full,
.primary-button.full {
  grid-column: 1 / -1;
}

.switch-field {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 0 2px;
  color: #53606b;
  font-size: 13px;
  font-weight: 800;
}

.switch-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--theme);
}

.data-list.clean {
  margin-top: 4px;
}

.clean-item {
  grid-template-columns: 1fr auto;
}

.clean-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.building-admin-card {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid #e5eaee;
  border-radius: 14px;
  background: #fbfcfd;
}

.building-admin-card.is-editing {
  border-color: var(--theme);
  background: color-mix(in srgb, var(--theme) 8%, white);
}

.qr-thumb-box {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid #e5eaee;
  border-radius: 12px;
  color: var(--muted);
  background: #ffffff;
  font-size: 12px;
}

.qr-thumb-box.large {
  width: 78px;
  height: 78px;
}

.qr-thumb-box img {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.qr-thumb-box.large img {
  width: 68px;
  height: 68px;
}

.building-admin-main {
  min-width: 0;
}

.building-admin-main strong {
  display: block;
  overflow: hidden;
  color: #17202a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.building-admin-main p,
.building-admin-meta span:first-child,
.panel-help {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.building-admin-meta {
  display: grid;
  justify-items: start;
  gap: 6px;
}

.empty-admin-state {
  padding: 18px;
  border: 1px dashed #d5dde3;
  border-radius: 14px;
  color: var(--muted);
  background: #fbfcfd;
  text-align: center;
}

.inline-building-form {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  width: 100%;
}

.inline-building-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.inline-building-fields .full {
  grid-column: 1 / -1;
}

.inline-switch {
  align-self: end;
}

.inline-building-actions {
  display: flex;
  min-width: 120px;
  flex-direction: column;
  gap: 8px;
}

.inline-building-actions .primary-button,
.inline-building-actions .ghost-button {
  width: 100%;
}

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

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

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

  .stats-grid,
  .settings-grid,
  .building-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-workspace,
  .designer-grid,
  .content-grid,
  .settings-sections {
    grid-template-columns: 1fr;
  }

  .admin-nav,
  .preview-panel {
    position: static;
    height: auto;
  }

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

@media (max-width: 620px) {
  .phone-shell {
    padding-inline: 18px;
  }

  .app-header h1 {
    font-size: 22px;
  }

  .campus-card {
    padding: 20px 16px 22px;
  }

  .admin-content {
    padding: 18px;
  }

  .admin-sidebar nav,
  .stats-grid,
  .settings-grid,
  .building-form,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .admin-main {
    padding: 14px;
  }

  .admin-hero,
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-nav nav,
  .compact-form,
  .building-editor,
  .color-grid,
  .building-admin-card,
  .inline-building-form,
  .inline-building-fields {
    grid-template-columns: 1fr;
  }

  .inline-building-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .building-admin-meta {
    justify-items: start;
  }

  .admin-topbar,
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .data-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .building-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Current admin layout */
.admin-workspace {
  display: block;
  min-height: 100vh;
}

.admin-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  height: auto;
  min-height: 76px;
  flex-direction: row;
  align-items: center;
  gap: 18px;
  padding: 14px 24px;
  border-right: 0;
  border-bottom: 1px solid #e5eaee;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
}

.admin-nav nav {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.admin-nav a {
  min-height: 42px;
  padding: 10px 13px;
  white-space: nowrap;
}

.admin-nav .ghost-button {
  width: auto;
  margin-top: 0;
  margin-left: auto;
  white-space: nowrap;
}

.admin-main {
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 24px;
}

.stats-grid.compact {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  overflow-x: auto;
  padding-bottom: 2px;
}

.stats-grid.compact .stat-card {
  min-width: 150px;
}

.campus-dorm-panel {
  gap: 20px;
}

.management-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.campus-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.campus-admin-list {
  display: grid;
  gap: 12px;
}

.campus-manage-card {
  display: grid;
  gap: 14px;
  padding: 15px;
  border: 1px solid #e5eaee;
  border-radius: 14px;
  background: #fbfcfd;
}

.campus-manage-card.is-editing {
  border-color: var(--theme);
  background: color-mix(in srgb, var(--theme) 8%, white);
}

.campus-manage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.campus-manage-head strong {
  display: block;
  color: #17202a;
  font-size: 17px;
}

.campus-manage-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.building-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.building-chip {
  display: grid;
  gap: 3px;
  min-width: 92px;
  max-width: 156px;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--theme) 18%, #e5eaee);
  border-radius: 12px;
  color: var(--theme-dark);
  background: color-mix(in srgb, var(--theme) 9%, white);
  text-align: left;
}

.building-chip:hover,
.building-chip:focus-visible {
  border-color: var(--theme);
  outline: 3px solid color-mix(in srgb, var(--theme) 18%, transparent);
}

.building-chip span {
  overflow: hidden;
  font-size: 14px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.building-chip small {
  overflow: hidden;
  color: #7f8790;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.building-chip.is-hidden {
  color: #8a4d13;
  background: #fff7e8;
  border-color: #f3dfbd;
}

.empty-inline {
  color: var(--muted);
  font-size: 13px;
}

.inline-campus-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px auto;
  gap: 12px;
  align-items: end;
}

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

.building-editor.merged {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  padding: 18px;
  border: 1px solid #e5eaee;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(31, 45, 54, 0.05);
}

.panel-subtitle {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.panel-subtitle h4 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
}

.panel-subtitle .eyebrow {
  grid-column: 1 / -1;
  margin-bottom: -4px;
}

@media (max-width: 960px) {
  .admin-nav {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .admin-nav nav {
    order: 3;
    flex-basis: 100%;
  }

  .admin-nav .ghost-button {
    margin-left: auto;
  }

  .management-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .admin-nav {
    gap: 12px;
    padding: 12px 14px;
  }

  .admin-brand {
    min-width: 0;
  }

  .admin-brand h1 {
    font-size: 18px;
  }

  .admin-nav nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .admin-nav a {
    flex: 0 0 auto;
  }

  .admin-main {
    padding: 14px;
  }

  .stats-grid.compact {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    overflow-x: visible;
  }

  .stats-grid.compact .stat-card {
    min-width: 0;
    padding: 12px 10px;
  }

  .stats-grid.compact .stat-card span {
    font-size: 11px;
  }

  .stats-grid.compact .stat-card strong {
    font-size: 24px;
  }

  .compact-form,
  .inline-campus-form,
  .building-editor.merged {
    grid-template-columns: 1fr;
  }

  .panel-subtitle {
    grid-template-columns: 1fr;
  }

  .inline-campus-actions {
    flex-wrap: wrap;
  }
}

/* More compact admin pass */
.compact-main {
  display: grid;
  gap: 14px;
  width: min(100%, 1180px);
  padding: 16px;
}

.overview-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

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

.overview-actions .primary-button,
.overview-actions .ghost-button {
  min-height: 42px;
}

.password-panel {
  grid-column: 1 / -1;
  border: 1px solid #e5eaee;
  border-radius: 14px;
  background: #ffffff;
}

.password-panel summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  color: #34404a;
  cursor: pointer;
  font-weight: 900;
}

.password-panel summary::marker {
  color: var(--theme-dark);
}

.password-panel summary svg {
  width: 18px;
  height: 18px;
}

.password-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 0 14px 14px;
}

.password-form .form-message {
  grid-column: 1 / -1;
  margin: 0;
}

.compact-settings {
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 14px;
}

.compact-title {
  margin-bottom: -4px;
}

.settings-sections.compact {
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1fr);
  gap: 12px;
}

.settings-sections.compact .plain-fieldset {
  padding: 13px;
}

.settings-sections.compact .field textarea {
  min-height: 70px;
}

.color-grid.compact {
  grid-template-columns: repeat(4, minmax(74px, 1fr));
  gap: 8px;
}

.color-grid.compact .color-field {
  min-height: 48px;
  padding: 8px 10px;
}

.color-grid.compact .color-field input {
  width: 30px;
  height: 28px;
}

.compact-preview {
  position: static;
  gap: 10px;
  padding: 14px;
}

.compact-preview summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-weight: 900;
}

.compact-preview summary::marker {
  color: var(--theme-dark);
}

.compact-preview summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.compact-preview .mini-phone {
  max-height: 360px;
  margin-top: 12px;
  padding: 12px;
  border-width: 7px;
  border-radius: 22px;
}

.compact-content {
  gap: 12px;
  padding: 18px;
}

.management-layout.tight {
  grid-template-columns: minmax(320px, 0.85fr) minmax(380px, 1fr);
  gap: 14px;
}

.compact-form.tight {
  grid-template-columns: minmax(0, 1fr) 86px auto;
  gap: 10px;
}

.campus-admin-list.compact {
  gap: 8px;
}

.campus-manage-card.compact {
  gap: 0;
  padding: 12px 13px;
}

.campus-manage-card.compact .campus-manage-head {
  align-items: center;
}

.campus-manage-card.compact strong {
  font-size: 16px;
}

.building-editor.merged.compact {
  gap: 10px;
  padding: 14px;
}

.building-editor.merged.compact .field input,
.building-editor.merged.compact .field select {
  min-height: 42px;
}

.building-editor.merged.compact .primary-button.full {
  margin-top: 2px;
}

@media (max-width: 960px) {
  .overview-strip,
  .compact-settings,
  .settings-sections.compact,
  .management-layout.tight,
  .password-form {
    grid-template-columns: 1fr;
  }

  .overview-actions {
    justify-content: stretch;
  }

  .overview-actions .primary-button,
  .overview-actions .ghost-button {
    flex: 1;
  }
}

@media (max-width: 620px) {
  .compact-main {
    gap: 10px;
    padding: 10px;
  }

  .compact-settings {
    gap: 10px;
  }

  .settings-sections.compact .plain-fieldset,
  .compact-preview,
  .compact-content {
    padding: 12px;
  }

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

  .compact-form.tight,
  .building-editor.merged.compact {
    grid-template-columns: 1fr;
  }

  .campus-manage-card.compact .campus-manage-head {
    align-items: flex-start;
  }
}
