.muted-note {
  margin: 8px 0 14px;
  color: #555;
  font-size: 0.95rem;
}
:root {
  --primary-color: #1F2A44;
  --secondary-color: #2F8F83;
  --accent-color: #E6E6E6;
  --background-color: #F8F9FB;
  --text-color: #1A1A1A;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--background-color);
  color: var(--text-color);
  line-height: 1.5;
}

.site-header {
  background: var(--primary-color);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: relative;
}
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
}
.menu-toggle:active {
  opacity: 0.8;
}
.logo {
  width: 90px;
  height: 90px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--accent-color);
  border-radius: 8px;
}
.navbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.navbar a {
  color: #fff;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
}
.navbar a:hover,
.navbar a.active { background: var(--secondary-color); }
.nav-button {
  background: var(--secondary-color);
  color: #fff;
  padding: 8px 12px;
}

.container { max-width: min(calc(100vw - 340px), 1280px); margin: 24px 16px 24px 24px; padding: 0 16px 24px; }
h1, h2 { color: var(--primary-color); margin-top: 0; }

.layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding-right: 0;
}
.sidebar {
  width: 220px;
  border: 1px solid var(--accent-color);
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  position: sticky;
  top: 12px;
}
.sidebar-title {
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 10px;
}
.sidebar a {
  display: block;
  padding: 10px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--primary-color);
  border: 1px solid transparent;
}
.sidebar a:hover {
  background: var(--background-color);
  border-color: var(--accent-color);
}
.mobile-sidebar-logout {
  display: none;
}
.main-content { flex: 1 1 0; min-width: 0; }

.smart-calendar-panel {
  position: fixed;
  top: 124px;
  right: 16px;
  width: 300px;
  max-height: calc(100vh - 160px);
  overflow: auto;
  z-index: 20;
}

@media (min-width: 1100px) {
  .container {
    width: min(calc(100vw - 340px), 1280px);
    margin: 24px 0px 24px 24px;
  }
  .layout { padding-right: 80px; }
  .smart-calendar-panel {
    width: 300px;
    right: 16px;
  }
}

.smart-calendar-card {
  background: #fff;
  border: 1px solid var(--accent-color);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(31, 42, 68, 0.06);
}

.smart-calendar-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.smart-calendar-today-big {
  font-size: 26px;
  font-weight: 800;
  color: var(--primary-color);
}

.smart-calendar-today-dow {
  color: var(--secondary-color);
  font-weight: 700;
  font-size: 13px;
  margin-top: 2px;
}

.smart-calendar-mini {
  margin-top: 12px;
}

.smart-cal-month {
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.smart-cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  font-size: 12px;
  color: var(--primary-color);
  margin-bottom: 6px;
}

.smart-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.smart-cal-day {
  height: 30px;
  border: 1px solid var(--accent-color);
  border-radius: 6px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.smart-cal-day.muted {
  opacity: 0.5;
  cursor: default;
}

.smart-cal-day.today {
  border-color: var(--secondary-color);
  background: rgba(47, 143, 131, 0.08);
}

.smart-cal-day.has-event {
  box-shadow: inset 0 -3px 0 rgba(47, 143, 131, 0.35);
}

.smart-cal-day.has-leave {
  box-shadow: inset 0 -3px 0 rgba(31, 42, 68, 0.35);
}

.smart-cal-day.has-meeting {
  box-shadow: inset 0 -3px 0 rgba(31, 42, 68, 0.2);
}

.smart-cal-day.has-event.has-leave {
  box-shadow: inset 0 -3px 0 rgba(230, 230, 230, 0.9);
}

.smart-cal-section {
  margin-top: 14px;
}

.smart-cal-section h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--primary-color);
}

.smart-cal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.smart-cal-item {
  border: 1px solid var(--accent-color);
  background: var(--background-color);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
}

.smart-cal-item-title {
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 2px;
  font-size: 13px;
}

.smart-cal-item-sub {
  color: var(--secondary-color);
  font-size: 12px;
  font-weight: 700;
}

.smart-cal-filter {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.smart-cal-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.smart-cal-filter label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-color);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open { display: flex; }

.modal {
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 120px);
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--accent-color);
  padding: 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.modal-title {
  color: var(--primary-color);
  font-weight: 900;
  font-size: 18px;
}

