/* 蜻蜓队长 · 移动端专版样式（max-width: 860px）
   字重严格遵循普惠体 55 Regular / 65 Medium（500），禁止 600/700/800/bold */

html,
body {
  background: #f4f6f9;
  touch-action: pan-y;
  overscroll-behavior-x: none;
  overflow-x: clip;
  max-width: 100vw;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* 移动端表单输入统一采用 16px 字号，彻底阻断 iOS Safari 聚焦自动放大 */
input[type='text'],
input[type='url'],
input[type='email'],
input[type='password'],
input[type='search'],
input[type='number'],
select,
textarea {
  font-size: 16px;
  height: 44px;
  padding: 9px 12px;
  border-radius: 10px;
}

textarea {
  height: auto;
  min-height: 96px;
}

.select-wrap select {
  padding-right: 34px;
}

.select-chevron {
  right: 12px;
  width: 16px;
  height: 16px;
}

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

.sidebar,
.topbar {
  display: none !important;
}

/* 移动端毛玻璃吸顶顶栏 */
.mobile-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}

.mobile-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  flex-shrink: 0;
}

.mobile-brand-mark svg {
  width: 17px;
  height: 17px;
}

.mobile-brand-info {
  min-width: 0;
  flex: 1;
}

.mobile-brand-top {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
}

.mobile-brand-name {
  font-size: 15px;
  line-height: 1.25;
  color: var(--text-primary);
  white-space: nowrap;
}

.mobile-sep,
.mobile-view-name {
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.mobile-status-line {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
  font-size: 11px;
  line-height: 1.25;
  color: var(--text-muted);
}

#mobile-runner-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mobile-head-actions .button.small {
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 13px;
}

/* 移动端内容舞台与安全区留白 */
.stage {
  max-width: 100%;
  padding: 12px 12px calc(82px + env(safe-area-inset-bottom));
}

.view-note {
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* 二级胶囊切换（运行记录 / 系统设置） */
.mobile-sub-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  border-radius: 11px;
  background: #e8ecf2;
  margin-bottom: 12px;
}

.sub-tab {
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  cursor: pointer;
}

.sub-tab.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* 筛选栏：首行搜索+网站筛选，次行 4 等分分段筛选 */
.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 124px;
  gap: 8px;
  margin-bottom: 12px;
}

.search-wrap {
  grid-column: 1;
  min-width: 0;
}

.search-wrap input {
  height: 40px;
  padding-left: 34px;
  border-radius: 11px;
  background: var(--surface);
}

.search-ico {
  left: 11px;
}

.toolbar .select-wrap {
  grid-column: 2;
  min-width: 0;
}

.toolbar .select-wrap select {
  height: 40px;
  border-radius: 11px;
  padding: 0 28px 0 10px;
  background: var(--surface);
}

.segmented {
  grid-column: 1 / -1;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  height: 38px;
  padding: 3px;
  border-radius: 11px;
  background: #e8ecf2;
  gap: 2px;
}

.seg-btn {
  height: 32px;
  padding: 0 4px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
}

/* 监控订单：单层原生态卡片，消除套娃嵌套 */
.order-groups-stack {
  gap: 12px;
}

.order-group-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid #e7ebf0;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  overflow: visible;
}

.order-group-head {
  order: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 12px;
  background: var(--surface);
  border-bottom: 1px solid #f0f2f6;
  border-radius: 14px 14px 0 0;
}

.order-group-title {
  font-size: 15.5px;
  line-height: 1.35;
}

.order-group-meta {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.45;
}

.order-group-head .toggle-switch {
  width: 42px;
  height: 24px;
  margin-top: 1px;
}

.order-group-head .toggle-switch::after {
  width: 20px;
  height: 20px;
}

.order-group-head .toggle-switch:checked::after {
  transform: translateX(18px);
}

/* 订单内商品流（直接作为卡片内部分割行，不套外框） */
.order-group-card .monitor-list {
  order: 2;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.monitor-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 8px 11px;
  align-items: start;
  padding: 13px 14px;
  border-bottom: 1px solid #f1f3f7;
  border-radius: 0;
  background: transparent;
}

.monitor-row:first-child {
  border-radius: 0;
}

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

.monitor-row:hover {
  background: transparent;
}

.row-thumb-wrap {
  width: 56px;
  height: 56px;
  border-radius: 10px;
}

.row-title {
  font-size: 14.5px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.row-meta {
  margin-top: 4px;
}

.row-detail {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.4;
  margin-top: 4px;
}

.row-status-col {
  align-items: flex-end;
  gap: 5px;
}

.row-price {
  font-size: 14px;
}

.row-live-col {
  grid-column: 1 / -1;
  padding: 8px 10px;
  border-radius: 9px;
  background: #f7f9fc;
  border: 1px solid #edf0f5;
  gap: 6px;
}

.row-actions-col {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 7px;
  padding-top: 2px;
}

.row-actions-col .toggle-switch {
  margin-right: auto;
}

.row-actions-col .icon-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
}

.row-actions-col .icon-btn.dots {
  width: 34px;
  padding: 0;
}

.row-menu {
  min-width: 168px;
  width: max-content;
  max-width: min(260px, calc(100vw - 32px));
  padding: 5px;
  border-radius: 12px;
  z-index: 45;
}

.menu-item {
  min-height: 40px;
  height: auto;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.35;
  white-space: nowrap;
}

