/* Shared mobile admin shell — Student Housing Admin PWA */

body[data-pwa-env="prod"] {
  --pwa-accent: #0a7f5a;
}

body[data-pwa-env="dev"] {
  --pwa-accent: #ff1493;
}

body.mobile-admin-page,
body[data-mobile-admin-shell="1"] {
  --mobile-top-bar-height: calc(48px + env(safe-area-inset-top, 0px));
  --mobile-template-toolbar-height: 40px;
  --mobile-top-chrome-height: calc(var(--mobile-top-bar-height) + var(--mobile-template-toolbar-height));
  padding-top: var(--mobile-top-chrome-height);
  padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}

body.mobile-admin-page .global-home-link,
body[data-mobile-admin-shell="1"] .global-home-link {
  display: none !important;
}

@media (max-width: 991.98px) {
  body.mobile-admin-page .global-home-link {
    display: none !important;
  }
}

.mobile-page-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.mobile-page-header h1,
.mobile-page-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.mobile-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid #dee2e6;
  background: #fff;
  color: #212529;
  text-decoration: none;
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.mobile-back-btn:active {
  background: #eef4ff;
}

.mobile-sticky-filter {
  position: sticky;
  top: var(--mobile-top-chrome-height, var(--mobile-top-bar-height, 0px));
  z-index: 1020;
  background: #f8f9fa;
  padding: 8px 0;
  margin: 0 -15px 12px -15px;
  border-bottom: 1px solid #dee2e6;
}

.mobile-tap-target {
  min-height: 44px;
}

.mobile-card {
  border-left: 4px solid transparent;
}

.mobile-card.needs-action {
  border-left-color: #dc3545;
}

.mobile-card.has-unread {
  border-left-color: #ffc107;
}

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

@media (min-width: 576px) {
  .mobile-hub-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.mobile-hub-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 108px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid #dee2e6;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: #212529;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.mobile-hub-tile:active {
  transform: scale(0.98);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.mobile-hub-tile.primary {
  border-color: #b6d4fe;
  background: linear-gradient(180deg, #eef4ff 0%, #f8fbff 100%);
}

.mobile-hub-tile .tile-icon {
  font-size: 1.5rem;
  line-height: 1;
  margin-bottom: 8px;
}

.mobile-hub-tile .tile-label {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.15;
}

.mobile-hub-tile .tile-meta {
  font-size: 0.78rem;
  color: #6c757d;
  margin-top: 4px;
}

.mobile-hub-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: auto;
}

.mobile-contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mobile-contact-row .btn {
  min-height: 40px;
}

/* ── Mobile inbox (SMS-style list) ─────────────────────────── */

.mobile-inbox-search .form-control {
  font-size: 16px;
}

.mobile-inbox-list {
  border-top: 1px solid #e9ecef;
}

.mobile-inbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #e9ecef;
  background: #fff;
  color: inherit;
  text-decoration: none;
}

.mobile-inbox-row:active {
  background: #f1f5f9;
}

.mobile-inbox-row.has-unread {
  background: #f8fbff;
}

.mobile-inbox-row.needs-reply {
  background: #fff8f8;
}

.mobile-inbox-avatar {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.mobile-inbox-main {
  flex: 1 1 auto;
  min-width: 0;
}

.mobile-inbox-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.mobile-inbox-name-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.mobile-inbox-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
}

.mobile-inbox-room {
  flex: 0 1 auto;
  font-size: 0.7rem;
  font-weight: 500;
  color: #868e96;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46%;
}

.mobile-inbox-time {
  flex: 0 0 auto;
  font-size: 0.72rem;
  color: #6c757d;
}

.mobile-inbox-preview {
  display: block;
  margin-top: 2px;
  font-size: 0.84rem;
  color: #495057;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-inbox-dot {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.mobile-inbox-dot--needs-reply {
  background: #dc3545;
}

.mobile-inbox-dot--unread {
  background: #0d6efd;
}

