:root {
  color-scheme: light;
  --ink: #18212f;
  --text: #2f3b4c;
  --muted: #6b7483;
  --line: #d9e0e8;
  --soft: #f3f6f9;
  --panel: #ffffff;
  --primary: #2457a6;
  --primary-dark: #17457f;
  --success: #16735f;
  --warning: #a36300;
  --danger: #a03a35;
  --violet: #6252a3;
  --shadow: 0 16px 40px rgba(27, 39, 56, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background: #eef2f6;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

.is-guest .app-shell,
.is-authenticated .login-screen {
  display: none;
}

.cannot-view-logs [data-logs-access] {
  display: none !important;
}

.admin-only {
  display: none;
}

.is-admin .admin-only {
  display: inline-flex;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  padding: 28px;
  place-items: center;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.app-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  position: sticky;
  top: 0;
  flex-direction: column;
  height: 100vh;
  padding: 20px 16px;
  color: #e9f0f8;
  background: #192333;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand > div:nth-child(2) {
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  color: #172030;
  background: #f6c45d;
  font-weight: 700;
}

.brand strong {
  display: block;
  color: #fff;
  font-size: 17px;
}

.brand strong[title] {
  cursor: help;
}

.brand span,
.brand small,
.sidebar-footer span {
  display: block;
  color: #aeb9c9;
  font-size: 13px;
}

.brand small {
  margin-top: 3px;
  color: #f4c96f;
}

.nav-tabs {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.nav-link {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 7px;
  color: #dbe5f2;
  background: transparent;
  text-align: left;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
  color: #fff;
  background: var(--primary);
  box-shadow: inset 3px 0 0 #d94b4b;
}


.sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 16px 6px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.user-menu {
  position: relative;
}

.user-menu summary {
  display: grid;
  gap: 2px;
  min-height: 48px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  list-style: none;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.user-menu summary:hover,
.user-menu[open] summary {
  background: rgba(255, 255, 255, 0.08);
}

.user-menu strong {
  color: #fff;
}

.user-menu-panel {
  display: grid;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: min(245px, calc(100vw - 32px));
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #111a27;
  box-shadow: var(--shadow);
}

.user-menu-panel p {
  margin: 0 0 4px;
  color: #dbe5f2;
  font-size: 13px;
}

.user-menu-panel .small-button {
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.main-content {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar h1,
.section-toolbar h2,
.login-panel h1,
.login-panel h2,
.modal h2 {
  margin: 0;
  color: var(--ink);
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 30px;
}

.section-toolbar h2,
.login-panel h1,
.login-panel h2 {
  font-size: 24px;
}

.modal h2 {
  font-size: 21px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.small {
  font-size: 13px;
}

.tab-panel {
  display: none;
  min-width: 0;
}

.tab-panel.active {
  display: block;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(280px, 430px) minmax(260px, 1fr);
  gap: 20px;
  align-items: stretch;
}

.login-layout-centered {
  grid-template-columns: minmax(280px, 430px);
  justify-content: center;
  width: min(430px, 100%);
}

.login-panel,
.settings-block,
.data-table-wrap,
.calendar-grid,
.month-picker,
.guard-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-panel {
  padding: 28px;
}

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 70;
  display: grid;
  gap: 10px;
  align-items: start;
  width: min(380px, calc(100vw - 36px));
}

.flash-message {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 18px 40px rgba(18, 28, 43, 0.16);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.flash-message.is-hiding {
  opacity: 0;
  transform: translateY(-8px);
}

.flash-message.success {
  border-color: rgba(22, 115, 95, 0.28);
  background: #effaf6;
  color: var(--success);
}

.flash-message.error {
  border-color: rgba(160, 58, 53, 0.28);
  background: #fff3f2;
  color: var(--danger);
}

.login-panel .flash-message {
  margin-bottom: 16px;
}

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

.table-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.table-tools label {
  width: min(360px, 100%);
}

.topbar-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.primary-button,
.outline-button,
.ghost-button,
.danger-button,
.small-button,
.icon-button,
.segmented-control button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 7px;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

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

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--primary-dark);
}

.outline-button {
  color: var(--primary);
  border-color: #a8b8d2;
  background: #fff;
}

.danger-outline {
  color: var(--danger);
  border-color: #e0aaa7;
}

.ghost-button {
  color: inherit;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
}

.main-content .ghost-button,
.modal .ghost-button {
  color: var(--primary);
  border-color: var(--line);
  background: var(--soft);
}

.small-button {
  min-height: 32px;
  padding: 6px 10px;
  color: var(--primary);
  border-color: var(--line);
  background: #fff;
  font-size: 13px;
}

.danger-button {
  color: var(--danger);
  border-color: #efc6c3;
  background: #fff7f6;
}

.danger-button:hover,
.danger-button:focus-visible {
  border-color: #e0aaa7;
  background: #fee8e6;
}

.icon-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  color: var(--muted);
  border-color: var(--line);
  background: #fff;
  font-weight: 700;
}

.full-width {
  width: 100%;
}

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

label,
legend {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  margin-top: 6px;
  padding: 9px 10px;
  border: 1px solid #cdd6e1;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

textarea {
  resize: vertical;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 17px, calc(100% - 10px) 17px;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
  padding-right: 30px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.guard-select-button:focus-visible,
.autocomplete-toggle:focus-visible {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(36, 87, 166, 0.14);
}

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

.radio-group,
.switch-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.radio-group label,
.switch-list label,
.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 500;
}

.radio-group input,
.switch-list input,
.checkbox-line input {
  width: 17px;
  min-height: 17px;
  margin: 0;
  flex: 0 0 auto;
}

.segmented-control {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segmented-control button {
  border: 0;
  border-radius: 0;
  color: var(--muted);
  background: #fff;
}

.segmented-control button + button {
  border-left: 1px solid var(--line);
}

.segmented-control button.active {
  color: var(--primary);
  background: #eaf1fb;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: hidden;
}

.weekday {
  min-height: 42px;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.weekday:nth-child(7n) {
  border-right: 0;
}

.day {
  display: flex;
  min-height: 112px;
  padding: 10px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
  flex-direction: column;
  gap: 8px;
}

.day:nth-child(7n) {
  border-right: 0;
}

.day span {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
}

.day em {
  display: inline-block;
  max-width: 100%;
  padding: 5px 7px;
  border-radius: 6px;
  color: var(--primary-dark);
  background: #eaf1fb;
  font-size: 12px;
  font-style: normal;
  overflow-wrap: anywhere;
}

.day:hover,
.day:focus-visible {
  background: #f7fbff;
}

.day.today span {
  color: #fff;
  background: var(--primary);
}

.day.weekend {
  background: #f6f7f9;
}

.day.weekend:disabled {
  color: #7d8794;
  background: #eef1f4;
}

.day.weekend:disabled:hover,
.day.weekend:disabled:focus-visible {
  background: #eef1f4;
}

.day.holiday {
  background: #f6f7f9;
}

.day.holiday:disabled {
  color: #7d8794;
  background: #eef1f4;
  box-shadow: none;
}

.day.holiday:disabled span {
  color: #7d8794;
}

.day.holiday:disabled:hover,
.day.holiday:disabled:focus-visible {
  background: #eef1f4;
}

.day.holiday em {
  color: var(--warning);
  background: #fff2d9;
}

.day.holiday:disabled em {
  color: #7d6a45;
  background: #e9edf2;
}

.day.has-demand {
  box-shadow: inset 0 3px 0 var(--primary);
}

.bulk-calendar-panel {
  display: grid;
  gap: 12px;
}

.bulk-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.bulk-calendar-weekday,
.bulk-calendar-day {
  min-height: 44px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.bulk-calendar-weekday:nth-child(7n),
.bulk-calendar-day:nth-child(7n) {
  border-right: 0;
}

.bulk-calendar-weekday {
  display: grid;
  place-items: center;
  color: var(--ink);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 800;
}

.bulk-calendar-day {
  display: grid;
  min-height: 58px;
  place-items: center;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
}

.bulk-calendar-day:not(:disabled):hover,
.bulk-calendar-day:not(:disabled):focus-visible {
  background: #eef6ff;
}

.bulk-calendar-day.is-selected {
  color: #fff;
  background: var(--primary);
  box-shadow: inset 0 0 0 3px #e11d48;
}

.bulk-calendar-day.muted,
.bulk-calendar-day:disabled {
  color: #8b95a1;
  background: #eef1f4;
}

.validation-proxy {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.data-table-wrap,
.guard-table-wrap {
  overflow: auto;
  max-width: 100%;
  min-width: 0;
}

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

.data-table th,
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--ink);
  background: #f8fafc;
  font-size: 13px;
  font-weight: 700;
}

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

.align-right {
  text-align: right;
}

.badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  margin: 2px 5px 2px 0;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.badge.blue {
  color: #16457e;
  background: #deebfb;
}

.badge.green {
  color: #11644f;
  background: #dff3ee;
}

.badge.violet {
  color: #51428f;
  background: #ece8fb;
}

.badge.red {
  color: #8a1f2d;
  background: #fde2e7;
}

.badge.orange {
  color: #5f3900;
  background: #ffe2a8;
}

.badge.teal {
  color: #0f5b62;
  background: #d9f3f5;
}

.badge.indigo {
  color: #303f8f;
  background: #e1e7ff;
}

.badge.skill-color {
  color: var(--skill-foreground, #303f8f);
  background: var(--skill-background, #e1e7ff);
}

.skill-swatch {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  background: var(--skill-color, #303f8f);
  vertical-align: middle;
}

.skill-color-input {
  width: 80px;
  min-height: 40px;
  padding: 3px;
  cursor: pointer;
}

.skills-table {
  min-width: 560px;
}

.skills-table td:last-child {
  white-space: nowrap;
}

.guard-role-options {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.guard-role-options legend {
  padding: 0 6px;
  font-size: 14px;
  font-weight: 700;
}

.guard-role-options .checkbox-list {
  display: grid;
  gap: 8px;
}

.guard-role-options label {
  display: grid;
  grid-template-columns: 16px max-content minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.guard-role-options input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
}

.guard-role-options .badge {
  margin: 0;
}

.status {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.status.available {
  color: var(--success);
  background: #e2f3ee;
}

.status.unavailable {
  color: var(--danger);
  background: #fae5e3;
}

.guard-layout {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.month-picker {
  display: flex;
  align-items: end;
  gap: 14px;
  padding: 14px;
}

.month-picker label {
  width: min(220px, 100%);
}

#guards .month-picker {
  display: grid;
  grid-template-columns: 40px minmax(90px, 220px) minmax(80px, 160px) 40px;
  align-items: end;
  gap: 8px;
}

#guards .month-picker label {
  width: 100%;
  min-width: 0;
}

#guards .month-nav-button {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 22px;
}

.filter-note {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--soft);
  font-size: 13px;
}

.stats-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.history-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.stats-filters label {
  min-width: 150px;
}

.stats-filters select[multiple] {
  min-width: 220px;
  min-height: 112px;
  padding-right: 10px;
  background-image: none;
}

.history-filters label {
  min-width: 190px;
}

.guard-table {
  min-width: 2360px;
}

.guard-select-combo {
  position: relative;
  min-width: 220px;
}

.native-guard-select {
  position: absolute;
  width: 1px;
  min-width: 1px;
  height: 1px;
  min-height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.guard-select-button {
  display: block;
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 8px 30px 8px 10px;
  border: 1px solid #cdd6e1;
  border-radius: 7px;
  color: var(--ink);
  background-color: #fff;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 17px, calc(100% - 10px) 17px;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
  font-size: 13px;
  text-align: left;
}

.guard-selected-priority {
  border-color: #7fc89a;
  background-color: #effaf3;
}

.guard-selected-cis-warning {
  border-color: #c68419;
  background-color: #ffe7b3;
}

.guard-select-menu {
  display: none;
  position: fixed;
  z-index: 120;
  gap: 2px;
  padding: 6px;
  border: 1px solid #b8c4d2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(18, 28, 43, 0.22);
  overflow: auto;
}

.guard-select-combo.open .guard-select-menu {
  display: grid;
}

.guard-select-option {
  position: relative;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  text-align: left;
}

.guard-option-label {
  display: block;
}

.guard-person-tooltip {
  display: none;
}

.guard-floating-tooltip {
  position: fixed;
  z-index: 300;
  width: 280px;
  max-width: min(280px, calc(100vw - 16px));
  padding: 10px;
  border: 1px solid #b8c4d2;
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  box-shadow: 0 18px 46px rgba(18, 28, 43, 0.22);
  pointer-events: none;
  white-space: normal;
}

.guard-floating-tooltip[hidden] {
  display: none;
}

.guard-floating-tooltip strong,
.guard-floating-tooltip span {
  display: block;
}

.guard-floating-tooltip .tooltip-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 7px 0;
}

.guard-floating-tooltip .tooltip-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 7px 0;
}

.guard-floating-tooltip .badge {
  display: inline-flex;
}

.guard-floating-tooltip .tooltip-priority.is-priority {
  width: fit-content;
  min-height: 26px;
  margin: 7px 0 0;
  padding: 4px 8px;
  border-radius: 6px;
  color: #11644f;
  background: #dff3ee;
  font-size: 12px;
  font-weight: 700;
}

.guard-select-option:hover,
.guard-select-option:focus-visible,
.guard-select-option.is-selected {
  background: #eaf1fb;
}

.guard-table select option.guard-option-priority {
  color: #11542f;
  background: #dff5e7;
  font-weight: 700;
}

.guard-select-option.guard-option-priority {
  color: #11542f;
  background: #dff5e7;
  font-weight: 700;
}

.guard-table select option.guard-option-cis-warning {
  color: #4b2b00;
  background: #f3b94d;
  font-weight: 700;
}

.guard-select-option.guard-option-cis-warning {
  color: #4b2b00;
  background: #f3b94d;
  font-weight: 700;
}

.guard-select-option.guard-option-priority.guard-option-cis-warning {
  color: #11542f;
  background: #dff5e7;
  box-shadow: none;
}

.guard-selected-priority.guard-selected-cis-warning {
  border-color: #7fc89a;
  color: #11542f;
  background-color: #effaf3;
  box-shadow: none;
}

.guard-select-option.guard-option-priority:hover,
.guard-select-option.guard-option-priority:focus-visible,
.guard-select-option.guard-option-priority.is-selected {
  background: #d2efd9;
}

.guard-select-option.guard-option-priority.guard-option-cis-warning:hover,
.guard-select-option.guard-option-priority.guard-option-cis-warning:focus-visible,
.guard-select-option.guard-option-priority.guard-option-cis-warning.is-selected {
  background: #d2efd9;
}

.guard-select-option.is-disabled {
  color: #8894a4;
  background: #eef1f4;
  cursor: not-allowed;
  opacity: 0.72;
}

.mini-readonly-table {
  width: 100%;
  max-width: 360px;
  border-collapse: collapse;
  font-size: 12px;
}

.readonly-value {
  display: block;
  min-height: 24px;
  color: var(--text);
}

.multiline-value {
  white-space: pre-wrap;
}

.request-staff-name {
  display: grid;
  gap: 2px;
}

.request-staff-name small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.sheet-header-side {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
  text-align: right;
}

.sheet-logo {
  display: none;
  width: auto;
  height: auto;
  margin-left: auto;
  object-fit: contain;
}

.sheet-logo-front {
  max-width: 180px;
  max-height: 90px;
}

.sheet-logo-back {
  max-width: 90px;
  max-height: 45px;
}

.mini-readonly-table th,
.mini-readonly-table td {
  padding: 5px 7px;
  border: 1px solid var(--line);
  vertical-align: top;
}

.mini-readonly-table th {
  width: 138px;
  color: var(--muted);
  background: #f8fafc;
  font-weight: 700;
}

.staff-ga-fields {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 14px;
}

.guard-weeks {
  display: grid;
  gap: 18px;
  padding-bottom: 100px;
}

.guard-lock-status {
  padding: 12px 16px;
  border: 1px solid #bad3c8;
  border-radius: 6px;
  background: #eef7f2;
  color: #19533f;
  font-size: 14px;
}

.guard-archived-person {
  display: block;
  min-height: 38px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafc;
  white-space: normal;
}

#guard-weeks textarea[readonly] {
  background: #f8fafc;
}

.guard-week-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.guard-week-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.guard-week-header h3 {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 20px;
}

.week-kicker {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

.guard-week-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--line);
}

.guard-week-table tbody tr:nth-child(4n + 1),
.guard-week-table tbody tr:nth-child(4n + 2) {
  background: #fbfcfe;
}

.guard-day-start td {
  border-top: 2px solid #dfe7f1;
}

.guard-date-cell {
  min-width: 116px;
  color: var(--ink);
  background: #f7fbff;
}

.guard-date-cell strong,
.holiday-guard-row strong {
  display: block;
  font-size: 14px;
}

.guard-date-cell span,
.holiday-guard-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.shift-label {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--primary);
  background: #eaf1fb;
  font-size: 12px;
  font-weight: 700;
}

.holiday-guard-row td {
  color: var(--muted);
  background: #eef1f4;
}

.guard-table th,
.guard-table td {
  padding: 10px 6px;
}

.guard-table select {
  width: 100%;
  min-width: 170px;
  margin-top: 0;
}

.guard-table .native-guard-select {
  width: 1px;
  min-width: 1px;
  min-height: 1px;
}

.guard-table textarea {
  width: 100%;
  min-width: 150px;
  min-height: 58px;
  margin-top: 0;
}

.day-task-cell {
  min-width: 188px;
  background: #fbfcfe;
  vertical-align: top;
}

.day-task-cell textarea {
  min-height: 92px;
  margin-top: 8px;
  resize: vertical;
}

.task-picker {
  min-width: 190px;
}

.empty-guard-cell {
  background: #fff3cf;
  box-shadow: inset 0 0 0 2px #f1b84b;
}

.empty-guard-cell select {
  border-color: #d19124;
  background-color: #fff8e8;
}

.empty-guard-cell .guard-select-button {
  border-color: #d19124;
  background-color: #fff8e8;
}

.holiday-label {
  display: block;
  margin-top: 5px;
  color: var(--warning);
  font-size: 12px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  min-width: 0;
}

.settings-block {
  min-width: 0;
  padding: 20px;
}

.settings-block h3 {
  margin: 0;
  color: var(--ink);
}

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

.task-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  min-width: 0;
}

.training-board {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.task-table {
  table-layout: fixed;
}

.task-table th:first-child,
.task-table td:first-child {
  width: 64px;
  color: var(--muted);
  font-weight: 700;
}

.task-table textarea {
  min-height: 58px;
  margin-top: 0;
  resize: vertical;
}

.training-table {
  min-width: 980px;
}

.training-table input,
.training-table select,
.training-table textarea {
  margin-top: 0;
}

.training-table textarea {
  min-height: 58px;
  resize: vertical;
}

.instructions-table,
.message-history-table {
  min-width: 920px;
}

.instructions-table td:nth-child(3),
.message-history-table td:nth-child(3) {
  max-width: 560px;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  justify-content: flex-end;
}

.sheet-actions label {
  min-width: 210px;
}

.sheet-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  justify-content: stretch;
}

.sheet-page {
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-size: 13px;
  box-shadow: var(--shadow);
}

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

.sheet-front .sheet-header,
.sheet-front .sheet-top-row {
  grid-column: 1 / -1;
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--ink);
}

.sheet-header h2 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 25px;
}

.sheet-header span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.sheet-part {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 10px;
  break-inside: avoid;
}

.sheet-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.9fr);
  gap: 10px;
  align-items: stretch;
  break-inside: avoid;
}

