/**
 * 首页与子页共用样式：登录、六宫格、逻辑算法、后台物料与工序
 * 从 index.html 提取，供 index / logic / menu3 等页面引用
 */
:root {
  --mes-hover-blue: #1976d2;
  --md-sys-color-primary: #1976d2;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #bbdefb;
  --md-sys-color-on-primary-container: #0d47a1;
  --md-sys-color-surface: #fafafa;
  --md-sys-color-surface-dim: #f5f5f5;
  --md-sys-color-on-surface: #1c1b1f;
  --md-sys-color-on-surface-variant: #49454f;
  --md-sys-color-outline: #79747e;
  --md-sys-color-outline-variant: #e7e0ec;
  --md-sys-color-surface-container: #fafafa;
  --md-sys-color-surface-container-high: #f5f5f5;
  --md-elevation-1: 0 1px 2px rgba(0,0,0,0.08);
  --md-elevation-2: 0 2px 6px rgba(0,0,0,0.1);
  --md-elevation-3: 0 4px 12px rgba(0,0,0,0.12);
  --md-shape-corner: 12px;
  --md-shape-corner-sm: 8px;
}
[data-theme="dark"] {
  --md-sys-color-primary: #1976d2;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-surface: #1c1b1f;
  --md-sys-color-surface-dim: #141318;
  --md-sys-color-on-surface: #e6e1e5;
  --md-sys-color-on-surface-variant: #cac4d0;
  --md-sys-color-surface-container: #1c1b1f;
  --md-sys-color-surface-container-high: #141318;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow-x: hidden; overflow-y: auto; }
body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  transition: background 0.2s, color 0.2s;
}

