:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #60717c;
  --line: #d7e0e4;
  --paper: #ffffff;
  --wash: #f4f8f4;
  --brand: #1c6b5a;
  --brand-dark: #10483d;
  --accent: #b6482d;
  --gold: #f1b94e;
  --highlight: #fff1bc;
  --success: #277044;
  --danger: #b1342c;
  --shadow: 0 16px 40px rgba(20, 38, 45, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(244, 248, 244, 0.96), rgba(255, 255, 255, 0.92)),
    url("https://images.unsplash.com/photo-1502136969935-8d8eef54d77b?auto=format&fit=crop&w=1800&q=80") center/cover fixed;
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  padding: 0 14px;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.link-button {
  background: transparent;
  border-color: transparent;
  color: var(--brand-dark);
  min-height: auto;
  padding: 0;
  text-decoration: underline;
  width: fit-content;
}

button:hover:not(:disabled) {
  border-color: var(--brand);
  transform: translateY(-1px);
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 56px);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid rgba(215, 224, 228, 0.8);
  backdrop-filter: blur(8px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 3.8vw, 3.6rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 1.35rem;
  line-height: 1.2;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab.active,
.primary-action {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.primary-action {
  width: 100%;
  margin-top: 20px;
  font-weight: 700;
}

main {
  padding: 28px clamp(18px, 4vw, 56px) 56px;
}

.site-footer {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.9rem;
  gap: 10px;
  justify-content: center;
  padding: 0 clamp(18px, 4vw, 56px) 32px;
  text-align: center;
}

.site-footer a {
  color: var(--brand-dark);
  font-weight: 700;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.layout,
.dashboard {
  display: grid;
  gap: 20px;
}

.layout {
  grid-template-columns: minmax(300px, 0.95fr) minmax(320px, 1.05fr);
  align-items: start;
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(215, 224, 228, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.panel-heading,
.admin-controls,
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading {
  margin-bottom: 16px;
}

select,
input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
}

label {
  display: grid;
  gap: 6px;
  color: #384950;
  font-size: 0.9rem;
  font-weight: 700;
}

.shift-list {
  display: grid;
  gap: 10px;
  max-height: 68vh;
  overflow: auto;
  padding-right: 4px;
}

.gender-filter,
.shift-person-selector {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  margin-bottom: 14px;
  padding: 14px;
}

.shift-person-selector {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shift-person-selector span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.shift-person-selector button {
  min-height: 36px;
  padding: 7px 11px;
}

.shift-person-selector button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.shift-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  width: 100%;
  min-height: 76px;
  padding: 14px;
  text-align: left;
}

.shift-card.selected {
  border-color: var(--brand);
  background: #eef7f1;
}

.shift-card.full {
  background: #f6eeee;
}

.shift-meta {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 4px;
}

.badge {
  align-self: start;
  border-radius: 999px;
  color: #fff;
  background: var(--success);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 9px;
  white-space: nowrap;
}

.badge.full {
  background: var(--danger);
}

.selected-shift {
  border: 2px solid var(--gold);
  border-left-width: 6px;
  background: var(--highlight);
  border-radius: 8px;
  margin-bottom: 18px;
  padding: 13px 14px;
  color: #4a3a18;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(120, 82, 12, 0.12);
}

.team-choice-field {
  background: var(--highlight);
  border: 2px solid var(--gold);
  border-left-width: 6px;
  border-radius: 8px;
  color: #4a3a18;
  padding: 12px;
}

.team-choice-field select {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(215, 155, 46, 0.18);
  font-weight: 800;
}

.team-guidance-message {
  background: var(--highlight);
  border: 2px solid var(--gold);
  border-left-width: 6px;
  border-radius: 8px;
  color: #4a3a18;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(120, 82, 12, 0.12);
}

.selected-slots-panel,
.signup-review {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding: 14px;
}

.slot-panel-title {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.selected-slot-list,
.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.selected-person-group,
.review-person-group {
  display: grid;
  gap: 8px;
}

.selected-person-group p {
  color: var(--ink);
  font-weight: 800;
}

.selected-slot-pill {
  align-items: center;
  display: inline-flex;
  gap: 10px;
  min-height: 38px;
}

.selected-slot-pill span,
.signup-review li button {
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 700;
}

.signup-review {
  background: #eef7f1;
  border-color: #b8d7ca;
  margin-bottom: 0;
  margin-top: 14px;
}

.signup-review ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.signup-review li {
  display: grid;
  gap: 8px;
}

.signup-review li button {
  border: 0;
  min-height: 0;
  padding: 0 0 0 8px;
}

.worker-select {
  margin-top: 8px;
}

.review-worker-note {
  color: var(--muted);
  display: block;
  font-size: 0.9rem;
  margin-top: 4px;
}

.review-actions button:first-child {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.span-2 {
  grid-column: span 2;
}

.second-person-section {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
}

.second-person-fields {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 14px;
}

.checkbox-label {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 10px;
}

.checkbox-label input {
  min-height: auto;
  width: auto;
}

.sms-consent {
  align-items: flex-start;
  background: #fff7df;
  border: 2px solid #d99a21;
  border-radius: 8px;
  color: #49320a;
  font-weight: 700;
  line-height: 1.45;
  padding: 12px;
}

.sms-consent input[type="checkbox"] {
  accent-color: #b66f00;
  flex: 0 0 auto;
  height: 28px;
  margin-top: 2px;
  width: 28px;
}

.message {
  min-height: 22px;
  margin-top: 12px;
  color: var(--success);
  font-weight: 700;
}

.error {
  color: var(--danger);
}

.duplicate-warning {
  border: 1px solid #e4b55c;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: #fff8e8;
  color: #4a3a18;
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
}

.duplicate-warning ul {
  margin: 0;
  padding-left: 20px;
}

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

.duplicate-actions button:first-child {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.login-panel {
  max-width: 480px;
  margin: 0 auto;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

#forgotPasswordForm,
#passwordResetForm {
  background: #f6fbfa;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 14px;
}

.returning-volunteer {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 22px;
}

.volunteer-dashboard {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.volunteer-dashboard-header,
.volunteer-shift-editor {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.volunteer-dashboard h3 {
  font-size: 1.05rem;
  margin: 0;
}

.volunteer-shift-list {
  display: grid;
  gap: 12px;
}

.volunteer-shift-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.volunteer-shift-editor label {
  flex: 1;
}

.shift-note {
  color: var(--muted);
  font-size: 0.86rem;
  margin: -4px 0 4px;
}

.hint,
.stat {
  color: var(--muted);
  font-size: 0.9rem;
}

.hidden {
  display: none;
}

.admin-controls {
  align-items: flex-end;
}

.recovery-logout-panel,
.forced-password-panel {
  align-items: center;
  display: grid;
  gap: 14px;
}

.recovery-logout-panel {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.control-row {
  flex-wrap: wrap;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-tab {
  background: #fff;
  min-height: 38px;
  padding: 8px 12px;
}

.admin-tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.admin-tab-panel.active {
  display: grid;
}

.admin-confirm-panel {
  align-items: center;
  background: #fff8e8;
  border: 1px solid #e4b55c;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  color: #4a3a18;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px;
}

.admin-confirm-panel p {
  margin-top: 4px;
}

.admin-extra-ack {
  margin-top: 10px;
}

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

.admin-schedule,
.email-template-form,
.admin-account-form,
.regular-admin-list,
.admin-log,
.time-slot-editor {
  display: grid;
  gap: 14px;
}

.admin-subsection {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
}

.admin-subsection h3 {
  font-size: 1rem;
  margin: 0;
}

.setup-grid {
  display: grid;
  gap: 14px;
}

.setup-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.setup-card h3 {
  font-size: 1rem;
  margin: 0;
}

.admin-shift {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.admin-shift-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: #edf4f3;
  padding: 12px 14px;
  font-weight: 700;
}

.admin-shift-tools {
  align-items: end;
  background: #fbfdfc;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
}

.admin-shift-tools label {
  max-width: 180px;
}

.admin-volunteer-actions {
  display: grid;
  gap: 8px;
  min-width: 260px;
}

.admin-volunteer-actions button {
  min-height: 34px;
}

.time-slot-table-wrap {
  overflow-x: auto;
}

.time-slot-table input {
  min-width: 126px;
}

.time-slot-table [data-slot-name],
.time-slot-table [data-new-shift-name] {
  min-width: 190px;
}

.time-slot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.danger-button {
  color: var(--danger);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #40545c;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.empty-row,
.empty-state {
  color: var(--muted);
  padding: 14px;
}

.email-template-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 13px 14px;
  background: #fbfdfc;
}

.email-template-card legend {
  color: var(--ink);
  font-weight: 800;
  padding: 0 6px;
}

.email-template-card textarea {
  min-height: 118px;
  resize: vertical;
}

@media (max-width: 860px) {
  .topbar,
  .panel-heading,
  .admin-controls,
  .recovery-logout-panel,
  .forced-password-panel,
  .admin-confirm-panel,
  .volunteer-dashboard-header,
  .volunteer-shift-editor {
    align-items: stretch;
    flex-direction: column;
  }

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

  .span-2 {
    grid-column: auto;
  }

  .admin-volunteer-actions {
    min-width: 0;
  }

  .admin-shift-tools label {
    max-width: none;
  }

  .shift-list {
    max-height: none;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .admin-controls,
  .admin-tabs,
  #emailAdminPanel,
  #logAdminPanel,
  #accountAdminPanel {
    display: none !important;
  }

  main,
  .panel {
    padding: 0;
  }

  .panel {
    border: 0;
    box-shadow: none;
  }

  body.print-day-view * {
    visibility: hidden !important;
  }

  body.print-day-view #scheduleAdminPanel,
  body.print-day-view #scheduleAdminPanel * {
    visibility: visible !important;
  }

  body.print-day-view #scheduleAdminPanel {
    display: block !important;
    left: 0;
    margin: 0;
    padding: 0;
    position: absolute;
    top: 0;
    width: 100%;
  }

  body.print-day-view #adminEditMessage,
  body.print-day-view .admin-shift-tools,
  body.print-day-view .admin-volunteer-actions,
  body.print-day-view #adminSchedule th:last-child,
  body.print-day-view #adminSchedule td:last-child {
    display: none !important;
  }
}
