:root {
  --bg: #0a0d10; --panel: #12161c; --line: #1e2630; --ink: #e6edf3;
  --muted: #8b98a5; --accent: #2A93C1; --accent-orange: #F1420B;
  --danger: #ff6b6b; --ok: #3fb950; --warn: #f0ad4e;
}
* { box-sizing: border-box; }
::-webkit-scrollbar { width: 0; height: 0; }
* { scrollbar-width: none; }
body {
  margin: 0; font: 15px/1.6 'Oswald', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 400; background: var(--bg); color: var(--ink);
}
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px; border-bottom: 1px solid var(--line);
  background: var(--panel);
}
h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: 0.5px; }
h2 { font-size: 20px; margin: 20px 0 14px; font-weight: 700; letter-spacing: 0.3px; }
h3 { font-size: 16px; margin: 18px 0 10px; font-weight: 600; }
.badge {
  font-size: 11px; font-weight: 600; color: var(--accent-orange);
  border: 1px solid var(--accent-orange); border-radius: 999px; padding: 2px 8px; margin-left: 8px;
}
main { max-width: 1400px; margin: 0 auto; padding: 28px 40px; }
footer { max-width: 1400px; margin: 30px auto; padding: 0 40px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--danger); min-height: 1.2em; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 24px 28px; margin: 18px 0; display: flex; flex-direction: column; gap: 14px;
}
.card.row { flex-direction: row; flex-wrap: wrap; align-items: end; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 6px; }
input, select, textarea {
  background: #080b0f; border: 1px solid var(--line); color: var(--ink);
  border-radius: 6px; padding: 10px 12px; font: inherit;
}
button {
  background: var(--accent); color: #fff; border: 0; border-radius: 6px;
  padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer;
  letter-spacing: 0.3px;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.link { background: none; color: var(--accent); padding: 2px 4px; font-weight: 500; }
.link.danger { color: var(--danger); }
.danger-btn { background: var(--danger); }
.danger-btn:hover { filter: brightness(1.1); }

/* App layout: sidebar + main content */
.app-layout {
  display: flex; gap: 0; min-height: calc(100vh - 120px);
}
.sidebar {
  width: 200px; min-width: 200px; flex-shrink: 0;
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px 0; position: sticky; top: 0; align-self: flex-start;
  max-height: calc(100vh - 60px); overflow-y: auto;
}
.main-content {
  flex: 1; min-width: 0; padding: 8px 32px;
}
.tab {
  background: none; color: var(--muted); border: none; border-left: 3px solid transparent;
  border-radius: 0; text-align: left; padding: 10px 16px; font-size: 13px;
  width: 100%; display: block; white-space: nowrap; cursor: pointer; transition: background 0.15s;
}
.tab:hover { background: rgba(255,255,255,0.04); }
.tab.active { color: var(--ink); border-left-color: var(--accent); background: rgba(42,147,193,0.08); }

/* Mobile: collapse sidebar to horizontal scrollable bar */
@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar {
    width: 100%; min-width: 0; flex-direction: row; overflow-x: auto;
    border-right: none; border-bottom: 1px solid var(--line);
    padding: 0; gap: 0; position: static; max-height: none;
  }
  .tab {
    border-left: none; border-bottom: 2px solid transparent;
    padding: 10px 14px; white-space: nowrap;
  }
  .tab.active { border-left-color: transparent; border-bottom-color: var(--accent); }
  .main-content { padding: 0; }
}

.whoami { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }

