:root {
  --sidebar-bg: #111827;
  --sidebar-bg2: #1f2937;
  --sidebar-text: #9ca3af;
  --brand-color: #6366f1;
  --brand-dark: #4f46e5;
  --brand-light: rgba(99,102,241,0.12);
  --sidebar-hover: rgba(99,102,241,0.12);
  --main-bg: #f1f5f9;
  --card-bg: #ffffff;
  --card-radius: 18px;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.06);
  --card-shadow-lg: 0 4px 6px rgba(0,0,0,0.05), 0 10px 40px rgba(0,0,0,0.1);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --sidebar-width: 250px;
  --green: #10b981;
  --green-light: rgba(16,185,129,0.12);
  --red: #ef4444;
  --red-light: rgba(239,68,68,0.1);
  --header-height: 62px;
  --bottom-nav-height: 68px;
  --border-color: #e2e8f0;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  background: var(--main-bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* =====================
   MOBILE LAYOUT
   ===================== */
.ts-body { display: block; min-height: 100vh; padding-bottom: var(--bottom-nav-height); }

/* Top header */
.ts-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-height);
  background: var(--sidebar-bg);
  z-index: 200;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.05);
}
.ts-header-logo { height: 28px; filter: brightness(0) invert(1); }
.ts-header-brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.ts-header-brand i { font-size: 1.5rem; color: #818cf8; }
.ts-header-brand-name { font-size: 0.95rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; }
.ts-header-brand-sub { font-size: 0.55rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.55; }
.ts-header-user {
  display: flex; align-items: center; gap: 7px;
  color: rgba(255,255,255,0.6); font-size: 0.82rem;
}
.ts-header-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-color);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: #fff;
}

/* Bottom nav */
.ts-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--bottom-nav-height);
  background: var(--sidebar-bg);
  z-index: 200;
  display: flex; align-items: stretch;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ts-bottom-nav::-webkit-scrollbar { display: none; }
.ts-bottom-nav-item {
  flex: 1 1 0; min-width: 64px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; text-decoration: none; color: var(--sidebar-text);
  font-size: 0.65rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  transition: color 0.15s; padding: 8px 10px;
  border: none; background: none; cursor: pointer; position: relative;
  text-align: center;
}
.ts-bottom-nav-item span { text-align: center; line-height: 1.2; }
.ts-bottom-nav-scroll .ts-bottom-nav-item {
  flex: 0 0 auto; min-width: 76px; padding: 8px 14px; white-space: nowrap;
}
.ts-bottom-nav-item i { font-size: 1.25rem; transition: transform 0.15s; }
.ts-bottom-nav-item:hover i { transform: translateY(-1px); }
.ts-bottom-nav-item.active { color: #fff; }
.ts-bottom-nav-item.active i { color: var(--brand-color); }
.ts-bottom-nav-item.active::before {
  content: ''; position: absolute; top: 0; left: 25%; right: 25%;
  height: 2px; background: var(--brand-color); border-radius: 0 0 4px 4px;
}

/* Sidebar hidden on mobile */
.ts-sidebar { display: none; }

/* Main content */
.ts-main { padding-top: calc(var(--header-height) + 18px); }
.ts-content { padding: 0 16px 24px; }

/* =====================
   DESKTOP (>= 992px)
   ===================== */
@media (min-width: 992px) {
  .ts-body { display: flex; padding-bottom: 0; }
  .ts-header { display: none; }
  .ts-bottom-nav { display: none; }

  .ts-sidebar {
    display: flex; flex-direction: column;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%);
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    box-shadow: 1px 0 0 rgba(255,255,255,0.04);
  }
  .ts-sidebar-brand {
    display: flex; align-items: center; justify-content: center;
    padding: 28px 24px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .ts-sidebar-logo { width: 155px; filter: brightness(0) invert(1); opacity: 0.9; }

  .ts-nav { flex: 1; padding: 16px 10px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent; }
  .ts-nav::-webkit-scrollbar { width: 4px; }
  .ts-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
  .ts-nav-section { font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.1em; color: rgba(255,255,255,0.25); padding: 12px 12px 6px; }
  .ts-nav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 14px; border-radius: 10px; margin-bottom: 2px;
    color: var(--sidebar-text); text-decoration: none;
    font-size: 0.9rem; font-weight: 500; transition: all 0.15s;
  }
  .ts-nav-link:hover { color: #fff; background: var(--sidebar-hover); }
  .ts-nav-link.active { color: #fff; background: var(--brand-color); }
  .ts-nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }

  .ts-sidebar-footer {
    padding: 14px 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
  }
  .ts-sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px; margin-bottom: 4px;
  }
  .ts-sidebar-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--brand-color);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem; font-weight: 700; color: #fff; flex-shrink: 0;
  }
  .ts-sidebar-user-name { color: #fff; font-size: 0.85rem; font-weight: 500; }
  .ts-logout-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 10px;
    color: var(--sidebar-text); text-decoration: none;
    font-size: 0.87rem; transition: all 0.15s;
  }
  .ts-logout-btn:hover { color: #fca5a5; background: rgba(239,68,68,0.08); }
  .ts-logout-btn i { font-size: 1rem; }

  .ts-main { margin-left: var(--sidebar-width); flex: 1; padding-top: 0; }
  .ts-content { padding: 36px 40px; max-width: 1100px; }
}

/* =====================
   PAGE HEADER
   ===================== */
.ts-page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}
.ts-page-header h2 {
  font-size: 1.25rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em;
}
.ts-date {
  font-size: 0.8rem; color: var(--text-muted); font-weight: 500;
  background: var(--card-bg); padding: 5px 12px; border-radius: 20px;
  box-shadow: var(--card-shadow); border: 1px solid var(--border-color);
}
@media (min-width: 992px) {
  .ts-page-header { margin-bottom: 32px; }
  .ts-page-header h2 { font-size: 1.65rem; }
}

/* =====================
   CARDS
   ===================== */
.ts-card {
  background: var(--card-bg); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); padding: 22px; margin-bottom: 14px;
  border: 1px solid rgba(226,232,240,0.6);
}
.ts-card-title {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 14px;
}

/* =====================
   CLOCK HERO
   ===================== */
.ts-clock-hero {
  background: var(--card-bg); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); border: 1px solid rgba(226,232,240,0.6);
  padding: 32px 24px 28px;
  text-align: center; margin-bottom: 14px;
}