.ptr-indicator {
  text-align: center;
  color: #6c757d;
  font-size: 0.85rem;
  height: 0;
  overflow: hidden;
  transition: height 0.15s ease-out;
}

.ptr-indicator.active,
.ptr-indicator.refreshing {
  height: 36px;
  line-height: 36px;
}

.ptr-indicator.refreshing {
  color: #0d6efd;
}

/* ── Mobile thread (chat-style) ───────────────────────────── */

body.mobile-thread-page {
  --mobile-top-bar-height: 0px;
  --mobile-template-toolbar-height: 0px;
  --mobile-top-chrome-height: env(safe-area-inset-top, 0px);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
}

.mobile-thread-shell {
  display: flex;
  flex-direction: column;
  height: calc(
    100dvh - var(--mobile-top-bar-height, 0px) - 56px - env(safe-area-inset-bottom, 0px)
  );
  max-height: calc(
    100dvh - var(--mobile-top-bar-height, 0px) - 56px - env(safe-area-inset-bottom, 0px)
  );
}

.mobile-thread-header {
  flex: 0 0 auto;
  position: relative;
  top: auto;
  z-index: 1035;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #dee2e6;
  padding: 6px 12px 0 12px;
  margin: 0;
}

.mobile-thread-header-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.mobile-thread-title-block {
  flex: 1 1 auto;
}

.mobile-thread-icon-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.mobile-thread-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #dee2e6;
  background: #fff;
  color: #212529;
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.mobile-thread-icon-btn:active {
  background: #eef4ff;
}

.mobile-thread-tabs {
  display: flex;
  gap: 0;
  margin-top: 4px;
}

.mobile-thread-tab {
  flex: 1 1 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 4px 4px 3px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.15;
  color: #6c757d;
}

.mobile-thread-tab.active {
  color: #0d6efd;
  border-bottom-color: #0d6efd;
}

.mobile-thread-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: none;
}

.mobile-thread-panel.active {
  display: flex;
  flex-direction: column;
}

.mobile-thread-meta {
  font-size: 0.82rem;
  color: #6c757d;
  margin-top: 4px;
}

.mobile-thread-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 12px 8px 12px;
}

.mobile-thread-scroll--sms,
.mobile-thread-scroll--email {
  padding: 0;
}

.mobile-email-thread-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #e9ecef;
  background: #fff;
  padding: 10px 12px;
  color: inherit;
}

.mobile-email-thread-item:active {
  background: #f8f9fa;
}

.mobile-email-thread-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.mobile-email-thread-subject {
  font-size: 0.84rem;
  font-weight: 600;
  color: #212529;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-email-thread-date {
  flex: 0 0 auto;
  font-size: 0.68rem;
  color: #868e96;
}

.mobile-email-thread-from,
.mobile-email-thread-snippet {
  font-size: 0.74rem;
  color: #6c757d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-email-message {
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
  background: #fff;
}

.mobile-email-message-meta {
  font-size: 0.72rem;
  color: #6c757d;
  margin-bottom: 8px;
}

.mobile-email-message-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.84rem;
  line-height: 1.35;
}

.mobile-sms-item .mobile-sms-time {
  font-size: 0.72rem;
  color: #868e96;
  margin-bottom: 4px;
}

.mobile-sms-item .mobile-sms-body {
  font-size: 0.88rem;
  line-height: 1.35;
}

.mobile-no-reply-btn,
.mobile-reopen-form .btn-link {
  font-size: 0.8rem;
  text-decoration: none;
}

.mobile-thread-bubble.is-closed {
  opacity: 0.88;
}

.mobile-thread-bubble-wrap {
  display: flex;
  margin-bottom: 10px;
}

.mobile-thread-bubble-wrap.from-student {
  justify-content: flex-start;
}

.mobile-thread-bubble-wrap.from-admin {
  justify-content: flex-end;
}

