/* HelperPay — mobile-first styles */

:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1a2233;
  --muted: #66718a;
  --line: #e3e8f0;
  --accent: #0b6e4f;
  --accent-soft: #e2f3ec;
  --blue: #2563eb;
  --blue-soft: #e4edff;
  --amber: #b45309;
  --amber-soft: #fdeeda;
  --red: #c0392b;
  --red-soft: #fde8e5;
  --green: #0b6e4f;
  --green-soft: #e2f3ec;
  --shadow: 0 1px 3px rgba(20, 30, 55, .08), 0 4px 14px rgba(20, 30, 55, .06);
  --radius: 14px;
  --tabbar-h: 62px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161f;
    --card: #1b2130;
    --text: #e8ecf4;
    --muted: #98a3ba;
    --line: #2a3245;
    --accent: #3dbd8e;
    --accent-soft: #17352a;
    --blue: #6c9bff;
    --blue-soft: #1c2947;
    --amber: #ffb45e;
    --amber-soft: #3a2a14;
    --red: #ff7b6b;
    --red-soft: #40201b;
    --green: #3dbd8e;
    --green-soft: #17352a;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 5px; font-weight: 600; }

/* ---------- header ---------- */

#topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  display: flex; align-items: center; justify-content: space-between;
}
#topbar .brand { font-weight: 800; font-size: 18px; letter-spacing: -.2px; }
#topbar .brand span { color: var(--accent); }
.mode-chip {
  font-size: 12.5px; font-weight: 700;
  padding: 6px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.mode-chip.helper { background: var(--blue-soft); color: var(--blue); }

/* ---------- layout ---------- */

#view { max-width: 560px; margin: 0 auto; padding: 14px 14px 30px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { font-size: 16px; margin-bottom: 10px; }
.card h3 { font-size: 14px; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 700; font-size: 12px; }

.muted { color: var(--muted); font-size: 13.5px; }
.small { font-size: 12.5px; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }
.mt { margin-top: 12px; }

.language-row { align-items: center; }
.language-row h2 { margin-bottom: 2px; }
.language-switch {
  display: inline-flex; flex: 0 0 auto;
  padding: 3px; border-radius: 10px; background: var(--bg);
  border: 1px solid var(--line);
}
.language-switch button {
  padding: 7px 10px; border-radius: 7px;
  color: var(--muted); font-size: 12.5px; font-weight: 700;
  white-space: nowrap;
}
.language-switch button.active {
  color: var(--accent); background: var(--card); box-shadow: var(--shadow);
}

@media (max-width: 390px) {
  .language-row { align-items: flex-start; flex-direction: column; }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 12px 16px; border-radius: 12px;
  font-weight: 700; font-size: 15px;
  background: var(--accent); color: #fff;
  width: 100%;
  transition: transform .06s ease;
}
.btn:active { transform: scale(.985); }
.btn.secondary { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn.ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--line); }
.btn.danger { background: var(--red); }
.btn.blue { background: var(--blue); }
.btn.compact { width: auto; padding: 8px 14px; font-size: 13.5px; border-radius: 10px; }

