/* ═══════════════════════════════════════════════════
   UC Team — app.css v4.0
   Full-screen, sticky header, fully responsive
═══════════════════════════════════════════════════ */

:root {
  --p:      #6366f1;
  --p-dk:   #4f46e5;
  --p-lt:   #eef2ff;
  --p-mid:  #c7d2fe;
  --ok:     #10b981;
  --warn:   #f59e0b;
  --bad:    #ef4444;
  --info:   #3b82f6;
  --bg:     #f8fafc;
  --surf:   #ffffff;
  --bd:     #e2e8f0;
  --bd2:    #f1f5f9;
  --text:   #0f172a;
  --muted:  #64748b;
  --light:  #94a3b8;
  --sb-w:   242px;
  --top-h:  58px;
  --r:      10px;
  --r-sm:   6px;
  --r-lg:   16px;
  --sh:     0 1px 4px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
  --sh-lg:  0 8px 32px rgba(0,0,0,.14);
  --tr:     .16s ease;
  --font:   -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Full-screen app shell — sits flush on the page ────────────── */
/* Strip WP chrome for non-system-admins */
body.tfp-active { margin: 0 !important; padding: 0 !important; overflow: hidden !important; }
body.tfp-active #wpadminbar       { display: none !important; }
body.tfp-active #wp-toolbar        { display: none !important; }
body.tfp-active .wp-admin-bar      { display: none !important; }
body.tfp-active .site-header,
body.tfp-active header,
body.tfp-active .entry-header,
body.tfp-active .site-footer,
body.tfp-active footer             { display: none !important; }
body.tfp-active #page,
body.tfp-active #content,
body.tfp-active .site,
body.tfp-active .hfeed,
body.tfp-active main               { padding: 0 !important; margin: 0 !important; }

/* Admins keep their WP bar — app adjusts */
body.tfp-active.admin-bar { margin-top: 0 !important; }

.tfp {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  z-index: 99999;
  overflow: hidden;
}
.tfp *, .tfp *::before, .tfp *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* System admin keeps WP bar — shift app down */
body.tfp-active.tfp-sys-admin #wpadminbar { display: block !important; }
body.tfp-active.tfp-sys-admin .tfp {
  top: var(--wp-admin--admin-bar--height, 32px) !important;
  height: calc(100vh - var(--wp-admin--admin-bar--height, 32px)) !important;
}

/* ── Sidebar overlay ───────────────────────────── */
.tfp-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9100;
  opacity: 0;
  transition: opacity var(--tr);
}
.tfp-overlay.show { opacity: 1; pointer-events: all; }

/* ── Sidebar ────────────────────────────────────── */
.tfp-sidebar {
  width: var(--sb-w);
  min-width: var(--sb-w);
  background: var(--surf);
  border-right: 1px solid var(--bd);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  z-index: 9200;
  transition: transform var(--tr);
}
.tfp-sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: var(--top-h);
  border-bottom: 1px solid var(--bd2);
  flex-shrink: 0;
  font-weight: 800;
  font-size: 16px;
}
.tfp-sb-brand svg { flex-shrink: 0; }
.tfp-sb-brand span { flex: 1; }
.tfp-sb-x {
  background: none; border: none; cursor: pointer; color: var(--muted);
  display: none; width: 28px; height: 28px; align-items: center; justify-content: center;
  border-radius: 6px; flex-shrink: 0;
}
.tfp-sb-x:hover { background: var(--bd2); color: var(--text); }
.tfp-nav { flex: 1; padding: 10px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.tfp-nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: var(--r-sm); color: var(--muted); text-decoration: none;
  font-weight: 500; font-size: 13.5px; transition: background var(--tr), color var(--tr);
  white-space: nowrap;
}
.tfp-nav-link:hover { background: var(--bd2); color: var(--text); }
.tfp-nav-link.active { background: var(--p-lt); color: var(--p); font-weight: 600; }
.tfp-nav-link svg { flex-shrink: 0; color: currentColor; }
.tfp-sb-foot { border-top: 1px solid var(--bd); padding: 12px; flex-shrink: 0; }
.tfp-sb-user { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.tfp-sb-user img { border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.tfp-sb-user-info { flex: 1; min-width: 0; }
.tfp-sb-user-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tfp-icon-btn {
  background: none; border: none; cursor: pointer; color: var(--muted);
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; flex-shrink: 0; transition: all var(--tr); text-decoration: none;
}
.tfp-icon-btn:hover { background: var(--bd2); color: var(--text); }
.tfp-logout-link {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: var(--r-sm); color: var(--muted); text-decoration: none;
  font-size: 13px; font-weight: 500; width: 100%; transition: all var(--tr);
}
.tfp-logout-link:hover { background: #fef2f2; color: var(--bad); }

/* Role pills */
.tfp-role-pill { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; }
.tfp-role-administrator { background: #fef3c7; color: #92400e; }
.tfp-role-tfp_manager   { background: var(--p-lt); color: var(--p-dk); }
.tfp-role-tfp_member    { background: var(--bd2); color: var(--muted); }

/* ── Topbar ─────────────────────────────────────── */
.tfp-main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.tfp-topbar {
  height: var(--top-h); background: var(--surf); border-bottom: 1px solid var(--bd);
  display: flex; align-items: center; padding: 0 16px; gap: 12px; flex-shrink: 0; z-index: 100;
}
.tfp-topbar-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.tfp-topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tfp-hamburger {
  background: none; border: none; cursor: pointer; color: var(--muted);
  width: 36px; height: 36px; display: none; align-items: center; justify-content: center;
  border-radius: var(--r-sm); flex-shrink: 0; transition: all var(--tr);
}
.tfp-hamburger:hover { background: var(--bd2); color: var(--text); }
.tfp-back-btn {
  background: none; border: 1.5px solid var(--bd); cursor: pointer; color: var(--muted);
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); flex-shrink: 0; transition: all var(--tr);
}
.tfp-back-btn:hover { background: var(--bd2); color: var(--text); border-color: var(--muted); }
.tfp-page-title { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tfp-search-box {
  display: flex; align-items: center; gap: 7px; background: var(--bg);
  border: 1.5px solid var(--bd); border-radius: var(--r-sm); padding: 0 10px; height: 34px;
}
.tfp-search-box svg { flex-shrink: 0; color: var(--light); }
.tfp-search-box input { border: none; background: none; outline: none; font-size: 13px; width: 180px; color: var(--text); }
.tfp-notif-btn {
  position: relative; background: none; border: none; cursor: pointer; color: var(--muted);
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); transition: all var(--tr);
}
.tfp-notif-btn:hover { background: var(--bd2); color: var(--text); }
.tfp-notif-badge {
  position: absolute; top: 4px; right: 4px; background: var(--bad); color: #fff;
  font-size: 9px; font-weight: 800; border-radius: 10px; min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}
.tfp-topbar-logout-btn {
  display: flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  color: var(--muted); border-radius: var(--r-sm); transition: all var(--tr); text-decoration: none;
}
.tfp-topbar-logout-btn:hover { background: #fef2f2; color: var(--bad); }

/* Notif panel */
.tfp-notif-panel {
  position: fixed; right: 16px; top: var(--top-h); width: 340px;
  background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r-lg);
  box-shadow: var(--sh-lg); z-index: 9500; display: none; max-height: 420px; overflow-y: auto;
}
.tfp-notif-panel.open { display: block; }
.tfp-notif-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--bd); }
.tfp-notif-item { padding: 11px 16px; border-bottom: 1px solid var(--bd2); cursor: pointer; transition: background var(--tr); }
.tfp-notif-item:hover { background: var(--bg); }
.tfp-notif-item.unread { background: var(--p-lt); }
.tfp-notif-msg { font-size: 13px; }
.tfp-notif-time { font-size: 11px; color: var(--light); margin-top: 3px; }

/* ── Content area ───────────────────────────────── */
.tfp-content { flex: 1; overflow-y: auto; }
.tfp-view { display: none; padding: 20px 24px; }
.tfp-view.active { display: block; }

/* ── Section header ─────────────────────────────── */
.tfp-section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.tfp-section-h { font-size: 18px; font-weight: 800; }
.tfp-auto-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }

