:root {
  --blue: #2c7be5;
  --blue-dark: #1a68d1;
  --blue-light: #eaf2fd;
  --green: #43a047;
  --green-light: #e7f4e8;
  --red: #e53935;
  --red-light: #fdeaea;
  --amber-light: #fff3cd;
  --amber-text: #856404;
  --bg: #f7f8fa;
  --card: #ffffff;
  --text: #37474f;
  --text-strong: #263238;
  --muted: #78909c;
  --border: #e5e9ee;
  --sidebar-w: 220px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ---------- Shell layout ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 10;
}

.logo {
  display: flex; align-items: center; gap: 8px;
  padding: 18px 20px;
  font-size: 17px; font-weight: 700; color: var(--text-strong);
}
.logo-mark {
  background: var(--blue); color: #fff;
  border-radius: 8px; padding: 4px 7px; font-size: 13px; font-weight: 800;
}

.nav { flex: 1; padding: 8px 0; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--bg); }
.nav-item.active {
  color: var(--blue);
  border-left-color: var(--blue);
  background: var(--blue-light);
}
.nav-ico { width: 20px; text-align: center; font-size: 15px; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 6px 0; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 10px 28px;
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 30;
}

.timerbox {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px 8px 6px 16px;
  font-variant-numeric: tabular-nums;
  font-size: 16px; font-weight: 600; color: var(--text-strong);
}
.timerbox.running { border-color: var(--green); }
.timerbox .idle { color: var(--muted); }
.timer-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.timer-form { margin: 0; display: flex; }
.btn-timer {
  border: none; border-radius: 50%;
  width: 32px; height: 32px;
  cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.btn-timer.start { background: var(--blue); }
.btn-timer.start:hover { background: var(--blue-dark); }
.btn-timer.stop { background: var(--red); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
}

.content { padding: 26px 28px; max-width: 1200px; }

/* ---------- Typography ---------- */
h1 { font-size: 26px; font-weight: 400; color: var(--text-strong); margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 600; color: var(--text-strong); margin: 26px 0 10px; }
.page-sub { color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); }

/* ---------- Page header row ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }

/* ---------- Pill tabs (Daily / Weekly) ---------- */
.pills { display: inline-flex; background: #eef1f4; border-radius: 22px; padding: 3px; }
.pills a {
  padding: 7px 20px; border-radius: 20px;
  color: var(--text); text-decoration: none; font-weight: 500;
}
.pills a.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.12); color: var(--text-strong); }

/* ---------- Date navigation ---------- */
.datenav { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.datenav .arrow {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); text-decoration: none; font-size: 15px;
}
.datenav .arrow:hover { background: var(--bg); }
.datenav .label { font-weight: 600; color: var(--text-strong); padding: 0 4px; }

