/* IAMMAN Employee Portal — reuses the same shared CSS custom properties
   (--bg, --bg-card, --accent, --text, ...) defined on :root in
   dashboard.html, same as Creative/Planner, so it stays visually
   consistent with the rest of the app (spec §34: "ใช้ IAMMAN Design
   System เดิม") without a separate palette. Mobile-first per spec §35 —
   Check In/Out especially needs big, thumb-friendly buttons. */

.ep-root { color: var(--text); background: var(--bg); min-height: 100vh; font-size: 14px; }
.ep-shell { display: flex; min-height: 100vh; }

.ep-sidebar {
  width: 232px; flex-shrink: 0; background: var(--bg-elev);
  border-right: 1px solid var(--border); padding: 18px 12px; min-height: 100vh;
  position: sticky; top: 0; align-self: flex-start; transition: width 0.15s ease;
  display: flex; flex-direction: column; justify-content: space-between;
}
.ep-sidebar-top { display: flex; flex-direction: column; }
.ep-sidebar-bottom { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.ep-sidebar.collapsed { width: 64px; }
.ep-sidebar.collapsed .ep-sidebar-bottom { display: none; }
.ep-sidebar-brand { display: flex; align-items: center; gap: 8px; padding: 4px 8px 18px; white-space: nowrap; overflow: hidden; }
.ep-sidebar-brand img { width: 30px; height: 30px; border-radius: 8px; }
.ep-sidebar-brand .label { font-weight: 800; font-size: 14px; }
.ep-sidebar-brand .label b { color: var(--accent); }
.ep-sidebar.collapsed .ep-sidebar-brand .label { display: none; }

.ep-group-label { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); padding: 14px 10px 6px; white-space: nowrap; overflow: hidden; }
.ep-sidebar.collapsed .ep-group-label { display: none; }
.ep-nav-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  font: inherit; background: transparent; border: none; border-left: 3px solid transparent;
  color: var(--text-dim); padding: 9px 10px; border-radius: 0 9px 9px 0; cursor: pointer; font-size: 13.5px;
  white-space: nowrap; overflow: hidden; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.ep-nav-btn:hover { background: var(--bg-card); color: var(--text); }
.ep-nav-btn.active { background: rgba(255, 230, 0, 0.12); color: var(--accent); font-weight: 600; border-left-color: var(--accent); }
.ep-nav-btn .icon { flex-shrink: 0; width: 18px; text-align: center; }
.ep-sidebar.collapsed .ep-nav-btn .label { display: none; }

.ep-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ep-header { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.ep-collapse-btn { font: inherit; background: transparent; border: 1px solid var(--border); color: var(--text-dim); border-radius: 8px; padding: 6px 9px; cursor: pointer; }
.ep-header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.ep-header button { font: inherit; background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-size: 12.5px; }
.ep-header button:hover { border-color: var(--accent); }
.ep-btn-danger { border-color: rgba(239, 68, 68, 0.4) !important; color: var(--red) !important; }

.ep-notif-wrap { position: relative; }
.ep-notif-bell { position: relative; font-size: 15px; }
.ep-notif-badge { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-size: 9.5px; font-weight: 700; border-radius: 999px; padding: 1px 5px; min-width: 14px; text-align: center; }
.ep-notif-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 320px; max-height: 380px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); z-index: 30; display: flex; flex-direction: column; }
.ep-notif-panel-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.ep-notif-list { overflow-y: auto; }
.ep-notif-item { padding: 10px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-size: 12.5px; cursor: pointer; }
.ep-notif-item:hover { background: rgba(255, 255, 255, 0.03); }
.ep-notif-item.read { opacity: 0.55; }
.ep-notif-item:last-child { border-bottom: none; }

