:root {
  color-scheme: light;
  --bg: #f6f3ed;
  --surface: #ffffff;
  --ink: #17211f;
  --muted: #63716d;
  --line: #dfe5df;
  --brand: #0b5a53;
  --brand-2: #f2b84b;
  --accent: #2f6fd6;
  --danger: #b42318;
  --ok: #16865f;
  --shadow: 0 18px 50px rgba(23, 33, 31, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(160deg, rgba(11, 90, 83, 0.12), transparent 34%),
    linear-gradient(20deg, rgba(242, 184, 75, 0.16), transparent 38%),
    var(--bg);
  color: var(--ink);
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.login-page {
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 28px 18px;
}

.login-panel {
  width: min(100%, 430px);
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.brand-stage {
  background: linear-gradient(180deg, #ffffff 0%, #f7faf9 55%, #e9f1ef 100%);
  color: var(--ink);
  padding: 32px 26px 26px;
  text-align: center;
}

.logo-mark {
  width: min(78vw, 310px);
  height: auto;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 34px;
  display: grid;
  place-items: center;
  background: #ffffff;
  box-shadow: 0 20px 48px rgba(0, 22, 60, 0.18);
  overflow: hidden;
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mini-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-stage h1 {
  margin: 22px 0 8px;
  font-size: clamp(2.1rem, 12vw, 3.8rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.brand-stage p {
  max-width: 25rem;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.5;
}

.login-form {
  padding: 24px;
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfb;
  color: var(--ink);
  padding: 13px 14px;
  outline: none;
}

.field textarea {
  resize: vertical;
  min-height: 92px;
}

.field select[multiple] {
  min-height: 156px;
  padding: 8px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(11, 90, 83, 0.12);
}

.date-priority {
  grid-column: 1 / -1;
  gap: 10px;
  inline-size: 100%;
  max-inline-size: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 14px;
  border: 1px solid rgba(180, 35, 24, 0.42);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff7f6, #fff);
  box-shadow: 0 14px 34px rgba(180, 35, 24, 0.12);
}

.date-priority span {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  background: #17211f;
  color: #fff;
  font-size: 0.9rem;
}

.date-priority small {
  color: #7a2d28;
  line-height: 1.35;
  font-weight: 700;
}

.date-input-shell {
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
  overflow: hidden;
  border-radius: 14px;
}

.date-priority input {
  display: block;
  inline-size: 100%;
  width: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
  min-width: 0;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  border-color: rgba(180, 35, 24, 0.35);
  background: #fff;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
}

.date-priority input:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.14);
}

.volunteer-picker {
  align-self: start;
}

.volunteer-options {
  max-height: 170px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfb;
}

.volunteer-options button {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  padding: 10px 12px;
  text-align: left;
  font: inherit;
  font-weight: 700;
}

.volunteer-options button.selected,
.volunteer-options button:focus {
  border-color: rgba(0, 110, 96, 0.35);
  background: #e9f3f0;
  color: var(--brand);
  outline: none;
}

.shift-assignment-field {
  grid-column: 1 / -1;
}

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

.shift-assignment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfb;
}

.shift-assignment-row .field {
  margin: 0;
}

.shift-assignment-row .icon-btn {
  width: 44px;
  min-width: 44px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.icon-btn {
  min-height: 44px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
}

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

.secondary-btn {
  background: #e8f0ee;
  color: var(--brand);
}

.secondary-btn.compact {
  min-height: 34px;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.secondary-btn.danger {
  background: #fff0ee;
  color: var(--danger);
}

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

.icon-btn {
  width: 44px;
  padding: 0;
  background: #eef3f1;
  color: var(--brand);
}

.icon-btn.small {
  width: 34px;
  min-height: 34px;
  border-radius: 11px;
}

.icon-btn.small .inline-icon {
  width: 18px;
  height: 18px;
}

.toggle-catalog-btn.deactivate {
  background: #fff0ee;
  color: var(--danger);
}

.toggle-catalog-btn.activate {
  background: #e8f0ee;
  color: var(--brand);
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e8f0ee;
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.sync-status.syncing {
  background: #fff8df;
  color: #8a5b00;
}

.sync-status.error {
  background: #fff0ee;
  color: var(--danger);
}

.sync-warning {
  margin: 10px auto 0;
  width: min(1120px, calc(100% - 32px));
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid #f4b4ad;
  border-radius: 14px;
  background: #fff0ee;
  color: var(--danger);
  box-shadow: 0 12px 32px rgba(180, 35, 24, 0.12);
}

.sync-warning[hidden] {
  display: none;
}

.sync-warning strong {
  font-size: 0.86rem;
}

.sync-warning span {
  color: #7f1d1d;
  font-size: 0.78rem;
  line-height: 1.35;
}

.avatar-btn,
.profile-photo-preview {
  border: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #eef3f1;
  color: var(--brand);
  font-weight: 900;
}

.avatar-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.avatar-btn img,
.profile-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.4;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-width: 100vw;
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(246, 243, 237, 0.88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(223, 229, 223, 0.76);
}

.mini-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.mini-logo {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  overflow: hidden;
}

.mini-brand strong,
.screen-title h2,
.card h3 {
  letter-spacing: 0;
}

.mini-brand small {
  display: block;
  color: var(--muted);
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  width: min(1120px, 100%);
  max-width: 100vw;
  margin: 0 auto;
  padding: 18px 16px 104px;
  overflow-x: clip;
}

.screen-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 8px 0 18px;
}

.screen-title h2 {
  margin: 0;
  font-size: clamp(1.7rem, 7vw, 2.6rem);
  line-height: 1;
}

.screen-title p {
  margin: 8px 0 0;
  color: var(--muted);
}

.stats-grid,
.cards-grid,
.form-grid {
  display: grid;
  gap: 12px;
}

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

.stat {
  min-height: 104px;
  border-radius: 18px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(23, 33, 31, 0.06);
}

.stat span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 10px;
  font-size: 2rem;
}

.card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 10px 26px rgba(23, 33, 31, 0.06);
  overflow-x: auto;
}

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

.section-stack {
  display: grid;
  gap: 14px;
}

.overview-groups {
  display: grid;
  gap: 12px;
}

.overview-card {
  padding: 0;
}

.overview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfb;
}

.overview-head strong,
.overview-head span {
  display: block;
}

.overview-head span:not(.pill) {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.3;
}

.sector-list {
  display: grid;
}

.sector-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.85fr) minmax(0, 1.15fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.sector-row:first-child {
  border-top: 0;
}

.sector-row span {
  min-width: 0;
  line-height: 1.35;
}

.sector-row em {
  font-style: normal;
  color: var(--ok);
  font-size: 0.76rem;
  font-weight: 800;
}

.sector-row em.pending {
  color: var(--danger);
}

.sector-row em.gold {
  color: #806000;
}

.sector-row em.green {
  color: var(--brand);
}

.sector-row em.blue {
  color: #315a8a;
}

.sector-row em.red {
  color: var(--danger);
}

.ministry-row,
.user-row,
.shift-row {
  display: grid;
  gap: 8px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.grouped-shift {
  gap: 10px;
}

.compact-sector-list {
  display: grid;
  gap: 7px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f7faf9;
}

.compact-sector-list div {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) minmax(0, 1.1fr);
  gap: 10px;
  align-items: center;
}

.compact-sector-list strong {
  color: var(--brand);
}

.compact-shift-meta,
.compact-shift-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.compact-shift-actions {
  flex-wrap: wrap;
}

.leader-panel {
  margin-top: 14px;
}

.leader-panel h3 {
  margin: 0;
}

.pending-row {
  display: grid;
  grid-template-columns: minmax(112px, 0.75fr) minmax(0, 1.25fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.pending-row:first-of-type {
  border-top: 0;
}

.pending-row strong {
  min-width: 0;
  color: var(--ink);
}

.pending-row span:not(.pill) {
  min-width: 0;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: right;
  line-height: 1.25;
}

.compact-empty {
  padding: 16px;
}

.compact-sector-list span {
  min-width: 0;
  color: var(--muted);
  line-height: 1.35;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  text-align: right;
}

.inline-edit {
  width: 28px;
  height: 28px;
  margin-left: 6px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  background: #e8f0ee;
  color: var(--brand);
}

.inline-edit .inline-icon {
  width: 16px;
  height: 16px;
}

.inline-edit.danger {
  color: var(--danger);
  background: #fff0ee;
}

.volunteer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.ministry-row:first-child,
.user-row:first-child,
.shift-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.row-head strong {
  min-width: 0;
}

.user-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #edf4f2;
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 800;
}

.pill.gold {
  background: #fff3d5;
  color: #8a5b08;
}

.pill.green {
  background: #e8f7ef;
  color: var(--ok);
}

.pill.blue {
  background: #eaf1ff;
  color: var(--accent);
}

.pill.red {
  background: #fff0ee;
  color: var(--danger);
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.nav-btn {
  min-height: 56px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  gap: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.nav-btn svg,
.inline-icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-btn.active {
  background: #e8f0ee;
  color: var(--brand);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.schedule-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.schedule-filters .field {
  min-width: 0;
}

.schedule-filters .field:nth-child(3) {
  grid-column: 1 / -1;
}

.schedule-filters input,
.schedule-filters select {
  height: 54px;
  min-height: 54px;
  line-height: 1.2;
  appearance: none;
  -webkit-appearance: none;
}

.schedule-filters input[type="month"] {
  display: block;
  text-align: left;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
}

.segmented button {
  min-height: 42px;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segmented button.active {
  background: var(--brand);
  color: #fff;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.ministry-activity-tools {
  margin-top: 12px;
}

.inline-create {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(96px, 0.7fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.activity-form {
  grid-template-columns: minmax(140px, 1.2fr) minmax(120px, 1fr) minmax(92px, 0.7fr) auto;
}

.catalog-search {
  margin-bottom: 12px;
}

.toolbar .field {
  min-width: 160px;
  flex: 1 1 160px;
}

.readonly-field strong {
  display: flex;
  min-height: 54px;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

.scale-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
}

.scale-filters .field {
  min-width: 0;
}

.filter-clear {
  min-height: 54px;
  white-space: nowrap;
  grid-column: 1 / -1;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: end;
  background: rgba(23, 33, 31, 0.42);
}

.dialog {
  width: min(100%, 560px);
  margin: 0 auto;
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
}

.dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.dialog h3 {
  margin: 0;
  font-size: 1.28rem;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}

.import-box {
  display: grid;
  gap: 12px;
}

.file-drop {
  min-height: 142px;
  border: 1px dashed #b7c5c1;
  border-radius: 18px;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #f8fbfa;
  color: var(--muted);
  text-align: center;
}

.file-drop input {
  max-width: 100%;
}

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

.check-option {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfb;
  color: var(--ink);
  font-weight: 700;
}

.check-option:has(input:checked) {
  border-color: rgba(0, 110, 96, 0.42);
  background: #e9f3f0;
  color: var(--brand);
}

.check-option:has(input:checked)::after {
  content: "✓";
  margin-left: auto;
  font-size: 16px;
  font-weight: 900;
}

.check-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.function-check-grid {
  max-height: 230px;
  margin-top: 10px;
  overflow: auto;
  padding-right: 2px;
}

.profile-readonly {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.profile-photo-editor {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.profile-photo-preview {
  width: 86px;
  height: 86px;
  border-radius: 24px;
  font-size: 1.5rem;
  border: 1px solid var(--line);
}

.profile-readonly div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 8px;
  background: #f7faf9;
  border: 1px solid var(--line);
}

.profile-readonly span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

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

.desktop-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

@media (max-width: 559px) {
  .bottom-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  }

  .topbar {
    gap: 8px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .mini-brand {
    gap: 8px;
  }

  .mini-logo {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .mini-brand small {
    max-width: 136px;
  }

  .top-actions {
    gap: 6px;
  }

  .sync-status {
    max-width: 94px;
    min-height: 30px;
    padding: 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.64rem;
  }

  .avatar-btn {
    width: 40px;
    height: 40px;
  }

  .nav-btn {
    min-width: 0;
    min-height: 54px;
    border-radius: 13px;
    font-size: 0.66rem;
  }

  .nav-btn svg {
    width: 20px;
    height: 20px;
  }

  .schedule-filters {
    width: 100%;
    max-width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 8px;
  }

  .schedule-filters input,
  .schedule-filters select {
    height: 52px;
    min-height: 52px;
    padding: 11px 12px;
    font-size: 0.95rem;
  }

  .scale-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 8px;
  }

  .scale-filters .field,
  .scale-filters .filter-clear {
    min-width: 0;
  }

  .scale-filters .field:nth-child(3),
  .scale-filters .field:nth-child(4),
  .scale-filters .filter-clear {
    grid-column: 1 / -1;
  }

  .segmented {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border-radius: 14px;
  }

  .segmented button {
    min-height: 38px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 0.86rem;
  }

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

  .inline-create {
    grid-template-columns: 1fr;
  }

  .profile-photo-editor {
    grid-template-columns: 1fr;
  }

  .check-grid {
    grid-template-columns: 1fr;
  }

  .ministry-row {
    overflow: hidden;
  }

  .ministry-row .row-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 8px;
  }

  .ministry-row .row-head strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ministry-row .user-actions {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, max-content)) repeat(2, 32px);
    justify-content: start;
    align-items: center;
    gap: 6px;
  }

  .ministry-row .pill {
    min-height: 28px;
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  .ministry-row .icon-btn.small {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .ministry-row .icon-btn.small svg {
    width: 18px;
    height: 18px;
  }

  .function-row .user-actions {
    grid-template-columns: minmax(48px, 74px) 42px 56px 52px 30px 30px;
    gap: 4px;
    align-items: center;
  }

  .function-row .pill {
    min-height: 26px;
    padding: 4px 6px;
    font-size: 0.66rem;
    justify-content: center;
  }

  .function-row .pill:first-child {
    max-width: 74px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .function-row .icon-btn.small {
    width: 30px;
    height: 30px;
  }

  .function-row .icon-btn.small svg {
    width: 16px;
    height: 16px;
  }

  .shift-assignment-row {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .shift-assignment-row .field {
    grid-column: 1 / -1;
  }

  .shift-assignment-row .icon-btn {
    grid-column: 2;
  }

  .compact-sector-list div {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid rgba(223, 229, 223, 0.82);
  }

  .compact-sector-list div:first-child {
    border-top: 0;
    padding-top: 0;
  }

  .compact-sector-list {
    gap: 4px;
    padding: 8px 10px;
  }

  .compact-sector-list strong {
    font-size: 0.9rem;
    line-height: 1.2;
  }

  .compact-sector-list span {
    font-size: 0.84rem;
    line-height: 1.2;
    justify-content: flex-start;
    text-align: left;
    flex-wrap: wrap;
  }

  .compact-shift-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .compact-volunteer {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .compact-shift-actions {
    justify-content: flex-start;
  }

  .compact-sector-list .pill {
    min-height: 22px;
    padding: 3px 8px;
    font-size: 0.7rem;
  }

  .sector-row {
    grid-template-columns: minmax(126px, 1fr) minmax(0, 0.85fr) auto;
    gap: 8px;
    padding: 9px 10px;
    align-items: center;
  }

  .sector-row strong {
    min-width: 0;
    font-size: 0.9rem;
    line-height: 1.2;
  }

  .sector-row span {
    min-width: 0;
    font-size: 0.86rem;
    line-height: 1.2;
    text-align: right;
  }

  .sector-row em {
    justify-self: end;
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #e8f7ef;
    font-size: 0.7rem;
    line-height: 1.2;
  }

  .sector-row em.pending {
    background: #fff0ee;
  }

  .pending-row {
    grid-template-columns: minmax(108px, 0.85fr) minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px 0;
  }

  .pending-row strong {
    font-size: 0.9rem;
    line-height: 1.2;
  }

  .pending-row span:not(.pill) {
    font-size: 0.78rem;
  }

  .pending-row .pill {
    min-height: 22px;
    padding: 3px 8px;
    font-size: 0.7rem;
  }

  .desktop-table,
  .desktop-table thead,
  .desktop-table tbody,
  .desktop-table tr,
  .desktop-table th,
  .desktop-table td {
    display: block;
  }

  .desktop-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .desktop-table tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .desktop-table tr:last-child {
    border-bottom: 0;
  }

  .desktop-table td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    padding: 6px 0;
    border-bottom: 0;
  }

  .desktop-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
  }
}

@media (min-width: 760px) {
  .content {
    padding-bottom: 34px;
  }

  .layout {
    grid-template-columns: 250px 1fr;
    grid-template-rows: auto 1fr;
  }

  .topbar {
    grid-column: 1 / -1;
  }

  .bottom-nav {
    position: sticky;
    top: 79px;
    align-self: start;
    grid-row: 2;
    grid-template-columns: 1fr;
    height: calc(100vh - 79px);
    padding: 16px;
    border-top: 0;
    border-right: 1px solid var(--line);
  }

  .nav-btn {
    grid-template-columns: 28px 1fr;
    justify-items: start;
    padding: 0 16px;
    font-size: 0.9rem;
  }

  .content {
    grid-column: 2;
  }

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

  .cards-grid {
    grid-template-columns: 1.1fr 0.9fr;
  }

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

  .dialog-backdrop {
    align-items: center;
    padding: 24px;
  }

  .dialog {
    border-radius: 24px;
  }
}
