:root {
  --bg: #f3f7fb;
  --card: #ffffff;
  --text: #122033;
  --muted: #6b7a90;
  --line: #dbe5ef;
  --blue: #0f48ad;
  --teal: #078d8d;
  --green: #19a75b;
  --red: #ef4444;
  --amber: #f59e0b;
  --shadow: 0 18px 45px rgba(24, 47, 78, 0.1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Noto Sans Thai", Tahoma, sans-serif;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.login-screen, .pending-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(180deg, #f7fbff, #e8f1f8);
}
.login-card {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 28px;
}
.login-brand { color: var(--text); margin-bottom: 20px; }
.login-brand span { color: var(--muted); }
.login-card h1 { font-size: 30px; margin-bottom: 10px; }
.login-card p, .muted { color: var(--muted); line-height: 1.6; }
.google-login { min-height: 44px; margin-top: 18px; }
.google-redirect-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}
.google-redirect-btn:hover { background: #f8fafc; }
.google-redirect-btn span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #4285f4;
  font-size: 22px;
  font-weight: 900;
}
.login-message {
  min-height: 22px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.status-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 16px;
  border-radius: 18px;
  background: #fff7df;
  color: #a86a00;
  font-size: 28px;
}

.app { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  width: 260px;
  height: 100vh;
  flex-direction: column;
  padding: 22px;
  background: linear-gradient(180deg, #077b7c, #075d63);
  color: #fff;
}
.brand, .sidebar-user, .mobile-profile, .card-head, .panel-head, .sheet-head, .user-banner {
  display: flex;
  align-items: center;
}
.brand { gap: 12px; margin-bottom: 28px; }
.brand-mark, .avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #fff;
  color: var(--teal);
  font-weight: 900;
}
.brand span, .sidebar-user span { display: block; color: rgba(255,255,255,.75); font-size: 12px; }
.nav { display: grid; gap: 8px; }
.nav a {
  border-radius: 12px;
  color: rgba(255,255,255,.85);
  padding: 12px 14px;
  text-decoration: none;
  font-weight: 700;
}
.nav a.active, .nav a:hover { background: rgba(255,255,255,.14); color: #fff; }
.sidebar-user { gap: 12px; margin-top: auto; border-top: 1px solid rgba(255,255,255,.16); padding-top: 18px; }

.content { width: 100%; padding: 28px; }
.app-page { scroll-margin-top: 20px; }
.app-page[hidden] { display: none !important; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.eyebrow { color: var(--teal); font-size: 12px; font-weight: 900; letter-spacing: .04em; margin: 0 0 4px; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(26px, 4vw, 40px); }
h2 { margin-bottom: 0; }
.top-actions { display: flex; gap: 10px; }
.icon-btn, .logout, .primary, .danger, .quick-grid button {
  border: 0;
  cursor: pointer;
  font-weight: 800;
}
.icon-btn {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
}
.logout { border-radius: 14px; background: #e9eef6; color: var(--text); padding: 0 16px; }

.mobile-hero { display: none; }
.grid { display: grid; gap: 18px; }
.dashboard-grid { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.attendance-card { max-width: 760px; }
.card, .panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.card { padding: 22px; }
.card-head, .panel-head { justify-content: space-between; gap: 14px; }
.status, .pill, .badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 900;
}
.status, .pill.soft { background: #e9f2ff; color: var(--blue); }
.check-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 4px; }
.primary { min-height: 52px; border-radius: 14px; color: #fff; padding: 0 16px; }
.green { background: var(--green); }
.blue { background: var(--blue); }
.gray { background: #e8edf4; color: #738197; }
.teal { background: var(--teal); }
.amber { background: var(--amber); color: #fff; }
.branch-workbox {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.branch-workbox label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.branch-status {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbff;
  color: var(--muted);
  padding: 12px;
  font-weight: 800;
}
.branch-status.ok { background: #dcfce7; color: #168046; }
.branch-status.warn { background: #fff3d6; color: #a86a00; }
.branch-status.error { background: #fee2e2; color: #b91c1c; }
.branch-mode-note {
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: #eff6ff;
  color: #47607f;
  line-height: 1.55;
  padding: 14px 16px;
  font-weight: 800;
}
.branch-mode-note strong { color: var(--blue); }
.attendance-days {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.attendance-day-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 12px;
}
.attendance-day-card strong,
.attendance-day-card span { display: block; }
.attendance-day-card strong { color: var(--text); }
.attendance-day-card span { color: var(--muted); font-size: 13px; margin-top: 4px; }
.attendance-day-times {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.attendance-day-times div {
  border-radius: 12px;
  background: #f8fbff;
  padding: 10px;
}
.time-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.time-row div { padding: 16px; text-align: center; }
.time-row div + div { border-left: 1px solid var(--line); }
.time-row span, .stat-card span { display: block; color: var(--muted); font-size: 13px; }
.time-row strong { display: block; margin-top: 6px; font-size: 18px; }
.stat-card strong { display: block; margin: 10px 0 2px; color: var(--blue); font-size: 36px; }
.stat-card p { color: var(--muted); margin-bottom: 0; }

.quick-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 18px 0; }
.quick-grid button {
  min-height: 70px;
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
}
.panel { padding: 22px; }
.toolbar { display: grid; grid-template-columns: 1fr 180px 180px; gap: 12px; margin: 18px 0; }
input, select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 0 14px;
}
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { background: var(--teal); color: #fff; text-align: left; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); }
tbody tr:nth-child(even) { background: #f7fbff; }
.badge.ok { background: #dcfce7; color: #168046; }
.badge.wait { background: #fff3d6; color: #a86a00; }
.approval-list { display: grid; gap: 12px; margin-top: 16px; }
.branch-form {
  display: grid;
  grid-template-columns: 1fr 1.4fr 130px 130px 110px auto auto;
  gap: 10px;
  margin: 16px 0;
}
.manual-branch-tools {
  margin-top: 12px;
}
.manual-branch-tools summary {
  color: var(--teal);
  cursor: pointer;
  font-weight: 900;
}
.branch-setup-status {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbff;
  color: var(--muted);
  font-weight: 800;
  margin-top: 12px;
  padding: 12px;
}
.branch-setup-status.ok { background: #dcfce7; color: #168046; }
.branch-setup-status.warn { background: #fff3d6; color: #a86a00; }
.branch-setup-status.error { background: #fee2e2; color: #b91c1c; }
.branch-list { display: grid; gap: 10px; }
.branch-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
}
.branch-item strong, .branch-item span { display: block; }
.branch-item span { color: var(--muted); font-size: 13px; }
.branch-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.map-link {
  color: var(--teal);
  font-weight: 900;
  text-decoration: none;
}
.map-link:hover { text-decoration: underline; }
.secondary {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #eef6ff;
  color: var(--blue);
  cursor: pointer;
  font-weight: 900;
}
.edit-branch-btn {
  min-height: 42px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
  color: var(--blue);
  cursor: pointer;
  font-weight: 900;
  padding: 0 16px;
}
.edit-branch-btn:hover { background: #dbeafe; }
.delete-branch-btn {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  background: var(--red);
  color: #fff;
  cursor: pointer;
  font-weight: 900;
  padding: 0 16px;
}
.delete-branch-btn:disabled,
.secondary:disabled {
  opacity: .6;
  cursor: not-allowed;
}
.approval-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 12px;
}
.approval-item img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #eef3f9;
}
.approval-info strong, .approval-info span { display: block; }
.approval-info span { color: var(--muted); font-size: 13px; }
.approval-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.approval-actions select { min-height: 40px; }
.approve-btn, .reject-btn {
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  font-weight: 900;
  padding: 0 12px;
}
.approve-btn { background: var(--green); }
.reject-btn { background: var(--red); }
.empty {
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}
.leave-page {
  display: grid;
  gap: 18px;
}
.leave-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 220px;
  border-radius: 24px;
  background: linear-gradient(135deg, #2047ff, #10b7e7);
  color: #fff;
  padding: 28px;
  overflow: hidden;
  box-shadow: 0 20px 44px rgba(37, 99, 235, .16);
}
.leave-hero::after,
.rewards-hero::after,
.notifications-hero::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  right: -54px;
  bottom: -72px;
  border-radius: 50%;
  background: rgba(255,255,255,.16);
}
.leave-hero .eyebrow,
.leave-hero p { color: rgba(255,255,255,.88); }
.leave-hero h2 { font-size: 32px; margin-bottom: 8px; }
.leave-hero > * { position: relative; z-index: 1; }
.leave-list { display: grid; gap: 14px; }
.leave-card {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .07);
  padding: 18px;
  transition: transform .16s ease, box-shadow .16s ease;
}
.leave-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(37, 99, 235, .10);
}
.leave-icon {
  display: grid;
  place-items: center;
  min-height: 78px;
  border-right: 1px solid var(--line);
  color: var(--blue);
  font-size: 42px;
}
.leave-card h3 { margin: 0 0 10px; color: var(--blue); font-size: 22px; }
.leave-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
}
.leave-row + .leave-row { border-top: 1px solid var(--line); margin-top: 8px; }
.leave-row span { color: var(--muted); }
.leave-row strong { color: var(--red); }
.rewards-page {
  display: grid;
  gap: 18px;
}
.rewards-hero {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  border-radius: 24px;
  background: linear-gradient(135deg, #2246ff, #10b8e8);
  color: #fff;
  padding: 28px;
  box-shadow: 0 20px 44px rgba(37, 99, 235, .16);
}
.rewards-hero .eyebrow,
.rewards-hero p { color: rgba(255,255,255,.88); }
.rewards-hero h2 { font-size: 32px; margin-bottom: 8px; }
.rewards-hero > * { position: relative; z-index: 1; }
.reward-summary {
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: center;
  gap: 18px;
  margin-top: -44px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .09);
  padding: 18px;
}
.coin {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #ffd45a;
  color: #f59e0b;
  font-size: 34px;
  font-weight: 900;
}
.reward-summary span { color: var(--muted); }
.reward-summary strong { display: block; margin-top: 8px; color: #2dd4bf; font-size: 24px; }
.reward-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.reward-grid button {
  position: relative;
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .07);
  cursor: pointer;
  font-weight: 900;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.reward-grid button:hover,
.reward-grid button:focus-visible {
  border-color: #bfdbfe;
  box-shadow: 0 16px 34px rgba(37, 99, 235, .12);
  transform: translateY(-2px);
  outline: none;
}
.reward-grid button span {
  display: block;
  font-size: 42px;
  margin-bottom: 8px;
}
.reward-grid button strong { display: block; color: var(--text); }
.reward-grid button em {
  position: absolute;
  top: 10px;
  right: 12px;
  color: #2dd4bf;
  font-style: normal;
}
.notifications-page {
  display: grid;
  gap: 18px;
}
.notifications-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 132px;
  border-radius: 24px;
  background: linear-gradient(135deg, #2246ff, #10b8e8);
  color: #fff;
  text-align: center;
  box-shadow: 0 20px 44px rgba(37, 99, 235, .16);
}
.notifications-hero h2 {
  position: relative;
  z-index: 1;
  font-size: 28px;
}
.notification-list {
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .08);
  overflow: hidden;
}
.notification-empty {
  color: var(--muted);
  padding: 34px 22px;
  text-align: center;
  font-weight: 800;
}
.notification-empty::before {
  content: "🔔";
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #eff6ff;
  color: var(--blue);
  font-size: 28px;
}
.notification-item {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}
.notification-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #4adecf;
  color: #fff;
  font-size: 24px;
}
.notification-item strong { display: block; margin-bottom: 4px; }
.notification-item span { display: block; color: var(--muted); line-height: 1.45; }
.tools-page {
  display: grid;
  gap: 20px;
}
.tools-profile {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 260px;
  border-radius: 24px;
  background: linear-gradient(135deg, #1d4ed8 0%, #0ea5e9 58%, #fff 58%);
  text-align: center;
  box-shadow: 0 20px 46px rgba(15, 23, 42, .12);
}
.tools-profile::before,
.tools-profile::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.16);
}
.tools-profile::before {
  width: 180px;
  height: 180px;
  right: -54px;
  top: -52px;
}
.tools-profile::after {
  width: 120px;
  height: 120px;
  left: -38px;
  bottom: 18px;
}
.tools-profile .avatar.large {
  position: relative;
  z-index: 1;
  width: 116px;
  height: 116px;
  border: 6px solid #fff;
  color: var(--teal);
  background: #fff;
  box-shadow: var(--shadow);
}
.tools-profile h2,
.tools-profile p { position: relative; z-index: 1; }
.tools-profile h2 { margin: 4px 0; font-size: 28px; }
.tools-profile p { color: #50627c; font-weight: 800; }
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.tools-grid button {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 126px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .07);
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.tools-grid button:hover,
.tools-grid button:focus-visible {
  border-color: #bfdbfe;
  box-shadow: 0 16px 34px rgba(37, 99, 235, .12);
  transform: translateY(-2px);
  outline: none;
}
.tools-grid button:active {
  transform: translateY(0);
}
.tools-grid span {
  color: #4f46e5;
  font-size: 42px;
  line-height: 1;
}
.section-title {
  margin: 26px 0 14px;
}
.section-title span {
  display: block;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.section-title strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 24px;
}
.section-title p {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}
.admin-tools-panel {
  margin-top: 24px;
  border: 1px solid #bfdbfe;
  border-radius: 24px;
  background: #eff6ff;
  padding: 20px;
}
.admin-tools-grid button {
  border-color: #bfdbfe;
  background: #fff;
}
.admin-tools-grid span {
  color: #0f766e;
}
.request-form-page {
  display: grid;
  gap: 0;
  overflow: hidden;
  border-radius: 24px;
  background: #f3f7fb;
}
.form-hero {
  position: relative;
  min-height: 260px;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(135deg, #2246ff, #10b8e8);
  color: #fff;
  padding: 36px 28px;
}
.form-hero h2 { font-size: 28px; margin-bottom: 18px; }
.form-hero p {
  max-width: 320px;
  border-left: 2px solid rgba(255,255,255,.75);
  color: rgba(255,255,255,.9);
  line-height: 1.7;
  padding-left: 14px;
}
.back-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.16);
  color: #fff;
  cursor: pointer;
  font-size: 34px;
  line-height: 1;
  margin-bottom: 12px;
}
.mobile-form {
  display: grid;
  gap: 18px;
  padding: 26px 28px 34px;
}
.mobile-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}
.mobile-form input,
.mobile-form select,
.mobile-form textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #9ca3af;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 10px 0;
}
.submit-pill {
  justify-self: center;
  min-width: 260px;
  min-height: 58px;
  border: 0;
  border-radius: 999px;
  background: #3f46f5;
  color: #fff;
  box-shadow: 0 14px 28px rgba(63,70,245,.28);
  cursor: pointer;
  font-size: 20px;
  font-weight: 900;
  margin-top: 22px;
}
.attendance-modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  grid-template-rows: 1fr auto;
  background: #eef3f9;
}
.attendance-map {
  position: relative;
  overflow: hidden;
}
.attendance-map iframe {
  position: relative;
  z-index: 0;
  width: 100%;
  height: 100%;
  min-height: 520px;
  border: 0;
  touch-action: pan-x pan-y;
}
.modal-topbar {
  position: absolute;
  z-index: 2;
  inset-inline: 0;
  top: 0;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  min-height: 74px;
  background: linear-gradient(135deg, #2246ff, #10b8e8);
  color: #fff;
  text-align: center;
  padding-top: env(safe-area-inset-top);
}
.modal-topbar button {
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 42px;
}
.modal-fields {
  position: absolute;
  z-index: 2;
  inset-inline: 10%;
  top: 102px;
  display: grid;
  gap: 12px;
}
.modal-fields input,
.modal-fields select {
  min-height: 58px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 8px 24px rgba(15,23,42,.18);
  padding: 0 24px;
  color: var(--text);
  font-weight: 800;
}
.map-radius-circle {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: min(62vw, 320px);
  height: min(62vw, 320px);
  border: 5px solid rgba(16, 215, 154, .98);
  border-radius: 50%;
  background: rgba(16, 215, 154, .22);
  box-shadow: 0 0 0 12px rgba(16, 215, 154, .10), 0 10px 30px rgba(15,23,42,.22);
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.map-radius-circle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 4px 14px rgba(15,23,42,.3);
  transform: translate(-50%, -50%);
}
.map-radius-circle.outside {
  border-color: rgba(239, 68, 68, .95);
  background: rgba(239, 68, 68, .13);
  box-shadow: 0 0 0 10px rgba(239, 68, 68, .08);
}
.map-radius-circle.outside::after { background: var(--red); }
.map-touch-hint {
  position: absolute;
  z-index: 4;
  right: 16px;
  bottom: 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .68);
  color: #fff;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 900;
  pointer-events: none;
}
.modal-confirm-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
  align-items: center;
  border-radius: 24px 24px 0 0;
  background: #fff;
  padding: 20px 28px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -14px 32px rgba(15,23,42,.12);
}
.modal-confirm-bar strong { font-size: 20px; }
.modal-confirm-bar span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 800;
}
.modal-confirm-bar button {
  min-width: 170px;
  min-height: 56px;
  border: 0;
  border-radius: 999px;
  background: #10d79a;
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  font-weight: 900;
}
.modal-confirm-bar button:disabled {
  background: #e5e7eb;
  color: #fff;
  cursor: not-allowed;
}
.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, .45);
  padding: 22px;
  backdrop-filter: blur(7px);
}
.confirm-card {
  width: min(420px, 100%);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(15, 23, 42, .28);
  padding: 28px;
  text-align: center;
}
.confirm-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #eff6ff;
  color: var(--blue);
  font-size: 34px;
  font-weight: 900;
}
.confirm-card h2 {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 26px;
}
.confirm-card p {
  color: var(--muted);
  line-height: 1.55;
  font-weight: 700;
}
.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}
.confirm-actions button {
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-size: 17px;
  font-weight: 900;
}
.confirm-cancel {
  background: #eef2f7;
  color: #475569;
}
.confirm-ok {
  background: var(--green);
  color: #fff;
}
.confirm-ok.danger {
  width: auto;
  min-height: 52px;
  margin: 0;
  background: var(--red);
  font-size: 17px;
}

