:root {
  --bg: #f5f5f5;
  --surface: #fff;
  --text: #1a1a1a;
  --muted: #555;
  --border: #ccc;
  --focus: #06c;
  --danger: #b00020;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
}

.shell {
  max-width: 28rem;
  margin: 0 auto;
  padding: calc(0.75rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom));
}

.page-title {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  font-weight: 600;
}

main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.block {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1rem;
}

.section-title {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.label {
  font-size: 0.875rem;
  color: var(--text);
}

.hint {
  font-weight: 400;
  color: var(--muted);
}

input[type="text"],
input[type="datetime-local"] {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.5rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
}

input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 0.75rem;
  font: inherit;
  font-size: 0.9375rem;
  border-radius: 2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn.primary {
  background: var(--text);
  color: var(--surface);
  border: 1px solid var(--text);
}

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

.btn.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.danger {
  background: var(--surface);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.error {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--danger);
}

.meta {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.list-head {
  margin-bottom: 0.5rem;
}

.list-head .section-title {
  margin-bottom: 0.15rem;
}

.sep {
  margin: 1rem 0;
  border: none;
  border-top: 1px solid var(--border);
}

.subsection-title {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.state {
  margin: 0;
  padding: 0.25rem 0;
}

.state.muted {
  color: var(--muted);
}

.guest-groups {
  margin: 0;
  padding: 0;
}

.day-group {
  margin-top: 1rem;
}

.day-group:first-child {
  margin-top: 0;
}

.day-heading {
  margin: 0 0 0.35rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.guest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.guest-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.guest-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.guest-main {
  flex: 1;
  min-width: 0;
}

.guest-name {
  margin: 0;
  font-weight: 500;
  word-break: break-word;
}

.guest-times {
  margin: 0.15rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.btn-leave,
.btn-edit,
.btn-delete {
  min-height: 36px;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
}

.dialog {
  width: min(calc(100vw - 2rem), 22rem);
  max-width: none;
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.25);
}

.dialog form {
  padding: 1rem;
}

.dialog-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dialog-actions .btn {
  flex: 1;
  min-width: 5rem;
}
