:root {
  --bg: #f5f7f4;
  --panel: #ffffff;
  --ink: #17211b;
  --muted: #68726d;
  --line: #dfe5de;
  --green: #25745b;
  --green-dark: #15513e;
  --amber: #d59131;
  --red: #c8554b;
  --mint: #e8f3ed;
  --shadow: 0 18px 50px rgba(24, 34, 29, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(37, 116, 91, 0.08), transparent 36%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

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

.pos-shell.module-mode {
  grid-template-columns: 232px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: #101b16;
  color: #f7fbf8;
}

.brand,
.operator,
.cart-header,
.totals div,
.receipt header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  justify-content: flex-start;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--amber);
  color: #101b16;
  font-weight: 800;
}

.brand small,
.operator small,
.shift-card small {
  display: block;
  color: rgba(255, 255, 255, 0.64);
}

.nav-stack {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
}

.nav-item[hidden] {
  display: none;
}

.nav-item span:first-child {
  display: grid;
  min-width: 30px;
  height: 28px;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.7rem;
  font-weight: 900;
}

.nav-item.is-active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.shift-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.shift-card span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
}

.shift-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 1.45rem;
}

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

.module-view {
  display: grid;
  gap: 18px;
}

.module-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.module-card,
.module-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 25px rgba(24, 34, 29, 0.05);
}

.module-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.module-card h2,
.module-table-wrap h2 {
  margin: 0;
  font-size: 1.1rem;
}

.module-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.module-card input,
.module-card select,
.module-card textarea {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.module-card textarea {
  min-height: 76px;
  padding: 10px;
}

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

.table-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.mini-button {
  min-width: 0;
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.8rem;
}

.danger-button {
  border-color: rgba(200, 85, 75, 0.32);
  color: var(--red);
}

.module-table-wrap {
  overflow: auto;
}

.module-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 800;
}

.module-empty {
  padding: 18px;
  color: var(--muted);
}

.cart-panel[hidden] {
  display: none;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.5rem;
}