table.grid { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.grid th, .grid td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.grid th { color: var(--muted); font-weight: 600; }

/* P2.1: Timer widget */
.timer-widget {
  margin-bottom: 16px;
  padding: 12px 16px;
}
.timer-controls {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.timer-controls select,
.timer-controls input {
  flex: 1; min-width: 120px;
}
.timer-display {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.timer-label {
  color: var(--muted); font-size: 13px;
}
.timer-info {
  font-size: 14px;
}
.timer-clock {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 22px; font-weight: 700; color: var(--ok);
  min-width: 100px;
}
.timer-btn {
  padding: 8px 16px; font-size: 14px;
}
.timer-btn.start { background: var(--ok); }
.timer-btn.stop { background: var(--danger); }

/* P2.2: Dashboard */
.dashboard-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 20px;
}
.dash-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 20px; text-align: center;
}
.dash-card.accent {
  border-color: var(--ok);
}
.dash-value {
  font-size: 28px; font-weight: 700; color: var(--ink);
}
.dash-label {
  font-size: 12px; color: var(--muted); margin-top: 4px;
}
.dash-recent {
  grid-column: 1 / -1;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px;
}

/* =========================================================
   Weekly Dashboard (Redesigned)
   ========================================================= */

/* Revenue hero card */
.dash-revenue-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 28px 32px; margin-bottom: 20px; text-align: center;
  position: relative; overflow: hidden;
}
.dash-revenue-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent-orange), var(--accent));
}
.dash-revenue-amount {
  font-size: 42px; font-weight: 800; color: var(--ink);
  letter-spacing: -1px; line-height: 1.1;
}
.dash-revenue-label {
  font-size: 13px; color: var(--muted); margin-top: 6px;
}
.dash-revenue-meta {
  display: flex; justify-content: center; gap: 28px; margin-top: 16px;
  flex-wrap: wrap;
}
.dash-revenue-stat {
  text-align: center;
}
.dash-revenue-stat-value {
  font-size: 20px; font-weight: 700; color: var(--ink);
}
.dash-revenue-stat-label {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.5px; margin-top: 2px;
}

/* Section headers */
.dash-section-header {
  font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.5px; margin: 24px 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

/* Team member table */
.dash-team-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; margin-bottom: 20px;
}
.dash-team-table th, .dash-team-table td {
  text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.dash-team-table th {
  color: var(--muted); font-weight: 600; font-size: 12px;
  background: rgba(255,255,255,0.02);
}
.dash-team-table tr:last-child td { border-bottom: none; }
.dash-team-table .num { text-align: right; }
.dash-team-clients {
  font-size: 11px; color: var(--muted); margin-top: 3px;
}
.dash-team-clients .client-chip {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  background: rgba(42,147,193,0.08); color: var(--accent);
  margin: 2px 3px 2px 0; font-size: 10px; font-weight: 600;
  white-space: nowrap;
}
.dash-team-hours-bar {
  display: flex; align-items: center; gap: 8px;
}
.dash-team-hours-bar .bar-track {
  flex: 1; height: 6px; background: var(--line); border-radius: 3px;
  overflow: hidden; min-width: 60px;
}
.dash-team-hours-bar .bar-fill {
  height: 100%; border-radius: 3px; background: var(--accent);
  transition: width 0.4s ease;
}
.dash-team-hours-bar .bar-value {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px; font-weight: 600; color: var(--ink);
  min-width: 48px; text-align: right;
}

/* Client cap progress rows */
.dash-client-grid {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px;
}
.dash-client-row {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 18px; display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap;
}
.dash-client-name {
  font-size: 14px; font-weight: 600; color: var(--ink);
  min-width: 140px; flex-shrink: 0;
}
.dash-client-progress {
  flex: 1; min-width: 160px;
}
.dash-client-bar-track {
  height: 10px; background: var(--line); border-radius: 5px;
  overflow: hidden; position: relative;
}
.dash-client-bar-fill {
  height: 100%; border-radius: 5px; transition: width 0.5s ease;
  min-width: 2px;
}
.dash-client-bar-labels {
  display: flex; justify-content: space-between; font-size: 11px;
  color: var(--muted); margin-top: 4px;
}
.dash-client-pct {
  font-size: 14px; font-weight: 700; min-width: 50px; text-align: right;
  flex-shrink: 0;
}
.dash-client-revenue {
  font-size: 13px; font-weight: 600; color: var(--ink);
  min-width: 90px; text-align: right; flex-shrink: 0;
}

/* Dashboard warning labels */
.dash-warning {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.3px;
  padding: 2px 8px; border-radius: 4px; margin-left: 8px; vertical-align: middle;
  text-transform: uppercase;
}
.dash-warning-yellow {
  background: rgba(240, 173, 78, 0.15); color: var(--warn); border: 1px solid rgba(240, 173, 78, 0.3);
}
.dash-warning-red {
  background: rgba(255, 107, 107, 0.15); color: var(--danger); border: 1px solid rgba(255, 107, 107, 0.3);
}

/* Revenue WoW change indicator */
.dash-revenue-wow {
  display: inline-block; font-size: 14px; font-weight: 600; margin-left: 10px;
}
.dash-revenue-wow.positive { color: var(--ok); }
.dash-revenue-wow.negative { color: var(--danger); }

/* Employee (non-admin) dashboard */
.dash-emp-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.dash-emp-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px; text-align: center;
}
.dash-emp-card-value {
  font-size: 26px; font-weight: 700; color: var(--ink);
}
.dash-emp-card-label {
  font-size: 12px; color: var(--muted); margin-top: 4px;
}

