:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #0f1f33;
  --muted: #68758a;
  --line: #dbe3ef;
  --sidebar: #09233d;
  --sidebar-2: #061a2f;
  --blue: #1463e8;
  --teal: #0f9f8a;
  --green: #129261;
  --amber: #e98619;
  --red: #e14b52;
  --purple: #7753d7;
  --pink: #d94d8a;
  --shadow: 0 12px 28px rgba(18, 34, 58, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1724;
  --panel: #121f2e;
  --panel-soft: #172637;
  --ink: #edf4ff;
  --muted: #9eacbd;
  --line: #27384d;
  --sidebar: #071525;
  --sidebar-2: #040d18;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: #eaf2ff;
  padding: 18px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px 20px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: #0c60df;
  background: #ffffff;
  border-radius: 8px;
}

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

.brand span {
  margin-top: 3px;
  color: #a8b7ca;
  font-size: 12px;
}

.nav-list,
.manage-drawer {
  display: grid;
  gap: 6px;
}

.nav-btn,
.ghost-row,
.manage-toggle {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #bfd0e6;
  border: 0;
  border-radius: 7px;
  background: transparent;
  padding: 10px 12px;
  text-align: left;
}

.nav-btn.active,
.nav-btn:hover,
.ghost-row:hover,
.manage-toggle:hover {
  color: #ffffff;
  background: rgba(20, 99, 232, 0.88);
}

.count-dot {
  margin-left: auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: #ef3340;
  color: #ffffff;
  font-size: 12px;
}

.manage-toggle {
  justify-content: space-between;
  margin-top: 22px;
  color: #e6effa;
}

.manage-toggle span:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chev {
  transition: transform 0.2s ease;
}

.chev.open {
  transform: rotate(90deg);
}

.manage-drawer {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.24s ease;
}

.manage-drawer.open {
  max-height: 240px;
}

