/* Service Log — tema otomotif: graphite/carbon, aksen silver & amber panel instrumen. */
:root {
  --bg: #0b0d10; --bg-2: #111418; --surface: #161a1f; --surface-2: #1c2128; --line: #262c34; --line-2: #313844;
  --text: #eef1f4; --text-2: #b6bdc6; --muted: #8b939e;
  --silver: #c9ced6; --amber: #f5a524; --amber-ink: #1a1203; --red: #ff5a3c; --ok: #3ccf8e;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 16px; --radius-sm: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-d: "Manrope", "Inter", system-ui, sans-serif;
  --nav-h: 64px;
  --carbon: repeating-linear-gradient(45deg, rgba(255,255,255,.018) 0 2px, transparent 2px 6px), repeating-linear-gradient(-45deg, rgba(255,255,255,.018) 0 2px, transparent 2px 6px);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f4f6; --bg-2: #eceef1; --surface: #ffffff; --surface-2: #f6f7f9; --line: #e3e6ea; --line-2: #d3d8de;
  --text: #14171b; --text-2: #3e4651; --muted: #5f6873;
  --silver: #5c6670; --amber: #955800; --amber-ink: #ffffff; --red: #b42d17; --ok: #0d6b40;
  --shadow: 0 8px 24px rgba(20,23,27,.08);
  --carbon: none;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); background-image: var(--carbon); color: var(--text);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  overflow-x: hidden;
}
h1, h2 { font-family: var(--font-d); letter-spacing: -.01em; margin: 0; }
h2 { font-size: 15px; font-weight: 700; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--amber); color: var(--amber-ink); padding: 8px 12px; border-radius: 8px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px); -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand img { display: block; border-radius: 9px; }
.topbar__title { flex: 1; min-width: 0; }
.topbar__title h1 { font-size: 18px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.status__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status--on .status__dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.status--off .status__dot, .status--err .status__dot { background: var(--red); }
.status--pend .status__dot, .status--sync .status__dot { background: var(--amber); }
.status--sync .status__dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
#sync-btn.spin .ic { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: 14.5px; text-decoration: none; cursor: pointer; transition: transform .08s, background .15s, border-color .15s;
}
.btn:hover { border-color: var(--silver); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn .ic { width: 19px; height: 19px; }
.btn--primary { background: linear-gradient(180deg, color-mix(in srgb, var(--amber) 100%, white 8%), var(--amber)); border-color: transparent; color: var(--amber-ink); }
.btn--danger { background: var(--red); border-color: transparent; color: #fff; }
.btn--danger-ghost { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--line)); background: transparent; }
.btn--ghost { background: transparent; }
.btn--sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn--block { width: 100%; margin-top: 10px; }
.btn--icon { min-height: 44px; width: 44px; padding: 0; border-radius: 12px; background: transparent; border-color: transparent; }
.btn--icon:hover { background: var(--surface-2); border-color: var(--line); }

/* ---------- Layout ---------- */
.view { max-width: 980px; margin: 0 auto; padding: 16px 16px 8px; outline: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; min-height: calc(100dvh - 60px); }
.view > * { min-width: 0; }
.field input[type="date"] { -webkit-appearance: none; appearance: none; display: flex; align-items: center; }
@media (min-width: 900px) { .view { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } .view > .hero, .view > .toolbar, .view > #svc-results, .view > .actions, .view > .form, .view > .grid, .view > .empty { grid-column: 1 / -1; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card__h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.link { color: var(--amber); font-size: 13px; font-weight: 600; text-decoration: none; }
.eyebrow { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--silver); font-weight: 600; }

