/* ==========================================================================
   Inspeksi Harian — aplikasi mobile Nusa Daya
   Desain: konsol lapangan. Kontras tinggi, target sentuh besar, aman
   digunakan di bawah sinar matahari dan saat memakai sarung tangan.
   ========================================================================== */

:root {
  --ink: #0b1b26;
  --ink-soft: #243b48;
  --navy: #06202e;
  --navy-2: #0a2c3d;
  --teal: #0c7a76;
  --teal-deep: #075955;
  --teal-soft: #dff1ee;
  --lime: #c9f06a;
  --lime-deep: #9bc53d;
  --paper: #edf4f1;
  --surface: #ffffff;
  --line: #d4e4df;
  --line-strong: #b9d2cb;
  --muted: #6b818a;
  --amber: #a86a12;
  --amber-bg: #fdf1d8;
  --red: #c22d47;
  --red-bg: #fde7ea;
  --green: #147a45;
  --green-bg: #ddf4e6;
  --blue: #2b5f8a;
  --blue-bg: #e3eef8;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 10px 30px rgba(6, 32, 46, .07);
  --shadow-soft: 0 2px 10px rgba(6, 32, 46, .06);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "Segoe UI Mono", "SF Mono", Consolas, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 100% -10%, #d9ece7 0%, transparent 62%),
    radial-gradient(700px 420px at -10% 110%, #e3ece5 0%, transparent 55%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .35;
  background-image: radial-gradient(rgba(11, 27, 38, .12) .6px, transparent .7px);
  background-size: 14px 14px;
  mask-image: linear-gradient(to bottom, #000, transparent 70%);
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

a {
  color: var(--teal);
}

[hidden] {
  display: none !important;
}

h1, h2, h3, h4, p {
  margin: 0;
}

h1, h2, h3 {
  letter-spacing: -.02em;
}

:focus-visible {
  outline: 3px solid rgba(12, 122, 118, .35);
  outline-offset: 2px;
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}

/* ============================== TOPBAR ============================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  padding-top: var(--safe-top);
  background:
    radial-gradient(420px 120px at 90% -30%, rgba(201, 240, 106, .22), transparent 70%),
    linear-gradient(180deg, #072433, #06202e);
  color: #eaf4f2;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 14px;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--lime);
  color: #0b2a1e;
  box-shadow: 0 4px 12px rgba(201, 240, 106, .28);
  flex: none;
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand-text {
  min-width: 0;
  line-height: 1.05;
  overflow: hidden;
}

.brand-text b {
  display: block;
  font-size: 12.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text span {
  display: block;
  font-size: 10.5px;
  color: #8fb0b6;
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .05);
  color: #d9e9e6;
  display: inline-grid;
  place-items: center;
  flex: none;
  transition: background .15s ease, transform .12s ease;
}

.icon-btn:active {
  transform: scale(.94);
  background: rgba(255, 255, 255, .12);
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.avatar-mini {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1ea6a0, #0c7a76);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  border: 2px solid rgba(255, 255, 255, .2);
  flex: none;
  overflow: hidden;
}

.avatar-mini img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .02em;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  color: #cfe3df;
  white-space: nowrap;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7f9aa0;
  flex: none;
}

.sync-chip[data-state="ok"] .sync-dot { background: var(--lime); box-shadow: 0 0 0 3px rgba(201, 240, 106, .18); }
.sync-chip[data-state="pending"] .sync-dot { background: #f0b45c; }
.sync-chip[data-state="conflict"] .sync-dot { background: #ff7189; }
.sync-chip[data-state="syncing"] .sync-dot { background: #6fd3ff; animation: pulse 1s infinite; }
.sync-chip[data-state="offline"] .sync-dot { background: #90a4aa; }

@keyframes pulse {
  0%, 100% { opacity: .35; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* ============================== CONTENT ============================== */

.content {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 16px calc(92px + var(--safe-bottom));
}

.content.form-mode {
  padding-bottom: calc(104px + var(--safe-bottom));
}

.content.no-tabbar {
  padding-bottom: calc(28px + var(--safe-bottom));
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 12px;
}

.page-head h1 {
  font-size: 22px;
  line-height: 1.15;
  font-weight: 800;
}

.page-head p {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--teal);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 20px 2px 9px;
}

.section-title h2 {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .02em;
}

.section-title a,
.section-title button {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--teal);
  background: none;
  border: 0;
  padding: 4px 0;
}

.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.mono { font-family: var(--mono); }
.center { text-align: center; }

/* ============================== CARD ============================== */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-pad { padding: 16px; }

.card + .card { margin-top: 12px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid #e8f1ee;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}

.card-body { padding: 14px 15px; }

/* ============================== BUTTONS ============================== */

.btn {
  --btn-bg: var(--teal);
  --btn-fg: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: .01em;
  text-decoration: none;
  transition: transform .12s ease, filter .15s ease, background .15s ease;
}

.btn svg { width: 18px; height: 18px; }

.btn:active { transform: translateY(1px) scale(.995); }
.btn:disabled { opacity: .55; pointer-events: none; }

.btn-primary {
  background: linear-gradient(180deg, #0f8b86, #0a6b67);
  box-shadow: 0 8px 20px rgba(12, 122, 118, .28), 0 1px 0 rgba(255, 255, 255, .18) inset;
}

.btn-lime {
  --btn-bg: var(--lime);
  --btn-fg: #102a1d;
  box-shadow: 0 8px 20px rgba(201, 240, 106, .24);
}

.btn-ghost {
  background: #fff;
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.btn-quiet {
  background: transparent;
  color: var(--teal);
  border-color: transparent;
  min-height: 38px;
  padding: 0 10px;
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-outline-danger {
  background: #fff;
  color: var(--red);
  border-color: #efc3ca;
}

.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 12px; border-radius: 10px; }
.btn-sm svg { width: 15px; height: 15px; }

.btn-row {
  display: flex;
  gap: 9px;
}

.btn-row > * { flex: 1; }

/* ============================== BADGES ============================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
}

.badge svg { width: 12px; height: 12px; }

.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-gray { background: #eef2f1; color: #637a82; }
.badge-teal { background: var(--teal-soft); color: var(--teal-deep); }

/* ============================== HERO ============================== */

.hero {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: 22px;
  color: #effaf7;
  background:
    radial-gradient(320px 200px at 110% -30%, rgba(201, 240, 106, .3), transparent 66%),
    radial-gradient(280px 220px at -20% 120%, rgba(20, 160, 150, .35), transparent 70%),
    linear-gradient(155deg, #0a3042 0%, #06202e 58%, #083632 100%);
  box-shadow: 0 18px 40px rgba(6, 32, 46, .22);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px dashed rgba(255, 255, 255, .13);
  border-radius: 15px;
  pointer-events: none;
}

.hero-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(201, 240, 106, .14);
  border: 1px solid rgba(201, 240, 106, .28);
  color: var(--lime);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.hero-date {
  font-size: 10.5px;
  color: #9cb9bd;
  font-weight: 600;
}

.hero-vehicle {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.vehicle-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .16);
  color: var(--lime);
  flex: none;
  overflow: hidden;
}

.vehicle-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vehicle-icon.user-photo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.vehicle-icon.user-photo span {
  font-size: 13px;
}

.vehicle-icon span {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .5px;
  color: #fff;
}

.vehicle-icon svg { width: 28px; height: 28px; }

.hero-vehicle h1 {
  font-size: 20px;
  line-height: 1.16;
  color: #fff;
  font-weight: 800;
}

.hero-vehicle p {
  margin-top: 3px;
  font-size: 11px;
  color: #9cb9bd;
}

.hero-status {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 15px 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  font-size: 11.5px;
  color: #d8e8e5;
}

.hero-status b { color: #fff; font-size: 12px; }

.hero .btn { position: relative; z-index: 1; width: 100%; }

.hero-foot {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, .14);
}

.hero-foot div { text-align: center; }
.hero-foot b { display: block; font-size: 16px; color: #fff; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero-foot small { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: #8fb0b6; font-weight: 700; }

/* ============================== KPI ============================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 12px;
}

.kpi {
  padding: 12px 11px;
  border-radius: 15px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.kpi small {
  display: block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
  line-height: 1.25;
}

.kpi b {
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
}

.kpi span {
  display: block;
  margin-top: 4px;
  font-size: 9.5px;
  color: var(--muted);
}

.kpi.is-alert b { color: var(--red); }
.kpi.is-warn b { color: var(--amber); }
.kpi.is-ok b { color: var(--green); }

/* ============================== LIST CARDS ============================== */

.stack { display: grid; gap: 10px; }

.inspection-card {
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  transition: transform .12s ease, border-color .15s ease;
}

.inspection-card:active { transform: scale(.994); border-color: var(--line-strong); }

.date-block {
  flex: none;
  width: 46px;
  padding: 6px 0;
  border-radius: 12px;
  background: #f1f7f4;
  border: 1px solid #e0ece8;
  text-align: center;
  align-self: flex-start;
}

.date-block b {
  display: block;
  font-size: 18px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.date-block small {
  display: block;
  margin-top: 2px;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.inspection-main { flex: 1; min-width: 0; }
.inspection-main h3 { font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inspection-main p { margin-top: 2px; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inspection-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 7px; }

.chevron { align-self: center; color: #9ab0b4; flex: none; }
.chevron svg { width: 17px; height: 17px; }

/* ============================== CHIPS / SEARCH ============================== */

.chip-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.chip-row::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.chip small {
  font-size: 9.5px;
  font-weight: 800;
  background: #edf3f1;
  border-radius: 99px;
  padding: 1px 6px;
  color: var(--muted);
}

.chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.chip.active small { background: rgba(255, 255, 255, .16); color: #fff; }

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.search svg { width: 18px; height: 18px; color: #8aa1a7; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; }

/* ============================== BANNER / NOTICE ============================== */

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid #ecd8a9;
  background: #fff8e8;
  color: #6b4a08;
  font-size: 11.5px;
  line-height: 1.4;
}

.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice b { display: block; font-size: 12px; margin-bottom: 1px; }
.notice.info { border-color: #bcd8ea; background: #eff7fd; color: #1f4c6d; }
.notice.danger { border-color: #efc3ca; background: #fff1f3; color: #8d1f33; }
.notice.success { border-color: #b7dfc7; background: #eefaf2; color: #136b3e; }
.notice .btn { margin-top: 6px; }

.offline-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 30px;
  padding: 5px 12px calc(5px + var(--safe-top));
  background: #3a2b0a;
  color: #ffe6a8;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .03em;
}

.offline-bar[hidden] { display: none; }

.offline-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f0b45c;
  box-shadow: 0 0 0 3px rgba(240, 180, 92, .18);
}

/* ============================== AUTH ============================== */

.auth-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(20px + var(--safe-top)) 18px calc(26px + var(--safe-bottom));
  background:
    radial-gradient(500px 340px at 95% -5%, rgba(201, 240, 106, .24), transparent 65%),
    radial-gradient(420px 320px at -10% 100%, rgba(20, 160, 150, .3), transparent 62%),
    linear-gradient(165deg, #0a3042 0%, #06202e 56%, #04161f 100%);
  color: #eaf4f2;
}

.auth-wrap {
  width: 100%;
  max-width: 430px;
  margin: auto;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 26px;
}

.auth-brand .brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 17px;
}

.auth-brand .brand-mark svg { width: 30px; height: 30px; }

.auth-brand h1 {
  font-size: 24px;
  line-height: 1.05;
  color: #fff;
  font-weight: 800;
  letter-spacing: -.03em;
}

.auth-brand p {
  margin-top: 4px;
  font-size: 11px;
  color: #93b1b5;
  letter-spacing: .04em;
}

.auth-card {
  background: #f7fbf9;
  color: var(--ink);
  border-radius: 24px;
  padding: 20px 18px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .32);
}

.auth-card h2 { font-size: 18px; font-weight: 800; }
.auth-card > p { margin-top: 3px; font-size: 12px; color: var(--muted); }

.auth-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px dashed #d9e7e2;
  font-size: 10.5px;
  color: #7c9299;
}

.auth-meta {
  margin-top: 22px;
  text-align: center;
  font-size: 10px;
  color: #7e9ba0;
  line-height: 1.5;
}

/* ============================== FORM ============================== */

.field {
  display: block;
  margin-top: 13px;
}

.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #fff;
  font-size: 16px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.textarea { min-height: 76px; resize: vertical; line-height: 1.45; }

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(12, 122, 118, .12);
}

.input::placeholder,
.textarea::placeholder { color: #a5b6ba; }

.input-wrap { position: relative; }
.input-wrap .input { padding-right: 48px; }
.input-wrap button {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
}
.input-wrap button svg { width: 19px; height: 19px; }

.form-meta {
  display: grid;
  gap: 9px;
  padding: 14px 15px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f7fbf9, #ffffff);
  border: 1px solid var(--line);
}

.meta-line {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.meta-line svg { width: 16px; height: 16px; color: var(--teal); flex: none; }
.meta-line b { font-weight: 700; }
.meta-line span { color: var(--muted); }

.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: #edf4f1;
  border: 1px solid #e0ebe7;
}

.seg button {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #526a72;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  padding: 4px 3px;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.seg button.active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(6, 32, 46, .12); }
.seg button.active[data-tone="baik"] { color: var(--green); }
.seg button.active[data-tone="ringan"] { color: var(--amber); }
.seg button.active[data-tone="berat"] { color: var(--red); }

/* ============================== ITEM INSPEKSI ============================== */

.items-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 2px 8px;
}

.items-head h2 { font-size: 13px; font-weight: 800; }
.items-head span { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.progress-track {
  height: 6px;
  border-radius: 99px;
  background: #e1ece8;
  overflow: hidden;
  margin: 0 2px 12px;
}

.progress-track > div {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--teal), var(--lime-deep));
  transition: width .25s ease;
}

.item {
  position: relative;
  padding: 13px 14px 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--c, #cfe0db);
}

.item.is-baik { --c: #2f9e63; }
.item.is-ringan { --c: #e2a031; }
.item.is-berat { --c: #d94b62; }
.item.is-temuan { border-color: #eed3a8; }
.item.is-berat { border-color: #f0c3ca; }

.item-head {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.item-idx {
  flex: none;
  min-width: 27px;
  height: 24px;
  padding: 0 5px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: #f0f6f4;
  border: 1px solid #e1ece8;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: #60777e;
}

.item-title { flex: 1; min-width: 0; }
.item-title h3 { font-size: 12.5px; font-weight: 800; line-height: 1.3; }
.item-title p { margin-top: 2px; font-size: 10px; color: var(--muted); }
.item-title code {
  font-family: var(--mono);
  font-size: 9.5px;
  background: #f0f5f3;
  padding: 1px 4px;
  border-radius: 4px;
  color: #4c666d;
}

.item-controls {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 11px;
}

.stepper {
  display: flex;
  align-items: center;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  overflow: hidden;
  background: #fff;
  flex: none;
}

.stepper button {
  width: 36px;
  height: 100%;
  border: 0;
  background: #f4f8f6;
  color: var(--ink);
  display: grid;
  place-items: center;
}

.stepper button:active { background: #e6f1ed; }
.stepper button svg { width: 15px; height: 15px; }

.stepper input {
  width: 44px;
  height: 100%;
  border: 0;
  border-left: 1px solid #e4eeeb;
  border-right: 1px solid #e4eeeb;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  outline: none;
  -moz-appearance: textfield;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.item .seg button { font-size: 10px; min-height: 34px; }

.item-note { margin-top: 9px; }

.item-note input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid #dfeae6;
  background: #fafcfb;
  font-size: 16px;
  outline: none;
}

.item-note input:focus { border-color: var(--teal); background: #fff; }

.item-photo {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 9px;
}

.thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #f0f5f3;
  flex: none;
}

.thumb-fallback {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #f0f5f3;
  border: 1px dashed var(--line-strong);
  color: #9ab0b4;
  flex: none;
}

.thumb-fallback svg { width: 20px; height: 20px; }

.photo-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.photo-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.photo-btn svg { width: 14px; height: 14px; }
.photo-btn.danger { color: var(--red); border-color: #efc3ca; }

/* ============================== SAVE BAR ============================== */

.savebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(6, 32, 46, .09);
}

.savebar-info { flex: 1; min-width: 0; line-height: 1.15; }
.savebar-info small {
  display: block;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.savebar-info b { display: block; font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.savebar .btn { flex: none; min-height: 48px; }

/* ============================== TABBAR ============================== */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + var(--safe-bottom));
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px 5px;
  border: 0;
  background: none;
  color: #7f959b;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .02em;
  border-radius: 10px;
}

.tab svg { width: 21px; height: 21px; }
.tab.active { color: var(--teal-deep); }
.tab.active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 22px;
  height: 3px;
  border-radius: 99px;
  background: var(--lime-deep);
}

.tab-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 20px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
}

.tab-badge[hidden] { display: none; }

/* ============================== DETAIL ============================== */

.detail-head {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border-radius: 20px;
  color: #effaf7;
  background:
    radial-gradient(300px 180px at 110% -20%, rgba(201, 240, 106, .24), transparent 66%),
    linear-gradient(150deg, #0a3042, #06202e);
}

.detail-head h1 { font-size: 18px; color: #fff; margin-top: 8px; line-height: 1.2; }
.detail-head p { margin-top: 3px; font-size: 11px; color: #9cb9bd; }

.detail-head .badge { position: relative; }

.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, .14);
  text-align: center;
}

.detail-stats b { display: block; font-size: 17px; color: #fff; font-variant-numeric: tabular-nums; }
.detail-stats small { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: #8fb0b6; font-weight: 700; }

.read-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px dashed #e4eeeb;
}

.read-item:last-child { border-bottom: 0; }
.read-item .dot-kondisi {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 5px;
  flex: none;
  background: #2f9e63;
}
.read-item .dot-kondisi.ringan { background: #e2a031; }
.read-item .dot-kondisi.berat { background: #d94b62; }

.read-item-main { flex: 1; min-width: 0; }
.read-item-main h4 { font-size: 12px; font-weight: 700; line-height: 1.3; }
.read-item-main p { margin-top: 2px; font-size: 10px; color: var(--muted); }
.read-item-main .ket { margin-top: 3px; font-size: 10.5px; color: var(--ink-soft); font-style: italic; }

.read-qty {
  flex: none;
  text-align: right;
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.read-qty b { display: block; font-size: 14px; color: var(--ink); }
.read-qty .selisih { color: var(--red); font-weight: 700; }

.detail-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.detail-photos img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #eef4f1;
}

.detail-photo-main {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #eef4f1;
}

/* ============================== SYNC / PROFILE ============================== */

.draft-card {
  padding: 13px 14px;
  border-radius: 15px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.draft-card.is-conflict { border-color: #f0c3ca; background: #fffafb; }
.draft-card.is-error { border-color: #ecd8a9; background: #fffdf6; }

.draft-top { display: flex; align-items: flex-start; gap: 10px; }
.draft-top > svg { width: 20px; height: 20px; color: var(--teal); flex: none; margin-top: 2px; }
.draft-top h3 { font-size: 12.5px; font-weight: 800; }
.draft-top p { margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.draft-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.profile-hero {
  padding: 20px 16px;
  border-radius: 20px;
  color: #fff;
  background:
    radial-gradient(260px 160px at 100% 0%, rgba(201, 240, 106, .24), transparent 65%),
    linear-gradient(155deg, #0a3042, #06202e);
  text-align: center;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  color: #0b2a1e;
  background: var(--lime);
  border: 3px solid rgba(255, 255, 255, .2);
  overflow: hidden;
}

.profile-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-hero h1 { font-size: 18px; }
.profile-hero p { margin-top: 2px; font-size: 11px; color: #9cb9bd; }

.list-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 2px;
  border-bottom: 1px dashed #e4eeeb;
}

.list-row:last-child { border-bottom: 0; }
.list-row > svg { width: 19px; height: 19px; color: var(--teal); flex: none; }
.list-row .row-main { flex: 1; min-width: 0; }
.list-row .row-main b { display: block; font-size: 12px; font-weight: 700; }
.list-row .row-main span { display: block; font-size: 10.5px; color: var(--muted); word-break: break-all; }

/* ============================== EMPTY / SKELETON ============================== */

.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
}

.empty .empty-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 12px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: #e8f1ee;
  color: #7e9a9e;
  border: 1px dashed #c8dbd5;
}

.empty .empty-icon svg { width: 28px; height: 28px; }
.empty h3 { font-size: 13.5px; color: var(--ink); margin-bottom: 3px; }
.empty p { font-size: 11.5px; max-width: 280px; margin: 0 auto; }

.skeleton {
  border-radius: 14px;
  background: linear-gradient(100deg, #e7efec 20%, #f3f8f6 40%, #e7efec 60%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite linear;
}

@keyframes shimmer {
  to { background-position: -220% 0; }
}

.skel-card { height: 92px; margin-bottom: 10px; }
.skel-hero { height: 214px; margin-bottom: 12px; border-radius: 22px; }

/* ============================== TOAST / SHEET / LIGHTBOX ============================== */

.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 90;
  width: min(92vw, 440px);
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border-radius: 13px;
  background: #0d2734;
  color: #eaf4f2;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .28);
  animation: toast-in .22s ease both;
}

.toast svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.toast.error { background: #4a1220; color: #ffe2e7; }
.toast.success { background: #0b3a27; color: #d9f7e5; }
.toast.warn { background: #42300a; color: #ffedc2; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(4, 16, 22, .55);
  backdrop-filter: blur(3px);
  animation: fade-in .16s ease both;
}

.overlay[hidden] { display: none; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  width: min(100%, 480px);
  max-height: 86dvh;
  overflow: auto;
  padding: 18px 18px calc(18px + var(--safe-bottom));
  border-radius: 22px 22px 0 0;
  background: #fff;
  animation: sheet-up .22s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }

.sheet-grip {
  width: 38px;
  height: 4px;
  border-radius: 99px;
  background: #d6e3df;
  margin: 0 auto 14px;
}

.sheet h2 { font-size: 17px; font-weight: 800; }
.sheet p { margin-top: 5px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.sheet .btn-row { margin-top: 16px; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(2, 10, 14, .94);
  display: grid;
  place-items: center;
  padding: calc(20px + var(--safe-top)) 14px calc(20px + var(--safe-bottom));
}

.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }
.lightbox .close {
  position: absolute;
  top: calc(14px + var(--safe-top));
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .1);
  color: #fff;
  display: grid;
  place-items: center;
}

/* ============================== RESPONSIF ============================== */

@media (max-width: 380px) {
  .kpi b { font-size: 18px; }
  .item-controls { grid-template-columns: 1fr; }
  .stepper { justify-self: start; }
  .hero-vehicle h1 { font-size: 18px; }
  .topbar-actions .sync-chip span:not(.sync-dot) { display: none; }
  .sync-chip { padding: 0 8px; }
}

@media (min-width: 700px) {
  .content { padding-left: 24px; padding-right: 24px; }
  .hero { padding: 22px; }
  .items-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .items-grid .item + .item { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ============================== PENYEMPURNAAN ============================== */

/* Kartu riwayat dirender sebagai <a>, jadi warna bawaan tautan direset. */a.inspection-card,
a.inspection-card:visited,
a.inspection-card:hover {
  color: inherit;
  text-decoration: none;
}

.tab,
.tab:visited {
  color: #7f959b;
  text-decoration: none;
}

.tab.active,
.tab.active:visited { color: var(--teal-deep); }

/* Formulir tampil tanpa tabbar; savebar menempati dasar layar. */
.content.form-mode.no-tabbar {
  padding-bottom: calc(108px + var(--safe-bottom));
}

/* Tombol layar penuh: hanya untuk browser mobile yang mendukung. */
.fs-toggle { display: none; }
.fs-toggle .fs-expand,
.fs-toggle .fs-compress {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fs-toggle .fs-compress { display: none; }

body.can-fullscreen:not(.is-standalone) .fs-toggle { display: inline-grid; }

body.is-fullscreen .fs-toggle .fs-expand { display: none; }
body.is-fullscreen .fs-toggle .fs-compress { display: inline-flex; }

/* Di layar sempit, rapatkan topbar agar nama aplikasi tetap satu baris. */
@media (max-width: 440px) {
  body.can-fullscreen .topbar-inner { gap: 8px; }
  body.can-fullscreen .topbar-actions { gap: 6px; }
  body.can-fullscreen .brand-text b { font-size: 11px; letter-spacing: .08em; }
  body.can-fullscreen .brand-text span { font-size: 9.5px; }
  body.can-fullscreen .fs-toggle { width: 36px; height: 36px; border-radius: 10px; }
  body.can-fullscreen .avatar-mini { width: 36px; height: 36px; }
  body.can-fullscreen .sync-chip { padding: 0 9px; }
}

.fs-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.fs-row .row-main { flex: 1; min-width: 0; }
.fs-row .row-main b { display: block; font-size: 12.5px; font-weight: 700; }
.fs-row .row-main span { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted); line-height: 1.4; }

/* Banner offline menempel di atas, lalu tergeser di bawah topbar. */
.offline-bar {
  z-index: 35;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}

body.is-offline .topbar {
  border-bottom-color: rgba(240, 180, 92, .28);
}

/* Pesan galat form (login / simpan). */
.form-error {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #efc3ca;
  border-radius: 12px;
  background: #fff1f3;
  color: #8d1f33;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.45;
}

.form-error[hidden] { display: none; }

/* Blok pengaturan server yang bisa dilipat. */
.server-details {
  margin-top: 14px;
  padding: 0 12px;
  border: 1px solid #dbe8e3;
  border-radius: 12px;
  background: #f2f8f5;
}

.server-details > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .03em;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.server-details > summary::-webkit-details-marker { display: none; }

.server-details > summary::after {
  content: "+";
  margin-left: auto;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  color: var(--teal);
}

.server-details[open] > summary::after { content: "–"; }
.server-details[open] { padding-bottom: 8px; }
.server-details .field { margin-top: 2px; }

/* Cegah halaman ikut bergulir saat sheet/konfirmasi terbuka. */
body.sheet-open {
  overflow: hidden;
  touch-action: none;
}

/* Foto bukti bisa diketuk untuk diperbesar. */
.detail-photos img {
  cursor: zoom-in;
  transition: opacity .15s ease, transform .15s ease;
}

.detail-photos img:active {
  opacity: .88;
  transform: scale(.98);
}
