:root {
  --bg: #eef8f7;
  --card: #fff;
  --ink: #17374c;
  --muted: #557781;
  --line: #d5e8e7;
  --blue: #087e8b;
  --blue-dark: #086672;
  --green: #0f7a4a;
  --amber: #9a6408;
  --red: #b42318;
  --shadow: 0 8px 24px rgba(15, 28, 46, 0.06);
  --shadow-lg: 0 14px 32px rgba(20, 128, 139, 0.2);
  --nav: 76px;
  --radius: 18px;
  --radius-sm: 12px;
  --space: 14px;
  --gap: 12px;
  font-family: "Manrope", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 420px at 8% -8%, rgba(20, 128, 139, 0.11), transparent 55%),
    radial-gradient(800px 380px at 100% 0%, rgba(14, 165, 164, 0.09), transparent 50%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 14px;
}
body.screen-open #app { padding-bottom: 12px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, input, select, textarea { touch-action: manipulation; }
:where(button, a, input, select, textarea):focus-visible { outline: 3px solid #087e8b; outline-offset: 3px; }
input, select, textarea { min-width: 0; font-size: 16px; scroll-margin-block: 100px; }
input::placeholder, textarea::placeholder { color: #65818a; opacity: 1; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--red); font-size: 13px; margin: 0 0 10px; }

/* ——— Login ——— */
#loginScreen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}
.login-form-wrap { width: min(440px, 100%); }
.login-intro { display: none; }
.login-card {
  width: 100%;
  background: var(--card);
  border: 1px solid rgba(221, 229, 240, 0.9);
  border-radius: 24px;
  padding: 32px 26px;
  box-shadow: 0 16px 48px rgba(15, 28, 46, 0.06);
}
.logo { height: 40px; max-width: 100%; object-fit: contain; display: block; margin: 0 0 26px; }
.login-card h1 {
  margin: 0;
  text-align: left;
  font-size: clamp(23px, 4vw, 28px);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.login-card > .muted { text-align: left; margin: 12px 0 26px; line-height: 1.65; font-size: 14px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue); margin: 0 0 8px; }
.login-card .field input { background: #fff; border-color: #c8d4e2; min-height: 50px; font-weight: 500; }
.login-card .field > label { margin: 0; }
.password-field { display: block; position: relative; }
.password-field input { padding-right: 52px; }
.password-toggle { position: absolute; inset: 1px 1px 1px auto; width: 48px; border: 0; border-radius: 13px; color: var(--muted); background: transparent; }
.password-toggle:hover { background: #edf3fc; color: var(--blue); }
.login-help { font-size: 12px; color: var(--muted); text-align: center; margin: 18px 0 0; line-height: 1.6; }
.login-card .error { padding: 12px 14px; border: 1px solid #f3c6c2; border-radius: 12px; background: #fff1ef; line-height: 1.5; }
.login-card #loginSubmit { display: flex; justify-content: center; align-items: center; gap: 10px; }
.login-card #loginSubmit i { margin: 0; }
.login-card .field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 700;
  color: #315766;
}
.login-card .field input { margin-top: 0; }
.login-card .btn { margin-top: 4px; min-height: 48px; }

/* ——— App chrome ——— */
#app {
  max-width: 1100px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(var(--nav) + 18px + env(safe-area-inset-bottom));
}
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 20px 12px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(221, 229, 240, 0.65);
}
.top strong {
  display: block;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.top > div:first-child { min-width: 0; }
.top #who { margin-top: 3px; font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  display: grid;
  place-items: center;
}
.icon-btn:active { background: #f4f7fb; }
.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.notice {
  margin: 8px 16px 0;
  background: #fff7e8;
  color: var(--amber);
  border: 1px solid #f0e0c0;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
}
#view {
  padding: 20px 20px 24px;
  display: grid;
  gap: var(--gap);
  align-content: start;
}
#view > *, .row > *, .section-head > :first-child { min-width: 0; }
.item strong, .hero-card h2, .field-hero h2, .visit-hero h2, .task-title { overflow-wrap: anywhere; }

/* ——— Typography & sections ——— */
h2 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}
h3 {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.section-head h2,
.section-head h3 { margin: 0; }
.section-head .muted { margin: 3px 0 0; }
.section-head .meta {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding-top: 2px;
}
.page-block { display: grid; gap: var(--gap); }
.hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

/* ——— Forms ——— */
label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #315766;
}
input, select, textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  background: #f5faf9;
  border-radius: 14px;
  padding: 12px 13px;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  background: #fff;
  border-color: #74c8c5;
  box-shadow: 0 0 0 4px rgba(20, 128, 139, 0.12);
}
textarea { min-height: 84px; resize: vertical; }
.search-field {
  margin: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px 12px 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23667789' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 14px center;
}