/* Responsive */
@media (max-width: 768px) {
  .dash-revenue-amount { font-size: 32px; }
  .dash-revenue-meta { gap: 16px; }
  .dash-client-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .dash-client-name { min-width: 0; }
  .dash-client-pct, .dash-client-revenue { text-align: left; }
}

/* P2.9: Pagination */
.pagination {
  display: flex; gap: 12px; align-items: center; justify-content: center;
  margin: 12px 0; padding: 8px 0;
}

/* P3.1: Status badges */
.status-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.status-badge.open { background: var(--line); color: var(--muted); }
.status-badge.submitted { background: rgba(76, 141, 255, 0.15); color: var(--accent); border: 1px solid var(--accent); }
.status-badge.approved { background: rgba(63, 185, 80, 0.15); color: var(--ok); border: 1px solid var(--ok); }
.status-badge.rejected { background: rgba(255, 107, 107, 0.15); color: var(--danger); border: 1px solid var(--danger); }

/* P3.4: Notification bell */
.notif-bell {
  position: relative; cursor: pointer; color: var(--muted); padding: 4px;
}
.notif-bell:hover { color: var(--ink); }
.notif-count {
  position: absolute; top: -4px; right: -6px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.notif-dropdown {
  position: absolute; top: 32px; right: 0; width: 320px; max-height: 400px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); overflow: hidden; z-index: 100;
}
.notif-header {
  padding: 12px 16px; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--line);
}
.notif-list {
  max-height: 340px; overflow-y: auto;
}
.notif-item {
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  font-size: 13px; cursor: pointer; transition: background 0.15s;
}
.notif-item:hover { background: rgba(255,255,255,0.03); }
.notif-item.unread { border-left: 3px solid var(--accent); }
.notif-item .notif-time { font-size: 11px; color: var(--muted); margin-top: 4px; }
.notif-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* P3.2: Admin table */
.admin-table { width: 100%; }
.admin-table td { vertical-align: middle; }
.admin-table select { padding: 4px 8px; font-size: 12px; }
.admin-table .link { font-size: 12px; }
.user-active { color: var(--ok); }
.user-inactive { color: var(--danger); }

/* P3.6: Modal */
.modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.modal-content {
  width: 90%; max-width: 520px; max-height: 80vh; overflow-y: auto;
}
.modal-actions {
  display: flex; gap: 10px; align-items: center; margin-top: 8px;
}

