:root {
  color-scheme: light;
  --bg: #fbfcff;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --surface-soft: #f5f7fa;
  --surface-muted: #edf3f7;
  --border: rgba(36, 55, 82, 0.13);
  --border-strong: rgba(36, 55, 82, 0.24);
  --text: #141b29;
  --text-soft: #5a687d;
  --text-muted: #8a96a8;
  --brand: #0ea5b7;
  --brand-strong: #073142;
  --brand-soft: rgba(14, 165, 183, 0.1);
  --success: #0f766e;
  --success-soft: rgba(15, 118, 110, 0.1);
  --shadow: 0 28px 80px rgba(15, 23, 42, 0.08);
  --radius-xl: 34px;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  max-width: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -8%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 32%),
    radial-gradient(circle at 104% 8%, rgba(37, 99, 235, 0.09), transparent 30%),
    linear-gradient(180deg, var(--bg) 0%, #f4f7fb 100%);
  font-family: "Helvetica Neue", "Avenir Next", "SF Pro Display", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

::-webkit-scrollbar {
  display: none;
}

.pos-shell {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 28vw, 380px);
  gap: clamp(14px, 1.8vw, 22px);
  padding: clamp(12px, 1.5vw, 18px) clamp(14px, 2vw, 24px) clamp(14px, 1.8vw, 22px);
  min-width: 0;
  isolation: isolate;
  overflow: hidden;
}

.pos-left,
.ticket-panel {
  min-height: 0;
  overflow: hidden;
}

.pos-left {
  display: grid;
  grid-template-rows: auto 50px minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  height: calc(100dvh - clamp(26px, 3.3vw, 40px));
  min-height: 550px;
}

.pos-header {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  min-height: 0;
  overflow: hidden;
}

.pos-header > div:first-child {
  flex: 1 1 300px;
  min-width: 0;
}

.brand-line {
  display: contents;
}

.brand-line img {
  display: none;
}

.pos-eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 0.68rem;
  font-weight: 820;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--text);
}

h1 {
  font-size: clamp(2.25rem, 3.4vw, 3.75rem);
  line-height: 0.96;
  letter-spacing: -0.08em;
  font-weight: 820;
}

h2 {
  font-size: 1.45rem;
  font-weight: 820;
  letter-spacing: -0.06em;
}

.pos-subtitle,
.ticket-header p,
.micro-status,
#posCacheStatus,
.product-meta {
  color: var(--text-muted);
  font-weight: 430;
  line-height: 1.5;
}

.pos-subtitle {
  max-width: 680px;
  margin: 8px 0 0;
  font-size: 0.98rem;
}

.header-actions {
  flex: 1 1 auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  min-width: 240px;
}

.pos-statusbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.status-pill {
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.76rem;
  font-weight: 780;
}

.ghost-button {
  min-height: 30px;
  border-radius: 999px;
  padding: 0 11px;
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 760;
}

.pos-search input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  outline: none;
  padding: 7px 2px;
  font-size: 1rem;
}

.pos-search input:focus {
  border-bottom-color: var(--brand);
}

#posCacheStatus {
  margin: 4px 0 0;
  font-size: 0.68rem;
}

.category-chips {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.category-chips button {
  min-width: fit-content;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  font-weight: 760;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.category-chips button:hover,
.category-chips button.active {
  background: var(--surface-muted);
  color: var(--text);
  transform: translateY(-1px);
}

.category-chips button::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 18px color-mix(in srgb, var(--brand) 60%, transparent);
}

.product-grid {
  min-height: 0;
  height: 100%;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 240px));
  gap: clamp(12px, 1.4vw, 16px);
  align-content: start;
  padding-right: 4px;
  scrollbar-width: none;
  min-width: 0;
}

.product-card {
  min-height: 246px;
  display: grid;
  grid-template-rows: 118px 1fr;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 26px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.045);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--brand) 24%, var(--border));
  box-shadow: var(--shadow);
}

.product-visual {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.8), transparent 24%),
    linear-gradient(135deg, var(--art-a, #2563eb), var(--art-b, #22d3ee));
  color: rgba(255, 255, 255, 0.9);
  font-size: 2rem;
  font-weight: 820;
  letter-spacing: -0.08em;
}

.product-visual::before {
  content: "";
  width: 76px;
  height: 76px;
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.08)),
    rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 18px 40px rgba(0, 0, 0, 0.12);
  transform: rotate(-12deg);
}

.product-visual span {
  position: absolute;
  z-index: 2;
}

.stock-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #0f172a;
  font-size: 0.72rem;
  font-weight: 780;
  backdrop-filter: blur(10px);
}

.product-body {
  display: grid;
  gap: 8px;
  padding: 15px;
}

.product-code {
  color: var(--brand);
  font-size: 0.66rem;
  font-weight: 820;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.product-name {
  min-height: 42px;
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 820;
  line-height: 1.18;
  letter-spacing: -0.035em;
}

.product-meta {
  font-size: 0.78rem;
}

.product-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 15px 15px;
}

.product-price {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 820;
  letter-spacing: -0.05em;
}

.add-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 1.25rem;
  line-height: 1;
}

.ticket-panel {
  display: grid;
  grid-template-rows: 138px minmax(0, 1fr) auto auto;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  width: clamp(320px, 28vw, 380px);
  max-width: 100%;
  height: calc(100dvh - clamp(26px, 3.3vw, 40px));
  min-width: 0;
}

.ticket-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.ticket-header p {
  margin: 8px 0 0;
  font-size: 0.88rem;
}

.ticket-header .ghost-button {
  background: transparent;
  color: var(--text-muted);
}

.cart-items {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px 20px;
  scrollbar-width: none;
}

.empty-state {
  align-self: center;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  padding: 24px;
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 58%, transparent);
}

.cart-item strong {
  color: var(--text);
  font-weight: 800;
  line-height: 1.25;
}

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

.cart-actions button {
  min-width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 820;
}

.totals {
  display: grid;
  gap: 8px;
  padding: 16px 24px 0;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px);
}

.totals div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--text-soft);
}

.totals strong {
  color: var(--text);
}

.muted-row {
  display: none !important;
}

.total-row {
  color: var(--text) !important;
  font-size: 1.45rem;
  font-weight: 820;
  letter-spacing: -0.055em;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.checkout {
  display: grid;
  gap: 10px;
  padding: 10px 24px 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.checkout select {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 12px;
  background: var(--surface-soft);
  color: var(--text);
}

.primary-button {
  min-height: 56px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--brand-strong), #071827);
  color: #fff;
  font-weight: 820;
  box-shadow: 0 22px 50px color-mix(in srgb, var(--brand) 20%, transparent);
}

.primary-button:disabled {
  background: #83919f;
  box-shadow: none;
  cursor: not-allowed;
}

.micro-status {
  display: none;
}

@media (max-width: 1200px) {
  body {
    overflow: auto;
  }

  .pos-shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    width: 100%;
    min-width: 0;
    overflow: visible;
  }

  .pos-left {
    min-height: auto;
    height: auto;
  }

  .ticket-panel {
    width: 100%;
    min-height: 620px;
    height: auto;
  }
}
