* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0a0a0a;
  --card: #141414;
  --card2: #1c1c1c;
  --primary: #5D3FD3;
  --primary2: #8b5cf6;
  --success: #22c55e;
  --danger: #ef4444;
  --text: #f5f5f5;
  --text-dim: #a0a0a0;
  --text-dark: #777;
  --border: #2a2a2a;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
}

body { display: flex; flex-direction: column; }

/* ---------- LOGIN ---------- */
.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 500px at 50% -10%, #1a1440 0%, #0a0a0a 60%);
}
.login-box {
  background: var(--card);
  padding: 36px 28px;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  text-align: center;
}
.logo { font-size: 56px; margin-bottom: 6px; }
.login-box h1 { color: var(--primary2); font-size: 26px; margin-bottom: 4px; }
.subtitle { color: var(--text-dim); font-size: 14px; margin-bottom: 24px; }
.login-box label { display: block; text-align: left; font-size: 13px; color: var(--text-dim); margin: 14px 0 6px; }
.login-box input {
  width: 100%;
  padding: 14px;
  background: #1f1f1f;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
}
.login-box input:focus { outline: none; border-color: var(--primary); }
.login-box button[type="submit"] {
  width: 100%;
  margin-top: 22px;
  padding: 16px;
  background: linear-gradient(90deg, var(--primary), var(--primary2));
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.login-box button[type="submit"]:disabled { opacity: 0.6; }
/* password show/hide */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-dim);
  padding: 4px;
}
.footnote { margin-top: 18px; font-size: 12px; color: var(--text-dark); }
.error-box {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.4);
  color: #fca5a5;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 12px;
  text-align: left;
}

/* ---------- APP SHELL ---------- */
#appView { flex: 1; display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
header { background: #0d0d0d; border-bottom: 1px solid var(--border); }
.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
}
.appbar-title { font-size: 18px; font-weight: 700; color: var(--primary2); }
.appbar-actions { display: flex; gap: 8px; }
.icon-btn {
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
}
.admin-banner {
  background: #2a1f5e;
  color: #c4b5fd;
  font-size: 12.5px;
  padding: 8px 16px;
  text-align: center;
}
.admin-banner a { color: #fff; font-weight: 600; }

main { flex: 1; overflow-y: auto; padding: 14px 14px 90px; }

/* ---------- CARDS ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 12px;
}
.card h3 { font-size: 13px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.card .big { font-size: 30px; font-weight: 800; color: var(--text); }
.card .label { font-size: 13px; color: var(--text-dim); margin-top: 4px; }

/* ---------- STATUS CARD ---------- */
.status-card { text-align: center; padding: 26px 18px; }
.status-icon { font-size: 52px; margin-bottom: 8px; }
.status-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.status-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 16px; }

