:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1a1d21;
  --muted: #5c6570;
  --border: #e2e6ea;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #059669;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body.has-staging-banner {
  padding-top: 2.25rem;
}

.env-banner-staging {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  background: #b45309;
  color: #fff;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0.4rem 0.5rem;
  pointer-events: none;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2.5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 650;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

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

.card-narrow {
  max-width: 24rem;
  margin: 2rem auto;
}

h1 {
  font-size: 1.35rem;
  font-weight: 650;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

.lead {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1.25rem;
}

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

input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

input:not([type="checkbox"]):not([type="radio"]):focus {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn:hover {
  background: #f8fafc;
}

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

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

.btn-danger {
  color: var(--danger);
  border-color: #fecaca;
  background: #fef2f2;
}

.btn-danger:hover {
  background: #fee2e2;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: #f1f5f9;
  color: var(--text);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.status {
  font-size: 0.9rem;
  color: var(--success);
  margin: 0.5rem 0;
  min-height: 1.25rem;
}

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

.hint {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
}

[hidden] {
  display: none !important;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table.roster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.roster-table th,
table.roster-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.roster-table th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: none;
}

table.roster-table tr:last-child td {
  border-bottom: none;
}

table.roster-table tr.row-disabled td {
  opacity: 0.72;
}

.col-check {
  width: 2.5rem;
  text-align: center;
}

.export-period-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-top: 0.5rem;
}

.export-period-inputs label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.88rem;
}

.export-atria-toggle {
  display: flex;
  gap: 0.65rem;
  margin: 1rem 0;
  align-items: flex-start;
}

.col-actions {
  white-space: nowrap;
}

.col-actions .btn {
  margin: 0.15rem 0.25rem 0.15rem 0;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-active {
  background: #ecfdf5;
  color: var(--success);
}

.badge-disabled {
  background: #f1f5f9;
  color: var(--muted);
}

fieldset.export-formats {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem 1rem;
  margin: 1rem 0;
}

label.export-choice {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0.75rem 0;
  cursor: pointer;
  font-weight: 400;
}

label.export-choice input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0.15rem 0 0;
  flex-shrink: 0;
}

.export-choice-text {
  flex: 1;
  line-height: 1.45;
}

.export-choice-text strong {
  display: block;
  font-weight: 600;
}

.export-choice-text .export-choice-detail {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 400;
}

dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  width: min(28rem, calc(100% - 2rem));
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.4);
}

.dialog-body {
  padding: 1.25rem 1.35rem 1.35rem;
}

dialog h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 650;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.dialog-wide {
  width: min(32rem, calc(100% - 2rem));
}

code {
  font-size: 0.85em;
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
