/* MotoCare PWA — "asfalt gece" teması (Android uygulamasıyla aynı renk dili). Koyu varsayılan; açık tema krem zeminli. */
:root {
  --page: #0F1217; --surface: #1A1F28; --field: #1E242E; --hair: #2A313D; --chip: #232A35;
  --text: #F3F4F6; --muted: #8E97A6; --faint: #5E6776;
  --accent: #F2A43A; --accent-text: #F2A43A; --on-accent: #140E05;
  --green: #4FC79A; --green-bg: #17281F; --green-line: #245A45; --danger: #EF5350; --warn: #F2A43A;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --page: #FAF6F0; --surface: #FFFFFF; --field: #FFFFFF; --hair: #E9E1D5; --chip: #F3ECE0;
  --text: #1A1410; --muted: #6B6259; --faint: #A39A8E;
  --accent: #F59E0B; --accent-text: #B45309; --on-accent: #140E05;
  --green: #12805C; --green-bg: #E6F0E8; --green-line: #A8D4BF; --danger: #D93A36; --warn: #B45309;
  --shadow: 0 10px 30px rgba(120,90,40,.12);
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { scroll-padding-bottom: 130px; scroll-padding-top: 20px; }
html, body { background: var(--page); color: var(--text); font-family: 'Archivo', system-ui, sans-serif; font-size: 15px; }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.hidden { display: none !important; }

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { flex: 1; padding: calc(env(safe-area-inset-top) + 18px) 20px 110px; }
h1.title { font-size: 30px; font-weight: 700; letter-spacing: -.5px; margin-bottom: 10px; }
h2.sub { font-size: 21px; font-weight: 700; margin: 8px 0 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 1.6px; color: var(--muted); margin: 20px 0 8px; }
.label .opt { letter-spacing: 0; color: var(--faint); margin-left: 6px; }
.req { color: var(--accent-text); }

/* Alanlar */
.field, select.field, textarea.field {
  width: 100%; background: var(--field); border: 1px solid var(--hair); border-radius: 12px; padding: 14px 15px; outline: none; color: var(--text);
}
.field::placeholder { color: var(--faint); }
.field:focus { border-color: var(--accent); }
textarea.field { resize: vertical; min-height: 84px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.combo { position: relative; }
.combo .list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); max-height: 240px; overflow: auto; background: var(--surface); border: 1px solid var(--hair); border-radius: 12px; z-index: 30; box-shadow: var(--shadow); }
.combo .item { padding: 12px 14px; border-bottom: 1px solid var(--hair); }
.combo .item:last-child { border: 0; }
.combo .item.add { color: var(--accent-text); font-weight: 600; }

/* Düğmeler */
.btn { display: block; width: 100%; text-align: center; padding: 15px; border-radius: 14px; font-weight: 700; background: var(--accent); color: var(--on-accent); }
.btn:disabled { opacity: .45; }
.btn.ghost { background: transparent; border: 1.5px solid var(--accent); color: var(--accent-text); }
.btn.danger { background: transparent; border: 1px solid var(--hair); color: var(--danger); }
.pill { display: inline-block; padding: 9px 15px; border-radius: 12px; border: 1px solid var(--hair); background: var(--surface); color: var(--accent-text); font-weight: 600; font-size: 13.5px; }
.link { color: var(--accent-text); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chip { padding: 10px 15px; border-radius: 999px; border: 1.5px solid var(--hair); background: transparent; font-weight: 600; font-size: 14px; }
.chip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-text); }
.seg { display: flex; gap: 10px; }
.seg .chip { flex: 1; text-align: center; border-radius: 14px; padding: 13px; }