/* ── Stats grid ─────────────────────────────────── */
.tfp-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 12px; margin-bottom: 20px; }
.tfp-stat { background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r); padding: 14px 16px; }
.tfp-stat.s-ok   { border-left: 4px solid var(--ok); }
.tfp-stat.s-bad  { border-left: 4px solid var(--bad); }
.tfp-stat.s-warn { border-left: 4px solid var(--warn); }
.tfp-stat.s-p    { border-left: 4px solid var(--p); }
.tfp-stat-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 4px; }
.tfp-stat-val { font-size: 26px; font-weight: 900; line-height: 1; }
.tfp-stat-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ── Dashboard grid ─────────────────────────────── */
.tfp-dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 16px; }
.tfp-card { background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r); padding: 16px; }
.tfp-card.full { grid-column: 1 / -1; }
.tfp-card-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 12px; }

/* Attendance widget on dashboard */
.tfp-attendance-widget {
  background: linear-gradient(135deg, #eef2ff 0%, #f0fdf4 100%);
  border: 1.5px solid var(--p-mid);
  border-radius: var(--r);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tfp-att-info { font-size: 14px; font-weight: 600; flex: 1; }
.tfp-att-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.tfp-btn-success { background: var(--ok); color: #fff; }
.tfp-btn-success:hover { background: #059669; }

/* Workload */
.tfp-wl-item { margin-bottom: 11px; }
.tfp-wl-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.tfp-wl-hd img { border-radius: 50%; }
.tfp-wl-name { flex: 1; font-size: 13px; font-weight: 600; }
.tfp-wl-cnt { font-size: 12px; color: var(--muted); }
.tfp-wl-bar-bg { height: 5px; background: var(--bd); border-radius: 4px; }
.tfp-wl-bar { height: 5px; background: var(--p); border-radius: 4px; transition: width .4s ease; }
.tfp-wl-bar.over { background: var(--bad); }

/* Productivity ring */
.tfp-ring-row { display: flex; align-items: center; gap: 16px; }
.tfp-ring-wrap { position: relative; flex-shrink: 0; }
.tfp-ring-bg { fill: none; stroke: var(--bd2); stroke-width: 7; }
.tfp-ring-fg { fill: none; stroke: var(--p); stroke-width: 7; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset .6s ease; }
.tfp-ring-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 900; }

/* Due soon */
.tfp-due-item { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--bd2); cursor: pointer; }
.tfp-due-item:last-child { border-bottom: none; }
.tfp-due-title { flex: 1; font-size: 13px; }
.tfp-due-date { font-size: 12px; color: var(--muted); }

/* Activity */
.tfp-act-item { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--bd2); }
.tfp-act-item:last-child { border-bottom: none; }
.tfp-act-item img { border-radius: 50%; flex-shrink: 0; }
.tfp-act-body { flex: 1; font-size: 13px; }
.tfp-act-time { font-size: 11px; color: var(--light); white-space: nowrap; }

/* ── Kanban ──────────────────────────────────────── */
.tfp-kanban-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.tfp-kanban-filters { display: flex; gap: 10px; flex-wrap: wrap; }
.tfp-board { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; overflow-x: auto; }
.tfp-col { background: var(--bg); border-radius: var(--r); padding: 10px; min-height: 200px; }
.tfp-col-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.tfp-col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tfp-dot-todo { background: var(--light); }
.tfp-dot-inprogress { background: var(--info); }
.tfp-dot-review { background: var(--warn); }
.tfp-dot-completed { background: var(--ok); }
.tfp-col-count { background: var(--bd); border-radius: 10px; padding: 1px 7px; font-size: 11px; }
.tfp-col-cards { min-height: 60px; display: flex; flex-direction: column; gap: 8px; }
.tfp-col-cards.drag-over { background: var(--p-lt); border-radius: var(--r-sm); }
.tfp-task-card { background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r-sm); padding: 10px; cursor: pointer; transition: box-shadow var(--tr), transform var(--tr); }
.tfp-task-card:hover { box-shadow: var(--sh); transform: translateY(-1px); }
.tfp-task-card.is-overdue { border-left: 3px solid var(--bad); }
.tfp-task-card.dragging { opacity: .5; transform: scale(.97); }
.tfp-tc-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.tfp-tc-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tfp-tc-avatar img { width: 20px; height: 20px; border-radius: 50%; }
.tfp-tc-dl { font-size: 11px; color: var(--muted); }
.tfp-tc-dl.overdue { color: var(--bad); font-weight: 700; }