/* ——— Buttons & chips ——— */
.btn {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 750;
  background: #edf5f4;
  color: var(--ink);
  position: relative;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.btn.primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(20, 128, 139, 0.22);
}
.btn.primary:hover:not(:disabled) { background: var(--blue-dark); }
.btn.primary:disabled,
.btn:disabled { opacity: 0.72; cursor: wait; box-shadow: none; }
.btn.primary:disabled { background: #80b9bd; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; border: 1px solid var(--line); box-shadow: none; }
.btn.danger-text { color: var(--red); border-color: #f3c6c2; }
.btn.danger-text i { margin-right: 6px; }
.btn i { margin-right: 6px; }
.btn.primary i,
.btn.ghost i { margin-right: 6px; }
.btn.is-loading,
.icon-btn.is-loading,
.locate-btn.is-loading,
.quick.is-loading {
  pointer-events: none;
  opacity: 0.85;
}
.btn.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: 0 0 auto;
}
.btn.ghost.is-loading .btn-spinner,
.btn.danger-text.is-loading .btn-spinner,
.icon-btn.is-loading .btn-spinner {
  border-color: rgba(20, 128, 139, 0.25);
  border-top-color: var(--blue);
}
.icon-btn.is-loading,
.locate-btn.is-loading { color: var(--blue); }
.icon-btn.is-loading i,
.locate-btn.is-loading i { animation: spin 0.8s linear infinite; }
.quick.is-loading { opacity: 0.7; }
.actions { display: grid; gap: 8px; }
.chips, .seg {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar,
.seg::-webkit-scrollbar { display: none; }
.chip, .seg button {
  min-height: 44px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}
.chip.on, .seg button.on {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.linkish {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 750;
  font-size: 13px;
  padding: 6px 4px;
  white-space: nowrap;
}

/* ——— Cards & lists ——— */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space);
  box-shadow: var(--shadow);
}
.card > p.muted:first-child { margin-top: 0; }
.row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.list { display: grid; gap: 8px; }
.item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 13px;
}
.item strong { display: block; font-weight: 800; letter-spacing: -0.01em; }
.item.soft {
  background: #fbfcfe;
  box-shadow: none;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 750;
  background: #edf5f4;
  color: #3b6471;
  white-space: nowrap;
}
.tag.ok { background: #e8f8ef; color: var(--green); }
.tag.warn { background: #fff4df; color: var(--amber); }
.tag.bad { background: #fdecea; color: var(--red); }
.tag.run { background: #e1f6f4; color: var(--blue); }
.tag.wait { background: #edf5f4; color: #4c6f7b; }

/* ——— Metrics ——— */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stats.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stats-4 { grid-template-columns: 1fr 1fr; }
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  text-align: left;
  color: inherit;
  width: 100%;
  box-shadow: var(--shadow);
  min-width: 0;
}
.stats.compact .stat {
  padding: 10px 8px;
  border-radius: 12px;
  box-shadow: none;
}
.stat.accent {
  background: #e1f6f4;
  border-color: #b6e4df;
  box-shadow: none;
}
.stat.danger {
  background: #fdecea;
  border-color: #f3c6c2;
  box-shadow: none;
}
.stat b {
  display: block;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-top: 2px;
}
.stats.compact .stat b { font-size: 17px; }
.stats.compact .stat .muted { font-size: 11px; }
.stat b { font-variant-numeric: tabular-nums; }

/* ——— Key-value ——— */
.kv { display: grid; gap: 0; }
.kv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.kv-row:first-child { padding-top: 0; }
.kv-row:last-child { border-bottom: 0; padding-bottom: 0; }
.kv-row strong { font-weight: 800; }

/* ——— Bars & progress ——— */
.bar, .perf-bar {
  height: 7px;
  background: #dfedeb;
  border-radius: 99px;
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  background: var(--blue);
  border-radius: inherit;
}
.perf-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #087e8b, #10bfc6);
  border-radius: inherit;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 0 6px;
  font-size: 12px;
  color: var(--muted);
}

/* ——— Hero ——— */
.hero-card {
  background: linear-gradient(145deg, #40566c, #31546a 55%, #246a72);
  color: #fff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -36px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  pointer-events: none;
}
.hero-card .muted { color: rgba(255,255,255,0.78); position: relative; }
.hero-card h2 {
  margin: 4px 0 6px;
  font-size: 22px;
  color: #fff;
  position: relative;
}
.hero-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255,255,255,0.9);
  position: relative;
  max-width: 58ch;
}

/* ——— Quick actions ——— */
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.quick {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 14px 12px;
  display: grid;
  gap: 8px;
  justify-items: start;
  text-align: left;
  font-weight: 750;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.quick:active { background: #f3faf9; }
.quick i {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: #e1f6f4;
  color: var(--blue);
}
.assign-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
}
.assign-btn i { margin: 0; }

/* ——— Strip headers ——— */
.strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.strip h2 { margin: 0 0 4px; }
.strip .btn { white-space: nowrap; }
.strip .btn i { margin-right: 6px; }
@media (max-width: 420px) {
  .strip .btn { width: 100%; }
}

/* ——— Empty ——— */
.empty {
  text-align: center;
  padding: 28px 16px;
  display: grid;
  gap: 10px;
  justify-items: center;
}
.empty i {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #e1f6f4;
  color: var(--blue);
  font-size: 22px;
}
.empty p, .empty h3 { margin: 0; }
.empty p { color: var(--muted); font-size: 13px; max-width: 280px; }

/* ——— Task cards ——— */
.item.task-card { padding: 14px; }
.item.task-card .task-title {
  font-weight: 700;
  margin: 5px 0 2px;
  font-size: 14px;
}
.item.task-card .meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  gap: 8px;
  flex-wrap: wrap;
}
.item.task-card .meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.item.task-card .progress-meta { margin: 10px 0 6px; }
.item.task-card .btn { margin-top: 12px; }
.item.task-card.cancelled {
  background: #f5faf9;
  border-style: dashed;
  opacity: 0.88;
}
.item.task-card.cancelled .task-title {
  color: var(--muted);
  font-weight: 650;
}
.item.task-card.cancelled strong { color: #64748b; }

/* ——— Sales / performance ——— */
.perf-row {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  width: 100%;
  text-align: left;
}
.perf-row:last-child { border-bottom: 0; padding-bottom: 0; }
.perf-row.clickable {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  border-radius: 0;
  cursor: pointer;
  padding: 12px 4px;
  margin: 0 -4px;
}
.perf-row.clickable:active { background: #eff8f7; border-radius: 10px; }
.sales-detail { display: grid; gap: var(--gap); }
.chart-row { margin: 0 0 12px; }
.chart-row:last-child { margin-bottom: 0; }
.chart-row .row { margin-bottom: 6px; font-size: 13px; }

/* ——— Lapangan workflow ——— */
.steps {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}
.step {
  border-radius: 12px;
  background: #f1f8f7;
  padding: 10px 8px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  color: var(--muted);
}
.step.on { background: #e1f6f4; color: var(--blue); }
.step.done { background: #e8f8ef; color: var(--green); }

.field-screen {
  display: grid;
  gap: 12px;
  animation: field-in 0.35s ease both;
}
@keyframes field-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes field-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .field-screen, .field-hero, .field-card { animation: none; }
}
.field-picker { display: grid; gap: 8px; }
.field-picker-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7b8b9e;
}
.field-chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: #fff;
  box-shadow: var(--shadow);
}
.field-chips .chip.on {
  box-shadow: 0 8px 18px rgba(20, 128, 139, 0.22);
}
.field-chips .chip i { font-size: 10px; }

.field-hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 18px 16px 16px;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.12), transparent 42%),
    linear-gradient(135deg, #40566c 0%, #31546a 50%, #246a72 100%);
  box-shadow: var(--shadow-lg);
  animation: field-rise 0.45s ease both;
}
.field-hero::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -40px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  pointer-events: none;
}
.field-hero-top {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.field-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}
.field-hero .tag {
  background: rgba(255,255,255,0.18);
  color: #fff;
  backdrop-filter: blur(6px);
}
.field-hero .tag.run,
.field-hero .tag.ok,
.field-hero .tag.warn,
.field-hero .tag.bad,
.field-hero .tag.wait {
  background: rgba(255,255,255,0.18);
  color: #fff;
}
.field-code {
  position: relative;
  font-size: 12px;
  font-weight: 700;
  opacity: 0.85;
  letter-spacing: 0.02em;
}
.field-hero h2 {
  position: relative;
  margin: 4px 0 8px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.2;
}
.field-hero p {
  position: relative;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255,255,255,0.9);
  max-width: 36ch;
}
.field-deadline {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  font-size: 12px;
  font-weight: 750;
  backdrop-filter: blur(6px);
}