.sheet-top-row .sheet-part {
  margin-bottom: 0;
}

.sheet-top-row .sheet-content {
  width: 100%;
  height: 100%;
}

.sheet-front .sheet-part {
  grid-template-columns: 1fr;
}

.sheet-personnel-part {
  grid-template-columns: 1fr;
  min-width: 0;
}

.sheet-comments-part {
  min-width: 0;
}

.sheet-front .handwriting-box,
.print-only-sheet {
  display: none;
}

.sheet-content {
  width: 100%;
  box-sizing: border-box;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
}

.sheet-content h3,
.sheet-back-section h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 14px;
}

.sheet-title-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.sheet-content p {
  margin: 0;
  color: var(--text);
}

.sheet-alert-text {
  color: var(--danger);
  font-weight: 800;
}

.sheet-training-text span {
  display: inline-block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.sheet-instructions-text ul {
  margin: 0;
  padding-left: 18px;
}

.sheet-instructions-text li + li {
  margin-top: 4px;
}

.handwriting-box,
.large-handwriting-zone,
.signature-zone {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
}

.handwriting-box {
  min-height: 92px;
}

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

.sheet-personnel-table,
.intervention-table {
  width: 100%;
  table-layout: fixed;
}

.sheet-personnel-table {
  border-collapse: collapse;
}

.intervention-table {
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: #fbfcfe;
}

.sheet-personnel-table caption {
  margin-bottom: 5px;
  color: var(--primary);
  font-weight: 700;
  text-align: left;
}

.sheet-personnel-table th,
.sheet-personnel-table td,
.intervention-table th,
.intervention-table td {
  padding: 7px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
  text-align: left;
}

.intervention-table th,
.intervention-table td {
  border: 0;
  border-right: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
}

.intervention-table th {
  color: var(--ink);
  background: #eef4fb;
  font-weight: 700;
}

.intervention-table td {
  background: #fff;
}

.intervention-table th:last-child,
.intervention-table td:last-child {
  border-right: 0;
}

.intervention-table tbody tr:last-child td {
  border-bottom: 0;
}

.sheet-personnel-table th,
.sheet-personnel-table td {
  font-size: 14px;
}

.leader-row td {
  color: var(--ink);
  background: #fff8e8;
  font-weight: 700;
}

.sheet-back-section {
  margin-bottom: 18px;
}

.intervention-table td {
  height: 34px;
}

.intervention-table tbody tr {
  height: 34px;
}

.intervention-table th:first-child,
.intervention-table td:first-child {
  width: 92px;
}

.large-handwriting-zone {
  min-height: 410px;
}

.signature-zone {
  display: flex;
  min-height: 64px;
  align-items: flex-start;
  padding: 12px;
  color: var(--muted);
  font-weight: 700;
}

.confirm-message {
  margin: 0 0 8px;
  color: var(--text);
}

.confirm-message strong {
  color: var(--danger);
}

.confirm-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.flat-table {
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: none;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 6px;
  color: var(--primary);
  background: #eaf1fb;
  font-size: 12px;
  font-weight: 700;
}

.retention-note {
  margin: -2px 0 16px;
  padding: 12px 14px;
  border: 1px solid #d8c28f;
  border-radius: 8px;
  color: #654500;
  background: #fff8e8;
  font-size: 14px;
}

.export-note {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #d8c28f;
  border-radius: 8px;
  color: #654500;
  background: #fff8e8;
  font-size: 14px;
}

.rights-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

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

.right-card strong {
  color: var(--ink);
}

.right-card span {
  color: var(--muted);
  font-size: 13px;
}

.ratio-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  color: #11644f;
  background: #dff3ee;
  font-size: 12px;
  font-weight: 700;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.table-pagination div {
  display: flex;
  gap: 8px;
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.history-summary > div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.history-summary span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.history-summary strong {
  color: var(--ink);
  font-size: 23px;
}

.history-table {
  min-width: 980px;
}

.history-table td:last-child {
  min-width: 180px;
}

.changes-table td:nth-child(6) {
  min-width: 460px;
}

.log-detail-cell {
  white-space: normal;
  line-height: 1.45;
}

.log-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.log-status.success {
  color: var(--success);
  background: #e2f3ee;
}

.log-status.warning {
  color: var(--warning);
  background: #fff2d9;
}

.log-status.info {
  color: var(--primary);
  background: #eaf1fb;
}

.log-status.danger {
  color: var(--danger);
  background: #fae5e3;
}

.stats-table {
  min-width: 1420px;
  table-layout: auto;
}

.annual-stats th,
.annual-stats td {
  min-width: 76px;
}

.daily-stats {
  min-width: 2320px;
}

.daily-stats th,
.daily-stats td {
  min-width: 54px;
}

.stats-table th:first-child,
.stats-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 170px;
  min-width: 170px;
  background: #fff;
}

.stats-table th:first-child {
  z-index: 2;
  background: #f8fafc;
}

.stats-table td {
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
}

.stats-table td:first-child {
  text-align: left;
}

.stats-person-button {
  display: inline-flex;
  width: 100%;
  padding: 0;
  border: 0;
  color: var(--primary);
  background: transparent;
  font-weight: 700;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.stats-person-button:hover,
.stats-person-button:focus-visible {
  color: var(--primary-dark);
}

.stats-sort-button {
  display: inline-flex;
  width: 100%;
  min-height: 28px;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: 800;
  text-align: left;
}

.stats-sort-button:hover,
.stats-sort-button:focus-visible,
.stats-sort-button.active {
  color: var(--primary);
}

.stats-detail-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overscroll-behavior: contain;
  overflow-x: hidden;
  overflow-y: auto;
}

.stats-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  min-width: 0;
}

