:root {
  --bg: #f5f3ee;
  --fg: #2a2622;
  --accent: #7a4a2b;
  --line: #ddd5c9;
  --free: #2e7d32;
  --booked: #b26a00;
  --card: #fff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .75rem 1.25rem;
  background: #2a2622;
  color: #f5f3ee;
}

.brand { font-weight: 700; letter-spacing: .02em; }

.topbar nav { display: flex; gap: 1rem; flex: 1; }
.topbar nav a { color: #f5f3ee; text-decoration: none; }
.topbar nav a:hover { text-decoration: underline; }

.logout { display: flex; gap: .75rem; align-items: center; }
.logout span { opacity: .8; font-size: .85rem; }

button {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: .4rem .8rem;
  border-radius: 4px;
  cursor: pointer;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: .4rem .8rem;
  border-radius: 4px;
}

.form label { display: block; margin-bottom: .75rem; }
.form input, .form select, .form textarea {
  display: block;
  width: 100%;
  max-width: 480px;
  padding: .4rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  background: #fff;
}
.form button { margin-top: .25rem; }

.notice {
  background: #fff8e1;
  border: 1px solid #f0e0a0;
  border-radius: 6px;
  padding: .6rem .9rem;
  margin-bottom: 1rem;
}
.notice p { margin: .25rem 0; }

.container { max-width: 1100px; margin: 1.5rem auto; padding: 0 1.25rem; }

h1 { font-size: 1.5rem; margin: .25rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
}

.muted { color: #8a8072; font-size: .85rem; }

.stats { display: flex; flex-wrap: wrap; gap: .75rem; margin: .75rem 0; }
.stat { background: var(--bg); border-radius: 6px; padding: .4rem .6rem; text-align: center; min-width: 64px; }
.stat .num { display: block; font-size: 1.3rem; font-weight: 700; }
.stat span { font-size: .75rem; color: #8a8072; }

.links { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.links a { color: var(--accent); }

table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  font-size: .9rem;
}

table.data th, table.data td {
  border-bottom: 1px solid var(--line);
  padding: .45rem .6rem;
  text-align: left;
  vertical-align: top;
}

table.data th { background: #efe8dc; }

tr.free td:first-child { border-left: 3px solid var(--free); }
tr.booked td:first-child { border-left: 3px solid var(--booked); }

.event-switch { margin-bottom: 1rem; }
.event-switch select {
  padding: .35rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.detail { display: grid; grid-template-columns: 160px 1fr; gap: .35rem 1rem; }
.detail dt { color: #8a8072; }
.detail dd { margin: 0; }

.audit-detail pre {
  margin: 0;
  font-size: .75rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: #555;
}

.login-card {
  max-width: 460px;
  margin: 4rem auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 2rem;
}

.login-card code { background: var(--bg); padding: .1rem .35rem; border-radius: 3px; }
.hint { color: #8a8072; font-size: .85rem; }

.broadcast { margin-bottom: 1rem; }
.broadcast p { margin: .35rem 0; }
.broadcast h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.message-preview {
  background: var(--bg);
  border-left: 3px solid var(--accent);
  margin: .5rem 0;
  padding: .6rem .9rem;
  white-space: pre-wrap;
}
.preview-button { display: inline-block; margin-top: .5rem; color: var(--accent); font-weight: 600; }
.broadcast-form { display: flex; gap: 1rem; align-items: center; }
.inline-form { margin-top: .35rem; }
.inline-form button { padding: .2rem .5rem; font-size: .8rem; }

.alert { padding: .6rem .9rem; border-radius: 6px; margin-bottom: 1rem; }
.alert.error { background: #fdecea; color: #b3261e; border: 1px solid #f5c6c0; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; }
  .topbar nav { order: 3; flex-basis: 100%; }
  table.data { font-size: .8rem; }
  .detail { grid-template-columns: 1fr; }
}