:root {
  --green: #0d9463;
  --green-dark: #0a7a51;
  --red: #d64545;
  --amber: #b97f10;
  --ink: #1c2430;
  --muted: #64748b;
  --bg: #eef2f5;
  --card: #ffffff;
  --line: #e3e8ee;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", Arial, sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, #dfe7ee 100%);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  -webkit-tap-highlight-color: transparent;
}

.card {
  background: var(--card);
  width: 100%;
  max-width: 400px;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(20, 40, 60, 0.12);
  padding: 28px 22px 20px;
  text-align: center;
}

.badge {
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #e6f5ee;
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
}

h1 { font-size: 1.35rem; margin-bottom: 4px; }

.employee { color: var(--muted); font-size: 0.95rem; margin-bottom: 16px; }
.employee strong { color: var(--ink); }

.status {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.95rem;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: #f6f8fa;
  color: var(--ink);
}
.status.info   { background: #f6f8fa; }
.status.working{ background: #eef4fb; border-color: #cfe0f5; color: #1d4e89; }
.status.success{ background: #e9f7f0; border-color: #bfe6d2; color: var(--green-dark); }
.status.error  { background: #fdecec; border-color: #f3c1c1; color: var(--red); }
.status.hidden { display: none; }

.gps-box {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 14px;
}
.gps-box .pin { margin-inline-end: 4px; }
.gps-box.hidden { display: none; }

.btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn:hover:not(:disabled) { background: var(--green-dark); }
.btn:disabled { background: #9fb8ac; cursor: not-allowed; }
.btn.small {
  width: auto;
  font-size: 0.8rem;
  padding: 8px 14px;
  background: #334155;
}
.btn.small:hover:not(:disabled) { background: #1e293b; }
.btn.secondary { background: #334155; margin-top: 10px; }
.btn.secondary:hover:not(:disabled) { background: #1e293b; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.result {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
}
.result.success { background: #e9f7f0; color: var(--green-dark); }
.result.error { background: #fdecec; color: var(--red); }
.result.hidden { display: none; }

.panel {
  margin-top: 18px;
  padding: 16px 14px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: #fbfcfd;
  text-align: right;
}
.panel h2 { font-size: 1rem; color: var(--red); margin-bottom: 6px; }
.panel p { font-size: 0.88rem; color: var(--muted); margin-bottom: 12px; }
.panel.hidden { display: none; }

.device-id-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.device-id-row code {
  font-size: 0.68rem;
  background: #eef2f6;
  border-radius: 8px;
  padding: 8px;
  word-break: break-all;
  direction: ltr;
  text-align: left;
  flex: 1;
}

footer {
  margin-top: 18px;
  font-size: 0.75rem;
  color: #9aa7b4;
}

/* ===== admin panel ===== */
.card.admin { max-width: 520px; text-align: right; }
.card.admin h1 { text-align: center; }
.card.admin .employee { text-align: center; }

.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  margin-bottom: 10px;
  background: #fbfcfd;
}
.input:focus { outline: 2px solid #bfe6d2; border-color: var(--green); }

.lbl {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 8px 0 4px;
}

.tabs {
  display: flex;
  gap: 6px;
  margin: 16px 0 14px;
}
.tab {
  flex: 1;
  border: 1px solid var(--line);
  background: #f6f8fa;
  border-radius: 10px;
  padding: 9px 6px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.tab.active { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.tab-body.hidden { display: none; }

.list { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.list .empty { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 14px 0; }

.row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbfcfd;
}
.row-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.row-main strong { font-size: 0.95rem; }
.row-main .code { font-size: 0.78rem; color: var(--muted); }
.row-main .devid {
  width: 100%;
  font-size: 0.66rem;
  background: #eef2f6;
  border-radius: 6px;
  padding: 4px 6px;
  direction: ltr;
  text-align: left;
  word-break: break-all;
}
.row-main .seen { font-size: 0.72rem; color: #9aa7b4; width: 100%; }
.pill {
  font-size: 0.7rem;
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 600;
}
.pill.ok { background: #e9f7f0; color: var(--green-dark); }
.pill.blocked { background: #fdecec; color: var(--red); }
.row-actions { display: flex; gap: 6px; }
.row-actions .btn.small { flex: 1; }
