:root {
  --bg: #171719;
  --bg-soft: #1d1d20;
  --card: #242427;
  --card-soft: #2a2a2e;
  --border: #34343a;
  --text: #f3f3f4;
  --muted: #a5a5ab;
  --muted-strong: #8d8d93;
  --accent: #ff642d;
  --accent-soft: #ff8b62;
  --success: #58e2a4;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  --radius-xl: 28px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a,
button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

.app-shell {
  padding: 0 0 40px;
}

.page {
  width: min(100%, 1024px);
  margin: 0 auto;
}

.hero,
.card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero {
  margin: 16px;
  padding: 28px;
  border-radius: var(--radius-xl);
}

.hero__eyebrow,
.section-label {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-strong);
  font-weight: 700;
}

.hero__content {
  display: grid;
  gap: 20px;
}

.hero__kicker {
  margin: 12px 0 0;
  color: var(--success);
  font-weight: 600;
}

.hero h1 {
  margin: 8px 0 0;
  font-size: clamp(2rem, 7vw, 3.4rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.hero__subtitle,
.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.hero__subtitle {
  margin-top: 14px;
  max-width: 36rem;
}

.hero__badge {
  width: fit-content;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--card-soft);
  border: 1px solid var(--border);
}

.hero__badge-label {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  color: var(--muted-strong);
  margin-bottom: 6px;
}

.content-grid {
  display: grid;
  gap: 16px;
  padding: 0 16px;
}

.content-grid--home {
  padding-bottom: 16px;
}

.card {
  border-radius: var(--radius-lg);
  padding: 22px;
}

.section-card {
  display: grid;
  gap: 18px;
}

.section-head,
.card-title--inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-head h2,
.card-title h2,
.state-card h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #303036;
  color: var(--text);
  font-size: 0.86rem;
}

.pill--accent {
  color: #ffd7ca;
}

.access-form,
.feature-list,
.quick-links {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 0.92rem;
}

.field input {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  background: #1e1e21;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.field input:focus {
  outline: none;
  border-color: #4a4a51;
}

.feature-item,
.quick-link,
.empty-box,
.result-box,
.split-box,
.state-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-soft);
}

.feature-item,
.split-box,
.state-card {
  padding: 16px;
}

.state-card--center {
  text-align: center;
}

.feature-item strong,
.result-box strong {
  display: block;
  margin-top: 8px;
}

.quick-links {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.quick-link {
  padding: 14px 16px;
  text-align: center;
  color: var(--muted);
}

.primary-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.primary-button:hover,
.primary-button:focus-visible {
  outline: none;
  background: var(--accent-soft);
}

.primary-button:disabled {
  opacity: 0.72;
  cursor: progress;
}

.primary-button--link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-state {
  display: grid;
}

.screen {
  display: grid;
  gap: 16px;
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 118px;
  padding: 24px 22px;
  border-bottom: 1px solid var(--border);
  background: #252528;
}

.screen-header__title h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.3rem);
  letter-spacing: -0.03em;
}

.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  color: #d7d7db;
  font-size: 2.3rem;
  line-height: 1;
}

.operation-card,
.detail-card,
.items-card,
.total-card,
.payment-card,
.state-card {
  margin: 0 16px;
}

.operation-card {
  display: grid;
  gap: 18px;
  padding: 20px 22px;
}

.operation-card__block {
  display: grid;
  gap: 10px;
}

.operation-card__divider {
  width: 1px;
  background: var(--border);
  display: none;
}

.operation-value,
.operation-date {
  font-size: 1.1rem;
  font-weight: 600;
}

.operation-value {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--success);
}

.card-title {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.info-rows {
  display: grid;
}

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.info-row span,
.totals-simple span,
.items-table__head span,
.payment-inline-note {
  color: var(--muted);
}

.info-row strong {
  font-size: 1rem;
  font-weight: 500;
  text-align: right;
}

.items-table {
  overflow: hidden;
  border-radius: 16px;
  background: #29292d;
}

.items-table__head,
.items-table__row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) 72px 72px 92px;
  align-items: center;
  column-gap: 12px;
}

