html,
body {
  min-height: 100%;
}

:root {
  --schedule-sunday-bg: #fff59d;
  --schedule-holiday-bg: #ffd54f;
  --schedule-holiday-badge-bg: #b8860b;
  --schedule-holiday-badge-text: #ffffff;
}

body {
  padding-bottom: 36px;
}

.app-navbar {
  min-height: 72px;
}

.navbar-logo {
  max-height: 46px;
  width: auto;
  display: block;
}

.app-footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  height: 36px;
  z-index: 1020;
}

.app-footer .container {
  height: 36px;
}

.demo-watermark {
  position: fixed;
  top: 45%;
  left: 50%;
  z-index: 0;
  transform: translate(-50%, -50%) rotate(-28deg);
  color: rgba(220, 53, 69, 0.13);
  font-size: clamp(5rem, 16vw, 13rem);
  font-weight: 800;
  letter-spacing: 0;
  pointer-events: none;
  text-transform: uppercase;
}

main {
  position: relative;
  z-index: 1;
}

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

.btn,
.form-control,
.form-select,
.alert,
.badge,
.rounded {
  border-radius: 8px !important;
}

.attendance-thumb {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  background: #f8f9fa;
}

.attendance-placeholder {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border: 1px dashed #adb5bd;
  border-radius: 8px;
  background: #f8f9fa;
  color: #6c757d;
  font-size: 2rem;
}

.comparison-photo,
.comparison-placeholder {
  width: 100%;
  min-height: 420px;
  max-height: 70vh;
  object-fit: contain;
  background: #f8f9fa;
}

.comparison-placeholder {
  display: grid;
  place-items: center;
  border: 1px dashed #adb5bd;
  border-radius: 8px;
  color: #6c757d;
  font-size: 1.1rem;
}

.comparison-placeholder i {
  display: block;
  font-size: 4rem;
  text-align: center;
}

.attendance-filter-compact {
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
}

.branch-board-row {
  display: flex;
  align-items: stretch;
}

.branch-board-branch {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 44px;
  min-width: 44px;
  padding: 6px 4px;
  border-right: 1px solid #e9ecef;
  background: #fff;
  display: grid;
  place-items: center;
}

.branch-code-rotated {
  transform: rotate(-90deg);
  transform-origin: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #334155;
  white-space: nowrap;
}

.branch-board-scroll {
  overflow-x: auto;
  width: 100%;
}

.branch-board-employees {
  display: flex;
  gap: 12px;
  padding: 12px;
  min-width: max-content;
}

.attendance-card {
  width: 128px;
  min-width: 128px;
}

.attendance-card-name {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  min-height: 0;
  margin-bottom: 2px;
}

.attendance-card-photo {
  width: 128px;
  height: 128px;
  object-fit: cover;
  border: 1px solid #dee2e6;
  border-radius: 8px 8px 0 0;
  background: #f8f9fa;
  display: block;
}

.attendance-photo-trigger {
  display: block;
  line-height: 0;
}

.attendance-card-photo-placeholder {
  display: grid;
  place-items: center;
  color: #6c757d;
  font-size: 1.4rem;
}

.attendance-card-footer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.attendance-card-footer .cell {
  min-height: 28px;
  display: grid;
  place-items: center;
  align-content: center;
  font-size: 0.64rem;
  font-weight: 700;
  border: 1px solid #ffffff;
  color: #0f172a;
}

.attendance-card-footer .regular {
  background: #86efac;
}

.attendance-card-footer .overtime {
  background: #93c5fd;
}

.attendance-card-footer .clock {
  display: block;
  line-height: 1.05;
}

.attendance-card-footer .ampm {
  display: block;
  font-size: 0.54rem;
  line-height: 1;
  opacity: 0.78;
}