.mobile-thread-bubble {
  max-width: min(88%, 520px);
  padding: 10px 12px;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.mobile-thread-bubble.from-student {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-bottom-left-radius: 4px;
}

.mobile-thread-bubble.from-admin {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-bottom-right-radius: 4px;
}

.mobile-thread-bubble.internal-note {
  max-width: 100%;
  background: #fff9c4;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
}

.mobile-thread-bubble .bubble-meta {
  font-size: 0.72rem;
  color: #64748b;
  margin-bottom: 4px;
}

.mobile-thread-bubble .bubble-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
  line-height: 1.35;
}

.mobile-thread-compose {
  flex: 0 0 auto;
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: 1032;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  border-top: 1px solid #dee2e6;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) 10px;
}

.mobile-compose-bar {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.mobile-compose-ai-shell {
  margin: 0;
}

.mobile-compose-icon-stack {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  flex: 0 0 32px;
  padding-bottom: 2px;
}

.mobile-compose-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-compose-icon-btn {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #dee2e6;
  background: #fff;
  color: #495057;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.mobile-compose-icon-btn:active,
.mobile-compose-attach-btn:active {
  background: #eef4ff;
}

.mobile-compose-icon-btn.js-ai-mic-toggle.btn-danger {
  border-color: #dc3545;
  background: #dc3545;
  color: #fff;
}

.mobile-compose-icon-btn.js-ai-mic-toggle.btn-outline-primary {
  border-color: #dee2e6;
  background: #fff;
  color: #495057;
}

.mobile-compose-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.mobile-compose-bottom-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.mobile-compose-templates {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  gap: 3px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.mobile-compose-templates::-webkit-scrollbar {
  display: none;
}

.mobile-compose-templates .btn {
  flex: 0 0 auto;
  font-size: 0.68rem;
  padding: 0.15rem 0.38rem;
  line-height: 1.15;
}

.mobile-compose-sms {
  flex: 0 0 auto;
  min-height: 0;
  padding-left: 2px;
  white-space: nowrap;
}

.mobile-compose-sms .custom-control-label {
  font-size: 0.68rem;
  line-height: 1.15;
  padding-top: 1px;
}

.mobile-compose-sms .custom-control-label::before,
.mobile-compose-sms .custom-control-label::after {
  top: 0.08rem;
  width: 0.9rem;
  height: 0.9rem;
}

.mobile-compose-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 0;
}

.mobile-compose-translate-btn {
  flex: 0 0 auto;
  border: 0;
  background: #eef4ff;
  color: #0d6efd;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.mobile-compose-translate-btn[hidden] {
  display: none !important;
}

.mobile-compose-ai-status {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.72rem;
  color: #6c757d;
}

.mobile-compose-ai-status:empty {
  display: none;
}

.student-message-sms-notify {
  font-size: 0.78rem;
  line-height: 1.35;
}

.student-message-sms-notify .badge {
  font-size: 0.68rem;
  font-weight: 600;
  vertical-align: middle;
}

.student-message-sms-notify__form .btn {
  font-size: 0.72rem;
  line-height: 1.2;
  padding: 2px 8px;
}

.mobile-thread-bubble .student-message-sms-notify {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

.bubble-read-status {
  font-size: 0.72rem;
  line-height: 1.3;
}

.bubble-read-status-line + .bubble-read-status-line {
  margin-top: 2px;
}

.bubble-read-status--read {
  color: #198754;
}

.bubble-read-status--unread {
  color: #b45309;
  font-weight: 600;
}

.mobile-compose-attachment-name {
  display: none;
  flex: 0 1 auto;
  font-size: 0.65rem;
  color: #0d6efd;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 3.5rem;
}

.mobile-compose-attachment-name.is-active {
  display: block;
}

.mobile-compose-more-btn {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #dee2e6;
  background: #f8f9fa;
  color: #495057;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0;
}

.mobile-compose-input {
  width: 100%;
  font-size: 16px;
  min-height: 38px;
  max-height: 120px;
  resize: none;
  border-radius: 18px;
  padding: 7px 12px;
}

.mobile-compose-send {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
}

.compose-extras-panel {
  border-top: 1px solid #eef2f7;
  margin-top: 8px;
  padding-top: 8px;
}

.compose-extras-inner {
  max-height: 180px;
  overflow-y: auto;
}

.mobile-thread-compose textarea {
  font-size: 16px;
  min-height: 72px;
  resize: vertical;
}

.mobile-thread-compose.collapsed textarea,
.mobile-thread-compose.collapsed .compose-extras {
  display: none;
}

.mobile-thread-compose.collapsed .compose-toggle-hint {
  display: block;
}

.compose-toggle-hint {
  display: none;
  font-size: 0.85rem;
  color: #6c757d;
  padding: 8px 0 2px 0;
}

.mobile-list-card {
  border-radius: 12px;
  border: 1px solid #dee2e6;
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.10);
  margin-bottom: 14px;
  overflow: hidden;
  border-left: 4px solid #ced4da;
}

.mobile-list-card.unread {
  border-left: 4px solid #0d6efd;
  background: #f8fbff;
}

.mobile-list-card.flagged {
  border-left: 4px solid #dc3545;
}

.mobile-list-card .card-body-inner {
  padding: 12px 14px;
}

.mobile-list-card .card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}

.mobile-list-card .card-meta {
  font-size: 0.78rem;
  color: #6c757d;
}

.move-out-status-chips .badge {
  font-size: 0.7rem;
  font-weight: 600;
}

.move-out-quick-actions form {
  margin: 0;
}

/* Move-out card status color coding */
.mo-card--pending {
  border-left-color: #fd7e14;
  background: #fffcf5;
}

.mo-card--acknowledged {
  border-left-color: #0d6efd;
  background: #f8fbff;
}

.mo-card--paused {
  border-left-color: #adb5bd;
  background: #f9f9f9;
}

.mo-card--moved-out {
  border-left-color: #198754;
  background: #f5faf7;
  opacity: 0.82;
}

/* Alternating: every other card flips to a clean grey-white so
   adjacent cards of the same status are always visually distinct. */
.mobile-list-card.mo-alt {
  background: #edf0f4 !important;
}

.mo-student-name {
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.mo-secondary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}

.mo-secondary-actions form {
  margin: 0;
}

.mo-date-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}