.ts-status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 18px; border-radius: 50px;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  margin-bottom: 24px;
}
.ts-status-pill .ts-pulse {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.ts-status-pill.in {
  background: var(--green-light); color: var(--green);
  border: 1px solid rgba(16,185,129,0.2);
}
.ts-status-pill.in .ts-pulse {
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(16,185,129,0.4);
  animation: pulse-green 1.8s ease-in-out infinite;
}
.ts-status-pill.out { background: var(--red-light); color: var(--red); border: 1px solid rgba(239,68,68,0.15); }
.ts-status-pill.out .ts-pulse { background: var(--red); }
.ts-status-pill.idle { background: #f1f5f9; color: var(--text-muted); border: 1px solid var(--border-color); }
.ts-status-pill.idle .ts-pulse { background: var(--text-muted); }

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  70% { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

.ts-duty-select-wrap { margin-bottom: 20px; text-align: left; }
.ts-duty-select-wrap label {
  display: block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 8px;
}
.ts-duty-select-wrap .form-select {
  font-size: 0.95rem; padding: 13px 16px; border-radius: 12px;
  border: 1.5px solid var(--border-color); background-color: #f8fafc;
  font-weight: 500; color: var(--text-primary);
}
.ts-duty-select-wrap .form-select:focus {
  border-color: var(--brand-color); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); outline: none;
}

.ts-clock-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: none; border-radius: 14px; padding: 17px 32px;
  font-size: 1.05rem; font-weight: 700; cursor: pointer;
  width: 100%; max-width: 340px;
  transition: all 0.2s; letter-spacing: 0.01em;
}
.ts-clock-btn:active { transform: scale(0.97); }
.ts-clock-btn i { font-size: 1.2rem; }
.ts-clock-in {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff; box-shadow: 0 4px 20px rgba(16,185,129,0.4);
}
.ts-clock-in:hover { box-shadow: 0 6px 28px rgba(16,185,129,0.5); transform: translateY(-1px); }
.ts-clock-out {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff; box-shadow: 0 4px 20px rgba(239,68,68,0.35);
}
.ts-clock-out:hover { box-shadow: 0 6px 28px rgba(239,68,68,0.45); transform: translateY(-1px); }

.ts-clock-time {
  font-size: 0.8rem; color: var(--text-muted); margin-top: 16px;
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
}
.ts-clock-time-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ts-clock-time-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; }
.ts-clock-time-value { font-size: 1rem; font-weight: 700; color: var(--text-primary); }

/* =====================
   ACTIVE DUTY CARD
   ===================== */
.ts-active-duty-card {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #3730a3 100%);
  border-radius: var(--card-radius); padding: 22px 22px 20px;
  margin-bottom: 14px; color: #fff;
  box-shadow: 0 8px 32px rgba(99,102,241,0.35);
  position: relative; overflow: hidden;
}
.ts-active-duty-card::before {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.ts-active-duty-card::after {
  content: ''; position: absolute; bottom: -30px; left: 20px;
  width: 90px; height: 90px; border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.ts-active-duty-label {
  font-size: 0.68rem; font-weight: 700; opacity: 0.75;
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px;
  display: flex; align-items: center; gap: 5px;
}
.ts-active-duty-name { font-size: 1.6rem; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.02em; line-height: 1.2; }
.ts-active-duty-since { font-size: 0.8rem; opacity: 0.75; display: flex; align-items: center; gap: 5px; }

/* Change duty */
.ts-change-duty-card {
  background: var(--card-bg); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); padding: 20px; margin-bottom: 14px;
  border: 1px solid rgba(226,232,240,0.6);
}
.ts-btn-change-duty {
  width: 100%; padding: 13px; border-radius: 12px;
  border: 1.5px solid var(--brand-color);
  background: var(--brand-light); color: var(--brand-color);
  font-size: 0.93rem; font-weight: 700; cursor: pointer; transition: all 0.15s;
  letter-spacing: 0.01em;
}
.ts-btn-change-duty:hover, .ts-btn-change-duty:active {
  background: var(--brand-color); color: #fff;
  box-shadow: 0 4px 16px rgba(99,102,241,0.3);
}

/* =====================
   DUTY LOG
   ===================== */
.ts-log-card {
  background: var(--card-bg); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); padding: 20px;
  border: 1px solid rgba(226,232,240,0.6);
}
.ts-log-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 0; border-bottom: 1px solid #f1f5f9;
}
.ts-log-item:first-child { padding-top: 4px; }
.ts-log-item:last-child { border-bottom: none; padding-bottom: 0; }
.ts-log-item-left { display: flex; align-items: center; gap: 12px; }
.ts-log-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-muted);
}
.ts-log-dot.active { background: var(--green); animation: pulse-green 1.8s ease-in-out infinite; }
.ts-log-text { display: flex; flex-direction: column; gap: 2px; }
.ts-log-duty { font-weight: 600; font-size: 0.92rem; color: var(--text-primary); }
.ts-log-times { font-size: 0.75rem; color: var(--text-muted); }
.ts-log-duration {
  font-size: 0.82rem; font-weight: 700; color: var(--brand-color);
  background: var(--brand-light); padding: 4px 11px; border-radius: 20px;
  white-space: nowrap;
}
.ts-log-duration.active { color: var(--green); background: var(--green-light); }

/* =====================
   MANAGER — Employee Cards
   ===================== */
.ts-employee-card {
  background: var(--card-bg); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); padding: 18px 20px; margin-bottom: 12px;
  border: 1px solid rgba(226,232,240,0.6);
  transition: box-shadow 0.15s;
}
.ts-employee-card:hover { box-shadow: var(--card-shadow-lg); }
.ts-employee-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ts-employee-name-row { display: flex; align-items: center; gap: 12px; }
.ts-employee-avatar {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-color), var(--brand-dark));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.95rem; flex-shrink: 0; letter-spacing: 0.02em;
}
.ts-employee-info-name { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); }
.ts-employee-info-hours { font-size: 0.75rem; color: var(--text-muted); margin-top: 1px; }
.ts-employee-times { text-align: right; }
.ts-employee-time-item { font-size: 0.75rem; color: var(--text-muted); line-height: 1.6; }
.ts-employee-time-item strong { color: var(--text-primary); font-weight: 600; }
.ts-employee-duties { display: flex; flex-wrap: wrap; gap: 6px; }
.ts-duty-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 8px;
  background: #f1f5f9; color: var(--text-secondary);
  font-size: 0.75rem; font-weight: 600; border: 1px solid var(--border-color);
}
.ts-duty-badge small { opacity: 0.65; }
.ts-duty-badge-active {
  background: var(--green-light); color: var(--green);
  border: 1.5px solid rgba(16,185,129,0.25); font-weight: 700;
}
.ts-pulse-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); margin-right: 4px; flex-shrink: 0;
  animation: pulse-green 1.8s ease-in-out infinite;
  vertical-align: middle; position: relative; top: -1px;
}

.ts-active-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 8px;
  background: var(--green-light); color: var(--green);
  font-size: 0.75rem; font-weight: 700;
}

