dialog.wfgrid-dialog {
  width: min(1480px, 98vw);
  max-width: 98vw;
  max-height: 94vh;
}

.wfgrid-root {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wfgrid-stage1-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
  align-items: end;
}

.wfgrid-period-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  padding: 10px 14px;
  background: #f5f9fa;
  border: 1px solid #dce5e6;
  border-radius: 10px;
}

.wfgrid-period-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.wfgrid-period-nav select,
.wfgrid-period-nav input[type='month'] {
  min-width: 240px;
}

.wfgrid-filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 12px;
  padding: 12px 14px;
  background: #fbfcfd;
  border: 1px solid #dce5e6;
  border-radius: 10px;
  align-items: end;
}

.wfgrid-check-inline {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px;
  margin: 0 !important;
  font-size: 13px;
  cursor: pointer;
}

.wfgrid-check-inline input[type='checkbox'] {
  width: 17px !important;
  height: 17px;
  flex: none;
  accent-color: var(--brand, #168977);
}

.wfgrid-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.wfgrid-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.wfgrid-people-list {
  max-height: 360px;
  overflow: auto;
  border: 1px solid #dce5e6;
  border-radius: 10px;
  background: #fff;
}

.wfgrid-person-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #edf1f2;
  cursor: pointer;
}

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

.wfgrid-person-row:hover {
  background: #f6fbf9;
}

.wfgrid-person-row input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand, #168977);
}

.wfgrid-person-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.wfgrid-person-title {
  font-size: 13px;
  font-weight: 600;
  color: #183449;
}

.wfgrid-person-title strong {
  color: var(--brand, #168977);
  margin-right: 6px;
}

.wfgrid-person-meta {
  font-size: 12px;
  color: #617580;
}

.wfgrid-person-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.wfgrid-tag-assigned {
  background: #e1f4ed;
  color: #0d6a58;
}

.wfgrid-tag-imported {
  background: #fdecec;
  color: #9e2a2b;
}

.wfgrid-stage2-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #f5f9fa;
  border: 1px solid #dce5e6;
  border-radius: 10px;
}

.wfgrid-context-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wfgrid-context-title strong {
  font-size: 15px;
  color: #183449;
}

.wfgrid-context-title span {
  font-size: 12px;
  color: #617580;
}

.wfgrid-cal-banner {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 14px;
}

.wfgrid-cal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.wfgrid-table-wrap {
  position: relative;
  overflow: auto;
  max-height: 54vh;
  border: 1px solid #cdd9dc;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(16, 44, 53, 0.05);
}

.wfgrid-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.wfgrid-table th,
.wfgrid-table td {
  border-right: 1px solid #e1e9ec;
  border-bottom: 1px solid #e1e9ec;
  vertical-align: middle;
}

.wfgrid-table thead th {
  position: sticky;
  z-index: 3;
  text-align: center;
  font-weight: 600;
  min-width: 132px;
  padding: 5px 6px;
}

.wfgrid-table thead tr.wfgrid-head-holiday th {
  top: 0;
  height: 28px;
  background: #f9fbfc;
  color: #49606c;
  font-size: 11px;
  z-index: 4;
}

.wfgrid-table thead tr.wfgrid-head-weekday th {
  top: 28px;
  height: 26px;
  background: #f3f7f8;
  color: #183449;
  font-size: 12px;
  z-index: 4;
}

