.daily-attendance-grid {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-surface);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.08), 0px 1px 2px 0px rgba(0, 0, 0, 0.04);
}

.summary-cards {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 4px 12px;
  flex-wrap: wrap;
}

.summary-card {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color, #ebebeb);
  border-radius: 10px;
  text-align: left;
  transition: box-shadow 0.15s ease;
  box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.04);
}

.summary-card:hover {
  box-shadow: 0px 3px 8px 0px rgba(0, 0, 0, 0.08);
}

.summary-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;

  mat-icon {
    font-size: 16px;
    width: 16px;
    height: 16px;
  }
}

.summary-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.summary-present .summary-icon {
  background: rgba(38, 168, 105, 0.12);
  color: #1f9d5c;
}

.summary-absent .summary-icon {
  background: rgba(224, 66, 66, 0.12);
  color: #d64545;
}

.summary-holiday .summary-icon {
  background: rgba(130, 90, 220, 0.12);
  color: #7a52d6;
}

.summary-leave .summary-icon {
  background: rgba(230, 149, 25, 0.14);
  color: #d98a12;
}

.summary-weekoff .summary-icon {
  background: rgba(90, 130, 220, 0.12);
  color: #4d78d9;
}

.summary-label {
  font-size: 10px;
  color: var(--text-secondary, #6b7280);
  font-weight: 500;
  white-space: nowrap;
  font-family: var(--app-font-family);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.summary-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--app-font-family);
  line-height: 1.2;
}

.legend.grid-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 4px;
  margin: 0 0 0 auto;
  flex: 0 1 auto;
}

.legend.grid-legend .legend-container {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.legend-item {
  display: flex;
  align-items: center;
  height: 26px;
  gap: 6px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--app-font-family);
  font-weight: 500;
  font-size: 11.5px;
  line-height: 150%;
  box-sizing: border-box;
  white-space: nowrap;
}

.legend-item::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-item.color-red {
  background: rgba(224, 90, 90, 0.1);
  border-color: rgba(224, 90, 90, 0.3);
  color: #b23c3c;
}

.legend-item.color-red::before {
  background-color: #e05a5a;
}

.legend-item.color-orange {
  background: rgba(230, 160, 32, 0.12);
  border-color: rgba(230, 160, 32, 0.32);
  color: #9c6a10;
}

.legend-item.color-orange::before {
  background-color: #e6a020;
}

.legend-item.color-green {
  background: rgba(47, 169, 106, 0.1);
  border-color: rgba(47, 169, 106, 0.3);
  color: #1f7a4d;
}

.legend-item.color-green::before {
  background-color: #2fa96a;
}

.grid-view-container {
  overflow-x: auto;
  max-height: calc(109vh - 375px);
  overflow-y: auto;
  padding: 0 4px 4px;
  border-radius: 12px;
}