/* Hero ala panel instrumen */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 18px 18px 16px; border: 1px solid var(--line-2);
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--amber) 14%, transparent), transparent 55%), linear-gradient(160deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow);
}
.hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: linear-gradient(90deg, var(--amber), transparent 70%); }
.hero__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hero__num { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-d); font-size: clamp(24px, 7.4vw, 40px); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; }
.hero__title { font-size: 22px; font-weight: 800; margin: 4px 0 6px; line-height: 1.25; }
.hero__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--text-2); font-size: 13.5px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.kpi { background: color-mix(in srgb, var(--bg) 45%, transparent); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-width: 0; }
.kpi__l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.kpi__v { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.select-pill select { appearance: none; -webkit-appearance: none; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 14px; font-weight: 600; min-height: 40px; }

/* Gauges */
.gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gauge { text-align: center; min-width: 0; }
.gauge svg { width: 100%; max-width: 128px; display: block; margin: 0 auto; }
.gauge__track { fill: none; stroke: var(--line-2); stroke-width: 7; stroke-linecap: round; }
.gauge__val { fill: none; stroke: var(--tone); stroke-width: 7; stroke-linecap: round; filter: drop-shadow(0 0 4px color-mix(in srgb, var(--tone) 50%, transparent)); }
.gauge__tick { stroke: var(--muted); stroke-width: 1.4; }
.gauge__needle { stroke: var(--tone); stroke-width: 3; stroke-linecap: round; }
.gauge__hub { fill: var(--silver); }
.gauge__num { font: 800 20px var(--font-d); fill: var(--text); }
.gauge__max { font-size: 12px; fill: var(--muted); font-weight: 600; }
.gauge__label { font-weight: 700; font-size: 13.5px; margin-top: -4px; }
.gauge__sub { font-size: 11.5px; color: var(--muted); }
.gauge--ok { --tone: var(--ok); } .gauge--amber { --tone: var(--amber); } .gauge--red { --tone: var(--red); }

/* Chart */
.chart { width: 100%; height: auto; display: block; }
.chart__grid { stroke: var(--line); stroke-dasharray: 3 4; }
.chart__base { stroke: var(--line-2); }
.chart__axis { font-size: 9px; fill: var(--muted); font-family: var(--font); }
.chart__bar rect { fill: color-mix(in srgb, var(--silver) 55%, var(--surface)); transition: fill .15s; }
.chart__bar.is-active rect, .chart__bar:hover rect { fill: var(--amber); }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hbars__row { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.hbars__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars__track { height: 7px; border-radius: 99px; background: var(--surface-2); margin-top: 5px; overflow: hidden; }
.hbars__fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--silver), var(--amber)); }

/* Rows / list */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li + li { border-top: 1px solid var(--line); }
.rows--card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rows--card .row { padding: 12px 14px; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; text-decoration: none; min-height: 56px; }
.row:hover .row__t { color: var(--amber); }
.row__icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--silver); flex: none; }
.row__icon .ic { width: 19px; height: 19px; }
.row__main { flex: 1; min-width: 0; }
.row__t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__s { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__end { text-align: right; display: grid; justify-items: end; gap: 3px; flex: none; max-width: 45%; }
.row__amt { font-weight: 700; }
.empty-row { padding: 18px; text-align: center; }

.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; border: 1px solid transparent; white-space: nowrap; }
.chip--ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.chip--amber { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.chip--red { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.chip--mute { color: var(--muted); background: var(--surface-2); border-color: var(--line); }
.tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border: 1px solid var(--line-2); border-radius: 5px; padding: 0 4px; margin-left: 4px; }
.plate { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; letter-spacing: .06em; padding: 2px 8px; border-radius: 6px; background: var(--text); color: var(--bg); font-size: 12.5px; }

/* Toolbar & filters */
.toolbar { display: grid; gap: 10px; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 14px; min-height: 48px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; height: 46px; font-size: 16px; }
.search .ic { color: var(--muted); width: 19px; }
.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 700px) { .filters { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sumbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 2px 2px 10px; }

/* Fields & forms */
.field { display: grid; gap: 6px; min-width: 0; font-size: 13px; color: var(--text-2); font-weight: 600; }
.field input, .field select {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text); font-size: 16px; font-weight: 500; outline: none; min-width: 0;
}
.field select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.field input:focus, .field select:focus { border-color: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 22%, transparent); }
.field input:disabled { opacity: .5; }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--red); }
.field--sm input, .field--sm select { min-height: 44px; font-size: 15px; }
.field__err { color: var(--red); font-weight: 600; min-height: 0; }
.field__err:empty { display: none; }
.req { color: var(--amber); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13px; color: var(--muted); min-height: 32px; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--amber); }
.form__title { font-size: 20px; margin-bottom: 14px; }
.form__grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .form__grid { grid-template-columns: 1fr 1fr; } .field--wide { grid-column: 1 / -1; } }
.form__total { display: flex; justify-content: space-between; align-items: center; margin: 16px 0 6px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line-2); }
.form__total b { font-size: 18px; color: var(--amber); }
.form__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.form__actions .btn { flex: 1 1 auto; }
@media (min-width: 640px) { .form__actions .btn { flex: 0 0 auto; } }
.pw { display: flex; gap: 6px; }
.pw input { flex: 1; }