/* 订单提示栏与底部操作区 */
.order-group-foot {
  order: 3;
  padding: 9px 14px;
  font-size: 12px;
  line-height: 1.45;
  border-top: 1px solid #f0f2f6;
  border-radius: 0;
  background: #fafbfd;
}

.order-group-actions {
  order: 4;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 12px 12px;
  background: #fafbfd;
  border-top: 1px solid #f0f2f6;
  border-radius: 0 0 14px 14px;
}

.order-group-actions .icon-btn:not(.dots) {
  flex: 1 1 calc(50% - 26px);
  min-width: 84px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 13px;
}

.order-group-actions .icon-btn.dots {
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

/* 其他页面卡片、表单与按钮网格化 */
.panel {
  border-radius: 14px;
  padding: 14px;
  border: 1px solid #e7ebf0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.callout {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  line-height: 1.5;
}

.callout .button {
  width: 100%;
  height: 38px;
  border-radius: 9px;
}

.card-grid,
.form-grid,
.form-grid.three {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

#account-list .account-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
}

#account-list .account-actions .button {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 13.5px;
}

#account-list .account-actions .menu-wrap {
  flex-shrink: 0;
  margin-left: 0;
}

#account-list .account-actions .icon-btn.dots {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

#order-list .account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
}

#order-list .account-actions a.button.primary {
  flex: 1 1 100%;
  height: 40px;
  border-radius: 10px;
  font-size: 14px;
}

#order-list .account-actions .text-button {
  flex: 1;
  justify-content: center;
  height: 36px;
  border-radius: 9px;
  background: #f4f6fa;
  border: 1px solid #eaedf3;
}

#store-list .account-actions .text-button {
  width: 100%;
  justify-content: center;
  height: 38px;
  border-radius: 9px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
}

.form-foot .button.primary {
  width: 100%;
  height: 44px;
  border-radius: 11px;
  font-size: 15px;
}

.run-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 11px 0;
}

.run-msg {
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
}

.run-time {
  font-size: 11.5px;
}

#setup-card code,
.path-box code {
  word-break: break-all;
  overflow-wrap: anywhere;
}

.notify-toggles {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.notify-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.notify-actions .button {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  font-size: 14px;
}

.path-box {
  flex-direction: column;
  align-items: stretch;
}

/* 移动端毛玻璃底部固定 TabBar */
.mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.mnav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 48px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  border-radius: 10px;
}

.mnav-item svg {
  width: 21px;
  height: 21px;
}

.mnav-item.active {
  color: var(--primary);
  background: transparent;
}

.mnav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  width: 20px;
  height: 2.5px;
  border-radius: 999px;
  background: var(--primary);
}

.mnav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 21px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-family: var(--font-medium);
  font-weight: 500;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px #ffffff;
}

/* 移动端底部滑入弹窗 + 登录弹窗居中展示 */
dialog.sheet-dialog,
dialog.sheet-dialog.wide,
dialog.drawer-dialog {
  position: fixed;
  inset: auto 0 0 0;
  margin: 0;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 92dvh;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.16);
  animation: mobileSheetUp 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.dialog-head {
  position: relative;
  padding: 20px 16px 12px;
}

.dialog-head::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: #d5dce6;
}

#login-dialog.center-mobile {
  inset: 0;
  margin: auto;
  width: calc(100vw - 32px);
  max-width: 380px;
  max-height: 82dvh;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-modal);
  animation: none;
}

#login-dialog.center-mobile .dialog-head {
  padding: 16px 18px 12px;
}

#login-dialog.center-mobile .dialog-head::before {
  display: none;
}

.close-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #f1f4f8;
  font-size: 14px;
}

.dialog-body {
  padding: 14px 16px 18px;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.stepper {
  border-radius: 10px;
}

.stepper-btn {
  width: 44px;
  height: 42px;
  font-size: 18px;
}

.stepper input[type='number'] {
  height: 42px;
  font-size: 16px;
}

.interval-presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.interval-chip {
  height: 40px;
  padding: 0 6px;
  border-radius: 9px;
  font-size: 13.5px;
}

.interval-input {
  width: 100% !important;
  height: 40px !important;
  border-radius: 9px;
  font-size: 16px;
}

.variant-grid {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  max-height: 240px;
}

.variant-chip {
  padding: 9px 10px;
  border-radius: 10px;
}

.input-with-btn {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

#inspect-url-btn {
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 14px;
}

.inline-add-bar {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f5f7fb;
  border: 1px dashed #d6dde8;
}

#add-draft-item-btn {
  width: 100%;
  height: 40px;
  border-radius: 9px;
  font-size: 14px;
}

.dialog-actions {
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  gap: 10px;
}

.dialog-actions .button {
  flex: 1;
  height: 44px;
  border-radius: 11px;
  font-size: 15px;
}

.drawer-actions {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
}

.drawer-actions-left {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.drawer-actions-left:empty {
  display: none;
}

.drawer-actions-left .button {
  height: 38px;
  border-radius: 9px;
  font-size: 13.5px;
}

.drawer-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.drawer-actions-right .button {
  flex: 1;
  height: 44px;
  border-radius: 11px;
  font-size: 15px;
}

.drawer-actions-right .text-button.danger {
  height: 44px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--danger-soft);
  flex-shrink: 0;
}

.toast {
  bottom: calc(74px + env(safe-area-inset-bottom));
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  text-align: center;
}

@keyframes mobileSheetUp {
  from {
    transform: translateY(28px);
    opacity: 0.72;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog.sheet-dialog,
  dialog.sheet-dialog.wide,
  dialog.drawer-dialog {
    animation: none !important;
  }
}