.btn {
  display: block;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
}
.btn:disabled { opacity: 0.5; }
.btn-primary { background: linear-gradient(90deg, var(--primary), var(--primary2)); }
.btn-success { background: linear-gradient(90deg, #16a34a, #22c55e); }
.btn-danger { background: linear-gradient(90deg, #b91c1c, #ef4444); }
.btn-ghost { background: var(--card2); border: 1px solid var(--border); color: var(--text); font-weight: 600; }
.btn-sm { padding: 10px; font-size: 14px; border-radius: 10px; }

/* ---------- STAT ROW ---------- */
.stat-row { display: flex; gap: 12px; }
.stat-row .card { flex: 1; margin-bottom: 0; text-align: center; }

/* ---------- LISTS ---------- */
.list-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}
.list-item .title { font-size: 15px; font-weight: 600; }
.list-item .sub { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; line-height: 1.5; }
.list-item .actions { margin-top: 10px; display: flex; gap: 8px; }
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-left: 8px;
  vertical-align: middle;
}
.badge-open { background: rgba(139,92,246,0.2); color: #c4b5fd; }
.badge-mine { background: rgba(34,197,94,0.15); color: #86efac; }
.badge-closed { background: #2a2a2a; color: #999; }
.badge-pending { background: rgba(234,179,8,0.15); color: #fde047; }
.empty { text-align: center; color: var(--text-dark); padding: 40px 20px; font-size: 14px; }

/* ---------- BOTTOM NAV ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: #0d0d0d;
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}
.nav-item {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dark);
  font-size: 20px;
  padding: 10px 0 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.nav-item span { font-size: 10.5px; }
.nav-item.active { color: var(--primary2); }

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: #222;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 100;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}
.toast.error { background: #7f1d1d; }
.toast.success { background: #14532d; }

/* ---------- HOURS ---------- */
.hour-item { display: flex; justify-content: space-between; align-items: center; }
.hour-item .dur { font-weight: 700; color: var(--primary2); font-size: 15px; }

/* ---------- PROFILE ---------- */
.profile-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: #fff;
  margin: 0 auto 12px;
}
.profile-name { text-align: center; font-size: 20px; font-weight: 700; }
.profile-email { text-align: center; color: var(--text-dim); font-size: 13px; margin-bottom: 18px; }
.profile-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.profile-row .k { color: var(--text-dim); }
.profile-row .v { font-weight: 600; }

/* ---------- SECTION HEADERS ---------- */
.sec-h {
  color: var(--text-dim);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 6px 2px 10px;
}

/* ---------- AVAILABILITY ---------- */
.avail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.avail-header .btn-sm { width: auto; flex: 0 0 auto; }
.avail-range { font-weight: 700; color: var(--primary2); font-size: 14px; }
.avail-day { padding: 14px; }
.avail-today { border-color: var(--primary2); }
.avail-day-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.avail-day-name { font-weight: 700; font-size: 14px; }
.avail-today-tag {
  background: var(--primary2);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}
.avail-btns { display: flex; gap: 8px; }
.avail-btn {
  flex: 1;
  padding: 10px 6px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text-dim);
  cursor: pointer;
}
.avail-btn:hover { opacity: 0.85; }
.avail-active { font-weight: 800; }

/* ---------- MODAL ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  width: 100%; max-width: 420px;
  max-height: 80vh; overflow-y: auto;
}
.modal-box h3 { color: var(--primary2); margin-bottom: 14px; }
.modal-box .field { margin-bottom: 12px; }
.modal-box label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.modal-box input {
  width: 100%; padding: 12px; background: #1f1f1f;
  border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 15px;
}
.modal-box input:focus { outline: none; border-color: var(--primary); }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }

/* ---------- CONNECTION STATUS ---------- */
.conn-status {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 16px;
  text-align: center;
}
.conn-online { background: #14532d; color: #86efac; }
.conn-offline { background: #7f1d1d; color: #fca5a5; }
.conn-syncing { background: #422006; color: #fde047; }

/* ---------- OFFLINE BANNER ---------- */
.offline-banner {
  background: rgba(234,179,8,0.12);
  border: 1px solid rgba(234,179,8,0.4);
  color: #fde047;
  font-size: 13px;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  line-height: 1.5;
}

/* ---------- INSTALL BANNER ---------- */
.install-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #2a1f5e;
  color: #c4b5fd;
  font-size: 13px;
  padding: 10px 16px;
}
.install-banner span { flex: 1; }
.install-banner-btn {
  background: linear-gradient(90deg, #16a34a, #22c55e);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.install-banner-x {
  background: none;
  border: none;
  color: #c4b5fd;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

/* ---------- payroll (v1.4.5) ---------- */
.payroll-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.payroll-total {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.35);
  font-weight: 700;
}
.payroll-note {
  margin-top: 12px; font-size: 12px; color: var(--text-dim);
  text-align: center; line-height: 1.5;
}

/* ── Geofence status line (added 2026-10-22) ───────────────────────────── */
.geo-status {
  margin: 8px 12px 0;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  border: 1px solid transparent;
}
.geo-status.geo-in {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.5);
  color: #4ade80;
}
.geo-status.geo-out {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.5);
  color: #f87171;
}
.geo-status.geo-warn {
  background: rgba(234, 179, 8, 0.14);
  border-color: rgba(234, 179, 8, 0.5);
  color: #facc15;
}
