/* Garage Manager's warranties (sir's original warranty program, rebuilt) and the job's Documents row.
   Loaded after styles.css (index.html); only the existing color tokens are used, so light / dark / each person's look follow. */

/* the hidden attribute always wins inside these screens (labels and buttons here are display: flex / inline-flex) */
.wpage [hidden], .wform [hidden], .wsheet [hidden], .wcarbox [hidden], .docrow [hidden], .wclaim [hidden], .wsent[hidden] { display: none !important; }

/* ---------- nav: eight sections ---------- */
/* phones: Warranties takes Settings' place in the bottom bar (Settings is in the name menu) */
@media (max-width: 600px) { nav .links a[href="#/settings"] { display: none; } }
/* wider screens: when the sections don't fit (Russian words, a big text size), app.js adds tight, then words, then icons */
nav.top.tight .links { gap: 2px; } nav.top.tight .links a { padding-left: 6px; padding-right: 6px; }
nav.top.words .links a .ic { display: none; } nav.top.words .links a span:not(.ic) { display: inline; }
nav.top.icons .links a span:not(.ic) { display: none; } nav.top.icons .links a .ic { display: inline-flex; } nav.top.icons .links a { padding: 8px; }
.pmset { margin-top: 10px; } .pmset .btn { width: 100%; }