/* big day-status choice buttons */
.choice-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.choice {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%;
  padding: 15px 16px;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: var(--card);
  font-size: 16px; font-weight: 600;
  text-align: left;
}
.choice .sub { display: block; font-size: 12.5px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.choice .amt { font-weight: 800; font-size: 15px; white-space: nowrap; }
.choice .amt.plus { color: var(--green); }
.choice .amt.minus { color: var(--red); }
.choice .amt.zero { color: var(--muted); }
.choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.choice.selected .check { color: var(--accent); font-weight: 900; }

/* ---------- badges ---------- */

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge.rest { background: var(--blue-soft); color: var(--blue); }
.badge.holiday { background: var(--amber-soft); color: var(--amber); }
.badge.normal { background: var(--line); color: var(--muted); }
.badge.plus { background: var(--green-soft); color: var(--green); }
.badge.minus { background: var(--red-soft); color: var(--red); }
.badge.approved { background: var(--green-soft); color: var(--green); }
.badge.pending { background: var(--amber-soft); color: var(--amber); }
.badge.draft { background: var(--line); color: var(--muted); }

/* ---------- today ---------- */

.today-date { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.today-type { margin-top: 4px; }

.stat-row { display: flex; gap: 10px; margin-top: 4px; }
.stat {
  flex: 1; background: var(--bg); border-radius: 12px; padding: 10px 12px;
}
.stat .v { font-size: 17px; font-weight: 800; }
.stat .k { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.stat .v.plus { color: var(--green); }
.stat .v.minus { color: var(--red); }

/* ---------- calendar ---------- */

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head .title { font-size: 17px; font-weight: 800; }
.nav-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1.5px solid var(--line); font-size: 17px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-dow.sun { color: var(--red); }
.cal-cell {
  aspect-ratio: 1 / 1.15;
  border-radius: 10px;
  border: 1.5px solid transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 5px; gap: 2px;
  font-size: 14px; font-weight: 600;
  position: relative;
  background: transparent;
}
.cal-cell:not(.empty):not(.outside) { background: var(--card); box-shadow: var(--shadow); }
.cal-cell.outside { color: var(--line); }
.cal-cell.today { border-color: var(--accent); }
.cal-cell.rest { color: var(--blue); }
.cal-cell.holiday { color: var(--amber); font-weight: 800; }
/* statutory holidays stand out with a tinted cell */
.cal-cell.holiday:not(.empty):not(.outside) { background: var(--amber-soft); }
.cal-cell .dots { display: flex; gap: 3px; height: 5px; }
.cal-cell .dot { width: 5px; height: 5px; border-radius: 50%; }
.dot.rest { background: var(--blue); }
.dot.holiday { background: var(--amber); }
.cal-cell .mark { font-size: 10.5px; font-weight: 800; line-height: 1; }
.mark.plus { color: var(--green); }
.mark.minus { color: var(--red); }
.mark.pend { color: var(--amber); }
.cal-cell.pending { border: 1.5px dashed var(--amber); }

/* pending day-log approval rows (Today tab) */
.pending-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
  cursor: pointer;
}
.pending-row:last-of-type { border-bottom: none; }
.pending-row .btn.compact { width: auto; flex: none; }
.pending-row [data-approve-log] { width: 44px; padding: 8px 0; }
/* named holiday list under the calendar grid */
.hol-list { margin-top: 12px; border-top: 1px dashed var(--line); }
.hol-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 2px; text-align: left;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}
.hol-item:last-child { border-bottom: none; }
.hol-item .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.hol-item b { white-space: nowrap; color: var(--amber); }
.hol-item .nm { color: var(--muted); }

.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.cal-legend .item { display: flex; align-items: center; gap: 5px; }
/* legend dots/marks live outside .cal-cell, so give them their own sizing */
.cal-legend .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.cal-legend .mark { font-size: 12px; font-weight: 800; }

/* ---------- salary statement ---------- */

.stmt-line { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.stmt-line:last-child { border-bottom: none; }
.stmt-line .lbl { color: var(--muted); }
.stmt-line .lbl b { color: var(--text); }
.stmt-line .val { font-weight: 700; white-space: nowrap; }
.stmt-line .val.plus { color: var(--green); }
.stmt-line .val.minus { color: var(--red); }
.stmt-line.sub { padding-left: 14px; font-size: 13.5px; }
.stmt-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; padding: 13px 14px;
  background: var(--accent-soft); border-radius: 12px;
  font-weight: 800; font-size: 16px; color: var(--accent);
}
.stmt-total .amt { font-size: 20px; }

.payment-item { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 10px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs img {
  width: 74px; height: 74px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--line); cursor: pointer;
}

/* ---------- settings ---------- */

.holiday-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.holiday-row .date { font-weight: 700; white-space: nowrap; }
.holiday-row .name { flex: 1; color: var(--muted); }
.holiday-row .del { color: var(--red); font-weight: 800; padding: 4px 8px; }

.banner {
  background: var(--amber-soft); color: var(--amber);
  border-radius: 12px; padding: 11px 14px; font-size: 13.5px; font-weight: 600;
  margin-bottom: 14px;
}

.legal-status {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px;
  font-size: 13px;
}
.legal-status p { margin-top: 5px; color: var(--muted); }
.legal-status ul { margin: 8px 0 0 18px; color: var(--muted); }
.legal-status li { margin-top: 4px; }
.legal-status code { display: block; margin-top: 7px; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.legal-status.ready { background: var(--green-soft); border-color: var(--green); }
.legal-status.ready > b { color: var(--green); }
.legal-status.blocked { background: var(--amber-soft); border-color: var(--amber); }
.legal-status.blocked > b { color: var(--amber); }

/* ---------- tab bar ---------- */

#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--card);
  border-top: 1px solid var(--line);
  display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
#tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; font-weight: 700; color: var(--muted);
}
#tabbar button .ico { font-size: 21px; line-height: 1; }
#tabbar button.active { color: var(--accent); }

/* ---------- bottom sheet & modal ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 14, 22, .45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .15s ease;
}
.overlay.center { align-items: center; padding: 20px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  background: var(--card);
  width: 100%; max-width: 560px;
  border-radius: 20px 20px 0 0;
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  max-height: 88vh; overflow-y: auto;
  animation: slideUp .2s ease;
}
.overlay.center .sheet { border-radius: 20px; max-height: 86vh; }
@keyframes slideUp { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet h2 { font-size: 17px; margin-bottom: 2px; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 12px; }

.img-viewer {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
}
.img-viewer img { max-width: 96vw; max-height: 88vh; border-radius: 6px; }
.img-viewer .close { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: 16px; color: #fff; font-size: 30px; font-weight: 700; }

/* ---------- approval screen ---------- */

.approve-amount { font-size: 34px; font-weight: 900; letter-spacing: -.5px; color: var(--accent); margin: 6px 0 2px; }

/* ---------- onboarding ---------- */

.onboarding-card { margin-top: 10px; padding: 20px; }
.onboarding-progress { display: flex; align-items: center; gap: 7px; margin-bottom: 22px; }
.onboarding-progress::before {
  content: ''; width: 28px; height: 3px; border-radius: 99px; background: var(--accent);
  margin-right: 3px;
}
.onboarding-progress span {
  width: 25px; height: 25px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1.5px solid var(--line); color: var(--muted);
  font-size: 11px; font-weight: 800;
}
.onboarding-progress span.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.onboarding-progress span.done { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.onboarding-heading { margin-bottom: 18px; }
.onboarding-heading .eyebrow {
  color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .7px;
  text-transform: uppercase; margin-bottom: 4px;
}
.onboarding-heading h1 { font-size: 25px; line-height: 1.2; letter-spacing: -.5px; }
.onboarding-heading > p:last-child { color: var(--muted); font-size: 14px; margin-top: 8px; }
.onboarding-language {
  padding: 12px 0 16px; margin-bottom: 4px; border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.onboarding-actions, .onboarding-checklist { display: flex; flex-direction: column; margin: 8px 0 16px; }
.onboarding-actions > div, .onboarding-checklist > div {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.onboarding-actions > div:last-child, .onboarding-checklist > div:last-child { border-bottom: 0; }
.onboarding-actions p, .onboarding-checklist p { display: flex; flex-direction: column; gap: 2px; }
.onboarding-actions b, .onboarding-checklist b { font-size: 15px; }
.onboarding-actions small, .onboarding-checklist small { color: var(--muted); font-size: 12.5px; }
.onboarding-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 38px;
  width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); font-size: 20px;
}
.onboarding-checklist > div > span {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 26px;
  width: 26px; height: 26px; border-radius: 50%; color: var(--accent);
  background: var(--accent-soft); font-size: 14px; font-weight: 900;
}
.onboarding-note {
  background: var(--blue-soft); color: var(--text); border-radius: 11px;
  padding: 12px 13px; margin: 4px 0 16px; font-size: 13px;
}

@media (min-width: 480px) {
  .onboarding-card { padding: 24px; }
}

@media (min-width: 600px) {
  #view { padding-top: 22px; }
}
