:root {
  --bg: #f4f1ec;
  --panel: #fffaf3;
  --ink: #1f2328;
  --muted: #6c6258;
  --line: #ded5ca;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(31, 35, 40, 0.14);
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

.catalog-panel {
  padding: 24px;
}

.topbar,
.order-header,
.modal-header,
.setup-list-header,
.modal-actions,
.order-actions,
.summary-row,
.receipt-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  align-items: flex-start;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-menu span {
  color: var(--muted);
  font-weight: 800;
}

.user-menu a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

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

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

h1,
h2 {
  margin-bottom: 0;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 18px;
}

.category-tab,
.secondary-button,
.ghost-button,
.primary-button,
.print-button,
.danger-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 750;
}

.category-tab,
.secondary-button,
.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.category-tab.active {
  border-color: var(--accent);
  background: #dff3ef;
  color: var(--accent-strong);
}

.primary-button,
.print-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover,
.print-button:hover {
  background: var(--accent-strong);
}

.danger-button {
  background: #ffe7e3;
  color: var(--danger);
}

.ghost-button {
  background: transparent;
}

.print-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

.product-button {
  min-height: 118px;
  border-radius: 8px;
  padding: 14px;
  color: #fff;
  text-align: left;
  box-shadow: 0 12px 30px rgba(31, 35, 40, 0.12);
}

.product-button strong,
.product-button span {
  display: block;
}

.product-button strong {
  font-size: 1.12rem;
  line-height: 1.2;
}

.product-button span {
  margin-top: 10px;
  font-weight: 800;
}

.order-panel {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--panel);
  min-height: 100vh;
}

.order-header {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.order-items {
  flex: 1;
  overflow: auto;
  padding: 14px;
}

.empty-state {
  margin: 36px auto;
  max-width: 260px;
  color: var(--muted);
  text-align: center;
}

.order-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.editable-line {
  cursor: pointer;
}

.editable-line:hover {
  border-color: var(--accent);
}

.order-line + .order-line {
  margin-top: 10px;
}

.order-line-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.line-name {
  font-weight: 800;
}

.line-options {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.line-edit-hint {
  margin: 6px 0 0;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

.line-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 10px;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.qty-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #f1ece5;
  color: var(--ink);
  font-weight: 900;
}

.remove-button {
  color: var(--danger);
  background: transparent;
  font-weight: 800;
}

.order-summary {
  border-top: 1px solid var(--line);
  padding: 16px 20px 20px;
}

.summary-row {
  margin-bottom: 12px;
}

.total-row {
  font-size: 1.35rem;
}

.transaction-status {
  min-height: 20px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.transaction-status.error {
  color: var(--danger);
}

.order-actions {
  margin-bottom: 10px;
}

.order-actions .secondary-button {
  flex: 1;
  padding: 0 10px;
}

.print-button {
  width: 100%;
}

.modal {
  width: min(720px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.wide-modal {
  width: min(1040px, calc(100vw - 28px));
}

.modal::backdrop {
  background: rgba(31, 35, 40, 0.45);
}

.modal-card {
  max-height: min(86vh, 860px);
  overflow: auto;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 18px 20px;
}

.option-groups,
.setup-layout {
  padding: 20px;
}

.modal-copy {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.option-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.option-group + .option-group {
  margin-top: 12px;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.option-row input[type="radio"],
.option-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.option-row label {
  flex: 1;
}

.setup-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
}

.setup-list,
.setup-editor {
  min-width: 0;
}

.setup-item-button {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  text-align: left;
}

.setup-item-button + .setup-item-button {
  margin-top: 8px;
}

.setup-item-button.active {
  border-color: var(--accent);
  background: #dff3ef;
}

.setup-editor label {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 700;
}

.setup-editor input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

.modifier-group-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  margin-bottom: 12px;
}

.modifier-group-grid,
.modifier-option-grid {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: end;
}

.modifier-option-grid {
  grid-template-columns: 1fr 120px auto;
  margin-top: 10px;
}

.small-button {
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 10px;
  font-weight: 750;
}

.modal-actions {
  position: sticky;
  bottom: 0;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 14px 20px;
}

.action-spacer {
  flex: 1;
}

.transaction-list {
  display: grid;
  gap: 10px;
  padding: 20px;
}

.transaction-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding: 16px 20px;
}

.transaction-filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.transaction-filters input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

.transaction-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.transaction-row strong,
.transaction-row span {
  display: block;
}

.transaction-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.receipt {
  display: none;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.15), rgba(180, 83, 9, 0.08)),
    var(--bg);
}

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

.login-card {
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 30px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 1.7rem;
  font-weight: 900;
}

.login-card h1 {
  font-size: 2rem;
}

.login-copy {
  margin: -6px 0 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.login-fields {
  display: grid;
  gap: 14px;
}

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

.login-card input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

.login-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.16);
  outline: 0;
}

.login-submit {
  margin-top: 4px;
  min-height: 50px;
}

.management-page {
  padding: 24px;
}

.management-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.management-grid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 20px;
}

.management-card {
  display: grid;
  align-content: start;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 32px rgba(31, 35, 40, 0.08);
  padding: 18px;
}

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

.management-card input,
.management-card select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-row input {
  min-height: auto;
  width: 18px;
  height: 18px;
}

.management-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.user-table {
  display: grid;
  gap: 10px;
}

.user-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.user-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

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

  .order-panel {
    border-top: 1px solid var(--line);
    border-left: 0;
    min-height: auto;
  }

  .setup-layout {
    grid-template-columns: 1fr;
  }

  .transaction-filters,
  .transaction-row,
  .management-grid,
  .user-row {
    grid-template-columns: 1fr;
  }

  .management-header {
    display: grid;
  }
}

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

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

  .receipt {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 72mm;
    padding: 8mm;
    color: #000;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  }

  .receipt h1 {
    margin-bottom: 4mm;
    text-align: center;
    font-size: 18px;
  }

  .receipt-line {
    border-bottom: 1px dashed #999;
    padding: 3mm 0;
  }

  .receipt-line-main,
  .receipt-total {
    display: flex;
    justify-content: space-between;
    gap: 8px;
  }

  .receipt-options,
  .receipt-meta,
  .receipt-footer {
    font-size: 11px;
  }

  .receipt-total {
    margin-top: 5mm;
    font-size: 16px;
  }
}
