:root {
  color-scheme: dark;
  --bg: #030705;
  --bg-soft: #07110d;
  --panel: rgba(7, 18, 13, 0.92);
  --panel-strong: rgba(10, 28, 19, 0.96);
  --ink: #ecfff5;
  --muted: #8ead9d;
  --line: rgba(77, 255, 158, 0.18);
  --brand: #39ff88;
  --brand-2: #00c46a;
  --brand-dark: #05733e;
  --acid: #c7ff4f;
  --danger: #ff5d5d;
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.42);
  --glow: 0 0 22px rgba(57, 255, 136, 0.26);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 10%, rgba(57, 255, 136, 0.18), transparent 28%),
    radial-gradient(circle at 86% 18%, rgba(199, 255, 79, 0.11), transparent 24%),
    linear-gradient(180deg, #020403 0, #07110d 42%, #030705 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(57, 255, 136, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 255, 136, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent 72%);
}

.locked-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.locked-shell {
  position: relative;
  width: min(460px, 100%);
}

.locked-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  background:
    radial-gradient(circle at top right, rgba(63, 255, 141, 0.2), transparent 38%),
    linear-gradient(145deg, rgba(4, 28, 15, 0.96), rgba(1, 9, 5, 0.96));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45), 0 0 42px rgba(40, 255, 128, 0.12);
}

.locked-card h1 {
  margin: 8px 0 12px;
  font-size: clamp(2rem, 8vw, 3.4rem);
  line-height: 0.95;
}

.locked-card .primary-action {
  width: 100%;
  min-height: 56px;
  margin-top: 20px;
}

.locked-status {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
}

button,
input {
  font: inherit;
}

button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(236, 255, 245, 0.06);
  color: var(--ink);
  font-weight: 800;
  padding: 0 14px;
  touch-action: manipulation;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

button:active {
  transform: translateY(1px) scale(0.99);
}

.primary,
.primary-action {
  border-color: rgba(57, 255, 136, 0.68);
  background: linear-gradient(180deg, #43ff91, #00a95c);
  color: #021108;
  box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.app-shell {
  position: relative;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom));
}

.topbar,
.section-heading,
.action-row,
.payment-actions,
.status-panel,
.section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar,
.section-heading,
.status-panel {
  justify-content: space-between;
}

.topbar {
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--acid);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.7rem;
  text-shadow: 0 0 18px rgba(57, 255, 136, 0.28);
}

h2 {
  margin-bottom: 12px;
  font-size: 1.08rem;
}

.pill {
  border-radius: 999px;
}

.status-panel,
.scanner-panel,
.cart-panel,
.product-form,
.setup-list article,
.receipt-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.status-panel {
  padding: 12px;
  margin-bottom: 12px;
}

.status-panel p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 7px;
  background: var(--acid);
  box-shadow: 0 0 14px rgba(199, 255, 79, 0.5);
}

.status-dot.online {
  background: var(--brand);
}

