* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid #e5e5ea;
  position: sticky;
  top: 0;
  z-index: 10;
}

header.topbar h1 {
  font-size: 18px;
  margin: 0;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tabs button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #e5e5ea;
  font-size: 15px;
  cursor: pointer;
}

.tabs button.active {
  background: #007aff;
  color: #fff;
}

form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  font-size: 13px;
  color: #6e6e73;
  margin-bottom: -6px;
}

input, select {
  padding: 10px 12px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  font-size: 15px;
}

.row {
  display: flex;
  gap: 8px;
}

.row > * {
  flex: 1;
}

button.primary {
  padding: 11px;
  border: none;
  border-radius: 8px;
  background: #007aff;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

button.primary:disabled {
  background: #a8a8ad;
  cursor: not-allowed;
}

button.secondary {
  padding: 11px 14px;
  border: 1px solid #007aff;
  border-radius: 8px;
  background: #fff;
  color: #007aff;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

button.secondary:disabled {
  border-color: #a8a8ad;
  color: #a8a8ad;
  cursor: not-allowed;
}

button.link {
  background: none;
  border: none;
  color: #ff3b30;
  cursor: pointer;
  font-size: 14px;
}

button.link.neutral {
  color: #007aff;
}

.error-msg {
  color: #ff3b30;
  font-size: 13px;
  min-height: 18px;
}

.hint {
  color: #6e6e73;
  font-size: 12px;
}

.piece-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
}

.piece-desc {
  color: #6e6e73;
  font-size: 13px;
  margin: 0 0 10px;
}

.slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid #f0f0f2;
  gap: 10px;
}

.slot:first-of-type {
  border-top: none;
}

.slot-info {
  flex: 1;
  min-width: 0;
}

.slot-label {
  font-size: 14px;
  font-weight: 500;
}

.slot-meta {
  font-size: 12px;
  color: #6e6e73;
  margin-top: 3px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  margin-left: 6px;
}

.badge.full {
  background: #ffedd5;
  color: #c2410c;
}

.badge.open {
  background: #dcfce7;
  color: #15803d;
}

.badge.closed {
  background: #e5e5ea;
  color: #6e6e73;
}

.voters {
  font-size: 12px;
  color: #6e6e73;
  margin-top: 4px;
  word-break: break-all;
}

button.vote-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #007aff;
  background: #fff;
  color: #007aff;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

button.vote-btn.voted {
  background: #007aff;
  color: #fff;
}

.empty-state {
  text-align: center;
  color: #6e6e73;
  padding: 40px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid #f0f0f2;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 18px 0 8px;
}

.inline-form {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
}

.inline-form > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inline-form input, .inline-form select {
  width: auto;
}

.inline-form input[type="number"] {
  width: 70px;
}
