:root {
  --bg: #f0f4f8;
  --bg-panel: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #0d9488;
  --primary-soft: #ccfbf1;
  --accent: #ea580c;
  --danger: #dc2626;
  --border: #e2e8f0;
  --sidebar: #ffffff;
  --sidebar-2: #f8fafc;
  --sidebar-text: #475569;
  --sidebar-muted: #94a3b8;
  --tab-bg: #eef2f6;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --radius: 12px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Shell: sidebar + tabs ===== */
.shell-body { overflow: hidden; background: var(--bg); }
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  background: var(--bg);
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  color: var(--sidebar-text);
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 12px rgba(15, 23, 42, 0.04);
}

.brand {
  display: flex;
  align-items: flex-start;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.brand-text {
  min-width: 0;
  width: 100%;
}
.brand-text strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.2px;
}
.brand-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.brand-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.3px;
}
.brand-tag-client {
  color: #0f766e;
  background: #ccfbf1;
  border: 1px solid #99f6e4;
}
.brand-tag-admin {
  color: #9a3412;
  background: #ffedd5;
  border: 1px solid #fed7aa;
}

.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow: auto; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--sidebar-text);
  text-align: left;
  padding: 11px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: background .18s ease, color .18s ease;
}
.nav-group-toggle:hover {
  background: #f1f5f9;
  color: var(--text);
}
.nav-group-title { flex: 1; }
.nav-caret {
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.55;
  transition: transform .18s ease;
  margin-right: 2px;
}
.nav-group.open .nav-caret { transform: rotate(45deg); }
.nav-sub {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 0 0 4px 0;
}
.nav-group.open .nav-sub { display: flex; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--sidebar-text);
  text-align: left;
  padding: 11px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: background .18s ease, color .18s ease;
}
.nav-sub-item {
  padding-left: 28px;
  font-size: 13px;
}
.nav-item:hover {
  background: #f1f5f9;
  color: var(--text);
}
.nav-item.active {
  background: var(--primary-soft);
  color: #0f766e;
  box-shadow: inset 3px 0 0 var(--primary);
  font-weight: 600;
}
.nav-ico {
  width: 18px;
  height: 18px;
  opacity: 0.9;
  background: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}