#stats-detail-modal {
  max-height: calc(100vh - 28px);
  overflow: hidden;
}

#stats-detail-modal[open] {
  display: flex;
  flex-direction: column;
}

#stats-detail-modal .modal-header,
#stats-detail-modal .modal-footer {
  flex: 0 0 auto;
}

#stats-detail-modal .data-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.stats-detail-grid h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 16px;
}

.settings-note {
  margin: -2px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.muted-action {
  color: var(--muted);
  font-size: 13px;
}

.plain-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plain-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(17, 24, 39, 0.42);
}

.modal {
  z-index: 50;
  width: min(720px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(18, 28, 43, 0.28);
  overflow: visible;
}

.wide-modal {
  width: min(1080px, calc(100vw - 28px));
}

#skills-modal,
#guard-roles-modal,
#guard-lock-modal,
#task-modal {
  max-height: calc(100dvh - 24px);
  overflow: hidden;
}

#skills-modal > .modal-content,
#guard-roles-modal > form,
#guard-lock-modal > form,
#task-modal > form {
  display: flex;
  max-height: inherit;
  min-height: 0;
  flex-direction: column;
}

#skills-modal .modal-header,
#skills-modal .modal-footer,
#guard-roles-modal .modal-header,
#guard-roles-modal .modal-footer,
#guard-lock-modal .modal-header,
#guard-lock-modal .modal-footer,
#task-modal .modal-header,
#task-modal .modal-footer {
  flex: 0 0 auto;
  flex-wrap: wrap;
}

