:root {
  color-scheme: light;
  --font-ui: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  --bg: #e7edf5;
  --surface: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #eef4ff;
  --panel-warm: #fff7ed;
  --border: #dbe4ef;
  --border-strong: #b8c5d6;
  --text: #13223a;
  --text-soft: #4b5d75;
  --text-muted: #7e8da3;
  --blue: #1d6cff;
  --blue-strong: #0d5bf0;
  --blue-soft: #e8f0ff;
  --green: #24c36b;
  --green-soft: #e8f8ef;
  --orange: #ff8a2a;
  --orange-soft: #fff1e5;
  --purple: #a855f7;
  --purple-soft: #f4eaff;
  --red: #f25555;
  --red-soft: #ffeded;
  --yellow: #eab308;
  --yellow-soft: #fff7d6;
  --shadow: 0 18px 44px rgba(20, 34, 58, 0.16);
  --shadow-soft: 0 10px 22px rgba(20, 34, 58, 0.1);
  --radius-card: 8px;
  --radius-control: 12px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-family: var(--font-ui);
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  margin: 0;
  display: flex;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

img {
  max-width: 100%;
  display: block;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--text);
  padding: 12px 13px;
  min-height: 46px;
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(29, 108, 255, 0.54);
  box-shadow: 0 0 0 4px rgba(29, 108, 255, 0.12);
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.phone-shell {
  width: 100vw;
  width: 100dvw;
  max-width: 430px;
  min-width: 0;
  height: 100dvh;
  min-height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 0 0 1px rgba(19, 34, 58, 0.08), var(--shadow);
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: calc(64px + env(safe-area-inset-top));
  padding: calc(10px + env(safe-area-inset-top)) 10px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: rgba(246, 248, 251, 0.96);
  backdrop-filter: blur(16px);
}

.brand-button {
  width: 158px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: transparent;
  padding: 0;
}

.brand-button img {
  width: 146px;
  max-height: 36px;
  object-fit: contain;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.icon-button {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #fff;
  color: var(--text-soft);
  box-shadow: 0 5px 12px rgba(20, 34, 58, 0.06);
}

.icon-button:active {
  transform: translateY(1px);
}

.has-badge span {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  border: 2px solid #fff;
}

.app-main {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 6px 4px calc(88px + env(safe-area-inset-bottom));
  scroll-padding-bottom: 96px;
}

.app-main::-webkit-scrollbar {
  width: 0;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
}

.screen-stack {
  display: grid;
  gap: 8px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.section-title {
  min-width: 0;
}

.section-title h1,
.section-title h2,
.section-title h3 {
  margin: 0;
  color: var(--text);
  line-height: 1.12;
}

.section-title h1 {
  font-size: 1.24rem;
}

.section-title h2 {
  font-size: 1.08rem;
}

.section-title h3 {
  font-size: 1rem;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
}

.worker-card {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.auth-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.auth-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

.auth-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.auth-panel p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.35;
}

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

.invite-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 9px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(36, 195, 107, 0.28);
  border-radius: var(--radius-card);
  background: var(--green-soft);
}

.invite-card strong,
.invite-card p {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invite-card p {
  margin: 3px 0 0;
  color: #087a3c;
  font-weight: 800;
}

.invite-card .primary-action {
  min-height: 40px;
  padding: 8px 10px;
}

.worker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(36, 195, 107, 0.26);
  font-weight: 900;
}

.avatar.compact {
  width: 36px;
  height: 36px;
  font-size: 0.78rem;
}

.worker-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.worker-name strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.worker-name small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-weight: 700;
}

.status-pill,
.small-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  line-height: 1.15;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-pill.online {
  background: var(--green-soft);
  color: #087a3c;
}

.status-pill.offline {
  background: var(--red-soft);
  color: #bc2626;
}

.small-pill.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.small-pill.green {
  background: var(--green-soft);
  color: #087a3c;
}

.small-pill.orange {
  background: var(--orange-soft);
  color: #a34b00;
}

.small-pill.purple {
  background: var(--purple-soft);
  color: #7c2db6;
}

.small-pill.red {
  background: var(--red-soft);
  color: #bc2626;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.stat-box {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #fbfdff;
}

.stat-box strong {
  display: block;
  font-size: 1rem;
  line-height: 1.1;
}

.stat-box span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.71rem;
  font-weight: 800;
  line-height: 1.2;
}