.nav-ico-grid {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 3h8v8H3V3zm10 0h8v8h-8V3zM3 13h8v8H3v-8zm10 0h8v8h-8v-8z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 3h8v8H3V3zm10 0h8v8h-8V3zM3 13h8v8H3v-8zm10 0h8v8h-8v-8z'/%3E%3C/svg%3E");
}
.nav-ico-users {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16 11a4 4 0 1 0-4-4 4 4 0 0 0 4 4zM8 12a4 4 0 1 0-4-4 4 4 0 0 0 4 4zm8 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4zM8 14c-.29 0-.62.02-.97.05C4.98 14.4 2 15.54 2 18v2h6v-2c0-1.1.45-2.07 1.21-2.84C8.8 14.05 8.41 14 8 14z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16 11a4 4 0 1 0-4-4 4 4 0 0 0 4 4zM8 12a4 4 0 1 0-4-4 4 4 0 0 0 4 4zm8 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4zM8 14c-.29 0-.62.02-.97.05C4.98 14.4 2 15.54 2 18v2h6v-2c0-1.1.45-2.07 1.21-2.84C8.8 14.05 8.41 14 8 14z'/%3E%3C/svg%3E");
}
.nav-ico-box {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M21 16.5V7.5L12 2 3 7.5v9L12 22l9-5.5zM12 4.3l6.5 3.7L12 11.7 5.5 8 12 4.3zM5 9.7l6 3.4v6.7l-6-3.5V9.7zm8 10.1v-6.7l6-3.4v6.6l-6 3.5z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M21 16.5V7.5L12 2 3 7.5v9L12 22l9-5.5zM12 4.3l6.5 3.7L12 11.7 5.5 8 12 4.3zM5 9.7l6 3.4v6.7l-6-3.5V9.7zm8 10.1v-6.7l6-3.4v6.6l-6 3.5z'/%3E%3C/svg%3E");
}
.nav-ico-rocket {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M13.13 11.87l-1.5 1.5a3 3 0 0 1-1.06.7L7 15l.93-3.57a3 3 0 0 1 .7-1.06l1.5-1.5 2.999 3zm6.54-7.54a8.5 8.5 0 0 0-7.78 2.25l-1.42 1.42-1.06-.35a1 1 0 0 0-1.05.24L5.2 9.05a1 1 0 0 0-.1 1.3l1.8 2.4-2.12 2.12 1.41 1.41 2.12-2.12 2.4 1.8a1 1 0 0 0 1.3-.1l1.16-1.16a1 1 0 0 0 .24-1.05l-.35-1.06 1.42-1.42a8.5 8.5 0 0 0 2.25-7.78z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M13.13 11.87l-1.5 1.5a3 3 0 0 1-1.06.7L7 15l.93-3.57a3 3 0 0 1 .7-1.06l1.5-1.5 2.999 3zm6.54-7.54a8.5 8.5 0 0 0-7.78 2.25l-1.42 1.42-1.06-.35a1 1 0 0 0-1.05.24L5.2 9.05a1 1 0 0 0-.1 1.3l1.8 2.4-2.12 2.12 1.41 1.41 2.12-2.12 2.4 1.8a1 1 0 0 0 1.3-.1l1.16-1.16a1 1 0 0 0 .24-1.05l-.35-1.06 1.42-1.42a8.5 8.5 0 0 0 2.25-7.78z'/%3E%3C/svg%3E");
}
.nav-ico-key {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12.65 10A5.99 5.99 0 0 0 7 4a6 6 0 0 0 0 12c1.33 0 2.55-.43 3.54-1.16l.11-.08 5.35 5.35 1.41-1.41-1.06-1.06 1.06-1.06-1.42-1.41 1.42-1.42L16 11.17l-3.24-3.24.04-.12c.1-.28.15-.58.15-.89 0-.17-.01-.34-.04-.5zM7 14a4 4 0 1 1 0-8 4 4 0 0 1 0 8z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12.65 10A5.99 5.99 0 0 0 7 4a6 6 0 0 0 0 12c1.33 0 2.55-.43 3.54-1.16l.11-.08 5.35 5.35 1.41-1.41-1.06-1.06 1.06-1.06-1.42-1.41 1.42-1.42L16 11.17l-3.24-3.24.04-.12c.1-.28.15-.58.15-.89 0-.17-.01-.34-.04-.5zM7 14a4 4 0 1 1 0-8 4 4 0 0 1 0 8z'/%3E%3C/svg%3E");
}
.nav-ico-chart {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 3h2v18H3V3zm16 8h2v10h-2V11zM11 7h2v14h-2V7zm-4 6h2v8H7v-8zm8-4h2v12h-2V9z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 3h2v18H3V3zm16 8h2v10h-2V11zM11 7h2v14h-2V7zm-4 6h2v8H7v-8zm8-4h2v12h-2V9z'/%3E%3C/svg%3E");
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  padding: 4px 2px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: #0f766e;
  font-weight: 700;
}
.user-name { color: var(--text); font-size: 13px; font-weight: 600; }
.user-role { color: var(--sidebar-muted); font-size: 12px; }
.btn-logout {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--sidebar-text);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
}
.btn-logout:hover { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--bg);
  box-shadow: none;
}

.tabs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 12px 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.tabs-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  padding-bottom: 8px;
  scrollbar-width: thin;
}
.tab-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 200px;
  padding: 8px 10px 8px 14px;
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  transition: all .15s ease;
}
.tab-item:hover { background: rgba(255,255,255,0.65); color: var(--text); }
.tab-item.active {
  background: var(--bg-panel);
  color: var(--text);
  border-color: var(--border);
  border-bottom-color: var(--bg-panel);
  box-shadow: 0 -2px 0 var(--primary) inset;
  font-weight: 600;
}
.tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.tab-close {
  border: 0;
  background: transparent;
  color: #94a3b8;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.tab-close:hover { background: #fee2e2; color: #b91c1c; }
.tabs-actions { display: flex; gap: 4px; padding-bottom: 8px; }
.tab-tool {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
.tab-tool:hover { color: var(--primary); border-color: #9ad5cc; }

.tab-panels {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--bg-panel);
}
.tab-panel {
  display: none;
  position: absolute;
  inset: 0;
}
.tab-panel.active { display: block; }
.tab-panel iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg-panel);
}
.tab-empty {
  display: none;
  height: 100%;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
}

