:root {
  --paper: #F7F5EF;
  --panel: #FFFFFE;
  --ink: #262B24;
  --ink-soft: #565F51;
  --accent: #3C5A62;
  --accent-soft: #E6ECEB;
  --warm: #B4703A;
  --positive: #5C7A52;
  --danger: #9C4A3D;
  --line: #DAD5C7;
  --serif: 'Source Serif 4', Georgia, serif;
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}

.shell {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.sidebar-title {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.sidebar-title-mark {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
  margin-top: 2px;
}

.sidebar-title h1 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 4px;
}

.sidebar-title p {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  text-align: left;
  background: none;
  border: none;
  border-left: 2px solid transparent;
  padding: 9px 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 0;
}

.nav-item:hover {
  color: var(--ink);
  background: var(--accent-soft);
}

.nav-item.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 500;
}

/* ---- Content ---- */

.content {
  flex: 1;
  padding: 40px 48px;
  max-width: 980px;
}

.panel { display: none; }
.panel.is-active { display: block; }

.panel-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.panel-header h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  margin: 0 0 6px;
}

.panel-header p {
  margin: 0;
  color: var(--ink-soft);
  max-width: 60ch;
}

.panel h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17px;
  margin: 28px 0 10px;
}

/* ---- Banner (errors / status) ---- */

.banner {
  background: #F3E4DD;
  border: 1px solid var(--warm);
  color: #6E3D1C;
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 14px;
}

.banner.success {
  background: #E7EEE4;
  border-color: var(--positive);
  color: #35492F;
}

/* ---- Forms ---- */

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
}

input, select, button {
  font-family: var(--sans);
  font-size: 14px;
}

input, select {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 7px 10px;
}

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

button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 7px 14px;
  cursor: pointer;
}

button:hover { background: #32494F; }

button.secondary {
  background: var(--panel);
  color: var(--accent);
}
button.secondary:hover { background: var(--accent-soft); }

button.danger {
  background: var(--panel);
  color: var(--danger);
  border-color: var(--danger);
}
button.danger:hover { background: #F3E7E4; }

button.link {
  border: none;
  background: none;
  color: var(--accent);
  padding: 2px 4px;
  text-decoration: underline;
}
button.link:hover { background: none; color: #2A4247; }

/* ---- Tables ---- */

.register-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 4px;
}

.register-table th, .register-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.register-table th {
  font-weight: 500;
  color: var(--ink-soft);
  font-size: 13px;
  border-bottom: 1px solid var(--ink);
}

.register-table tbody tr:hover { background: var(--accent-soft); }

.status-pill {
  display: inline-block;
  font-size: 12.5px;
  padding: 1px 8px;
  border: 1px solid var(--line);
}

.status-pill.active { color: var(--positive); border-color: var(--positive); }
.status-pill.inactive { color: var(--ink-soft); }

.constraint-type {
  color: var(--warm);
  font-size: 13.5px;
}

/* ---- Quarter picker (constraints / schedule) ---- */

.quarter-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.quarter-picker label {
  color: var(--ink-soft);
  font-size: 13.5px;
}

/* ---- Schedule ---- */

.schedule-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 8px;
}

.schedule-status {
  font-size: 13.5px;
  color: var(--ink-soft);
}

.ledger td:first-child {
  font-family: var(--serif);
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    padding: 16px 20px;
  }
  .sidebar-nav { flex-direction: row; }
  .content { padding: 24px; }
}

/* ---- accounts ---- */
[hidden] { display: none !important; }
.no-perm { display: none !important; }

.auth-screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--paper); padding: 1rem; z-index: 10;
}
.auth-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 2rem; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 0.9rem;
}
.auth-card h1 { font-family: var(--serif); margin: 0; }
.auth-card p { margin: 0; color: var(--ink-soft); }
.auth-card label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--ink-soft); }
.auth-card input { font: inherit; padding: 0.5rem; border: 1px solid var(--line); border-radius: 4px; }
.auth-buttons { display: flex; gap: 0.6rem; }
.hint { font-size: 0.85rem; color: var(--ink-soft); }

.user-box { margin-top: auto; padding-top: 1.2rem; display: flex; flex-direction: column; gap: 0.3rem; align-items: flex-start; }
.user-name { font-weight: 600; font-size: 0.9rem; }

.user-form { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; margin-bottom: 1rem; }
.check { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; margin-right: 0.6rem; white-space: nowrap; }
.check-group { display: inline-flex; flex-wrap: wrap; }
#table-users td .check { display: flex; margin: 0.15rem 0; }
#temp-password-value {
  display: block; font-size: 1.3rem; margin: 0.5rem 0; padding: 0.5rem; background: var(--panel);
  border: 1px dashed var(--accent); user-select: all;
}