.calendar-panel {
  padding: 6px 3px 8px;
  overflow: hidden;
  touch-action: pan-y;
}

.monthbar {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 4px;
  align-items: center;
  margin-bottom: 7px;
}

.monthbar > button:not(.month-title-button) {
  width: 36px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-control);
  background: var(--blue-soft);
  color: var(--blue);
}

.month-title-button {
  min-width: 0;
  min-height: 34px;
  padding: 4px 8px;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text);
  text-align: center;
  touch-action: manipulation;
}

.month-title-button strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-size: 0.96rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-title-button:active {
  background: var(--blue-soft);
  color: var(--blue);
}

.weekday-grid,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  min-width: 0;
}

.weekday-grid {
  margin-bottom: 4px;
}

.weekday-grid span {
  min-width: 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.day-cell {
  position: relative;
  min-width: 0;
  aspect-ratio: 0.72;
  min-height: 66px;
  width: 100%;
  padding: 5px 5px 6px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: stretch;
  justify-items: stretch;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  overflow: hidden;
  text-align: left;
}

.day-cell.spacer {
  pointer-events: none;
  opacity: 0;
}

.day-cell.weekend {
  border-color: rgba(242, 85, 85, 0.58);
}

.day-cell.today {
  box-shadow: inset 0 0 0 2px rgba(29, 108, 255, 0.65);
}

.day-cell.selected {
  box-shadow: inset 0 0 0 2px var(--orange);
}

.day-cell.selectable {
  border-color: rgba(29, 108, 255, 0.7);
}

.day-cell.blocked {
  opacity: 0.56;
}

.day-cell.personal-blocked {
  box-shadow: inset 0 0 0 2px rgba(242, 85, 85, 0.72);
}

.day-cell.has-swap-change {
  box-shadow: inset 0 0 0 2px rgba(255, 174, 0, 0.9);
}

.day-cell.today.has-swap-change {
  box-shadow:
    inset 0 0 0 2px rgba(255, 174, 0, 0.95),
    inset 0 0 0 4px rgba(29, 108, 255, 0.5);
}

.day-number {
  font-size: 0.82rem;
  line-height: 1;
  font-weight: 900;
  text-align: left;
}

.swap-change-alert {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #ffb000;
  color: #271700;
  box-shadow: 0 5px 12px rgba(50, 30, 0, 0.22);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}

.shift-badge,
.reminder-chip,
.blocked-day-chip,
.swap-return-badge {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: clip;
  border-radius: 0;
  min-height: 0;
  padding: 0;
  font-size: 0.7rem;
  line-height: 1.05;
  font-weight: 900;
  text-align: left;
  align-self: end;
}

.swap-return-badge {
  justify-self: stretch;
  border: 1px solid rgba(11, 18, 32, 0.12);
  border-radius: 7px;
  padding: 3px 4px;
  background: #fff;
  color: var(--text);
  text-align: center;
  box-shadow: 0 5px 14px rgba(11, 18, 32, 0.16);
  animation: swapReturnBlink 1.05s ease-in-out infinite;
}

.swap-return-badge.larga {
  border-color: rgba(13, 166, 87, 0.48);
  color: #087a3c;
}

.swap-return-badge.noche {
  border-color: rgba(29, 108, 255, 0.48);
  color: var(--blue);
}

@keyframes swapReturnBlink {
  0%,
  100% {
    opacity: 1;
    transform: translateY(0);
  }

  50% {
    opacity: 0.42;
    transform: translateY(-1px);
  }
}

.shift-badge.label-sm {
  font-size: 0.62rem;
}

.shift-badge.label-xs {
  font-size: 0.54rem;
  line-height: 1;
}

.shift-badge.larga {
  color: #fff;
}

.shift-badge.noche {
  color: #fff;
}

.shift-badge.libre {
  display: none;
  color: var(--text-muted);
}

.shift-badge.permiso {
  color: #fff;
}

.shift-badge.turno24 {
  color: #fff;
}

.shift-badge.diurno {
  color: #fff;
}

.shift-badge.diurno-noche {
  color: #fff;
}

.shift-badge.half,
.shift-badge.turno18 {
  color: #fff;
}

.shift-badge.sin-datos {
  color: var(--text-muted);
}

.day-cell.shift-larga {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.day-cell.shift-noche {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.day-cell.shift-permiso {
  border-color: var(--orange);
  background: linear-gradient(180deg, #ff7f1f 0%, var(--orange) 100%);
  color: #fff;
}

.day-cell.shift-turno24 {
  border-color: #7c3aed;
  background: #7c3aed;
  color: #fff;
}

.day-cell.shift-diurno {
  border-color: #0f9f6e;
  background: #0f9f6e;
  color: #fff;
}

.day-cell.shift-diurno-noche {
  border-color: #d89c00;
  background: #d89c00;
  color: #fff;
}

.day-cell.shift-half,
.day-cell.shift-turno18 {
  border-color: #8f5b1d;
  background: #8f5b1d;
  color: #fff;
}

.day-cell.shift-libre,
.day-cell.shift-sin-datos {
  background: #fff;
}

.day-cell.weekend.shift-libre,
.day-cell.weekend.shift-sin-datos {
  background: #f7f8fa;
}

.day-cell.weekend {
  border-color: rgba(242, 85, 85, 0.78);
}

.day-cell.personal-blocked,
.day-cell.weekend.personal-blocked {
  border-color: #c7d0dc;
  background: #e6ebf2;
  color: #536174;
  box-shadow: inset 0 0 0 1px rgba(126, 141, 163, 0.28);
}

.day-cell.personal-blocked .shift-badge {
  color: #536174;
}

.day-cell.today.personal-blocked {
  box-shadow:
    inset 0 0 0 1px rgba(126, 141, 163, 0.32),
    inset 0 0 0 3px rgba(29, 108, 255, 0.28);
}

.reminder-chip,
.blocked-day-chip {
  align-self: end;
  border-radius: 6px;
  padding: 2px 3px;
  font-size: 0.54rem;
  line-height: 1;
  text-align: center;
}

.reminder-chip {
  background: var(--yellow-soft);
  color: #7a5700;
}

.blocked-day-chip {
  background: #f7f8fa;
  color: #59677a;
  border: 1px solid rgba(126, 141, 163, 0.22);
}

.mode-banner {
  display: none;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-card);
  background: #fff;
  border: 1px solid rgba(29, 108, 255, 0.26);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.mode-banner.is-visible {
  display: grid;
}

.mode-banner button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--red-soft);
  color: #bf2727;
}

.action-stack {
  display: grid;
  gap: 8px;
}

.primary-action,
.secondary-action,
.ghost-action,
.danger-action {
  min-height: 48px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: var(--radius-control);
  font-weight: 900;
  line-height: 1.15;
  padding: 11px 12px;
}

.primary-action {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 22px rgba(29, 108, 255, 0.2);
}

.secondary-action {
  border: 1px solid rgba(29, 108, 255, 0.32);
  background: #fff;
  color: var(--blue);
}

.ghost-action {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-soft);
}

.danger-action {
  background: var(--red-soft);
  color: #b42323;
}

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

.reminders-panel,
.list-panel,
.settings-panel,
.tool-panel {
  padding: 12px;
}

.item-list {
  display: grid;
  gap: 8px;
}

.message-search {
  margin-bottom: 9px;
}

.message-search input {
  min-height: 44px;
}

.directory-list {
  display: grid;
  gap: 7px;
}

.directory-item {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #fff;
  color: var(--text);
  text-align: left;
}

.directory-item.is-active {
  border-color: rgba(29, 108, 255, 0.46);
  background: #f0f6ff;
}

.directory-item.is-unread {
  border-color: rgba(218, 43, 43, 0.34);
  background: #fffafa;
}

.directory-item span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.directory-item strong,
.directory-item small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-item small {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.directory-item svg {
  width: 20px;
  height: 20px;
  color: var(--blue);
}

.list-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #fff;
}

.chat-card {
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
}

.chat-card > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.list-item.is-soft {
  background: #fbfdff;
}

.request-card-extra {
  border-color: rgba(29, 108, 255, 0.24);
  background: #f8fbff;
}

.request-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 4px;
}

