:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #162033;
  --muted: #667085;
  --line: #dbe1ea;
  --primary: #0a7cff;
  --danger: #d92d20;
  --nav: #0f172a;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Segoe UI", "PingFang SC", sans-serif; }
.app-shell { --nav-width: 240px; min-height: 100vh; display: grid; grid-template-columns: var(--nav-width) 1fr; transition: grid-template-columns .2s ease; }
.app-shell.nav-collapsed { --nav-width: 84px; }
.side-nav { background: var(--nav); color: #d0d5dd; padding: 18px 10px; display: grid; grid-template-rows: auto 1fr auto auto auto; gap: 12px; overflow: hidden; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { font-size: 20px; margin: 0 0 6px; color: #fff; white-space: nowrap; }
.small { font-size: 12px; margin: 2px 0; }
.nav-list { display: grid; gap: 8px; align-content: start; }
.nav-btn { height: 36px; border: 1px solid #344054; border-radius: 8px; text-align: left; padding: 0 10px; background: transparent; color: #d0d5dd; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.nav-icon { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; background: #253146; color: #f2f4f7; font-size: 11px; }
.nav-label { white-space: nowrap; }
.nav-btn.active, .nav-btn:hover { background: #1d2939; border-color: #4b5565; }
.icon-btn { width: 36px; min-width: 36px; padding: 0; font-size: 16px; }
.app-shell.nav-collapsed .nav-label,
.app-shell.nav-collapsed .small,
.app-shell.nav-collapsed .brand { display: none; }
.app-shell.nav-collapsed .side-head { justify-content: center; }
.app-shell.nav-collapsed .nav-btn { justify-content: center; }
.main-content { padding: 18px; display: grid; gap: 14px; align-content: start; }
.pane { display: none; gap: 14px; }
.pane.active { display: grid; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: 0 6px 20px rgba(16, 24, 40, 0.04); }
.muted { color: var(--muted); }
.form { display: grid; gap: 10px; }
.inline-form { grid-template-columns: 1fr 1fr auto; align-items: end; }
label { display: grid; gap: 6px; font-size: 14px; }
input, select { height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: #fff; }
button { height: 36px; border: 0; background: var(--primary); color: #fff; border-radius: 8px; cursor: pointer; padding: 0 14px; }
button.secondary { background: #344054; }
button.danger { background: var(--danger); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.msg { min-height: 20px; font-size: 13px; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; min-width: 920px; }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 10px; font-size: 13px; white-space: nowrap; }
thead th { background: #f8fafd; position: sticky; top: 0; z-index: 1; }
.log-box { width: 100%; min-height: 320px; font-family: Consolas, monospace; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #0c111d; color: #d0d5dd; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.kpi { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #f8fafd; display: grid; }
.kpi b { font-size: 22px; margin-top: 6px; }
.inline-actions { display: flex; gap: 6px; }
.task-summary-cell { position: relative; min-width: 220px; max-width: 320px; white-space: normal; }
.task-summary-chip { display: inline-block; max-width: 100%; padding: 4px 8px; border-radius: 999px; background: #eef4ff; color: #175cd3; border: 1px solid #c7d7fe; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-summary-pop { position: absolute; left: 10px; top: calc(100% - 2px); z-index: 8; width: 260px; padding: 10px 12px; border-radius: 10px; background: rgba(15, 23, 42, 0.96); color: #f8fafc; box-shadow: 0 14px 32px rgba(15, 23, 42, 0.22); border: 1px solid rgba(148, 163, 184, 0.22); opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity .16s ease, transform .16s ease; }
.task-summary-cell:hover .task-summary-pop { opacity: 1; transform: translateY(0); }
.task-summary-pop h4 { margin: 0 0 8px; font-size: 13px; line-height: 1.3; }
.task-summary-pop p { margin: 4px 0; font-size: 12px; line-height: 1.35; color: #cbd5e1; }
.task-summary-pop p strong { color: #f8fafc; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: linear-gradient(140deg, #eef4ff, #f7f9fd); }
.login-side { background: #10223e; color: #e9eef9; padding: 40px; }
.login-side h1 { margin-top: 0; }
.login-side ul { margin: 10px 0 18px; padding-left: 18px; }
.login-main { display: grid; place-items: center; padding: 20px; }
.login-card { width: min(460px, 92vw); }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-shell.nav-collapsed { grid-template-columns: 1fr; }
  .side-nav { grid-template-rows: auto auto auto auto auto; }
  .inline-form { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-side { padding: 22px; }
}

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.shop-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 8px 24px rgba(16, 24, 40, 0.06); }
.shop-hero { position: relative; min-height: 160px; background: linear-gradient(135deg, #dbeafe, #eff6ff); background-size: cover; background-position: center; }
.shop-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15,23,42,0.08), rgba(15,23,42,0.72)); }
.shop-head { position: absolute; left: 14px; right: 14px; bottom: 14px; display: flex; gap: 12px; align-items: flex-end; z-index: 1; }
.shop-logo { width: 64px; height: 64px; border-radius: 16px; object-fit: cover; background: #fff; border: 2px solid rgba(255,255,255,.85); box-shadow: 0 10px 24px rgba(0,0,0,.18); }
.shop-title { color: #fff; min-width: 0; }
.shop-title h3 { margin: 0 0 6px; font-size: 18px; line-height: 1.2; }
.shop-meta-line { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; opacity: .96; }
.shop-body { padding: 14px; display: grid; gap: 12px; }
.shop-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shop-stat { background: #f8fafd; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.shop-stat span { display: block; font-size: 12px; color: var(--muted); }
.shop-stat strong { display: block; margin-top: 4px; font-size: 14px; }
.shop-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.shop-tag { padding: 4px 8px; border-radius: 999px; background: #eef4ff; color: #175cd3; font-size: 12px; border: 1px solid #c7d7fe; }
.dish-preview { display: grid; gap: 8px; }
.dish-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fcfcfd; }
.dish-item img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: #eef2f7; }
.dish-item h4 { margin: 0 0 4px; font-size: 14px; }
.dish-item p { margin: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.dish-price { font-weight: 700; color: #101828; }
.dish-hot { display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: 999px; background: #fff2e8; color: #b54708; font-size: 11px; }
.empty-panel { border: 1px dashed var(--line); border-radius: 12px; padding: 24px; text-align: center; color: var(--muted); background: #f8fafd; }
.shop-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.modal-shell { position: fixed; inset: 0; z-index: 50; }
.modal-shell.hidden { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.52); }
.modal-card { position: relative; width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 40px); margin: 20px auto; background: #fff; border-radius: 16px; border: 1px solid var(--line); box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22); padding: 16px; overflow: auto; }
.dish-manager-body { display: grid; gap: 14px; margin-top: 12px; }
.dish-manager-toolbar { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.dish-category-block { border: 1px solid var(--line); border-radius: 14px; background: #fcfdff; overflow: hidden; }
.dish-category-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: #eef3fb; border: 0; width: 100%; cursor: pointer; text-align: left; color: var(--text); }
.dish-category-head h4 { margin: 0; font-size: 15px; color: #162033; }
.dish-category-head span { color: #475467; font-size: 12px; }
.dish-category-toggle { display: flex; align-items: center; gap: 10px; }
.dish-category-chevron { font-size: 12px; color: #344054; transition: transform .18s ease; }
.dish-category-block.collapsed .dish-category-chevron { transform: rotate(-90deg); }
.dish-category-block.collapsed .table-wrap { display: none; }
.dish-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.dish-table th, .dish-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; white-space: normal; }
.dish-table thead th { background: #fff; position: static; }
.dish-table img { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; background: #eef2f7; }
.dish-table .dish-name-cell { display: grid; gap: 4px; }
.dish-table .dish-name-cell strong { font-size: 14px; }
.dish-table .dish-name-cell .muted { line-height: 1.4; }
.dish-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; border: 1px solid #c7d7fe; background: #eef4ff; color: #175cd3; }