/* Date filter bar */
.ts-manager-date-bar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 22px; flex-wrap: wrap;
}
.ts-date-input { max-width: 175px; }

/* =====================
   FORMS
   ===================== */
.ts-form-card {
  background: var(--card-bg); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); padding: 28px; max-width: 520px;
  border: 1px solid rgba(226,232,240,0.6);
}
.form-label { font-weight: 600; font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 6px; display: block; }
.form-control, .form-select {
  border-radius: 10px; border: 1.5px solid var(--border-color);
  padding: 11px 14px; font-size: 0.93rem; color: var(--text-primary);
  background: #fafbfc; transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-color); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); outline: none; background: #fff;
}
.input-group { display: flex; }
.input-group-text {
  background: #f1f5f9; border: 1.5px solid var(--border-color); border-right: none;
  color: var(--text-muted); border-radius: 10px 0 0 10px; padding: 11px 14px;
  display: flex; align-items: center;
}
.input-group .form-control { border-radius: 0 10px 10px 0; border-left: none; }
.form-check-input { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-color); cursor: pointer; }
.form-check-input:checked { background-color: var(--brand-color); border-color: var(--brand-color); }
.form-check-label { font-size: 0.9rem; color: var(--text-secondary); cursor: pointer; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 20px; }

/* Buttons */
.ts-btn-primary {
  background: linear-gradient(135deg, var(--brand-color), var(--brand-dark));
  color: #fff; border: none; border-radius: 10px; padding: 12px 22px;
  font-weight: 700; cursor: pointer; font-size: 0.93rem;
  box-shadow: 0 4px 14px rgba(99,102,241,0.3);
  transition: all 0.15s; letter-spacing: 0.01em;
}
.ts-btn-primary:hover { box-shadow: 0 6px 20px rgba(99,102,241,0.4); transform: translateY(-1px); color: #fff; }
.ts-btn-secondary {
  background: var(--card-bg); color: var(--text-secondary);
  border: 1.5px solid var(--border-color); border-radius: 10px; padding: 11px 22px;
  font-weight: 600; cursor: pointer; font-size: 0.93rem; transition: all 0.15s;
}
.ts-btn-secondary:hover { background: #f1f5f9; color: var(--text-primary); border-color: #cbd5e1; }

/* Badges */
.badge { padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; }
.badge.bg-primary { background: var(--brand-light) !important; color: var(--brand-color) !important; }
.badge.bg-secondary { background: #f1f5f9 !important; color: var(--text-muted) !important; }

/* Tables */
.ts-table-card { background: var(--card-bg); border-radius: var(--card-radius); box-shadow: var(--card-shadow); overflow: hidden; border: 1px solid rgba(226,232,240,0.6); }
.ts-table { border-collapse: collapse; width: 100%; }
.ts-table thead th {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 700; padding: 12px 16px;
  background: #f8fafc; border-bottom: 1px solid var(--border-color);
}
.ts-table tbody td { padding: 14px 16px; border-bottom: 1px solid #f1f5f9; font-size: 0.9rem; vertical-align: middle; }
.ts-table tbody tr:last-child td { border-bottom: none; }
.ts-table tbody tr:hover td { background: #fafbff; }

/* Empty state */
.ts-empty-state { text-align: center; padding: 64px 24px; color: var(--text-muted); }
.ts-empty-state i { font-size: 2.8rem; display: block; margin-bottom: 14px; opacity: 0.25; }
.ts-empty-state p { font-size: 0.92rem; }

/* =====================
   LOGIN PAGE
   ===================== */
.ts-login-body {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(160deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
  padding: 32px 20px;
}
.ts-login-wrapper { width: 100%; max-width: 420px; }

.ts-login-brand {
  text-align: center; margin-bottom: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.ts-login-logo { width: 190px; filter: brightness(0) invert(1); opacity: 0.92; }
.ts-login-divider {
  display: flex; align-items: center; gap: 12px; width: 100%; opacity: 0.3;
}
.ts-login-divider::before, .ts-login-divider::after {
  content: ''; flex: 1; height: 1px; background: #fff;
}
.ts-login-divider span { color: #fff; font-size: 0.65rem; white-space: nowrap; letter-spacing: 0.1em; font-weight: 600; text-transform: uppercase; }
.ts-login-app-brand {
  display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,0.85);
}
.ts-login-app-brand i { font-size: 1.6rem; color: #818cf8; }
.ts-login-app-brand-text {}
.ts-login-app-brand-name { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.ts-login-app-brand-sub { font-size: 0.7rem; opacity: 0.6; letter-spacing: 0.06em; text-transform: uppercase; }

.ts-login-card {
  background: #fff; border-radius: 22px; padding: 36px 32px;
  box-shadow: 0 25px 80px rgba(0,0,0,0.4); margin-top: 24px;
}
.ts-login-card .form-control,
.ts-login-card .input-group-text {
  font-size: 16px; /* prevents iOS Safari auto-zoom on focus */
}
.ts-login-heading { text-align: center; margin-bottom: 28px; }
.ts-login-heading p { color: var(--text-muted); font-size: 0.9rem; }

/* =====================
   EDIT TIMESHEET
   ===================== */

/* Edit button on employee cards */
.ts-edit-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--brand-light); color: var(--brand-color);
  border: 1px solid rgba(99,102,241,0.2); transition: all 0.15s; flex-shrink: 0;
  text-decoration: none;
}
.ts-edit-btn:hover { background: var(--brand-color); color: #fff; }

/* Back button */
.ts-back-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--card-bg); color: var(--text-secondary);
  border: 1.5px solid var(--border-color); text-decoration: none; transition: all 0.15s;
}
.ts-back-btn:hover { background: #f1f5f9; color: var(--text-primary); }

/* Header card with inline clock edit */
.ts-edit-header-card {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--card-bg); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); border: 1px solid rgba(226,232,240,0.6);
  padding: 18px 22px; margin-bottom: 14px;
}
.ts-clock-edit-form { margin-left: auto; }
.ts-clock-edit-fields {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.ts-clock-edit-item { display: flex; flex-direction: column; gap: 3px; }
.ts-clock-edit-item label {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
}
.ts-clock-edit-sep { color: var(--text-muted); font-size: 0.9rem; margin-top: 12px; }

/* Time input — clean and compact */
.ts-time-input {
  border: 1.5px solid var(--border-color); border-radius: 9px;
  padding: 8px 10px; font-size: 0.95rem; font-weight: 600;
  color: var(--text-primary); background: #f8fafc; width: 108px;
  transition: border-color 0.15s;
}
.ts-time-input:focus { border-color: var(--brand-color); outline: none; background: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }

/* Section */
.ts-edit-section {
  background: var(--card-bg); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); border: 1px solid rgba(226,232,240,0.6);
  padding: 22px; margin-bottom: 14px;
}
.ts-edit-section-title {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.ts-entry-count {
  margin-left: auto; background: #f1f5f9; color: var(--text-muted);
  padding: 2px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 600;
  text-transform: none; letter-spacing: 0;
}

/* Timeline rows */
.ts-duty-timeline { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }

.ts-timeline-row {
  display: flex; align-items: center; gap: 10px;
  background: #f8fafc; border: 1px solid var(--border-color);
  border-radius: 12px; padding: 10px 14px; transition: border-color 0.15s;
}
.ts-timeline-row:hover { border-color: #c7d2fe; background: #fafbff; }

.ts-timeline-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-muted); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--text-muted);
}
.ts-timeline-dot.active {
  background: var(--green); box-shadow: 0 0 0 1px var(--green);
  animation: pulse-green 1.8s ease-in-out infinite;
}
.ts-timeline-dot.add {
  background: var(--brand-color); box-shadow: 0 0 0 1px var(--brand-color);
}

.ts-timeline-form {
  display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap;
}

.ts-inline-select {
  border: 1.5px solid var(--border-color); border-radius: 9px;
  padding: 8px 10px; font-size: 0.88rem; font-weight: 600;
  color: var(--text-primary); background: #fff; flex: 1; min-width: 110px;
  transition: border-color 0.15s;
}
.ts-inline-select:focus { border-color: var(--brand-color); outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }

.ts-timeline-arrow { color: var(--text-muted); font-size: 0.85rem; flex-shrink: 0; }

.ts-duration-chip {
  font-size: 0.75rem; font-weight: 700; color: var(--brand-color);
  background: var(--brand-light); padding: 4px 10px; border-radius: 20px;
  white-space: nowrap; flex-shrink: 0;
}
.ts-duration-chip.active { color: var(--green); background: var(--green-light); }

/* Action buttons inline */
.ts-inline-save-btn {
  width: 34px; height: 34px; border-radius: 9px; border: none; flex-shrink: 0;
  background: var(--brand-color); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.9rem; transition: all 0.15s;
}
.ts-inline-save-btn:hover { background: var(--brand-dark); }

.ts-inline-delete-btn {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: none; border: 1.5px solid var(--border-color); color: var(--text-muted);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.85rem; transition: all 0.15s;
}
.ts-inline-delete-btn:hover { background: var(--red-light); border-color: var(--red); color: var(--red); }

.ts-inline-add-btn {
  width: 34px; height: 34px; border-radius: 9px; border: none; flex-shrink: 0;
  background: var(--green); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.95rem; transition: all 0.15s;
}
.ts-inline-add-btn:hover { background: #059669; }

/* Add entry row */
.ts-add-entry-row {
  border-top: 1.5px dashed var(--border-color); padding-top: 14px; margin-top: 4px;
  display: flex; align-items: center; gap: 10px;
}

.ts-alert-error {
  background: var(--red-light); border: 1.5px solid rgba(239,68,68,0.25);
  color: var(--red); border-radius: 12px; padding: 13px 18px;
  font-size: 0.88rem; font-weight: 600; margin-bottom: 14px;
  display: flex; align-items: center;
}

.ts-no-entries {
  color: var(--text-muted); font-size: 0.88rem;
  padding: 20px 0; text-align: center; display: flex;
  align-items: center; justify-content: center; gap: 8px;
}

/* =====================
   HISTORY PAGE
   ===================== */
.ts-history-dates {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
  margin-bottom: 16px; scrollbar-width: none;
}
.ts-history-dates::-webkit-scrollbar { display: none; }

.ts-history-date-btn {
  display: flex; flex-direction: column; align-items: center;
  min-width: 52px; padding: 10px 8px; border-radius: 14px;
  background: var(--card-bg); border: 1.5px solid var(--border-color);
  text-decoration: none; color: var(--text-secondary); transition: all 0.15s;
  flex-shrink: 0;
}
.ts-history-date-btn:hover { border-color: var(--brand-color); color: var(--brand-color); }
.ts-history-date-btn.active {
  background: var(--brand-color); border-color: var(--brand-color); color: #fff;
}
.ts-hd-day { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.7; }
.ts-hd-num { font-size: 1.1rem; font-weight: 800; line-height: 1.2; }
.ts-hd-mon { font-size: 0.62rem; font-weight: 600; opacity: 0.7; }
.ts-history-date-btn.active .ts-hd-day,
.ts-history-date-btn.active .ts-hd-mon { opacity: 0.8; }

.ts-history-summary {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin-bottom: 14px;
}
@media (min-width: 600px) {
  .ts-history-summary { grid-template-columns: repeat(4, 1fr); }
}
.ts-history-summary-item {
  background: var(--card-bg); border-radius: 14px;
  box-shadow: var(--card-shadow); border: 1px solid rgba(226,232,240,0.6);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
}
.ts-hs-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.ts-hs-value { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.ts-hs-total { color: var(--brand-color); }

/* =====================
   MANAGER DASHBOARD
   ===================== */
.ts-dash-kpis {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 24px;
}
@media (min-width: 768px) { .ts-dash-kpis { grid-template-columns: repeat(4, 1fr); } }
.ts-dash-kpi {
  background: var(--card-bg); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); border: 1px solid rgba(226,232,240,0.6);
  padding: 20px; display: flex; align-items: center; gap: 16px;
}
.ts-dash-kpi-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.ts-dash-kpi-body { min-width: 0; }
.ts-dash-kpi-value {
  font-size: 1.6rem; font-weight: 800; color: var(--text-primary); line-height: 1.1;
}
.ts-dash-kpi-sub { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); margin-left: 2px; }
.ts-dash-kpi-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.03em; }

.ts-dash-charts {
  display: grid; grid-template-columns: 1fr; gap: 20px; margin-bottom: 24px;
}
@media (min-width: 992px) { .ts-dash-charts { grid-template-columns: 2fr 1fr; } }

.ts-dash-chart-card {
  background: var(--card-bg); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); border: 1px solid rgba(226,232,240,0.6);
  padding: 24px; position: relative; overflow: hidden;
}
.ts-dash-chart-card canvas { max-height: 260px; }
.ts-dash-chart-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.ts-dash-chart-header h3 {
  font-size: 0.9rem; font-weight: 700; color: var(--text-primary); margin: 0;
}
.ts-dash-link {
  font-size: 0.8rem; font-weight: 600; color: var(--brand-color);
  text-decoration: none; white-space: nowrap;
}
.ts-dash-link:hover { text-decoration: underline; }

.ts-dash-status-list { max-height: 300px; overflow-y: auto; }
.ts-dash-status-group { margin-bottom: 14px; }
.ts-dash-status-group:last-child { margin-bottom: 0; }
.ts-dash-status-label {
  font-size: 0.78rem; font-weight: 700; color: var(--text-secondary);
  margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.ts-dash-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.ts-dash-status-item {
  padding: 5px 0; font-size: 0.85rem; color: var(--text-primary);
  border-bottom: 1px solid rgba(226,232,240,0.4);
}
.ts-dash-status-item:last-child { border-bottom: none; }
.ts-dash-status-item small { margin-left: 6px; }

.ts-dash-bottom {
  display: grid; grid-template-columns: 1fr; gap: 20px; margin-bottom: 24px;
}
@media (min-width: 992px) { .ts-dash-bottom { grid-template-columns: 1fr 1fr; } }
.ts-dash-card {
  background: var(--card-bg); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); border: 1px solid rgba(226,232,240,0.6);
  padding: 24px;
}
.ts-dash-table-wrap { max-height: 300px; overflow-y: auto; }

/* =====================
   EXPORT PAGE
   ===================== */
.ts-reports-grid {
  display: grid; grid-template-columns: 1fr; gap: 24px;
}
@media (min-width: 992px) {
  .ts-reports-grid { grid-template-columns: repeat(2, 1fr); }
}
.ts-export-card {
  background: var(--card-bg); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); border: 1px solid rgba(226,232,240,0.6);
  padding: 36px 32px; text-align: center;
  display: flex; flex-direction: column;
}
.ts-export-card .ts-export-form { flex: 1; }
.ts-export-card .ts-export-info { margin-top: auto; }
.ts-export-icon {
  width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--brand-color), var(--brand-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: #fff;
  box-shadow: 0 8px 24px rgba(99,102,241,0.3);
}
.ts-export-card h3 { font-size: 1.2rem; font-weight: 800; color: var(--text-primary); margin-bottom: 8px; }
.ts-export-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 28px; line-height: 1.6; }