/* Kartlar */
.card { background: var(--surface); border: 1px solid var(--hair); border-radius: 20px; padding: 18px; margin-top: 16px; }
.card.green { background: var(--green-bg); border-color: var(--green-line); }
.card .eyebrow { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 1.6px; color: var(--muted); }
.card.green .eyebrow { color: var(--green); }
.hero { height: 200px; border-radius: 20px 20px 0 0; background: var(--chip) center/cover no-repeat; position: relative; display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 44px; }
.hero .photo-btn { position: absolute; right: 12px; bottom: 12px; padding: 9px 13px; border-radius: 12px; background: rgba(0,0,0,.55); color: var(--accent); font-weight: 600; font-size: 13px; backdrop-filter: blur(6px); }
.bikecard { background: var(--surface); border: 1px solid var(--hair); border-radius: 20px; margin-top: 14px; overflow: hidden; }
.bikecard .body { padding: 16px 18px 18px; }
.plate { display: inline-flex; align-items: stretch; background: #fff; border: 2px solid #1E3FBF; border-radius: 6px; overflow: hidden; font-family: 'IBM Plex Mono', monospace; font-weight: 600; color: #111; }
.plate .tr { background: #1E3FBF; color: #fff; font-size: 9px; padding: 3px 5px; display: flex; align-items: flex-end; }
.plate .no { padding: 3px 9px; font-size: 16px; }
.bikename { font-size: 24px; font-weight: 700; margin: 12px 0 8px; }
.kmrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kmrow .mono { color: var(--muted); font-size: 13.5px; }
.doc, .wear { padding: 12px 0; border-top: 1px solid var(--hair); }
.doc:first-of-type, .wear:first-of-type { border-top: 0; }
.doc { display: flex; justify-content: space-between; align-items: center; }
.doc b, .wear b { font-weight: 600; font-size: 17px; }
.tone-ok { color: var(--green); } .tone-warn { color: var(--warn); } .tone-bad { color: var(--danger); }
.bar { height: 8px; background: var(--chip); border-radius: 6px; margin: 9px 0 7px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: var(--green); }
.bar > i.warn { background: var(--warn); } .bar > i.bad { background: var(--danger); }
.wearhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.item-card { background: var(--surface); border: 1px solid var(--hair); border-radius: 16px; padding: 15px 16px; margin-top: 12px; }
.item-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.item-card h3 { font-size: 17px; font-weight: 600; }
.tag { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); white-space: nowrap; }
.tag.ok { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.tag.bad { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.tag.gray { background: var(--chip); color: var(--muted); }
.del { color: var(--danger); font-weight: 600; font-size: 14px; }
.empty { color: var(--muted); padding: 18px 2px; }
.stats { display: flex; gap: 10px; margin-top: 10px; }
.stats > div { flex: 1; }
.stats b { display: block; font-family: 'IBM Plex Mono', monospace; font-size: 19px; margin-top: 3px; }

/* Alt sekmeler */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: color-mix(in srgb, var(--page) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--hair); padding: 8px 6px calc(env(safe-area-inset-bottom) + 8px); display: flex; justify-content: center; }
nav.tabs .in { display: flex; width: 100%; max-width: 520px; }
nav.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); font-weight: 500; position: relative; }
nav.tabs .ic { width: 46px; height: 32px; border-radius: 12px; background: var(--chip); display: flex; align-items: center; justify-content: center; }
nav.tabs .ic svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
nav.tabs button.on { color: var(--text); font-weight: 700; }
nav.tabs button.on .ic { background: var(--accent); color: var(--on-accent); }
nav.tabs .badge { position: absolute; top: -3px; right: 20%; min-width: 17px; height: 17px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* Giriş ekranları */
.auth { min-height: 100dvh; padding: calc(env(safe-area-inset-top) + 22px) 24px 40px; position: relative; overflow: hidden; }
.auth::before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 45%); }
.logo { width: 76px; height: 76px; border-radius: 22px; background: linear-gradient(145deg, #F2A43A, #CC7A1A); display: flex; align-items: center; justify-content: center; margin: 60px 0 18px; box-shadow: 0 14px 40px rgba(242,164,58,.28); }
.logo svg { width: 46px; height: 46px; }
.brand { font-size: 40px; font-weight: 800; letter-spacing: -1px; }
.brand b { color: var(--accent-text); }
.tagline { font-family: 'IBM Plex Mono', monospace; letter-spacing: 3.5px; font-size: 11.5px; color: var(--muted); margin: 6px 0 34px; }
.theme-toggle { position: absolute; top: calc(env(safe-area-inset-top) + 16px); right: 20px; display: flex; background: var(--chip); border-radius: 999px; padding: 4px; }
.theme-toggle span { width: 34px; height: 30px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.theme-toggle span.on { background: var(--accent); color: var(--on-accent); }
.err { background: color-mix(in srgb, var(--danger) 14%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); border-radius: 12px; padding: 11px 14px; margin-top: 14px; font-size: 13.5px; }
.ok { background: var(--green-bg); border: 1px solid var(--green-line); color: var(--green); border-radius: 12px; padding: 11px 14px; margin-top: 14px; font-size: 13.5px; }
.center { text-align: center; }
.hint { background: var(--surface); border: 1px dashed var(--hair); border-radius: 14px; padding: 13px 15px; margin-top: 16px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.hint b { color: var(--text); }

/* Alt sayfa (sheet) */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; max-height: 90dvh; overflow: auto; background: var(--page); border-radius: 24px 24px 0 0; padding: 12px 20px calc(env(safe-area-inset-bottom) + 24px); border: 1px solid var(--hair); }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--hair); margin: 0 auto 14px; }
.sheet h3 { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 4px; font-weight: 500; }
#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 96px); transform: translateX(-50%); background: var(--text); color: var(--page); padding: 11px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 80; max-width: 88vw; text-align: center; }
#toast.show { opacity: 1; }
.list-row { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-top: 1px solid var(--hair); gap: 12px; }
.list-row:first-child { border-top: 0; }
.list-row .t { font-weight: 600; font-size: 16px; }
.switch { width: 50px; height: 30px; border-radius: 16px; background: var(--chip); border: 1px solid var(--hair); position: relative; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--faint); transition: .18s; }
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on::after { left: 23px; background: var(--on-accent); }
.slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 6px; }
.slots button { padding: 11px 0; border-radius: 12px; border: 1px solid var(--hair); background: var(--chip); font-family: 'IBM Plex Mono', monospace; font-size: 13.5px; }
.slots button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-text); font-weight: 600; }
.slots button:disabled { opacity: .3; text-decoration: line-through; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }
