:root {
  --bg: #f3f6f5;
  --panel: #ffffff;
  --text: #172126;
  --muted: #65727c;
  --line: #dce4e2;
  --brand: #0b8f70;
  --brand-strong: #06745a;
  --accent: #d83a37;
  --blue: #1768ac;
  --warn: #b66a00;
  --shadow: 0 10px 30px rgba(20, 35, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(rgba(243, 246, 245, 0.91), rgba(243, 246, 245, 0.98)),
    url("https://images.unsplash.com/photo-1522778119026-d647f0596c20?auto=format&fit=crop&w=1800&q=80") center top / cover fixed;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

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

button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
  padding: 0 14px;
}

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

button.secondary {
  color: var(--text);
  background: #e8eeed;
}

button.danger {
  background: var(--accent);
}

button.ghost {
  color: var(--brand);
  background: transparent;
  border: 1px solid var(--line);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

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

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

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

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

h1,
h2,
p {
  margin: 0;
}

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

h2 {
  font-size: 18px;
}

.token-box {
  display: grid;
  grid-template-columns: minmax(160px, 260px) 72px;
  gap: 8px;
}

.view-tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px;
  margin-bottom: 14px;
}

.tab-button {
  min-width: 86px;
  color: var(--muted);
  background: transparent;
}

.tab-button.active {
  color: #fff;
  background: var(--brand);
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.records-view {
  display: block;
}

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

.panel {
  border: 1px solid rgba(220, 228, 226, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  padding: 16px;
}

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

.stack {
  display: grid;
  gap: 12px;
}

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

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.segmented.three {
  grid-template-columns: repeat(3, 1fr);
}

.choice {
  min-height: 42px;
  color: var(--text);
  background: #f6f8f8;
  border: 1px solid var(--line);
}

.choice.active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.schedule-list,
.cart-list,
.slip-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

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

.cart-row strong,
.slip-row strong {
  display: block;
  margin-bottom: 4px;
}

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

.schedule-view {
  display: grid;
  gap: 14px;
}

.schedule-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(220, 228, 226, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  padding: 18px;
}

.schedule-hero h2 {
  font-size: 24px;
}

.schedule-list {
  margin-top: 0;
}

.schedule-day {
  border: 1px solid rgba(220, 228, 226, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.schedule-day-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #eef5f3;
  border-bottom: 1px solid var(--line);
}

.schedule-day-title span {
  color: var(--muted);
  font-size: 13px;
}

.schedule-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.schedule-card:last-child {
  border-bottom: 0;
}

.schedule-card-main {
  display: grid;
  gap: 5px;
}

.schedule-card-main strong {
  font-size: 17px;
}

.match-no {
  width: fit-content;
  border-radius: 999px;
  background: #e5f1ee;
  color: var(--brand);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}

.schedule-time {
  min-width: 86px;
  text-align: right;
  display: grid;
  gap: 4px;
}

.schedule-time strong {
  font-size: 16px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
}

.badge.warn {
  background: var(--warn);
}

.badge.good {
  background: var(--brand);
}

.badge.bad {
  background: var(--accent);
}

.hidden {
  display: none !important;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  text-align: center;
}

.cart-actions,
.slip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.combo-picker {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6faf9;
  padding: 12px;
}

.combo-summary {
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

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

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

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

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.inline-check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.inline-check input {
  width: auto;
}

.legs-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.legs-table th,
.legs-table td {
  border-top: 1px solid var(--line);
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100% - 36px));
  border-radius: 8px;
  background: #172126;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  z-index: 20;
}

@media (max-width: 1050px) {
  .layout {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1440px);
  }

  .topbar,
  .split,
  .token-box,
  .stats-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  h1 {
    font-size: 26px;
  }

  .view-tabs {
    width: 100%;
  }

  .tab-button {
    min-width: 0;
  }

  .schedule-card {
    grid-template-columns: 1fr;
  }

  .schedule-time {
    min-width: 0;
    text-align: left;
    grid-template-columns: auto auto;
    justify-content: start;
  }
}