/* ---------- Cards & widgets ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.widget .w-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.widget .w-value { font-size: 28px; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.widget .w-foot { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.table th, .table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.table tr:last-child td { border-bottom: none; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; background: #fafbfc; }
.table a { color: var(--blue); text-decoration: none; }
.table a:hover { text-decoration: underline; }

/* hours bar next to member */
.hbar { background: #eef1f4; border-radius: 4px; height: 8px; width: 140px; display: inline-block; vertical-align: middle; }
.hbar > span { display: block; height: 8px; border-radius: 4px; background: var(--blue); }

/* ---------- Badges ---------- */
.badge { padding: 3px 10px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.badge-in { background: var(--green-light); color: var(--green); }
.badge-out { background: #eef1f4; color: var(--muted); }
.badge-edited { background: var(--amber-light); color: var(--amber-text); font-weight: 500; }
.badge-review { background: var(--red-light); color: var(--red); }

/* ---------- Buttons & forms ---------- */
.btn {
  padding: 9px 18px;
  border-radius: 6px;
  border: none;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-danger { background: var(--red); color: #fff; }
.btn-secondary { background: #fff; color: var(--blue); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--blue-light); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="datetime-local"], input[type="number"], input[type="date"], input[type="month"], select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--blue-light); border-color: var(--blue); }

.stack { display: flex; flex-direction: column; gap: 14px; margin: 16px 0; }
.stack label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.checkbox { flex-direction: row !important; align-items: center; gap: 8px !important; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Login ---------- */
.container { max-width: 900px; margin: 0 auto; padding: 32px 20px; }
.auth-card {
  max-width: 380px;
  margin: 80px auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}
.auth-card h1 { font-size: 22px; }

/* ---------- Flash ---------- */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13.5px; }
.flash-success { background: var(--green-light); color: var(--green); }
.flash-error { background: var(--red-light); color: var(--red); }

/* ---------- Timeline (daily timesheet) ---------- */
.tl-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.tl-name { width: 140px; font-weight: 600; color: var(--text-strong); flex-shrink: 0; }
.tl-track {
  position: relative; flex: 1; height: 26px;
  background: #eef1f4; border-radius: 5px;
}
.tl-block {
  position: absolute; top: 0; height: 26px;
  background: var(--blue); border-radius: 4px;
  min-width: 3px;
}
.tl-block.open { background: var(--green); }
.tl-block:hover::after {
  content: attr(data-label);
  position: absolute; bottom: 32px; left: 0;
  background: var(--text-strong); color: #fff;
  padding: 4px 9px; border-radius: 5px; font-size: 12px; white-space: nowrap; z-index: 20;
}
.tl-total { width: 60px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.tl-axis { display: flex; margin-left: 154px; margin-right: 74px; color: var(--muted); font-size: 11px; justify-content: space-between; margin-bottom: 18px; }

/* ---------- Week bars (member dashboard) ---------- */
.weekbars { display: flex; gap: 12px; align-items: flex-end; height: 120px; margin: 10px 0 4px; }
.weekbar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.weekbar .bar { width: 100%; max-width: 46px; background: var(--blue-light); border-radius: 5px 5px 0 0; position: relative; }
.weekbar .bar > span { display: block; background: var(--blue); border-radius: 5px 5px 0 0; width: 100%; position: absolute; bottom: 0; }
.weekbar.today .bar > span { background: var(--green); }
.weekbar .d-label { font-size: 11px; color: var(--muted); }
.weekbar .d-hours { font-size: 11px; font-weight: 600; }

/* ---------- Activity grid ---------- */
.activity-grid .day-col { padding: 6px 4px; text-align: center; font-size: 12px; min-width: 24px; }
.activity-grid .day-col a { color: var(--muted); text-decoration: none; }
.activity-grid .day-col a:hover { color: var(--blue); text-decoration: underline; }
.activity-grid td.touched { background: var(--blue-light); color: var(--blue-dark); font-weight: 600; }

/* ---------- KPI tiles (legacy member view) ---------- */
.kpi-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 12px 0 8px; }
.kpi-tile { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px 22px; min-width: 120px; text-align: center; }
.kpi-num { font-size: 26px; font-weight: 700; color: var(--blue); }
.kpi-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Clock-in popover ---------- */
.timer-group {
  background: var(--blue-light); color: var(--blue-dark);
  border-radius: 5px; padding: 3px 9px; font-size: 12px; font-weight: 600;
}
.start-pop { position: relative; }
.start-pop summary { list-style: none; cursor: pointer; }
.start-pop summary::-webkit-details-marker { display: none; }
.start-form {
  position: absolute; top: 46px; left: -12px; z-index: 60;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 26px rgba(0,0,0,0.13);
  padding: 16px; width: 250px;
  display: flex; flex-direction: column; gap: 10px;
}
.start-form input { width: 100%; }
.start-form label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; font-weight: 500; }

/* ---------- Screenshots ---------- */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.shot-card { padding: 10px; }
.shot-img {
  width: 100%; aspect-ratio: 16/10; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--border); display: block;
  background: #eef1f4;
}
.shot-none { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.shot-meta { padding: 8px 4px 2px; }
.act-bar { background: #eef1f4; border-radius: 4px; height: 6px; margin: 6px 0; overflow: hidden; }
.act-bar > span { display: block; height: 6px; border-radius: 4px; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .hbar { width: 70px; }
}