.request-actions .primary-action,
.request-actions .secondary-action {
  min-height: 40px;
  padding: 8px 10px;
}

.worker-message-panel {
  min-height: calc(100dvh - 190px);
}

.worker-message-thread {
  min-height: 320px;
  max-height: 58dvh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 4px 0;
}

.worker-message-bubble {
  max-width: 86%;
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.worker-message-bubble.is-mine {
  align-self: flex-end;
  background: var(--blue);
  color: #fff;
}

.worker-message-bubble.is-supervisor {
  align-self: flex-start;
  background: #f8fbff;
}

.worker-message-bubble p {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.worker-message-bubble small {
  color: currentColor;
  font-size: 0.68rem;
  font-weight: 900;
  opacity: 0.72;
}

.worker-reply-form {
  display: grid;
  gap: 10px;
  padding-top: 10px;
}

.worker-reply-form textarea {
  min-height: 68px;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  padding: 10px 12px;
  color: var(--text);
  font: inherit;
}

.list-item header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.list-item strong {
  min-width: 0;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.18;
}

.list-item p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.35;
}

.list-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.empty-state {
  padding: 18px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
  color: var(--text-muted);
  text-align: center;
  font-weight: 800;
  font-size: 0.84rem;
}

.empty-state.compact {
  padding: 11px 10px;
  font-size: 0.78rem;
}

.bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  min-height: calc(70px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
}

.bottom-nav button {
  min-width: 0;
  display: grid;
  place-items: center;
  gap: 3px;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 2px;
  font-size: 0.69rem;
  font-weight: 900;
}

.bottom-nav button svg {
  width: 21px;
  height: 21px;
}

.bottom-nav button.is-active {
  background: var(--blue-soft);
  color: var(--blue);
}

.menu-sheet,
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(11, 18, 32, 0.42);
}