.field-card {
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(221, 229, 240, 0.95);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
  animation: field-rise 0.5s ease both;
}
.field-card + .field-card { animation-delay: 0.06s; }
.field-steps {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: start;
  gap: 4px;
  margin-bottom: 18px;
}
.field-step {
  display: grid;
  justify-items: center;
  gap: 7px;
  text-align: center;
}
.field-step-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #edf5f4;
  color: #8a9bb0;
  font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.field-step-label {
  font-size: 11px;
  font-weight: 750;
  color: var(--muted);
}
.field-step.on .field-step-icon {
  background: #e1f6f4;
  color: var(--blue);
  box-shadow: 0 6px 14px rgba(20, 128, 139, 0.16);
}
.field-step.on .field-step-label { color: var(--blue); }
.field-step.done .field-step-icon {
  background: #e8f8ef;
  color: var(--green);
}
.field-step.done .field-step-label { color: var(--green); }
.field-step-line {
  width: 100%;
  height: 3px;
  margin-top: 18px;
  border-radius: 99px;
  background: #dfedeb;
}
.field-step-line.on {
  background: linear-gradient(90deg, #0f7a4a, #10bfc6);
}

.field-progress { margin-bottom: 16px; }
.field-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.field-progress-head strong {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.field-progress-rate {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.field-bar {
  height: 10px;
  background: #dfedeb;
  border-radius: 99px;
  overflow: hidden;
}
.field-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #087e8b, #10bfc6);
  box-shadow: 0 0 12px rgba(20, 128, 139, 0.35);
}

.field-cta {
  min-height: 50px;
  border-radius: 16px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 12px 24px rgba(20, 128, 139, 0.28);
}
.field-cta i { margin: 0; }
.field-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.field-hint i {
  margin-top: 2px;
  color: var(--blue);
  opacity: 0.75;
}
.field-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 18px 10px 8px;
  text-align: center;
  color: var(--muted);
}
.field-empty i {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #edf5f4;
  color: #8a9bb0;
}
.field-empty p { margin: 0; font-size: 13px; }

.field-card .visit-item {
  background: #f5faf9;
  border-color: #e6edf5;
  box-shadow: none;
}
.field-card .visit-item strong { font-size: 14px; }

/* ——— Map ——— */
.map-wrap {
  position: relative;
  z-index: 0;
  isolation: isolate;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
#map { height: 62vh; width: 100%; }
.locate-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 500;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  color: var(--blue);
  box-shadow: 0 8px 20px rgba(18, 32, 51, 0.18);
  display: grid;
  place-items: center;
  font-size: 18px;
}
.locate-btn.loading {
  color: var(--muted);
  pointer-events: none;
}
.locate-btn.loading i { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  box-shadow: var(--shadow);
}
.map-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.map-legend .dot.odp { background: #2a81cb; box-shadow: 0 0 0 2px rgba(42,129,203,0.2); }
.map-legend .dot.efektif { background: #0f7a4a; }
.map-legend .dot.tidak { background: #c98510; }
.visit-marker { background: transparent; border: 0; }
.visit-marker span {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(15, 28, 46, 0.35);
}
.map-popup { min-width: 180px; max-width: 240px; }
.map-popup .muted { margin-top: 4px; font-size: 12px; }
.map-popup-tasks { margin: 8px 0; line-height: 1.35; }
.map-assign {
  margin-top: 4px;
  padding: 10px 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.assign-odp {
  background: #edf9f8;
  border: 1px solid #c8e9e5;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 4px;
}
.assign-odp strong { display: block; margin: 2px 0; }

/* ——— Bottom nav ——— */
#tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  background: rgba(255,255,255,0.96);
  border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  backdrop-filter: blur(12px);
  min-height: var(--nav);
}
#tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  justify-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  min-width: 0;
  padding: 6px 2px;
}
#tabs button i { font-size: 16px; }
#tabs button.on { color: var(--blue); }
#tabs button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tabs button.on i {
  background: #e1f6f4;
  width: 36px;
  height: 26px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

/* ——— Sheets & toast ——— */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(18, 32, 51, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet .panel {
  width: min(760px, 100%);
  max-height: 85dvh;
  overflow: auto;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet .panel > .row { margin-bottom: 12px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav) + 12px);
  transform: translateX(-50%);
  background: #122033;
  color: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  z-index: 50;
  max-width: 90%;
  font-size: 13px;
  box-shadow: 0 10px 28px rgba(15, 28, 46, 0.28);
}
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice button.on.good { background: #e8f8ef; border-color: #b7ebc9; color: var(--green); }
.choice button.on.bad { background: #fff4df; border-color: #f3ddb0; color: var(--amber); }

/* ——— Screen forms (task / odp) ——— */
.form-screen {
  display: grid;
  gap: 12px;
  padding-bottom: 24px;
}
.form-card {
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(221, 229, 240, 0.9);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.form-card .field {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: #315766;
}
.form-card .field:last-child { margin-bottom: 0; }
.form-card .field input,
.form-card .field select,
.form-card .field textarea {
  margin: 0;
  border: 1px solid #cbdedc;
  background: #f5faf9;
  border-radius: 14px;
  padding: 13px 14px;
  font-weight: 500;
}
.form-card .field input:focus,
.form-card .field select:focus,
.form-card .field textarea:focus {
  outline: none;
  background: #fff;
  border-color: #74c8c5;
  box-shadow: 0 0 0 4px rgba(20, 128, 139, 0.12);
}
.form-actions {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}
.form-actions .btn { min-height: 48px; }

/* ——— Premium visit form ——— */
.visit-form {
  display: grid;
  gap: 12px;
  padding-bottom: 88px;
}
.visit-hero {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 18px 16px;
  border-radius: 22px;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.12), transparent 40%),
    linear-gradient(135deg, #40566c 0%, #31546a 48%, #246a72 100%);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.visit-hero::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -40px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.visit-back {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,0.16);
  color: #fff;
  display: grid;
  place-items: center;
  backdrop-filter: blur(6px);
  z-index: 1;
}
.visit-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}
.visit-hero h2 {
  margin: 4px 0 2px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}
.visit-hero p {
  margin: 0;
  font-size: 13px;
  opacity: 0.9;
  line-height: 1.35;
}
.visit-gps {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin-top: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  font-size: 11px;
  font-weight: 700;
  z-index: 1;
}
.visit-card {
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(221, 229, 240, 0.9);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.visit-section-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7b8b9e;
  margin-bottom: 12px;
}
.visit-choice { gap: 10px; }
.visit-type {
  border: 1px solid var(--line);
  background: #f7f9fc;
  border-radius: 18px;
  padding: 14px 12px;
  display: grid;
  gap: 4px;
  justify-items: start;
  text-align: left;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.visit-type i {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: #e5f3f0;
  color: var(--blue);
  margin-bottom: 4px;
}
.visit-type strong { font-size: 14px; font-weight: 800; }
.visit-type span { font-size: 11px; color: var(--muted); line-height: 1.3; }
.visit-type.on {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 28, 46, 0.08);
}
.visit-type.on.good {
  background: linear-gradient(180deg, #f2fbf6, #e7f7ee);
  border-color: #9fd9b5;
  color: var(--green);
}
.visit-type.on.good i { background: #d8f3e4; color: var(--green); }
.visit-type.on.bad {
  background: linear-gradient(180deg, #fff9ef, #fff1d9);
  border-color: #f0d29a;
  color: var(--amber);
}
.visit-type.on.bad i { background: #ffe8b8; color: var(--amber); }
.visit-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.visit-form .field {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: #315766;
}
.visit-form .field:last-child { margin-bottom: 0; }
.visit-form .field span { letter-spacing: 0.01em; }
.visit-form .field input,
.visit-form .field select,
.visit-form .field textarea {
  margin: 0;
  border: 1px solid #cbdedc;
  background: #f5faf9;
  border-radius: 14px;
  padding: 13px 14px;
  font-weight: 500;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.visit-form .field input:focus,
.visit-form .field select:focus,
.visit-form .field textarea:focus {
  outline: none;
  background: #fff;
  border-color: #74c8c5;
  box-shadow: 0 0 0 4px rgba(20, 128, 139, 0.12);
}
.visit-form .field textarea { min-height: 92px; }
.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
@media (min-width: 520px) {
  .field-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}
.visit-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  display: grid;
  grid-template-columns: 0.8fr 1.4fr;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,0.9);
  border-top: 1px solid rgba(221, 229, 240, 0.9);
  backdrop-filter: blur(14px);
  box-shadow: 0 -10px 30px rgba(15, 28, 46, 0.06);
}
.visit-section-label, .field-picker-label { color: var(--muted); }

@media (min-width: 900px) {
  #loginScreen { grid-template-columns: 1fr 1fr; padding: 0; gap: 0; background: #eef8f7; }
  .login-intro { display: flex; position: relative; overflow: hidden; min-height: 100dvh; width: 100%; flex-direction: column; justify-content: space-between; padding: 48px clamp(32px, 5vw, 72px); background: #102b4b; color: #fff; }
  .login-intro::before { content: ""; pointer-events: none; position: absolute; right: -190px; top: 70px; width: 520px; height: 520px; border-radius: 50%; border: 1px solid #ffffff14; box-shadow: 0 0 0 75px #ffffff04, 0 0 0 150px #ffffff03; }
  .login-intro > * { position: relative; }
  .login-brand { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 700; letter-spacing: 0.03em; }
  .login-brand b { display: block; font-size: 18px; }
  .brand-symbol { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: #1c5590; font-size: 21px; }
  .login-intro .eyebrow { color: #acd2ff; }
  .login-intro h2 { font-size: clamp(30px, 3.2vw, 46px); line-height: 1.2; margin: 16px 0 18px; }
  .login-description { max-width: 40ch; font-size: 15px; line-height: 1.8; color: #d3e2f2; }
  .login-features { list-style: none; padding: 0; margin: 34px 0; display: grid; gap: 22px; }
  .login-features li { display: flex; align-items: center; gap: 14px; }
  .login-features i { display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px; background: #ffffff0b; color: #acd2ff; font-size: 18px; }
  .login-features strong, .login-features span { display: block; }
  .login-features strong { font-size: 14px; }
  .login-features span { margin-top: 3px; font-size: 12px; color: #d3e2f2; line-height: 1.6; }
  .login-intro-footer { font-size: 12px; color: #b0c5dc; }
  .login-form-wrap { padding: 36px 0; width: min(440px, calc(100% - 64px)); }
  .login-card { padding: 36px; }
  #view[data-view="dashboard"] { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  #view[data-view="dashboard"] > .hero-card, #view[data-view="dashboard"] > .stats, #view[data-view="dashboard"] > .quick-grid { grid-column: 1 / -1; }
  #view[data-view="dashboard"] > .stats, #view[data-view="dashboard"] > .quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #view[data-view="form"], #view[data-view="lapangan"] { max-width: 800px; margin: 0 auto; }
}

@media (min-width: 600px) {
  #tabs { left: 50%; right: auto; transform: translateX(-50%); width: min(760px, calc(100% - 32px)); bottom: max(12px, env(safe-area-inset-bottom)); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 8px 32px #17374c12; padding-bottom: 6px; }
  #app { padding-bottom: calc(var(--nav) + 32px + env(safe-area-inset-bottom)); }
  .visit-actions { left: 50%; right: auto; transform: translateX(-50%); width: min(760px, 100%); border-radius: 20px 20px 0 0; }
  .stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat { padding: 16px; }
  .stat b { font-size: 28px; }
}

@media (max-width: 380px) {
  .top { padding-left: 14px; padding-right: 14px; gap: 8px; }
  #view { padding-left: 14px; padding-right: 14px; }
  .top-actions { gap: 4px; }
  .stats.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-card { padding: 26px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
.visit-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border-radius: 16px;
  font-weight: 800;
}
.visit-actions .btn.primary {
  box-shadow: 0 12px 24px rgba(20, 128, 139, 0.28);
}
.visit-actions .btn i { margin: 0; }

/* ——— Visit list items ——— */
.visit-item .visit-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.visit-item .visit-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.visit-item .visit-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.visit-item.clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.visit-item.clickable:active {
  transform: scale(0.99);
  background: #edf8f6;
  border-color: #c6e5df;
}

.visit-detail-panel { padding-top: 10px; }
.visit-detail-handle {
  width: 42px;
  height: 4px;
  border-radius: 99px;
  background: #cbdedc;
  margin: 0 auto 14px;
}
.visit-detail-hero {
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
}
.visit-detail-hero.good {
  background: linear-gradient(180deg, #f2fbf6, #e7f7ee);
  border: 1px solid #b7ebc9;
}
.visit-detail-hero.warn {
  background: linear-gradient(180deg, #fff9ef, #fff1d9);
  border: 1px solid #f0d29a;
}
.visit-detail-hero p {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.4;
}
.visit-detail-panel .kv-row strong {
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

/* ——— Filter toolbar ——— */
.filter-bar {
  display: grid;
  gap: 10px;
}
.filter-bar .seg { padding-bottom: 0; }

/* Primary actions share the cyan-to-teal accent of the login page. */
#app .btn.primary{background:linear-gradient(100deg,#10bdf0,#03dfcd);color:#083d53;box-shadow:0 8px 18px rgba(8,155,167,.18)}
#app .btn.primary:hover:not(:disabled){background:linear-gradient(100deg,#16c6f3,#20e5d5)}
#app .btn.primary:disabled{background:#a4d6d7;color:#315766}