.ts-export-form { margin-bottom: 24px; }
.ts-export-fields {
  display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; justify-content: center; flex-wrap: wrap;
}
.ts-export-fields > div { text-align: left; }
.ts-export-to-label { color: var(--text-muted); font-weight: 600; font-size: 0.9rem; padding-bottom: 10px; }

.ts-btn-export {
  background: linear-gradient(135deg, var(--brand-color), var(--brand-dark));
  color: #fff; border: none; border-radius: 12px; padding: 14px 32px;
  font-size: 1rem; font-weight: 700; cursor: pointer; width: 100%;
  box-shadow: 0 4px 16px rgba(99,102,241,0.3); transition: all 0.15s;
}
.ts-btn-export:hover { box-shadow: 0 6px 24px rgba(99,102,241,0.45); transform: translateY(-1px); }

.ts-export-info {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left;
  background: #f8fafc; border-radius: 12px; padding: 16px;
}
.ts-export-info-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.82rem; color: var(--text-secondary); font-weight: 500;
}
.ts-export-info-item i { color: var(--green); font-size: 0.85rem; }

.ts-export-format-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; text-align: left; }
.ts-export-format-option {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border: 1.5px solid var(--border-color); border-radius: 10px;
  cursor: pointer; transition: all 0.15s; background: var(--card-bg);
}
.ts-export-format-option:hover { border-color: var(--brand-color); background: rgba(99,102,241,0.03); }
.ts-export-format-option.ts-format-selected {
  border-color: var(--brand-color); background: rgba(99,102,241,0.06);
  box-shadow: 0 0 0 1px var(--brand-color);
}
.ts-format-radio {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-color);
  flex-shrink: 0; position: relative; transition: all 0.15s;
}
.ts-format-selected .ts-format-radio {
  border-color: var(--brand-color);
}
.ts-format-selected .ts-format-radio::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--brand-color);
}
.ts-format-info { display: flex; flex-direction: column; gap: 2px; }
.ts-format-name { font-size: 0.9rem; font-weight: 700; color: var(--text-primary); }
.ts-format-desc { font-size: 0.78rem; color: var(--text-muted); }

