:root {
  --bg: #f8f6f3;
  --surface: #fff;
  --border: #e2ddd4;
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --accent: #c45c26;
  --accent-hover: #a34a1e;
  --full: #d4edda;
  --full-text: #155724;
  --open: #fff8e6;
  --danger: #b42318;
  --radius: 8px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header {
  background: linear-gradient(135deg, #2d5a3d 0%, #1e3d2a 100%);
  color: #fff;
  padding: 1.5rem 1rem;
  text-align: center;
}

.header-logo {
  display: block;
  margin: 0 auto 1rem;
  max-width: min(100%, 20rem);
  height: auto;
  border-radius: var(--radius);
}

header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 700;
}

header p {
  margin: 0;
  opacity: 0.9;
  font-size: 0.95rem;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.notice {
  background: var(--open);
  border: 1px solid #e6c200;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.notice strong {
  color: var(--accent);
}

.loading,
.error-banner {
  text-align: center;
  padding: 2rem;
}

.error-banner {
  color: var(--danger);
  background: #fef2f2;
  border-radius: var(--radius);
}

.grid-wrap {
  overflow-x: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

table.grid {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 0.85rem;
}

table.grid th,
table.grid td {
  border: 1px solid var(--border);
  padding: 0.5rem;
  vertical-align: top;
}

table.grid th {
  background: #2d5a3d;
  color: #fff;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

table.grid th.stand-col {
  text-align: left;
  min-width: 160px;
  position: sticky;
  left: 0;
  z-index: 2;
}

table.grid td.stand-col {
  font-weight: 600;
  background: #f5f3ef;
  position: sticky;
  left: 0;
  z-index: 1;
}

table.grid td.stand-col .cap-badge {
  display: block;
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--muted);
}

.cell {
  min-height: 72px;
  text-align: center;
}

.cell.full {
  background: var(--full);
}

.cell.partial {
  background: var(--open);
}

.cell .volunteer {
  font-size: 0.8rem;
  margin: 0.15rem 0;
}

.cell .places {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.btn {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 420px;
  width: 100%;
  padding: 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.modal h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.modal .slot-info {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.modal label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.modal input,
.modal select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.modal .message {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.modal .message.error {
  color: var(--danger);
}

.modal .message.success {
  color: var(--full-text);
}

.modal .edit-link-box {
  margin-top: 0.75rem;
  padding: 0.5rem;
  background: #f0f4f8;
  border-radius: 4px;
  font-size: 0.8rem;
  word-break: break-all;
}

footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 600px) {
  .header-logo {
    max-width: min(100%, 16rem);
    margin-bottom: 0.75rem;
  }

  header h1 {
    font-size: 1.25rem;
  }

  table.grid {
    font-size: 0.78rem;
  }
}
