:root {
  --ink: #20201d;
  --muted: #6a665f;
  --paper: #fbfaf6;
  --line: #ded7ca;
  --green: #183f34;
  --red: #7c2032;
  --gold: #c09a48;
  --cream: #f0eadf;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

button,
input,
textarea,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 250, 246, 0.94);
  padding: 14px clamp(18px, 4vw, 56px);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: var(--gold);
  font-weight: 900;
}

.brand small,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.admin-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

.header-admin-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.header-admin-nav .admin-link {
  min-height: 38px;
  border-radius: 7px;
  padding: 8px 10px;
}

.header-admin-nav .admin-link:hover,
.header-tab.is-active {
  background: var(--cream);
  color: var(--green);
}

.hero {
  padding: clamp(44px, 8vw, 86px) clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #fffdf8, #eef6f1);
}

.hero h1,
.admin-head h1,
.login-panel h1 {
  margin: 6px 0 12px;
  font-size: clamp(2.2rem, 6vw, 5rem);
  line-height: 1;
}

.hero p {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.08rem;
}

.schedule,
.admin-shell,
.login-panel {
  padding: clamp(28px, 5vw, 58px) clamp(18px, 4vw, 56px);
}

.shift,
.panel,
.admin-shift,
.module-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: clamp(16px, 3vw, 26px);
  box-shadow: 0 8px 24px rgba(32, 32, 29, 0.08);
}

.shift + .shift,
.panel + .panel,
.admin-shift + .admin-shift,
.tab-panel + .tab-panel {
  margin-top: 18px;
}

.shift-head,
.admin-head,
.admin-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.admin-head.compact {
  align-items: center;
  margin: 24px 0 16px;
}

.admin-head.compact h2 {
  margin: 4px 0 0;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
}

.shift-head h2,
.panel h2 {
  margin: 4px 0 0;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
}

.shift-head strong {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  border: 1px solid rgba(192, 154, 72, 0.48);
  border-radius: 8px;
  background: #fff8e8;
  color: var(--green);
  font-size: clamp(1.22rem, 2vw, 1.6rem);
  font-weight: 900;
  line-height: 1.1;
  padding: 8px 13px;
  white-space: nowrap;
}

.duty-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.duty,
.admin-duty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 14px;
}

.duty.is-full {
  opacity: 0.72;
}

.duty-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.duty h3 {
  margin: 0;
}

.duty span,
.admin-line span {
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-shift > .admin-line span {
  color: var(--green);
  font-size: clamp(1.08rem, 1.8vw, 1.35rem);
  font-weight: 900;
}

.helpers {
  min-height: 92px;
  margin: 12px 0;
  padding-left: 20px;
}

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

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.button.primary {
  background: var(--red);
  color: var(--white);
}

.button.secondary {
  background: var(--white);
  border-color: var(--line);
  color: var(--ink);
}

.button.danger {
  background: var(--white);
  border-color: rgba(124, 32, 50, 0.38);
  color: var(--red);
}

.button.danger:hover {
  background: #fff3f3;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

dialog {
  width: min(520px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
}

dialog::backdrop {
  background: rgba(32, 32, 29, 0.58);
}

#signupForm,
.panel form,
.form-grid,
.login-panel .panel {
  display: grid;
  gap: 14px;
}

#signupForm {
  padding: 24px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cfc6b8;
  border-radius: 7px;
  background: var(--white);
  padding: 10px 11px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.module-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 8px;
  border-bottom: 1px solid var(--line);
}

.module-tab {
  min-height: 44px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 10px 16px;
  font-weight: 800;
}

.module-tab.is-active {
  border-color: var(--line);
  background: var(--white);
  color: var(--green);
  box-shadow: 0 -3px 0 var(--gold) inset;
}

.tab-panel {
  padding-top: 16px;
}

.module-card {
  max-width: 760px;
}

.module-card h2 {
  margin: 4px 0 10px;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
}

.module-card p {
  color: var(--muted);
}

.user-summary {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.user-summary div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.user-summary dt {
  color: var(--muted);
  font-weight: 800;
}

.user-summary dd {
  margin: 0;
}

.status {
  min-height: 1.2em;
  color: var(--red);
  font-weight: 800;
}

.login-panel {
  display: grid;
  min-height: calc(100vh - 73px);
  place-items: center;
}

.login-panel .panel {
  width: min(460px, 100%);
}

.form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check input {
  width: auto;
}

.admin-duty-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.admin-duty ul {
  display: grid;
  gap: 8px;
  padding-left: 0;
  list-style: none;
}

.admin-duty li,
.export-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mini-danger {
  border: 0;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font-weight: 800;
}

.is-inactive {
  opacity: 0.58;
}

.exports-list {
  display: grid;
  gap: 10px;
}

.users-list {
  display: grid;
  gap: 10px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 14px;
}

.user-row strong,
.user-row span {
  display: block;
}

.user-row span {
  color: var(--muted);
  font-size: 0.92rem;
}

.user-state {
  min-width: 86px;
  border-radius: 999px;
  background: #eef6f1;
  color: var(--green) !important;
  padding: 5px 10px;
  font-weight: 900;
  text-align: center;
}

.user-row.is-inactive .user-state {
  background: #f7e8e8;
  color: var(--red) !important;
}

.loading,
.empty-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: 18px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .duty-grid,
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .topbar,
  .shift-head,
  .admin-head,
  .admin-line,
  .admin-duty li,
  .export-row,
  .user-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .user-row {
    display: flex;
  }

  .duty-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .module-tabs {
    border-bottom: 0;
  }

  .module-tab {
    flex: 1 1 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
  }

  .user-summary div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