/* ===== Panel (iframe content) ===== */
.panel-body { background: var(--bg-panel); min-height: 100%; }
.panel { padding: 18px 22px 28px; }
.panel-header h1 {
  margin: 0 0 16px;
  font-size: 20px;
  letter-spacing: 0.2px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset;
}
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stats-6 { grid-template-columns: repeat(6, 1fr); }
.stats-4 { grid-template-columns: repeat(4, 1fr); }
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary-soft);
}
.stat .num { font-size: 28px; font-weight: 750; position: relative; }
.stat .label { color: var(--muted); font-size: 13px; margin-top: 4px; position: relative; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: #fafbfc; }

.btn {
  display: inline-block;
  border: none;
  border-radius: 9px;
  padding: 8px 14px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  box-shadow: 0 6px 14px rgba(15, 122, 108, 0.22);
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn-sm { padding: 5px 10px; font-size: 12px; box-shadow: none; }
.btn-secondary { background: #475569; box-shadow: none; }
.btn-danger { background: var(--danger); box-shadow: none; }
.btn-outline {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.toolbar input, .toolbar select,
.form-grid input, .form-grid select, .form-grid textarea,
.takeaway-ch input, .takeaway-ch select {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 14px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.toolbar input:focus, .toolbar select:focus,
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus,
.takeaway-ch input:focus, .takeaway-ch select:focus {
  outline: none;
  border-color: #5eead4;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}
.form-grid input[readonly]:focus,
.form-grid textarea[readonly]:focus {
  border-color: var(--border);
  box-shadow: none;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.alert { padding: 10px 12px; border-radius: 9px; margin-bottom: 12px; }
.alert-ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert-err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background:
    radial-gradient(1200px 600px at 0% 0%, rgba(20, 184, 166, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 100%, rgba(251, 191, 36, 0.1), transparent 50%),
    linear-gradient(160deg, #f8fafc 0%, #eef2f7 45%, #e8f4f3 100%);
}
.login-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(920px, 100%);
  min-height: 520px;
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.1);
  overflow: hidden;
}
.login-aside {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 40px;
  background:
    linear-gradient(145deg, #f0fdfa 0%, #ecfeff 40%, #fff 100%);
  border-right: 1px solid var(--border);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
.login-brand strong {
  display: block;
  font-size: 22px;
  color: var(--text);
  letter-spacing: 0.3px;
}
.login-brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}
.login-tagline {
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--sidebar-text);
}
.login-tips {
  margin: 0;
  padding: 0;
  list-style: none;
}
.login-tips li {
  position: relative;
  padding: 10px 0 10px 22px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  border-top: 1px solid rgba(226, 232, 240, 0.8);
}
.login-tips li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 17px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.65;
}
.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 44px;
  background: #fff;
}
.login-card h2 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}
.login-card .login-sub {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.login-card .field { margin-bottom: 16px; }
.login-card .field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sidebar-text);
}
.login-card input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: #f8fafc;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.login-card input:focus {
  outline: none;
  border-color: #5eead4;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}
.login-card .btn-login {
  width: 100%;
  margin-top: 8px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
}
.login-foot {
  margin: 20px 0 0;
  font-size: 12px;
  color: var(--sidebar-muted);
  text-align: center;
  line-height: 1.6;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #e2e8f0;
}
.badge-on { background: #dcfce7; color: #166534; }
.badge-off { background: #fee2e2; color: #991b1b; }
/* 勿对 td 设 display:flex，会破坏表格行分隔线对齐 */
.actions > * { margin-right: 6px; vertical-align: middle; }
.actions > *:last-child { margin-right: 0; }
.actions-inline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  max-width: 100%;
}
.cd-md5 {
  font-size: 12px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cd-ops {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.cd-ops-upload {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  min-width: 0;
}
.cd-ops-upload input[type="file"] {
  width: 170px;
  max-width: 170px;
}
.cd-ops-clear {
  margin: 0;
  flex-shrink: 0;
}
.card > table tbody tr:last-child > th,
.card > table tbody tr:last-child > td {
  border-bottom: none;
}
.pager {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.pager a, .pager span.page-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  margin-left: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
}
.pager a:hover { border-color: #99f6e4; color: var(--primary); }
.pager span.page-num.current {
  background: var(--primary-soft);
  border-color: #99f6e4;
  color: #0f766e;
  font-weight: 600;
}
.pager .pager-info { margin-right: auto; }
.muted { color: var(--muted); font-size: 13px; }
.img-preview {
  width: 96px;
  height: 96px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #f1f5f9;
  display: block;
}
.thumb-empty {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  color: #cbd5e1;
  font-size: 12px;
  display: grid;
  place-items: center;
}
.table-dense { font-size: 13px; white-space: nowrap; }
.table-dense th, .table-dense td { padding: 8px 10px; }
.nowrap { white-space: nowrap; }
.takeaway-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}
.takeaway-ch {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
}
.takeaway-ch-title {
  font-weight: 700;
  margin-bottom: 8px;
}
.takeaway-ch label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
.takeaway-ch input { width: 100%; }

/* ===== Modal（弹窗）===== */
.amodal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
  animation: amodal-fade .15s ease;
}
@keyframes amodal-fade { from { opacity: 0; } to { opacity: 1; } }
.amodal {
  display: flex;
  flex-direction: column;
  width: 640px;
  max-width: 94vw;
  max-height: 90vh;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  overflow: hidden;
  animation: amodal-pop .16s ease;
}
@keyframes amodal-pop { from { transform: translateY(8px) scale(.985); opacity: .6; } to { transform: none; opacity: 1; } }
.amodal-sm { width: 480px; }
.amodal-md { width: 640px; }
.amodal-lg { width: 880px; }
.amodal-xl { width: 1080px; }
.amodal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  flex-shrink: 0;
}
.amodal-title { font-size: 16px; font-weight: 700; color: var(--text); }
.amodal-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.amodal-close:hover { background: #fee2e2; color: #b91c1c; }
.amodal-body { flex: 1; min-height: 0; overflow: auto; padding: 18px; }
.amodal-body.is-iframe { overflow: hidden; padding: 0; }
.amodal-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--bg-panel);
}
/* iframe 模态给对话框确定高度，保证内部滚动 */
.amodal.is-iframe { height: 76vh; }
.amodal.is-iframe.amodal-sm { height: 60vh; }
.amodal.is-iframe.amodal-lg { height: 84vh; }
.amodal.is-iframe.amodal-xl { height: 90vh; }
/* 弹窗内页紧凑化：标题已在弹窗头显示，隐藏页内大标题 */
.is-modal .panel { padding: 14px 16px 20px; }
.is-modal .panel-header { display: none; }
/* 弹窗内隐藏“再导航”类链接（子页互跳），改由弹窗头 × / 关闭按钮退出 */
.is-modal .modal-hide { display: none !important; }
body.amodal-open { overflow: hidden; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .workspace { margin: 0; border-radius: 0; min-height: 70vh; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats-6 { grid-template-columns: 1fr 1fr; }
  .stats-4 { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .takeaway-grid { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; min-height: auto; }
  .login-aside { padding: 32px 28px; border-right: 0; border-bottom: 1px solid var(--border); }
  .login-card { padding: 32px 28px 36px; }
  .amodal-overlay { padding: 12px; }
  .amodal.is-iframe { height: 86vh; }
  .amodal.is-iframe.amodal-lg,
  .amodal.is-iframe.amodal-xl { height: 88vh; }
}