.ep-content { flex: 1; padding: 22px; overflow-y: auto; max-width: 980px; }
.ep-greet { margin-bottom: 18px; }
.ep-greet h2 { margin: 0 0 4px; font-size: 20px; }
.ep-greet p, .ep-hint { margin: 0; color: var(--text-dim); font-size: 12.5px; }
.ep-greet-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ep-btn-secondary { font: inherit; background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-size: 12.5px; }
.ep-btn-secondary:hover { border-color: var(--accent); }
.ep-btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
.ep-section { margin-bottom: 24px; }
.ep-section h3 { margin: 0 0 10px; font-size: 14px; }

.ep-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.ep-empty { text-align: center; padding: 30px 10px; color: var(--text-faint); }

.ep-status-card { display: flex; align-items: center; gap: 14px; border-width: 1px; }
.ep-status-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.ep-status-label { font-size: 17px; font-weight: 800; }
.ep-status-time { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }

.ep-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.ep-kpi { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.ep-kpi .n { font-size: 24px; font-weight: 800; }
.ep-kpi .l { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.ep-holiday-row { padding: 6px 0; font-size: 13px; }

/* Check In/Out — big, thumb-friendly, mobile-first (spec §6/§35) */
.ep-checkin-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px 24px; text-align: center; max-width: 420px; }
.ep-checkin-date { color: var(--text-dim); font-size: 13px; margin-bottom: 8px; }
.ep-checkin-clock { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; margin-bottom: 18px; }
.ep-checkin-info { color: var(--text-dim); font-size: 13px; margin-bottom: 6px; }
.ep-checkin-btn {
  width: 100%; padding: 20px; border-radius: 16px; font-size: 17px; font-weight: 800; cursor: pointer;
  border: none; margin-top: 14px; transition: transform 0.08s ease, filter 0.15s ease;
}
.ep-checkin-btn:active { transform: scale(0.97); }
.ep-checkin-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ep-checkin-btn-in { background: var(--green); color: #06240f; }
.ep-checkin-btn-out { background: var(--red); color: #2b0505; }
.ep-checkin-done { margin-top: 14px; color: var(--green); font-weight: 700; }

/* My Attendance calendar */
.ep-cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ep-cal-title { font-size: 15px; font-weight: 700; }
.ep-cal-nav { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 16px; }
.ep-cal-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; font-size: 11px; color: var(--text-dim); }
.ep-cal-legend-item { display: flex; align-items: center; gap: 5px; }
.ep-cal-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.ep-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.ep-cal-dow { text-align: center; font-size: 11px; color: var(--text-faint); padding: 6px 0; }
.ep-cal-cell {
  aspect-ratio: 1; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  cursor: pointer; color: var(--text); font: inherit;
}
.ep-cal-cell:hover { border-color: var(--accent); }
.ep-cal-cell.active { border-color: var(--accent); background: rgba(255, 230, 0, 0.08); }
.ep-cal-blank { background: transparent; border: none; cursor: default; }
.ep-cal-daynum { font-size: 12.5px; }
.ep-detail-title { font-weight: 700; margin-bottom: 10px; }
.ep-detail-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.ep-detail-row:last-child { border-bottom: none; }
.ep-detail-row span { color: var(--text-dim); }

/* Leave Request form */
.ep-form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.ep-form-field label { font-size: 12px; color: var(--text-dim); }
.ep-form-field input, .ep-form-field select, .ep-form-field textarea {
  font: inherit; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: 10px;
}
.ep-form-field textarea { min-height: 80px; resize: vertical; }
.ep-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ep-checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); margin-bottom: 14px; cursor: pointer; }
.ep-btn-primary { width: 100%; padding: 12px; border-radius: 10px; border: none; background: var(--accent); color: #1a1408; font-weight: 700; font-size: 14px; cursor: pointer; }
.ep-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* Leave Balance */
.ep-balance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.ep-balance-title { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.ep-balance-days { font-size: 20px; font-weight: 800; margin-bottom: 10px; }
.ep-progress { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.ep-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* My Requests table */
.ep-table { width: 100%; border-collapse: collapse; font-size: 12.5px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ep-table th { text-align: left; color: var(--text-faint); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.03em; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.ep-table td { padding: 10px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.ep-table tr:last-child td { border-bottom: none; }
.ep-badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.ep-badge.waiting { background: rgba(148, 163, 184, 0.15); color: var(--text-dim); }
.ep-badge.completed { background: rgba(34, 197, 94, 0.15); color: var(--green); }
.ep-badge.failed { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.ep-link-btn { background: none; border: none; color: var(--blue); cursor: pointer; font-size: 12px; padding: 0; }

/* Company Holidays */
.ep-holiday-list { display: flex; flex-direction: column; gap: 8px; }
.ep-holiday-card { display: flex; align-items: center; gap: 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
.ep-holiday-date { font-weight: 700; color: var(--accent); font-size: 13px; min-width: 70px; }
.ep-holiday-name { font-size: 13.5px; }

/* My Profile */
.ep-profile-name { font-size: 18px; font-weight: 800; }
.ep-profile-lang-label { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); margin: 4px 0 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.ep-profile-avatar-btn {
  position: relative; width: 64px; height: 64px; border-radius: 50%; padding: 0; border: 2px solid var(--border);
  background: var(--bg-elev); cursor: pointer; overflow: hidden; flex-shrink: 0;
}
.ep-profile-avatar-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ep-profile-avatar-initial { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 24px; font-weight: 800; color: var(--accent); background: rgba(255, 230, 0, 0.12); }
.ep-profile-avatar-overlay {
  position: absolute; inset: auto 0 0 0; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 12px;
  text-align: center; padding: 3px 0; opacity: 0; transition: opacity 0.15s ease;
}
.ep-profile-avatar-btn:hover .ep-profile-avatar-overlay { opacity: 1; }
.ep-profile-avatar-btn:disabled { cursor: not-allowed; opacity: 0.7; }

/* Payroll — salary certificate / payslip print view. A real letter-size
   white "page" over a dark overlay, since these are formal documents meant
   to be printed/saved as PDF, not styled like the rest of the dark UI. */
.ep-print-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75); z-index: 200;
  display: flex; flex-direction: column; align-items: center; overflow-y: auto; padding: 24px 16px;
}
.ep-print-toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.ep-print-toolbar button { font: inherit; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); cursor: pointer; }
.ep-print-doc {
  background: #fff; color: #111; width: 210mm; max-width: 100%; min-height: 297mm;
  padding: 20mm; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); font-size: 14px; line-height: 1.6;
}
.ep-print-company { font-size: 20px; font-weight: 800; }
.ep-print-info, .ep-print-slip { width: 100%; border-collapse: collapse; margin-top: 14px; }
.ep-print-info td { padding: 4px 8px 4px 0; }
.ep-print-slip th, .ep-print-slip td { padding: 8px; border-bottom: 1px solid #ddd; text-align: left; }
.ep-print-slip th { background: #f5f5f5; }

@media print {
  body * { visibility: hidden; }
  .ep-print-doc, .ep-print-doc * { visibility: visible; }
  .ep-print-overlay { position: static; background: none; padding: 0; }
  .ep-print-doc { position: absolute; top: 0; left: 0; width: 100%; box-shadow: none; padding: 10mm; }
  .ep-print-toolbar { display: none; }
}

@media (max-width: 720px) {
  /* Hidden off-canvas by default (was always-visible + fixed, permanently
     covering ~60% of a phone screen with no way to dismiss it) — opens via
     the .open class (mobileDrawerOpen state), same pattern as the classic
     dashboard's .man-sidebar / .ct-sidebar. */
  .ep-sidebar { position: fixed; left: 0; top: 0; z-index: 20; height: 100vh; width: 232px !important; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 0 0 40px rgba(0,0,0,0.5); }
  .ep-sidebar.open { transform: translateX(0); }
  .ep-content { padding: 16px; }
  .ep-form-row { grid-template-columns: 1fr; }
  .ep-checkin-clock { font-size: 36px; }
}