/* P3.6: Edit history */
.edit-history {
  margin-top: 12px;
}
.edit-history h4 { font-size: 13px; color: var(--muted); margin: 8px 0 4px; }
.edit-record {
  font-size: 12px; padding: 6px 0; border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.edit-record .field { color: var(--accent); font-weight: 600; }
.edit-record .old-val { color: var(--danger); text-decoration: line-through; }
.edit-record .new-val { color: var(--ok); }
.edit-record .edit-reason { font-style: italic; }

/* P3.1: Reject reason display */
.reject-reason {
  font-size: 12px; color: var(--danger); font-style: italic;
  padding: 4px 0;
}

/* P4: Invoice status badges */
.status-badge.inv-draft, .status-badge.inv-draft { background: var(--line); color: var(--muted); }
.status-badge.inv-sent { background: rgba(76, 141, 255, 0.15); color: var(--accent); border: 1px solid var(--accent); }
.status-badge.inv-paid { background: rgba(63, 185, 80, 0.15); color: var(--ok); border: 1px solid var(--ok); }
.status-badge.inv-void { background: rgba(255, 107, 107, 0.15); color: var(--danger); border: 1px solid var(--danger); }
.status-badge.inv-partially_paid { background: rgba(240, 173, 78, 0.15); color: var(--warn); border: 1px solid var(--warn); }

/* P5: Client Portal — hours progress bar */
.hours-cap-card {
  padding: 16px;
}
.hours-cap-card h3 {
  margin: 0 0 12px 0;
}
.hours-bar-track {
  width: 100%; height: 20px; background: var(--line); border-radius: 10px;
  overflow: hidden; position: relative;
}
.hours-bar-fill {
  height: 100%; border-radius: 10px; transition: width 0.5s ease;
  min-width: 2px;
}
.hours-bar-labels {
  display: flex; justify-content: space-between; font-size: 12px;
  color: var(--muted); margin-top: 6px;
}
.hours-bar-status {
  font-size: 13px; font-weight: 600; margin-top: 4px; text-align: center;
}

/* P6: Budget table */
.budget-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.budget-table th, .budget-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.budget-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.budget-table .num { text-align: right; }
.budget-row-green { border-left: 3px solid var(--ok); }
.budget-row-yellow { border-left: 3px solid var(--warn); background: rgba(240, 173, 78, 0.05); }
.budget-row-red { border-left: 3px solid var(--danger); background: rgba(255, 107, 107, 0.08); }
.budget-row-amber { border-left: 3px solid #e6a817; }
.budget-pct { font-weight: 700; font-size: 14px; }
.budget-pct-green { color: var(--ok); }
.budget-pct-yellow { color: var(--warn); }
.budget-pct-red { color: var(--danger); }
.budget-over-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  background: rgba(255, 107, 107, 0.15); color: var(--danger); border: 1px solid var(--danger);
}
.budget-behind-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  background: rgba(230, 168, 23, 0.15); color: #e6a817; border: 1px solid #e6a817;
}
.budget-bar-track {
  width: 100%; height: 8px; background: var(--line); border-radius: 4px;
  overflow: hidden; position: relative; min-width: 80px;
}
.budget-bar-fill {
  height: 100%; border-radius: 4px; transition: width 0.3s ease;
}
.budget-detail-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; margin: 12px 0;
}
.budget-detail-card h3 { margin: 0 0 12px; }
.budget-mini-bar {
  display: flex; align-items: center; gap: 8px;
}
.budget-mini-bar .bar-container {
  flex: 1; height: 8px; background: var(--line); border-radius: 4px;
  overflow: hidden;
}
.budget-mini-bar .bar-fill {
  height: 100%; border-radius: 4px;
}
.budget-mini-bar .bar-label {
  font-size: 12px; color: var(--muted); min-width: 40px; text-align: right;
}

/* P6.6: Client weekly trend */
.weekly-trend-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.weekly-trend-table td, .weekly-trend-table th {
  padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line);
}
.weekly-trend-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.trend-bar-cell { width: 50%; }
.trend-bar-track {
  height: 16px; background: var(--line); border-radius: 4px;
  overflow: hidden; position: relative;
}
.trend-bar-fill {
  height: 100%; border-radius: 4px; background: var(--accent);
  transition: width 0.3s ease; min-width: 2px;
}
.clickable-row { cursor: pointer; transition: background 0.15s; }
.clickable-row:hover { background: rgba(255,255,255,0.03); }

/* =========================================================
   Clockify-style Tracker
   ========================================================= */