/* =====================
   CALENDAR
   ===================== */
.ts-cal-toggle {
  display: flex; border-radius: 10px; overflow: hidden;
  border: 1.5px solid var(--border-color); background: var(--card-bg);
}
.ts-cal-toggle-btn {
  padding: 7px 16px; font-size: 0.82rem; font-weight: 600;
  color: var(--text-secondary); text-decoration: none; transition: all 0.15s;
}
.ts-cal-toggle-btn.active { background: var(--brand-color); color: #fff; }

.ts-cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; background: var(--card-bg);
  border-radius: 12px; padding: 10px 14px;
  box-shadow: var(--card-shadow); border: 1px solid rgba(226,232,240,0.6);
}
.ts-cal-nav-btn {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--main-bg); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; border: 1.5px solid var(--border-color); transition: all 0.15s;
}
.ts-cal-nav-btn:hover { background: var(--brand-light); color: var(--brand-color); border-color: var(--brand-color); }
.ts-cal-nav-title { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }

/* Month grid */
.ts-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; background: var(--border-color);
  border-radius: 14px; overflow: hidden; border: 1px solid var(--border-color);
}
.ts-cal-day-header {
  background: #f8fafc; padding: 7px 4px; text-align: center;
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
}
.ts-cal-cell {
  background: var(--card-bg); min-height: 64px; padding: 5px 4px;
  position: relative; transition: background 0.15s;
}
.ts-cal-cell-empty { background: #f8fafc; }
.ts-cal-cell-future { background: #fafbfc; }
.ts-cal-cell-today { background: #f0f1ff; }
.ts-cal-cell-alert { background: rgba(251,191,36,0.07); outline: 1px solid rgba(245,158,11,0.25); outline-offset: -1px; }
.ts-cal-cell-num {
  font-size: 0.75rem; font-weight: 700; color: var(--text-primary); margin-bottom: 3px;
}
.ts-cal-cell-today .ts-cal-cell-num { color: var(--brand-color); }
.ts-cal-cell-future .ts-cal-cell-num { color: var(--text-muted); }
.ts-cal-cell-alert-badge {
  position: absolute; top: 4px; right: 4px;
  width: 7px; height: 7px; border-radius: 50%; background: #f59e0b;
}

/* Mobile: avatar dots */
.ts-cal-dots { display: flex; flex-wrap: wrap; gap: 2px; }
.ts-cal-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--brand-color);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.52rem; font-weight: 700; color: #fff;
}
.ts-cal-dot-alert { background: var(--red); }
.ts-cal-dot-more { background: #e2e8f0; color: var(--text-muted); font-size: 0.5rem; }

/* Clickable day number */
.ts-cal-cell-link {
  text-decoration: none; color: inherit; display: inline-block;
  border-radius: 4px; padding: 0 2px; margin: 0 -2px;
  transition: color 0.12s;
}
.ts-cal-cell-link:hover { color: var(--brand-color); }
.ts-cal-cell-today .ts-cal-cell-link { color: var(--brand-color); }

/* Clickable dots already styled as <a> — inherit base styles */
.ts-cal-dot { text-decoration: none; cursor: pointer; transition: transform 0.12s, opacity 0.12s; }
.ts-cal-dot:hover { transform: scale(1.15); opacity: 0.85; }

/* Desktop: name+hours chips (hidden on mobile) */
.ts-cal-people { display: none; flex-direction: column; gap: 2px; margin-top: 2px; }
.ts-cal-person-chip {
  font-size: 0.65rem; font-weight: 600; padding: 2px 5px; border-radius: 5px;
  background: var(--brand-light); color: var(--brand-color);
  display: flex; justify-content: space-between; gap: 3px; overflow: hidden;
  text-decoration: none; transition: filter 0.12s;
}
.ts-cal-person-chip:hover { filter: brightness(0.88); }
.ts-cal-person-chip-alert { background: rgba(239,68,68,0.1); color: var(--red); }
.ts-cal-person-chip small { opacity: 0.75; white-space: nowrap; }

@media (min-width: 992px) {
  .ts-cal-dots { display: none; }
  .ts-cal-people { display: flex; }
  .ts-cal-cell { min-height: 90px; padding: 8px; }
  .ts-cal-cell-num { font-size: 0.82rem; }
  .ts-cal-grid { gap: 3px; }
  .ts-cal-day-header { padding: 9px 6px; font-size: 0.68rem; }
}

/* Week view */
.ts-cal-week { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.ts-cal-week-day {
  background: var(--card-bg); border-radius: 14px;
  box-shadow: var(--card-shadow); border: 1px solid rgba(226,232,240,0.6);
  padding: 14px 16px; min-height: 100px;
}
.ts-cal-week-day-alert { border-color: rgba(245,158,11,0.4); background: rgba(251,191,36,0.04); }
.ts-cal-week-day-today { border-color: rgba(99,102,241,0.3); background: #f9f9ff; }
.ts-cal-week-day-future { opacity: 0.7; }

.ts-cal-week-day-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; gap: 4px; overflow: hidden;
}
.ts-cal-week-day-label {
  font-size: 0.88rem; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; gap: 4px;
  overflow: hidden; min-width: 0;
}
.ts-cal-week-day-label span { color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.ts-cal-day-link { text-decoration: none; transition: color 0.12s; }
.ts-cal-day-link:hover { color: var(--brand-color); }
.ts-cal-day-link:hover .ts-cal-day-link-arrow { opacity: 1; }
.ts-cal-day-link-arrow { opacity: 0; font-size: 1rem; transition: opacity 0.12s; margin-left: -2px; }
.ts-cal-today-badge {
  font-size: 0.65rem; font-weight: 700; color: var(--brand-color);
  background: var(--brand-light); padding: 2px 8px; border-radius: 20px; letter-spacing: 0.02em;
}
.ts-cal-week-alert-badge {
  font-size: 0.65rem; font-weight: 700; color: #b45309;
  background: rgba(245,158,11,0.12); padding: 2px 7px;
  border-radius: 20px; display: inline-flex; align-items: center; gap: 3px;
  white-space: nowrap;
}
.ts-cal-week-empty { color: var(--text-muted); font-size: 0.82rem; font-style: italic; }
.ts-cal-week-people { display: flex; flex-direction: column; gap: 5px; }
.ts-cal-week-person {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-radius: 9px; background: #f8fafc;
  border: 1px solid var(--border-color);
  text-decoration: none; transition: border-color 0.12s, background 0.12s;
  flex-wrap: wrap; gap: 2px 6px; overflow: hidden;
}
.ts-cal-week-person:hover { border-color: var(--brand-color); background: #fafbff; }
.ts-cal-week-person-alert { background: rgba(239,68,68,0.05); border-color: rgba(239,68,68,0.2); }
.ts-cal-week-person-alert:hover { border-color: var(--red); background: rgba(239,68,68,0.08); }
.ts-cal-edit-icon {
  font-size: 0.8rem; color: var(--brand-color); opacity: 0;
  transition: opacity 0.12s; margin-left: 4px;
}
.ts-cal-week-person:hover .ts-cal-edit-icon { opacity: 1; }
.ts-cal-week-person-name {
  font-size: 0.82rem; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.ts-cal-week-person-right {
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0; font-size: 0.75rem;
}
.ts-cal-week-person-hours {
  font-size: 0.75rem; font-weight: 700; color: var(--brand-color);
  white-space: nowrap;
}
.ts-cal-week-person-active {
  font-size: 0.65rem; font-weight: 700; color: var(--red);
  background: rgba(239,68,68,0.1); padding: 1px 6px; border-radius: 20px;
  display: inline-flex; align-items: center; gap: 3px; white-space: nowrap;
}

@media (min-width: 992px) {
  .ts-cal-week { flex-direction: row; align-items: stretch; }
  .ts-cal-week-day { flex: 1 1 0; min-width: 0; padding: 10px 10px; }
  .ts-cal-week-day-header { flex-wrap: nowrap; overflow: hidden; }
  .ts-cal-week-day-label { font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ts-cal-today-badge { font-size: 0.58rem; padding: 1px 5px; }
  .ts-cal-week-person { padding: 4px 6px; }
  .ts-cal-week-person-name { font-size: 0.75rem; }
  .ts-cal-week-person-hours { font-size: 0.7rem; }
  .ts-cal-week-person-active { font-size: 0.6rem; padding: 1px 4px; }
  .ts-cal-week-person-away { font-size: 0.65rem; }
  .ts-cal-week-alert-badge { font-size: 0.6rem; padding: 1px 5px; }
}

/* =====================
   AVATAR (photo + initial fallback)
   ===================== */
/* Applied to .ts-header-avatar and .ts-sidebar-avatar when they contain a photo */
.ts-avatar { position: relative; overflow: hidden; }
.ts-avatar img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: inherit;
}
.ts-avatar span { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }

/* =====================
   PROFILE PHOTO UPLOAD
   ===================== */
.ts-photo-preview-wrap {
  position: relative; display: inline-block; margin: 12px auto 20px;
}
.ts-photo-preview {
  width: 120px; height: 120px; border-radius: 50%;
  background: var(--brand-color);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
  box-shadow: 0 4px 20px rgba(99,102,241,0.3);
}
.ts-photo-preview img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.ts-photo-initial {
  font-size: 2.8rem; font-weight: 800; color: #fff; line-height: 1;
}
.ts-photo-edit-btn {
  position: absolute; bottom: 4px; right: 4px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--sidebar-bg); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; cursor: pointer; border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25); transition: background 0.15s;
}
.ts-photo-edit-btn:hover { background: var(--brand-color); }
.ts-photo-file-input { display: none; }
.ts-photo-hint {
  color: var(--text-muted); font-size: 0.82rem; margin-bottom: 16px; line-height: 1.5;
}

/* =====================
   LOGO UPLOAD (Settings)
   ===================== */
.ts-logo-preview-wrap {
  background: var(--sidebar-bg); border-radius: 14px;
  padding: 24px; display: flex; align-items: center; justify-content: center;
  min-height: 100px; margin-bottom: 4px;
}
.ts-logo-preview-img {
  max-width: 100%; max-height: 120px; object-fit: contain;
  filter: brightness(0) invert(1); opacity: 0.9;
}
.ts-logo-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 0.82rem;
}

/* =====================
   LEAVE REQUESTS
   ===================== */
.ts-leave-days-badge {
  font-size: 0.8rem; font-weight: 700; color: #f59e0b;
  background: rgba(245,158,11,0.12); padding: 5px 12px;
  border-radius: 20px; white-space: nowrap;
}

.ts-leave-card {
  border-radius: var(--card-radius); padding: 16px 18px; margin-bottom: 10px;
  border: 1.5px solid var(--border-color); background: var(--card-bg);
}
.ts-leave-pending { border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.04); }
.ts-leave-approved { border-color: rgba(16,185,129,0.25); background: rgba(16,185,129,0.04); }
.ts-leave-declined { border-color: var(--border-color); background: #fafbfc; opacity: 0.8; }

.ts-leave-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ts-leave-dates { font-size: 0.92rem; font-weight: 700; color: var(--text-primary); }
.ts-leave-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.ts-leave-reason { font-size: 0.8rem; color: var(--text-secondary); font-style: italic; margin-top: 6px; }

.ts-leave-badge {
  font-size: 0.7rem; font-weight: 700; padding: 3px 10px; border-radius: 20px;
  white-space: nowrap; letter-spacing: 0.03em; flex-shrink: 0;
}
.ts-leave-badge-pending { background: rgba(245,158,11,0.15); color: #b45309; }
.ts-leave-badge-approved { background: rgba(16,185,129,0.15); color: #059669; }
.ts-leave-badge-declined { background: #f1f5f9; color: var(--text-muted); }

/* Manager review card */
.ts-leave-review-card {
  background: var(--card-bg); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); border: 1px solid rgba(226,232,240,0.6);
  padding: 18px 20px; margin-bottom: 12px;
}
.ts-leave-review-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.ts-leave-review-dates { text-align: right; }

.ts-btn-leave-approve {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff; border: none; border-radius: 10px; padding: 10px 16px;
  font-weight: 700; font-size: 0.88rem; cursor: pointer; transition: all 0.15s;
}
.ts-btn-leave-approve:hover { box-shadow: 0 4px 16px rgba(16,185,129,0.4); transform: translateY(-1px); }

.ts-btn-leave-decline {
  background: var(--card-bg); color: var(--red);
  border: 1.5px solid rgba(239,68,68,0.3); border-radius: 10px; padding: 10px 16px;
  font-weight: 700; font-size: 0.88rem; cursor: pointer; transition: all 0.15s;
}
.ts-btn-leave-decline:hover { background: var(--red-light); border-color: var(--red); }

/* Leave summary strip */
.ts-leave-summary {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card-bg); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); border: 1px solid rgba(226,232,240,0.6);
  padding: 16px 12px; margin-bottom: 16px; text-align: center; gap: 0;
}
.ts-leave-summary-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ts-leave-summary-val { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.ts-leave-summary-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
.ts-leave-summary-divider { width: 1px; background: var(--border-color); margin: 4px 0; align-self: stretch; }
.ts-leave-summary-taken    { color: var(--text-primary); }
.ts-leave-summary-approved { color: #f59e0b; }
.ts-leave-summary-available { color: var(--green); }

/* Mini summary line inside manager review cards */
.ts-leave-mini-summary {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 10px;
  background: #f8fafc; border-radius: 8px; padding: 6px 10px;
}
.ts-lms-dot {
  width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0;
}

/* Calendar leave styles */
.ts-cal-dot-leave { background: #f59e0b; }
.ts-cal-person-chip-leave {
  background: rgba(245,158,11,0.12); color: #b45309;
  font-size: 0.65rem; font-weight: 600; padding: 2px 5px; border-radius: 5px;
  display: flex; justify-content: space-between; gap: 3px; overflow: hidden;
  text-decoration: none;
}
.ts-cal-week-person-leave {
  background: rgba(245,158,11,0.07); border-color: rgba(245,158,11,0.25);
}
.ts-cal-week-person-away {
  font-size: 0.75rem; font-weight: 700; color: #b45309;
  background: rgba(245,158,11,0.15); padding: 2px 8px; border-radius: 20px;
  display: flex; align-items: center;
}

/* =====================
   LOCATION MAP
   ===================== */
.ts-map-wrap {
  position: relative; border-radius: var(--card-radius);
  overflow: hidden; box-shadow: var(--card-shadow-lg);
  border: 1px solid rgba(226,232,240,0.6);
}
#map {
  height: 420px; width: 100%; z-index: 1;
}
@media (min-width: 992px) {
  #map { height: calc(100vh - 240px); min-height: 500px; }
}

/* Legend */
.ts-map-legend {
  position: absolute; bottom: 18px; left: 18px; z-index: 500;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(8px);
  border-radius: 12px; padding: 10px 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  border: 1px solid rgba(226,232,240,0.8);
  display: flex; flex-direction: column; gap: 6px;
}
.ts-map-legend-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.75rem; font-weight: 600; color: var(--text-secondary);
}
.ts-map-legend-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}

/* Custom marker pins */
.ts-map-pin {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 0.72rem;
  border: 2.5px solid #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
  letter-spacing: 0.02em;
  cursor: pointer; transition: transform 0.15s;
}
.ts-map-pin:hover { transform: scale(1.12); }

/* Popup styling */
.ts-map-popup { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; min-width: 160px; }
.ts-map-popup-name { font-size: 0.88rem; font-weight: 700; color: var(--text-primary); margin-bottom: 5px; }
.ts-map-popup-action {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.78rem; color: var(--text-secondary); font-weight: 500;
}
.ts-map-popup-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.ts-map-popup-duty {
  font-size: 0.75rem; color: var(--text-muted); margin-top: 4px;
  display: flex; align-items: center; gap: 5px;
}
/* Override Leaflet popup chrome */
.leaflet-popup-content-wrapper {
  border-radius: 12px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15) !important;
  padding: 4px !important;
}
.leaflet-popup-content { margin: 12px 16px !important; }
.leaflet-popup-tip-container { margin-top: -1px; }

/* GPS status strip on dashboard */
.ts-geo-status {
  margin-top: 14px; font-size: 0.78rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  transition: color 0.2s;
}

/* Out-of-radius badge on Daily Overview */
.ts-outside-badge {
  display: inline-flex; align-items: center;
  font-size: 0.68rem; font-weight: 700;
  color: #dc2626; background: rgba(220,38,38,0.1);
  padding: 1px 7px; border-radius: 20px;
  margin-left: 7px; vertical-align: middle;
}
.ts-employee-card-outside {
  border-left: 3px solid #ef4444;
}

/* Misc utilities */
.text-muted { color: var(--text-muted) !important; }
.fw-semibold { font-weight: 600; }
.w-100 { width: 100%; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.align-items-center { align-items: center; }
.mt-3 { margin-top: 12px; }
.me-1 { margin-right: 4px; }
.me-2 { margin-right: 8px; }
.table-responsive { overflow-x: auto; }

/* --- Job Photos & Notes --- */
.ts-photo-notes-section {
    margin: 12px 0;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255,255,255,0.03);
}
.ts-section-toggle {
    padding: 10px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    user-select: none;
}
.ts-section-toggle:hover { color: var(--brand-color); }
.ts-toggle-icon { margin-left: auto; transition: transform 0.2s; font-size: 0.7rem; }
.ts-photo-notes-section.open .ts-toggle-icon { transform: rotate(180deg); }
.ts-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 14px;
}
.ts-photo-notes-section.open .ts-section-content {
    max-height: 400px;
    padding: 0 14px 14px;
}
.ts-photo-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.ts-photo-preview img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid rgba(99,102,241,0.3);
}
.ts-log-notes {
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding: 4px 0 2px 28px;
    line-height: 1.5;
    font-style: italic;
}
.ts-log-photos {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 4px 0 4px 28px;
}
.ts-log-photo-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    border: 1.5px solid var(--brand-color);
    cursor: pointer;
    transition: transform 0.15s;
}
.ts-log-photo-thumb:hover {
    transform: scale(1.15);
}