/* ── Task List ──────────────────────────────────── */
.tfp-list-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.tfp-list-bar .tfp-input { max-width: 220px; }
.tfp-task-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r-sm); cursor: pointer; transition: box-shadow var(--tr); flex-wrap: wrap; }
.tfp-task-row:hover { box-shadow: var(--sh); }
.tfp-task-row + .tfp-task-row { margin-top: 6px; }
.tfp-task-row-title { flex: 1; font-weight: 600; font-size: 13px; min-width: 120px; }
.tfp-task-row-project { font-size: 11px; background: var(--p-lt); color: var(--p); padding: 2px 7px; border-radius: 10px; }
.tfp-task-row-avatar img { width: 22px; height: 22px; border-radius: 50%; }
.tfp-task-row-dl { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tfp-task-row-dl.overdue { color: var(--bad); font-weight: 700; }

/* ── Create Task ─────────────────────────────────── */
.tfp-create-page { max-width: 720px; }
.tfp-create-header { margin-bottom: 24px; }
.tfp-create-header h2 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.tfp-create-header p { color: var(--muted); font-size: 13px; }
.tfp-direct-form .tfp-fg { margin-bottom: 16px; }
.tfp-direct-form label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.tfp-direct-form .req { color: var(--bad); }
.tfp-fg-row { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 14px; }
.tfp-fg-actions { display: flex; gap: 10px; margin-top: 22px; }

/* ── Projects ──────────────────────────────────── */
.tfp-project-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); gap: 16px; }
.tfp-project-card { background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r); overflow: hidden; }
.tfp-project-color-bar { height: 5px; }
.tfp-project-body { padding: 14px 16px; }
.tfp-project-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.tfp-project-desc { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.tfp-project-meta { display: flex; gap: 6px; }

/* ── Attendance ──────────────────────────────────── */
.tfp-att-table-wrap { overflow-x: auto; }
.tfp-table { width: 100%; border-collapse: collapse; }
.tfp-table th { background: var(--bg); text-align: left; padding: 9px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); border-bottom: 1.5px solid var(--bd); white-space: nowrap; }
.tfp-table td { padding: 9px 12px; border-bottom: 1px solid var(--bd2); font-size: 13px; }
.tfp-table tr:last-child td { border-bottom: none; }
.tfp-table tr:hover td { background: var(--bg); }
.tfp-attendance-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── Calendar / Holidays ────────────────────────── */
.tfp-calendar-wrap { }
.tfp-holiday-list { display: grid; grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); gap: 14px; }
.tfp-holiday-month { background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r); padding: 14px; }
.tfp-holiday-month-name { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--p); margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--bd2); }
.tfp-holiday-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--bd2); }
.tfp-holiday-item:last-child { border-bottom: none; }
.tfp-holiday-date { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 800; flex-shrink: 0; }
.tfp-holiday-info { flex: 1; }
.tfp-holiday-title { font-size: 13px; font-weight: 600; }
.tfp-holiday-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tfp-holiday-none { font-size: 12px; color: var(--light); padding: 4px 0; }

/* ── Leave Management ─────────────────────────── */
.tfp-badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--bd); color: var(--muted); }
.tfp-badge.s-ok  { background: #dcfce7; color: #166534; }
.tfp-badge.s-bad { background: #fee2e2; color: #b91c1c; }
.tfp-badge.s-warn{ background: #fef3c7; color: #92400e; }
.tfp-btn-xs { padding: 3px 8px; font-size: 11px; }

/* ── Export ────────────────────────────────────── */
.tfp-export-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(280px,1fr)); gap: 16px; }
.tfp-export-card { background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r); padding: 18px; display: flex; align-items: center; gap: 14px; }
.tfp-export-icon { font-size: 28px; flex-shrink: 0; }
.tfp-export-info { flex: 1; }
.tfp-export-title { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.tfp-export-desc { font-size: 12px; color: var(--muted); }
.tfp-export-btn { flex-shrink: 0; white-space: nowrap; }

/* ── Time tracker ──────────────────────────────── */
.tfp-time-page { display: flex; flex-direction: column; gap: 20px; max-width: 800px; }
.tfp-active-timer-card { background: var(--surf); border: 1.5px solid var(--p); border-radius: var(--r); padding: 20px; text-align: center; }
.tfp-timer-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--p); margin-bottom: 8px; }
.tfp-timer-clock { font-size: 44px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--text); margin-bottom: 6px; }
.tfp-timer-task-name { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.tfp-manual-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tfp-manual-row .tfp-input { flex: 1; min-width: 70px; }
.tfp-manual-badge { background: var(--bd); color: var(--muted); font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 10px; text-transform: uppercase; }

/* ── Team hierarchy ───────────────────────────── */
.tfp-team-hierarchy { }
.tfp-team-controls { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.tfp-hier-section { margin-bottom: 28px; }
.tfp-hier-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--bd); }
.tfp-team-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 14px; }
.tfp-team-card { background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r); padding: 16px; text-align: center; }
.tfp-team-card img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 3px solid var(--bd); margin-bottom: 10px; }
.tfp-team-card-name { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.tfp-team-card-job  { font-size: 12px; color: var(--muted); }
.tfp-team-card-dept { font-size: 11px; color: var(--light); margin-bottom: 6px; }
.tfp-avail-badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.tfp-avail-available { background: #dcfce7; color: #166534; }
.tfp-avail-busy      { background: #fee2e2; color: #b91c1c; }
.tfp-avail-away      { background: #fef3c7; color: #92400e; }
.tfp-team-card-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.tfp-team-card-actions .tfp-btn { width: 100%; }

/* ── Automations ───────────────────────────────── */
.tfp-auto-card { display: flex; align-items: center; gap: 12px; background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r-sm); padding: 14px 16px; margin-bottom: 8px; }
.tfp-auto-icon { font-size: 22px; flex-shrink: 0; }
.tfp-auto-info { flex: 1; }
.tfp-auto-name { font-size: 14px; font-weight: 700; }
.tfp-auto-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tfp-auto-meta { font-size: 11px; color: var(--light); margin-top: 3px; }
.tfp-toggle { position: relative; display: inline-flex; width: 36px; height: 20px; flex-shrink: 0; cursor: pointer; }
.tfp-toggle input { opacity: 0; width: 0; height: 0; }
.tfp-toggle-sl { position: absolute; inset: 0; background: var(--bd); border-radius: 20px; transition: background var(--tr); }
.tfp-toggle-sl:before { content:''; position:absolute; width:14px; height:14px; left:3px; top:3px; background:#fff; border-radius:50%; transition:transform var(--tr); }
.tfp-toggle input:checked + .tfp-toggle-sl { background: var(--p); }
.tfp-toggle input:checked + .tfp-toggle-sl:before { transform: translateX(16px); }

/* ── Drawer ─────────────────────────────────────── */
.tfp-drawer-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 9300; }
.tfp-drawer-backdrop.show { display: block; }
.tfp-drawer {
  position: fixed; top: 0; right: 0; width: 420px; max-width: 100vw;
  height: 100%; background: var(--surf); box-shadow: var(--sh-lg);
  transform: translateX(100%); z-index: 9400;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.tfp-drawer.open { transform: none; }
.tfp-drawer-inner { overflow-y: auto; flex: 1; padding: 20px; position: relative; }

/* Close bar at top of drawer */
.tfp-drawer-close-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--bd);
}
.tfp-drawer-close-title { font-size: 15px; font-weight: 700; flex: 1; line-height: 1.3; }
.tfp-drawer-x-btn { flex-shrink: 0; border-color: var(--bd) !important; }

/* Footer close button */
.tfp-drawer-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--bd);
  background: var(--bg);
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}
.tfp-drawer-close-bottom { width: 100%; justify-content: center; }