/* Key-values */
.kvs { margin: 0; display: grid; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions .btn--primary { grid-column: 1 / -1; }
.actions--inline { margin-top: 12px; }
@media (min-width: 700px) { .actions { display: flex; flex-wrap: wrap; } .actions .btn--primary { grid-column: auto; } }

/* Vehicles grid */
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }
.vcard { position: relative; display: block; text-decoration: none; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: linear-gradient(160deg, var(--surface-2), var(--surface)); box-shadow: var(--shadow); overflow: hidden; }
.vcard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, var(--silver), transparent); opacity: .6; }
.vcard__top { display: flex; justify-content: space-between; align-items: center; }
.vcard__badge { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--silver); }
.vcard__name { font: 800 17px var(--font-d); margin-top: 12px; }
.vcard__plate { color: var(--muted); font-size: 13px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.vcard__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.vcard__stats span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.vcard__stats b { font-size: 13px; }

/* Segmented */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.seg__btn { min-height: 40px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; cursor: pointer; color: var(--text-2); }
.seg__btn.is-on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.about { display: flex; gap: 14px; align-items: center; }
.about img { border-radius: 14px; }
.about__name { font: 800 17px var(--font-d); }
.about__credit { margin-top: 4px; font-size: 12.5px; color: var(--amber); font-weight: 600; }

/* Empty */
.empty { text-align: center; padding: 36px 18px; display: grid; justify-items: center; gap: 10px; }
.empty p { color: var(--text-2); max-width: 420px; margin: 0; }
.empty__logo { border-radius: 22px; box-shadow: var(--shadow); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--amber); animation: spin .9s linear infinite; }

/* Bottom nav + FAB */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 0 max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line);
}
.nav__item { display: grid; place-items: center; align-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; min-height: 48px; }
.nav__item[aria-current="page"] { color: var(--text); }
.nav__item[aria-current="page"] .ic { color: var(--amber); }
.fab {
  position: fixed; z-index: 31; right: max(18px, env(safe-area-inset-right)); bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; color: var(--amber-ink);
  background: linear-gradient(160deg, color-mix(in srgb, var(--amber) 100%, white 12%), var(--amber)); box-shadow: 0 10px 26px color-mix(in srgb, var(--amber) 35%, transparent);
}
.fab .ic { width: 26px; height: 26px; stroke-width: 2.2; }
.fab[hidden] { display: none; }
.credit { text-align: center; font-size: 12px; color: var(--muted); padding: 12px 16px calc(var(--nav-h) + 96px + env(safe-area-inset-bottom)); }
.credit span { letter-spacing: .02em; }

/* Update banner, toast, modal */
.update { position: sticky; top: 64px; z-index: 19; display: flex; justify-content: center; align-items: center; gap: 12px; padding: 8px 16px; background: var(--amber); color: var(--amber-ink); font-weight: 600; }
.update[hidden] { display: none; }
.update .btn { background: var(--amber-ink); color: var(--amber); }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 90px + env(safe-area-inset-bottom)); z-index: 60; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); }
.toast { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 14px; background: #20252c; color: #f1f3f5; border: 1px solid #343b45; box-shadow: var(--shadow); font-size: 14px; animation: tin .2s ease-out; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .2s; }
.toast--ok { border-left: 3px solid var(--ok); } .toast--err { border-left: 3px solid #ff5a3c; }
.toast__btn { border: 0; background: transparent; color: #f5a524; font-weight: 800; cursor: pointer; padding: 6px 8px; min-height: 36px; }
.toast--progress::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; background: #f5a524; animation: prog var(--dur) linear forwards; }
@keyframes prog { from { width: 100%; } to { width: 0; } }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: end center; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 640px) { .modal { place-items: center; } }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); opacity: 0; transition: opacity .2s; }
.modal__card { position: relative; width: min(460px, 100%); max-height: 85dvh; overflow: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); transform: translateY(20px); opacity: 0; transition: .2s; }
.modal__card--wide { width: min(620px, 100%); }
.modal.in .modal__backdrop { opacity: 1; } .modal.in .modal__card { transform: none; opacity: 1; }
.modal__title { font-size: 18px; margin-bottom: 8px; }
.modal__body { color: var(--text-2); }
.modal__actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.modal__actions .btn { flex: 1 1 140px; }
.tablewrap { overflow-x: auto; }
.diff { width: 100%; border-collapse: collapse; font-size: 13px; }
.diff th, .diff td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.diff thead th { color: var(--muted); font-weight: 600; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