.mo-date-input {
  flex: 0 0 auto;
  width: 140px;
}

.mo-notes-input {
  flex: 1 1 120px;
  min-width: 100px;
}

.mo-save-btn {
  flex: 0 0 auto;
}

/* Move-out redesign: checklist chips */
.mo-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.mo-checklist form {
  margin: 0;
}

.mo-check-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 100px;
  border: 2px solid #ced4da;
  background: #fff;
  color: #6c757d;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
  line-height: 1.2;
  -webkit-appearance: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}

.mo-check-chip .mo-icon {
  font-size: 1rem;
  line-height: 1;
}

.mo-check-chip--done {
  border-color: #198754;
  background: #198754;
  color: #fff;
}

.mo-check-chip--fail {
  border-color: #dc3545;
  background: #dc3545;
  color: #fff;
}

.mo-primary-action {
  margin-top: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px !important;
  height: 46px;
}

.mo-done-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 0 2px;
}

.mo-done-label {
  color: #198754;
  font-weight: 600;
  font-size: 0.9rem;
}

.mobile-list-card .card-body-text {
  font-size: 0.9rem;
  white-space: pre-line;
  word-break: break-word;
  margin-top: 6px;
}

.mobile-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.mobile-filter-pill {
  display: inline-block;
  border-radius: 999px;
  font-size: 0.78rem;
  padding: 4px 12px;
  border: 1px solid #ced4da;
  background: #fff;
  color: #495057;
  text-decoration: none;
}

.mobile-filter-pill.active {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}

.mobile-kpi-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mobile-kpi-pill {
  font-size: 0.78rem;
  background: #fff3cd;
  border: 1px solid #ffecb5;
  border-radius: 999px;
  padding: 4px 10px;
  color: #664d03;
}