.attendance-record-card {
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.attendance-record-thumb-wrap {
  min-width: 88px;
}

.attendance-record-thumb {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  background: #f8f9fa;
}

.attendance-record-thumb-empty {
  display: grid;
  place-items: center;
  color: #6c757d;
  font-size: 0.8rem;
}

.attendance-record-table-wrap {
  overflow: auto;
  max-height: calc(100vh - 260px);
  padding: 0;
}

.attendance-record-table .pair-cell {
  text-align: center;
  font-weight: 600;
  min-width: 72px;
}

.attendance-record-photo-table {
  width: 100% !important;
  min-width: 100% !important;
  table-layout: fixed;
}

.attendance-record-photo-table .pair-cell {
  min-width: 132px;
  width: 132px;
}

.attendance-record-photo-cell {
  vertical-align: top;
}

.attendance-record-photo-table th:first-child,
.attendance-record-photo-table td:first-child {
  width: 72px;
}

.attendance-record-photo-table th:nth-child(2),
.attendance-record-photo-table td:nth-child(2) {
  width: 84px;
}

.attendance-record-photo-table th:nth-child(3),
.attendance-record-photo-table td:nth-child(3) {
  width: 110px;
}

.attendance-record-photo-table th:nth-child(4),
.attendance-record-photo-table td:nth-child(4) {
  width: 110px;
}

.attendance-record-photo-thumb {
  width: 112px;
  height: 112px;
  object-fit: cover;
}

.attendance-record-table {
  width: auto !important;
}

.attendance-record-month-nav {
  white-space: nowrap;
}

.attendance-record-month-nav .form-control {
  min-width: 160px;
}

.attendance-record-table th,
.attendance-record-table td {
  white-space: nowrap;
}

.attendance-record-table thead tr {
  position: sticky;
  top: 0;
  z-index: 4;
}

.attendance-record-table thead th {
  background: #ffffff;
  box-shadow: inset 0 -1px 0 #dee2e6;
}

.attendance-record-summary-sunday {
  background-color: var(--schedule-sunday-bg) !important;
}

.attendance-record-summary-holiday {
  background-color: var(--schedule-holiday-bg) !important;
}

@media (max-width: 767.98px) {
  .attendance-desktop-col {
    display: none;
  }
}

.attendance-record-table .pair-a {
  background: #eff6ff;
}

.attendance-record-table .pair-b {
  background: #f8fafc;
}

.attendance-record-table .pair-ot {
  background: #fee2e2;
  color: #991b1b;
}

.employee-card-form {
  background:
    repeating-linear-gradient(
      to bottom,
      #fbf6e8 0,
      #fbf6e8 27px,
      #e9e2cf 28px
    );
  border-color: #d9cfb2 !important;
  box-shadow: 0 8px 22px rgba(88, 74, 40, 0.12);
}

.employee-card-form .mb-3 {
  margin-bottom: 0.55rem !important;
}

.employee-card-form .form-label {
  margin-bottom: 0.2rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.employee-card-form .form-control,
.employee-card-form .form-select {
  min-height: calc(1.25em + 0.5rem + 2px);
  padding: 0.2rem 0.45rem;
  font-size: 0.84rem;
}

.employee-card-form .form-check {
  margin-bottom: 0.35rem !important;
}

.employee-card-form .form-text {
  font-size: 0.72rem;
}

.branch-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
}

.branch-check-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid #d8ccb0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.68);
  font-size: 0.8rem;
}

.branch-check-item input {
  width: 14px;
  height: 14px;
}

.employee-card-photo-wrap {
  border: 1px dashed #c8b68e;
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.65);
}

.employee-card-photo {
  width: 100%;
  max-width: 190px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #d3c5a4;
  background: #f7f3e8;
  margin-bottom: 8px;
}

.employee-card-photo-empty {
  display: grid;
  place-items: center;
  color: #8f7d53;
  font-size: 2rem;
}

.employee-qr-compact .form-control {
  background: #fffdfa;
}

.capability-matrix-table th,
.capability-matrix-table td {
  white-space: nowrap;
}

.capability-matrix-table .cap-sticky-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
}

.capability-row {
  transition: background-color 0.15s ease-in;
}

.capability-row:hover > td {
  background-color: #eef8ff;
}

.capability-row:hover > td.cap-sticky-col {
  background-color: #eef8ff;
}

.capability-toggle-btn {
  min-width: 34px;
  padding: 0.18rem 0.48rem;
  border: 1px solid #ced4da;
}

.capability-toggle-btn.is-enabled {
  color: #157347;
  border-color: #b8e0c6;
  background: #effaf3;
}

.capability-toggle-btn.is-disabled {
  color: #6c757d;
  background: #fff;
}

.capability-toggle-btn .capability-empty {
  font-size: 0.86rem;
  line-height: 1;
}

.slot-button {
  border-width: 1px;
}

.slot-button.slot-status-complete {
  color: #0f5132;
  background-color: #ecfdf3;
  border-color: #75c69a;
}

.slot-button.slot-status-partial {
  color: #7f1d1d;
  background-color: #fff1f2;
  border-color: #f1aeb5;
}

.slot-button.slot-status-conflict {
  color: #7f1d1d;
  background-color: #ffe4e6;
  border-color: #ef4444;
}

.slot-button.slot-status-empty {
  color: #495057;
  background-color: #f1f3f5;
  border-color: #ced4da;
}

.slot-assign-layout {
  min-height: 280px;
}

.slot-assign-employee-col {
  flex: 0 0 auto;
  width: fit-content;
  min-width: 260px;
  max-width: 340px;
}

.slot-assign-employee-col #slotAssignList {
  max-height: 340px;
  overflow: auto;
}

.slot-assign-date-col {
  flex: 1 1 auto;
  min-width: 0;
}

.slot-date-checks {
  max-height: 320px;
  min-height: 260px;
  overflow: auto;
}

.schedule-row-sunday > td {
  background-color: var(--schedule-sunday-bg);
}

.schedule-row-holiday > td {
  background-color: var(--schedule-holiday-bg);
}

.schedule-holiday-badge {
  background-color: var(--schedule-holiday-badge-bg);
  color: var(--schedule-holiday-badge-text);
}

@media (max-width: 991.98px) {
  .slot-assign-layout {
    flex-direction: column;
    min-height: 0;
  }

  .slot-assign-employee-col,
  .slot-assign-date-col {
    width: 100%;
    max-width: none;
    min-width: 0;
  }
}