.bottom-nav { display: none; }
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(5px);
}
.sheet {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  max-height: 86vh;
  overflow: auto;
  border-radius: 28px 28px 0 0;
  background: #fff;
  padding: 18px;
}
.grab { width: 64px; height: 7px; margin: 0 auto 18px; border-radius: 99px; background: #d7e0ea; }
.sheet-head { justify-content: space-between; }
.user-banner {
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0;
  border-radius: 20px;
  background: linear-gradient(90deg, #078d8d, #2ebfb4);
  color: #fff;
  padding: 16px;
}
.user-banner span { display: block; opacity: .85; font-size: 12px; }
.user-banner em { border-radius: 99px; background: rgba(255,255,255,.18); font-style: normal; padding: 8px 12px; font-size: 12px; font-weight: 900; }
.menu-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.menu-grid a {
  min-height: 74px;
  border-radius: 18px;
  background: #eff8fb;
  color: var(--text);
  display: grid;
  place-items: center;
  text-align: center;
  text-decoration: none;
  font-weight: 800;
}
.menu-section {
  margin-top: 18px;
}
.menu-section > strong {
  display: block;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 16px;
}
.menu-section > p {
  margin: -4px 0 12px;
  color: var(--muted);
  font-weight: 700;
}
.admin-menu-section {
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  background: #eff6ff;
  padding: 14px;
}
.admin-menu-section .menu-grid a {
  background: #fff;
  color: #075d63;
}
.danger { width: 100%; min-height: 52px; margin-top: 20px; border-radius: 16px; background: var(--red); color: #fff; font-size: 18px; }

@media (max-width: 900px) {
  body { background: #eef3f9; }
  .app { display: block; }
  .sidebar, .topbar { display: none; }
  .content { padding: 0 14px 96px; }
  body.no-mobile-hero .mobile-hero { display: none; }
  body.no-mobile-hero .content { padding-top: 14px; }
  body.no-mobile-hero .leave-page,
  body.no-mobile-hero .rewards-page,
  body.no-mobile-hero .notifications-page,
  body.no-mobile-hero .tools-page { padding-bottom: 12px; }
  .mobile-hero {
    display: block;
    margin: 0 -14px 0;
    padding: 26px 20px 72px;
    border-radius: 0 0 30px 30px;
    background: linear-gradient(180deg, #1976d2, #0f48ad);
    color: #fff;
  }
  .mobile-company span, .mobile-profile p, .date { color: rgba(255,255,255,.82); }
  .mobile-profile { gap: 14px; margin-top: 24px; }
  .avatar.large { width: 62px; height: 62px; border-radius: 50%; background: rgba(255,255,255,.16); color: #fff; border: 2px solid rgba(255,255,255,.55); }
  .mobile-profile h2 { font-size: 20px; margin-bottom: 2px; }
  .clock { margin-top: 18px; text-align: center; font-size: 58px; font-weight: 900; line-height: 1; }
  .date { text-align: center; margin-top: 8px; font-size: 14px; }
  .dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: -48px; }
  .attendance-card { max-width: none; border-radius: 22px; margin-top: -48px; }
  .card, .panel { border-radius: 18px; padding: 16px; }
  .check-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .primary { min-height: 62px; padding: 0 8px; }
  .stat-card strong { font-size: 30px; }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
  .quick-grid button { min-height: 64px; }
  .toolbar { grid-template-columns: 1fr; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .bottom-nav {
    position: fixed;
    z-index: 40;
    inset-inline: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border-top: 1px solid var(--line);
    background: #fff;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 30px rgba(24,47,78,.08);
  }
  .bottom-nav a, .bottom-nav button {
    border: 0;
    background: transparent;
    color: #718096;
    text-align: center;
    text-decoration: none;
    font-size: 19px;
    font-weight: 900;
  }
  .bottom-nav span { display: block; margin-top: 2px; font-size: 11px; }
  .bottom-nav .active { color: var(--blue); }
  .bottom-nav a:nth-child(3) {
    transform: translateY(-8px);
    border-radius: 999px;
    background: #f2f4f8;
    padding: 10px 4px 8px;
    color: #0f172a;
  }
  .bottom-nav a:nth-child(3).active {
    color: var(--blue);
    background: #eef2ff;
  }
  .menu-grid { grid-template-columns: repeat(3, 1fr); }
  .approval-item { grid-template-columns: 44px 1fr; }
  .approval-actions { grid-column: 1 / -1; flex-wrap: wrap; }
  .branch-form { grid-template-columns: 1fr; }
  .branch-item { grid-template-columns: 1fr; }
  .branch-actions { justify-content: space-between; }
}

@media (max-width: 520px) {
  h1 { font-size: 30px; }
  .dashboard-grid { grid-template-columns: 1fr; gap: 12px; }
  .time-row strong { font-size: 15px; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .menu-grid { grid-template-columns: repeat(2, 1fr); }
  .check-actions,
  .attendance-day-times { grid-template-columns: 1fr; }
  .primary { width: 100%; }
  .leave-hero { min-height: 190px; align-items: flex-end; padding: 22px; }
  .leave-hero { flex-direction: column; align-items: stretch; }
  .leave-card { grid-template-columns: 76px 1fr; padding: 14px; }
  .leave-icon { font-size: 34px; min-height: 70px; }
  .rewards-hero { min-height: 190px; padding: 22px; }
  .reward-summary { grid-template-columns: 68px 1fr; }
  .reward-grid { grid-template-columns: repeat(2, 1fr); }
  .reward-grid button { min-height: 118px; }
  .notification-item { grid-template-columns: 50px 1fr; padding: 14px; }
  .tools-profile { min-height: 240px; margin: 0 -2px; }
  .tools-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .tools-grid button { min-height: 112px; font-size: 13px; border-radius: 16px; }
  .tools-grid span { font-size: 32px; }
  .admin-tools-panel { padding: 14px; border-radius: 20px; }
  .section-title strong { font-size: 22px; }
  .request-form-page { border-radius: 0; margin: 0 -14px; }
  .form-hero { border-radius: 0; min-height: 260px; }
  .mobile-form { padding: 26px 28px 96px; }
  .attendance-map iframe { min-height: calc(100vh - 116px); }
  .modal-fields { inset-inline: 28px; top: 92px; }
  .modal-confirm-bar {
    grid-template-columns: 1fr 1fr;
    padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  }
  .modal-confirm-bar strong { font-size: 18px; }
  .modal-confirm-bar span { font-size: 13px; }
  .modal-confirm-bar button { min-width: 0; width: 100%; }
  .bottom-nav a, .bottom-nav button { font-size: 17px; }
  .bottom-nav span { font-size: 10px; }
}





body.modal-open { overflow: hidden; }
.branch-map-dialog {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .55);
}
.branch-map-card {
  width: min(980px, 100%);
  max-height: min(820px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: auto auto minmax(320px, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 28px 70px rgba(15, 23, 42, .28);
}
.branch-map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 12px;
}
.branch-map-head h2 { margin: 0; }
.branch-map-help {
  margin: 0 22px 14px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: #eff6ff;
  color: #47607f;
  padding: 12px 14px;
  font-weight: 800;
  line-height: 1.5;
}
.branch-map-canvas {
  position: relative;
  width: 100%;
  min-height: 420px;
  overflow: hidden;
  background: #e8eef5;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.branch-map-canvas:active { cursor: grabbing; }
.branch-map-tiles { position: absolute; inset: 0; }
.branch-map-tiles img {
  position: absolute;
  width: 256px;
  height: 256px;
  user-select: none;
  pointer-events: none;
}
.branch-map-radius-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  border: 3px solid rgba(16, 185, 129, .95);
  border-radius: 999px;
  background: rgba(16, 185, 129, .18);
  box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 12px 28px rgba(15,23,42,.18);
  pointer-events: none;
}
.branch-map-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  transform: translate(-50%, -92%);
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 999px 999px 999px 0;
  background: var(--red);
  color: #fff;
  box-shadow: 0 12px 26px rgba(15,23,42,.32);
  font-size: 24px;
  font-weight: 900;
  pointer-events: none;
}
.branch-map-credit {
  position: absolute;
  left: 14px;
  bottom: 12px;
  z-index: 4;
  border-radius: 999px;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}
.branch-map-foot {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 16px 22px 20px;
  border-top: 1px solid var(--line);
}
.branch-map-foot span {
  color: var(--muted);
  font-weight: 900;
}
.branch-map-foot button { min-height: 46px; }

@media (max-width: 720px) {
  .branch-map-dialog { padding: 0; align-items: stretch; }
  .branch-map-card {
    min-height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    grid-template-rows: auto auto 1fr auto;
  }
  .branch-map-canvas { min-height: 360px; }
  .branch-map-foot { grid-template-columns: 1fr; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .branch-map-foot button { width: 100%; }
}