.mobile-kpi-pill.muted {
  background: #f8f9fa;
  border-color: #dee2e6;
  color: #495057;
}

.mobile-filter-pills .btn {
  border-radius: 999px;
  font-size: 0.78rem;
  padding: 4px 12px;
}

.mobile-change-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed #e9ecef;
  font-size: 0.88rem;
}

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

.mobile-apartment-bubble {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #fff;
  border: 1px solid #dee2e6;
}

.mobile-apartment-bubble.flagged {
  border-color: #f5c2c7;
  background: #fff5f5;
}

.mobile-preview-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mobile-ptr-indicator {
  text-align: center;
  color: #6c757d;
  font-size: 0.85rem;
  height: 0;
  overflow: hidden;
  transition: height 0.15s ease-out;
}

.mobile-ptr-indicator.active,
.mobile-ptr-indicator.refreshing {
  height: 36px;
  line-height: 36px;
}

.mobile-ptr-indicator.refreshing {
  color: #0d6efd;
}

/* Top notification bar — all mobile admin pages */
.mobile-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1040;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 48px;
  padding: env(safe-area-inset-top, 0px) 8px 0 10px;
  background: #fff;
  border-bottom: 1px solid #dee2e6;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.mobile-top-bar__leading {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.mobile-top-bar__title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.mobile-top-bar__back {
  min-width: 40px;
  min-height: 40px;
  padding: 0 8px;
  border-radius: 10px;
}