.items-table__head {
  min-height: 74px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.items-table__row {
  min-height: 74px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.items-table__row:last-child {
  border-bottom: 0;
}

.item-name,
.item-total {
  font-size: 1rem;
  font-weight: 500;
}

.item-time {
  color: var(--muted);
}

.qty-badge {
  justify-self: start;
  min-width: 42px;
  padding: 6px 0;
  border-radius: 999px;
  background: #404046;
  color: var(--text);
  text-align: center;
}

.totals-simple {
  display: grid;
  gap: 14px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.totals-simple div,
.total-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.positive {
  color: var(--success);
}

.total-card__footer {
  padding-top: 22px;
}

.total-card__footer span {
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  font-weight: 700;
}

.total-card__footer strong {
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent);
}

.payment-options {
  display: grid;
  gap: 10px;
}

.payment-options--minimal {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.payment-option {
  min-height: 52px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.payment-option span {
  font-weight: 500;
}

.payment-option small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.payment-option.is-selected {
  border-color: #56565f;
  background: #313136;
}

.payment-action {
  display: grid;
  gap: 14px;
}

.primary-button--compact {
  width: auto;
  min-width: 200px;
}

.primary-button--large {
  min-height: 56px;
  font-size: 1rem;
}

.split-box--minimal {
  padding: 14px 0 0;
  border: 0;
  background: transparent;
}

.empty-box,
.result-box {
  padding: 16px;
}

.qr-image {
  display: block;
  width: min(100%, 220px);
  margin-top: 14px;
  border-radius: 14px;
  background: #fff;
  padding: 10px;
}

.code-block {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: #1c1c1f;
  color: #d8d8dc;
  border: 1px solid var(--border);
  word-break: break-all;
  font-size: 0.84rem;
  line-height: 1.5;
}

.secondary-link {
  display: inline-flex;
  margin-top: 14px;
  color: #d7d7db;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.secondary-link--button {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.pay-cta {
  margin: 0 16px 24px;
}

.sheet-overlay,
.success-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(2px);
}

.bottom-sheet,
.success-modal {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 16px), 1024px);
  background: #222225;
  border: 1px solid var(--border);
  box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.28);
}

.bottom-sheet {
  bottom: 0;
  z-index: 20;
  border-radius: 24px 24px 0 0;
  padding: 12px 16px 24px;
}

.bottom-sheet__handle {
  width: 54px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: #4a4a50;
}

.bottom-sheet__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.bottom-sheet__header h2,
.success-modal h2 {
  margin: 6px 0 0;
  font-size: 1.2rem;
}

.sheet-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.sheet-options {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.sheet-option {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 16px;
  text-align: left;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #2b2b2f;
  color: var(--text);
}

.sheet-option strong {
  font-size: 1rem;
}

.sheet-option span {
  color: var(--muted);
  font-size: 0.92rem;
}

.sheet-detail {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.lookup-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 18px;
  background: #2a2a2e;
  border: 1px solid var(--border);
}

.lookup-panel__header {
  display: grid;
  gap: 8px;
}

.lookup-panel__header h3 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.customer-lookup-row {
  display: grid;
  gap: 12px;
}

.sheet-actions {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.sheet-actions--stack {
  justify-items: stretch;
}

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

.field--full {
  grid-column: 1 / -1;
}

.secondary-button {
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #2c2c31;
  color: var(--text);
  padding: 0 16px;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  outline: none;
  background: #333339;
}

.secondary-button--ghost {
  width: 100%;
  background: transparent;
}

.field--lookup span {
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-strong);
  font-weight: 700;
}

.field--lookup input {
  min-height: 58px;
  padding: 16px 18px;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  background: #1a1a1d;
}

.lookup-helper {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.customer-chip {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #2b2b2f;
  border: 1px solid var(--border);
}

.customer-chip span {
  color: var(--muted);
  font-size: 0.92rem;
}

.sheet-result {
  display: grid;
  gap: 10px;
}

.sheet-result strong {
  font-size: 1rem;
}

.success-modal {
  bottom: 24px;
  z-index: 30;
  border-radius: 24px;
  padding: 22px;
}

.screen--state {
  min-height: 100vh;
}

@media (min-width: 720px) {
  .hero__content,
  .content-grid--home {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .operation-card {
    grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr);
    align-items: center;
  }

  .operation-card__divider {
    display: block;
    min-height: 62px;
  }

  .operation-card__block--right {
    justify-items: end;
    text-align: right;
  }

  .payment-action {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .customer-lookup-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding-bottom: 24px;
  }

  .hero,
  .operation-card,
  .detail-card,
  .items-card,
  .total-card,
  .payment-card,
  .state-card {
    margin-left: 8px;
    margin-right: 8px;
  }

  .pay-cta {
    margin-left: 8px;
    margin-right: 8px;
  }

  .screen-header {
    min-height: 96px;
    padding: 20px 16px;
  }

  .screen-header__title h1 {
    font-size: 1.55rem;
  }

  .info-row,
  .total-card__footer,
  .payment-action {
    align-items: flex-start;
    flex-direction: column;
  }

  .info-row strong {
    text-align: left;
  }

  .items-table__head,
  .items-table__row {
    grid-template-columns: minmax(0, 1.6fr) 52px 64px 84px;
    column-gap: 8px;
    padding: 0 12px;
  }

  .payment-options--minimal {
    grid-template-columns: 1fr;
  }

  .primary-button--compact {
    width: 100%;
  }

  .customer-form-grid {
    grid-template-columns: 1fr;
  }

  .bottom-sheet,
  .success-modal {
    width: calc(100% - 12px);
  }
}