.wfgrid-table thead tr.wfgrid-head-brand th {
  top: 54px;
  height: 38px;
  background: var(--brand, #168977);
  color: #fff;
  border-right-color: rgba(255, 255, 255, 0.22);
  border-bottom: 2px solid #0e6356;
  z-index: 4;
}

.wfgrid-table thead tr.wfgrid-head-holiday th.wfgrid-head-spacer,
.wfgrid-table thead tr.wfgrid-head-weekday th.wfgrid-head-spacer {
  background: #f6f9fa;
}

.wfgrid-sticky-left-1 {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 58px !important;
  width: 58px;
  max-width: 58px;
  text-align: center;
  background: #fbfdfe;
  padding: 6px 4px;
}

.wfgrid-sticky-left-2 {
  position: sticky;
  left: 58px;
  z-index: 2;
  min-width: 185px !important;
  max-width: 210px;
  background: #fbfdfe;
  padding: 6px 10px;
  box-shadow: 2px 0 6px rgba(16, 44, 53, 0.06);
}

.wfgrid-table thead th.wfgrid-sticky-left-1,
.wfgrid-table thead th.wfgrid-sticky-left-2 {
  z-index: 6 !important;
}

.wfgrid-sticky-right-total {
  position: sticky;
  right: 40px;
  z-index: 2;
  min-width: 108px !important;
  background: #fbfdfe;
  padding: 6px 8px;
  box-shadow: -2px 0 6px rgba(16, 44, 53, 0.06);
}

.wfgrid-sticky-right-del {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 40px !important;
  width: 40px;
  text-align: center;
  background: #fbfdfe;
  padding: 4px;
}

.wfgrid-table thead th.wfgrid-sticky-right-total,
.wfgrid-table thead th.wfgrid-sticky-right-del {
  z-index: 6 !important;
}

.wfgrid-holiday-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  max-width: 122px;
}

body #dialog.wfgrid-dialog .wfgrid-holiday-indicator input[type='checkbox'] {
  width: 13px;
  height: 13px;
  min-height: 13px;
  margin: 0;
  pointer-events: none;
}

.wfgrid-holiday-indicator span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wfgrid-day-name {
  font-size: 12px;
  font-weight: 700;
}

.wfgrid-brand-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
  gap: 2px;
}

.wfgrid-brand-col span {
  font-size: 12px;
  font-weight: 700;
}

/* Secondary headings inherit the accessible header foreground. */
body[data-company] .wfgrid-table .wfgrid-brand-col small {
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  opacity: 1;
}

.wfgrid-table tbody td {
  padding: 6px 5px;
  background: #fff;
}

.wfgrid-table tbody tr:nth-child(even) td {
  background: #fafcfd;
}

.wfgrid-table
  tbody
  tr:hover
  td:not(.wfgrid-sticky-left-1):not(.wfgrid-sticky-left-2):not(.wfgrid-sticky-right-total):not(
    .wfgrid-sticky-right-del
  ) {
  background: #f5fbf8;
}

.wfgrid-table th.is-weekend:not(.wfgrid-head-brand th) {
  background: #eef2f4;
}

.wfgrid-table thead tr.wfgrid-head-weekday th.is-weekend,
.wfgrid-table thead tr.wfgrid-head-holiday th.is-weekend {
  background: #eaefee;
  color: #536671;
}

.wfgrid-table thead tr.wfgrid-head-brand th.is-weekend {
  background: #137465;
}

.wfgrid-table tbody td.is-weekend {
  background: #f3f6f7;
}

.wfgrid-table thead tr.wfgrid-head-holiday th.is-holiday,
.wfgrid-table thead tr.wfgrid-head-weekday th.is-holiday {
  background: #fdecec;
  color: #9e2a2b;
}

.wfgrid-table thead tr.wfgrid-head-brand th.is-holiday {
  background: #b93c3c;
}

.wfgrid-table tbody td.is-holiday {
  background: #fff6f6;
}

.wfgrid-table thead tr.wfgrid-head-holiday th.is-contract-holiday,
.wfgrid-table thead tr.wfgrid-head-weekday th.is-contract-holiday {
  background: #e9f3fa;
  color: #1f5c87;
}

.wfgrid-table thead tr.wfgrid-head-brand th.is-contract-holiday {
  background: #23689c;
}

.wfgrid-table tbody td.is-contract-holiday {
  background: #f4fafe;
}

.wfgrid-table thead tr.wfgrid-head-holiday th.is-closure,
.wfgrid-table thead tr.wfgrid-head-weekday th.is-closure {
  background: #fff3dd;
  color: #8a5600;
}

.wfgrid-table thead tr.wfgrid-head-brand th.is-closure {
  background: #87530e;
}