.menu-sheet.is-open,
.modal-root.is-open {
  display: flex;
}

.sheet-panel,
.modal-card {
  width: min(100vw, 430px);
  max-height: min(86dvh, 760px);
  overflow: auto;
  border-radius: 18px 18px 0 0;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-card.swap-modal-card {
  width: min(100vw, 430px);
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0;
}

.swap-modal-card .modal-header {
  flex: 0 0 auto;
  padding-top: calc(13px + env(safe-area-inset-top));
}

.swap-modal-card .modal-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.sheet-panel::-webkit-scrollbar,
.modal-card::-webkit-scrollbar {
  width: 0;
}

.swap-modal-card .modal-body::-webkit-scrollbar {
  width: 0;
}

.sheet-header,
.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.sheet-header h2,
.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.module-tile {
  min-height: 92px;
  display: grid;
  place-items: center;
  gap: 7px;
  padding: 10px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #fff;
  color: var(--text);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 900;
}

.module-tile svg {
  width: 28px;
  height: 28px;
}

.module-tile[data-tone="blue"] svg {
  color: var(--blue);
}

.module-tile[data-tone="green"] svg {
  color: var(--green);
}

.module-tile[data-tone="orange"] svg {
  color: var(--orange);
}

.module-tile[data-tone="purple"] svg {
  color: var(--purple);
}

.module-tile[data-tone="red"] svg {
  color: var(--red);
}

.modal-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.month-picker {
  display: grid;
  gap: 14px;
}

.year-stepper {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
}

.year-input-wrap {
  min-width: 0;
}

.year-input-wrap input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: #f8fbff;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 900;
  text-align: center;
}

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

.month-picker-grid button {
  min-width: 0;
  min-height: 48px;
  padding: 8px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
}

.month-picker-grid button.is-selected {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 22px rgba(29, 108, 255, 0.2);
}

.month-picker-grid button:active {
  transform: translateY(1px);
}

.form-grid {
  display: grid;
  gap: 10px;
}

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

.field span,
.toggle-row span:first-child {
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 900;
}

.field small {
  color: var(--text-muted);
  font-weight: 700;
}

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

.toggle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #fff;
}

.toggle-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-height: auto;
  accent-color: var(--blue);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: #f3f7fd;
}

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

.segmented button {
  min-height: 38px;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 900;
  padding: 8px 6px;
}

.segmented button.is-active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 4px 10px rgba(20, 34, 58, 0.08);
}

.permission-list {
  display: grid;
  gap: 8px;
}

.permission-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #fff;
  color: var(--text);
  text-align: left;
}

.permission-option strong {
  display: block;
  font-size: 0.93rem;
}

.permission-option small {
  color: var(--text-muted);
  font-weight: 800;
}

.leave-rule-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #f8fbff;
}

.leave-rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.leave-rule-row strong {
  color: var(--text);
  white-space: nowrap;
}

.leave-days-control {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: end;
}

.leave-days-control label {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.leave-days-control label span {
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 900;
}

.leave-days-control input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 900;
  text-align: center;
}