.mobile-top-bar__page-title {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  color: #495057;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-top-bar__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* Email template copy — second row below top bar (not in bell/flag row) */
.mobile-template-toolbar {
  position: fixed;
  top: var(--mobile-top-bar-height, 48px);
  left: 0;
  right: 0;
  z-index: 1038;
  min-height: var(--mobile-template-toolbar-height, 40px);
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.mobile-template-toolbar__scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.mobile-template-toolbar__scroll::-webkit-scrollbar {
  display: none;
}

.mobile-template-copy-btn {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #ced4da;
  background: #fff;
  color: #212529;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  cursor: pointer;
}

.mobile-template-copy-btn:active {
  background: #eef4ff;
  border-color: #b6d4fe;
}

.mobile-template-copy-toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  z-index: 1050;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
}

.mobile-template-copy-toast[hidden] {
  display: none !important;
}

.mobile-template-copy-toast--success {
  background: #d1e7dd;
  color: #0f5132;
  border: 1px solid #a3cfbb;
}

.mobile-template-copy-toast--error {
  background: #f8d7da;
  color: #842029;
  border: 1px solid #f1aeb5;
}

/* Compact period tabs (mobile room list) */
.mobile-roomlist-page .mobile-period-tabs {
  position: sticky;
  top: 0;
  z-index: 1015;
  margin: 0 -8px 6px;
  padding: 0 8px 4px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.mobile-period-tabs__scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.mobile-period-tabs__scroll::-webkit-scrollbar {
  display: none;
}

.mobile-period-tab {
  flex: 0 0 auto;
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #ced4da;
  background: #fff;
  color: #495057;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.15;
  text-decoration: none;
  white-space: nowrap;
  max-width: 7.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-period-tab.active {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}

.mobile-period-tab:active {
  opacity: 0.9;
}

.mobile-roomlist-search {
  position: relative;
  margin-bottom: 6px;
}

.mobile-roomlist-search .form-control {
  font-size: 0.85rem;
  min-height: 36px;
  padding-right: 2.25rem;
}

.mobile-roomlist-search__clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #6c757d;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.mobile-roomlist-search__clear[hidden] {
  display: none !important;
}

.mobile-roomlist-search__clear:active {
  background: #e9ecef;
  color: #212529;
}

.mobile-roomlist-no-matches {
  display: none;
}

.mobile-roomlist-no-matches.is-visible {
  display: block;
}

.mobile-roomlist-page .unit-group.is-filter-hidden {
  display: none;
}

.mobile-roomlist-page .room-entry.is-filter-hidden {
  display: none;
}

.mobile-roomlist-page .container-fluid {
  padding-top: 0;
}

.mobile-roomlist-summary {
  font-size: 0.75rem;
  color: #6c757d;
  margin-bottom: 4px;
}

/* Unit block — color per building (CSS var --unit-hue set inline) */
.mobile-roomlist-page .unit-group {
  --unit-hue: 210;
  margin-bottom: 4px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid hsl(var(--unit-hue), 35%, 82%);
  border-left-width: 4px;
  border-left-color: hsl(var(--unit-hue), 55%, 42%);
}

.mobile-roomlist-page .unit-group-header {
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 8px;
  background: hsl(var(--unit-hue), 45%, 90%);
  color: #1a1a1a;
}

.mobile-roomlist-page .unit-group-header__label {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  overflow: hidden;
}

.mobile-roomlist-page .unit-group-header__name {
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-roomlist-page .unit-group-header__count {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  color: hsl(var(--unit-hue), 45%, 32%);
  white-space: nowrap;
}

.mobile-roomlist-page .unit-group-header .chev::before {
  content: '▼';
  font-size: 0.65rem;
  color: hsl(var(--unit-hue), 40%, 35%);
}

.mobile-roomlist-page .unit-group-header.collapsed .chev::before {
  content: '▶';
}

.mobile-roomlist-page .unit-group-panel {
  padding: 2px 3px 3px;
  background: hsl(var(--unit-hue), 35%, 97%);
}

/* One compact row per room — horizontal layout */
.mobile-roomlist-page .room-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 3px 4px 3px 6px;
  margin-bottom: 2px;
  border-radius: 4px;
  background: hsl(var(--unit-hue), 30%, 99%);
  font-size: 0.8rem;
  line-height: 1.2;
}

.mobile-roomlist-page .room-row.is-vacant {
  opacity: 0.88;
}

.mobile-roomlist-page .room-row.is-ghost .room-row__name {
  color: #6d28d9;
}

.mobile-roomlist-page .room-row__room {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 2.4rem;
}

.mobile-roomlist-page .room-row__num {
  font-weight: 700;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  min-width: 1.1rem;
  text-align: right;
}

.mobile-studentdir-page .room-row__num--muted {
  color: #adb5bd;
  font-weight: 500;
}

.mobile-studentdir-page .room-row-detail__history {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid hsl(var(--unit-hue), 20%, 88%);
}

.mobile-studentdir-page .room-row-detail__history-title {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #495057;
}

.mobile-studentdir-page .room-row-detail__history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-studentdir-page .room-row-detail__history-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 4px 0;
  font-size: 0.72rem;
  border-bottom: 1px solid hsl(var(--unit-hue), 15%, 92%);
}

.mobile-studentdir-page .room-row-detail__history-item:last-child {
  border-bottom: none;
}

.mobile-studentdir-page .room-row-detail__history-item.is-current {
  font-weight: 600;
}

.mobile-studentdir-page .room-row-detail__history-period {
  color: hsl(var(--unit-hue), 50%, 32%);
}

.mobile-studentdir-page .room-row-detail__history-place {
  color: #212529;
}

.mobile-studentdir-page .room-row-detail__history-tag {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #198754;
}

.mobile-roomlist-page .room-row__status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mobile-roomlist-page .room-row__status--booked {
  background: #198754;
}

.mobile-roomlist-page .room-row__status--prelim {
  background: #0dcaf0;
}

.mobile-roomlist-page .room-row__status--pending {
  background: #ffc107;
}

.mobile-roomlist-page .room-row__status--vacant {
  background: #ced4da;
}

.mobile-roomlist-page .room-row__status--other {
  background: #adb5bd;
}

.mobile-roomlist-page .room-row__body {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.mobile-roomlist-page .room-row__name {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  font-size: 0.8rem;
}

.mobile-roomlist-page .room-row__name.is-vacant {
  font-weight: 500;
  color: #868e96;
  font-size: 0.75rem;
}

.mobile-roomlist-page .room-row__ghost {
  margin-right: 2px;
  font-size: 0.75rem;
}

.mobile-roomlist-page .room-row__actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
}

.mobile-roomlist-page .room-row-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid hsl(var(--unit-hue), 25%, 80%);
  background: #fff;
  color: #212529;
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}

