:root {
  --navy: #121a4b;
  --blue-btn: #1d4b8f;
  --blue-btn-disabled: #7d96b8;
  --bg: #f5f5f5;
  --text: #111827;
  --muted: #555555;
  --border: #efefef;
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Roboto", "SF Pro Text", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* ===== LOGIN SCREEN ===== */
.login-screen {
  position: relative;
  width: 100%;
  height: 100dvh;
  background: url("/bg_home.png") center center / cover no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: env(safe-area-inset-top) 36px env(safe-area-inset-bottom);
}

.login-form-wrap {
  width: 100%;
  max-width: 360px;
  margin-top: 120px;
}

.login-form .field-group {
  margin-bottom: 14px;
  position: relative;
}

.login-form input {
  width: 100%;
  padding: 12px 10px;
  font-size: 15px;
  color: #111;
  background: rgba(255, 255, 255, 0.85);
  border: none;
  border-bottom: 2px solid #0065b3;
  border-radius: 6px 6px 0 0;
  outline: none;
}

.password-wrap .eye-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.login-btn {
  width: 100%;
  height: 45px;
  margin-top: 10px;
  border: none;
  border-radius: 6px;
  background: #0065b3;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.login-btn:disabled {
  opacity: 0.6;
}

.login-msg {
  color: #d32f2f;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  text-align: center;
  margin-top: 10px;
}

.login-msg:empty {
  display: none;
}

.login-version {
  position: absolute;
  bottom: calc(20px + env(safe-area-inset-bottom));
  font-size: 12px;
  font-weight: 700;
  color: #333;
  text-align: center;
}

/* ===== APP / GEOFENCE SCREEN ===== */
.app-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
}

.topbar {
  background: var(--navy);
  color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 12px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 1100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.icon-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  padding: 2px 6px;
  cursor: pointer;
}

.topbar-right {
  display: flex;
  gap: 8px;
}

.top-action {
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ===== MAP MODE ===== */
.map-mode {
  position: relative;
  flex: 1;
  width: 100%;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

.map-toggle-btn {
  background: rgba(215, 218, 222, 0.92);
  color: #111;
  border: none;
  border-radius: 3px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.map-toggle-left {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 900;
}

.gps-chip {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 900;
  background: rgba(18, 26, 75, 0.85);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 14px;
  max-width: 60%;
  text-align: right;
}

.bottom-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 900;
  padding: 0 12px;
  pointer-events: none;
}

.mulai-absen-btn {
  pointer-events: auto;
  display: block;
  width: 155px;
  height: 44px;
  background: var(--blue-btn);
  color: #fff;
  border: none;
  border-radius: 2px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  margin-bottom: 18px;
  cursor: pointer;
}

.mulai-absen-btn:disabled {
  background: var(--blue-btn-disabled);
  cursor: not-allowed;
}

.notif-area {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.95);
  color: #111;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 8px 12px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.notif-area.err {
  background: #fdeaea;
  color: #b71c1c;
}

.notif-area.ok {
  background: #e8f5e9;
  color: #1b5e20;
}

/* ===== SUMMARY / DATA MODE ===== */
.summary-mode {
  flex: 1;
  overflow-y: auto;
  background: #f2f2f2;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.summary-top-row {
  display: flex;
  justify-content: flex-end;
  padding: 8px 10px 4px;
  background: #fff;
}

.inout-card {
  display: flex;
  background: #fff;
  height: 150px;
  border-bottom: 1px solid #e5e7eb;
}

.inout-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.inout-label {
  font-size: 13px;
  color: #444;
}

.inout-time {
  font-size: 26px;
  font-weight: 700;
  color: #111;
  margin: 6px 0;
}

.inout-date {
  font-size: 13px;
  color: #555;
}

.info-card {
  background: #fff;
  margin: 8px;
  padding: 8px 10px 14px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.nrp-row {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  font-weight: 700;
  font-size: 14px;
}

.nrp-col {
  flex: 1;
  text-align: center;
}

.nrp-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
}

.name-col {
  flex: 3;
  text-align: center;
}

.device-block {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #0a0909;
  padding: 10px 4px 4px;
  line-height: 1.6;
}

.warning-pp {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #ff0000;
  padding: 12px 10px;
  line-height: 1.4;
}

.table-header {
  display: flex;
  background: #e5e7eb;
  height: 38px;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.th-tgl { flex: 1; }
.th-io { flex: 0.5; }

.table-body .table-row {
  display: flex;
  padding: 9px 0;
  border-bottom: 1px solid #eeeeee;
  font-size: 12px;
  text-align: center;
}

.table-empty {
  text-align: center;
  padding: 14px;
  font-size: 12px;
  color: #777;
}

/* ===== LOVELY DIALOG MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 2000;
}

.modal-card {
  width: 100%;
  max-width: 330px;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
}

.modal-err { background: #ef5350; }
.modal-ok-hdr { background: #2e7d32; }

.modal-body {
  padding: 18px 20px 14px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #111;
}

.modal-msg {
  font-size: 14px;
  color: #444;
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.modal-ok {
  background: transparent;
  border: none;
  color: #111;
  font-size: 14px;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
}