.leave-quick-days {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.leave-quick-days button {
  min-height: 38px;
  padding: 7px 6px;
  border: 1px solid rgba(29, 108, 255, 0.28);
  border-radius: var(--radius-control);
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
}

.rule-message {
  margin: 0;
  padding: 9px 10px;
  border-radius: var(--radius-control);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.25;
}

.rule-message.is-ok {
  background: rgba(34, 197, 94, 0.12);
  color: #0f7a3a;
}

.rule-message.is-error {
  background: rgba(242, 85, 85, 0.12);
  color: #b42323;
}

.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding-top: 2px;
}

.modal-actions button:disabled {
  opacity: 0.48;
}

.clock-missing-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.missing-button {
  min-height: 42px;
  border: 1px solid rgba(29, 108, 255, 0.32);
  border-radius: var(--radius-control);
  background: var(--blue-soft);
  color: var(--text);
  font-weight: 900;
}

.missing-button.is-active {
  background: var(--red-soft);
  border-color: rgba(242, 85, 85, 0.46);
  color: #b42323;
}

.colleague-grid,
.date-choice-grid {
  display: grid;
  gap: 8px;
}

.colleague-button,
.date-choice {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #fff;
  color: var(--text);
  text-align: left;
}

.colleague-button.is-active,
.date-choice.is-active {
  border-color: rgba(29, 108, 255, 0.54);
  background: var(--blue-soft);
}

.swap-direct-flow {
  display: grid;
  gap: 14px;
}

.swap-worker-select {
  padding: 12px;
  border: 1px solid rgba(29, 108, 255, 0.22);
  border-radius: var(--radius-card);
  background: #f8fbff;
}

.swap-worker-select.is-disabled {
  opacity: 0.72;
}

.swap-worker-select select {
  min-height: 52px;
  font-weight: 900;
}

.swap-summary-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid rgba(36, 195, 107, 0.28);
  border-radius: var(--radius-card);
  background: #f5fff9;
}

.swap-summary-card header,
.swap-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.swap-summary-card header strong {
  font-size: 0.95rem;
}

.swap-summary-row {
  padding-top: 8px;
  border-top: 1px solid rgba(36, 195, 107, 0.18);
}

.swap-summary-row span {
  min-width: 0;
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 900;
}

.swap-summary-row strong {
  min-width: 0;
  max-width: 190px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.78rem;
  text-align: right;
}

.swap-submit-actions {
  padding-bottom: 2px;
}

.swap-calendar-summary {
  gap: 10px;
}

.swap-calendar-summary-grid {
  display: grid;
  gap: 7px;
}

.swap-calendar-summary-grid div {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #fbfdff;
}

.swap-calendar-summary-grid span {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.1;
}

.swap-calendar-summary-grid strong {
  overflow-wrap: anywhere;
  font-size: 0.84rem;
}

.swap-calendar {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #fff;
}

.swap-calendar-own {
  background: #fbfdff;
}

.swap-calendar-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.swap-calendar-head strong {
  min-width: 0;
  color: var(--text);
  font-weight: 900;
}

.swap-calendar-head small {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-muted);
  font-weight: 800;
  text-align: right;
}

.swap-calendar-worker-button {
  min-width: 0;
  justify-self: end;
  border-radius: var(--radius-control);
  background: var(--blue-soft);
  color: var(--blue);
  padding: 7px 9px;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.15;
  text-align: right;
  overflow-wrap: anywhere;
}

.swap-calendar-worker-button:active {
  transform: translateY(1px);
}

.swap-colleague-list {
  display: grid;
  gap: 8px;
}

.swap-colleague-option {
  min-width: 0;
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #fff;
  color: var(--text);
  text-align: left;
}

.swap-colleague-option span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.swap-colleague-option strong,
.swap-colleague-option small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.swap-colleague-option strong {
  font-size: 0.86rem;
  line-height: 1.15;
}

.swap-colleague-option small {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.swap-colleague-option svg {
  width: 18px;
  height: 18px;
  color: var(--blue);
}

.swap-calendar-weekdays,
.swap-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.swap-calendar-weekdays span {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
}

.swap-calendar-day {
  position: relative;
  min-width: 0;
  min-height: 48px;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-muted);
  font: inherit;
}

.swap-calendar-day strong {
  color: inherit;
  font-size: 0.8rem;
  line-height: 1;
}