#skills-modal .modal-body,
#guard-roles-modal .modal-body,
#guard-lock-modal .modal-body,
#task-modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

#guard-lock-description {
  margin: 0;
}

#request-modal {
  width: min(1180px, calc(100vw - 18px));
  max-height: calc(100vh - 24px);
  min-height: min(760px, calc(100vh - 24px));
}

#request-modal > form {
  display: flex;
  max-height: inherit;
  min-height: inherit;
  flex-direction: column;
}

#request-modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

#bulk-request-modal {
  max-height: calc(100vh - 24px);
  overflow: hidden;
}

#bulk-request-modal[open] {
  display: flex;
  flex-direction: column;
}

#bulk-request-modal > form {
  display: flex;
  max-height: inherit;
  min-height: 0;
  flex-direction: column;
}

#bulk-request-modal .modal-header,
#bulk-request-modal .modal-footer {
  flex: 0 0 auto;
}

#bulk-request-modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

#bulk-request-modal .autocomplete {
  align-self: stretch;
}

#bulk-request-modal .modal-footer {
  flex-wrap: wrap;
}

.modal::backdrop {
  background: rgba(17, 24, 39, 0.42);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.modal-header {
  border-bottom: 1px solid var(--line);
}

.modal-footer {
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

.modal-body {
  padding: 20px;
  overflow: visible;
}

.request-list {
  display: grid;
  max-height: min(380px, 42vh);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}

.empty-state {
  margin: 0;
  padding: 16px;
  border: 1px dashed #b9c4d3;
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafc;
}

.request-feedback {
  margin: 0;
  padding: 10px 12px;
  border-radius: 7px;
  color: #16512c;
  background: #e8f7ee;
  font-size: 14px;
  font-weight: 700;
}

.request-feedback.error {
  color: #8b1d1d;
  background: #fdeaea;
}

.request-row {
  display: grid;
  grid-template-columns: minmax(230px, 1.2fr) minmax(230px, 1.2fr) minmax(180px, 1fr) minmax(150px, auto);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.request-row:last-child {
  border-bottom: 0;
}

.request-row-head {
  color: var(--ink);
  background: #f8fafc;
  font-size: 13px;
  font-weight: 700;
}

.request-row input,
.request-row select,
.request-row textarea {
  margin-top: 0;
}

.autocomplete {
  display: grid;
  position: relative;
  width: 100%;
  margin-top: 6px;
}

.autocomplete input {
  min-height: 40px;
  margin-top: 0;
  padding-right: 42px;
}

.autocomplete-toggle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: grid;
  width: 38px;
  min-height: 0;
  padding: 0;
  place-items: center;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 7px 7px 0;
  color: var(--muted);
  background: #fff;
  font-size: 0;
  font-weight: 700;
  line-height: 1;
}

.autocomplete-toggle::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: -3px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.autocomplete-menu {
  display: none;
  position: absolute;
  z-index: 5000;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: min(360px, 42vh);
  overflow: auto;
  border: 1px solid #b9c4d3;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(27, 39, 56, 0.18);
}

.add-request-panel .autocomplete-menu {
  top: auto;
  bottom: calc(100% + 4px);
}

.autocomplete.open .autocomplete-menu {
  display: grid;
}

.autocomplete-option {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  background: #fff;
  text-align: left;
}

.autocomplete-option:last-child {
  border-bottom: 0;
}

.autocomplete-option:hover,
.autocomplete-option:focus-visible {
  color: var(--primary-dark);
  background: #eaf1fb;
}

.autocomplete-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

.request-row-form {
  grid-template-columns: minmax(280px, 1.25fr) minmax(230px, 1fr) minmax(180px, 1fr) auto;
  padding: 0;
  border: 0;
}

.period-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
  border: 0;
}

.period-pills legend {
  width: 100%;
  margin-bottom: 4px;
}

.period-pills label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-weight: 500;
}

