:root {
  color-scheme: light;
  --brand: #063da8;
  --brand-2: #0c6bff;
  --ink: #172033;
  --muted: #687386;
  --line: #dce3ef;
  --soft: #f4f7fb;
  --panel: #ffffff;
  --good: #0b8a43;
  --danger: #c7362e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--soft);
}

.login-screen.hidden {
  display: none;
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(23, 32, 51, 0.08);
}

.login-tip {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 14px;
}

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

.userbar span {
  max-width: 120px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
}

.icon-button,
.primary,
.ghost,
.tab,
.order-actions button {
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: white;
  background: var(--brand);
  font-size: 22px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat strong {
  display: block;
  margin-top: 6px;
  color: var(--brand);
  font-size: 19px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 8px 0;
  background: var(--soft);
}

.tab {
  height: 40px;
  border-radius: 8px;
  color: var(--muted);
  background: #e9eef7;
  font-weight: 700;
}

.tab.active {
  color: white;
  background: var(--brand);
}

.panel {
  display: none;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel.active {
  display: block;
}

.form,
.store-settings {
  display: grid;
  gap: 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-row.compact {
  grid-template-columns: 0.8fr 1fr 1fr;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: white;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(12, 107, 255, 0.12);
}

.primary {
  height: 46px;
  border-radius: 8px;
  color: white;
  background: var(--brand);
  font-weight: 800;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 10px;
  margin-bottom: 12px;
}

.orders-list,
.report-table {
  display: grid;
  gap: 10px;
}

.order-item,
.report-row,
.store-setting {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.order-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
}

.order-title {
  display: block;
  font-size: 16px;
}

.order-meta,
.order-sub {
  color: var(--muted);
  font-size: 13px;
}

.order-money {
  color: var(--brand);
  font-weight: 800;
}

.order-sub,
.order-actions {
  grid-column: 1 / -1;
}

.order-actions {
  display: flex;
  gap: 8px;
}

.order-actions button,
.ghost {
  min-height: 36px;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--brand);
  background: #edf4ff;
  font-weight: 700;
}

.ghost.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.order-actions button[data-action="delete"] {
  color: var(--danger);
  background: #fff0ee;
}

.report-head,
.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.report-head p,
.settings-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.report-row {
  display: grid;
  grid-template-columns: 1.1fr repeat(4, 1fr);
  align-items: center;
  gap: 8px;
}

.report-row.header {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: white;
}

.report-row strong {
  color: var(--brand);
}

.store-setting {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
  align-items: end;
}

.empty {
  padding: 24px 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  .app {
    padding: 12px;
  }

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

  .userbar {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

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

  .field-row,
  .field-row.compact,
  .filters,
  .store-setting {
    grid-template-columns: 1fr;
  }

  .report-row {
    grid-template-columns: 1fr 1fr;
  }

  .report-row.header {
    display: none;
  }

  .report-row span::before {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .report-row span:nth-child(2)::before {
    content: "订单";
  }

  .report-row span:nth-child(3)::before {
    content: "金额";
  }

  .report-row span:nth-child(4)::before {
    content: "门店分成";
  }

  .report-row span:nth-child(5)::before {
    content: "师傅分成";
  }
}