.swap-calendar-day span {
  max-width: 100%;
  overflow: hidden;
  color: inherit;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swap-calendar-day.is-empty {
  visibility: hidden;
}

.swap-calendar-day.is-available {
  border-color: rgba(29, 108, 255, 0.32);
  background: rgba(29, 108, 255, 0.08);
  color: var(--text);
}

.swap-calendar-day.is-available.larga {
  border-color: rgba(36, 195, 107, 0.38);
  background: rgba(36, 195, 107, 0.13);
  color: #0f6f3a;
}

.swap-calendar-day.is-available.noche {
  border-color: rgba(29, 108, 255, 0.38);
  background: rgba(29, 108, 255, 0.13);
  color: #124db8;
}

.swap-calendar-day.is-active {
  z-index: 1;
  border-color: var(--blue);
  border-width: 2px;
  background: var(--blue);
  color: #fff;
  box-shadow:
    0 0 0 3px rgba(29, 108, 255, 0.22),
    0 10px 20px rgba(29, 108, 255, 0.18);
  transform: translateY(-1px);
}

.swap-calendar-day.is-active.larga {
  border-color: #0f8f4b;
  background: var(--green);
  color: #fff;
  box-shadow:
    0 0 0 3px rgba(36, 195, 107, 0.26),
    0 10px 20px rgba(36, 195, 107, 0.18);
}

.swap-calendar-day.is-active.noche {
  border-color: var(--blue-strong);
  background: var(--blue);
  color: #fff;
  box-shadow:
    0 0 0 3px rgba(29, 108, 255, 0.28),
    0 10px 20px rgba(29, 108, 255, 0.18);
}

.swap-calendar-day.is-active::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: currentColor;
}

.swap-calendar-day.is-change-date {
  border-color: var(--orange);
  box-shadow:
    0 0 0 3px rgba(255, 138, 42, 0.34),
    0 10px 20px rgba(255, 138, 42, 0.2),
    inset 0 0 0 2px rgba(255, 255, 255, 0.72);
}

.chart-card {
  display: grid;
  gap: 10px;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 164px;
  padding: 12px 4px 0;
  border-bottom: 1px solid var(--border);
}

.bar-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 3px;
  min-height: 132px;
}

.bar {
  min-height: 8px;
  border-radius: 6px 6px 0 0;
}

.bar.day {
  background: var(--orange);
}

.bar.night {
  background: var(--blue);
}

.bar-label {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-align: center;
}

.contact-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.contact-actions {
  display: flex;
  gap: 6px;
}

.round-action {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
}

.kanban-board {
  display: grid;
  gap: 10px;
}

.kanban-column {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #fbfdff;
}

.kanban-column h3 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.kanban-card {
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #fff;
  font-size: 0.82rem;
  font-weight: 800;
}

.kanban-column .kanban-card + .kanban-card {
  margin-top: 7px;
}

.settings-group {
  display: grid;
  gap: 8px;
}

.settings-label {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 900;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(82px + env(safe-area-inset-bottom));
  z-index: 120;
  width: min(380px, calc(100vw - 28px));
  padding: 11px 13px;
  border-radius: var(--radius-control);
  background: #13223a;
  color: #fff;
  box-shadow: var(--shadow);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  font-weight: 800;
  font-size: 0.83rem;
  line-height: 1.35;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hidden {
  display: none !important;
}

@media (min-width: 700px) {
  body {
    padding: 18px;
    align-items: center;
  }

  .phone-shell {
    min-height: min(900px, calc(100dvh - 36px));
    max-height: min(900px, calc(100dvh - 36px));
    border-radius: 28px;
  }

  .app-topbar {
    border-radius: 28px 28px 0 0;
  }

  .bottom-nav {
    border-radius: 0 0 28px 28px;
  }
}

@media (max-width: 370px) {
  .brand-button {
    width: 136px;
  }

  .brand-button img {
    width: 128px;
  }

  .topbar-actions {
    gap: 5px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .day-cell {
    min-height: 62px;
    padding: 4px;
  }

  .shift-badge {
    font-size: 0.62rem;
  }

  .shift-badge.label-xs,
  .reminder-chip,
  .blocked-day-chip {
    font-size: 0.5rem;
  }
}

@media (max-width: 430px) {
  .brand-button {
    width: 132px;
  }

  .brand-button img {
    width: 126px;
  }

  .topbar-actions {
    gap: 5px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    border-radius: 12px;
  }

  .section-head .small-pill,
  .section-head .status-pill {
    max-width: 106px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