.period-choice.period-morning,
.period-badge.period-morning {
  border-color: #9dc4f2;
  color: #174b82;
  background: #e7f1fd;
}

.period-choice.period-afternoon,
.period-badge.period-afternoon {
  border-color: #c5a6ef;
  color: #56328b;
  background: #f0e7ff;
}

.period-choice.period-full,
.period-badge.period-full {
  border-color: #8ecdb8;
  color: #12634d;
  background: #e0f6ee;
}

.period-choice:not(:has(input:checked)) {
  border-color: var(--line);
  color: var(--text);
  background: #fff;
}

.period-badge {
  display: inline-flex;
  width: fit-content;
  min-height: 28px;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.period-pills input {
  width: 15px;
  min-height: 15px;
  margin: 0;
}

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

.add-request-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.add-request-panel h3 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.compact-table input,
.compact-table select,
.compact-table textarea {
  margin-top: 0;
}

.compact-table input[readonly],
.compact-table textarea[readonly],
.task-table textarea[readonly] {
  color: var(--text);
  background: transparent;
  cursor: default;
}

.task-edit-button {
  margin-top: 12px;
}

.add-line {
  margin-top: 14px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .sidebar-footer {
    display: grid;
  }

  .user-menu-panel {
    position: static;
    width: 100%;
    margin-top: 8px;
  }

  .topbar,
  .section-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .button-row {
    justify-content: flex-start;
  }

  .guard-week-header,
  .sheet-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .week-actions,
  .sheet-actions {
    justify-content: flex-start;
  }

  .sheet-preview {
    grid-template-columns: 1fr;
  }

  .login-layout,
  .guard-layout,
  .settings-grid,
  .task-board,
  .training-board,
  .staff-ga-fields {
    grid-template-columns: 1fr;
  }

  .month-picker,
  .request-row,
  .request-row-form {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .month-picker {
    display: grid;
  }

  .request-row-head {
    display: none;
  }

  .stats-filters,
  .history-filters {
    justify-content: flex-start;
  }

  .history-summary {
    grid-template-columns: 1fr;
  }

  .stats-detail-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  #guards .month-picker {
    grid-template-columns: 32px minmax(0, 1.2fr) minmax(0, 0.8fr) 32px;
    gap: 6px;
    padding: 8px;
  }

  #guards .month-nav-button {
    width: 32px;
  }

  .main-content {
    padding: 18px;
  }

  .topbar h1 {
    font-size: 25px;
  }

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

  .weekday {
    display: none;
  }

  .day {
    min-height: 82px;
    border-right: 0;
  }

  .two-cols {
    grid-template-columns: 1fr;
  }

  .nav-tabs {
    grid-template-columns: 1fr;
  }

  .button-row,
  .stats-filters,
  .history-filters,
  .sheet-actions,
  .segmented-control {
    width: 100%;
  }

  .button-row > *,
  .stats-filters label,
  .history-filters label,
  .sheet-actions label,
  .segmented-control button {
    flex: 1 1 auto;
  }

  .sheet-page {
    min-height: 0;
    padding: 18px;
  }

  .sheet-top-row,
  .sheet-part,
  .sheet-shifts {
    grid-template-columns: 1fr;
  }

  .handwriting-box {
    min-height: 88px;
  }

  .table-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .table-pagination div {
    width: 100%;
  }

  .table-pagination .small-button {
    flex: 1 1 0;
  }

  #bulk-request-modal .modal-body {
    padding: 16px;
  }

  #bulk-request-modal .modal-footer {
    align-items: stretch;
    flex-direction: column;
  }

  #bulk-request-modal .modal-footer .outline-button,
  #bulk-request-modal .modal-footer .primary-button {
    width: 100%;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  body {
    background: #fff;
    margin: 0;
  }

  .sidebar,
  .topbar,
  .login-screen,
  .section-toolbar,
  .toast-stack,
  .flash-message,
  .modal-backdrop,
  dialog,
  .tab-panel:not(#guard-sheet) {
    display: none !important;
  }

  .app-shell,
  .main-content,
  .tab-panel,
  #guard-sheet {
    display: block !important;
    padding: 0;
  }

  .sheet-preview {
    display: block;
    width: 210mm;
    margin: 0;
  }

  .print-only-sheet {
    display: block;
  }

  .sheet-page {
    width: 210mm !important;
    min-height: auto;
    height: 297mm !important;
    box-sizing: border-box;
    margin: 0;
    padding: 6mm 6mm 6mm 16mm;
    border: 0;
    border-radius: 0;
    font-size: 10.5px;
    box-shadow: none;
    overflow: hidden;
    page-break-after: auto;
    break-after: auto;
  }

  .sheet-front {
    display: block;
    page-break-after: always;
    break-after: page;
  }

  .sheet-back {
    page-break-after: auto;
    break-after: auto;
  }

  .sheet-back .sheet-header > div:first-child {
    display: none;
  }

  .sheet-header {
    display: block;
    position: relative;
    margin-bottom: 5mm;
    padding-bottom: 3mm;
  }

  .sheet-header-side {
    display: block;
    margin-top: 1mm;
    padding-right: 54mm;
    text-align: left;
  }

  .sheet-logo {
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
  }

  .sheet-logo-front {
    max-width: 180px;
    max-height: 90px;
  }

  .sheet-logo-back {
    max-width: 90px;
    max-height: 45px;
    top: -5px;
  }

  .sheet-header h2 {
    font-size: 20px;
  }

  .sheet-part,
  .sheet-front .sheet-part {
    grid-template-columns: minmax(0, 1fr) 74mm;
    gap: 3mm;
    margin-bottom: 2mm;
  }

  .sheet-top-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 3mm;
    margin-bottom: 2mm;
    width: 100%;
  }

  .sheet-top-row > .sheet-part,
  .sheet-top-row .sheet-content {
    width: 100%;
  }

  .sheet-comments-part,
  .sheet-personnel-part {
    grid-template-columns: 1fr;
    min-width: 0;
    width: 100%;
  }

  .sheet-top-row > .sheet-part {
    display: block !important;
    min-width: 0 !important;
    max-width: 100%;
    width: 100% !important;
  }

  .sheet-personnel-part .sheet-content,
  .sheet-comments-part .sheet-content {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100%;
  }

  .sheet-personnel-table,
  .intervention-table {
    table-layout: fixed;
    width: 100%;
  }

  .intervention-table {
    border-color: #cbd5e1;
    border-radius: 1.6mm;
    background: #fbfcfe !important;
  }

  .intervention-table th,
  .intervention-table td {
    border-right-color: #cbd5e1;
    border-bottom-color: #cbd5e1;
  }

  .intervention-table th {
    background: #eef4fb !important;
  }

  .intervention-table td {
    background: #fff !important;
  }

  .sheet-content {
    min-height: 12mm;
    padding: 2.4mm;
  }

  .sheet-alert-text {
    color: #b91c1c !important;
    font-weight: 800;
  }

  .sheet-training-text span {
    margin-top: 1.2mm;
    font-size: 9.5px;
  }

  .sheet-content h3,
  .sheet-back-section h3 {
    margin-bottom: 1.8mm;
    font-size: 11px;
  }

  .sheet-title-note {
    font-size: 9.2px;
  }

  .handwriting-box,
  .sheet-front .handwriting-box {
    display: block;
    min-height: 23mm;
  }

  .sheet-sport-part {
    margin-bottom: 0;
  }

  .sheet-sport-part .sheet-content,
  .sheet-sport-part .handwriting-box,
  .sheet-front .sheet-sport-part .handwriting-box {
    min-height: 7mm;
  }

  .sheet-sport-part .sheet-content {
    padding-top: 1.5mm;
    padding-bottom: 1.5mm;
  }

  .sheet-sport-part h3 {
    margin: 0;
  }

  .sheet-personnel-part .handwriting-box {
    display: none;
  }

  .sheet-personnel-table th,
  .sheet-personnel-table td {
    padding: 1.7mm;
    font-size: 10.8px;
  }

  .intervention-table th,
  .intervention-table td {
    padding: 1.8mm;
    font-size: 10px;
  }

  .intervention-table td {
    height: 7mm;
  }

  .intervention-table tbody tr {
    height: 7mm;
  }

  .large-handwriting-zone {
    min-height: 102mm;
  }

  .signature-zone {
    min-height: 24mm;
    padding: 3mm;
  }
}