.modal-close {
  border: 1px solid var(--accent-color);
  background: #fff;
  color: var(--primary-color);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.modal-body p { margin: 6px 0; }

@media (max-width: 1099px) and (min-width: 901px) {
  .layout { padding-right: calc(280px + 24px); }
  .sidebar { width: 200px; }
  .smart-calendar-panel {
    width: 280px;
    right: 16px;
  }
}

@media (max-width: 900px) and (min-width: 769px) {
  .layout { 
    flex-direction: column;
    padding-right: 0;
  }
  .sidebar { width: 100%; position: static; }
  .smart-calendar-panel {
    position: static;
    width: auto;
    max-height: none;
    margin-bottom: 18px;
    top: auto;
    right: auto;
  }
}

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }
  .site-header {
    justify-content: space-between;
    align-items: center;
  }
  .navbar {
    display: none;
  }
  .container {
    max-width: 100%;
    margin: 16px;
    padding: 0;
  }
  .layout {
    flex-direction: column;
    gap: 16px;
    padding-right: 0;
  }
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    width: 280px;
    background: #fff;
    border-right: 1px solid var(--accent-color);
    border-radius: 0;
    padding: 20px 0;
    z-index: 10000;
    transition: left 0.3s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar.open {
    left: 0;
  }
  .sidebar-title {
    padding: 0 16px;
    margin-bottom: 12px;
  }
  .sidebar a {
    padding: 12px 16px;
    margin: 0 8px;
  }
  .mobile-sidebar-logout {
    display: block;
    width: calc(100% - 16px);
    margin: 12px 8px 0;
    padding: 12px 16px;
    border: 0;
    border-radius: 8px;
    background: var(--secondary-color);
    color: #fff;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
  }
  .menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9998;
    display: none;
  }
  .menu-overlay.show {
    display: block;
  }
  .smart-calendar-panel {
    position: static;
    width: 100%;
    max-height: none;
    margin-bottom: 16px;
    top: auto;
    right: auto;
    border-radius: 10px;
  }
  .main-content {
    width: 100%;
    min-width: 0;
  }
  .card {
    padding: 14px;
    margin-bottom: 14px;
  }
  h1, h2 {
    font-size: 20px;
    margin-bottom: 12px;
  }
  h4 {
    font-size: 16px;
  }
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin: 0 -14px;
  }
  .table-wrap .table {
    min-width: auto;
  }
  .table {
    font-size: 12px;
  }
  .table th,
  .table td {
    padding: 8px;
    font-size: 12px;
  }
  .table-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 80px;
  }
  .table-actions button,
  .table-actions select,
  .table-actions input {
    font-size: 11px;
    padding: 6px 8px;
    min-height: auto;
  }
  input,
  select,
  button {
    font-size: 14px;
    padding: 10px 12px;
  }
  button {
    min-height: 44px;
    padding: 12px;
  }
  .grid-form {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .inline-form {
    flex-direction: column;
    gap: 10px;
  }
  label {
    font-size: 13px;
  }
  .choice-row {
    min-height: 44px;
    flex-wrap: wrap;
  }
  .modal {
    width: 90%;
    max-height: 80vh;
  }
}

.card {
  background: #fff;
  border: 1px solid var(--accent-color);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(31, 42, 68, 0.06);
}
.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; align-items: end; }
.filters-card {
  background: var(--background-color);
  border: 1px solid var(--accent-color);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
}
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}
.filters-grid button {
  width: 100%;
}
label, .field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-weight: 600;
  color: var(--primary-color);
}
.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  min-height: 42px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--accent-color);
  border-radius: 6px;
  background: #fff;
}
input, select, button {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--accent-color);
  font-size: 14px;
}
input, select {
  width: 100%;
  background: #fff;
  color: var(--text-color);
}
.multi-select {
  height: 140px;
  overflow: auto;
}
button {
  background: var(--primary-color);
  color: #fff;
  border: none;
  cursor: pointer;
  min-height: 42px;
  font-weight: 600;
}
button:hover { background: var(--secondary-color); }
button:disabled {
  background: #b5bcc8;
  cursor: not-allowed;
}

.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { border: 1px solid var(--accent-color); padding: 10px; text-align: left; vertical-align: middle; }
.table th { background: var(--accent-color); color: var(--primary-color); }
.table-wrap {
  width: 100%;
  overflow-x: auto;
}
.leave-table {
  min-width: 1080px;
}
.bonus-table {
  min-width: 1120px;
}
.events-table {
  min-width: 1120px;
}
.photo-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--accent-color);
  background: var(--background-color);
}
.profile-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.profile-photo {
  width: 56px;
  height: 56px;
}
.profile-title {
  font-weight: 700;
  color: var(--primary-color);
}
.profile-subtitle {
  color: var(--secondary-color);
  font-weight: 600;
}
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.action-link { color: var(--secondary-color); cursor: pointer; margin-right: 8px; }
.download-link {
  color: var(--secondary-color);
  text-decoration: none;
  font-weight: 600;
}
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status-badge.pending {
  background: #eef0f5;
  color: var(--primary-color);
}
.status-badge.approved {
  background: #d9f1ed;
  color: var(--secondary-color);
}
.status-badge.rejected {
  background: #fde2e2;
  color: #9f2b2b;
}
.status-text {
  margin: 0 0 12px;
  color: var(--secondary-color);
}
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  min-height: 430px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 28px;
}
.auth-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.auth-logo {
  width: 90px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}
.auth-content {
  width: 100%;
}
.auth-title {
  text-align: center;
  margin-bottom: 22px;
}
.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.auth-switch-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--accent-color);
  border-radius: 6px;
  text-decoration: none;
  color: var(--primary-color);
  background: #fff;
  font-weight: 600;
}
.auth-switch-btn:hover,
.auth-switch-btn.active {
  background: var(--primary-color);
  color: #fff;
}
.auth-form {
  display: grid;
  gap: 14px;
}
.auth-form button {
  width: 100%;
}
.auth-message {
  min-height: 24px;
  margin: 14px 0 0;
  text-align: center;
  color: var(--secondary-color);
}
.auth-form input {
  min-height: 44px;
}
.hidden { display: none; }

.site-footer {
  text-align: center;
  font-size: 12px;
  color: #8f8f8f;
  padding: 14px 8px;
}

/* Modal styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  z-index: 1000;
  display: none;
}
.modal-overlay.open {
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background-color: #fff;
  margin: auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 600px;
  border-radius: 8px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.modal-title {
  font-size: 1.5em;
  font-weight: bold;
}
.modal-close {
  background: var(--secondary-color);
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
}
.modal-body {
  max-height: 400px;
  overflow-y: auto;
}
.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}
.close:hover { color: #000; }
.history-timeline {
  max-height: 400px;
  overflow-y: auto;
}
.history-item {
  margin-bottom: 10px;
  padding: 10px;
  border-left: 4px solid var(--secondary-color);
  background: var(--background-color);
}

/* Table pagination (admin + manager heavy lists) */
.table-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.table-pagination .pagination-info {
  font-weight: 700;
  color: var(--secondary-color);
  margin-right: 8px;
}
.table-pagination button {
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}
.table-pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
