:root {
  --green: #1b6b4a;
  --green-dark: #134d36;
  --green-soft: #e4f3ec;
  --gold: #f4a261;
  --gold-dark: #c67b32;
  --ink: #1c1917;
  --muted: #6b635b;
  --line: #e7e0d6;
  --bg: #f6f3ee;
  --card: #fffcf8;
  --danger: #b42318;
  --ok: #127a4a;
  --shadow: 0 10px 30px rgba(28, 25, 23, 0.08);
  --radius: 18px;
  --nav-h: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Segoe UI", "Noto Sans", "Roboto", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { max-width: 100%; }
a { color: var(--green); }

.app { min-height: 100%; display: flex; flex-direction: column; }

/* screens */
.screen { display: none; min-height: 100%; }
.screen.active { display: flex; flex-direction: column; flex: 1; }

/* welcome */
.welcome {
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 80% -10%, #2a8f64 0%, transparent 55%),
    linear-gradient(165deg, #134d36 0%, #1b6b4a 48%, #0e3b2a 100%);
  color: #fff;
  padding: 28px 22px 32px;
  justify-content: space-between;
}
.brand-mark {
  width: 64px; height: 64px;
  border-radius: 20px;
  background: rgba(255,255,255,.12);
  display: grid; place-items: center;
  font-weight: 800; font-size: 28px;
  border: 1px solid rgba(255,255,255,.2);
}
.welcome h1 { font-size: 2.15rem; letter-spacing: -0.03em; margin: 18px 0 8px; }
.welcome .tag { opacity: .88; font-size: 1.05rem; max-width: 22rem; }
.welcome-art { margin: 28px 0; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 22px; }
.stat {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  padding: 12px 10px;
  text-align: center;
}
.stat b { display: block; font-size: 1.15rem; }
.stat span { font-size: .75rem; opacity: .8; }
.welcome-actions { display: grid; gap: 10px; margin-top: 24px; }
.hint { text-align: center; font-size: .85rem; opacity: .75; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 18px; border-radius: 14px;
  font-weight: 700; letter-spacing: .01em;
}
.btn-primary { background: var(--gold); color: #3a2208; }
.btn-primary:active { transform: scale(.98); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-ghost {
  background: transparent; color: inherit;
  border: 1px solid currentColor; opacity: .95;
}
.btn-outline {
  background: #fff; border: 1px solid var(--line); color: var(--ink);
}
.btn-whatsapp { background: #25d366; color: #083b1c; }
.btn-call { background: var(--green-soft); color: var(--green-dark); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 12px; border-radius: 10px; font-size: .9rem; }

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 12px;
  background: rgba(246,243,238,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar h2 { font-size: 1.15rem; flex: 1; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line);
}

/* layout */
.page { padding: 14px 16px calc(var(--nav-h) + var(--safe-b) + 18px); flex: 1; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.stack { display: grid; gap: 12px; }

/* forms */
label.field { display: grid; gap: 6px; font-size: .86rem; font-weight: 600; color: var(--muted); }
input, select, textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 12px;
  min-height: 48px;
  color: var(--ink);
}
textarea { min-height: 88px; resize: vertical; }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-opt {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 16px 12px;
  text-align: left;
}
.role-opt.active { border-color: var(--green); background: var(--green-soft); }
.role-opt b { display: block; font-size: 1rem; color: var(--ink); }
.role-opt span { color: var(--muted); font-size: .82rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: .86rem;
  font-weight: 600;
}
.chip.on { background: var(--green); color: #fff; border-color: var(--green); }

/* worker cards */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.filters-3 { grid-template-columns: 1fr; }
@media (min-width: 420px) {
  .filters-3 { grid-template-columns: 1fr 1fr 1fr; }
}
.search-bar { margin-bottom: 10px; }
.typeahead { position: relative; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); max-height: 240px; overflow: auto;
}
.suggest-item, .suggest-empty {
  display: grid; width: 100%; text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--line); background: #fff;
}
.suggest-item:last-child, .suggest-empty:last-child { border-bottom: 0; }
.suggest-item strong { font-size: .92rem; }
.suggest-item span { color: var(--muted); font-size: .78rem; }
.suggest-item:active, .suggest-empty:active { background: var(--green-soft); }
.worker-card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: start;
}
.avatar {
  width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center;
  font-weight: 800; color: #fff;
  letter-spacing: .02em;
}
.meta { color: var(--muted); font-size: .85rem; }
.name-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: .7rem; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 7px; border-radius: 999px;
}
.badge-on { background: #d9f6e5; color: #0d6b3c; }
.badge-off { background: #f1ece6; color: #7a7168; }
.badge-busy { background: #fde7c8; color: #8a4b00; }
.badge-bronze { background: #e8c4a0; color: #6a3b16; }
.badge-silver { background: #d7dde4; color: #334155; }
.badge-gold { background: #f3d58a; color: #6a4b00; }
.badge-ikhona {
  background: #e4f3ec;
  color: #134d36;
  margin-left: 4px;
}
.badge-platinum {
  background: linear-gradient(135deg, #e8eef5, #b8c4d4);
  color: #1a2744;
  border: 1px solid #8a97ad;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.avatar-lg { width: 84px; height: 84px; border-radius: 24px; font-size: 1.6rem; }
.doc-preview { width: 100%; max-height: 180px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.lock-note { background: #f7efe6; padding: 12px; border-radius: 12px; font-size: .88rem; }
.rate { font-weight: 800; white-space: nowrap; }
.stars { color: var(--gold-dark); letter-spacing: 1px; font-size: .92rem; }

/* profile */
.hero-profile {
  display: grid; justify-items: center; text-align: center; gap: 6px;
  padding: 8px 0 4px;
}
.hero-profile .avatar { width: 84px; height: 84px; border-radius: 24px; font-size: 1.6rem; }
.toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.switch {
  width: 52px; height: 32px; border-radius: 999px;
  background: #d7d0c6; position: relative;
}
.switch i {
  position: absolute; top: 3px; left: 3px;
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; transition: .2s;
}
.switch.on { background: var(--green); }
.switch.on i { left: 23px; }
.switch.locked { opacity: .45; }

.actions-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* bottom nav */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: #fff;
  border-top: 1px solid var(--line);
  display: none;
  grid-template-columns: repeat(4, 1fr);
}
.nav.nav-admin { grid-template-columns: repeat(5, 1fr); }
.card-stale { border: 1px solid #e2a54e; background: #fff6e8; }
.badge-warn { background: #fde7c8; color: #8a4b00; margin-left: 6px; }
.btn-warn { background: #c05621; color: #fff; }
.card-reported { border: 1px solid #c53030; background: #fff1f0; }
.badge-report { background: #fed7d7; color: #9b2c2c; margin-left: 6px; }
.btn-report { background: #9b2c2c; color: #fff; }
.report-note {
  background: #fff5f5;
  border: 1px solid #f0c2c2;
  border-radius: 10px;
  padding: 8px 10px;
  margin: 8px 0;
  font-size: .86rem;
}
.nav.show { display: grid; }
.nav button {
  display: grid; place-items: center; gap: 2px;
  font-size: .72rem; font-weight: 700; color: var(--muted);
}
.nav button.active { color: var(--green); }
.nav svg { width: 22px; height: 22px; }

/* rating */
.star-pick { display: flex; gap: 6px; font-size: 1.7rem; }
.star-pick button { color: #d7d0c6; }
.star-pick button.on { color: var(--gold-dark); }
.chips-tight { margin-top: 6px; }
.chips-tight .chip { font-size: .75rem; padding: 5px 8px; font-weight: 700; }
.skill-rate {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-weight: 700; font-size: .92rem;
}
.skill-rate .star-pick { font-size: 1.4rem; }

.empty {
  text-align: center; color: var(--muted); padding: 28px 10px;
}
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + 16px);
  background: var(--ink); color: #fff; padding: 12px 14px;
  border-radius: 12px; z-index: 50; display: none;
}
.toast.show { display: block; }
.lang {
  display: flex; gap: 6px;
}
.lang button {
  color: #fff; opacity: .7; font-weight: 700; font-size: .8rem;
  padding: 4px 8px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25);
}
.lang button.on { opacity: 1; background: rgba(255,255,255,.15); }

.map-link { font-weight: 700; }

.review {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-size: .92rem;
}
.muted { color: var(--muted); }
.small { font-size: .82rem; }

@media (min-width: 780px) {
  .app-shell { max-width: 520px; margin: 0 auto; min-height: 100%; background: var(--bg); box-shadow: 0 0 0 1px var(--line); }
  .nav { max-width: 520px; left: 50%; transform: translateX(-50%); }
  .toast { max-width: 488px; left: 50%; right: auto; transform: translateX(-50%); width: calc(100% - 32px); }
}

.id-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: #0b1220;
  display: flex; flex-direction: column;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0px));
}
.id-overlay[hidden] { display: none !important; }
.id-card {
  flex: 1;
  background:
    radial-gradient(800px 280px at 110% -10%, rgba(244,162,97,.35), transparent 50%),
    linear-gradient(165deg, #1b6b4a 0%, #134d36 55%, #0e3b2a 100%);
  color: #fff;
  border-radius: 22px;
  padding: 22px 20px 18px;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.16);
}
.id-card-top { display: flex; justify-content: space-between; align-items: center; }
.id-card-brand { font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; opacity: .9; }
.id-card-chip { font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: linear-gradient(135deg,#f4f7fb,#b9c6d8); color: #1a2744; padding: 5px 9px; border-radius: 999px; }
.id-card-photo {
  width: 112px; height: 112px; border-radius: 28px; margin: 22px auto 10px;
  overflow: hidden; background: rgba(255,255,255,.12);
  display: grid; place-items: center; font-size: 2rem; font-weight: 800;
  border: 2px solid rgba(255,255,255,.3);
}
.id-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.id-card h2 { text-align: center; font-size: 1.45rem; }
.id-card .id-meta { text-align: center; opacity: .88; font-size: .9rem; margin-top: 4px; }
.id-card-qr { margin-top: auto; display: grid; justify-items: center; gap: 8px; padding-top: 16px; }
.id-card-qr img { width: 148px; height: 148px; background: #fff; border-radius: 14px; padding: 8px; }
.id-overlay-actions { display: grid; gap: 8px; margin-top: 12px; }
.id-overlay-actions .btn-ghost { color: #fff; }