.attendance-grid-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-surface);
  font-size: 12px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color, #ececec);
  box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.06);

  thead {
    position: sticky;
    top: 0;
    background: var(--bg-focus, #f6f6f8);
    z-index: 1;
  }

  th {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    font-weight: 600;
    font-family: var(--app-font-family);
    color: var(--text-secondary, #555);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    background: var(--bg-focus, #f6f6f8);
  }

  td {
    padding: 10px 8px;
    text-align: center;
    font-size: 12px;
    white-space: nowrap;
    font-family: var(--app-font-family);
    color: var(--text-primary);
    font-weight: 400;
    border-bottom: 1px solid var(--border-color, #f0f0f2);
  }

  tbody tr:last-child td {
    border-bottom: none;
  }

  tbody tr {
    cursor: pointer;
    background-color: var(--bg-surface);
    transition: background-color 0.12s ease;

    &.color-red {
      background-color: rgba(224, 90, 90, 0.14) !important;
      box-shadow: inset 3px 0 0 0 #e05a5a;
    }

    &.color-orange {
      background-color: rgba(230, 160, 32, 0.14) !important;
      box-shadow: inset 3px 0 0 0 #e6a020;
    }

    &.color-green {
      background-color: rgba(47, 169, 106, 0.14) !important;
      box-shadow: inset 3px 0 0 0 #2fa96a;
    }

    &:hover,
    &.color-red:hover,
    &.color-orange:hover,
    &.color-green:hover {
      background-color: var(--bg-focus, #f2f2f4) !important;
    }
  }
}

@media (max-width: 768px) {
  .summary-cards {
    gap: 8px;
    padding: 0px 10px 5px;
  }

  .summary-card {
    flex: 1 1 calc(50% - 8px);
    padding: 8px 10px;
  }

  .legend.grid-legend {
    flex: 1 1 100%;
    justify-content: flex-start;
    margin-left: 0;
  }

  .grid-view-container {
    padding: 0 10px 20px;
    max-height: calc(100vh - 250px);
  }

  .attendance-grid-table {
    font-size: 11px;

    th,
    td {
      padding: 8px 6px;
    }
  }
}

@media (max-width: 480px) {
  .summary-card {
    flex: 1 1 100%;
    padding: 6px 8px;
  }

  .summary-label {
    font-size: 9px;
  }

  .summary-value {
    font-size: 12px;
  }

  .grid-view-container {
    padding: 0 5px 15px;
    max-height: calc(100vh - 220px);
  }

  .attendance-grid-table {
    font-size: 10px;

    th,
    td {
      padding: 6px 3px;
    }
  }
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px;
  flex-shrink: 0;
  padding-top: 0px;
  padding-bottom: 0px;
}

.left-section {
  display: flex;
  align-items: center;
}

.right-section {
  display: flex;
  align-items: center;
}

.profile-pic {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  margin-right: 15px;
  object-fit: cover;
}

.userImage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  cursor: pointer;
  background-color: var(--button-primary-bg-active);
  color: var(--bg-surface);
  border-radius: 50%;
  font-family: var(--app-font-family);
  font-weight: 700;
  font-size: 20px;
  line-height: 150%;
  text-align: center;
  flex-shrink: 0;
  margin-left: 10px;
}

.employee-details {
  display: flex;
  flex-direction: column;
  padding-left: 10px;
}

.employee-details h3 {
  margin: 0;
  width: 220px;
  height: 18px;
  font-weight: 800;
  font-size: 12px;
  line-height: 150%;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--app-font-family);
}

.employee-details p {
  margin: 0;
  width: 220px;
  height: 15px;
  font-weight: 400;
  font-size: 10px;
  line-height: 150%;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-picker-wrapper {
  position: relative;
  display: inline-block;
  margin-left: 20px;
}

.nav-btn {
  width: 48px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #818181;
  background-color: #ffffff;
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  margin: 0 5px;
}

.nav-btn:hover {
  background-color: #f5f5f5;
}

.nav-btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
  background-color: #ffffff;
}

.arrow {
  width: 22px;
  height: 22px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
}

.today-btn {
  width: 160px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #818181;
  background-color: #ffffff;
  color: #333;
  font-weight: 700;
  font-size: 14px;
  line-height: 150%;
  text-align: center;
  cursor: pointer;
  margin: 0 5px;
}

.today-btn:hover {
  background-color: #f5f5f5;
}

.refresh-btn {
  width: 48px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #818181;
  background-color: #ffffff;
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-right: 5px;
}

.refresh-btn:hover {
  background-color: #f5f5f5;
}

.refresh-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.refresh-btn2 {
  width: 160px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #818181;
  background-color: var(--action-primary-disabled);
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-right: 5px;
  font-weight: 700;
  font-size: 14px;
}

.last-updated {
  font-size: 10px;
  color: #666;
  text-align: center;
  max-width: 120px;
  line-height: 1.2;
}

.rotating {
  animation: rotate 1s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 768px) {
  .top-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 15px;
    gap: 15px;
  }

  .left-section {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .employee-picker-wrapper {
    width: 100%;
    margin-left: 0;
    margin-top: 10px;
  }

  .right-section {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }

  .nav-btn,
  .today-btn {
    height: 44px;
    min-height: 44px;
  }

  .today-btn {
    width: auto;
    flex: 1;
    min-width: 150px;
  }
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  // Below the CDK overlay container's default z-index (1000, see @angular/cdk/overlay-prebuilt.css)
  // so MatDialog-based popups opened from inside this lightbox (e.g. the picklist grid) stack above it.
  z-index: 998;
}

.modal-content.screen-modal {
  width: min(90vw, 1405px);
  max-width: 95vw;
  height: 80vh;
  max-height: 900px;
  border-radius: 8px;
  background-color: #ffffff;
  box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 15px;
  margin-top: 10px;
}

.modal-header {
  width: 100%;
  height: auto;
  min-height: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0 10px 0;
  border-bottom: 1px solid #eee;
}

.modal-header-content {
  width: auto;
  height: auto;
  font-family: var(--app-font-family);
  font-weight: 700;
  font-size: 18px;
  line-height: 150%;
  color: var(--action-primary-default);
  display: flex;
  align-items: center;
  padding: 0;
}

.close-icon {
  width: 30px;
  height: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  color: #ffffff;
  background-color: red;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s;
}

.close-icon:hover {
  background-color: rgba(255, 0, 0, 0.817);
}

.modal-body.screen-modal-body {
  flex: 1;
  overflow: auto;
  padding: 0;
  width: 100%;
  min-width: 0;
}

.context-menu {
  position: fixed !important;
  background-color: white !important;
  border: 1px solid #ccc !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
  border-radius: 4px !important;
  min-width: 150px !important;
  z-index: 9999 !important;
  padding: 5px 0 !important;
  display: block !important;
}

.menu-item {
  padding: 8px 12px !important;
  cursor: pointer !important;

  &:hover {
    background-color: #f5f5f5 !important;
  }
}

@media (max-width: 768px) {
  .modal-overlay {
    padding: 0;
  }

  .modal-content.screen-modal {
    width: 99%;
    height: 95vh;
    padding: 15px;
    border-radius: 0;
  }

  .modal-header-content {
    font-size: 16px;
  }

  .context-menu {
    min-width: 180px;
    font-size: 14px;
  }

  .menu-item {
    padding: 12px 15px;
  }
}

@media (max-width: 480px) {
  .modal-content.screen-modal {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    padding: 10px;
  }

  .modal-header-content {
    font-size: 14px;
  }

  .context-menu {
    min-width: 160px;
    font-size: 13px;
  }

  .menu-item {
    padding: 10px 12px;
  }
}