/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 13px; background: #f0f2f5; color: #222; height: 100%; overflow: hidden; position: fixed; width: 100%; }
html { height: 100dvh; overflow: hidden; }
#app { display: flex; flex-direction: column; height: 100dvh; }

/* The app shell is viewport-locked; scrolling belongs to the active view. */
#schedule-view {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#dashboard-view {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* Login */
.login-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.login-box {
  background: #fff; border-radius: 10px; padding: 32px 28px; width: 320px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.login-box h2 { text-align: center; font-size: 20px; margin-bottom: 4px; }
.login-box input {
  border: 1px solid #ccc; border-radius: 6px; padding: 9px 12px; font-size: 14px; outline: none;
}
.login-box input:focus { border-color: #4a90e2; }
.login-box button {
  background: #4a90e2; color: #fff; border: none; border-radius: 6px;
  padding: 10px; font-size: 14px; cursor: pointer; font-weight: 600;
}
.login-box button:hover { background: #357abd; }
.login-error { color: #e53935; font-size: 12px; text-align: center; min-height: 16px; }

/* Header */
.header {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; padding: 8px 14px; border-bottom: 1px solid #dde1e7;
  position: sticky; top: 0; z-index: 100; gap: 10px; flex-wrap: wrap;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.header-search { flex: 1; min-width: 120px; max-width: 220px; }
.header-search input {
  width: 100%; border: 1px solid #dde1e7; border-radius: 6px;
  padding: 5px 10px; font-size: 13px; outline: none; background: #f5f7fa;
}
.header-search input:focus { border-color: #4a90e2; background: #fff; }
.header-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.header h1 { font-size: 15px; font-weight: 700; min-width: 140px; text-align: center; }
.nav-btn {
  background: none; border: 1px solid #ccc; border-radius: 5px;
  padding: 3px 10px; cursor: pointer; font-size: 16px; color: #555;
}
.nav-btn:hover { background: #f0f2f5; }

.online-badge {
  font-size: 12px; padding: 3px 8px; background: #e8f5e9;
  border-radius: 12px; color: #2e7d32; white-space: nowrap;
}

button.btn-add, button.btn-settings, button.btn-export, button.btn-import, button.btn-logout {
  border: 1px solid #ccc; border-radius: 6px; padding: 5px 10px;
  cursor: pointer; font-size: 12px; background: #fff; color: #333;
}
button.btn-add { background: #4a90e2; color: #fff; border-color: #4a90e2; }
button.btn-add:hover { background: #357abd; }
button.btn-logout { color: #e53935; border-color: #e53935; }
button.btn-logout:hover { background: #ffebee; }
button.btn-settings:hover, button.btn-export:hover, button.btn-import:hover { background: #f0f2f5; }

/* Table */
.schedule-container { overflow: auto; -webkit-overflow-scrolling: touch; flex: 1; min-height: 0; padding: 0 8px 4px; padding-bottom: max(4px, env(safe-area-inset-bottom)); }
.schedule-table { border-collapse: collapse; width: 100%; min-width: 600px; background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }

.schedule-table th, .schedule-table td {
  border: 1px solid #e0e3e8; padding: 5px 6px; text-align: center; white-space: nowrap;
}
.schedule-table thead th {
  background: #f5f7fa; font-weight: 600; font-size: 12px;
  position: -webkit-sticky; position: sticky; top: 0; z-index: 6;
  box-shadow: 0 2px 4px rgba(0,0,0,.08);
  padding: 6px 4px; line-height: 1.3;
}
.schedule-table thead th.col-name {
  text-align: left; min-width: 130px;
  position: -webkit-sticky; position: sticky; left: 0; top: 0;
  z-index: 11; background: #f5f7fa;
}
.schedule-table thead th.col-total { min-width: 50px; }

.schedule-table tbody td.col-name {
  text-align: left; font-weight: 500; cursor: pointer; position: -webkit-sticky; position: sticky; left: 0;
  background: #fff; z-index: 5;
}
.schedule-table tbody td.col-name .emp-name-text { cursor: pointer; }
.schedule-table tbody td.col-name .emp-name-text:hover { text-decoration: underline; }
.emp-vacation-btn {
  margin-left: 5px; background: none; border: none; cursor: pointer;
  font-size: 12px; opacity: 0; padding: 0 2px; border-radius: 3px;
  vertical-align: middle; transition: opacity .15s;
}
.schedule-table tbody tr:hover .emp-vacation-btn { opacity: 0.6; }
.emp-vacation-btn:hover { opacity: 1 !important; background: #fff9c4; }

.schedule-table tbody tr:hover td { filter: brightness(0.96); }

/* Day cells */
td.day-cell {
  cursor: pointer; min-width: 70px; max-width: 80px; font-size: 11px;
  transition: background .12s; touch-action: manipulation;
}
td.day-cell:hover { background: #e3f2fd !important; }
td.day-cell.weekend { background: #fce4ec; }
td.day-cell.off { background: #a5d6a7; color: #1b5e20; font-weight: 700; }
td.day-cell.comp-off { background: #ffe082; color: #795548; font-weight: 700; }
td.day-cell.vacation { background: #fff9c4; color: #f57f17; font-weight: 700; }
td.day-cell.sick { background: #ffebee; color: #c62828; font-weight: 700; }
td.day-cell.shift-late { background: #e0e0e0; color: #555; }
td.day-cell.vacation:hover { background: #fff176 !important; }
td.day-cell.sick:hover { background: #ffcdd2 !important; }
td.day-cell .cell-shift { font-weight: 600; font-size: 12px; }
td.day-cell .cell-lunch { font-size: 10px; color: #888; }

td.col-total { font-weight: 700; font-size: 12px; background: #f9fbe7; }

/* Summary bar */
.summary-bar {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 14px;
  background: #fff; border-top: 1px solid #e0e3e8; font-size: 12px; color: #555;
}
.summary-item { background: #f0f2f5; border-radius: 5px; padding: 4px 10px; }
.summary-item strong { color: #222; }

/* Modals */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 40px 16px;
  z-index: 500;
}
.modal-box {
  background: #fff; border-radius: 10px; padding: 24px 22px; width: 320px;
  display: flex; flex-direction: column; gap: 14px; box-shadow: 0 8px 32px rgba(0,0,0,.18);
  margin: auto;
}
.modal-box h3 { font-size: 16px; font-weight: 700; }
.modal-box label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #555; }
.modal-box input[type=text], .modal-box input[type=number] {
  border: 1px solid #ccc; border-radius: 6px; padding: 8px 10px; font-size: 13px; outline: none;
}
.modal-box input:focus { border-color: #4a90e2; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* Cell popup */
.cell-popup {
  position: fixed; background: #fff; border: 1px solid #dde1e7; border-radius: 10px;
  padding: 8px; box-shadow: 0 4px 20px rgba(0,0,0,.18); z-index: 300;
}
.cell-popup-shifts { display: flex; flex-direction: column; gap: 4px; }
.shift-btn {
  background: #f5f7fa; border: 1px solid #e0e3e8; border-radius: 7px;
  padding: 8px 18px; font-size: 13px; font-weight: 500; cursor: pointer;
  text-align: left; transition: background .1s;
}
.shift-btn:hover { background: #e3f2fd; border-color: #90caf9; }
.shift-btn.active { background: #1976d2; color: #fff; border-color: #1976d2; }
.shift-btn-off { color: #888; }
.shift-btn-off:hover { background: #f5f5f5; border-color: #bbb; color: #555; }
.shift-btn-off.active { background: #757575; border-color: #757575; color: #fff; }
.shift-btn-clear { color: #e53935; border-color: transparent; background: none; font-size: 12px; text-align: center; }
.shift-btn-clear:hover { background: #ffebee; border-color: #ef9a9a; }
.shift-btn-vacation { color: #f57f17; }
.shift-btn-vacation:hover { background: #fff9c4; border-color: #ffe082; }
.shift-btn-vacation.active { background: #f9a825; color: #fff; border-color: #f9a825; }
.shift-btn-vacation-action { color: #f57f17; }
.shift-btn-sick { color: #c62828; }
.shift-btn-sick:hover { background: #ffebee; border-color: #ef9a9a; }
.shift-btn-sick.active { background: #d32f2f; color: #fff; border-color: #d32f2f; }

/* Buttons */
.btn-primary { background: #4a90e2; color: #fff; border: none; border-radius: 6px; padding: 8px 16px; cursor: pointer; font-size: 13px; font-weight: 600; }
.btn-primary:hover { background: #357abd; }
.btn-secondary { background: #f0f2f5; color: #333; border: 1px solid #ccc; border-radius: 6px; padding: 8px 14px; cursor: pointer; font-size: 13px; }
.btn-secondary:hover { background: #e0e3e8; }
.btn-danger { background: #e53935; color: #fff; border: none; border-radius: 6px; padding: 8px 14px; cursor: pointer; font-size: 13px; }
.btn-danger:hover { background: #c62828; }

/* Users modal */
button.btn-users { background: #7b1fa2; color: #fff; border-color: #7b1fa2; }
button.btn-users:hover { background: #6a1b9a; }

/* Audit button */
button.btn-audit { background: #fff; color: #e65100; border: 1px solid #e65100; border-radius: 6px; padding: 5px 10px; cursor: pointer; font-size: 12px; }
button.btn-audit:hover { background: #fff3e0; }

/* Copy week button */
button.btn-copy-week { background: #fff; color: #00695c; border: 1px solid #00695c; border-radius: 6px; padding: 5px 10px; cursor: pointer; font-size: 12px; }
button.btn-copy-week:hover { background: #e0f2f1; }

/* Undo button */
button.btn-undo { background: #fff; color: #5c35b5; border: 1px solid #5c35b5; border-radius: 6px; padding: 5px 10px; cursor: pointer; font-size: 12px; }
button.btn-undo:hover { background: #ede7f6; }

/* Clear week button */
button.btn-clear-week { background: #fff; color: #bf360c; border: 1px solid #bf360c; border-radius: 6px; padding: 5px 10px; cursor: pointer; font-size: 12px; }
button.btn-clear-week:hover { background: #fbe9e7; }
.copy-week-target-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 5px 8px; border-radius: 6px; background: #f5f7fa; cursor: pointer; }
.copy-week-target-row:hover { background: #e0f2f1; }
.copy-week-target-row input { cursor: pointer; }

/* Audit log */
.audit-list { display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow-y: auto; }
.audit-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 10px; border-radius: 6px; background: #f5f7fa; font-size: 12px;
}
.audit-row:nth-child(even) { background: #fff; }
.audit-time { color: #999; white-space: nowrap; min-width: 120px; }
.audit-user { font-weight: 700; color: #1976d2; min-width: 80px; }
.audit-action { color: #555; }

.users-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.user-row {
  display: flex; align-items: center; justify-content: space-between;
  background: #f5f7fa; border-radius: 6px; padding: 7px 10px; font-size: 13px;
}
.user-row .user-info { display: flex; align-items: center; gap: 8px; }
.user-badge-admin  { font-size: 10px; background: #7b1fa2; color: #fff; border-radius: 4px; padding: 1px 6px; }
.user-badge-editor { font-size: 10px; background: #1976d2; color: #fff; border-radius: 4px; padding: 1px 6px; }
.user-badge-viewer { font-size: 10px; background: #546e7a; color: #fff; border-radius: 4px; padding: 1px 6px; }
.role-select { font-size: 11px; border: 1px solid #ccc; border-radius: 4px; padding: 2px 4px; background: #fff; cursor: pointer; }
.user-row-actions { display: flex; gap: 6px; }
.btn-icon { background: none; border: 1px solid #ccc; border-radius: 5px; padding: 3px 8px; cursor: pointer; font-size: 12px; }
.btn-icon:hover { background: #f0f2f5; }
.btn-icon.danger { color: #e53935; border-color: #e53935; }
.btn-icon.danger:hover { background: #ffebee; }

/* Weekend column header highlight */
th.weekend-header { color: #c62828; }

/* Today column */
.schedule-table thead th.today-col {
  background: #1565c0 !important; color: #fff !important;
}
.schedule-table thead th.today-col span { color: #fff !important; }
.schedule-table tbody td.today-col { background-color: rgba(21, 101, 192, 0.06); }
.schedule-table tbody td.today-col.weekend { background-color: rgba(21, 101, 192, 0.1); }
.schedule-table tbody td.today-col.off { background-color: #a5d6a7; }
.schedule-table tbody td.today-col.vacation { background-color: #fff9c4; }

/* Color palette */
.color-palette {
  display: flex; flex-wrap: wrap; gap: 5px; padding: 4px 0;
}
.color-swatch {
  width: 26px; height: 26px; border-radius: 5px; border: 2px solid #ccc;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform .1s, border-color .1s;
}
.color-swatch:hover { transform: scale(1.15); border-color: #888; }
.color-swatch.active { border-color: #1976d2; border-width: 2px; box-shadow: 0 0 0 2px #90caf9; }

/* Day filter */
.schedule-table thead th[data-day] { cursor: pointer; }
.schedule-table thead th[data-day]:hover { background: #e3f2fd; }
.schedule-table thead th.day-filter-active { background: #1976d2 !important; color: #fff; }
.schedule-table thead th.day-filter-active span { color: #fff; }
.filter-clear { cursor: pointer; font-size: 10px; color: #e53935; margin-left: 4px; }
.filter-clear:hover { text-decoration: underline; }

/* Drag and drop rows */
.schedule-table tbody tr.dragging { opacity: 0.4; }
.schedule-table tbody tr.drag-over td { border-top: 2px solid #4a90e2; }

/* Day filter summary bar */
#day-filter-summary {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 14px; background: #e3f2fd; border-bottom: 1px solid #90caf9;
  font-size: 13px; color: #1565c0;
}
.summary-date { font-weight: 700; margin-right: 4px; }
.summary-chip {
  background: #fff; border: 1px solid #90caf9; border-radius: 12px;
  padding: 2px 10px; font-size: 12px; color: #1976d2;
}
.summary-chip strong { color: #0d47a1; }

/* Section header row */
.schedule-table tbody tr.section-header-row td {
  background: #37474f; color: #fff; padding: 5px 12px;
  text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; cursor: default; border: none;
}
.section-header-name { vertical-align: middle; }
.section-header-count { margin-left: 8px; font-weight: 400; font-size: 11px; opacity: .7; vertical-align: middle; }

/* Group header row */
.schedule-table tbody tr.group-header-row td {
  background: #f0f2f5; padding: 3px 10px; border-top: 2px solid #dde1e7;
  text-align: left; font-size: 11px; color: #666; cursor: default;
}
.group-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle; border: 1px solid rgba(0,0,0,.12);
}
.group-header-count { vertical-align: middle; font-weight: 500; }
.group-disband-btn {
  margin-left: 10px; background: none; border: none; cursor: pointer;
  font-size: 11px; color: #bbb; padding: 0 3px; vertical-align: middle;
  border-radius: 3px;
}
.group-disband-btn:hover { color: #e53935; background: #ffebee; }

/* Grouping mode */
button.btn-group {
  border: 1px solid #00897b; border-radius: 6px; padding: 5px 10px;
  cursor: pointer; font-size: 12px; background: #fff; color: #00897b;
}
button.btn-group:hover, button.btn-group.active { background: #00897b; color: #fff; }

button.btn-group-action {
  background: #1976d2; color: #fff; border: none; border-radius: 6px;
  padding: 5px 10px; cursor: pointer; font-size: 12px; font-weight: 600;
}
button.btn-group-action:hover { background: #1565c0; }

.schedule-table tbody tr.grouping-mode td { cursor: pointer; }
.schedule-table tbody tr.grouping-mode:hover td { filter: brightness(0.93); }
.schedule-table tbody tr.group-selected td {
  outline: 2px solid #1976d2; outline-offset: -1px;
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
  /* Header: 2 rows — row1: nav+buttons, row2: search */
  .header {
    padding: 6px 8px; gap: 4px; align-items: center;
  }
  .header-left { order: 1; flex: 1; }
  .header-right { order: 2; flex-wrap: nowrap; gap: 4px; }
  .header-search { order: 3; flex: 0 0 100%; max-width: 100%; min-width: 0; }

  /* Hide text labels — show only icons/symbols */
  .btn-label { display: none; }

  /* Hide grouping on mobile (desktop-only feature) */
  button.btn-group { display: none !important; }

  .header h1 { font-size: 13px; min-width: 100px; }
  .nav-btn { padding: 2px 7px; font-size: 14px; }

  button.btn-add, button.btn-export, button.btn-import,
  button.btn-logout, button.btn-users, button.btn-audit,
  button.btn-copy-week, button.btn-group-action, button.btn-danger {
    padding: 5px 9px; font-size: 14px;
  }

  /* Prevent iOS auto-zoom on input focus (requires font-size >= 16px) */
  input, select, textarea { font-size: 16px !important; }

  .header-search input { padding: 5px 10px; }
  .schedule-container { padding: 0 2px 4px; }

  .schedule-table thead th {
    font-size: 11px; padding: 4px 2px;
  }
  .schedule-table thead th.col-name { min-width: 90px; }
  .schedule-table th, .schedule-table td { padding: 4px 3px; }

  td.day-cell { min-width: 62px; max-width: 70px; font-size: 10px; overflow: hidden; }
  td.day-cell .cell-shift { font-size: 10px; white-space: nowrap; }

  .schedule-table tbody td.col-name { font-size: 11px; }
  .emp-vacation-btn { font-size: 11px; }

  .modal-box {
    width: 94vw !important; max-height: 90vh; overflow-y: auto;
    padding: 16px 14px;
  }

  .cell-popup { max-width: 92vw; }
  .shift-btn { padding: 9px 12px; font-size: 12px; }

  #day-filter-summary { padding: 5px 8px; font-size: 12px; }

  .online-badge { font-size: 11px; padding: 2px 6px; }
}

/* ---- Spreadsheet final pass: calm and dense ---- */
:root {
  --ui-bg: #f5f7fa;
  --ui-surface: #ffffff;
  --ui-surface-2: #f8fafc;
  --ui-border: #e4e7ec;
  --ui-border-strong: #cfd6df;
  --ui-text: #1f2937;
  --ui-muted: #667085;
  --ui-blue: #2f80ed;
  --ui-blue-soft: #eaf3ff;
  --ui-green: #dff4e5;
  --ui-green-text: #236a35;
  --ui-yellow: #fff2c4;
  --ui-yellow-text: #805800;
  --ui-gray-cell: #eef1f5;
  --ui-weekend: #fbf0f3;
  --ui-danger: #c9342b;
}

html,
body {
  background: var(--ui-bg);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ui-text);
}

.header {
  background: var(--ui-surface);
  border-bottom: 1px solid var(--ui-border);
  box-shadow: 0 1px 4px rgba(16, 24, 40, .05);
  padding: 7px 12px;
  gap: 8px;
}

.header-left {
  gap: 6px;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.header h1 {
  min-width: 148px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ui-text);
}

.nav-btn {
  height: 28px;
  min-width: 30px;
  padding: 0 8px;
  border: 1px solid var(--ui-border-strong);
  border-radius: 6px;
  background: #fff;
  color: #475467;
  font-size: 16px;
  font-weight: 700;
}

.nav-btn:hover {
  background: #f2f4f7;
}

.header-search {
  max-width: 260px;
}

.header-search input {
  height: 30px;
  border: 1px solid var(--ui-border);
  border-radius: 7px;
  background: #f8fafc;
  padding: 5px 10px;
  color: var(--ui-text);
}

.header-search input:focus {
  background: #fff;
  border-color: #98c5ff;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, .12);
}

.header-right {
  gap: 5px;
}

.header-right button,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-icon,
.login-box button {
  min-height: 30px;
  border-radius: 7px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  box-shadow: none !important;
  transform: none !important;
}

button.btn-add,
.btn-primary,
.login-box button,
button.btn-group-action {
  background: var(--ui-blue) !important;
  border-color: var(--ui-blue) !important;
  color: #fff !important;
}

button.btn-add:hover,
.btn-primary:hover,
.login-box button:hover,
button.btn-group-action:hover {
  background: #1f6fd1 !important;
}

button.btn-export,
button.btn-import,
button.btn-copy-week,
button.btn-group,
button.btn-undo,
button.btn-audit,
button.btn-users,
button.btn-logout {
  background: #fff !important;
  border: 1px solid var(--ui-border-strong) !important;
  color: #344054 !important;
}

button.btn-export:hover,
button.btn-import:hover,
button.btn-copy-week:hover,
button.btn-group:hover,
button.btn-group.active,
button.btn-undo:hover,
button.btn-audit:hover,
button.btn-users:hover {
  background: #f2f4f7 !important;
  color: var(--ui-text) !important;
}

button.btn-danger,
button.btn-clear-week,
#clear-schedule-btn {
  background: #fff !important;
  border: 1px solid #e7aaa6 !important;
  color: var(--ui-danger) !important;
}

button.btn-danger:hover,
button.btn-clear-week:hover,
#clear-schedule-btn:hover {
  background: #fff4f3 !important;
}

.online-badge {
  background: #ecfdf3 !important;
  border: 1px solid #c7eed8 !important;
  color: #237a3b !important;
  border-radius: 999px !important;
  padding: 4px 8px !important;
  font-weight: 650 !important;
}

.schedule-container {
  padding: 8px 8px 6px !important;
}

.schedule-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: 100%;
  min-width: 720px;
  background: #fff !important;
  border: 1px solid var(--ui-border) !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 8px rgba(16, 24, 40, .06) !important;
  overflow: visible;
}

.schedule-table th,
.schedule-table td {
  border: 0 !important;
  border-right: 1px solid var(--ui-border) !important;
  border-bottom: 1px solid var(--ui-border) !important;
  padding: 4px 6px !important;
  white-space: nowrap;
}

.schedule-table thead th {
  height: 34px;
  background: #f8fafc !important;
  color: #475467 !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1.25;
  text-transform: none !important;
  letter-spacing: 0 !important;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .06) !important;
}

.schedule-table thead th.col-name {
  min-width: 165px !important;
  max-width: 165px;
  background: #f8fafc !important;
  color: var(--ui-text) !important;
  border-right: 1px solid var(--ui-border-strong) !important;
}

.schedule-table tbody td.col-name {
  min-width: 165px !important;
  max-width: 165px;
  background: #fff !important;
  border-right: 1px solid var(--ui-border-strong) !important;
  box-shadow: 3px 0 8px rgba(16, 24, 40, .035) !important;
  color: var(--ui-text) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
}

.schedule-table tbody td.col-name .emp-name-text {
  display: inline-block;
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.schedule-table tbody td.col-name .emp-name-text:hover {
  color: #1f6fd1 !important;
  text-decoration: underline !important;
}

.schedule-table tbody tr:hover td {
  filter: none !important;
}

.schedule-table tbody tr:hover td.day-cell:not(.off):not(.vacation):not(.shift-late):not(.weekend) {
  background: #f8fbff !important;
}

td.day-cell {
  min-width: 70px !important;
  max-width: 76px !important;
  height: 31px !important;
  background: #fff !important;
  color: var(--ui-text) !important;
  font-size: 11px !important;
  text-align: center !important;
}

td.day-cell:hover {
  background: #eef6ff !important;
  outline: 1px solid rgba(47, 128, 237, .45) !important;
  outline-offset: -1px;
}

td.day-cell.weekend {
  background: var(--ui-weekend) !important;
}

td.day-cell.off {
  background: var(--ui-green) !important;
  color: var(--ui-green-text) !important;
  font-weight: 700 !important;
}

td.day-cell.vacation {
  background: var(--ui-yellow) !important;
  color: var(--ui-yellow-text) !important;
  font-weight: 700 !important;
}

td.day-cell.sick {
  background: #ffebee !important;
  color: #b42318 !important;
  font-weight: 700 !important;
}

td.day-cell.shift-late {
  background: var(--ui-gray-cell) !important;
  color: #4b5563 !important;
}

td.day-cell .cell-shift {
  display: inline !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: inherit !important;
  font-size: 12px !important;
  font-weight: 650 !important;
}

.schedule-table thead th.today-col {
  background: #dcecff !important;
  color: #0f4e9c !important;
  box-shadow: inset 0 -2px 0 var(--ui-blue) !important;
}

.schedule-table thead th.today-col span {
  color: #0f4e9c !important;
}

.schedule-table tbody td.today-col {
  box-shadow: inset 2px 0 0 rgba(47, 128, 237, .55), inset -2px 0 0 rgba(47, 128, 237, .55) !important;
}

.schedule-table tbody td.today-col:not(.off):not(.vacation):not(.sick):not(.shift-late) {
  background-color: #f1f7ff !important;
}

.schedule-table tbody td.today-col.weekend {
  background-color: #f2e6ec !important;
}

th.weekend-header {
  color: #b42318 !important;
}

.schedule-table thead th[data-day]:hover,
.schedule-table thead th.day-filter-active {
  background: #dcecff !important;
  color: #0f4e9c !important;
}

.schedule-table thead th.day-filter-active span,
.schedule-table thead th[data-day]:hover span {
  color: #0f4e9c !important;
}

#day-filter-summary {
  margin: 6px 8px 0 !important;
  padding: 6px 10px !important;
  border: 1px solid #bfdbfe !important;
  border-radius: 8px !important;
  background: #eff6ff !important;
  color: #1d4f91 !important;
  box-shadow: none !important;
}

.summary-chip {
  border-color: #bfdbfe !important;
  color: #1d4f91 !important;
}

.summary-chip strong {
  color: #0f4e9c !important;
}

.schedule-table tbody tr.section-header-row td {
  background: #eef2f6 !important;
  color: #475467 !important;
  border-top: 1px solid var(--ui-border-strong) !important;
  border-bottom: 1px solid var(--ui-border-strong) !important;
  border-left: 3px solid #98a2b3 !important;
  padding: 5px 10px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: .02em !important;
  text-transform: none !important;
}

.section-header-count {
  margin-left: 7px !important;
  padding: 1px 6px !important;
  border-radius: 999px !important;
  background: #fff !important;
  color: #667085 !important;
  opacity: 1 !important;
}

.schedule-table tbody tr.group-header-row td {
  background: #f8fafc !important;
  color: #667085 !important;
  border-top: 1px solid var(--ui-border) !important;
  padding: 3px 9px !important;
}

.group-disband-btn:hover {
  background: #fff1f0 !important;
  color: var(--ui-danger) !important;
}

.emp-vacation-btn {
  background: transparent !important;
  color: #8a5a00 !important;
}

.schedule-table tbody tr:hover .emp-vacation-btn {
  opacity: .65 !important;
}

.emp-vacation-btn:hover {
  background: var(--ui-yellow) !important;
}

.cell-popup {
  border-radius: 10px !important;
  border: 1px solid var(--ui-border) !important;
  box-shadow: 0 8px 28px rgba(16, 24, 40, .16) !important;
}

.shift-btn {
  border-radius: 7px !important;
  background: #f8fafc !important;
  color: #344054 !important;
}

.shift-btn.active {
  background: var(--ui-blue) !important;
  border-color: var(--ui-blue) !important;
  color: #fff !important;
}

.shift-btn-off.active {
  background: #667085 !important;
  border-color: #667085 !important;
}

.shift-btn-vacation.active {
  background: #c48a10 !important;
  border-color: #c48a10 !important;
}

.modal-box,
.login-box {
  border-radius: 12px !important;
  box-shadow: 0 12px 34px rgba(16, 24, 40, .14) !important;
}

.audit-row,
.user-row,
.copy-week-target-row {
  background: #f8fafc !important;
  border: 0 !important;
  border-radius: 7px !important;
}

.audit-row:nth-child(even) {
  background: #fff !important;
}

@media (max-width: 768px) {
  .header {
    padding: 6px 8px !important;
  }

  .header h1 {
    min-width: 100px !important;
    font-size: 13px !important;
  }

  .schedule-container {
    padding: 6px 2px 4px !important;
  }

  .schedule-table {
    min-width: 620px;
  }

  .schedule-table thead th.col-name,
  .schedule-table tbody td.col-name {
    min-width: 96px !important;
    max-width: 96px !important;
  }

  .schedule-table tbody td.col-name .emp-name-text {
    max-width: 76px;
  }

  td.day-cell {
    min-width: 62px !important;
    max-width: 68px !important;
    height: 30px !important;
  }

  td.day-cell .cell-shift {
    font-size: 10px !important;
  }
}

/* Admin Jira dashboard */
button.btn-dashboard { background: #0f766e; color: #fff; border-color: #0f766e; }
button.btn-dashboard:hover, button.btn-dashboard.active { background: #115e59; }
.dashboard-view { padding: 24px; max-width: 1280px; margin: 0 auto; }
.dashboard-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.dashboard-heading h2 { margin: 0; font-size: 22px; }
.dashboard-heading p { margin: 5px 0 0; color: #667085; font-size: 13px; }
.dashboard-actions { display: flex; gap: 8px; }
.dashboard-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dashboard-card { background: #fff; border: 1px solid #d0d5dd; border-radius: 12px; padding: 18px; box-shadow: 0 1px 3px rgba(16, 24, 40, .08); }
.dashboard-chart-card { grid-column: 1 / -1; }
.dashboard-card h3 { margin: 0; color: #344054; font-size: 15px; }
.dashboard-chart-subtitle { margin: 4px 0 12px; color: #667085; font-size: 12px; }
.dashboard-bar-chart { display: flex; align-items: end; gap: 5px; height: 168px; margin: 0; padding: 0; list-style: none; overflow-x: auto; }
.dashboard-bar-item { display: grid; grid-template-rows: 18px 1fr 18px; align-items: end; min-width: 25px; height: 100%; text-align: center; }
.dashboard-bar-value, .dashboard-bar-label { color: #667085; font-size: 10px; font-variant-numeric: tabular-nums; }
.dashboard-bar { display: block; width: 100%; min-height: 4px; background: #0f766e; border-radius: 4px 4px 0 0; }
.dashboard-bar-item:nth-child(7n) .dashboard-bar { background: #0e7490; }
.dashboard-issues-card { grid-column: 1 / -1; }
.dashboard-table-scroll { overflow: auto; max-height: 560px; border: 1px solid #eaecf0; border-radius: 8px; }
.dashboard-issues-table { min-width: 1120px; }
.dashboard-issues-table thead { position: sticky; top: 0; background: #fff; z-index: 1; }
.dashboard-issues-table a { color: #0f766e; font-weight: 700; text-decoration: none; }
.dashboard-issues-table a:hover { text-decoration: underline; }
.dashboard-address { min-width: 280px; max-width: 520px; white-space: normal; }
.dashboard-total { margin-top: 12px; color: #0f766e; font-size: 34px; font-weight: 700; line-height: 1; }
.dashboard-total-label { margin: 4px 0 14px; color: #667085; font-size: 12px; }
.dashboard-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dashboard-table th, .dashboard-table td { padding: 8px 4px; border-top: 1px solid #eaecf0; text-align: left; }
.dashboard-table th:last-child, .dashboard-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.dashboard-table th { color: #667085; font-size: 11px; text-transform: uppercase; }
@media (max-width: 768px) {
  .dashboard-view { padding: 14px 10px; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; }
  .dashboard-cards { grid-template-columns: 1fr; }
}