.tabbar {
  position: sticky;
  top: max(8px, env(safe-area-inset-top));
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.tab {
  min-height: 46px;
  padding: 0 8px;
  color: #b7dac9;
  background: rgba(2, 10, 6, 0.78);
}

.tab.active {
  border-color: rgba(57, 255, 136, 0.8);
  color: #021108;
  background: linear-gradient(180deg, #d8ff9c, #39ff88);
  box-shadow: var(--glow);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.82fr);
  gap: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 116px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(circle at 80% 20%, rgba(57, 255, 136, 0.14), transparent 34%),
    var(--panel);
  box-shadow: var(--shadow);
}

.metric-card span {
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
}

.metric-card strong {
  color: var(--brand);
  font-size: clamp(1.5rem, 5vw, 2.3rem);
}

.scanner-panel,
.cart-panel {
  padding: 14px;
}

.hero-total {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  padding: 18px;
  border: 1px solid rgba(57, 255, 136, 0.32);
  border-radius: 14px;
  background:
    radial-gradient(circle at 82% 18%, rgba(199, 255, 79, 0.28), transparent 24%),
    linear-gradient(135deg, #020604, #0c2819 58%, #052012);
  color: #fff;
  box-shadow: var(--glow);
}

.hero-total::after {
  content: "";
  position: absolute;
  inset: auto -20% -45% 12%;
  height: 90px;
  border-radius: 50%;
  background: rgba(57, 255, 136, 0.18);
  filter: blur(20px);
}

.hero-total span {
  position: relative;
  color: #baffce;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

.hero-total strong {
  position: relative;
  font-size: clamp(2.35rem, 11vw, 4.6rem);
  line-height: 1;
}

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

.product-search {
  width: 100%;
  margin-top: 12px;
}

.quick-product {
  display: grid;
  align-content: space-between;
  min-height: 92px;
  padding: 12px;
  text-align: left;
  background: linear-gradient(180deg, rgba(236, 255, 245, 0.08), rgba(57, 255, 136, 0.07));
}

.quick-product span {
  color: #c5dece;
  font-size: 0.9rem;
}

.quick-product strong {
  color: var(--brand);
  font-size: 1.28rem;
}

.action-row,
.payment-actions {
  flex-wrap: wrap;
}

.customer-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.action-row button,
.payment-actions button {
  flex: 1;
  min-height: 54px;
}

.payment-actions {
  display: grid;
  grid-template-columns: 1fr;
}

.payment-actions button {
  width: 100%;
}

.camera-frame {
  position: relative;
  overflow: hidden;
  margin-top: 12px;
  border: 1px solid rgba(57, 255, 136, 0.28);
  border-radius: 14px;
  background: #020604;
  aspect-ratio: 4 / 3;
}

.camera-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-frame button {
  position: absolute;
  right: 10px;
  bottom: 10px;
}

.scan-line {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 50%;
  height: 2px;
  background: var(--brand);
  box-shadow: 0 0 20px var(--brand);
}

.amount-entry {
  margin-top: 12px;
}

label {
  display: block;
  margin-bottom: 6px;
  color: #b7dac9;
  font-weight: 900;
}

.money-input {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 6px 6px 12px;
  background: rgba(0, 0, 0, 0.28);
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: rgba(0, 0, 0, 0.32);
  color: var(--ink);
}

input::placeholder {
  color: #668276;
}

.money-input input {
  border: 0;
  padding: 0;
  outline: none;
  background: transparent;
}

.cart-items,
.product-list,
.receipt-list,
.setup-list {
  display: grid;
  gap: 8px;
}

.empty {
  padding: 20px;
  border: 1px dashed rgba(57, 255, 136, 0.26);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
  background: rgba(0, 0, 0, 0.18);
}

.cart-item,
.product-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 11px;
  border: 1px solid rgba(57, 255, 136, 0.14);
  border-radius: 12px;
  background: rgba(236, 255, 245, 0.055);
}

.row-actions,
.receipt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.row-actions button,
.receipt-actions button {
  min-height: 38px;
}

.cart-item small,
.product-row small,
.receipt-card small {
  color: var(--muted);
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quantity-controls button {
  width: 38px;
  min-height: 38px;
  padding: 0;
}

.totals {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.totals div {
  display: flex;
  justify-content: space-between;
}

.grand-total {
  color: var(--brand);
  font-size: 1.5rem;
}

.link-button {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--brand);
  padding: 4px;
  box-shadow: none;
}

.product-form {
  display: grid;
  gap: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.setup-list article {
  padding: 12px;
}

.setup-list p {
  margin: 5px 0 0;
  color: var(--muted);
}

.receipt-card {
  padding: 12px;
}

.sales-summary {
  margin: -4px 0 10px;
  color: var(--muted);
  font-weight: 800;
}

.sales-tools {
  display: grid;
  grid-template-columns: 1fr 150px 150px 150px;
  gap: 8px;
  margin-bottom: 10px;
}

.closeout-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.closeout-summary > div {
  min-height: 74px;
  padding: 12px;
  border: 1px solid rgba(57, 255, 136, 0.2);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
}

.closeout-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.closeout-summary strong {
  display: block;
  margin-top: 8px;
  color: var(--brand);
  font-size: 1.1rem;
}

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

.setup-health > div,
.reader-status-row {
  padding: 12px;
  border: 1px solid rgba(57, 255, 136, 0.2);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
}

.setup-health span,
.reader-status-row small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.setup-health strong {
  display: block;
  margin-top: 6px;
  color: var(--brand);
}

.reader-status-list {
  display: grid;
  gap: 8px;
}

.reader-status-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.reader-status-row > span {
  color: var(--brand);
  font-weight: 900;
}

select {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: rgba(0, 0, 0, 0.32);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.sale-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.sale-row button {
  min-height: 42px;
}

.dialog-card a {
  color: var(--brand);
  font-weight: 900;
}

.dialog-card ul {
  margin: 10px 0;
  padding-left: 18px;
  color: var(--muted);
}

.payment-choice-grid,
.reader-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.payment-choice-grid button,
.reader-list button {
  display: grid;
  gap: 4px;
  min-height: 62px;
  padding: 12px;
  text-align: left;
}

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

dialog {
  width: min(430px, calc(100% - 24px));
  border: 1px solid rgba(57, 255, 136, 0.28);
  border-radius: 14px;
  padding: 0;
  background: var(--panel-strong);
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
}

.dialog-card {
  padding: 16px;
}

.dialog-card menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0;
  margin: 16px 0 0;
}

.dialog-card input {
  margin-top: 8px;
}

.toast {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 10;
  display: none;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 14px;
  border: 1px solid rgba(57, 255, 136, 0.26);
  border-radius: 12px;
  background: #06100b;
  color: #eafff2;
  box-shadow: var(--shadow);
}

.toast.show {
  display: block;
}

@media (min-width: 761px) {
  .payment-actions {
    grid-template-columns: 1.2fr 1fr 0.8fr;
  }
}

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

  .status-panel,
  .topbar {
    align-items: flex-start;
  }

  .status-panel {
    flex-direction: column;
  }

  .status-panel button {
    width: 100%;
  }

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

  .dashboard-grid,
  .closeout-summary,
  .setup-health,
  .customer-strip,
  .sales-tools {
    grid-template-columns: 1fr;
  }
}

@media (display-mode: standalone) {
  .app-shell {
    padding-top: max(18px, env(safe-area-inset-top));
  }
}
