:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-strong: #eef3f8;
  --ink: #171a1f;
  --muted: #626b78;
  --line: #d8dde5;
  --accent: #b63b32;
  --accent-strong: #8f2b25;
  --blue: #285da8;
  --green: #25764f;
  --amber: #9f6b19;
  --danger: #a12b2b;
  --shadow: 0 12px 28px rgba(24, 30, 40, 0.08);
}

* {
  box-sizing: border-box;
}

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

.page {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar,
.status-strip,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  margin-bottom: 14px;
}

.topbar-actions,
.button-row,
.order-actions,
.toggles {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
}

.muted {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 14px;
  overflow: hidden;
}

.status-strip > div {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.status-strip > div:last-child {
  border-right: 0;
}

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

.panel {
  padding: 16px;
}

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

.call-panel {
  grid-column: span 4;
}

.summary-panel {
  grid-column: span 8;
}

.active-panel,
.settings-panel,
.menu-panel,
.history-panel {
  grid-column: span 6;
}

.unhandled-panel {
  grid-column: span 5;
}

.output-panel {
  grid-column: span 7;
}

.login-panel {
  margin-bottom: 14px;
}

.login-form {
  display: flex;
  align-items: end;
  gap: 12px;
}

.login-form label {
  flex: 1 1 auto;
}

.summary-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.summary-grid-wide {
  grid-column: 1 / -1;
}

.summary-label {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.summary-value {
  min-height: 24px;
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.summary-items {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.items-list,
.order-list,
.history-list,
.menu-list,
.trace-list {
  display: grid;
  gap: 10px;
}

.item-row,
.order-card,
.menu-row,
.trace-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.item-row,
.menu-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
}

.trace-card {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

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

.trace-list {
  max-height: 260px;
  overflow: auto;
}

.trace-row {
  padding: 10px 12px;
}

.trace-row-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 4px;
}

.trace-event {
  margin: 0;
  font-size: 13px;
  font-weight: 750;
}

.trace-time {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.trace-detail {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.item-main {
  margin: 0 0 4px;
  font-weight: 750;
}

.item-meta,
.order-line {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.item-price {
  white-space: nowrap;
  font-weight: 800;
}

.order-card {
  padding: 12px;
}

.order-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.history-items {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--ink);
}

.history-items li {
  margin: 4px 0;
}

button,
input,
select,
textarea {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

button {
  width: auto;
  padding: 0 14px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 750;
}

button:hover {
  background: var(--accent-strong);
}

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

button.secondary {
  background: #ffffff;
  color: var(--ink);
}

button.secondary:hover {
  background: var(--surface-strong);
}

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

button.compact {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--ink);
}

textarea {
  min-height: 72px;
  resize: vertical;
}

label {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

label input[type="checkbox"] {
  width: auto;
  min-height: 0;
  margin: 0 8px 0 0;
}

.wide-label {
  margin-top: 12px;
}

.toggles {
  margin-top: 12px;
}

.toggles label {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.panel-search {
  width: min(260px, 100%);
  margin-top: 0;
}

.menu-info {
  min-width: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.badge.small {
  min-height: 26px;
  font-size: 12px;
}

.badge[data-mode="test"] {
  background: var(--amber);
}

.badge[data-mode="live"] {
  background: var(--green);
}

.badge[data-mode="off"] {
  background: var(--danger);
}

.eta-input {
  width: 88px;
  margin-top: 0;
}

pre {
  min-height: 260px;
  max-height: 520px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border-radius: 8px;
  background: #1f2329;
  color: #f5f7fa;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 960px) {
  .topbar,
  .panel-header {
    flex-direction: column;
  }

  .status-strip,
  .summary-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .status-strip > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .status-strip > div:last-child {
    border-bottom: 0;
  }

  .call-panel,
  .summary-panel,
  .active-panel,
  .settings-panel,
  .menu-panel,
  .history-panel,
  .unhandled-panel,
  .output-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .page {
    width: min(100% - 18px, 1280px);
    padding-top: 12px;
  }

  h1 {
    font-size: 28px;
  }

  .topbar-actions,
  .button-row,
  .order-actions,
  .login-form {
    width: 100%;
  }

  .topbar-actions button,
  .button-row button,
  .order-actions button,
  .login-form button,
  .eta-input {
    width: 100%;
  }

  .item-row,
  .menu-row {
    flex-direction: column;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .topbar,
  .status-strip,
  .login-panel,
  .call-panel,
  .active-panel,
  .settings-panel,
  .menu-panel,
  .history-panel,
  .unhandled-panel,
  .output-panel,
  .summary-panel .panel-header button {
    display: none;
  }

  .page {
    width: 100%;
    padding: 0;
  }

  .workspace {
    display: block;
  }

  .summary-panel {
    border: 0;
    box-shadow: none;
  }
}
