:root {
  --green: #0f7b55;
  --green-dark: #006041;
  --ink: #111827;
  --muted: #6b7280;
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #e5e7eb;
  --amber: #f59e0b;
  --blue: #2563eb;
  --red: #dc2626;
  --radius: 8px;
  --shadow: 0 4px 12px rgba(17, 24, 39, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  padding-bottom: 70px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-size: 20px;
  font-weight: 700;
}

.store-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
}

.page {
  padding: 16px;
}

.login-page {
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}

.logo-block {
  text-align: center;
}

.logo-mark {
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  font-size: 34px;
  font-weight: 800;
}

.logo-block h1 {
  margin: 0;
  font-size: 22px;
}

.logo-block p {
  margin: 8px 0 0;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.danger-zone {
  border-color: rgba(220, 38, 38, 0.22);
  background: rgba(220, 38, 38, 0.035);
  box-shadow: none;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

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

.metric {
  min-height: 90px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  margin-top: 8px;
  font-size: 30px;
  line-height: 34px;
  font-weight: 800;
}

.section-title {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title small {
  color: var(--muted);
  font-weight: 500;
}

.btn {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

.btn.primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.btn.danger {
  color: var(--red);
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.06);
}

.btn.ghost {
  background: transparent;
}

.btn.block {
  width: 100%;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quick-actions .btn {
  min-height: 62px;
  flex-direction: column;
  padding: 8px;
}

.match-card,
.user-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.match-head,
.row-between {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.record-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.record-line:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.record-tags {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.time {
  font-size: 17px;
  font-weight: 800;
}

.subtle {
  color: var(--muted);
  font-size: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.tag.waiting,
.tag.pending_confirm {
  color: var(--amber);
  background: rgba(245, 158, 11, 0.12);
}

.tag.confirmed {
  color: var(--green);
  background: rgba(15, 123, 85, 0.12);
}

.tag.cancelled {
  color: var(--red);
  background: rgba(220, 38, 38, 0.1);
}

.tag.finished {
  color: var(--muted);
  background: #eef0f3;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #eef0f3;
  display: grid;
  place-items: center;
  color: var(--green);
  font-weight: 800;
  flex: 0 0 auto;
}

.person-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.divider {
  height: 1px;
  background: var(--line);
}

.toolbar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.toolbar select,
.toolbar input {
  min-width: 104px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #fff;
}

.field textarea {
  min-height: 76px;
  resize: vertical;
}

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

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 30;
  width: min(100%, 430px);
  height: 60px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 12px rgba(17, 24, 39, 0.05);
}

.nav-item {
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 12px;
}

.nav-item.active {
  color: var(--green);
  font-weight: 700;
}

.empty,
.loading,
.error-box {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
}

.error-box {
  color: var(--red);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: min(360px, calc(100% - 32px));
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(17, 24, 39, 0.55);
}

.modal {
  width: min(100%, 360px);
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 20px 50px rgba(17, 24, 39, 0.2);
}

.modal h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.analytics-bar {
  height: 10px;
  border-radius: 999px;
  background: #e8ecef;
  overflow: hidden;
}

.analytics-bar span {
  display: block;
  height: 100%;
  background: var(--green);
}

@media (min-width: 720px) {
  .app-shell {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}