/* Drawer content */
.tfp-td-title { font-size: 16px; font-weight: 800; line-height: 1.3; margin-bottom: 10px; }
.tfp-td-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tfp-td-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 14px; }
.tfp-td-meta .lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 2px; }
.tfp-td-meta .val { font-size: 13px; font-weight: 500; }
.tfp-td-sec { margin-bottom: 18px; }
.tfp-td-sec-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding-bottom: 7px; border-bottom: 1px solid var(--bd); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.tfp-st-row { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 16px; }
.tfp-st-btn { padding: 5px 11px; border: 1.5px solid var(--bd); border-radius: 16px; background: none; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted); transition: all var(--tr); }
.tfp-st-btn:hover { border-color: var(--p); color: var(--p); }
.tfp-st-btn.cur { background: var(--p); border-color: var(--p); color: #fff; }
.tfp-st-btn:disabled { opacity: .4; cursor: not-allowed; }
.tfp-td-timer { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: var(--r-sm); padding: 9px 13px; margin-bottom: 14px; flex-wrap: wrap; }
.tfp-td-timer-lbl { flex: 1; font-size: 13px; font-weight: 600; }
.tfp-td-timer-val { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--p); }

/* File links */
.tfp-file-link-item { padding: 4px 0; border-bottom: 1px solid var(--bd2); font-size: 13px; }
.tfp-file-link-item a { color: var(--p); text-decoration: none; word-break: break-all; }
.tfp-file-link-item a:hover { text-decoration: underline; }

/* Subtask inline form */
.tfp-subtask-form { background: var(--bg); border: 1px solid var(--bd); border-radius: var(--r-sm); padding: 12px; margin-top: 8px; }
.tfp-sfg { margin-bottom: 8px; }
.tfp-sfg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Comments */
.tfp-comment { display: flex; gap: 8px; margin-bottom: 12px; }
.tfp-comment img { border-radius: 50%; width: 28px; height: 28px; flex-shrink: 0; }
.tfp-comment-body { flex: 1; }
.tfp-comment-hd { display: flex; align-items: baseline; gap: 7px; margin-bottom: 4px; }
.tfp-comment-author { font-weight: 700; font-size: 12px; }
.tfp-comment-time   { font-size: 11px; color: var(--light); }
.tfp-comment-text   { font-size: 13px; background: var(--bg); border-radius: var(--r-sm); padding: 8px 10px; line-height: 1.6; }
.tfp-comment-replies { margin: 7px 0 0 18px; border-left: 2px solid var(--bd); padding-left: 12px; }
.tfp-reply-btn { background: none; border: none; cursor: pointer; font-size: 11px; color: var(--p); font-weight: 600; margin-top: 4px; padding: 0; }
.tfp-comment-form { display: flex; gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.tfp-comment-form textarea { flex: 1; min-width: 140px; border: 1.5px solid var(--bd); border-radius: var(--r-sm); padding: 7px 10px; font: 13px var(--font); resize: none; outline: none; min-height: 56px; }
.tfp-comment-form textarea:focus { border-color: var(--p); }

/* Subtasks */
.tfp-subtask-item { display: flex; align-items: center; gap: 7px; padding: 5px 0; border-bottom: 1px solid var(--bd2); font-size: 13px; }
.tfp-subtask-item:last-child { border-bottom: none; }
.tfp-subtask-title { flex: 1; }
.tfp-subtask-title.done { text-decoration: line-through; color: var(--muted); }
.tfp-add-sub-btn { width: 100%; background: none; border: 1.5px dashed var(--bd); border-radius: var(--r-sm); padding: 6px; font-size: 12px; color: var(--muted); cursor: pointer; margin-top: 6px; transition: all var(--tr); }
.tfp-add-sub-btn:hover { border-color: var(--p); color: var(--p); }

/* ── Profile ───────────────────────────────────── */
.tfp-profile-wrap { max-width: 700px; display: flex; flex-direction: column; gap: 20px; }
.tfp-profile-header { display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap; margin-bottom: 4px; }
.tfp-avatar-wrap { position: relative; flex-shrink: 0; }
.tfp-avatar-wrap img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid var(--bd); display: block; }
.tfp-avatar-edit-btn { position: absolute; bottom: 0; right: 0; background: var(--p); color: #fff; border: none; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.tfp-avatar-file { display: none; }
.tfp-profile-info { flex: 1; min-width: 200px; }
.tfp-profile-name { font-size: 20px; font-weight: 800; margin-bottom: 3px; }
.tfp-profile-sub  { font-size: 13px; color: var(--muted); }
.tfp-profile-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.tfp-ps { background: var(--bg); border-radius: var(--r-sm); padding: 12px; text-align: center; }
.tfp-ps-val { font-size: 22px; font-weight: 900; }
.tfp-ps-lbl { font-size: 11px; color: var(--muted); }
.tfp-profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Modal ─────────────────────────────────────── */
.tfp-modal-wrap {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 9600;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.tfp-modal {
  background: var(--surf); border-radius: var(--r-lg); box-shadow: var(--sh-lg);
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  animation: modalIn .18s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.tfp-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; border-bottom: 1px solid var(--bd); font-weight: 800; font-size: 15px; }
.tfp-modal-x { background: none; border: none; cursor: pointer; color: var(--muted); display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; }
.tfp-modal-x:hover { background: var(--bd2); color: var(--text); }
.tfp-modal-body { padding: 20px; }
.tfp-modal-foot { padding: 12px 20px; border-top: 1px solid var(--bd); display: flex; gap: 8px; justify-content: flex-end; }
.tfp-mfg { margin-bottom: 14px; }
.tfp-mfg label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px; }
.tfp-mfg label .req { color: var(--bad); }
.tfp-mrow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 0; }

