:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Login ---------- */
.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}
.login-logo { height: 36px; width: auto; display: block; margin: 0 0 16px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p.sub { color: var(--text-muted); margin: 0 0 24px; font-size: 14px; }

/* ---------- Post-login menu ---------- */
.menu-card { max-width: 420px; text-align: left; }
.menu-grid { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.menu-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  width: 100%; text-align: left; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; cursor: pointer; font-family: inherit;
}
.menu-item:hover:not(:disabled) { border-color: var(--primary); background: #f5f8ff; }
.menu-item:disabled { cursor: default; opacity: 0.55; }
.menu-item-title { font-weight: 600; font-size: 15px; display: flex; align-items: center; }
.menu-item-desc { color: var(--text-muted); font-size: 13px; }
.menu-item-title .badge {
  background: var(--danger); color: #fff; font-size: 11px; border-radius: 999px;
  padding: 1px 6px; margin-left: 6px;
}

/* ---------- Header / nav ---------- */
header.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  flex-shrink: 0;
}
header.topbar .brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.brand-logo { height: 22px; width: auto; display: block; }
nav.tabs { display: flex; gap: 4px; }
nav.tabs button {
  background: none; border: none; padding: 8px 14px; border-radius: 8px;
  font-size: 14px; color: var(--text-muted); cursor: pointer; position: relative;
}
nav.tabs button.active { background: #eef2ff; color: var(--primary); font-weight: 600; }
nav.tabs button .badge {
  background: var(--danger); color: #fff; font-size: 11px; border-radius: 999px;
  padding: 1px 6px; margin-left: 6px;
}
.user-menu { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.user-menu .who { text-align: right; line-height: 1.2; }
.user-menu .who .role { color: var(--text-muted); font-size: 12px; text-transform: capitalize; }

main { flex: 1; padding: 24px; max-width: 900px; width: 100%; margin: 0 auto; }

/* ---------- Generic elements ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
h2.page-title { font-size: 18px; margin: 0 0 16px; }
label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
label:first-child { margin-top: 0; }
input, select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
textarea { resize: vertical; min-height: 70px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
button.btn {
  background: var(--primary); color: #fff; border: none; padding: 10px 16px;
  border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
}
button.btn:hover { background: var(--primary-dark); }
button.btn.secondary { background: #eef0f3; color: var(--text); }
button.btn.secondary:hover { background: #e2e5ea; }
button.btn.danger { background: var(--danger); }
button.btn.danger:hover { background: #b91c1c; }
button.btn:disabled { opacity: 0.55; cursor: default; }
button.btn.sm { padding: 6px 10px; font-size: 12px; }
.error-msg { background: var(--danger-bg); color: var(--danger); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.success-msg { background: var(--success-bg); color: var(--success); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.empty { color: var(--text-muted); font-size: 14px; padding: 24px 0; text-align: center; }

/* ---------- Status badges ---------- */
.badge-status { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; display: inline-block; }
.badge-status.pending { background: var(--amber-bg); color: var(--amber); }
.badge-status.approved { background: var(--success-bg); color: var(--success); }
.badge-status.declined { background: var(--danger-bg); color: var(--danger); }
.badge-status.cancelled { background: #eef0f3; color: var(--text-muted); }

/* ---------- Claims list ---------- */
.claim-item {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
  margin-bottom: 10px; cursor: pointer; background: #fff;
}
.claim-item:hover { border-color: #c7d2fe; }
.claim-item .top-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.claim-item .title { font-weight: 600; font-size: 14px; }
.claim-item .meta { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.claim-item .amount { font-weight: 700; font-size: 15px; }

/* ---------- Detail / steps ---------- */
.steps-list { list-style: none; padding: 0; margin: 12px 0 0; }
.steps-list li {
  display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.steps-list li:last-child { border-bottom: none; }
.step-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.step-dot.pending { background: #f59e0b; }
.step-dot.approved { background: var(--success); }
.step-dot.declined { background: var(--danger); }
.step-dot.skipped { background: #cbd5e1; }
.slip-preview { max-width: 100%; border-radius: 8px; margin-top: 12px; border: 1px solid var(--border); }

/* ---------- Slip capture (camera / file) ---------- */
.slip-capture-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.slip-capture-btn { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; margin: 0; text-align: center; }
.slip-preview-wrap { margin-top: 12px; display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.slip-preview-wrap[hidden] { display: none; }
.slip-preview-thumb { max-width: 200px; max-height: 200px; border-radius: 8px; border: 1px solid var(--border); display: block; object-fit: cover; }

/* ---------- Modal / overlay ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center;
  justify-content: center; padding: 20px; z-index: 50;
}
.modal { background: #fff; border-radius: var(--radius); padding: 24px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin-top: 0; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- Admin tables ---------- */
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th, table.data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.data-table th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.admin-subtabs { display: flex; gap: 8px; margin-bottom: 16px; }
.admin-subtabs button {
  background: #eef0f3; border: none; padding: 7px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
}
.admin-subtabs button.active { background: var(--primary); color: #fff; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-top: 12px; }
.inline-form .field { display: flex; flex-direction: column; gap: 4px; }
.inline-form .field label { margin: 0; }
.toggle-active { cursor: pointer; }

@media (max-width: 640px) {
  main { padding: 14px; }
  header.topbar { padding: 0 12px; }
  nav.tabs { gap: 0; }
  nav.tabs button { padding: 8px 10px; font-size: 13px; }
  .user-menu .who { display: none; }
  .row { flex-direction: column; }
}