/* Change duty card adjustments for notes section */
.ts-change-duty-card .ts-photo-notes-section {
    border-color: rgba(0,0,0,0.08);
    background: rgba(0,0,0,0.02);
}
.ts-change-duty-card .ts-section-toggle {
    color: var(--text-secondary);
}

/* --- Standalone Job Photos Card --- */
.ts-job-photos-card {
    margin-bottom: 16px;
}
.ts-job-photo-upload-area {
    border: 2px dashed rgba(99,102,241,0.25);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.2s;
    min-height: 80px;
}
.ts-job-photo-upload-area:hover {
    border-color: var(--brand-color);
}
.ts-job-photo-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px;
    cursor: pointer;
    color: var(--text-muted);
    text-align: center;
    width: 100%;
    transition: color 0.15s;
}
.ts-job-photo-label:hover {
    color: var(--brand-color);
}
.ts-job-photo-label i {
    font-size: 1.8rem;
    color: var(--brand-color);
    opacity: 0.7;
}
.ts-job-photo-label span {
    font-size: 0.85rem;
    font-weight: 600;
}
.ts-job-photo-previews {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px;
}
.ts-job-photo-previews:empty {
    display: none;
}
.ts-job-photo-thumb-wrap {
    position: relative;
}
.ts-job-photo-thumb-wrap img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid rgba(99,102,241,0.3);
}
.ts-photo-remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #fff;
    border: none;
    border-radius: 50%;
    padding: 0;
    line-height: 1;
    font-size: 1.15rem;
    color: var(--red);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    z-index: 2;
}
.ts-photo-remove-btn:hover { color: #dc2626; }
.ts-photo-add-more {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    border: 2px dashed rgba(99,102,241,0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(99,102,241,0.04);
    transition: border-color .2s;
}
.ts-photo-add-more:hover { border-color: var(--brand-color); }

/* --- Manager Overview & Job Detail: notes + photos --- */
/* Daily Overview — duty timeline */
.ts-duty-timeline {
    margin-top: 4px;
    padding-left: 16px;
    border-left: 2px solid #e2e8f0;
}
.ts-duty-timeline-item {
    position: relative;
    padding: 0 0 14px 18px;
}
.ts-duty-timeline-item:last-child { padding-bottom: 0; }
.ts-duty-timeline-dot {
    position: absolute;
    left: -24px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #cbd5e1;
    border: 2px solid #fff;
}
.ts-duty-timeline-dot.active {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.2);
}
.ts-duty-timeline-active { }
.ts-duty-timeline-content {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
}
.ts-duty-timeline-active .ts-duty-timeline-content {
    background: rgba(16,185,129,0.04);
    border-color: rgba(16,185,129,0.2);
}
.ts-duty-timeline-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}
.ts-duty-timeline-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
}
.ts-duty-timeline-job {
    font-size: 0.78rem;
    font-weight: 600;
    color: #6366f1;
    margin-left: 6px;
}
.ts-duty-timeline-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.ts-duty-timeline-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.ts-duty-timeline-dur {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--brand-color);
    background: rgba(99,102,241,0.08);
    padding: 1px 8px;
    border-radius: 20px;
    white-space: nowrap;
}
.ts-duty-timeline-dur.active {
    color: #10b981;
    background: rgba(16,185,129,0.1);
}
.ts-duty-timeline-notes {
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.5;
    padding: 6px 10px;
    background: rgba(99,102,241,0.04);
    border-radius: 8px;
    border-left: 3px solid rgba(99,102,241,0.2);
}
.ts-duty-timeline-photos {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.ts-duty-timeline-photo {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}
.ts-duty-timeline-photo:hover {
    transform: scale(1.08);
    border-color: var(--brand-color);
}

/* Legacy compat */
.ts-overview-note {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.5;
    padding: 4px 0 2px 0;
}
.ts-overview-photos {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 4px 0;
}
.ts-overview-photo-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    border: 1.5px solid var(--brand-color);
    cursor: pointer;
    transition: transform 0.15s;
}
.ts-overview-photo-thumb:hover {
    transform: scale(1.15);
}
.ts-job-detail-entry {
    padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.ts-job-detail-entry:last-child {
    border-bottom: none;
}

/* Upload spinner */
.ts-spin {
    display: inline-block;
    animation: ts-spin-anim 1s linear infinite;
}
@keyframes ts-spin-anim {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
