/* WrenchJournal - pegboard garage service log */

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

:root {
  --accent: #ff6b00;
  --primary: #1e3a5f;
  --secondary: #4a4a4a;
  --manila: #e7d6a8;
  --manila-dark: #c9b27f;
  --ink: #3a2f1f;
  --paper-line: #b49a63;
  --tabbar-h: 78px;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--primary);
  color: var(--ink);
  overflow: hidden;
  height: 100dvh;
  position: relative;
}

/* ============ PEGBOARD BACKGROUND ============ */
.pegboard {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(0,0,0,.18), transparent 22%),
    radial-gradient(circle at 70% 80%, rgba(0,0,0,.22), transparent 30%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.02) 0 1px, transparent 1px 14px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.02) 0 1px, transparent 1px 14px),
    linear-gradient(160deg, #27496f, #1a3050);
  z-index: 0;
}
.hole {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #0e1c2b, #060d15);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.9), 0 1px 1px rgba(255,255,255,.08);
}
.h1 { top: 18%; left: 8%; }
.h2 { top: 26%; left: 92%; }
.h3 { top: 46%; left: 6%; }
.h4 { top: 58%; right: 7%; }
.h5 { top: 74%; left: 12%; }
.h6 { top: 38%; left: 85%; }
.h7 { top: 8%; right: 20%; }
.h8 { top: 90%; left: 45%; }
.h9 { top: 5%; left: 42%; }
.h10 { top: 66%; left: 28%; }
.h11 { top: 84%; right: 30%; }
.h12 { top: 40%; left: 40%; }

.smudge {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, rgba(255,120,20,.16), rgba(40,25,10,.05) 60%, transparent 70%);
  filter: blur(2px);
  z-index: 0;
}
.sm1 { width: 90px; height: 70px; top: 30%; left: 55%; }
.sm2 { width: 130px; height: 90px; bottom: 14%; left: 60%; }
.sm3 { width: 60px; height: 50px; top: 60%; left: 20%; }
.sm4 { width: 100px; height: 80px; top: 12%; right: 5%; }

.gloves {
  position: absolute;
  bottom: 12px; left: -6px;
  width: 88px; height: 70px;
  background: radial-gradient(circle at 30% 20%, #7a3c1f, #4a2412 70%);
  border-radius: 60% 50% 40% 55% / 70% 80% 40% 60%;
  transform: rotate(-12deg);
  box-shadow: 0 4px 10px rgba(0,0,0,.4), inset 0 -6px 8px rgba(0,0,0,.4);
  z-index: 0;
  opacity: .85;
}
.gloves::before {
  content: "";
  position: absolute; top: -12px; left: 20px;
  width: 46px; height: 20px;
  background: #8a4a26;
  border-radius: 20px 40px 30px 30px;
}
.gloves::after {
  content: "";
  position: absolute; top: -4px; right: -10px;
  width: 20px; height: 16px;
  background: #5a2e15;
  border-radius: 50%;
}
.grip {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(0,0,0,.15) 6px 12px);
  border-radius: inherit;
}

/* ============ MANILA JOB TICKET ============ */
.ticket-top {
  position: relative;
  margin: 0 auto;
  padding: 26px 18px 8px;
  max-width: 480px;
  z-index: 2;
  color: var(--manila);
}
.clip {
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  width: 70px; height: 22px;
  background: linear-gradient(180deg, #c0c0c0, #8a8a8a);
  border-radius: 4px 4px 8px 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,.4);
  z-index: 3;
}
.clip::after {
  content: "";
  position: absolute; top: 2px; left: 8px; right: 8px; height: 3px;
  background: rgba(255,255,255,.4);
  border-radius: 3px;
}
.brand {
  margin: 12px 0 2px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 3px;
  text-align: center;
  color: #f7ecc8;
  text-shadow: 0 2px 0 rgba(0,0,0,.3);
}
.brand span { color: var(--accent); }
.brand-sub {
  margin: 0;
  text-align: center;
  font-size: 10px;
  letter-spacing: 4px;
  color: #cbb98c;
}