/* ── Form controls ─────────────────────────────── */
.tfp-input, .tfp-select, .tfp-textarea {
  width: 100%; border: 1.5px solid var(--bd); border-radius: var(--r-sm);
  padding: 8px 12px; font: 14px var(--font); color: var(--text);
  background: var(--surf); outline: none; transition: border-color var(--tr);
}
.tfp-input:focus, .tfp-select:focus, .tfp-textarea:focus { border-color: var(--p); }
.tfp-textarea { resize: vertical; min-height: 80px; }
.tfp-select { cursor: pointer; }

/* ── Buttons ───────────────────────────────────── */
.tfp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--r-sm); border: 1.5px solid transparent;
  font: 600 13px var(--font); cursor: pointer; transition: all var(--tr); white-space: nowrap;
  text-decoration: none;
}
.tfp-btn:disabled { opacity: .55; cursor: not-allowed; }
.tfp-btn-primary   { background: var(--p); color: #fff; border-color: var(--p); }
.tfp-btn-primary:hover:not(:disabled)   { background: var(--p-dk); border-color: var(--p-dk); }
.tfp-btn-secondary { background: var(--bd2); color: var(--text); border-color: var(--bd); }
.tfp-btn-secondary:hover:not(:disabled) { background: var(--bd); }
.tfp-btn-ghost     { background: none; border-color: var(--bd); color: var(--text); }
.tfp-btn-ghost:hover:not(:disabled) { background: var(--bg); }
.tfp-btn-danger    { background: var(--bad); color: #fff; border-color: var(--bad); }
.tfp-btn-danger:hover:not(:disabled) { background: #dc2626; }
.tfp-btn-sm { padding: 5px 11px; font-size: 12px; }
.tfp-btn-success { background: var(--ok); color: #fff; border-color: var(--ok); }
.tfp-btn-success:hover:not(:disabled) { background: #059669; }

/* ── Tags/Priority/Status ───────────────────────── */
.tfp-tag { display: inline-block; background: var(--bd2); color: var(--muted); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; margin-right: 4px; }
.tfp-prio { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; white-space: nowrap; }
.tfp-prio-low    { background: #dcfce7; color: #166534; }
.tfp-prio-medium { background: #fef3c7; color: #92400e; }
.tfp-prio-high   { background: #fee2e2; color: #b91c1c; }
.tfp-prio-urgent { background: var(--bad); color: #fff; }
.tfp-status { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; white-space: nowrap; }
.tfp-status-todo       { background: var(--bd2); color: var(--muted); }
.tfp-status-inprogress { background: #dbeafe; color: #1d4ed8; }
.tfp-status-review     { background: #fef3c7; color: #92400e; }
.tfp-status-completed  { background: #dcfce7; color: #166534; }

/* ── Toast ─────────────────────────────────────── */
#tfp-toasts { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: 320px; }
.tfp-toast { background: var(--text); color: #fff; padding: 10px 15px; border-radius: var(--r-sm); font-size: 13px; font-weight: 500; pointer-events: all; box-shadow: var(--sh-lg); animation: toastIn .22s ease; }
.tfp-toast.ok   { background: var(--ok); }
.tfp-toast.err  { background: var(--bad); }
.tfp-toast.warn { background: var(--warn); color: var(--text); }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Spinner / Empty ───────────────────────────── */
.tfp-spinner { width: 30px; height: 30px; border: 3px solid var(--bd); border-top-color: var(--p); border-radius: 50%; animation: spin .6s linear infinite; }
.tfp-spinner-center { display: flex; justify-content: center; align-items: center; min-height: 160px; }
@keyframes spin { to { transform: rotate(360deg); } }
.tfp-empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 14px; }
.tfp-loading { color: var(--muted); font-size: 13px; padding: 16px 0; }
.tfp-link-btn { background: none; border: none; color: var(--p); font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; }
.tfp-link-btn:hover { text-decoration: underline; }

/* Alert */
.tfp-alert { border-radius: var(--r-sm); padding: 10px 14px; font-size: 13px; }
.tfp-alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.tfp-alert-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ── Login Page ────────────────────────────────── */
.tfp-login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#eef2ff 0%,#f8fafc 50%,#e0f2fe 100%); padding: 20px; font-family: var(--font); }
.tfp-login-card { background: var(--surf); border-radius: var(--r-lg); box-shadow: var(--sh-lg); padding: 40px 36px; width: 100%; max-width: 420px; }
.tfp-login-logo { display: flex; align-items: center; gap: 10px; justify-content: center; font-weight: 800; font-size: 20px; margin-bottom: 24px; }
.tfp-login-title { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 6px; }
.tfp-login-sub { color: var(--muted); text-align: center; font-size: 13px; margin-bottom: 28px; }
.tfp-login-field { margin-bottom: 16px; }
.tfp-login-field label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.tfp-pw-wrap { position: relative; }
.tfp-pw-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; }
.tfp-field-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.tfp-checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.tfp-btn-full { width: 100%; }
.btn-loader { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
.tfp-lert { border-radius: var(--r-sm); padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }
.tfp-lert-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.tfp-lert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ── Manager-only elements ─────────────────────── */
[data-role="tfp_member"] .tfp-mgr-only { display: none !important; }


/* ═══════════════════════════════════════════════
   CALENDAR — YEAR & MONTH VIEWS
═══════════════════════════════════════════════ */
.tfp-cal-controls { display:flex; align-items:center; gap:10px; margin-bottom:14px; flex-wrap:wrap; }
.tfp-cal-year-label { font-size:18px; font-weight:700; padding:0 8px; }
.tfp-cal-legend { display:flex; gap:14px; flex-wrap:wrap; margin-bottom:18px; }
.tfp-cal-leg { font-size:12px; display:flex; align-items:center; gap:5px; }
.tfp-leg-holiday::before { content:''; display:inline-block; width:10px; height:10px; border-radius:50%; background:#10b981; }
.tfp-leg-leave::before   { content:''; display:inline-block; width:10px; height:10px; border-radius:50%; background:#ef4444; }
.tfp-leg-event::before   { content:''; display:inline-block; width:10px; height:10px; border-radius:50%; background:#3b82f6; }

/* Year grid — 4 columns of mini-months */
.tfp-year-grid { display:grid; grid-template-columns: repeat(4,1fr); gap:16px; margin-bottom:32px; }
@media (max-width:900px) { .tfp-year-grid { grid-template-columns: repeat(3,1fr); } }
@media (max-width:640px) { .tfp-year-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width:360px) { .tfp-year-grid { grid-template-columns: 1fr; } }

.tfp-month-mini { background:var(--surf); border:1px solid var(--bd); border-radius:var(--r); padding:10px 8px; cursor:pointer; transition:box-shadow .15s; }
.tfp-month-mini:hover { box-shadow:0 4px 16px rgba(0,0,0,.10); border-color:var(--p); }
.tfp-month-mini-name { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; color:var(--muted); text-align:center; margin-bottom:6px; }
.tfp-month-mini-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:1px; }
.tfp-mday-lbl { font-size:9px; font-weight:700; color:var(--light); text-align:center; padding:2px 0; }
.tfp-mday { font-size:10px; text-align:center; padding:2px 0; border-radius:3px; line-height:1.4; }
.tfp-mday.is-holiday { background:#10b981; color:#fff; font-weight:700; border-radius:3px; }
.tfp-mday.is-leave   { background:#ef4444; color:#fff; border-radius:3px; }
.tfp-mday.is-event   { background:#3b82f6; color:#fff; border-radius:3px; }

/* Month full grid */
.tfp-month-full-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; margin-bottom:24px; }
.tfp-mf-day-lbl { font-size:11px; font-weight:700; color:var(--muted); text-align:center; padding:6px 0; text-transform:uppercase; letter-spacing:.5px; }
.tfp-mf-day { min-height:70px; background:var(--surf); border:1px solid var(--bd); border-radius:6px; padding:6px; font-size:12px; position:relative; }
.tfp-mf-day.is-today { border-color:var(--p); background:var(--p-lt); }
.tfp-mf-day.is-holiday { background:#dcfce7; border-color:#10b981; }
.tfp-mf-day.is-leave   { background:#fee2e2; border-color:#ef4444; }
.tfp-mf-num { font-size:13px; font-weight:700; display:block; margin-bottom:4px; }
.tfp-mf-badge { font-size:9px; padding:2px 4px; border-radius:3px; margin-bottom:2px; display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tfp-mf-badge.hd { background:#10b981; color:#fff; }
.tfp-mf-badge.lv { background:#ef4444; color:#fff; }
@media (max-width:640px) { .tfp-month-full-grid { grid-template-columns:repeat(7,1fr); gap:2px; } .tfp-mf-day { min-height:44px; padding:3px; } }

.tfp-hd-list-section { margin-top:24px; }

/* ═══════════════════════════════════════════════
   PROJECT DETAIL BOARD
═══════════════════════════════════════════════ */
.tfp-pd-filters { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.tfp-pd-board { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-top:4px; }
@media (max-width:900px) { .tfp-pd-board { grid-template-columns:1fr 1fr; } }
@media (max-width:640px) { .tfp-pd-board { grid-template-columns:1fr; } }
.tfp-pd-col { background:var(--bg); border-radius:var(--r); overflow:hidden; border:1px solid var(--bd); }
.tfp-pd-col-head { display:flex; justify-content:space-between; align-items:center; padding:10px 12px; font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; color:var(--muted); background:var(--surf); border-bottom:1px solid var(--bd); }
.tfp-pd-tasks { padding:10px; display:flex; flex-direction:column; gap:8px; min-height:100px; }

/* ═══════════════════════════════════════════════
   REPORTS DASHBOARD
═══════════════════════════════════════════════ */
.tfp-reports-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:16px; }
.tfp-report-card { background:var(--surf); border:1px solid var(--bd); border-radius:var(--r); padding:18px; }
.tfp-rc-header { display:flex; align-items:center; gap:12px; margin-bottom:14px; }
.tfp-rc-header img { border-radius:50%; object-fit:cover; }
.tfp-rc-info { flex:1; }
.tfp-rc-name { font-size:15px; font-weight:700; margin-bottom:3px; }
.tfp-rc-score { width:52px; height:52px; border-radius:50%; display:flex; flex-direction:column; align-items:center; justify-content:center; flex-shrink:0; }
.tfp-rc-score.s-ok   { background:#dcfce7; color:#166534; }
.tfp-rc-score.s-warn { background:#fef9c3; color:#854d0e; }
.tfp-rc-score.s-bad  { background:#fee2e2; color:#991b1b; }
.tfp-rc-score-val { font-size:17px; font-weight:800; line-height:1; }
.tfp-rc-score-lbl { font-size:9px; opacity:.7; }
.tfp-rc-stats { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-bottom:12px; }
.tfp-rc-stat { text-align:center; background:var(--bg); border-radius:6px; padding:8px 4px; }
.tfp-rc-stat.bad .tfp-rc-sv { color:var(--bad); }
.tfp-rc-sv { display:block; font-size:16px; font-weight:800; line-height:1; margin-bottom:2px; }
.tfp-rc-sl { font-size:9px; color:var(--muted); text-transform:uppercase; letter-spacing:.3px; }
.tfp-rc-bar-wrap { height:6px; background:var(--bg); border-radius:3px; overflow:hidden; }
.tfp-rc-bar { height:100%; border-radius:3px; transition:width .6s ease; }
.tfp-rc-bar.s-ok   { background:var(--ok); }
.tfp-rc-bar.s-warn { background:var(--warn); }
.tfp-rc-bar.s-bad  { background:var(--bad); }

/* ═══════════════════════════════════════════════
   KARMA
═══════════════════════════════════════════════ */
.tfp-karma-wrap { display:flex; flex-direction:column; gap:20px; }
.tfp-lb-item { display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--bd); }
.tfp-lb-item:last-child { border-bottom:none; }
.tfp-lb-item img { border-radius:50%; object-fit:cover; flex-shrink:0; }
.tfp-lb-rank { width:30px; font-size:18px; text-align:center; flex-shrink:0; }
.tfp-lb-name { flex:1; font-weight:600; font-size:14px; }
.tfp-lb-pts  { font-weight:800; color:var(--p); font-size:14px; margin-right:6px; }

/* ═══════════════════════════════════════════════
   IMPORT
═══════════════════════════════════════════════ */
.tfp-import-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:16px; }
.tfp-import-card { background:var(--surf); border:1px solid var(--bd); border-radius:var(--r); padding:18px; display:flex; flex-direction:column; gap:12px; }
.tfp-import-actions { display:flex; gap:8px; flex-wrap:wrap; }
.tfp-import-result { font-size:13px; }
.tfp-hidden-file { display:none; }

/* ═══════════════════════════════════════════════
   MISC FIXES
═══════════════════════════════════════════════ */
.tfp-topbar-logout-btn { display:flex; align-items:center; color:var(--muted); padding:6px; border-radius:6px; }
.tfp-topbar-logout-btn:hover { color:var(--bad); background:var(--bg); }
.tfp-btn-xs { padding:3px 8px; font-size:11px; }
.s-p  { background:var(--p-lt); }
.tfp-attendance-filters { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */
@media (max-width: 900px) {
  .tfp-sidebar {
    position: fixed; top: 0; left: 0; height: 100%;
    transform: translateX(-100%); z-index: 9200;
  }
  .admin-bar .tfp-sidebar { top: var(--wp-admin--admin-bar--height, 32px); }
  .tfp-sidebar.open { transform: none; }
  .tfp-overlay { display: block; pointer-events: none; }
  .tfp-sb-x { display: flex; }
  .tfp-hamburger { display: flex; }
  .tfp-search-box input { width: 120px; }
  .tfp-notif-panel { right: 8px; width: calc(100vw - 16px); max-width: 360px; top: var(--top-h); }
  .tfp-view { padding: 16px; }
  .tfp-board { grid-template-columns: 1fr 1fr; }
  .tfp-drawer { width: 100%; }
  .tfp-export-card { flex-direction: column; text-align: center; }
}

@media (max-width: 640px) {
  .tfp-board { grid-template-columns: 1fr; }
  .tfp-search-box { display: none; }
  .tfp-timer-clock { font-size: 38px; }
  .tfp-login-card { padding: 28px 18px; }
  .tfp-stat-grid { grid-template-columns: 1fr 1fr; }
  .tfp-dash-grid { grid-template-columns: 1fr; }
  .tfp-mrow { grid-template-columns: 1fr; }
  .tfp-profile-grid { grid-template-columns: 1fr; }
  .tfp-team-grid { grid-template-columns: 1fr 1fr; }
  .tfp-holiday-list { grid-template-columns: 1fr; }
  .tfp-export-grid { grid-template-columns: 1fr; }
  .tfp-section-header { flex-direction: column; align-items: flex-start; }
  .tfp-list-bar { flex-direction: column; }
  .tfp-list-bar .tfp-input { max-width: 100%; }
  .tfp-td-meta { grid-template-columns: 1fr; }
  .tfp-sfg-row { grid-template-columns: 1fr; }
  .tfp-manual-row { flex-direction: column; align-items: stretch; }
  .tfp-attendance-widget { flex-direction: column; align-items: flex-start; }
  .tfp-fg-row { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
  .tfp-team-grid { grid-template-columns: 1fr; }
  .tfp-stat-grid { grid-template-columns: 1fr; }
}

/* ── Extra utility classes added in v5.1 ────────────────── */
.tfp-btn-warn  { background: var(--warn); color: #fff; border: none; }
.tfp-btn-warn:hover { background: #d97706; }
.tfp-btn-danger { background: var(--bad); color: #fff; border: none; }
.tfp-btn-danger:hover { background: #dc2626; }
.tfp-btn-success { background: var(--ok); color: #fff; border: none; }
.tfp-btn-success:hover { background: #059669; }
.tfp-btn-xs { padding: 2px 8px; font-size: 11px; border-radius: 4px; cursor: pointer; font-weight: 600; }
.tfp-hier-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; }
.tfp-hier-section { margin-bottom: 24px; }
.tfp-team-hierarchy { padding: 4px 0; }
.tfp-lb-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--bd2); }
.tfp-lb-item:last-child { border-bottom: none; }
.tfp-lb-rank { min-width: 28px; font-size: 18px; text-align: center; }
.tfp-lb-name { font-weight: 600; font-size: 13px; }
.tfp-lb-pts  { margin-left: auto; font-weight: 700; color: var(--p); white-space: nowrap; }
.tfp-karma-wrap { display: flex; flex-direction: column; gap: 0; }
.tfp-stats-row .tfp-stat-card { border-radius: var(--r); }

/* ── v6 additions ──────────────────────────────────── */

/* Admin/founder-only nav items */
.tfp-admin-only { display: flex; }
body:not(.tfp-sys-admin) .tfp-admin-only { display: none !important; }

/* Mobile header — always visible, fixed at top */
.tfp-topbar {
  position: sticky; top: 0; z-index: 900;
  background: var(--surface); border-bottom: 1px solid var(--bd);
}
@media (max-width: 900px) {
  .tfp-topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 9100; height: var(--top-h); }
  .tfp-main { padding-top: var(--top-h); }
  .tfp-content { height: calc(100vh - var(--top-h)); overflow-y: auto; }
}

/* Work progress bar on dashboard */
.tfp-att-work-bar { display: flex; align-items: center; gap: 10px; margin: 8px 0; flex: 1; min-width: 160px; }
.tfp-att-work-prog { flex: 1; height: 8px; background: var(--bd2); border-radius: 4px; overflow: hidden; }
.tfp-att-work-fill { height: 100%; background: var(--p); border-radius: 4px; transition: width .4s; }
.tfp-att-work-fill.done { background: var(--ok); }
.tfp-att-work-label { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* Page-level back button inside view */
.tfp-view-header { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.tfp-back-inline { align-self: flex-start; }

/* Employee DB table */
.tfp-empdb-wrap { }
.tfp-empdb-stats { }

/* Salary summary */
.tfp-salary-summary { }

/* Reports summary bar */
.tfp-reports-summary { }

/* Reports grid */
.tfp-reports-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 16px; }

/* Attendance sessions badge */
.tfp-att-session-badge { display: inline-block; background: var(--p-lt); color: var(--p); border-radius: 4px; padding: 2px 8px; font-size: 11px; font-weight: 600; }

/* User delete button size */
.tfp-delete-user-btn { line-height: 1; }

/* Scrollable attendance table */
.tfp-att-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Mobile: make topbar search box hidden, show hamburger always */
@media (max-width: 640px) {
  .tfp-topbar { display: flex; height: var(--top-h); }
  .tfp-hamburger { display: flex !important; }
  .tfp-topbar-right { gap: 4px; }
}

/* ══════════════════════════════════════════
   MOBILE BOTTOM NAV
══════════════════════════════════════════ */
.tfp-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 58px;
  background: var(--surf);
  border-top: 1px solid var(--bd);
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
  z-index: 9300;
  flex-direction: row;
  align-items: stretch;
}
.tfp-mn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  padding: 6px 4px 4px;
  transition: color .15s;
  cursor: pointer;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
}
.tfp-mn-item.active,
.tfp-mn-item:hover { color: var(--p); }

@media (max-width: 900px) {
  /* Show mobile bottom nav */
  .tfp-mobile-nav { display: flex !important; }
  /* Push content up so bottom nav doesn't overlap */
  .tfp-content { padding-bottom: 58px; }
  /* Topbar always fixed */
  .tfp-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 9100;
    background: var(--surf);
    border-bottom: 1px solid var(--bd);
  }
  .tfp-main { padding-top: var(--top-h); }
  /* Hamburger always visible on mobile */
  .tfp-hamburger { display: flex !important; }
  /* Back button always visible on mobile */
  #tfp-back-btn { display: flex !important; }
}

@media (max-width: 640px) {
  .tfp-search-box { display: none; }
  .tfp-modal { width: 95vw !important; max-width: 95vw; }
}

/* ═══════════ ADMIN / MGR ROLE GATING (CSS fallback) ═══════════ */
/* Server-side PHP gating is primary; JS hides nav links.
   These rules hide the nav links for non-admins via CSS if JS hasn't fired */
.tfp-admin-only { display: none; }
[data-role="administrator"] .tfp-admin-only,
[data-role="cofounder"]     .tfp-admin-only { display: flex; }

/* ═══════════ BACK BUTTON ══════════════════════════════════════ */
#tfp-back-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 12px;
  background: var(--bd2);
  border: 1px solid var(--bd);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}
#tfp-back-btn:hover { background: var(--bd); }

/* ═══════════ TOPBAR — always fixed at top ═════════════════════ */
.tfp-topbar {
  position: sticky;
  top: 0;
  z-index: 9100;
  background: var(--surf);
  border-bottom: 1px solid var(--bd);
  flex-shrink: 0;
}

/* ═══════════ MOBILE ════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* Topbar fixed at top on mobile */
  .tfp-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 9100;
    height: var(--top-h);
  }
  /* Compensate for fixed topbar */
  .tfp-main { padding-top: var(--top-h); }
  /* Content ends above mobile nav */
  .tfp-content { padding-bottom: 64px; overflow-y: auto; }
  /* Hamburger always visible */
  .tfp-hamburger { display: flex !important; }
  /* Back button always visible when active */
  #tfp-back-btn[style*="display: inline"],
  #tfp-back-btn[style*="display:inline"] { display: flex !important; }
  /* Hide search on very small screens */
  .tfp-search-box { display: none; }
}

/* ═══════════ ATTENDANCE STATUS BADGES ═════════════════════════ */
.tfp-badge.s-ok   { background: var(--ok);   color: #fff; }
.tfp-badge.s-warn { background: var(--warn); color: #fff; }
.tfp-badge.s-bad  { background: var(--bad);  color: #fff; }