.wfgrid-table tbody td.is-closure {
  background: #fffbf2;
}

.wfgrid-table th.is-closed-period,
.wfgrid-table td.is-closed-period {
  background: #eceff1 !important;
  color: #475a65 !important;
}

.wfgrid-table td.is-out-of-bond,
.wfgrid-table td.is-imported {
  background: #f2f4f5 !important;
}

.wfgrid-emp-code {
  font-weight: 700;
  color: var(--brand, #168977);
  font-size: 12px;
  white-space: nowrap;
}

.wfgrid-emp-name {
  font-weight: 600;
  color: #183449;
  line-height: 1.25;
  font-size: 12px;
}

.wfgrid-emp-meta {
  font-size: 10.5px;
  color: #617580;
  margin-top: 2px;
}

.wfgrid-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wfgrid-cell-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

body #dialog.wfgrid-dialog .wfgrid-cell-line input[type='number'] {
  width: 40px;
  min-width: 40px;
  height: 30px;
  min-height: 30px;
  padding: 2px 3px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  border: 1px solid #cbd7da;
  border-radius: 6px;
  background: #fff;
  box-shadow: none;
  appearance: textfield;
  -moz-appearance: textfield;
}

body #dialog.wfgrid-dialog .wfgrid-cell-line input[type='number']::-webkit-outer-spin-button,
body #dialog.wfgrid-dialog .wfgrid-cell-line input[type='number']::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

body #dialog.wfgrid-dialog .wfgrid-cell-line input[type='number']:focus {
  outline: none;
  border-color: var(--brand, #168977);
  box-shadow: 0 0 0 2px rgba(22, 137, 119, 0.24);
}

body #dialog.wfgrid-dialog .wfgrid-cell-line input[type='number'].is-existing {
  background: #e4f3ee;
  border-color: #7ebda8;
  color: #0d5a4b;
  font-weight: 700;
}

body #dialog.wfgrid-dialog .wfgrid-cell-line input[type='number'].is-dirty {
  background: #fffdf0;
  border-color: var(--brand, #168977);
}

body #dialog.wfgrid-dialog .wfgrid-cell-line input[type='number']:disabled:not(.is-existing) {
  background: #eef1f3;
  color: #8a99a3;
  cursor: not-allowed;
}

body #dialog.wfgrid-dialog .wfgrid-abs-btn {
  height: 30px;
  min-height: 30px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #cbd7da;
  background: #fff;
  color: #35505e;
  white-space: nowrap;
  box-shadow: none;
}

body #dialog.wfgrid-dialog .wfgrid-abs-btn:hover:not(:disabled) {
  background: #fff4f4;
  border-color: #d97a78;
  color: #9e2a2b;
}

body #dialog.wfgrid-dialog .wfgrid-abs-btn.has-absence {
  background: #fdecec;
  border-color: #d9534f;
  color: #9e2a2b;
  font-weight: 700;
}

body #dialog.wfgrid-dialog .wfgrid-abs-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.wfgrid-cell-hint {
  font-size: 10px;
  color: #546975;
  text-align: center;
  line-height: 1.2;
}

.wfgrid-table td.is-over-limit {
  background: #fff0f0 !important;
  box-shadow: inset 0 0 0 2px #c94a4a;
}

.wfgrid-cell-error {
  font-size: 10px;
  font-weight: 700;
  color: #9e2a2b;
  text-align: center;
}

.wfgrid-row-total {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 11px;
  text-align: right;
}

.wfgrid-row-total strong {
  font-size: 13px;
  color: var(--brand, #168977);
}

body #dialog.wfgrid-dialog .wfgrid-remove-btn {
  height: 28px;
  min-height: 28px;
  padding: 0 6px;
  font-size: 12px;
  background: #fff;
  border: 1px solid #dce5e6;
  border-radius: 6px;
  box-shadow: none;
}

body #dialog.wfgrid-dialog .wfgrid-remove-btn:hover {
  border-color: #d9534f;
  color: #9e2a2b;
  background: #fff5f5;
}