.ticket {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  height: calc(100dvh - var(--tabbar-h) - 96px);
  background:
    radial-gradient(circle at 10% 20%, rgba(180,150,80,.2), transparent 20%),
    radial-gradient(circle at 90% 70%, rgba(130,90,40,.18), transparent 25%),
    radial-gradient(circle at 40% 90%, rgba(170,140,90,.15), transparent 18%),
    linear-gradient(180deg, #efe1b4, #e0cf9e 60%, #d6c391);
  border-left: 3px solid #b49a63;
  border-right: 3px solid #b49a63;
  border-bottom: 4px solid #a98f58;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  padding: 18px 16px 90px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.ticket::-webkit-scrollbar { width: 8px; }
.ticket::-webkit-scrollbar-thumb { background: #a98f58; border-radius: 4px; }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============ PANE TITLES ============ */
.pane-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--ink);
  border-bottom: 2px dashed var(--manila-dark);
  padding-bottom: 8px;
  margin: 0 0 14px;
  text-transform: uppercase;
}

/* ============ DASHBOARD COUNTERS (OIL CAPS) ============ */
.caps {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}
.cap {
  flex: 1;
  text-align: center;
}
.cap-cap {
  position: relative;
  width: 78px;
  height: 78px;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #7d8a94, #3a434b 60%, #23292e);
  box-shadow:
    inset 0 3px 6px rgba(255,255,255,.25),
    inset 0 -6px 10px rgba(0,0,0,.5),
    0 5px 9px rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.cap-cap::after {
  content: "";
  position: absolute;
  bottom: 8px; left: 15%;
  width: 70%; height: 8px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(40,25,5,.35), transparent 70%);
  filter: blur(1px);
}
.cap-num {
  font-size: 30px;
  font-weight: 900;
  color: #f5f5f5;
  text-shadow: 0 1px 1px rgba(0,0,0,.5);
  line-height: 1;
}
.cap-label {
  font-size: 9px;
  letter-spacing: .5px;
  color: #d8dde1;
  margin-top: 2px;
  font-weight: 700;
}
.cap-type {
  font-size: 9px;
  color: #2e2e2e;
  letter-spacing: 1px;
  font-weight: 800;
  text-transform: uppercase;
}
.cap-icon {
  font-size: 15px;
  color: var(--secondary);
  display: block;
  margin-top: 3px;
}

/* ============ QUICK ADD ============ */
.quick-add {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, #ff8c2a, var(--accent));
  border: none;
  border-radius: 10px;
  box-shadow: 0 3px 0 #b34d00, inset 0 1px 0 rgba(255,255,255,.4);
  margin-bottom: 16px;
  letter-spacing: .5px;
}
.quick-add:active { transform: translateY(2px); box-shadow: 0 1px 0 #b34d00; }

/* ============ CARDS / TAGS ============ */
.section-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #6b5b36;
  margin: 16px 0 8px;
}

.summary-card, .guide-card {
  background: #f3e6b8;
  border: 1px solid #c9b27f;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.5);
  position: relative;
}
.summary-card { cursor: pointer; }
.summary-card:active { background: #ebdcab; }
.summary-date { font-size: 12px; color: #6b5b36; font-weight: 700; }
.summary-type { font-size: 15px; font-weight: 800; margin-top: 2px; }

/* ============ LOGBOOK PEG TAGS ============ */
.search-wrap { margin-bottom: 12px; }
.search-input {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid #a98f58;
  border-radius: 8px;
  background: #f7ecc8;
  font-size: 15px;
  color: var(--ink);
  outline: none;
}
.search-input:focus { border-color: var(--accent); }

.peg-row {
  position: relative;
  background: transparent;
  margin-bottom: 4px;
  padding-top: 10px;
  cursor: pointer;
}
.peg-string {
  position: absolute;
  top: 0; left: 24px;
  width: 4px; height: 16px;
  background: repeating-linear-gradient(180deg, #3a2f1f 0 5px, #7a6a4a 5px 7px);
  border-radius: 2px;
}
.peg-string::before {
  content: "";
  position: absolute; top: -6px; left: -3px;
  width: 10px; height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #d0d5d8, #6d7579 70%);
  box-shadow: 0 2px 3px rgba(0,0,0,.4);
}
.tag {
  position: relative;
  background: linear-gradient(175deg, #fbf0c8, #ecdcab);
  border: 1px solid #c9b27f;
  border-radius: 4px 10px 4px 4px;
  padding: 10px 40px 10px 12px;
  margin-left: 30px;
  box-shadow: 0 3px 5px rgba(0,0,0,.18);
}
.tag::after {  /* curled paper corner */
  content: "";
  position: absolute;
  top: -1px; right: -1px;
  width: 18px; height: 18px;
  background: linear-gradient(225deg, #dcc98f, #efe1b4 60%);
  border-bottom-left-radius: 50%;
  box-shadow: -2px 2px 3px rgba(0,0,0,.2);
}
.tag-date { font-size: 11px; color: #7a6a4a; font-weight: 700; }
.tag-type { font-size: 15px; font-weight: 800; margin-top: 1px; }
.tag-mile { font-size: 12px; color: #6b5b36; font-weight: 600; margin-top: 1px; }
.tag-stamp { /* hand-stamped look */
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%) rotate(-6deg);
  font-size: 12px;
  font-weight: 800;
  color: rgba(120,40,20,.5);
  border: 1px solid rgba(120,40,20,.45);
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 1px;
}
.fingerprint {
  position: absolute;
  top: -4px; left: -6px;
  width: 20px; height: 26px;
  border-radius: 45%;
  background: radial-gradient(circle, rgba(90,50,20,.5) 30%, transparent 35%);
  opacity: .5;
  transform: rotate(-20deg);
}
.delete-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 26px; height: 26px;
  border: none;
  border-radius: 50%;
  background: #c0392b;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 3px rgba(0,0,0,.3);
}
.delete-btn:active { transform: scale(.95); }
.tag-buttons { margin-top: 8px; display: flex; gap: 8px; }
.tag-buttons button {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.btn-edit { background: var(--primary); color: #fff; }
.btn-delete { background: #c0392b; color: #fff; }

.empty {
  text-align: center;
  padding: 30px 10px;
  color: #6b5b36;
}
.empty-peg {
  width: 14px; height: 14px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #d0d5d8, #6d7579 70%);
  box-shadow: 0 3px 4px rgba(0,0,0,.3);
}
.empty p { margin: 6px 0; font-size: 14px; }

/* ============ ADD SERVICE FORM ============ */
.form-field { margin-bottom: 14px; }
.form-field label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6b5b36;
  margin-bottom: 6px;
}
.form-field input, .form-field textarea {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  color: var(--ink);
  background: #f7ecc8;
  border: 2px solid #a98f58;
  border-radius: 8px;
  outline: none;
  font-family: inherit;
}
.form-field input:focus, .form-field textarea:focus { border-color: var(--accent); }
.form-field input.error, .form-field textarea.error { border-color: #c0392b; }
.field-hint { font-size: 12px; color: #a00; margin-top: 4px; min-height: 14px; }

.rag-save {
  width: 100%;
  padding: 16px;
  font-size: 17px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(180deg, #5a3a1e, #33200f 80%);
  border: none;
  border-radius: 12px 12px 10px 10px;
  box-shadow: 0 4px 0 #1d1006, inset 0 1px 0 rgba(255,255,255,.25);
  margin-top: 6px;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}
.rag-save::before {
  content: "";
  position: absolute;
  top: -8px; left: -10px;
  width: 40px; height: 26px;
  background: rgba(90,60,30,.6);
  border-radius: 40%;
  transform: rotate(15deg);
}
.rag-save:active { transform: translateY(3px); box-shadow: 0 1px 0 #1d1006; }

/* ============ QUICK GUIDE CARDS ============ */
.guide-card { padding: 14px 16px 18px; }
.guide-card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 800; }
.guide-card .interval { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.guide-card .desc { font-size: 13px; color: #6b5b36; }
.guide-status {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 8px;
}
.status-normal { border-left: 5px solid #2e8b57; }
.status-normal .guide-status { color: #2e8b57; }
.status-due { border-left: 5px solid var(--accent); }
.status-due .guide-status { color: #b34d00; }
.status-overdue { border-left: 5px solid #c0392b; }
.status-overdue .guide-status { color: #a0281c; }

.drip {
  position: absolute;
  bottom: -8px;
  width: 12px; height: 14px;
  border-radius: 0 0 60% 60%;
  filter: blur(.5px);
}
.guide-card.status-normal .drip { background: #2e8b57; left: 30%; }
.guide-card.status-due .drip { background: var(--accent); left: 60%; }
.guide-card.status-overdue .drip { background: #c0392b; left: 78%; }

/* ============ TAB BAR (PEG HOOKS + TOOLS) ============ */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 0 6px env(safe-area-inset-bottom);
  display: flex;
  justify-content: space-around;
  background: linear-gradient(180deg, #223f5f, #172b43);
  border-top: 3px solid #0f1f31;
  box-shadow: 0 -3px 8px rgba(0,0,0,.4);
  z-index: 20;
}
.tool {
  position: relative;
  flex: 1;
  background: none;
  border: none;
  color: #9fb3c8;
  cursor: pointer;
  padding-top: 16px;
  outline: none;
  font-family: inherit;
}
.hook {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 26px; height: 20px;
  border: 4px solid #6d7579;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  background: #3a434b;
}
.tool-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  margin: 4px auto 3px;
  border-radius: 12px;
  font-size: 24px;
  color: #7a8896;
  background: linear-gradient(160deg, #5a6673, #39434d);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.5), 0 2px 0 #222;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}
.drop {
  position: absolute;
  top: 30px; left: 50%;
  width: 10px; height: 12px;
  border-radius: 50% 50% 50% 50%;
  background: radial-gradient(circle at 35% 30%, #ffc878, #ff9a1f 70%);
  opacity: 0;
  transform: translateX(-50%);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.4));
}
.label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
  color: #7a8896;
}

.tool.active .tool-icon {
  transform: translateY(-10px);
  background: linear-gradient(160deg, #ffd9a8, #ffb347 45%, #e08b00);
  color: #fff;
  box-shadow:
    0 8px 14px rgba(0,0,0,.5),
    inset 0 2px 3px rgba(255,255,255,.5);
}
.tool.active .drop { opacity: 1; animation: drip 2.2s infinite; }
.tool.active .label { color: #ffd27a; }
.tool.active .hook { border-color: #a8b0b6; }

@keyframes drip {
  0%, 100% { transform: translateX(-50%) translateY(0) scale(1); opacity: .9; }
  50% { transform: translateX(-50%) translateY(2px) scale(.9); opacity: .7; }
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  left: 50%; bottom: calc(var(--tabbar-h) + 14px);
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #f7ecc8;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0,0,0,.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 30;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }