/* VideoMix 授权中心 · 手机端 H5
   配色与前台一致（令牌同 app.css），只做窄屏布局，不影响电脑版。 */

:root {
  --m-primary: #1a1d21;
  --m-accent: #5b8def;
  --m-accent-deep: #4a7de0;
  --m-accent-soft: #e8f0fe;
  --m-bg: #f5f6fa;
  --m-card: #fff;
  --m-text: #1a1d21;
  --m-text-2: #6b7280;
  --m-text-3: #9ca3af;
  --m-line: rgba(0, 0, 0, .06);
  --m-danger: #f43f5e;
  --m-success: #16a34a;
  --m-warning: #d97706;
  --m-r-sm: 8px;
  --m-r-md: 12px;
  --m-r-lg: 16px;
  --m-shadow: 0 2px 12px rgba(0, 0, 0, .06);
  --m-shadow-lg: 0 12px 40px rgba(0, 0, 0, .16);
  --m-safe-top: env(safe-area-inset-top, 0px);
  --m-safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body { height: 100%; }
body.m-body {
  margin: 0;
  font-size: 15px;
  background: var(--m-bg);
  color: var(--m-text);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* ---------------------------------------------------------------- 登录 */
.m-login {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 22px calc(28px + var(--m-safe-bottom));
  background: linear-gradient(160deg, #e9f0ff 0%, #f6f9ff 55%, #eef3ff 100%);
  overflow: auto;
}
.m-login__logo {
  align-self: center;
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 14px;
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--m-accent-deep);
  background: rgba(91, 140, 255, .14);
  border: 1px solid rgba(91, 140, 255, .22);
  border-radius: 999px;
}
.m-login__title {
  margin: 0 0 6px;
  font-size: 30px;
  font-weight: 700;
  text-align: center;
  color: #1f4ed8;
}
.m-login__sub {
  margin: 0 0 26px;
  font-size: 13px;
  text-align: center;
  color: #7b88a8;
}
.m-login__card {
  padding: 22px 18px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(31, 78, 216, .12);
  backdrop-filter: blur(16px);
}
.m-login__hint {
  margin: 14px 0 0;
  font-size: 12px;
  text-align: center;
  color: #7b88a8;
}

/* ---------------------------------------------------------------- 骨架 */
.m-app {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-top: var(--m-safe-top);
}
.m-header {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 10px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--m-line);
  backdrop-filter: blur(12px);
}
.m-header__title {
  flex: 1;
  min-width: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}
.m-header__sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  color: var(--m-text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m-header__btn {
  flex: none;
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  color: var(--m-accent-deep);
  background: var(--m-accent-soft);
  border: 0;
  border-radius: 999px;
}
.m-header__btn:active { opacity: .7; }
.m-header__user {
  flex: none;
  max-width: 42%;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--m-accent-deep);
  background: var(--m-accent-soft);
  border-radius: 999px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.m-body {
  flex: 1;
  padding: 14px 14px calc(84px + var(--m-safe-bottom));
}

/* ------------------------------------------------------------ 底部导航 */
.m-tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 14;
  display: flex;
  padding-bottom: var(--m-safe-bottom);
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--m-line);
  backdrop-filter: blur(12px);
}
.m-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 2px 9px;
  font-size: 11px;
  color: var(--m-text-3);
  background: none;
  border: 0;
}
.m-tab__icon { font-size: 19px; line-height: 1; }
.m-tab.active { color: var(--m-accent-deep); font-weight: 600; }
.m-tab:active { opacity: .6; }

/* ------------------------------------------------------------ 统计卡片 */
.m-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.m-stat {
  padding: 14px 14px 12px;
  background: var(--m-card);
  border-radius: var(--m-r-lg);
  box-shadow: var(--m-shadow);
}
.m-stat__label { font-size: 12px; color: var(--m-text-2); }
.m-stat__value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
}
.m-stat__hint { margin-top: 4px; font-size: 11px; color: var(--m-text-3); }
.m-stat--blue .m-stat__value { color: var(--m-accent-deep); }
.m-stat--green .m-stat__value { color: var(--m-success); }
.m-stat--amber .m-stat__value { color: var(--m-warning); }
.m-stat--rose .m-stat__value { color: var(--m-danger); }

/* ---------------------------------------------------------------- 卡片 */
.m-section {
  margin-bottom: 14px;
  background: var(--m-card);
  border-radius: var(--m-r-lg);
  box-shadow: var(--m-shadow);
  overflow: hidden;
}
.m-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 13px 14px 10px;
  font-size: 14px;
  font-weight: 600;
}
.m-section__head small { font-size: 12px; font-weight: 400; color: var(--m-text-3); }
.m-section__body { padding: 0 14px 14px; }
.m-section__foot {
  padding: 11px 14px;
  font-size: 13px;
  text-align: center;
  color: var(--m-accent-deep);
  border-top: 1px solid var(--m-line);
}
.m-section__foot:active { background: #f7f9ff; }

/* ---------------------------------------------------------------- 列表 */
.m-list { display: flex; flex-direction: column; }
.m-item {
  padding: 13px 14px;
  border-top: 1px solid var(--m-line);
  background: var(--m-card);
}
.m-item:first-child { border-top: 0; }
.m-item:active { background: #f7f9ff; }
.m-item__top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.m-item__title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m-item__code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 15px;
  letter-spacing: .4px;
}
.m-item__meta {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--m-text-2);
}
.m-item__meta b { font-weight: 600; color: var(--m-text); }

/* 状态胶囊 */
.m-pill {
  flex: none;
  padding: 2px 9px;
  font-size: 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.m-pill--gray { color: #6b7280; background: #f1f2f5; }
.m-pill--blue { color: #2f5fd0; background: #e8f0fe; }
.m-pill--green { color: #147a3c; background: #e6f6ec; }
.m-pill--amber { color: #a55a04; background: #fdf1de; }
.m-pill--rose { color: #c02a45; background: #fdeaee; }

/* ------------------------------------------------------------ 搜索筛选 */
.m-search {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.m-search input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  font-size: 15px;
  color: var(--m-text);
  background: #fff;
  border: 1px solid var(--m-line);
  border-radius: 999px;
  outline: none;
}
.m-search input:focus { border-color: var(--m-accent); }
.m-search button {
  flex: none;
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
  color: #fff;
  background: var(--m-accent);
  border: 0;
  border-radius: 999px;
}

.m-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.m-chips::-webkit-scrollbar { display: none; }
.m-chip {
  flex: none;
  height: 30px;
  padding: 0 13px;
  font-size: 13px;
  color: var(--m-text-2);
  background: #fff;
  border: 1px solid var(--m-line);
  border-radius: 999px;
}
.m-chip.active {
  color: #fff;
  background: var(--m-accent);
  border-color: var(--m-accent);
}

/* ------------------------------------------------------------ 悬浮按钮 */
.m-fab {
  position: fixed;
  right: 16px;
  bottom: calc(74px + var(--m-safe-bottom));
  z-index: 13;
  height: 46px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #5b8def, #4a7de0);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(91, 141, 239, .4);
}
.m-fab:active { transform: scale(.97); }

/* ------------------------------------------------------------ 底部弹层 */
.m-sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  background: rgba(15, 20, 32, .42);
  animation: m-fade .16s ease-out;
}
@keyframes m-fade { from { opacity: 0; } to { opacity: 1; } }
.m-sheet {
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #f7f8fb;
  border-radius: 20px 20px 0 0;
  box-shadow: var(--m-shadow-lg);
  animation: m-rise .2s ease-out;
}
@keyframes m-rise { from { transform: translateY(24px); } to { transform: translateY(0); } }
.m-sheet__head {
  position: relative;
  flex: none;
  padding: 16px 52px 12px 18px;
  background: #fff;
  border-radius: 20px 20px 0 0;
  border-bottom: 1px solid var(--m-line);
}
.m-sheet__title { font-size: 16px; font-weight: 700; }
.m-sheet__sub { margin-top: 4px; font-size: 12px; color: var(--m-text-3); }
.m-sheet__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  font-size: 17px;
  color: var(--m-text-3);
  background: #f1f2f5;
  border: 0;
  border-radius: 50%;
}
.m-sheet__body {
  flex: 1;
  overflow: auto;
  padding: 14px;
  -webkit-overflow-scrolling: touch;
}
.m-sheet__foot {
  flex: none;
  display: flex;
  gap: 10px;
  padding: 12px 14px calc(12px + var(--m-safe-bottom));
  background: #fff;
  border-top: 1px solid var(--m-line);
}

.m-sheet__action {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 15px 14px;
  font-size: 15px;
  text-align: left;
  color: var(--m-text);
  background: #fff;
  border: 0;
  border-top: 1px solid var(--m-line);
}
.m-sheet__action:first-child { border-top: 0; }
.m-sheet__action:active { background: #f2f5fd; }
.m-sheet__action--danger { color: var(--m-danger); }
.m-sheet__action--primary { color: var(--m-accent-deep); font-weight: 600; }
.m-sheet__group {
  margin-bottom: 12px;
  background: #fff;
  border-radius: var(--m-r-md);
  overflow: hidden;
}

/* 键值表 */
.m-kv { display: flex; flex-direction: column; }
.m-kv > div {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  font-size: 13px;
  border-top: 1px solid var(--m-line);
}
.m-kv > div:first-child { border-top: 0; }
.m-kv dt { flex: none; width: 84px; color: var(--m-text-3); }
.m-kv dd { flex: 1; min-width: 0; margin: 0; word-break: break-all; }
.m-kv .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

/* 表单 */
.m-field { margin-bottom: 13px; }
.m-field > label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--m-text-2);
}
.m-field input, .m-field select, .m-field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  font-size: 15px;
  font-family: inherit;
  color: var(--m-text);
  background: #fff;
  border: 1px solid var(--m-line);
  border-radius: var(--m-r-md);
  outline: none;
}
.m-field input:focus, .m-field select:focus, .m-field textarea:focus { border-color: var(--m-accent); }
.m-field textarea { min-height: 76px; resize: vertical; }
.m-field__row { display: flex; gap: 10px; }
.m-field__row > .m-field { flex: 1; min-width: 0; }

.m-btn {
  flex: 1;
  height: 46px;
  font-size: 15px;
  font-weight: 600;
  color: var(--m-text);
  background: #f1f2f5;
  border: 0;
  border-radius: var(--m-r-md);
}
.m-btn--primary { color: #fff; background: var(--m-accent); }
.m-btn--danger { color: #fff; background: var(--m-danger); }
.m-btn--sm { flex: none; height: 34px; padding: 0 14px; font-size: 13px; }
.m-btn:disabled { opacity: .55; }
.m-btn:active:not(:disabled) { opacity: .85; }
.m-btn--block { width: 100%; }
.m-row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.m-row-actions a.m-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

/* 提示 */
.m-empty, .m-loading {
  padding: 34px 16px;
  font-size: 13px;
  text-align: center;
  color: var(--m-text-3);
}
.m-note {
  padding: 11px 13px;
  margin-bottom: 13px;
  font-size: 12px;
  line-height: 1.6;
  color: #7b6a3a;
  background: #fdf6e6;
  border: 1px solid #f6e3bb;
  border-radius: var(--m-r-md);
}

/* 让电脑版组件（toast / modal）在手机上别溢出 */
.toast-wrap { left: 12px; right: 12px; bottom: auto; top: calc(12px + var(--m-safe-top)); align-items: center; }
.toast { max-width: 100%; }

@media (min-width: 720px) {
  .m-body { max-width: 720px; margin: 0 auto; width: 100%; }
  .m-header { max-width: 720px; margin: 0 auto; width: 100%; }
  .m-tabs { max-width: 720px; margin: 0 auto; }
  .m-sheet { max-width: 560px; margin: 0 auto; border-radius: 20px 20px 0 0; }
}
