/* ── Reset / base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0d0f12;
  --surface:  #161a1f;
  --surface2: #1e2329;
  --border:   #2a2f38;
  --accent:   #019496;
  --accent2:  #01aeb0;
  --text:     #e8eaed;
  --muted:    #7a8494;
  --danger:   #e05252;
  --warn:     #e09c38;
  --success:  #3ec97e;
  --radius:   10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

/* ── Login gate ───────────────────────────────────────────────────────────── */
#login-gate {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 340px;
  text-align: center;
}

/* Brand mark in login */
.emp-brand-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 7px;
  flex-shrink: 0;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.login-card .wordmark {
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.login-card h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 28px;
}

.login-card input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 10px;
  outline: none;
  transition: border-color .15s;
}

.login-card input:focus { border-color: var(--accent); }

.login-card button {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  transition: opacity .15s;
}

.login-card button:hover { opacity: .88; }

.login-card .hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 14px;
}

#login-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin-top: 8px;
}

/* ── App shell ────────────────────────────────────────────────────────────── */
#app { display: none; min-height: 100vh; }

/* ── Top bar ──────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.topbar .brand {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.topbar .brand-sub {
  font-size: 0.67rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Status pill */
@keyframes emp-dot-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

.emp-status-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(1,148,150,0.1);
  border: 1px solid rgba(1,148,150,0.25);
  border-radius: 20px;
  padding: 3px 9px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.emp-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: emp-dot-pulse 2.4s ease-in-out infinite;
  flex-shrink: 0;
}

.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar .user-name {
  font-size: 13px;
  color: var(--muted);
}

.notif-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  transition: color .15s;
}

.notif-btn:hover { color: var(--text); }

.notif-badge {
  position: absolute;
  top: 0; right: 0;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 99px;
  min-width: 16px;
  height: 16px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

.logout-btn {
  background: rgba(224,90,90,.1);
  border: 1px solid rgba(224,90,90,.3);
  color: #e06060;
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.logout-btn:hover { background: rgba(224,90,90,.2); border-color: #e06060; }

/* ── Nav tabs ─────────────────────────────────────────────────────────────── */
.nav-tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 12px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}

.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Page panels ──────────────────────────────────────────────────────────── */
.page { display: none; padding: 28px 28px; max-width: 960px; margin: 0 auto; }
.page.active { display: block; }

/* ── Section headers ──────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-header h2 {
  font-size: 18px;
  font-weight: 600;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 14px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Form ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color .15s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--accent); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Status badges ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-pending  { background: rgba(224,156,56,.15);  color: var(--warn); }
.badge-approved { background: rgba(62,201,126,.15);  color: var(--success); }
.badge-rejected { background: rgba(224,82,82,.15);   color: var(--danger); }
.badge-active   { background: rgba(0,180,160,.15);   color: var(--accent); }
.badge-completed{ background: rgba(122,132,148,.15); color: var(--muted); }

/* ── Table ────────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }

/* ── Task item ────────────────────────────────────────────────────────────── */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.task-item:last-child { border-bottom: none; }

.task-check {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.task-check.done { background: var(--accent); border-color: var(--accent); }
.task-check.done::after { content: '✓'; color: #fff; font-size: 11px; }

.task-body { flex: 1; }
.task-title { font-size: 14px; font-weight: 500; }
.task-title.done { text-decoration: line-through; color: var(--muted); }
.task-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }

.task-actions { display: flex; gap: 6px; }

/* ── Notification panel ───────────────────────────────────────────────────── */
#notif-panel {
  position: fixed;
  top: 56px; right: 0;
  width: 340px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 40;
  display: none;
  flex-direction: column;
}
#notif-panel.open { display: flex; }

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  position: sticky; top: 0;
  background: var(--surface);
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.notif-item:hover { background: var(--surface2); }
.notif-item.unread { border-left: 3px solid var(--accent); }
.notif-item.unread.action { border-left-color: var(--warn); }

.notif-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.notif-body  { font-size: 12px; color: var(--muted); }
.notif-time  { font-size: 11px; color: var(--muted); margin-top: 4px; }
.notif-empty { padding: 32px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* ── Project cards ────────────────────────────────────────────────────────── */
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  cursor: pointer;
  transition: border-color .15s;
}
.project-card:hover { border-color: var(--accent); }
.project-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.project-card .meta { font-size: 12px; color: var(--muted); display: flex; gap: 16px; }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.empty-state .icon { font-size: 36px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Light mode ───────────────────────────────────────────────────────────── */
body.theme-light {
  --bg:       #f4f6f5;
  --surface:  #ffffff;
  --surface2: #eef1f0;
  --border:   #d4dedd;
  --text:     #0f1a1a;
  --muted:    #5a6a6a;
}
body.theme-light .topbar { box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
body.theme-light .login-card { box-shadow: 0 2px 12px rgba(0,0,0,0.06); }

/* ── PIN change button (topbar) ──────────────────────────────────────────── */
.pin-change-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.pin-change-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Theme toggle button (topbar) ─────────────────────────────────────────── */
.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 15px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.theme-toggle-btn:hover { color: var(--text); border-color: var(--accent); }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warn { color: var(--warn); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