/* ========== 1级 登录 ========== */
.view { display: none; width: 100%; min-height: 100vh; }
.view.active { display: block; }
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  border-radius: var(--md-shape-corner);
  padding: clamp(32px, 4vw, 48px);
  width: 100%;
  max-width: min(460px, 92vw);
  box-shadow: var(--md-elevation-3, 0 4px 12px rgba(0,0,0,0.15));
  border: 1px solid var(--md-sys-color-outline-variant);
}
.login-card h1 { color: var(--md-sys-color-on-surface); font-size: 24px; font-weight: 600; margin-bottom: 4px; }
.login-card .subtitle { color: var(--md-sys-color-on-surface-variant); font-size: 14px; margin-bottom: 28px; }
.login-card .field { margin-bottom: 20px; }
.login-card .field.field-row { display: flex; align-items: center; gap: 12px; }
.login-card .field.field-row label { flex: 0 0 56px; margin-bottom: 0; color: var(--md-sys-color-on-surface-variant); font-size: 13px; }
.login-card .field.field-row input { flex: 1; min-width: 0; }
.login-card .field label { display: block; color: var(--md-sys-color-on-surface-variant); font-size: 13px; margin-bottom: 6px; }
.login-card .field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-size: 14px;
}
/* 登录按钮：黑/白 + 悬停与 DOCK 一致（动效 + 蓝） */
.login-card .btn-login {
  width: 100%;
  padding: 14px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
  border: 1px solid var(--md-sys-color-outline-variant);
  transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1), background-color 0.18s, color 0.18s, border-color 0.18s;
  transform-origin: center bottom;
}
.login-card .btn-login,
.login-card .btn-login:focus,
.login-card .btn-login:focus-visible {
  background: #ffffff !important;
  color: #1c1b1f !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
}
[data-theme="light"] .login-card .btn-login,
[data-theme="light"] .login-card .btn-login:focus,
[data-theme="light"] .login-card .btn-login:focus-visible {
  background: #2b2930 !important;
  color: #e6e1e5 !important;
  border-color: rgba(0, 0, 0, 0.5) !important;
}
.login-card .btn-login:hover { transform: scale(1.08) translateY(-2px); background: var(--mes-hover-blue, #1976d2) !important; color: #fff !important; border-color: var(--mes-hover-blue, #1976d2) !important; filter: none; }
/* 修改密码链接：随系统主题黑/白，无下划线 */
.login-card .login-change-pwd-link,
.login-card .login-change-pwd-link:focus,
.login-card .login-change-pwd-link:visited { color: var(--md-sys-color-on-surface-variant) !important; text-decoration: none !important; font-size: 13px; }
.login-card .login-change-pwd-link:hover { color: var(--md-sys-color-on-surface) !important; }

/* ========== 2级 六宫格 + 主题/后台 ========== */
[data-theme="dark"] .menu2-wrap,
[data-theme="dark"] .login-wrap {
  background: var(--md-sys-color-surface) !important;
}
[data-theme="light"] .menu2-wrap,
[data-theme="light"] .login-wrap {
  background: var(--md-sys-color-surface) !important;
}
.menu2-wrap {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  padding: 28px 32px;
  padding-top: max(28px, env(safe-area-inset-top));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
/* 六宫格：顶部/底部与 DOCK 等距，垂直居中对齐 */
.menu2-wrap:has(.jelly-grid) {
  --vm: var(--six-grid-vertical-margin, clamp(20px, 3vw, 36px));
  padding-top: max(var(--vm), env(safe-area-inset-top));
  padding-bottom: calc(var(--algo-dock-height, 64px) + var(--vm));
  padding-left: 32px;
  padding-right: 32px;
  justify-content: center;
}
.global-footer-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.global-footer-nav .menu2-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}
.global-footer-nav .menu2-actions .theme-icons {
  display: flex;
  align-items: center;
  gap: 8px;
}
.field-remember { margin-bottom: 12px; }
.remember-wrap { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px 10px; border-radius: 8px; background: var(--md-sys-color-surface-container-high); border: 1px solid var(--md-sys-color-outline-variant); }
.remember-wrap:hover { filter: brightness(1.05); }
.remember-wrap input[type="checkbox"] { margin: 0; width: 16px; height: 16px; accent-color: var(--mes-hover-blue, #1976d2); cursor: pointer; flex-shrink: 0; }
.remember-text { color: var(--md-sys-color-on-surface-variant); font-size: 13px; }
.jelly-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, auto);
  gap: var(--six-grid-vertical-margin, clamp(20px, 3vw, 36px));
  max-width: min(1200px, 92vw);
  width: 100%;
  margin: 0 auto;
  flex: 0 0 auto;
  margin-top: auto;
  margin-bottom: auto;
  --jelly-icon-size: 64px;
  --jelly-text-size: 34px;
  --jelly-gap: 24px;
  --jelly-hover-scale: 1.08;
  --jelly-hover-shadow: 0 12px 40px rgba(0,0,0,0.45);
}
.jelly-btn {
  aspect-ratio: 1.2;
  border-radius: clamp(16px, 2vw, 24px);
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--jelly-gap, 24px);
  font-size: var(--jelly-text-size, 34px);
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.jelly-btn::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
  pointer-events: none;
}
.jelly-btn:hover {
  transform: scale(var(--jelly-hover-scale, 1.08));
  box-shadow: var(--jelly-hover-shadow, 0 12px 40px rgba(0,0,0,0.45));
}
.jelly-btn .icon, .logic-sub-btn .icon { display: inline-flex; align-items: center; justify-content: center; }
.jelly-btn .icon svg, .logic-sub-btn .icon svg {
  width: var(--jelly-icon-size, 64px);
  height: var(--jelly-icon-size, 64px);
  flex-shrink: 0;
  opacity: 0.95;
}
.jelly-btn.jb1 { background: linear-gradient(145deg, #2196f3, #1976d2); }
.jelly-btn.jb2 { background: linear-gradient(145deg, #9c27b0, #7b1fa2); }
.jelly-btn.jb3 { background: linear-gradient(145deg, #4caf50, #388e3c); }
.jelly-btn.jb4 { background: linear-gradient(145deg, #ff9800, #f57c00); }
.jelly-btn.jb5 { background: linear-gradient(145deg, #f44336, #d32f2f); }
.jelly-btn.jb6 { background: linear-gradient(145deg, #00acc1, #0097a7); }
.jelly-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(0.6);
}
.logic-header { margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.logic-header .logic-sub-back { margin-right: 12px; margin-bottom: 0; }
.logic-header .logic-sub-title { margin-bottom: 0; }
.logic-sub-wrap { max-width: min(1280px, 94vw); width: 100%; margin: 0 auto; padding: 28px 32px; box-sizing: border-box; }
.logic-sub-title { color: var(--mes-hover-blue, #1976d2); font-size: 18px; }
.logic-sub-back .ic-arrow, .menu3-back .ic-arrow { width: 18px; height: 18px; flex-shrink: 0; margin-right: 6px; }
.logic-sub-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px; }
.logic-sub-btn {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 24px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}
[data-theme="light"] .logic-sub-btn {
  background: #2b2930;
  color: #e6e1e5;
  border: 1px solid rgba(0,0,0,0.5);
}
[data-theme="dark"] .logic-sub-btn {
  background: #ffffff;
  color: #1c1b1f;
  border: 1px solid rgba(255,255,255,0.5);
}
.logic-sub-btn {
  transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1), background-color 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
  transform-origin: center bottom;
}
/* logic-sub-btn 悬停：与 DOCK 一致动效 + 蓝底白字（3级菜单） */
.logic-sub-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
  background: var(--mes-hover-blue, #1976d2) !important;
  color: #ffffff !important;
  border-color: var(--mes-hover-blue, #1976d2) !important;
}

/* ========== 3级 后台入口（物料/工序简表） ========== */
#view-menu3.view.active,
.page-logic-root {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--md-sys-color-surface);
}
.page-logic-root .menu2-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.page-logic-root .menu2-wrap:has(.logic-sub-wrap) {
  padding-bottom: calc(var(--algo-dock-height, 64px) + var(--six-grid-vertical-margin, 24px));
}
[data-theme="dark"] .page-logic-root { background: var(--md-sys-color-surface) !important; }
[data-theme="light"] .page-logic-root { background: var(--md-sys-color-surface) !important; }

.page-menu3-root { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.menu3-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--md-sys-color-surface);
  padding: 12px 16px;
  padding-bottom: max(16px, 64px);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}
.page-menu3-root .menu3-wrap { flex: 1; min-height: 0; }
.menu3-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
}
.menu3-header h1 { font-size: 18px; font-weight: 500; color: var(--md-sys-color-on-surface); }
.menu3-back { font-size: 13px; cursor: pointer; }
.menu3-content { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex: 1; min-height: 0; align-content: start; overflow-y: auto; }
.menu3-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
}
.menu3-section h2 { font-size: 13px; margin-bottom: 4px; color: var(--md-sys-color-on-surface-variant); font-weight: 500; flex-shrink: 0; }
.menu-design-form { margin-top: 8px; }
.menu-design-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.menu-design-row label { min-width: 140px; font-size: 13px; color: var(--md-sys-color-on-surface-variant); }
.menu-design-row input[type="number"] { width: 80px; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--md-sys-color-outline-variant); background: var(--md-sys-color-surface-container); color: var(--md-sys-color-on-surface); font-size: 13px; }
#md-save { margin-top: 8px; }
/* 图1 CSV 按钮：固定宽、左右居中 */
.menu3-csv-entry { display: flex; justify-content: center; width: 100%; }
.menu3-csv-entry .mes-btn { width: 100%; max-width: 280px; min-width: 0; display: inline-flex; justify-content: center; }
/* 图2 保存包装与运费：与 CSV 按钮同宽、左右居中 */
#m3-save-pack-freight { max-width: 280px; width: 100%; align-self: center; }
.menu3-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 6px;
  background: var(--md-sys-color-surface-container);
  display: flex;
  flex-direction: column;
}
.menu3-table-wrap .menu3-table { flex: 0 0 auto; }
.menu3-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.menu3-table th, .menu3-table td { padding: 4px 8px; text-align: left; border-bottom: 1px solid var(--md-sys-color-outline-variant); color: var(--md-sys-color-on-surface); line-height: 1.3; }
.menu3-table th { background: var(--md-sys-color-surface-container-high); font-weight: 500; color: var(--md-sys-color-on-surface-variant); white-space: nowrap; }
.menu3-table input.editable {
  width: 100%;
  max-width: 72px;
  padding: 3px 6px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 4px;
  font-size: 12px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
}
.menu3-table .save-hint { font-size: 10px; color: var(--md-sys-color-on-surface-variant); margin-left: 4px; }
/* 客户前缀预设·删除：与报价表详情列 参数/详情/调整 同尺寸 */
.menu3-qp-delete-btn { padding: 6px 14px !important; font-size: 12px !important; border-radius: 8px !important; min-width: 0; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.menu3-pack-input { width: 64px; padding: 4px 6px; font-size: 12px; border-radius: 6px; border: 1px solid var(--md-sys-color-outline-variant); background: var(--md-sys-color-surface); color: var(--md-sys-color-on-surface); }
.btn-entry-bom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}
.global-footer-nav .menu2-actions .btn-entry-bom { margin-top: 0; }
.btn-entry-bom:hover { filter: brightness(1.08); color: var(--md-sys-color-on-surface); }
.btn-entry-bom svg { width: 20px; height: 20px; flex-shrink: 0; }
.snackbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  padding: 14px 24px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: var(--md-elevation-3);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 10001;
}
.snackbar.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.snackbar.success { background: #2e7d32; color: #fff; }
.snackbar.error {
  background: #c62828;
  color: #fff;
  bottom: 88px;
  font-size: 15px;
  padding: 16px 24px;
  max-width: min(420px, 92vw);
  text-align: center;
  word-break: break-word;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
}
.modal-input { width: 100%; padding: 10px; border-radius: 6px; border: 1px solid var(--md-sys-color-outline-variant); background: var(--md-sys-color-surface); color: var(--md-sys-color-on-surface); box-sizing: border-box; }
.modal-actions-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* 占位页：部门功能开发中 */
.placeholder-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.placeholder-page h1 { font-size: 20px; margin-bottom: 12px; color: var(--md-sys-color-on-surface); }
.placeholder-page p { color: var(--md-sys-color-on-surface-variant); font-size: 14px; }
.placeholder-page .btn-back { margin-top: 20px; padding: 10px 20px; border-radius: 8px; background: var(--mes-hover-blue, #1976d2); color: #ffffff; text-decoration: none; font-size: 14px; }

/* ========== 窄屏适配 ========== */
@media (max-width: 768px) {
  .login-wrap { padding: 16px; }
  .login-card { padding: 24px 20px; max-width: 100%; }
  .login-card h1 { font-size: 20px; }
  .login-card .subtitle { font-size: 13px; margin-bottom: 20px; }
  .login-card .field { margin-bottom: 14px; }
  .login-card .field input { padding: 10px 12px; font-size: 16px; }
  .login-card .btn-login { padding: 12px; font-size: 14px; }
  .menu2-wrap { padding: 10px 14px; min-height: 100dvh; }
  .global-footer-nav { padding: 22px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .global-footer-nav .menu2-actions { gap: 6px; }
  .global-footer-nav .menu2-actions .theme-icons { gap: 6px; }
  .menu2-actions .theme-icon,
  .menu2-actions .btn-admin-entry,
  .menu2-actions .btn-entry-bom,
  .menu2-actions .btn-user-header,
  .menu2-actions .btn-logout-arrow,
  .menu2-actions .btn-create-account.btn-icon-only { width: 32px; height: 32px; min-width: 32px; min-height: 32px; }
  .menu2-actions .theme-icon svg,
  .menu2-actions .btn-admin-entry svg,
  .menu2-actions .btn-entry-bom svg,
  .menu2-actions .btn-create-account .icon svg,
  .menu2-actions .btn-logout-arrow svg { width: 16px; height: 16px; }
  .menu2-actions .btn-user-header { font-size: 16px; }
  .jelly-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: clamp(6px, 1.5vmin, 10px);
    max-width: 100%;
    padding-bottom: env(safe-area-inset-bottom, 8px);
    --jelly-icon-size: clamp(20px, 5vmin, 28px) !important;
    --jelly-text-size: clamp(11px, 2.8vmin, 15px) !important;
    --jelly-gap: 4px !important;
  }
  .jelly-btn {
    width: 100%; height: 100%; min-height: 0; aspect-ratio: unset;
    border-radius: 12px; font-weight: 600;
  }
  .menu3-wrap { padding: 10px 12px; }
  .menu3-header { margin-bottom: 8px; gap: 6px; }
  .menu3-header h1 { font-size: 16px; }
  .menu3-back { font-size: 12px; }
  .menu3-content { grid-template-columns: 1fr; gap: 10px; }
  .menu3-section h2 { font-size: 12px; }
  .menu3-table { font-size: 11px; }
  .menu3-table th, .menu3-table td { padding: 4px 6px; }
  .menu3-table input.editable { max-width: 56px; padding: 2px 4px; font-size: 11px; }
  .menu-design-row { gap: 8px; margin-bottom: 10px; }
  .menu-design-row label { min-width: 100px; font-size: 12px; }
  .menu-design-row input[type="number"] { width: 64px; padding: 4px 6px; font-size: 12px; }
  .logic-sub-wrap { padding: 16px 20px; }
  .logic-header { margin-bottom: 16px; gap: 8px; }
  .logic-sub-title { font-size: 16px; }
  .logic-sub-back { font-size: 13px; }
  .logic-sub-grid { grid-template-columns: 1fr; gap: 18px; }
  .logic-sub-btn { padding: 16px; font-size: 15px; gap: 12px; border-radius: 12px; }
  .logic-sub-btn .icon svg { width: 28px; height: 28px; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .menu2-wrap { padding: 6px 12px; min-height: 100dvh; height: 100dvh; overflow: hidden; }
  .global-footer-nav { padding: 22px 10px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .global-footer-nav .menu2-actions { gap: 6px; }
  .global-footer-nav .menu2-actions .theme-icons { gap: 6px; }
  .menu2-actions .theme-icon,
  .menu2-actions .btn-admin-entry,
  .menu2-actions .btn-entry-bom,
  .menu2-actions .btn-user-header,
  .menu2-actions .btn-logout-arrow,
  .menu2-actions .btn-create-account.btn-icon-only { width: 28px; height: 28px; min-width: 28px; min-height: 28px; }
  .menu2-actions .theme-icon svg,
  .menu2-actions .btn-admin-entry svg,
  .menu2-actions .btn-entry-bom svg,
  .menu2-actions .btn-create-account .icon svg,
  .menu2-actions .btn-logout-arrow svg { width: 14px; height: 14px; }
  .menu2-actions .btn-user-header { font-size: 14px; }
  .jelly-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: clamp(4px, 1vmin, 8px);
    max-width: 100%; padding-bottom: 4px;
    flex: 1 1 0; min-height: 0; align-content: stretch;
    --jelly-icon-size: clamp(20px, 5vmin, 28px) !important;
    --jelly-text-size: clamp(11px, 2.8vmin, 15px) !important;
    --jelly-gap: 2px !important;
  }
  .jelly-btn {
    width: 100%; height: 100%; min-height: 0; aspect-ratio: unset; border-radius: 10px;
  }
}
@media (max-width: 768px) and (orientation: landscape) {
  .menu2-wrap { padding: 6px 12px; min-height: 100dvh; height: 100dvh; overflow: hidden; }
  .global-footer-nav { padding: 22px 10px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .global-footer-nav .menu2-actions .theme-icons { gap: 6px; }
  .jelly-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: clamp(4px, 1vmin, 8px);
    flex: 1 1 0; min-height: 0; align-content: stretch;
    --jelly-icon-size: clamp(20px, 5vmin, 28px) !important;
    --jelly-text-size: clamp(11px, 2.8vmin, 15px) !important;
    --jelly-gap: 2px !important;
  }
  .jelly-btn { min-height: 0; aspect-ratio: unset; }
}
@media (max-width: 480px) {
  .login-wrap { padding: 12px; }
  .login-card { padding: 20px 16px; }
  .login-card h1 { font-size: 18px; }
  .login-card .field input { padding: 10px; font-size: 16px; }
  .menu2-wrap { padding: 8px 12px; }
  .global-footer-nav { padding: 22px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .jelly-grid {
    gap: clamp(5px, 1.2vmin, 8px);
    --jelly-icon-size: clamp(20px, 5vmin, 28px) !important;
    --jelly-text-size: clamp(11px, 2.8vmin, 15px) !important;
    --jelly-gap: 3px !important;
    padding-bottom: env(safe-area-inset-bottom, 6px);
  }
  .jelly-btn { border-radius: 10px; }
  .menu3-wrap { padding: 8px 10px; }
  .menu3-header h1 { font-size: 14px; }
  .menu3-table { font-size: 10px; }
  .menu3-table th, .menu3-table td { padding: 3px 4px; }
  .menu-design-row label { min-width: 0; }
  .menu-design-row input[type="number"] { width: 52px; }
  .logic-sub-wrap { padding: 12px 14px; }
  .logic-sub-title { font-size: 14px; }
  .logic-sub-grid { gap: 15px; }
  .logic-sub-btn { padding: 12px 14px; font-size: 14px; gap: 10px; }
  .logic-sub-btn .icon svg { width: 24px; height: 24px; }
}