.sidebar-foot {
  margin-top: auto;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.top-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

h1,
h2,
p {
  margin: 0;
}

.top-title h1 {
  font-size: 19px;
  line-height: 1.2;
}

.top-title p,
.section-head p,
.compact-note,
.principle,
.discipline {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.top-actions > * {
  flex: 0 0 auto;
}

.store-select,
.top-date {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--teal);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.live,
.status-pill.paid {
  background: rgba(18, 146, 97, 0.1);
  color: var(--green);
  border-color: rgba(18, 146, 97, 0.28);
}

.status-pill.warn {
  color: var(--amber);
  background: rgba(233, 134, 25, 0.1);
  border-color: rgba(233, 134, 25, 0.28);
}

.icon-btn,
.notify-btn,
.text-btn,
.primary,
.secondary,
.chip,
.tabs button,
.segmented button {
  border: 1px solid var(--line);
  border-radius: 7px;
  min-height: 36px;
  color: var(--ink);
  background: var(--panel);
}

.icon-btn {
  width: 36px;
  display: inline-grid;
  place-items: center;
}

.notify-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

.notify-btn b {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #ef3340;
  color: #fff;
  font-size: 12px;
}

.content {
  width: min(1460px, 100%);
  margin: 0 auto;
  padding: 20px 22px 42px;
}

.panel,
.kpi-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
  min-width: 0;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-head.compact {
  align-items: center;
}

.section-head h2 {
  font-size: 17px;
  line-height: 1.25;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi-card {
  min-height: 104px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
}

.kpi-card span,
.kpi-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.kpi-card strong {
  display: block;
  margin: 8px 0;
  font-size: 24px;
}

.kpi-card i {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--blue);
}

.kpi-card.warn i,
.kpi-card.warn strong {
  color: var(--amber);
}

.kpi-card.info i {
  color: var(--purple);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: 14px;
  margin-bottom: 14px;
}

.wide {
  min-width: 0;
}

.system-table,
.route-list,
.tree-list,
.publish-list,
.summary-grid,
.setting-list,
.device-list,
.member-list,
.settled-table,
.refund-table,
.order-table {
  display: grid;
  gap: 8px;
}

.system-row,
.route-list div,
.tree-list div,
.summary-grid div,
.device-list div,
.member-list div,
.settled-table div,
.refund-row,
.order-row,
.items-head,
.item-row,
.table-head {
  display: grid;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.system-row {
  grid-template-columns: 180px 160px minmax(0, 1fr);
}

.system-row p,
.route-list span,
.tree-list span,
.summary-grid span,
.device-list small,
.member-list small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.flow-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 8px;
  overflow-x: auto;
}

.flow-step {
  position: relative;
  min-height: 92px;
  padding: 12px 34px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.flow-step b,
.flow-step span {
  display: block;
}

.flow-step span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.flow-step i {
  position: absolute;
  top: 14px;
  right: 10px;
  color: var(--blue);
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.rule-grid p {
  padding: 10px;
  border-left: 3px solid var(--teal);
  background: var(--panel-soft);
  color: var(--muted);
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.45;
}

.reminder-list {
  display: grid;
  gap: 9px;
}

.reminder,
.status-line {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--ink);
}

.reminder span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-preview,
.dish-photo,
.thumb,
.menu-photo {
  background-repeat: no-repeat;
  background-color: #e8edf3;
}

.mini-preview {
  height: 148px;
  border-radius: 8px;
  background-size: cover;
  margin-bottom: 12px;
}

.totem-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 12px;
}

code {
  color: var(--blue);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.tree-list div {
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.8fr);
  min-width: 0;
}

.tree-list div > * {
  min-width: 0;
}

.publish-list div {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 5px 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.publish-list span {
  grid-column: 2;
  color: var(--muted);
  font-size: 13px;
}

.check-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.check-list li {
  padding: 10px 10px 10px 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  position: relative;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 16px;
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--teal);
}

.summary-grid {
  grid-template-columns: repeat(5, 1fr);
}

.primary,
.secondary,
.text-btn,
.chip,
.tabs button,
.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.secondary {
  background: var(--panel-soft);
}

.primary.small,
.secondary.small {
  min-height: 32px;
}

.design-top-toggle.active {
  border-color: var(--blue);
  background: rgba(20, 99, 232, 0.1);
  color: var(--blue);
}

.block {
  width: 100%;
}

.text-btn {
  border-color: transparent;
  background: transparent;
  color: var(--blue);
}

.segmented,
.toolbar,
.category-row,
.tabs,
.date-inline,
.kds-shortcuts,
.pay-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.segmented button,
.tabs button,
.category-row button {
  border-color: transparent;
  background: transparent;
}

.segmented button.active,
.chip.active,
.tabs button.active,
.category-row button.active,
.aux-card.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.ordering-layout,
.orders-layout,
.serving-layout,
.settings-layout {
  display: grid;
  grid-template-columns: minmax(270px, 0.85fr) minmax(420px, 1.25fr) minmax(280px, 0.7fr);
  gap: 14px;
  align-items: start;
}

.orders-layout {
  grid-template-columns: minmax(340px, 0.82fr) minmax(0, 1.18fr);
}

.serving-layout,
.settings-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.6fr);
}

.table-grid,
.takeaway-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.table-tile,
.takeaway-card {
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 12px;
  text-align: left;
}

.table-tile strong,
.table-tile span,
.table-tile small,
.takeaway-card b,
.takeaway-card span,
.takeaway-card small {
  display: block;
}

.table-tile strong {
  font-size: 20px;
}

.table-tile span,
.takeaway-card span {
  margin: 8px 0 4px;
  font-weight: 800;
}

.table-tile small,
.takeaway-card small {
  color: var(--muted);
  line-height: 1.35;
}

.table-tile.free {
  border-color: rgba(18, 146, 97, 0.45);
}

.table-tile.busy {
  border-color: rgba(20, 99, 232, 0.45);
}

.table-tile.unpaid {
  border-color: rgba(225, 75, 82, 0.45);
}

.table-tile.reserved {
  border-color: rgba(119, 83, 215, 0.45);
}

.category-row {
  margin-bottom: 12px;
}

.category-row button {
  min-height: 32px;
  border-radius: 7px;
  padding: 0 10px;
}

.category-row button small {
  font-size: 11px;
  font-weight: 800;
  opacity: 0.78;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
}

.menu-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow: hidden;
}

.menu-photo {
  width: 100%;
  aspect-ratio: 1.45;
  border: 0;
  border-radius: 0;
  background-size: 300% 200%;
  position: relative;
}

.menu-photo b {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  color: #fff;
  background: var(--blue);
  border-radius: 999px;
}