/* Top input bar -- single-line Clockify style */
.tracker-bar {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 16px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.tracker-bar-inner {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
  margin: 0; padding: 0; border: none; background: none;
}
.tracker-task-input {
  flex: 1; min-width: 180px;
  background: transparent; border: none; color: var(--ink);
  padding: 8px 12px; font: inherit; font-size: 14px;
}
.tracker-task-input::placeholder { color: var(--muted); }
.tracker-task-input:focus { outline: none; }

.tracker-client-select {
  background: var(--bg); border: 1px solid var(--line); color: var(--accent);
  border-radius: 16px; padding: 6px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; min-width: 100px; max-width: 180px; flex-shrink: 0;
}
.tracker-client-select:focus { border-color: var(--accent); outline: none; }

/* Billable toggle */
.tracker-billable { display: flex; align-items: center; cursor: pointer; flex-direction: row; gap: 0; flex-shrink: 0; }
.tracker-billable input { display: none; }
.tracker-billable-icon {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  font-size: 14px; font-weight: 700; color: var(--muted);
  border: 1px solid var(--line); transition: all 0.15s;
}
.tracker-billable input:checked + .tracker-billable-icon {
  color: var(--accent); border-color: var(--accent); background: rgba(42,147,193,0.1);
}

/* Mode toggle button (timer <-> manual) */
.tracker-mode-toggle {
  background: none; border: 1px solid var(--line); color: var(--muted);
  border-radius: 6px; padding: 5px 7px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}
.tracker-mode-toggle:hover { color: var(--accent); border-color: var(--accent); }
.tracker-mode-toggle.active { color: var(--accent); border-color: var(--accent); background: rgba(42,147,193,0.08); }

/* Time pickers (manual mode) */
.tracker-time-pickers {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.tracker-time-input {
  width: 54px; text-align: center;
  background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  border-radius: 6px; padding: 6px 4px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 14px; font-weight: 600;
}
.tracker-time-input:focus { border-color: var(--accent); outline: none; }
.tracker-time-input::placeholder { color: var(--muted); font-weight: 400; }
.tracker-time-sep {
  color: var(--muted); font-size: 14px; font-weight: 600; flex-shrink: 0;
}

/* Timer display */
.tracker-timer-display {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 18px; font-weight: 700; color: var(--ink);
  min-width: 84px; text-align: center; letter-spacing: 1px; flex-shrink: 0;
}
.tracker-timer-display.running { color: var(--ok); }
.tracker-timer-display.manual-calc { color: var(--accent); }

/* Start/Stop/Add buttons */
.tracker-action-btn {
  padding: 8px 20px; font-size: 13px; font-weight: 700;
  border-radius: 6px; text-transform: uppercase; letter-spacing: 0.5px;
  border: none; cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.tracker-start { background: var(--accent-orange); color: #fff; }
.tracker-start:hover { filter: brightness(1.1); }
.tracker-stop { background: var(--danger); color: #fff; }
.tracker-stop:hover { filter: brightness(1.1); }
.tracker-log { background: var(--ok); color: #fff; }
.tracker-log:hover { filter: brightness(1.1); }

.tracker-err { margin: 4px 0 0 0; font-size: 12px; }

/* Week total */
.tracker-week-total {
  display: flex; flex-direction: column; align-items: flex-end;
  min-width: 80px; flex-shrink: 0;
}
.tracker-week-label {
  font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px;
}
.tracker-week-value {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 16px; font-weight: 700; color: var(--accent);
}

/* Weekly pie chart */
.weekly-pie-container {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 20px; margin-bottom: 16px;
}
.weekly-pie-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.weekly-pie-title {
  font-size: 14px; font-weight: 600; color: var(--ink); margin: 0;
}
.weekly-pie-range {
  font-size: 12px; color: var(--muted);
}
.weekly-pie-body {
  display: flex; align-items: center; gap: 24px;
}
.weekly-pie-svg {
  flex-shrink: 0;
}
.weekly-pie-legend {
  display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0;
}
.pie-legend-item {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
}
.pie-legend-swatch {
  width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0;
}
.pie-legend-name {
  color: var(--ink); flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.pie-legend-hours {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px; color: var(--accent); font-weight: 600; flex-shrink: 0;
}
.pie-legend-pct {
  font-size: 11px; color: var(--muted); flex-shrink: 0; min-width: 32px; text-align: right;
}
@media (max-width: 768px) {
  .weekly-pie-body { flex-direction: column; align-items: flex-start; }
}

/* Day group */
.day-group { margin-bottom: 4px; }
.day-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: rgba(42,147,193,0.06);
  border-bottom: 1px solid var(--line); border-left: 3px solid var(--accent);
  margin-top: 12px;
}
.day-header:first-child { margin-top: 0; }
.day-header-date {
  font-size: 13px; font-weight: 700; color: var(--accent);
}
.day-header-total {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 14px; font-weight: 600; color: var(--accent);
}

/* Entry row */
.entry-row {
  display: flex; align-items: center; padding: 10px 16px; gap: 12px;
  border-bottom: 1px solid var(--line); transition: background 0.1s;
  min-height: 48px;
}
.entry-row:hover { background: rgba(255,255,255,0.03); }

.entry-desc {
  flex: 1; min-width: 0; font-size: 14px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.entry-desc .no-desc { color: var(--muted); font-style: italic; }

.entry-tag {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600;
  background: rgba(42,147,193,0.12); color: var(--accent);
  white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis;
}

.entry-type-badge {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
}
.entry-type-badge.work { display: none; } /* Don't show "work" -- it's the default */
.entry-type-badge.break { background: rgba(240,173,78,0.15); color: var(--warn); }
.entry-type-badge.time_off { background: rgba(42,147,193,0.12); color: var(--accent); }
.entry-type-badge.sick { background: rgba(255,107,107,0.12); color: var(--danger); }
.entry-type-badge.holiday { background: rgba(63,185,80,0.12); color: var(--ok); }

.entry-billable-indicator {
  font-size: 12px; font-weight: 700; width: 20px; text-align: center;
}
.entry-billable-indicator.billable { color: var(--accent); }
.entry-billable-indicator.internal { color: var(--muted); }

.entry-status-col { min-width: 60px; }

.entry-hours {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 14px; font-weight: 600; color: var(--ink);
  min-width: 72px; text-align: right;
}

.entry-actions {
  display: flex; gap: 4px; align-items: center; opacity: 0; transition: opacity 0.15s;
  min-width: 80px; justify-content: flex-end;
}
.entry-row:hover .entry-actions { opacity: 1; }

.entry-actions .link { font-size: 12px; padding: 4px 6px; }

/* Play button (re-start task) */
.entry-play-btn {
  background: none; border: none; color: var(--accent); cursor: pointer;
  padding: 4px; display: flex; align-items: center; opacity: 0.6;
  transition: opacity 0.15s;
}
.entry-play-btn:hover { opacity: 1; }

/* Empty state */
.entries-empty {
  text-align: center; padding: 40px 20px; color: var(--muted);
}

/* Responsive: tracker bar */
@media (max-width: 768px) {
  .tracker-bar { flex-wrap: wrap; position: static; }
  .tracker-bar-inner { flex-wrap: wrap; }
  .tracker-task-input { min-width: 100%; flex-basis: 100%; }
  .tracker-week-total { align-items: center; width: 100%; flex-direction: row; justify-content: center; gap: 8px; margin-top: 4px; }
  .entry-row { flex-wrap: wrap; gap: 6px; }
  .entry-actions { opacity: 1; } /* Always visible on mobile */
}

/* =========================================================
   Clockify-style Reports
   ========================================================= */

/* Sub-tabs row */
.rpt-subtabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--line); margin-bottom: 16px;
}
.rpt-subtab {
  background: none; color: var(--muted); border: none; border-bottom: 2px solid transparent;
  padding: 10px 20px; font-size: 14px; font-weight: 600; cursor: pointer;
  margin-bottom: -2px; transition: color 0.15s, border-color 0.15s;
}
.rpt-subtab:hover { color: var(--ink); }
.rpt-subtab.active {
  color: var(--accent); border-bottom-color: var(--accent);
}

/* Filter bar */
.rpt-filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 16px;
}
.rpt-filter-bar select,
.rpt-filter-bar input[type="date"] {
  background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  border-radius: 6px; padding: 8px 10px; font: inherit; font-size: 13px;
}
.rpt-filter-bar select { min-width: 140px; }
.rpt-filter-bar input[type="date"] { min-width: 130px; }
.rpt-filter-sep { color: var(--muted); font-size: 13px; }
.rpt-apply-btn {
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  padding: 8px 18px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.rpt-apply-btn:hover { filter: brightness(1.1); }
.rpt-export-btn {
  background: none; color: var(--accent); border: 1px solid var(--accent);
  border-radius: 6px; padding: 7px 14px; font: inherit; font-size: 13px;
  font-weight: 600; cursor: pointer;
}
.rpt-export-btn:hover { background: rgba(42,147,193,0.08); }

/* Stats row */
.rpt-stats-row {
  display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.rpt-stat-card {
  flex: 1; min-width: 160px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 20px;
}
.rpt-stat-value {
  font-size: 26px; font-weight: 700; color: var(--ink);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}
.rpt-stat-label {
  font-size: 12px; color: var(--muted); margin-top: 2px; text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Panes */
.rpt-pane { /* default visible */ }

/* Bar chart */
.rpt-chart {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 20px 24px; margin-bottom: 20px; min-height: 80px;
}
.rpt-chart-title {
  font-size: 13px; color: var(--muted); margin-bottom: 16px; font-weight: 600;
}
.rpt-chart-bars {
  display: flex; align-items: flex-end; gap: 6px; height: 180px;
  border-bottom: 1px solid var(--line); padding-bottom: 8px;
}
.rpt-bar-col {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; min-width: 0;
}
.rpt-bar {
  width: 100%; max-width: 48px; min-height: 4px;
  background: var(--ok); border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
}
.rpt-bar-val {
  font-size: 11px; color: var(--ink); font-weight: 600; margin-bottom: 4px;
  white-space: nowrap;
}
.rpt-bar-label {
  font-size: 11px; color: var(--muted); margin-top: 8px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 100%; text-align: center;
}
.rpt-chart-empty {
  text-align: center; padding: 40px 0; color: var(--muted); font-size: 13px;
}

/* Group-by header */
.rpt-group-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.rpt-group-label {
  font-size: 13px; color: var(--muted); font-weight: 600;
}
.rpt-group-header select {
  background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  border-radius: 6px; padding: 6px 10px; font: inherit; font-size: 13px;
}

/* Grouped table */
.rpt-grouped-table {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden;
}
.rpt-group-row {
  display: flex; align-items: center; padding: 12px 16px; cursor: pointer;
  border-bottom: 1px solid var(--line); transition: background 0.15s;
  user-select: none;
}
.rpt-group-row:last-child { border-bottom: none; }
.rpt-group-row:hover { background: rgba(255,255,255,0.03); }
.rpt-group-arrow {
  width: 20px; flex-shrink: 0; color: var(--muted); font-size: 12px;
  transition: transform 0.2s;
}
.rpt-group-arrow.open { transform: rotate(90deg); }
.rpt-group-name {
  flex: 1; font-size: 14px; font-weight: 600; color: var(--ink);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rpt-group-dur {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 14px; font-weight: 600; color: var(--ink); min-width: 90px; text-align: right;
}
.rpt-group-amt {
  font-size: 13px; color: var(--muted); min-width: 100px; text-align: right;
}
.rpt-group-detail {
  display: none; background: rgba(0,0,0,0.15); border-bottom: 1px solid var(--line);
}
.rpt-group-detail.open { display: block; }
.rpt-detail-row {
  display: flex; align-items: center; padding: 8px 16px 8px 36px; gap: 12px;
  border-bottom: 1px solid rgba(42,50,61,0.5); font-size: 13px;
}
.rpt-detail-row:last-child { border-bottom: none; }
.rpt-detail-name { flex: 1; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpt-detail-dur {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px; color: var(--muted); min-width: 90px; text-align: right;
}
.rpt-detail-amt { font-size: 12px; color: var(--muted); min-width: 100px; text-align: right; }

/* Detailed table */
.rpt-detailed-table table { width: 100%; }
.rpt-detailed-table .grid td { font-size: 13px; }

/* Weekly pivot */
.rpt-weekly-wrap {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  overflow-x: auto;
}
.rpt-weekly-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rpt-weekly-table th,
.rpt-weekly-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; }
.rpt-weekly-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.rpt-weekly-table td:first-child,
.rpt-weekly-table th:first-child { text-align: left; position: sticky; left: 0; background: var(--panel); }
.rpt-weekly-total-cell { font-weight: 700; color: var(--accent); }

/* Reports empty state */
.rpt-empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 13px; }

/* Reports responsive */
@media (max-width: 768px) {
  .rpt-filter-bar { flex-direction: column; align-items: stretch; }
  .rpt-filter-bar select,
  .rpt-filter-bar input[type="date"] { min-width: 100%; }
  .rpt-stats-row { flex-direction: column; }
  .rpt-stat-card { min-width: 100%; }
  .rpt-chart-bars { height: 120px; }
  .rpt-group-amt { display: none; }
  .rpt-detail-amt { display: none; }
}

/* =========================================================
   Timesheets Redesign: Accordion by client
   ========================================================= */

/* Week header */
.ts-week-header {
  margin: 8px 0 20px;
  padding: 16px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}
.ts-week-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-orange));
}
.ts-week-label {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--ink);
}

/* Client card */
.ts-client-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.ts-client-card:hover {
  border-color: var(--accent);
}

/* Client header (clickable) */
.ts-client-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.ts-client-header:hover {
  background: rgba(42, 147, 193, 0.05);
}
.ts-client-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ts-client-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.2px;
}
.ts-client-meta {
  font-size: 12px;
  color: var(--muted);
}

/* Chevron */
.ts-chevron {
  width: 20px;
  height: 20px;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.25s ease;
}
.ts-chevron-open {
  transform: rotate(180deg);
}

/* Expanded body */
.ts-client-body {
  border-top: 1px solid var(--line);
  padding: 20px;
}
.ts-client-content {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

/* Pie chart column */
.ts-pie-col {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ts-pie-empty {
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Members column */
.ts-members-col {
  flex: 1;
  min-width: 0;
}
.ts-members-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* Member row */
.ts-member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(30, 38, 48, 0.5);
}
.ts-member-row:last-of-type {
  border-bottom: none;
}
.ts-member-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ts-member-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ts-member-name:hover {
  text-decoration: underline;
  color: #3dacd6;
}
.ts-member-hours {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  min-width: 52px;
  text-align: right;
}
.ts-member-pct {
  font-size: 11px;
  color: var(--muted);
  min-width: 32px;
  text-align: right;
}

/* Member detail (expanded on click) */
.ts-member-detail {
  margin: 0 0 8px 20px;
  padding: 8px 0;
}
.ts-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ts-detail-table th {
  text-align: left;
  padding: 4px 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  border-bottom: 1px solid var(--line);
}
.ts-detail-table td {
  padding: 5px 10px;
  color: var(--ink);
  border-bottom: 1px solid rgba(30, 38, 48, 0.3);
}
.ts-detail-table tr:last-child td {
  border-bottom: none;
}
.ts-detail-hours {
  text-align: right;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-weight: 600;
}

/* Actions row */
.ts-actions {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ts-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ts-reject-reason {
  font-size: 12px;
  color: var(--danger);
  font-style: italic;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .ts-client-content {
    flex-direction: column;
    gap: 16px;
  }
  .ts-pie-col {
    align-self: center;
  }
  .ts-week-header {
    margin: 4px 0 14px;
    padding: 12px 16px;
  }
  .ts-week-label {
    font-size: 15px;
  }
}

/* Clients & Team Management Tabs */
.clients-header { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.clients-header h2 { margin: 0; }
.clients-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.clients-search-input { flex: 0 0 200px; padding: 8px 12px; font-size: 13px; }
.clients-add-bar { display: flex; gap: 8px; margin-left: auto; }
.clients-add-input { width: 220px; padding: 8px 12px; font-size: 13px; }
.clients-add-button { padding: 8px 18px; font-size: 13px; font-weight: 700; letter-spacing: 0.5px; }
.clients-table { width: 100%; }
.clients-table th { text-transform: uppercase; font-size: 11px; letter-spacing: 0.8px; color: var(--muted); }
.clients-table td { vertical-align: middle; }
.client-name-cell { font-weight: 600; color: var(--accent); }
.client-actions-cell { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.client-actions-cell .link { font-size: 12px; }
.client-status-active { color: var(--ok); font-size: 12px; font-weight: 600; }
.client-status-archived { color: var(--muted); font-size: 12px; font-weight: 600; }
.team-role-select { padding: 4px 8px; font-size: 12px; }
@media (max-width: 768px) {
  .clients-toolbar { flex-direction: column; align-items: stretch; }
  .clients-add-bar { margin-left: 0; }
  .clients-search-input { flex: 1; }
}
/* P8: WGG Updates */
.wgg-list { padding-left: 18px; margin: 4px 0; }
.wgg-list li { margin-bottom: 8px; line-height: 1.5; font-size: 13px; }
