:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --border: #e2e4e8;
  --text: #1a1a1a;
  --muted: #6b7280;
  --accent: #1e40af;
  --accent-hover: #1e3a8a;
  --error: #b91c1c;
  --success: #15803d;
  --required: #dc2626;
  --radius: 6px;
  --gap: 1rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.muted { color: var(--muted); font-size: 0.9em; }
.logout-form { margin-left: auto; }
.link-button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0.25rem 0.5rem;
}
.link-button:hover { text-decoration: underline; }

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

h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
h1 + p.subtitle { color: var(--muted); margin: 0 0 1.5rem; }

.form { display: flex; flex-direction: column; gap: var(--gap); }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--gap);
}
label { font-weight: 500; font-size: 0.95rem; }
.required::after { content: ' *'; color: var(--required); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
textarea { min-height: 80px; resize: vertical; }
.long-textarea { min-height: 120px; }

.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.checkbox-field input { width: auto; margin: 0; }
.checkbox-field label { font-weight: 400; }

.button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 0.65rem 1.25rem;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.button:hover { background: var(--accent-hover); }
.button:disabled { opacity: 0.6; cursor: not-allowed; }
.button-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}
.button-secondary:hover { background: var(--bg); }

.button-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.conditional {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  margin-left: 0.25rem;
}

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

.login-card {
  max-width: 380px;
  margin: 4rem auto 0;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.alert-error {
  background: #fee2e2;
  color: var(--error);
  border: 1px solid #fca5a5;
}
.alert-success {
  background: #dcfce7;
  color: var(--success);
  border: 1px solid #86efac;
}

.help-text {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

hr.section-break {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0 0.5rem;
}