.menu-meta {
  padding: 10px;
}

.menu-meta small,
.menu-meta span,
.menu-meta em {
  color: var(--muted);
  font-size: 12px;
}

.menu-meta strong,
.menu-meta span,
.menu-meta em {
  display: block;
  margin-top: 4px;
}

.menu-meta strong {
  line-height: 1.32;
}

.menu-meta em {
  min-height: 15px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.25;
}

.qty-row {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  border-top: 1px solid var(--line);
}

.qty-row button {
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 18px;
}

.qty-row span {
  text-align: center;
  font-weight: 800;
}

.empty-state {
  min-height: 240px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.cart-lines {
  display: grid;
  gap: 8px;
}

.cart-lines div,
.cart-total {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.cart-total {
  margin: 12px 0;
}

.cart-total strong {
  color: var(--blue);
}

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

input,
select {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.table-head,
.order-row {
  grid-template-columns: minmax(170px, 1fr) 86px 108px;
}

.table-head,
.items-head {
  min-height: 36px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  box-shadow: none;
}

.order-row {
  width: 100%;
  color: var(--ink);
  text-align: left;
}

.order-row.selected {
  border-color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

.order-row small,
.item-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.money {
  color: var(--red);
  font-weight: 800;
}

.detail-header,
.bottom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-header h2 span {
  color: var(--muted);
  font-size: 16px;
}

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

.amount-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.amount {
  min-height: 68px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.amount span,
.amount b {
  display: block;
}

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

.amount b {
  margin-top: 8px;
  font-size: 18px;
}

.amount.orange b {
  color: var(--amber);
}

.amount.red b {
  color: var(--red);
}

.amount.green b {
  color: var(--green);
}

.amount.purple b {
  color: var(--purple);
}

.amount.pink b {
  color: var(--pink);
}

.items-table {
  display: grid;
  gap: 6px;
  max-height: 320px;
  max-width: 100%;
  overflow: auto;
}

.items-table.expanded {
  max-height: 480px;
}

.items-head,
.item-row {
  grid-template-columns: minmax(150px, 1.3fr) 54px 118px 106px 78px 78px 82px 36px;
  min-width: 720px;
}

.item-row {
  min-height: 54px;
  background: var(--panel);
}

.item-row > span {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
}

.thumb {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 7px;
  background-size: 300% 200%;
}

.payment-box {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.pay-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

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

.payment-box p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.long-unpaid {
  min-height: 30px;
  border: 0;
  border-radius: 7px;
  padding: 0 12px;
  color: #fff;
  background: var(--red);
  font-weight: 800;
}

.disabled {
  opacity: 0.48;
}

.line-popover {
  position: fixed;
  right: 36px;
  bottom: 86px;
  z-index: 8;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.line-popover button {
  min-width: 100px;
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--ink);
}

.payment-cards,
.dish-grid,
.menu-definition,
.category-admin,
.allergen-grid,
.note-admin,
.report-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.pay-card,
.dish-card,
.menu-definition article,
.report-card {
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.pay-card strong,
.pay-card span,
.pay-card small,
.dish-card strong,
.dish-card span,
.dish-card b,
.dish-card small {
  display: block;
}

.pay-card strong {
  margin: 8px 0;
  font-size: 22px;
}

.pay-card.green strong {
  color: var(--green);
}

.pay-card.blue strong {
  color: var(--blue);
}

.pay-card.purple strong {
  color: var(--purple);
}

.pay-card.amber strong {
  color: var(--amber);
}

.settled-table {
  margin-top: 14px;
}

.settled-table div {
  grid-template-columns: minmax(160px, 1fr) 100px 100px 180px;
}

.date-inline {
  justify-content: flex-end;
}

.date-inline input {
  width: 160px;
}

.aux-card {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 10px;
}

.refund-table .table-head,
.refund-row {
  grid-template-columns: 1fr 100px 120px 90px 90px 1fr;
}

.serving-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.serve-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.serve-top,
.progress-line,
.kds-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.serve-top b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
}

.serve-status {
  text-align: center;
  font-size: 21px;
  font-weight: 900;
}

.glow-dish {
  padding: 14px;
  border: 1px solid rgba(20, 99, 232, 0.26);
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(90deg, #0e68df, #0ba9c4, #0e68df);
  background-size: 200% 100%;
  animation: sweep 2.2s linear infinite;
  font-weight: 900;
  text-align: center;
}

@keyframes sweep {
  to {
    background-position: 200% 0;
  }
}

.history {
  display: grid;
  gap: 5px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.history span,
.progress-line small,
.kds-row small {
  color: var(--muted);
  font-size: 12px;
}

.serve-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.serve-actions button,
.kds-shortcuts button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
}

.kds-row {
  min-height: 56px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 7px;
  margin-bottom: 8px;
  background: var(--panel-soft);
}

.kds-row span,
.kds-row small {
  display: block;
}

.tabs {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.dish-grid {
  grid-template-columns: repeat(3, 1fr);
}

.dish-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
}

.dish-card small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.dish-card p {
  grid-column: 1 / -1;
  min-height: 38px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dish-tags {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dish-tags span {
  display: inline-flex;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.dish-photo {
  width: 92px;
  height: 92px;
  border-radius: 8px;
  background-size: 300% 200%;
}

.category-admin,
.allergen-grid,
.note-admin {
  grid-template-columns: repeat(5, 1fr);
}

.category-admin button,
.allergen-grid button,
.note-admin button {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  font-weight: 800;
}

.category-admin span,
.allergen-grid span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.ingredient-tree {
  display: grid;
  gap: 8px;
}

.ingredient-tree > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow: hidden;
}

.ingredient-tree button {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 800;
}

.ingredient-tree button b {
  width: 18px;
  color: var(--blue);
}

.ingredient-children {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 12px 12px 38px;
}

.ingredient-children span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}

.bar-chart {
  grid-column: span 2;
  min-height: 260px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: end;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.bar-chart div {
  min-height: var(--h);
  display: flex;
  align-items: end;
  justify-content: center;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--blue), var(--teal));
  color: #fff;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.report-card strong,
.report-card span {
  display: block;
}

.report-card span {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.5;
}

.setting-list {
  gap: 10px;
}

.setting-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 48px;
  align-items: center;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.setting-row strong,
.setting-row small {
  display: block;
}

.setting-row small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.setting-row input {
  position: absolute;
  opacity: 0;
}

.setting-row i {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #aab5c4;
  position: relative;
}

.setting-row i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}

.setting-row input:checked + i {
  background: var(--blue);
}

.setting-row input:checked + i::after {
  transform: translateX(20px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 15, 28, 0.48);
}

.modal {
  width: min(440px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal.large {
  width: min(760px, 100%);
}

.text-edit-modal {
  width: min(840px, 100%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stepper-row {
  min-height: 48px;
  display: grid;
  grid-template-columns: 1fr 38px 44px 38px;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.stepper-row button {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 18px;
}

.stepper-row b {
  text-align: center;
}

.customer-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.customer-card span,
.customer-card small {
  color: var(--muted);
}

.dish-form {
  display: grid;
  grid-template-columns: 180px repeat(2, 1fr);
  gap: 12px;
}

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

.dish-form select[multiple] {
  min-height: 88px;
  padding-top: 7px;
}

.text-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.text-edit-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.text-edit-grid label.wide {
  grid-column: 1 / -1;
}

.text-edit-grid textarea {
  min-height: 120px;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
}

.text-edit-grid textarea[readonly] {
  color: var(--muted);
}

.upload-box {
  grid-row: span 3;
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 1px dashed var(--blue);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--blue);
  text-align: center;
}

.upload-box span {
  max-width: 130px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #10253f;
  box-shadow: var(--shadow);
}

.design-toolbar {
  position: fixed;
  left: 258px;
  right: 20px;
  bottom: 18px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(20, 99, 232, 0.28);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 16px 40px rgba(14, 30, 54, 0.18);
  backdrop-filter: blur(16px);
}

.design-toolbar strong,
.design-toolbar span {
  display: block;
}

.design-toolbar strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
}

.design-toolbar span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

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

.design-btn {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--blue);
  border-radius: 7px;
  background: var(--blue);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.design-btn.ghost {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--ink);
}

.design-import-input {
  display: none;
}

.design-inspector {
  position: fixed;
  top: 78px;
  right: 18px;
  bottom: 86px;
  z-index: 29;
  width: min(360px, calc(100vw - 36px));
  display: none;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(14, 30, 54, 0.16);
}

.design-inspector.open {
  display: block;
}

.design-inspector-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.design-inspector h2,
.design-inspector h3 {
  font-size: 15px;
}

.design-inspector p,
.design-muted,
.design-empty,
.design-comment-box small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.design-comment-box {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(20, 99, 232, 0.22);
  border-radius: 8px;
  background: rgba(20, 99, 232, 0.06);
}

.design-comment-box span {
  font-weight: 800;
  font-size: 13px;
}

.design-comment-box textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.design-section {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.design-version-row,
.design-change-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--ink);
  text-align: left;
}

.design-version-row span,
.design-version-row small,
.design-change-row b,
.design-change-row span,
.design-change-row small {
  display: block;
}

.design-version-row button {
  min-height: 28px;
  border: 1px solid var(--blue);
  border-radius: 7px;
  background: var(--blue);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.design-change-row {
  display: grid;
  justify-content: stretch;
}

.design-change-row.active {
  border-color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

.design-change-row span,
.design-change-row small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.design-mode-on .design-block {
  position: relative;
  outline: 1px dashed rgba(20, 99, 232, 0.2);
  outline-offset: -3px;
}

.design-mode-on .design-block:hover {
  outline-color: rgba(20, 99, 232, 0.75);
}

.design-tool {
  position: absolute;
  z-index: 12;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(20, 99, 232, 0.32);
  border-radius: 7px;
  background: #ffffff;
  color: var(--blue);
  box-shadow: 0 8px 18px rgba(14, 30, 54, 0.16);
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

:root[data-theme="dark"] .design-tool {
  background: #102033;
}

.design-block:hover > .design-tool,
.design-block.is-design-dragging > .design-tool,
.design-block.is-design-resizing > .design-tool {
  opacity: 1;
}

.design-drag {
  top: 6px;
  left: 6px;
  cursor: grab;
}

.design-resize {
  right: 6px;
  bottom: 6px;
  transform: rotate(45deg);
  cursor: nwse-resize;
}

.is-design-dragging {
  z-index: 25;
  opacity: 0.92;
  cursor: grabbing;
  box-shadow: 0 18px 42px rgba(14, 30, 54, 0.18);
}

.is-design-resizing {
  outline-color: var(--amber);
}

.design-editable-text {
  border-radius: 4px;
  outline: 1px dashed transparent;
  outline-offset: 2px;
}

.design-editable-text:hover {
  outline-color: rgba(15, 159, 138, 0.55);
}

.is-design-editing {
  outline: 2px solid var(--teal);
  background: color-mix(in srgb, var(--panel) 88%, var(--teal));
}

.mobile-menu {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .design-toolbar {
    left: 228px;
  }

  .kpi-grid,
  .payment-cards,
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid,
  .ordering-layout,
  .orders-layout,
  .serving-layout,
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .rule-grid,
  .serving-grid,
  .dish-grid,
  .report-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .design-toolbar {
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: grid;
  }

  .design-toolbar-actions {
    justify-content: stretch;
  }

  .design-btn {
    flex: 1 1 auto;
  }

  .design-inspector {
    top: 92px;
    right: 12px;
    bottom: 120px;
    width: calc(100vw - 24px);
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
  }

  .nav-list,
  .manage-drawer.open {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content {
    padding: 14px;
  }

  .topbar,
  .section-head,
  .detail-header {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .top-actions::-webkit-scrollbar {
    display: none;
  }

  .mobile-menu {
    display: inline-grid;
  }

  .kpi-grid,
  .table-grid,
  .takeaway-grid,
  .menu-grid,
  .rule-grid,
  .summary-grid,
  .payment-cards,
  .dish-grid,
  .menu-definition,
  .category-admin,
  .allergen-grid,
  .note-admin,
  .serving-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .system-row,
  .tree-list div,
  .settled-table div,
  .refund-table .table-head,
  .refund-row,
  .table-head,
  .order-row {
    grid-template-columns: 1fr;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .amount-grid,
  .pay-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .flow-strip {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  .items-table {
    overflow-x: auto;
  }

  .items-head,
  .item-row {
    min-width: 820px;
  }

  .dish-form,
  .text-edit-grid {
    grid-template-columns: 1fr;
  }

  .upload-box {
    grid-row: auto;
  }
}
