:root {
  --ink: #18212f;
  --muted: #687386;
  --line: #dce2ea;
  --surface: #ffffff;
  --soft: #f4f7fb;
  --brand: #0b4f71;
  --brand-strong: #07344c;
  --accent: #b78b2f;
  --danger: #b3261e;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-bottom: 180px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--soft);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 96px;
}

.shop-header {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 18px 16px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: white;
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 7vw, 34px);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.05;
}

p {
  margin: 4px 0 0;
  color: var(--muted);
}

.customer-panel,
.order-panel {
  padding: 16px;
}

.customer-panel {
  display: grid;
  gap: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.dual-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.dual-label span {
  display: block;
  margin: 0;
  line-height: 1.25;
}

.dual-label span + span {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
  outline: none;
}

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 79, 113, 0.12);
}

.table-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th {
  height: 44px;
  padding: 8px 6px;
  text-align: left;
  background: #edf4f8;
  color: var(--brand-strong);
  font-size: 12px;
}

th:first-child {
  width: 25%;
}

th:nth-child(2) {
  width: 43%;
}

th:nth-child(3) {
  width: 32%;
}

td {
  height: 64px;
  border-top: 1px solid var(--line);
  padding: 6px;
  vertical-align: middle;
}

.editable-cell {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 0;
}

.editable-cell.placeholder {
  color: #a0a8b6;
  font-style: italic;
}

.table-input {
  min-width: 0;
  min-height: 42px;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.table-input:focus {
  border-color: transparent;
  box-shadow: none;
}

.design-group,
.qty-group {
  display: grid;
  gap: 6px;
  align-items: center;
}

.design-group {
  grid-template-columns: minmax(0, 1fr);
}

.qty-group {
  grid-template-columns: minmax(0, 1fr) 44px;
}

.board-input {
  text-transform: uppercase;
}

.field-stack {
  min-width: 0;
}

.row-language-hint {
  display: block;
  margin-top: -6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  white-space: normal;
}

.row-add-button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 6px;
  color: white;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
}

.row-add-button {
  background: var(--brand);
}

.submit-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.submit-bar div {
  display: grid;
  gap: 2px;
}

.submit-bar span {
  color: var(--muted);
  font-size: 12px;
}

#submitOrder,
#closeSuccess {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--brand);
  color: white;
  font-weight: 800;
}

.keypad-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 38, 0.42);
}

.keypad-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 16px 18px;
  background: white;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 -18px 40px rgba(15, 25, 38, 0.2);
}

.sheet-handle {
  width: 48px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 99px;
  background: #c5ccd6;
}

.sheet-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.sheet-title span {
  display: block;
  min-height: 22px;
  color: var(--muted);
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.alpha-pad,
.number-pad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.number-pad {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.key {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
}

.key:active,
.key.selected {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.keypad-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.keypad-actions button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 800;
}

#nextKey {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

dialog {
  width: min(340px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
}

dialog::backdrop {
  background: rgba(15, 25, 38, 0.45);
}

dialog h2 {
  margin: 10px 0 6px;
}

.success-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border-radius: 50%;
  background: #dff4e6;
  color: #126c33;
  font-size: 30px;
  font-weight: 900;
}

@media (min-width: 720px) {
  .app-shell {
    max-width: 760px;
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    background: var(--surface);
  }

  .submit-bar {
    left: 50%;
    width: 760px;
    transform: translateX(-50%);
  }

  .keypad-sheet {
    left: 50%;
    width: 520px;
    transform: translateX(-50%);
  }
}
