/* HR Location Finder - Powered by Anjok Technologies */
:root {
  --primary: #4338ca;
  --primary-2: #0ea5e9;
  --primary-soft: #eef2ff;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --green: #059669;  --green-soft: #d1fae5;
  --red: #dc2626;    --red-soft: #fee2e2;
  --orange: #d97706; --orange-soft: #fef3c7;
  --blue: #2563eb;   --blue-soft: #dbeafe;
  --purple: #7c3aed; --purple-soft: #ede9fe;
  --gray-soft: #f3f4f6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06);
  --grad: linear-gradient(135deg, var(--primary), var(--primary-2));
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1220; --card: #181c2e; --text: #e5e7eb; --muted: #9ca3af; --border: #2a3047;
    --primary-soft: #23264a; --gray-soft: #22263a;
    --green-soft: #0b3b2e; --red-soft: #451a1a; --orange-soft: #41300b; --blue-soft: #172554; --purple-soft: #2e1b5c;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
@media (prefers-color-scheme: dark) { a { color: #a5b4fc; } }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1rem; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  font: inherit; font-weight: 600; line-height: 1.2; background: var(--gray-soft); color: var(--text);
  transition: transform .05s, filter .15s; text-decoration: none;
}
.btn:hover { filter: brightness(.96); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-warning { background: var(--orange); color: #fff; }
.btn-purple { background: var(--purple); color: #fff; }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
@media (prefers-color-scheme: dark) { .btn-outline { color: #a5b4fc; border-color: #6366f1; } }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-sm { padding: .35rem .65rem; font-size: .82rem; border-radius: 8px; }
.btn-lg { padding: .9rem 1.2rem; font-size: 1.05rem; }
.btn-block { display: flex; width: 100%; }
form .field { margin-bottom: .9rem; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
input, select, textarea {
  width: 100%; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 10px;
  font: inherit; background: var(--card); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #a5b4fc; border-color: var(--primary); }
textarea { min-height: 110px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { margin: 0; min-width: 150px; flex: 1; }
.filters .field.narrow { flex: 0 0 auto; }

/* ---------- cards, alerts, badges ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; margin-bottom: 1rem; border: 1px solid var(--border); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.alert { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 500; }
.alert-success { background: var(--green-soft); color: var(--green); }
.alert-error { background: var(--red-soft); color: var(--red); }
.alert-info { background: var(--blue-soft); color: var(--blue); }
.alert-warning { background: var(--orange-soft); color: var(--orange); }
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-orange { background: var(--orange-soft); color: var(--orange); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-gray { background: var(--gray-soft); color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #9ca3af; margin-right: .35rem; vertical-align: middle; }
.dot.on { background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.25); }
.loc-link { color: inherit; }
.loc-link:hover { color: var(--primary); text-decoration: underline; }
.pin { font-size: .85em; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: var(--card); font-size: .9rem; }
th, td { padding: .65rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--gray-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.addr { min-width: 220px; max-width: 360px; }
.actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.actions form { margin: 0; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .85rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.stat .num { font-size: 1.8rem; font-weight: 800; }
.stat .lbl { color: var(--muted); font-size: .85rem; }
.stat.c1 .num { color: var(--primary); } .stat.c2 .num { color: var(--green); }
.stat.c3 .num { color: var(--blue); } .stat.c4 .num { color: var(--orange); } .stat.c5 .num { color: var(--purple); }

/* ---------- maps ---------- */
.map { height: 420px; border-radius: 12px; border: 1px solid var(--border); z-index: 0; }
.map.tall { height: calc(100vh - 210px); min-height: 380px; }
.map.small { height: 240px; }

/* ---------- auth ---------- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.25rem; background: var(--grad); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 20px; padding: 2rem 1.5rem 1.25rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); text-align: center; }
.auth-card form { text-align: left; margin-top: 1rem; }
.auth-card .btn-block { margin-top: .6rem; }
.auth-logo { width: 76px; height: 76px; border-radius: 18px; margin-bottom: .75rem; }
.auth-card h1 { font-size: 1.4rem; }
.geo-status { font-size: .82rem; margin: .5rem 0; padding: .5rem .7rem; border-radius: 8px; background: var(--gray-soft); color: var(--muted); }
.powered { text-align: center; font-size: .78rem; color: var(--muted); margin-top: 1.25rem; padding-bottom: .5rem; }
.powered strong { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- admin layout ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; background: #1e1b4b; color: #c7d2fe; position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column; padding: 1rem .75rem; overflow-y: auto; z-index: 50; transition: transform .2s;
}
.sidebar .brand { display: flex; gap: .65rem; align-items: center; padding: .25rem .5rem 1rem; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: .75rem; }
.sidebar .brand img { width: 40px; height: 40px; border-radius: 10px; }
.sidebar .brand strong { color: #fff; display: block; font-size: .95rem; }
.sidebar .brand small { color: #a5b4fc; font-size: .75rem; }
.sidebar nav { flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: .6rem; padding: .6rem .75rem; border-radius: 10px; color: #c7d2fe; font-weight: 500; margin-bottom: 2px; }
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar nav a.active { background: var(--grad); color: #fff; }
.sidebar nav .ico { width: 1.4rem; text-align: center; }
.sidebar nav .count { margin-left: auto; background: #f59e0b; color: #111; border-radius: 999px; font-size: .72rem; padding: 0 .45rem; font-weight: 700; }
.sidebar .powered { color: #a5b4fc; }
.sidebar .install-btn { color: #fff; border-color: rgba(255,255,255,.4); margin-top: .5rem; }
.admin-main { flex: 1; margin-left: 250px; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem; background: var(--card); border-bottom: 1px solid var(--border); padding: .75rem 1.25rem; }
.topbar h1 { font-size: 1.15rem; margin: 0; flex: 1; }
.topbar-user { color: var(--muted); font-size: .9rem; }
.menu-btn { display: none; background: none; border: 0; font-size: 1.5rem; color: var(--text); cursor: pointer; }
.content { padding: 1.25rem; flex: 1; }
.page-footer { border-top: 1px solid var(--border); padding: .25rem; }
.sidebar-backdrop { display: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }
@media (max-width: 960px) {
  .grid-2, .grid-3-1 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
  .admin-main { margin-left: 0; }
  .menu-btn { display: block; }
  .topbar-user { display: none; }
  .content { padding: .9rem; }
  .map { height: 320px; }
}
.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: .4rem .75rem; margin: 0; }
.detail-list dt { color: var(--muted); font-size: .85rem; }
.detail-list dd { margin: 0; font-weight: 500; word-break: break-word; }
.report-body { white-space: pre-wrap; background: var(--gray-soft); padding: .9rem; border-radius: 10px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.modal-box { background: var(--card); border-radius: 16px; width: 100%; max-width: 460px; padding: 1.25rem; max-height: 90vh; overflow-y: auto; }

/* ---------- employee app ---------- */
body.employee { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.emp-top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .7rem;
  padding: calc(.7rem + env(safe-area-inset-top)) 1rem .7rem; background: var(--grad); color: #fff;
}
.emp-top img { width: 36px; height: 36px; border-radius: 10px; background: #fff; }
.emp-top-title { flex: 1; min-width: 0; }
.emp-top-title strong { display: block; font-size: 1.02rem; }
.emp-top-title small { opacity: .85; font-size: .78rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.net-dot { width: 10px; height: 10px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(255,255,255,.3); }
.net-dot.off { background: #f87171; }
.emp-main { max-width: 640px; margin: 0 auto; padding: 1rem; }
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; background: var(--card);
  border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 16px rgba(0,0,0,.06);
}
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: .5rem 0 .45rem; color: var(--muted); font-size: .72rem; font-weight: 600; position: relative; }
.bottom-nav a .ico { font-size: 1.3rem; line-height: 1.2; filter: grayscale(1); opacity: .75; }
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a.active .ico { filter: none; opacity: 1; }
.nav-badge { position: absolute; top: 2px; left: 54%; background: var(--red); color: #fff; font-size: .65rem; border-radius: 999px; padding: 0 .4rem; min-width: 18px; text-align: center; }
.hero { background: var(--card); border-radius: 20px; padding: 1.25rem; box-shadow: var(--shadow); border: 1px solid var(--border); text-align: center; margin-bottom: 1rem; }
.hero .clock { font-size: 2.4rem; font-weight: 800; letter-spacing: -.02em; }
.hero .date { color: var(--muted); margin-bottom: 1rem; }
.punch-btn {
  width: 170px; height: 170px; border-radius: 50%; border: 0; color: #fff; font-size: 1.15rem; font-weight: 800; cursor: pointer;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; margin: .5rem auto 1rem;
  box-shadow: 0 12px 30px rgba(67,56,202,.35); transition: transform .1s;
}
.punch-btn .big { font-size: 2.4rem; }
.punch-btn.in { background: linear-gradient(135deg, #059669, #10b981); box-shadow: 0 12px 30px rgba(5,150,105,.35); }
.punch-btn.out { background: linear-gradient(135deg, #dc2626, #f97316); box-shadow: 0 12px 30px rgba(220,38,38,.35); }
.punch-btn:active { transform: scale(.96); }
.punch-btn:disabled { opacity: .7; }
.status-line { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; font-size: .9rem; }
.status-line div span { display: block; color: var(--muted); font-size: .78rem; }
.status-line div strong { font-size: 1rem; }
.cur-loc { font-size: .85rem; color: var(--muted); margin-top: .75rem; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: 1rem; }
.quick .btn { padding: .9rem .5rem; flex-direction: column; font-size: .88rem; border-radius: 14px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); }
.quick .btn .big { font-size: 1.5rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; border-left: 2px solid var(--border); margin-left: .5rem; }
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid var(--card); }
.timeline li.punch_in::before { background: var(--green); }
.timeline li.punch_out::before { background: var(--red); }
.timeline li.visit::before { background: var(--blue); }
.timeline li.request::before { background: var(--purple); }
.timeline li.track::before { background: #9ca3af; }
.timeline .t { font-size: .78rem; color: var(--muted); }
.list-item { padding: .85rem 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item.unread { background: var(--primary-soft); margin: 0 -1.1rem; padding: .85rem 1.1rem; }
.toast-box { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 2000; width: calc(100% - 2rem); max-width: 420px; }
.toast { background: #111827; color: #fff; padding: .85rem 1rem; border-radius: 12px; margin-bottom: .5rem; box-shadow: 0 10px 30px rgba(0,0,0,.3); animation: slideIn .25s ease-out; }
.toast strong { display: block; }
.toast.success { background: var(--green); } .toast.error { background: var(--red); }
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.spinner { width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