.wfgrid-footer-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  background: #fbfcfd;
  border: 1px solid #dce5e6;
  border-radius: 10px;
}

.wfgrid-footer-add select {
  min-width: 280px;
  flex: 1 1 280px;
}

.wfgrid-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  background: #f0faf6;
  border: 1px solid #b5e2d4;
  border-radius: 10px;
  color: #174f43;
  font-size: 13px;
}

.wfgrid-review-box {
  padding: 16px;
  border: 1px solid #b5e2d4;
  background: #f0faf6;
  border-radius: 10px;
  color: #174f43;
}

.wfgrid-conflicts-box {
  padding: 16px;
  border: 1px solid #efc9aa;
  background: #fff9f3;
  border-radius: 10px;
  overflow: auto;
}

.wfgrid-conflicts-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 12px;
}

.wfgrid-conflicts-table th,
.wfgrid-conflicts-table td {
  border: 1px solid #e7d8c9;
  padding: 6px 8px;
  text-align: left;
}

dialog.wfgrid-absence-dialog {
  width: min(440px, 94vw);
  padding: 0;
  border: 1px solid #dce5e6;
  border-radius: 14px;
  box-shadow: 0 22px 60px rgba(9, 40, 62, 0.34);
}

dialog.wfgrid-absence-dialog::backdrop {
  background: rgba(9, 40, 62, 0.45);
  backdrop-filter: blur(2px);
}

.wfgrid-abs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #edf1f2;
}

.wfgrid-abs-head h3 {
  margin: 0;
  font-size: 16px;
  color: #183449;
}

.wfgrid-abs-head p {
  margin: 2px 0 0;
  font-size: 12px;
}

.wfgrid-abs-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 18px;
}

.wfgrid-abs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 18px 16px;
  border-top: 1px solid #edf1f2;
}

.wfgrid-popover-existing {
  background: #f5f9fa;
  border: 1px solid #dce5e6;
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#wfGridForm [hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  dialog.wfgrid-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
  }
  .wfgrid-sticky-left-1,
  .wfgrid-sticky-left-2,
  .wfgrid-sticky-right-total,
  .wfgrid-sticky-right-del {
    position: static;
    box-shadow: none;
  }
}

/* Keep period navigation on one baseline, with a compact mobile layout. */
body #dialog.wfgrid-dialog .wfgrid-period-bar > label {
  flex: 0 0 135px;
  margin: 0;
}
body #dialog.wfgrid-dialog .wfgrid-period-nav {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  flex: 1 1 450px;
  min-width: 0;
  align-items: center;
}
body #dialog.wfgrid-dialog .wfgrid-period-nav :is(select, input[type='month']) {
  min-width: 0;
  width: 100%;
  margin: 0;
}
body #dialog.wfgrid-dialog .wfgrid-period-nav button {
  min-height: 44px;
  margin: 0;
  white-space: nowrap;
}
@media (max-width: 640px) {
  body #dialog.wfgrid-dialog .wfgrid-period-bar > label {
    flex-basis: 100%;
  }
  body #dialog.wfgrid-dialog .wfgrid-period-nav {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: 'period period' 'previous next';
    flex-basis: 100%;
  }
  body #dialog.wfgrid-dialog .wfgrid-period-nav :is(select, input[type='month']) {
    grid-area: period;
  }
  body #dialog.wfgrid-dialog .wfgrid-period-nav button:first-child {
    grid-area: previous;
  }
  body #dialog.wfgrid-dialog .wfgrid-period-nav button:last-child {
    grid-area: next;
  }
}

.wfgrid-outside {
  background: #fff0d4;
  color: #704509;
  border: 1px solid #e2bd78;
  white-space: normal;
}
.wfgrid-root .wfgrid-toolbar-group button[aria-pressed='true'] {
  border-color: var(--brand, #117b70);
  box-shadow: inset 0 -3px var(--brand, #117b70);
  font-weight: 700;
}
.wfgrid-root .wfgrid-toolbar strong {
  white-space: normal;
  line-height: 1.5;
}