.mobile-roomlist-page .room-row-icon-btn:active {
  background: hsl(var(--unit-hue), 40%, 92%);
}

.mobile-roomlist-page .room-entry {
  margin-bottom: 2px;
}

.mobile-roomlist-page .room-row--expandable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mobile-roomlist-page .room-row--expandable:active {
  background: hsl(var(--unit-hue), 35%, 94%);
}

.mobile-roomlist-page .room-row__chev {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.65rem;
  color: hsl(var(--unit-hue), 35%, 40%);
  vertical-align: middle;
}

.mobile-roomlist-page .room-row__chev::before {
  content: '▸';
}

.mobile-roomlist-page .room-row.is-expanded .room-row__chev::before {
  content: '▾';
}

.mobile-roomlist-page .room-row-detail {
  margin: 0 4px 4px 8px;
  padding: 6px 8px 8px;
  border-radius: 4px;
  background: #fff;
  border: 1px solid hsl(var(--unit-hue), 25%, 85%);
  font-size: 0.75rem;
}

.mobile-roomlist-page .room-row-detail__list {
  display: grid;
  grid-template-columns: minmax(5.5rem, 38%) 1fr;
  gap: 2px 8px;
  margin: 0;
}

.mobile-roomlist-page .room-row-detail__item {
  display: contents;
}

.mobile-roomlist-page .room-row-detail__item dt {
  margin: 0;
  font-weight: 600;
  color: #495057;
}

.mobile-roomlist-page .room-row-detail__item dd {
  margin: 0;
  color: #212529;
  word-break: break-word;
}

.mobile-roomlist-page .room-row-detail__links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid hsl(var(--unit-hue), 20%, 88%);
}

.mobile-roomlist-page .room-row-detail__link {
  font-size: 0.72rem;
  font-weight: 600;
  color: hsl(var(--unit-hue), 55%, 32%);
  text-decoration: none;
}

.mobile-roomlist-page .room-row-detail__link--btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.mobile-lang-switch-form {
  display: inline-flex;
  margin: 0;
}

.mobile-lang-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.mobile-lang-switch:active {
  background: #eef4ff;
}

.mobile-notif-wrap {
  position: relative;
  flex-shrink: 0;
}

.mobile-notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #212529;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.mobile-notif-bell:active,
.mobile-notif-bell[aria-expanded="true"] {
  background: #eef4ff;
}

.mobile-notif-badge {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #dc3545;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.mobile-notif-panel {
  position: fixed;
  top: var(--mobile-top-bar-height, 48px);
  left: 0;
  right: 0;
  max-height: min(70vh, calc(100vh - var(--mobile-top-bar-height, 48px) - 84px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border-bottom: 1px solid #dee2e6;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 1041;
}

.mobile-notif-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
  position: sticky;
  top: 0;
  z-index: 1;
}

.mobile-notif-panel__actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.mobile-notif-link {
  font-size: 0.78rem;
  white-space: nowrap;
}

.mobile-notif-list {
  min-height: 48px;
}

.mobile-notif-item {
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.mobile-notif-item.unread {
  background: #eaf3ff;
}

.mobile-notif-item__title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
}

.mobile-notif-item__body {
  font-size: 0.82rem;
  color: #555;
  margin-top: 4px;
  white-space: pre-line;
}

.mobile-notif-item__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: #777;
}

.mobile-notif-empty,
.mobile-notif-loading {
  padding: 20px 12px;
  text-align: center;
  color: #6c757d;
  font-size: 0.85rem;
}

.mobile-notif-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1039;
  background: rgba(0, 0, 0, 0.35);
}

body.mobile-notif-panel-open {
  overflow: hidden;
}