.operator {
  justify-content: flex-start;
  min-width: 230px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

.logout-link {
  margin-left: auto;
  color: var(--red);
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1eb980;
  box-shadow: 0 0 0 5px rgba(30, 185, 128, 0.12);
}

.order-meta,
.search-row,
.category-tabs,
.payment-methods {
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-meta {
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.order-meta label {
  display: grid;
  gap: 6px;
  min-width: 150px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.order-meta input,
.order-meta select,
.search-box input,
.note-box textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  outline: 0;
}

.order-meta input,
.order-meta select {
  height: 42px;
  padding: 0 12px;
}

.service-toggle,
.payment-methods {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

.cash-panel[hidden] {
  display: none;
}

.cash-panel label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.cash-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.cash-input-row input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.change-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
}

.change-row strong {
  color: var(--green-dark);
  font-size: 1.1rem;
}

.service-toggle button,
.category-tabs button,
.payment-methods button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.service-toggle button,
.payment-methods button {
  padding: 0 12px;
}

.service-toggle .is-selected,
.payment-methods .is-selected {
  background: var(--green);
  color: #ffffff;
}

.search-row {
  margin-bottom: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.search-box input {
  height: 44px;
  padding: 0;
  border: 0;
}

.icon-button,
.ghost-button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
}

.ghost-button {
  padding: 0 14px;
}

.category-tabs {
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.analytics-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.analytics-strip article {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.analytics-strip span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.analytics-strip strong {
  color: var(--green-dark);
  font-size: 1.12rem;
}

.category-tabs button {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.category-tabs button.is-active {
  border-color: var(--green);
  background: var(--mint);
  color: var(--green-dark);
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.menu-card {
  display: grid;
  gap: 12px;
  min-height: 190px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 25px rgba(24, 34, 29, 0.05);
}

.menu-card:hover {
  border-color: rgba(37, 116, 91, 0.42);
  transform: translateY(-1px);
}

.item-art {
  display: grid;
  min-height: 84px;
  place-items: center;
  border-radius: 8px;
  background: var(--item-bg);
  color: var(--item-ink);
  font-size: 2.2rem;
  font-weight: 800;
}

.menu-card h3 {
  margin: 0;
  font-size: 1rem;
}

.menu-card p {
  min-height: 34px;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-footer strong {
  color: var(--green-dark);
}

.add-button {
  min-width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  font-size: 1.2rem;
}

.cart-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.cart-list {
  display: grid;
  align-content: start;
  gap: 8px;
  flex: 1 1 180px;
  min-height: 120px;
  overflow-y: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
}

.empty-cart {
  display: grid;
  min-height: 150px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.cart-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 78px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.cart-item h3 {
  margin: 0 0 4px;
  font-size: 0.96rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.cart-item small {
  color: var(--muted);
  display: block;
  line-height: 1.35;
}

.cart-item > div:last-child {
  display: grid;
  justify-items: end;
  align-content: center;
  gap: 6px;
  min-width: 104px;
}

.cart-item > div:last-child strong {
  line-height: 1;
  white-space: nowrap;
}

.qty-control {
  display: grid;
  grid-template-columns: 32px 32px 32px;
  align-items: center;
  height: 32px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qty-control button {
  height: 100%;
  border: 0;
  background: #f4f7f4;
  color: var(--ink);
  font-weight: 800;
}

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

.note-box {
  display: grid;
  flex: 0 0 auto;
  gap: 6px;
}

.note-box label,
.recent-sales h3 {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.note-box textarea {
  min-height: 52px;
  max-height: 78px;
  padding: 10px 12px;
  resize: vertical;
}

.totals {
  display: grid;
  flex: 0 0 auto;
  gap: 7px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

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

.grand-total {
  padding-top: 6px;
  font-size: 1.18rem;
}

.checkout-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #ffffff;
  font-weight: 900;
}

.checkout-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.recent-sales {
  display: grid;
  gap: 10px;
  flex: 0 0 auto;
  max-height: 92px;
  overflow: auto;
}

.ops-panel {
  display: grid;
  flex: 0 0 auto;
  gap: 8px;
  padding-top: 4px;
}

.ops-panel small {
  color: var(--muted);
  line-height: 1.4;
}

.pos-status {
  display: block;
  flex: 0 0 auto;
  color: var(--muted);
  line-height: 1.35;
}

.wide {
  width: 100%;
}

.sale-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.sale-row strong {
  color: var(--ink);
}

.receipt-modal {
  width: min(420px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.receipt-modal::backdrop {
  background: rgba(16, 27, 22, 0.45);
}

.receipt {
  display: grid;
  gap: 16px;
  padding: 10px;
}

.receipt-pages {
  display: grid;
  gap: 14px;
}

.receipt-copy {
  display: grid;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}

.receipt-copy h3 {
  margin: 0;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.receipt-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.install-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.login-card input {
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.login-card small,
.login-error {
  color: var(--muted);
  line-height: 1.45;
}

.login-error {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff0ef;
  color: var(--red);
  font-weight: 800;
}

.install-card {
  display: grid;
  gap: 16px;
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.install-link {
  text-decoration: none;
}

@media print {
  body * {
    visibility: hidden;
  }

  .receipt-modal,
  .receipt-modal * {
    visibility: visible;
  }

  .receipt-modal {
    position: fixed;
    inset: 0;
    width: 80mm;
    box-shadow: none;
  }

  .receipt-copy {
    min-height: 100vh;
    page-break-after: always;
    border-bottom: 0;
  }

  .receipt-copy:last-child {
    page-break-after: auto;
  }

  .no-print,
  .checkout-button {
    display: none;
  }
}

@media (max-width: 1100px) {
  .pos-shell {
    grid-template-columns: 84px minmax(0, 1fr) 360px;
  }

  .sidebar {
    padding: 18px 12px;
  }

  .brand div,
  .nav-item span:last-child,
  .shift-card {
    display: none;
  }

  .nav-item {
    justify-content: center;
  }
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto 1fr;
    padding: 12px;
  }

  .nav-stack {
    display: flex;
    justify-content: flex-end;
  }

  .menu-panel,
  .cart-panel {
    padding: 18px;
  }

  .cart-panel {
    max-height: none;
    border-left: 0;
  }

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

@media (max-width: 560px) {
  .topbar,
  .cart-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .operator {
    width: 100%;
  }

  .service-toggle,
  .payment-methods {
    width: 100%;
    overflow-x: auto;
  }

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

  .analytics-strip {
    grid-template-columns: 1fr 1fr;
  }
}
