/* 移动端专属样式 - 参考代课系统 mobile.css 极简扁平风格 */
:root {
  --m-primary: #2563eb;
  --m-primary-hover: #1d4ed8;
  --m-success: #16a34a;
  --m-warning: #f59e0b;
  --m-danger: #dc2626;
  --m-bg: #f8fafc;
  --m-card-bg: #ffffff;
  --m-border: #e2e8f0;
  --m-text-main: #0f172a;
  --m-text-muted: #64748b;
  --m-text-light: #94a3b8;
}

body.mobile-page {
  display: block;
  margin: 0;
  padding: 0;
  background-color: var(--m-bg);
  color: var(--m-text-main);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* 手机保留触屏滚动，隐藏装饰性滚动条 */
body.mobile-page .m-tabs,
body.mobile-page .m-child-pills,
body.mobile-page .m-drawer-body,
body.mobile-page .m-scroll-hide {
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

body.mobile-page .m-tabs::-webkit-scrollbar,
body.mobile-page .m-child-pills::-webkit-scrollbar,
body.mobile-page .m-drawer-body::-webkit-scrollbar,
body.mobile-page .m-scroll-hide::-webkit-scrollbar {
  display: none;
}

body.mobile-page.m-drawer-open {
  overflow: hidden;
}

.mobile-page #toast-container {
  top: calc(12px + env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  align-items: center;
}

.mobile-page .toast {
  min-width: 0;
  max-width: 100%;
  width: max-content;
  overflow-wrap: anywhere;
}

/* 顶部账号和身份 */
.m-header-hero {
  background-color: #2563eb;
  color: #ffffff;
  padding: calc(16px + env(safe-area-inset-top)) 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.m-hero-user {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.m-hero-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: #ffffff;
  color: #2563eb;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.m-hero-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.m-hero-name {
  font-size: 16.5px;
  font-weight: 600;
}

.m-hero-organization {
  font-size: 13px;
  color: #eff6ff;
}

.m-role-switch {
  flex-shrink: 0;
  color: #fff;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.m-role-switch:disabled {
  color: #cbd5e1;
  opacity: 0.5;
  cursor: default;
}

.m-role-switch:hover:enabled {
  background: rgba(255, 255, 255, 0.12);
}

.m-role-switch:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* 移动端主容器 */
.m-container {
  padding: 0 12px 32px;
  margin-top: -18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.m-card {
  background-color: var(--m-card-bg);
  border: 1px solid var(--m-border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: none !important;
}

.mobile-page .dean-table th,
.mobile-page .dean-table td {
  padding-inline: 6px;
}

@media (max-width: 375px) {
  .mobile-page .dean-table th,
  .mobile-page .dean-table td {
    padding-inline: 2px;
    font-size: 12px;
  }
}

.mobile-page #plan-import-form .form-row {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.mobile-page #plan-import-form input[type="datetime-local"] {
  display: block;
  min-width: 0;
  max-width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

.mobile-page #plan-import-form input[type="datetime-local"]::-webkit-date-and-time-value {
  min-width: 0;
  text-align: left;
}

.mobile-page .stats-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.mobile-page .stats-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px 94px;
  gap: 6px;
}

.mobile-page .stats-filters .form-control {
  min-width: 0;
  height: 40px;
  padding: 0 6px;
  font-size: 13px;
}

.mobile-page .stats-filters input[type="search"] {
  font-size: 16px;
}

.mobile-page .stats-filters input[type="search"]::placeholder {
  font-size: 13px;
}

.mobile-page .stats-toolbar .batch-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 6px;
  margin-inline-start: 0;
}

.mobile-page .stats-toolbar .batch-actions .btn {
  min-width: 0;
  min-height: 40px;
  padding: 6px 2px;
  font-size: 13px;
  white-space: nowrap;
}

.stats-mobile-sort {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 12px;
}

.stats-mobile-sort .form-label {
  flex-shrink: 0;
  margin-bottom: 0;
}

.stats-mobile-sort .form-control {
  width: auto;
  min-width: 0;
  padding: 6px 8px;
}

.stats-mobile-sort .btn {
  flex-shrink: 0;
  padding: 6px 9px;
}

.mobile-page .upload-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  justify-content: safe center;
}

.mobile-page .upload-actions .btn {
  min-width: 0;
  white-space: normal;
  text-align: center;
}

.m-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.m-card-title {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--m-text-main);
  margin: 0;
}

/* 孩子横向胶囊切换 */
.m-child-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.m-child-pill {
  flex-shrink: 0;
  border: 1px solid var(--m-border);
  background: #f8fafc;
  color: var(--m-text-main);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.m-child-pill.active {
  background: #eff6ff;
  border-color: #2563eb;
  color: #2563eb;
  font-weight: 600;
}

.m-child-pill small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--m-text-muted);
  margin-top: 2px;
}

.m-child-pill.active small {
  color: #1d4ed8;
}

/* 筛选胶囊选项卡 */
.m-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 12px;
  padding-bottom: 2px;
}

.m-tab-btn {
  padding: 5px 12px;
  border-radius: 16px;
  border: 1px solid var(--m-border);
  background-color: #f8fafc;
  color: var(--m-text-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.m-tab-btn.active {
  background-color: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

/* 移动端课程/记录卡片 */
.m-record-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.m-record-card {
  border: 1px solid var(--m-border);
  border-radius: 10px;
  background-color: #ffffff;
  padding: 13px;
}

.m-record-card.selected {
  border-color: #3b82f6;
  background-color: #f8fbff;
}

.m-record-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 9px;
  border-bottom: 1px dashed var(--m-border);
  margin-bottom: 9px;
}

.m-record-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--m-text-main);
  line-height: 1.35;
}

.m-status-pill {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.m-status-pill.ok {
  background-color: #dcfce7;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.m-status-pill.low {
  background-color: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.m-status-pill.full {
  background-color: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.m-status-pill.selected {
  background-color: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.m-record-details {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  line-height: 1.45;
}

.m-detail-row {
  display: flex;
  align-items: flex-start;
}

.m-detail-label {
  color: var(--m-text-muted);
  width: 70px;
  flex-shrink: 0;
}

.m-detail-val {
  color: var(--m-text-main);
  flex: 1;
  overflow-wrap: anywhere;
}

.m-record-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

/* 移动端底部切换 */
.m-footer {
  text-align: center;
  padding: 14px 0 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--m-text-light);
}

.m-footer-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  background: #ffffff;
  border: 1px solid var(--m-border);
  padding: 7px 16px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12.5px;
}

/* 移动端抽屉/弹层 */
.mobile-page dialog.adjustment-picker {
  position: fixed;
  inset: auto 0 0;
  margin: 0 auto;
  width: 100%;
  max-width: none;
  border-radius: 16px 16px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-page .adjustment-picker-options button {
  min-height: 46px;
}

.mobile-page .adjustment-picker-search input {
  font-size: 16px;
}

.m-drawer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.5);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.m-drawer-overlay.show {
  opacity: 1;
  visibility: visible;
}

.m-drawer-panel {
  background-color: #ffffff;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  max-height: 88vh;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  border-top: 1px solid var(--m-border);
}

.m-drawer-overlay.show .m-drawer-panel {
  transform: translateY(0);
}

.m-drawer-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--m-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.m-drawer-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--m-text-main);
}

.m-drawer-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--m-text-light);
  cursor: pointer;
  line-height: 1;
}

.m-drawer-body {
  min-height: 0;
  overscroll-behavior: contain;
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.m-drawer-footer {
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--m-border);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  background-color: #ffffff;
}

