:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --text: #1f2430;
  --muted: #717784;
  --line: #e4e7ec;
  --nav: #202631;
  --nav-2: #2a3140;
  --accent: #8155a2;
  --accent-2: #6d458d;
  --success: #18885b;
  --warning: #b56a00;
  --danger: #b64242;
  --shadow: 0 8px 24px rgba(21, 27, 38, .08);
  --radius: 14px;
  --rail: 220px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(129,85,162,.28); outline-offset: 2px; }
.app-frame { min-height: 100vh; display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); }
.nav-rail { position: sticky; top: 0; height: 100vh; background: linear-gradient(180deg, var(--nav), #171c25); color: #f6f7f9; display: flex; flex-direction: column; padding: 16px 12px; z-index: 30; }
.brand { min-height: 56px; display: flex; gap: 11px; align-items: center; color: inherit; text-decoration: none; padding: 8px; margin-bottom: 12px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; letter-spacing: -.04em; background: linear-gradient(145deg, #9c6cbe, #68428a); box-shadow: 0 8px 20px rgba(0,0,0,.24); }
.brand-copy { display: grid; line-height: 1.15; }
.brand-copy strong { font-size: 14px; }
.brand-copy small { color: #aeb5c2; font-size: 11px; margin-top: 3px; }
.app-nav { display: grid; gap: 3px; overflow: auto; padding-right: 2px; }
.app-nav a { min-height: 44px; display: flex; align-items: center; gap: 10px; border-radius: 10px; padding: 0 12px; color: #cdd2db; text-decoration: none; font-size: 14px; font-weight: 560; }
.app-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.app-nav a[aria-current="page"] { background: rgba(129,85,162,.28); color: #fff; box-shadow: inset 3px 0 0 #a978ca; }
.nav-footer { margin-top: auto; min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 10px; color: #9fa6b3; font-size: 12px; }
.nav-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #42c98b; box-shadow: 0 0 0 4px rgba(66,201,139,.1); }
.app-main { min-width: 0; }
.topbar { height: 68px; position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 0 22px; }
.command-wrap { min-width: 240px; max-width: 660px; flex: 1; height: 42px; border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; background: #f8f9fb; padding: 0 10px; }
.command-wrap:focus-within { border-color: #bda7cc; background: #fff; box-shadow: 0 0 0 3px rgba(129,85,162,.08); }
.search-icon { font-size: 20px; color: var(--muted); margin-right: 6px; transform: rotate(-20deg); }
#global-search { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
kbd { border: 1px solid #d9dde3; border-bottom-width: 2px; border-radius: 6px; background: #fff; color: #8a909a; padding: 2px 6px; font-size: 10px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.system-health { min-height: 32px; display: flex; align-items: center; padding: 0 10px; border-radius: 999px; background: #eef8f4; color: var(--success); font-size: 12px; font-weight: 700; }
.profile-chip { min-height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 11px; display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 5px; color: var(--text); }
.profile-chip span { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: #ece4f3; color: var(--accent-2); font-weight: 800; font-size: 11px; }
.profile-chip strong { font-size: 12px; }
.mobile-menu { display: none; min-width: 44px; min-height: 44px; border: 0; background: transparent; border-radius: 10px; }
.workspace { min-height: calc(100vh - 68px); padding: 24px; }
.workspace-header { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.workspace-title { margin: 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.04em; }
.workspace-subtitle { color: var(--muted); margin: 6px 0 0; font-size: 13px; }
.empty-module { min-height: 420px; display: grid; place-items: center; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.empty-module h2 { margin: 0 0 8px; }
.empty-module p { margin: 0; color: var(--muted); max-width: 520px; }
#toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 100; }
@media (max-width: 900px) {
  :root { --rail: 74px; }
  .brand-copy, .app-nav a { font-size: 0; }
  .app-nav a::first-letter { font-size: 13px; }
  .app-nav a { justify-content: center; padding: 0 6px; }
  .nav-footer span:last-child { display: none; }
  .workspace { padding: 16px; }
}
@media (max-width: 680px) {
  .app-frame { grid-template-columns: 1fr; }
  .nav-rail { position: fixed; width: min(82vw, 270px); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 15px 0 35px rgba(0,0,0,.25); }
  body.nav-open .nav-rail { transform: translateX(0); }
  .brand-copy, .app-nav a { font-size: revert; }
  .app-nav a { justify-content: flex-start; padding: 0 12px; }
  .mobile-menu { display: block; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-actions .profile-chip strong, kbd { display: none; }
  .system-health { display: none; }
  .workspace { min-height: calc(100vh - 68px); }
}
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.metric-card { min-height: 136px; display: flex; flex-direction: column; justify-content: space-between; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px; box-shadow: 0 3px 14px rgba(21,27,38,.04); }
.metric-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-value { font-size: 26px; letter-spacing: -.035em; }
.metric-value.not_connected { font-size: 18px; color: #9a6a35; }
.metric-card small { color: #969ca6; font-size: 11px; }
.dashboard-section { margin-top: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.section-heading h2 { margin: 0; font-size: 17px; }.section-heading p { margin: 5px 0 14px; color: var(--muted); font-size: 12px; }
.quick-module-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.quick-module { min-height: 110px; padding: 15px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); text-decoration: none; color: var(--text); display: flex; flex-direction: column; justify-content: space-between; }
.quick-module:hover { border-color: #c9bad5; box-shadow: 0 7px 18px rgba(41,28,52,.07); transform: translateY(-1px); }
.quick-module span { color: var(--muted); font-size: 11px; line-height: 1.4; }
.primary-action { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 16px; border-radius: 11px; background: var(--accent); color: #fff; text-decoration: none; font-weight: 750; font-size: 13px; }
@media (max-width: 980px) { .dashboard-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .quick-module-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 560px) { .dashboard-grid, .quick-module-grid { grid-template-columns: 1fr; } }
.pos-workspace { margin: -24px; min-height: calc(100vh - 68px); display: flex; flex-direction: column; background: #eef0f3; }
.pos-context-bar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: #fff; }
.pos-context-group { display: flex; gap: 8px; flex-wrap: wrap; }
.context-chip { min-height: 50px; min-width: 128px; border: 1px solid var(--line); background: #fff; border-radius: 11px; padding: 7px 12px; text-align: left; display: grid; gap: 2px; color: var(--text); }
.context-chip small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.context-chip strong { font-size: 13px; }
.context-chip-primary { border-color: #cbb9d8; background: #f6f0fa; }
.pos-mode-badge { padding: 7px 12px; border-radius: 999px; background: #eaf7f1; color: var(--success); font-size: 11px; font-weight: 800; }
.pos-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 410px; }
.product-browser { min-width: 0; padding: 16px; overflow: auto; }
.product-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.product-search-wrap { flex: 1; min-height: 46px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: #fff; border: 1px solid var(--line); border-radius: 11px; }
.product-search-wrap input { flex: 1; border: 0; outline: 0; min-width: 0; background: transparent; }
.category-row { display: flex; gap: 7px; overflow: auto; padding-bottom: 12px; }
.category-pill { min-height: 38px; white-space: nowrap; border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 0 14px; font-size: 12px; font-weight: 700; }
.category-pill.active { background: var(--nav); border-color: var(--nav); color: #fff; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 10px; align-content: start; }
.product-card { min-height: 134px; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: var(--text); padding: 13px; text-align: left; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 2px 10px rgba(21,27,38,.035); }
.product-card small { color: var(--muted); line-height: 1.35; }
.product-empty { grid-column: 1 / -1; min-height: 220px; align-items: center; justify-content: center; text-align: center; border-style: dashed; color: #7d838d; }
.product-icon { width: 42px; height: 42px; border-radius: 12px; background: #f1ebf5; color: var(--accent); display: grid; place-items: center; font-size: 24px; margin-bottom: 9px; }
.product-thumb { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; margin-bottom: 9px; background: var(--panel-2); }
.product-initial { width: 36px; height: 36px; border-radius: 10px; background: #f1ebf5; color: var(--accent); display: grid; place-items: center; font-size: 16px; font-weight: 800; margin-bottom: 9px; }
.ticket-panel { min-width: 0; background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: calc(100vh - 144px); }
.ticket-head { min-height: 74px; display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.ticket-head small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }.ticket-head h2 { margin: 2px 0 0; font-size: 18px; }
.icon-action { min-width: 44px; min-height: 44px; border: 1px solid var(--line); background: #fff; border-radius: 10px; }
.order-context { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.order-context label { display: grid; gap: 4px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .04em; font-weight: 800; }
.order-context select { min-height: 38px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); padding: 0 7px; font-size: 11px; }
.ticket-lines { flex: 1; min-height: 220px; overflow: auto; padding: 12px; }
.ticket-empty { min-height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.ticket-empty > span { font-size: 32px; color: #bdc2ca; margin-bottom: 8px; }.ticket-empty strong { color: var(--text); }.ticket-empty small { margin-top: 4px; }
.ticket-actions { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; padding: 10px 12px; border-top: 1px solid var(--line); }
.touch-action { min-height: 44px; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 9px; padding: 0 10px; font-weight: 700; font-size: 11px; }
.touch-action.compact { min-width: 100px; }.touch-action.wide { grid-column: 1 / -1; background: #f3f4f6; }.accent-outline { color: var(--accent-2); border-color: #cbb9d8; background: #faf7fc; }
.ticket-totals { border-top: 1px solid var(--line); padding: 11px 14px; display: grid; gap: 8px; }.ticket-totals > div { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; }.ticket-totals strong { color: var(--text); }.grand-total { font-size: 15px !important; }.grand-total strong { font-size: 21px; letter-spacing: -.03em; }
.bottom-payment-bar { display: grid; grid-template-columns: 120px 1fr; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: #fafbfc; }
.split-action, .payment-action { min-height: 52px; border-radius: 11px; font-weight: 800; }.split-action { border: 1px solid #c9ced5; background: #fff; color: var(--text); }.payment-action { border: 0; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; }.payment-action:hover { background: var(--accent-2); }
@media (max-width: 1060px) { .pos-layout { grid-template-columns: minmax(0,1fr) 350px; } .context-chip { min-width: 105px; } }
@media (max-width: 800px) { .pos-workspace { margin: -16px; } .pos-layout { grid-template-columns: 1fr; }.ticket-panel { border-left: 0; border-top: 1px solid var(--line); min-height: 620px; }.pos-context-bar { align-items: flex-start; }.pos-mode-badge { display:none; } }
.bridge-header { align-items: center; }
.secondary-action { min-height: 42px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text); text-decoration: none; font-size: 12px; font-weight: 750; }
.module-bridge { height: calc(100vh - 156px); min-height: 520px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.menu-admin-cat { margin-bottom: 28px; }
.menu-admin-cat h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: baseline; gap: 8px; }
.menu-admin-cat h2 small { color: var(--muted); font-weight: 600; font-size: 11px; }
.menu-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.menu-admin-item { border: 1px solid var(--line); border-radius: 13px; background: #fff; overflow: hidden; box-shadow: 0 2px 10px rgba(21,27,38,.035); }
.menu-admin-item.inactive { opacity: .55; }
.menu-admin-thumb { height: 96px; background: #f3f4f6; display: flex; align-items: center; justify-content: center; }
.menu-admin-thumb img { width: 100%; height: 100%; object-fit: cover; }
.menu-admin-thumb .no-photo { font-size: 11px; color: var(--muted); }
.menu-admin-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.menu-admin-body strong { font-size: 13px; }
.menu-admin-body > span:not(.payment-badge) { color: var(--muted); font-size: 12px; }
.menu-admin-actions { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.menu-admin-actions .touch-action.compact { min-width: 0; flex: 1; padding: 0 8px; }
.module-bridge iframe { width: 100%; height: 100%; border: 0; background: #fff; }