/* ---------- the list ---------- */
.wpage { max-width: 1280px; margin: 0 auto; }
.wsplit { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 900px) {
  .wsplit { grid-template-columns: minmax(340px, 440px) minmax(0, 1fr); }
  .wside { position: sticky; top: calc(var(--navh, 64px) + 12px); max-height: calc(100vh - var(--navh, 64px) - 24px); overflow: auto; overscroll-behavior: contain; }
}
.whead { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.whead h1 { margin: 0; }
.whead .n { color: var(--muted); font-weight: 600; font-size: 15px; flex: 1; }
.wwel { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.wwel .btn { margin-left: auto; }
.woffline { margin: 0 0 8px; padding: 8px 12px; border-radius: 10px; font-size: 14px; background: color-mix(in srgb, var(--warn) 16%, transparent); }
.wsearch { position: sticky; top: var(--navh, 64px); z-index: 6; padding: 6px 0 8px; background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.wsbox { position: relative; }
.wsbox input { font-size: 18px; min-height: 52px; padding: 12px 48px 12px 44px; border-radius: 14px; }
.wsbox input::-webkit-search-cancel-button { display: none; }
.wsbox .wsi { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: flex; }
.wsbox .wsx { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.wchips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-top: 8px; padding-bottom: 2px; }
.wchips::-webkit-scrollbar { display: none; }
.wchip { flex: none; width: auto; max-width: 70vw; min-height: 40px; padding: 8px 30px 8px 14px; border-radius: 99px; font: 600 14px var(--font); -webkit-appearance: none; appearance: none;
  color: var(--ink); border: 1px solid var(--line); cursor: pointer;
  background: var(--panel2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e98a4' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center; }
.wchip.on { border-color: var(--accent); background-color: color-mix(in srgb, var(--accent) 14%, var(--panel2)); }
.wchip.clear { padding-right: 14px; background-image: none; color: var(--muted); }
.wmeta { margin: 8px 2px 6px; color: var(--muted); font-size: 13px; }
.wlist { display: flex; flex-direction: column; gap: 8px; }
.wfoot { margin: 14px 2px; font-size: 14px; }
.wcard, .wgroup { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; content-visibility: auto; contain-intrinsic-size: auto 96px; }
.wcard { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 12px 8px 12px 14px; cursor: pointer; }
.wcard:hover, .wline:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.wcard.sel, .wgroup.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.wcard:focus-visible, .wline:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wtop { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.wpn { font: 800 18px ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wname { font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.wsku { margin-left: 8px; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.wcar { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.wcar.none { color: var(--muted); font-style: italic; }
.wsub { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.wright { grid-column: 2; grid-row: 1 / span 3; display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 6px; }
.wrc { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); color: var(--ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.wrc:active { transform: scale(.95); }
.wgroup { padding: 4px 0 6px; }
.wgh { display: flex; align-items: center; gap: 10px; padding: 6px 8px 4px 14px; }
.wgh .t { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wgh .c { font-size: 15px; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 500; display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.wline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); cursor: pointer; color: inherit; }
.wline .wl1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wline.dim { opacity: .5; }
.wline.sel { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.card > .wline:first-of-type { border-top: 0; }
.wb { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; border: 1px solid var(--line); color: var(--muted); }
.wb.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 60%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.wb.soon { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 60%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.wb.exp { color: var(--muted); }
.wb.unk { border-style: dashed; }
.wb.rep { color: var(--info); border-color: color-mix(in srgb, var(--info) 55%, transparent); }
.wlist mark, .wdetail mark { background: color-mix(in srgb, var(--warn) 38%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.wempty { text-align: center; padding: 28px 18px; color: var(--ink); }
.wempty .ico { color: var(--accent); }
.wempty h2 { margin: 10px 0 6px; }
.wfail { text-align: center; }
/* loading: a soft shimmer (still when motion is reduced) */
.wsk { height: 92px; border-radius: 14px; margin-bottom: 8px; border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--panel) 0%, var(--panel2) 40%, var(--panel) 80%) 0 0 / 200% 100%; animation: wsk 1.3s ease-in-out infinite; }
@keyframes wsk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .wsk { animation: none; } }

/* the right side (iPad / Mac): overview tiles when nothing is picked */
.wtiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.wtile { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.wtile b { display: block; font-size: 28px; font-variant-numeric: tabular-nums; }
.wtile span { color: var(--muted); font-size: 13px; font-weight: 600; }
.wover h3 { margin-top: 6px; }
.wover .wline { border-top: 1px solid var(--line); padding-left: 0; padding-right: 0; }

/* ---------- one warranty ---------- */
.wdpage { max-width: 720px; }
.wback { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; color: var(--info); margin-bottom: 6px; }
.wdetail .lbl, .wcov .lbl, .wlbl { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.wd-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wd-pnrow { display: flex; align-items: center; gap: 10px; margin: 4px 0 2px; }
.wd-pn { font: 800 34px ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .01em; overflow-wrap: anywhere; line-height: 1.15; }
.wd-cp { width: 44px; height: 44px; flex: none; }
.wd-name { font-size: 19px; font-weight: 600; color: var(--muted); }
.wd-ask { margin-top: 6px; }
.wnames { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.wd-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 6px; }
.wd-acts .btn { min-height: 56px; }
.wd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
@media (max-width: 380px) { .wd-grid, .wd-acts { grid-template-columns: 1fr; } }
.wv { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 28px 10px 12px; min-height: 64px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); font: inherit; cursor: pointer; min-width: 0; }
.wv .k { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.wv .v { font: 700 clamp(16px, 4.5vw, 21px) ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.wv .cp { position: absolute; right: 10px; top: 10px; color: var(--muted); }
.wv:disabled { cursor: default; opacity: .7; }
.wv:not(:disabled):active { transform: scale(.98); }
.wd-ago { margin: 10px 0 0; }
.wd-car, .wd-cov { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.wchipl { display: inline-block; padding: 7px 12px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); font-weight: 600; font-size: 14px; min-height: 36px; }
.wclaimrow { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.wclaimrow:last-child { border-bottom: 0; }
.wnotes-t { white-space: pre-wrap; }
.wd-meta { display: flex; flex-direction: column; gap: 2px; margin: 4px 2px 10px; }
.wd-bottom { margin-bottom: 20px; }

/* ---------- add / edit ---------- */
.wform h2 { margin-bottom: 4px; }
.wfgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.wfgrid .wf-car { grid-column: 1 / -1; }
@media (min-width: 700px) { .wfgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .wfgrid .wf-pn input { font: 700 18px ui-monospace, Menlo, monospace; } }
@media (max-width: 480px) { .wfgrid { grid-template-columns: 1fr; } }
.wcombo { position: relative; display: block; }
.wsugg { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .35); max-height: 300px; overflow: auto; padding: 4px; }
.wsg-h { font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.wsg { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--ink); font: 15px var(--font); padding: 10px; border-radius: 8px; cursor: pointer; min-height: 44px; }
.wsg:hover, .wsg.on { background: var(--panel2); }
.wlinked { font-size: 13px; color: var(--ok); font-weight: 600; }
.wstores { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.wchip-s { border: 1px solid var(--line); background: var(--panel2); color: var(--ink); border-radius: 99px; padding: 5px 10px; font: 600 13px var(--font); cursor: pointer; min-height: 32px; }
.wcov { margin-top: 14px; }
.wcovs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.wcv { border: 1px solid var(--line); background: var(--panel2); color: var(--ink); border-radius: 99px; padding: 8px 13px; font: 600 14px var(--font); cursor: pointer; min-height: 40px; }
.wcv.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.wmonths { max-width: 160px; }
.whint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.hint.okhint { background: color-mix(in srgb, var(--ok) 14%, transparent); margin: 6px 0 8px; }
.wnotes { margin-top: 10px; }
.wfbtns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
@media (max-width: 600px) {
  .wfbtns { flex-direction: column-reverse; align-items: stretch; } .wfbtns .grow { display: none; }
  .wfbtns .btn.primary { order: 9; }
}
.wconf { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; background: var(--panel2); border-radius: 12px; margin: 8px 0; }
.wseg { display: flex; flex-wrap: wrap; width: 100%; margin-top: 6px; }
.wseg label { flex: 1 1 120px; flex-direction: row; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 9px; color: var(--ink); font-size: 15px; }
.wseg label:has(input:checked) { background: var(--panel); }
.wpick { max-height: 50vh; overflow: auto; }
.wtoast { display: flex; align-items: center; gap: 12px; }

/* ---------- the receipt sheet ---------- */
.wsheet-wrap { padding: 0; }
.wsheet { width: min(600px, 100%); max-height: 100vh; overflow: auto; background: #e9ebef; color: #14171c; border-radius: 18px; padding: 10px 16px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wsheet { background: #0b0d10; color: #eef0f3; } }
.wsbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; }
.wsbar .btn { justify-self: start; color: inherit; border-color: transparent; }
.wspaper { width: min(100%, 560px); display: grid; place-items: center; min-height: 200px; }
.wspaper img { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - 190px); background: #fff; border-radius: 6px; box-shadow: 0 10px 34px rgba(0, 0, 0, .28);
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.wsmaking { color: #6b7280; padding: 60px 0; }
.wsfail { background: #fff; color: #111; border-radius: 12px; padding: 16px; width: 100%; }
.wfall { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 20px; margin: 10px 0 0; }
.wfall dt { color: #6b7280; font-size: 15px; align-self: center; } .wfall dd { margin: 0; font: 700 22px ui-monospace, Menlo, monospace; }
.wsacts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.wsacts .btn { min-height: 44px; }
.wsheet .whint { text-align: center; }
@media (max-width: 600px) { .wsheet { width: 100%; min-height: 100%; border-radius: 0; padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(18px, env(safe-area-inset-bottom)); } }
@media print {
  body.wprinting > *:not(.wsheet-wrap) { display: none !important; }
  body.wprinting .wsheet-wrap { position: static; background: none; padding: 0; display: block; }
  body.wprinting .wsheet { background: none; box-shadow: none; padding: 0; width: auto; max-height: none; overflow: visible; }
  body.wprinting .wsheet > *:not(.wspaper) { display: none !important; }
  body.wprinting .wspaper img { width: 5in; height: 7.5in; max-height: none; box-shadow: none; border-radius: 0; }
  @page { size: letter; margin: .5in; }
}

/* ---------- a customer's car: warranties, address ---------- */
.wcarbox:empty { display: none; }
.wcarbox { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.wch { font-size: 13px; font-weight: 700; color: var(--muted); }
.wci { display: flex; align-items: center; gap: 6px; padding: 7px 10px; background: var(--panel2); border-radius: 10px; min-height: 40px; min-width: 0; }
.wci .wpn { font-size: 15px; }
.wmore summary { cursor: pointer; padding: 4px 0; list-style: none; }
.wmore summary::-webkit-details-marker { display: none; }
.wmore .wci { margin-top: 6px; }
.wmaybe { font-size: 13px; color: var(--warn); }
.caddr { margin-top: 4px; font-size: 14px; color: var(--muted); }

/* ---------- Parts: order online ---------- */
.plinks { display: flex; flex-wrap: wrap; gap: 8px; }
.plinks .btn .ico { opacity: .7; }

/* ---------- a job: documents, the original program's banner, save warranty ---------- */
.docrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.docrow .lbl { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.docrow .seg button { padding: 6px 10px; }
.docbtn.internal { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.legacybox { border-color: var(--info); background: color-mix(in srgb, var(--info) 10%, var(--panel)); }
.legacybox > b { display: block; margin-bottom: 2px; }
.wsave { color: var(--ok); }

/* ---------- the original program's records flagged for sir ---------- */
.rvbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.rvbar .btn { margin-left: auto; }
.rvjob { margin-top: 10px; padding-top: 8px; border-top: 1px solid color-mix(in srgb, var(--info) 35%, var(--line)); }
.rvjob ul { margin: 6px 0 8px; padding-left: 18px; }
.rvjob li { margin: 2px 0; }
.rvtag { color: var(--warn); text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; }
.wrv { margin-bottom: 10px; }
.rvlist h2 { margin-bottom: 4px; }
.rvbody { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; max-height: 60vh; overflow: auto; }
.rvitem { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; }
.rvitem.done { opacity: .6; }
.rvwhat { font-weight: 700; overflow-wrap: anywhere; } .rvwhat a { color: var(--info); }
.rvwhy { font-size: 13px; color: var(--warn); margin-top: 2px; }
.rvitem .btn { flex: none; min-height: 40px; }

/* ---------- parts & supplies: our cost and the margin (staff only) ---------- */
.mg { color: var(--muted); }
.mg b { color: var(--ok); font-weight: 700; }
.mg b.neg, b.neg, .v.neg { color: var(--red); }
.mg.miss { color: var(--warn); font-weight: 600; }
table.sums tr.mgrow td { color: var(--ink); border-top: 1px dashed var(--line); padding-top: 8px; }
table.sums tr.mgrow b { color: var(--ok); }
table.sums tr.mgrow b.neg { color: var(--red); }
table.sums tr.mgmiss td { color: var(--warn); font-size: 13px; }
.mgnow { align-self: end; padding-bottom: 12px; font-size: 14px; }
.lineform .mghint { margin-top: 8px; }

/* ---------- Money: income by stream ---------- */
.streams .row h2 { margin: 0; }
.ms-tiles { margin-top: 10px; }
.ms-profit { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.ms-profit .v { color: var(--ok); }
.ms-by { margin: 4px 0 8px; }
.ms-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ms-table { min-width: 720px; }
.ms-table th { text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px; white-space: nowrap; }
.ms-table th.n, .ms-table td.n { text-align: right; white-space: nowrap; }
.ms-table td { padding: 7px 6px; border-top: 1px solid var(--line); }
.ms-table tr.ms-tot td { font-weight: 800; border-top: 2px solid var(--line); }
.qq-line .qq-mg { grid-column: 3 / -1; font-size: 12.5px; margin-top: -6px; }
.ms-table td:first-child { white-space: nowrap; }
@media (max-width: 600px) { .tiles.ms-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- touch screens (phones, iPads): every small control here is at least 44 px (Apple's minimum tap target) ---------- */
/* (a mouse or trackpad keeps the compact sizes: pointer: coarse is a finger) */
@media (pointer: coarse) {
  .wstores .wchip-s { min-height: 44px; padding: 8px 14px; }
  .wcv, .wchip, .wci, .wline, .rvitem .btn { min-height: 44px; }
  #toasts .btn, .wpage .btn.sm, .wcarbox .btn.sm, .duebtns .btn.sm, .rvbar .btn.sm, .docrow .btn.sm, .legacybox .btn.sm, .wsheet .btn { min-height: 44px; }
  .wpage .linkbtn, .wform .linkbtn, .wcarbox .linkbtn, .caddr .linkbtn, .porder .linkbtn, .legacybox .linkbtn, .rvlist .linkbtn, .wclaim .linkbtn {
    display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 8px; vertical-align: middle; }
  .wchipl { display: inline-flex; align-items: center; min-height: 44px; }
  .docrow .seg button { min-height: 44px; min-width: 44px; }
}
