:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --line: #dde2ea;
  --text: #172033;
  --muted: #667085;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --ok: #047857;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 216px 1fr;
  overflow: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-view {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: #eef2f7;
}

.login-panel {
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .16);
}

.login-panel h1 {
  font-size: 24px;
}

.login-panel p {
  margin-top: 6px;
  color: var(--muted);
}

.login-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.login-panel button {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.login-panel button:hover {
  color: #fff;
  background: var(--primary-dark);
}

.captcha-row {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 8px;
  align-items: center;
}

.captcha-row img {
  width: 150px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: #f8fafc;
}

.login-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}

button:hover { border-color: var(--primary); color: var(--primary); }

.background-task-row.task-off { background: #fafafa; }

.task-name,
.background-task-row td {
  vertical-align: top;
}

.task-name {
  display: grid;
  gap: 4px;
}

.task-name code {
  width: fit-content;
  padding: 2px 5px;
  border-radius: 4px;
  color: #475569;
  background: #f1f5f9;
  font-size: 11px;
}

.task-name small,
.task-policy {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.task-kind,
.task-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.task-kind.device { color: #1d4ed8; background: #dbeafe; }
.task-kind.business { color: #7c3aed; background: #ede9fe; }
.task-status.success { color: #047857; background: #d1fae5; }
.task-status.running { color: #0369a1; background: #e0f2fe; }
.task-status.failed { color: #b91c1c; background: #fee2e2; }
.task-status.disabled { color: #64748b; background: #e2e8f0; }
.task-status.neutral { color: #475569; background: #f1f5f9; }

.task-description {
  min-width: 260px;
  color: #475569;
  line-height: 1.6;
}

.task-policy {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-failure { color: var(--danger); }
.task-locked { color: var(--muted); font-size: 12px; }
.task-enable { color: #047857; border-color: #a7f3d0; background: #ecfdf5; }

.sidebar {
  height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  padding: 14px 10px;
  color: #243241;
  background: #f9fbfc;
  border-right: 1px solid var(--line);
}

.brand {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 10px;
  border-bottom: 1px solid var(--line);
}

.brand::before {
  content: "托";
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
  line-height: 1.2;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

nav {
  min-height: 0;
  flex: 1 1 auto;
  gap: 8px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.nav-channel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: start;
}

.nav-tab {
  flex: 1 1 calc(50% - 4px);
  min-width: 0;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 7px;
  border: 1px solid #e1e9ef;
  border-radius: 999px;
  color: #47596a;
  background: #fff;
  text-align: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}

.nav-tab:hover {
  color: var(--primary);
  border-color: #bfdbfe;
  background: #eff6ff;
}

.nav-tab.active {
  color: #17346d;
  border-color: #93c5fd;
  background: #dbeafe;
  box-shadow: 0 3px 10px rgba(37, 99, 235, .1);
}

.nav-tab-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--primary);
  font-size: 10px;
  font-weight: 800;
}

.nav-tab-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11px;
  font-weight: 700;
}

.nav-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid #e1e9ef;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}

.nav-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #edf2f6;
  color: #243241;
  font-weight: 800;
}

.nav-panel-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.nav-items {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 4px;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #a9bdc8 transparent;
}

.nav-items::-webkit-scrollbar { width: 7px; }
.nav-items::-webkit-scrollbar-track { background: transparent; }
.nav-items::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #b6c8d1;
}

.nav-btn {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  text-align: left;
  color: #34495b;
  background: #f8fbfd;
  font-size: 12px;
}

.nav-btn:hover {
  color: var(--primary);
  border-color: #d7e8f8;
  background: #eff6ff;
}

.nav-btn.active {
  color: #17346d;
  background: #dbeafe;
  border-color: #bfdbfe;
  font-weight: 700;
}

.nav-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  opacity: .45;
}

.nav-btn.active .nav-dot {
  opacity: 1;
}

.nav-label {
  min-width: 0;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.25;
  display: block;
}

.main {
  min-width: 0;
  height: 100vh;
  overflow: auto;
  padding: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

h1, h2, p { margin: 0; }

h1 { font-size: 24px; }
.topbar p { color: var(--muted); margin-top: 6px; }

.db-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 7px 12px;
  color: var(--muted);
  white-space: nowrap;
}

.user-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 7px 12px;
  color: var(--muted);
  white-space: nowrap;
}

.db-status.ok { color: var(--ok); border-color: #86efac; background: #f0fdf4; }
.db-status.fail { color: var(--danger); border-color: #fecaca; background: #fef2f2; }

.overview {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.meal-control {
  --meal-navy: #172554;
  --meal-blue: #2563eb;
  --meal-sky: #eff6ff;
  display: grid;
  gap: 14px;
  padding-bottom: 28px;
}

.meal-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 142px;
  padding: 26px 30px;
  border-radius: 14px;
  color: #fff;
  background:
    radial-gradient(circle at 76% 0%, rgba(96, 165, 250, .55), transparent 34%),
    linear-gradient(125deg, #0f172a, #1e3a8a 58%, #2563eb);
  box-shadow: 0 16px 38px rgba(30, 64, 175, .18);
}

.meal-hero::after {
  content: "";
  position: absolute;
  right: -54px;
  bottom: -95px;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
}

.meal-kicker {
  display: block;
  margin-bottom: 8px;
  color: #bfdbfe;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
}

.meal-hero h2 { font-size: 27px; letter-spacing: .02em; }
.meal-hero p { max-width: 680px; margin-top: 8px; color: #dbeafe; line-height: 1.65; }

.meal-hero-note {
  position: relative;
  z-index: 1;
  flex: 0 0 min(330px, 35%);
  padding: 15px 17px;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 10px;
  background: rgba(15, 23, 42, .35);
  backdrop-filter: blur(8px);
}

.meal-hero-note strong,
.meal-hero-note span { display: block; }
.meal-hero-note strong { margin-bottom: 5px; font-size: 13px; }
.meal-hero-note span { color: #dbeafe; font-size: 12px; line-height: 1.55; }

.meal-tabs {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.meal-tabs button {
  flex: 1 0 auto;
  min-width: 88px;
  border: 0;
  border-radius: 7px;
  padding: 10px 13px;
  color: #64748b;
  background: transparent;
  font-weight: 650;
}

.meal-tabs button:hover { color: var(--meal-blue); background: #f8fafc; }
.meal-tabs button.active { color: #fff; background: var(--meal-navy); box-shadow: 0 5px 14px rgba(15, 23, 42, .18); }
.meal-control-body { display: grid; gap: 14px; min-width: 0; }

.meal-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.meal-metric {
  position: relative;
  overflow: hidden;
  min-height: 116px;
  padding: 18px 19px;
  border: 1px solid #dbe4f0;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(15, 23, 42, .04);
}

.meal-metric::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -22px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: #eff6ff;
}

.meal-metric span,
.meal-metric strong,
.meal-metric small { position: relative; z-index: 1; display: block; }
.meal-metric span { color: #64748b; font-size: 12px; font-weight: 700; }
.meal-metric strong { margin: 6px 0 5px; color: #0f172a; font-size: 30px; line-height: 1; }
.meal-metric small { color: #94a3b8; }
.meal-metric.green::after { background: #ecfdf5; }
.meal-metric.red::after { background: #fff1f2; }
.meal-metric.red strong { color: #dc2626; }

.meal-grid { display: grid; gap: 14px; min-width: 0; }
.meal-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.meal-panel,
.meal-toolbar {
  min-width: 0;
  border: 1px solid #dbe4f0;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(15, 23, 42, .035);
}

.meal-panel { overflow: hidden; }
.meal-panel > header,
.meal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 17px;
}

.meal-panel > header { border-bottom: 1px solid #edf2f7; }
.meal-panel h3 { color: #0f172a; font-size: 15px; }
.meal-panel header p,
.meal-toolbar span { display: block; margin-top: 4px; color: #94a3b8; font-size: 12px; }
.meal-toolbar > div:last-child { display: flex; gap: 8px; }
.meal-toolbar button.primary { border-color: var(--meal-blue); color: #fff; background: var(--meal-blue); }
.meal-dialog button.primary {
  border-color: #2563eb;
  color: #fff;
  background: #2563eb;
  box-shadow: 0 5px 13px rgba(37, 99, 235, .22);
}
.meal-dialog button.primary:hover { border-color: #1d4ed8; background: #1d4ed8; }
.meal-dialog button.primary:focus-visible { outline: 3px solid rgba(37, 99, 235, .24); outline-offset: 2px; }

.meal-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.meal-filters input { min-width: 250px; }
.meal-count { flex: 0 0 auto; margin: 0 !important; color: #64748b !important; }

.meal-table-wrap { width: 100%; overflow: auto; }
.meal-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.meal-table th {
  padding: 10px 13px;
  color: #64748b;
  background: #f8fafc;
  text-align: left;
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: .02em;
}

.meal-table td {
  padding: 12px 13px;
  border-top: 1px solid #edf2f7;
  color: #334155;
  vertical-align: top;
}

.meal-table tbody tr:hover { background: #fafcff; }
.meal-table td > strong,
.meal-table td > small { display: block; }
.meal-table td > strong { color: #0f172a; }
.meal-table td > small { max-width: 360px; margin-top: 4px; color: #94a3b8; line-height: 1.45; }
.meal-table code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; overflow-wrap: anywhere; }

.meal-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  margin: 0 3px 3px 0;
  border-radius: 999px;
  padding: 3px 7px;
  color: #475569;
  background: #f1f5f9;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.meal-badge.good { color: #047857; background: #ecfdf5; }
.meal-badge.bad { color: #be123c; background: #fff1f2; }
.meal-badge.warn { color: #b45309; background: #fffbeb; }
.meal-row-actions { display: flex; flex-wrap: wrap; gap: 4px; min-width: 150px; }
.meal-link { border: 0; padding: 3px 5px; color: var(--meal-blue); background: transparent; font-size: 12px; }
.meal-link:hover { text-decoration: underline; }
.meal-link.danger { color: #dc2626; }

.meal-version-list { padding: 5px 17px 13px; }
.meal-version-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid #edf2f7;
}
.meal-version-list span,
.meal-version-list small { display: block; }
.meal-version-list small { margin-top: 3px; color: #94a3b8; font-size: 11px; }
.meal-version-list strong { color: var(--meal-blue); font-size: 18px; }
.meal-status-cloud { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; padding: 17px; }
.meal-status-cloud > div { display: flex; align-items: center; justify-content: space-between; padding: 10px; border-radius: 7px; background: #f8fafc; }

.meal-guide ol { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 0; padding: 18px 20px 21px 44px; }
.meal-guide li { padding: 0 18px 0 4px; color: var(--meal-blue); }
.meal-guide li + li { border-left: 1px solid #e2e8f0; padding-left: 27px; }
.meal-guide li strong,
.meal-guide li span { display: block; }
.meal-guide li strong { color: #0f172a; font-size: 13px; }
.meal-guide li span { margin-top: 5px; color: #64748b; font-size: 12px; line-height: 1.55; }

.meal-progress { width: 160px; height: 6px; overflow: hidden; border-radius: 99px; background: #e2e8f0; }
.meal-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2563eb, #38bdf8); }
.meal-empty { display: grid; justify-items: center; gap: 4px; padding: 34px 18px; color: #94a3b8; text-align: center; }
.meal-empty strong { color: #64748b; }
.meal-loading,
.meal-error { display: grid; justify-items: center; gap: 10px; padding: 68px 20px; border: 1px solid #dbe4f0; border-radius: 11px; background: #fff; color: #64748b; }
.meal-loading i { width: 24px; height: 24px; border: 3px solid #dbeafe; border-top-color: var(--meal-blue); border-radius: 50%; animation: meal-spin .8s linear infinite; }
@keyframes meal-spin { to { transform: rotate(360deg); } }

.meal-dialog {
  width: min(780px, calc(100vw - 34px));
  max-height: calc(100dvh - 34px);
  padding: 0;
  border: 0;
  border-radius: 13px;
  overflow: hidden;
  box-shadow: 0 25px 80px rgba(15, 23, 42, .28);
}
.meal-dialog-card {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 34px);
  overflow: hidden;
}
.meal-dialog::backdrop { background: rgba(15, 23, 42, .62); backdrop-filter: blur(2px); }
.meal-dialog-card > header { flex: 0 0 auto; display: flex; justify-content: space-between; gap: 14px; padding: 18px 21px; color: #fff; background: linear-gradient(115deg, #0f172a, #1e3a8a); }
.meal-dialog-card header h2 { margin: 0; font-size: 18px; }
.meal-dialog-card header p { margin: 5px 0 0; color: #bfdbfe; font-size: 12px; }
.meal-dialog-card header button { border: 0; color: #fff; background: transparent; font-size: 23px; }
.meal-dialog form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100dvh - 112px);
  overflow: hidden;
}
.meal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.meal-form-grid label { display: grid; align-content: start; gap: 6px; min-width: 0; color: #334155; font-size: 12px; font-weight: 700; }
.meal-form-grid label.wide,
.meal-form-grid .wide { grid-column: 1 / -1; }
.meal-form-grid label small { color: #94a3b8; font-weight: 400; line-height: 1.4; }
.meal-form-grid input,
.meal-form-grid select,
.meal-form-grid textarea { width: 100%; min-width: 0; font-weight: 400; }
.meal-form-grid .meal-check { display: flex; flex-direction: row; align-items: center; }
.meal-form-grid .meal-check input { width: auto; }
.meal-dialog form > footer {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 20px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  box-shadow: 0 -8px 18px rgba(15, 23, 42, .06);
}
.meal-secret { display: grid; justify-items: center; gap: 8px; padding: 35px 20px; border: 1px dashed #93c5fd; border-radius: 10px; background: #eff6ff; }
.meal-secret span { color: #64748b; font-size: 13px; }
.meal-secret strong { color: #1d4ed8; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 34px; letter-spacing: .14em; }
.meal-secret small { color: #64748b; }

@media (max-width: 1100px) {
  .meal-metrics { grid-template-columns: repeat(2, 1fr); }
  .meal-grid.two { grid-template-columns: 1fr; }
  .meal-guide ol { grid-template-columns: repeat(2, 1fr); row-gap: 20px; }
  .meal-guide li:nth-child(3) { border-left: 0; padding-left: 4px; }
}

@media (max-width: 760px) {
  .meal-hero { align-items: flex-start; flex-direction: column; padding: 22px; }
  .meal-hero-note { flex-basis: auto; width: 100%; }
  .meal-metrics { grid-template-columns: 1fr; }
  .meal-toolbar { align-items: stretch; flex-direction: column; }
  .meal-filters { display: grid; grid-template-columns: 1fr; }
  .meal-filters input { min-width: 0; }
  .meal-guide ol { grid-template-columns: 1fr; }
  .meal-guide li + li { border-left: 0; padding: 14px 18px 0 4px; }
  .meal-form-grid { grid-template-columns: 1fr; }
  .meal-form-grid label.wide,
  .meal-form-grid .wide { grid-column: auto; }
  .meal-dialog,
  .meal-dialog-card { max-height: calc(100dvh - 16px); }
  .meal-dialog form { max-height: calc(100dvh - 94px); }
}

.overview-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: linear-gradient(135deg, #eff6ff 0%, #fff 68%);
}

.overview-hero h2 {
  margin: 0;
  font-size: 22px;
}

.overview-hero p {
  margin: 6px 0 0;
  color: var(--muted);
}

.overview-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metric span { display: block; color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 8px; font-size: 26px; }
.metric small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.metric.warn { border-color: #fbbf24; background: #fffbeb; }
.metric.devices { border-color: #bfdbfe; }
.metric.care { border-color: #bbf7d0; }
.metric.sync { border-color: #c4b5fd; }

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

.overview-panel,
.overview-list {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.overview-panel header,
.overview-list header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid #eef2f7;
}

.overview-panel h3,
.overview-list h3 {
  margin: 0;
  font-size: 16px;
}

.overview-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.overview-kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.overview-kv-grid div {
  min-width: 0;
  padding: 10px;
  border-radius: 7px;
  background: #f8fafc;
}

.overview-kv-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.overview-kv-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
}

.overview-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.overview-list-body {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.overview-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid #edf2f7;
  border-radius: 7px;
  background: #fbfdff;
}

.overview-list-item div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.overview-list-item strong,
.overview-list-item span,
.overview-list-item small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.overview-list-item span,
.overview-list-item small {
  color: var(--muted);
  font-size: 12px;
}

.overview-list-item em {
  flex: 0 0 auto;
  min-width: 58px;
  padding: 4px 8px;
  border-radius: 999px;
  font-style: normal;
  text-align: center;
  font-size: 12px;
  background: #eef2ff;
  color: #3730a3;
}

.overview-list-item em.ok { background: #dcfce7; color: #166534; }
.overview-list-item em.warn { background: #fef3c7; color: #92400e; }
.overview-list-item em.bad { background: #fee2e2; color: #991b1b; }

.overview-empty {
  padding: 18px;
  border-radius: 7px;
  color: var(--muted);
  background: #f8fafc;
  text-align: center;
}

.toolbar,
.batchbar,
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.filters, .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
}

.school-combo {
  position: relative;
  min-width: 220px;
}

.school-combo input[data-school-search] {
  width: 100%;
}

.form-combo {
  min-width: 0;
}

.combo-options {
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .16);
}

.combo-options button {
  width: 100%;
  border: 0;
  border-radius: 4px;
  padding: 8px 10px;
  text-align: left;
  background: transparent;
}

.combo-options button:hover {
  background: #eef4ff;
}

.combo-empty {
  padding: 9px 10px;
  color: var(--muted);
  font-size: 13px;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.batchbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.table-wrap table {
  min-width: 980px;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  font-size: 13px;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}

th {
  background: #f8fafc;
  color: #475467;
  font-weight: 600;
}

td.actions-cell {
  width: 230px;
  white-space: normal;
}

td.data-cell {
  cursor: pointer;
}

td.data-cell:hover {
  background: #f8fbff;
}

.cell-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

td.cell-expanded .cell-text {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

td.actions-cell button {
  margin: 2px;
  padding: 5px 8px;
  font-size: 12px;
}

.danger { color: var(--danger); }

.pager {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.hidden { display: none !important; }
.simulation-action { border-color: var(--primary); color: #fff; background: var(--primary); font-weight: 700; }
.simulation-action:hover { filter: brightness(.92); }

.toast-root {
  position: fixed;
  z-index: 1000;
  top: 18px;
  right: 18px;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.dialog-toast-root {
  z-index: 10000;
  top: 24px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 40px));
}

.toast {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .18);
  pointer-events: auto;
}

.dialog-toast-root .toast {
  border-width: 2px;
  border-left-width: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .34);
}

.dialog-toast-root .toast strong {
  font-size: 15px;
}

.dialog-toast-root .toast span {
  color: var(--text);
}

.toast strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}

.toast span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.toast button {
  border: 0;
  padding: 0 4px;
  color: var(--muted);
  background: transparent;
  font-size: 18px;
  line-height: 1;
}

.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--ok); }
.toast.warning { border-left-color: #d97706; }
.toast.info { border-left-color: var(--primary); }

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  width: min(760px, calc(100vw - 32px));
  box-shadow: 0 24px 80px rgba(15,23,42,.25);
}

dialog::backdrop {
  background: rgba(15,23,42,.42);
}

.dialog header,
.dialog footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.dialog footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.icon-btn {
  border: 0;
  font-size: 22px;
  line-height: 1;
  padding: 0 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.form-grid label.full {
  grid-column: 1 / -1;
}

.camera-simulation-dialog > header h2 { margin: 0; font-size: 19px; }
.camera-simulation-dialog > header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.camera-simulation-body { display: grid; gap: 14px; max-height: 68vh; overflow-y: auto; padding: 16px; }
.camera-simulation-body label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.camera-simulation-body small { color: #6b7f8d; line-height: 1.5; }
.camera-simulation-body textarea { resize: vertical; }
.camera-simulation-steps { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.camera-simulation-steps i { height: 2px; background: #dbe6ec; }
.camera-simulation-steps span { display: flex; align-items: center; gap: 7px; color: #7b8e9b; font-size: 13px; font-weight: 700; }
.camera-simulation-steps span b { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; color: #607785; background: #e7eef2; }
.camera-simulation-steps span em { font-style: normal; }
.camera-simulation-steps span.active { color: var(--primary); }
.camera-simulation-steps span.active b { color: #fff; background: var(--primary); }
.camera-simulation-step { display: grid; gap: 14px; }
.camera-simulation-fields,
.temperature-simulation-fields { display: grid; gap: 14px; }
.temperature-simulation-fields { grid-template-columns: 1.35fr .65fr; }
.camera-simulation-body .checkbox-field { display: flex; align-items: center; align-self: end; min-height: 38px; color: var(--text); }
.camera-simulation-body .checkbox-field input { width: auto; margin: 0; padding: 0; }
.camera-selected-device { padding: 12px 14px; border: 1px solid #b7cdf5; border-radius: 8px; color: #1d4ed8; background: #eff6ff; font-weight: 700; }
.camera-simulation-preview { display: grid; min-height: 180px; place-items: center; overflow: hidden; border: 1px dashed #afc4d0; border-radius: 8px; color: var(--muted); background: #f8fbfd; }
.camera-simulation-preview img { display: block; width: 100%; max-height: 320px; object-fit: contain; }
.camera-ai-hint { margin: 0; padding: 10px 12px; border-radius: 7px; color: #73510d; background: #fff8df; font-size: 13px; line-height: 1.55; }

.form-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.form-hint.full {
  grid-column: 1 / -1;
}

.detail-dialog {
  width: min(960px, calc(100vw - 40px));
}

.detail-body {
  display: grid;
  gap: 14px;
  max-height: 68vh;
  overflow: auto;
  padding: 16px;
}

.detail-section {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-section h3 {
  margin: 0;
  font-size: 15px;
}
.device-integration-dialog { width: min(880px, calc(100vw - 40px)); }
.device-integration-dialog header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.device-integration-note { margin: 16px 0 0; padding: 12px 14px; border-radius: 8px; font-size: 13px; }
.device-integration-note.ok { border: 1px solid #a9dfcf; color: #17654f; background: #eefaf6; }
.device-integration-note.warn { border: 1px solid #f0d29b; color: #8a5910; background: #fff8e9; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
}

.detail-item {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.detail-item strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.detail-item span {
  overflow-wrap: anywhere;
}

.detail-json {
  max-height: 240px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #111827;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.muted {
  color: var(--muted);
}

.context-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -6px 0 12px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
}

.context-filter button {
  padding: 6px 10px;
}

.device-type-slices {
  margin: 0 0 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.device-type-slices__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.device-type-slices__head strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.device-type-slices__head span {
  color: var(--muted);
  font-size: 12px;
}

.device-type-slices__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.device-type-slice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #475569;
  background: #fff;
}

.device-type-slice:hover {
  border-color: #93c5fd;
  color: var(--primary);
  background: #eff6ff;
}

.device-type-slice.active {
  border-color: var(--primary);
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.device-type-slice__count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  color: inherit;
  background: rgba(148, 163, 184, .18);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.device-type-slice.active .device-type-slice__count {
  background: rgba(255, 255, 255, .2);
}

.flow-view-btn {
  border-color: #b9ddd8;
  color: #0f766e;
  background: #ecfdf8;
  font-weight: 700;
}

#deviceFlowDialog {
  width: min(1120px, calc(100vw - 32px));
  max-width: none;
  background: #f5f8fa;
}

.device-flow-dialog > header {
  align-items: flex-start;
  background: #fff;
}

.device-flow-dialog > header h2 {
  margin: 4px 0 3px;
  font-size: 22px;
}

.device-flow-dialog > header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.device-flow-eyebrow {
  color: #0f766e;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.device-flow-dialog > footer {
  align-items: center;
  background: #fff;
}

.device-flow-dialog > footer span {
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
}

.device-flow-body {
  display: grid;
  gap: 16px;
  max-height: 76vh;
  overflow: auto;
  padding: 18px;
}

.device-flow-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, .8fr);
  gap: 16px;
}

.device-flow-visual,
.device-flow-summary,
.device-flow-section,
.device-flow-bottom > article {
  border: 1px solid #dbe5ea;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(15, 23, 42, .045);
}

.device-flow-visual {
  display: grid;
  min-height: 280px;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

.device-flow-svg {
  display: block;
  width: 100%;
  min-width: 620px;
}

.flow-svg-node rect {
  fill: #fff;
  stroke: #d5e1e6;
  stroke-width: 1.5;
  filter: drop-shadow(0 5px 10px rgba(15, 23, 42, .07));
}

.flow-svg-node circle { fill: var(--flow-accent); }
.flow-svg-index { fill: #fff; font-size: 16px; font-weight: 800; }
.flow-svg-label { fill: #22323b; font-size: 14px; font-weight: 700; }
.flow-svg-arrow { stroke: var(--flow-accent); stroke-width: 2; stroke-dasharray: 4 4; }
.flow-svg-scene-icon { fill: #fff; font-size: 20px; font-weight: 800; }
.flow-svg-scene-title { fill: #16272f; font-size: 18px; font-weight: 800; }
.flow-svg-scene-subtitle { fill: #647985; font-size: 12px; }

.device-flow-summary {
  padding: 20px;
}

.device-flow-status {
  display: inline-flex;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--flow-accent) 35%, white);
  border-radius: 999px;
  color: var(--flow-accent);
  background: color-mix(in srgb, var(--flow-accent) 8%, white);
  font-size: 11px;
  font-weight: 800;
}

.device-flow-summary h3 {
  margin: 16px 0 8px;
  font-size: 18px;
}

.device-flow-summary h4 {
  margin: 18px 0 8px;
  font-size: 13px;
}

.device-flow-summary p,
.device-flow-summary li,
.device-flow-note-card li {
  color: #536975;
  font-size: 13px;
  line-height: 1.7;
}

.device-flow-summary ul,
.device-flow-note-card ul {
  margin: 0;
  padding-left: 18px;
}

.device-flow-section {
  padding: 18px;
}

.device-flow-section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}

.device-flow-section-title span {
  color: var(--flow-accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
}

.device-flow-section-title h3 {
  margin: 0;
  color: #20343d;
  font-size: 15px;
}

.device-flow-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.device-flow-step {
  position: relative;
  min-height: 154px;
  padding: 14px;
  border: 1px solid #e0e8ec;
  border-radius: 11px;
  background: linear-gradient(155deg, #fff, #f7fafb);
}

.device-flow-step > span {
  color: color-mix(in srgb, var(--flow-accent) 58%, white);
  font-size: 26px;
  font-weight: 900;
}

.device-flow-step h4 {
  margin: 7px 0 5px;
  color: #253a44;
  font-size: 14px;
}

.device-flow-step p {
  margin: 0;
  color: #667b86;
  font-size: 12px;
  line-height: 1.6;
}

.device-flow-bottom {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 16px;
}

.device-flow-bottom > article {
  padding: 18px;
}

.device-flow-data-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.device-flow-data-points span {
  padding: 7px 9px;
  border-radius: 7px;
  color: #38505b;
  background: #eef3f5;
  font-family: Consolas, monospace;
  font-size: 11px;
}

.device-flow-note-card {
  border-color: color-mix(in srgb, var(--flow-accent) 24%, white) !important;
  background: color-mix(in srgb, var(--flow-accent) 4%, white) !important;
}

@media (max-width: 900px) {
  body {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .sidebar {
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  nav {
    min-height: 260px;
  }
  .main {
    height: auto;
    overflow: visible;
  }
  .overview-hero { display: grid; }
  .overview-metrics,
  .overview-grid,
  .overview-lists { grid-template-columns: 1fr; }
  .toolbar { display: grid; }
  .device-type-slices__head {
    display: grid;
    gap: 3px;
  }
  .detail-grid { grid-template-columns: 1fr; }
  .device-flow-hero,
  .device-flow-bottom { grid-template-columns: 1fr; }
  .device-flow-steps { grid-template-columns: 1fr; }
  .device-flow-visual { overflow-x: auto; place-items: start; }
  .temperature-simulation-fields { grid-template-columns: 1fr; }
}
.diet-admin-shell {
  display: grid;
  gap: 15px;
  min-width: 0;
  color: #25342f;
}

.diet-admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border: 1px solid #dce9e2;
  border-radius: 18px;
  background: linear-gradient(125deg, #f4fbf7, #fff9ef);
}

.diet-admin-hero > div:first-child > span,
.diet-admin-dialog form > header span {
  color: #31a477;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
}

.diet-admin-hero h2,
.diet-admin-dialog h2 {
  margin: 3px 0 5px;
}

.diet-admin-hero p,
.diet-admin-dialog p {
  margin: 0;
  color: #75817d;
}

.diet-admin-stat {
  display: grid;
  min-width: 130px;
  padding: 12px 16px;
  border: 1px solid #dbe9e2;
  border-radius: 13px;
  background: rgb(255 255 255 / 72%);
  text-align: right;
}

.diet-admin-stat strong {
  color: #238b66;
  font-size: 25px;
}

.diet-admin-stat span {
  color: #7a8781;
  font-size: 11px;
}

.diet-admin-tabs {
  display: flex;
  gap: 5px;
  border-bottom: 1px solid #dce7e1;
}

.diet-admin-tabs button,
.diet-admin-toolbar button,
.diet-admin-toolbar input,
.diet-admin-toolbar select,
.diet-admin-pager button,
.diet-admin-content button,
.diet-admin-dialog button,
.diet-admin-dialog input,
.diet-admin-dialog select {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #d5e1db;
  border-radius: 10px;
  background: #fff;
  color: #33483f;
}

.diet-admin-tabs button {
  border: 0;
  border-radius: 10px 10px 0 0;
  background: transparent;
  cursor: pointer;
}

.diet-admin-tabs button.active {
  background: #e9f7f0;
  color: #208a64;
  font-weight: 800;
}

.diet-admin-toolbar {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  padding: 13px;
  border: 1px solid #e0e9e4;
  border-radius: 14px;
  background: #fff;
}

.diet-admin-toolbar input {
  min-width: 260px;
  flex: 1;
}

.diet-admin-toolbar button,
.diet-admin-content button,
.diet-admin-pager button,
.diet-admin-dialog button {
  cursor: pointer;
}

.diet-admin-toolbar .primary,
.diet-admin-dialog .primary {
  border-color: #2ca779;
  background: #2ca779;
  color: #fff;
}

.diet-admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(275px, 1fr));
  gap: 12px;
}

.diet-admin-dish-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid #e0e9e4;
  border-radius: 14px;
  background: #fff;
}

.diet-admin-dish-card > header,
.diet-admin-dish-card > footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.diet-admin-dish-card h3 {
  margin: 3px 0 0;
}

.diet-admin-dish-card header span,
.diet-admin-dish-card footer small {
  display: block;
  color: #83908a;
  font-size: 11px;
}

.diet-admin-dish-card header em {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}

.diet-admin-dish-card header em.public {
  background: #eaf6f1;
  color: #278965;
}

.diet-admin-dish-card header em.school {
  background: #fff3d8;
  color: #a76b16;
}

.diet-admin-dish-card > p {
  min-height: 44px;
  margin: 0;
  overflow: hidden;
  color: #6e7c75;
  font-size: 12px;
  line-height: 1.8;
}

.diet-admin-food-table {
  overflow: auto;
  border: 1px solid #dfe8e3;
  border-radius: 14px;
  background: #fff;
}

.diet-admin-food-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr .65fr .8fr .8fr .7fr .75fr .55fr;
  gap: 10px;
  align-items: center;
  min-width: 900px;
  padding: 12px 15px;
  border-bottom: 1px solid #edf1ef;
}

.diet-admin-food-row.head {
  background: #f4f8f6;
  color: #74817b;
  font-size: 12px;
  font-weight: 700;
}

.diet-admin-food-row strong,
.diet-admin-food-row small {
  display: block;
}

.diet-admin-food-row small {
  color: #8a9690;
  font-size: 10px;
}

.diet-admin-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #6e7b75;
}

.diet-admin-pager > div {
  display: flex;
  gap: 7px;
}

.diet-admin-empty,
.diet-admin-loading {
  padding: 50px 20px;
  border: 1px dashed #ccdcd3;
  border-radius: 14px;
  color: #7b8882;
  text-align: center;
}

.diet-admin-dialog {
  width: min(900px, calc(100vw - 30px));
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 22px 70px rgb(27 52 41 / 24%);
}

.diet-admin-dialog::backdrop {
  background: rgb(27 43 37 / 48%);
}

.diet-admin-dialog form > header,
.diet-admin-dialog form > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid #e6ece9;
}

.diet-admin-dialog form > footer {
  justify-content: flex-end;
  border-top: 1px solid #e6ece9;
  border-bottom: 0;
}

.diet-admin-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  padding: 20px 22px;
}

.diet-admin-form-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.diet-admin-form-grid label {
  display: grid;
  gap: 6px;
  color: #627169;
  font-size: 12px;
}

.diet-admin-ingredient-editor {
  display: grid;
  gap: 12px;
  padding: 0 22px 22px;
}

.diet-admin-ingredient-editor > header,
.diet-admin-ingredient-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.diet-admin-ingredient-editor > header {
  justify-content: space-between;
}

.diet-admin-ingredient-editor h3 {
  margin: 0 0 3px;
}

.diet-admin-ingredient-row select {
  flex: 1;
  min-width: 0;
}

.diet-admin-ingredient-row input {
  width: 110px;
}

@media (max-width: 760px) {
  .diet-admin-hero {
    align-items: stretch;
    flex-direction: column;
  }
  .diet-admin-stat {
    text-align: left;
  }
  .diet-admin-form-grid,
  .diet-admin-form-grid.compact {
    grid-template-columns: 1fr;
  }
}
