@font-face { font-family: Vazirmatn; font-weight: 400; font-display: swap; src: url(../fonts/vazirmatn-400.woff2) format("woff2"); }
@font-face { font-family: Vazirmatn; font-weight: 500; font-display: swap; src: url(../fonts/vazirmatn-500.woff2) format("woff2"); }
@font-face { font-family: Vazirmatn; font-weight: 700; font-display: swap; src: url(../fonts/vazirmatn-700.woff2) format("woff2"); }

:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --ink: #1a2332;
  --muted: #5a6577;
  --line: #dde2ea;
  --brand: #13294b;
  --brand-ink: #ffffff;
  --brand-soft: #e7edf7;
  --topbar: #13294b;
  --topbar-ink: #ffffff;
  --gold: #b8911a;
  --gold-soft: #fbf4de;
  --ok: #1d7a4b;
  --ok-soft: #e3f4ea;
  --warn: #a15c00;
  --warn-soft: #fdf0dc;
  --bad: #b3261e;
  --bad-soft: #fbe6e4;
  --info: #1c5fa8;
  --info-soft: #e4eefa;
  --focus: #2f6fd6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1520; --surface: #171f2d; --surface-2: #1c2636; --ink: #e8edf5; --muted: #9aa6b8; --line: #2a3547;
    --brand: #8fb3ff; --brand-ink: #0f1520; --brand-soft: #1d2a42; --topbar: #0b1a33; --gold: #e2bd4a; --gold-soft: #2e2716;
    --ok: #5cc98f; --ok-soft: #16301f; --warn: #f0a847; --warn-soft: #33250f; --bad: #ff8a80; --bad-soft: #3a1917;
    --info: #7fb2f0; --info-soft: #172a42; --focus: #8fb3ff; --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.7 Vazirmatn, Tahoma, sans-serif;
}
/* Japanese and English read best in the phone's own fonts (Vazirmatn has no kana or kanji). */
html:lang(ja) body { font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif; line-height: 1.6; }
html:lang(en) body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.55; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
/* A whole table cell or row of a list written left-to-right keeps its own box (only inline text becomes an inline block). */
td.ltr, th.ltr { display: table-cell; }
dd.ltr, div.ltr, p.ltr { display: block; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- frame ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--topbar); color: var(--topbar-ink);
}
.topbar a { color: inherit; }
.brand { font-weight: 700; letter-spacing: .5px; white-space: nowrap; font-size: 1.05rem; direction: ltr; }
.brand small { font-weight: 500; opacity: .75; margin-inline-start: 6px; }
.topbar .search { flex: 1; max-width: 420px; margin-inline-start: auto; }
.topbar .search input {
  width: 100%; border: 0; border-radius: 10px; padding: 8px 12px; font: inherit; font-size: .95rem;
  background: rgba(255, 255, 255, .14); color: inherit;
}
.topbar .search input::placeholder { color: inherit; opacity: .7; }
.bell { position: relative; display: inline-flex; padding: 6px; border-radius: 10px; }
.bell svg { width: 24px; height: 24px; }
.bell .count {
  position: absolute; top: -2px; inset-inline-start: -4px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--bad); color: #fff; font-size: .75rem; line-height: 20px; text-align: center;
}
.user-menu { white-space: nowrap; font-size: .9rem; }
.user-menu form { display: inline; }
.user-menu button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; padding: 0 4px; }

.layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 56px); }
.sidenav { background: var(--surface); border-inline-end: 1px solid var(--line); padding: 16px 10px; }
.sidenav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--ink);
  font-weight: 500; text-decoration: none;
}
.sidenav a:hover { background: var(--surface-2); }
.sidenav a.active { background: var(--brand-soft); color: var(--brand); }
.sidenav .group { margin: 14px 12px 4px; font-size: .78rem; color: var(--muted); font-weight: 700; }
.sidenav .n { margin-inline-start: auto; font-size: .75rem; background: var(--bad); color: #fff; border-radius: 10px; padding: 0 7px; }
main { padding: 20px 24px 48px; min-width: 0; }
.mobile-nav { display: none; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidenav { display: none; }
  .mobile-nav { display: block; position: relative; }
  .mobile-nav > summary { list-style: none; cursor: pointer; padding: 6px 8px; border-radius: 8px; font-size: 1.3rem; line-height: 1; }
  .mobile-nav > summary::-webkit-details-marker { display: none; }
  .mobile-nav[open] > .sidenav {
    display: block; position: fixed; inset: 56px 0 0 0; overflow: auto; border: 0; z-index: 30;
  }
  .topbar .search { display: none; }
  .user-menu .name { display: none; }
  main { padding: 16px 16px 40px; }
}

/* ---------- building blocks ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head .actions { margin-inline-start: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
@media (max-width: 420px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.help { background: var(--info-soft); color: var(--ink); border-radius: 10px; padding: 10px 14px; font-size: .92rem; margin-bottom: 14px; }

.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 18px; }
.stat {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow); color: var(--ink); text-decoration: none; border-inline-start: 5px solid var(--line);
}
a.stat:hover { text-decoration: none; border-color: var(--focus); }
.stat .label { color: var(--muted); font-weight: 500; font-size: .95rem; }
.stat .value { font-size: 2.1rem; font-weight: 700; line-height: 1.2; direction: ltr; text-align: right; }
[dir=ltr] .stat .value { text-align: left; }
.stat .hint { font-size: .85rem; color: var(--muted); }
.stat.bad { border-inline-start-color: var(--bad); } .stat.bad .value { color: var(--bad); }
.stat.warn { border-inline-start-color: var(--warn); } .stat.warn .value { color: var(--warn); }
.stat.ok { border-inline-start-color: var(--ok); }
.stat.gold { border-inline-start-color: var(--gold); }
.stat.info { border-inline-start-color: var(--info); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.12); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: var(--ok); filter: brightness(1.1); }
.btn-danger { color: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-small { min-height: 32px; padding: 4px 10px; font-size: .88rem; }
.btn-big { min-height: 52px; padding: 10px 22px; font-size: 1.05rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.inline-form { display: inline; }

.badge { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .82rem; font-weight: 500; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; max-width: 100%; }
/* A long badge (e.g. a warning sentence) wraps instead of widening the page on a phone. */
@media (max-width: 600px) { .badge { white-space: normal; } }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.gold { background: var(--gold-soft); color: var(--gold); border-color: transparent; }

.flash { border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-weight: 500; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.bad { background: var(--bad-soft); color: var(--bad); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.flash ul { margin: 6px 0 0; padding-inline-start: 22px; font-weight: 400; }

/* ---------- forms ---------- */
.form-grid { display: grid; gap: 14px 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .field .label { font-weight: 500; font-size: .95rem; }
.field .req::after { content: " *"; color: var(--bad); }
.field .hint { font-size: .84rem; color: var(--muted); }
input:not([type]), input[type=text], input[type=url], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=search], input[type=email], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: 2px solid color-mix(in srgb, var(--focus) 25%, transparent); }
input.ltr-input, .ltr-input { direction: ltr; text-align: left; }
.field-error, .field-validation-error { color: var(--bad); font-size: .86rem; font-weight: 500; }
.input-validation-error { border-color: var(--bad) !important; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
/* A long label in a row of actions wraps instead of widening the page on a phone. */
.form-actions .btn { max-width: 100%; white-space: normal; text-align: center; }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 4px; flex: none; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 14px; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; }

/* option cards (choices, destination) */
.options { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.option { position: relative; display: block; border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; background: var(--surface); }
.option:hover { border-color: var(--focus); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option .title { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.option .effect { font-size: .88rem; color: var(--muted); margin-top: 4px; }
.option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { background: var(--surface-2); font-weight: 700; font-size: .88rem; color: var(--muted); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tr.row-bad td { background: var(--bad-soft); }
.table tr.row-warn td { background: var(--warn-soft); }
.table tr.row-muted td { color: var(--muted); }
.table td.num { direction: ltr; text-align: right; white-space: nowrap; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filters .field { min-width: 160px; flex: 1 1 160px; max-width: 260px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pill { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: .92rem; text-decoration: none; }
.pill:hover { text-decoration: none; border-color: var(--focus); }
.pill.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 14px; align-items: center; }

/* ---------- key/value ---------- */
dl.kv { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .92rem; }
dl.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ---------- process timeline ---------- */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { position: relative; padding-block: 0 14px; padding-inline-start: 30px; }
.steps li::before { content: ""; position: absolute; top: 6px; inset-inline-start: 7px; width: 14px; height: 14px; border-radius: 50%; background: var(--line); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.steps li::after { content: ""; position: absolute; top: 22px; bottom: 0; inset-inline-start: 13px; width: 2px; background: var(--line); }
.steps li:last-child::after { display: none; }
.steps li.done::before { background: var(--ok); }
.steps li.active::before { background: var(--info); box-shadow: 0 0 0 4px var(--info-soft); }
.steps li.late::before { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.steps li.skipped { color: var(--muted); }
.steps li.skipped .name { text-decoration: line-through; }
.steps .name { font-weight: 500; }
.steps .meta { font-size: .85rem; color: var(--muted); }

.stage-card { border: 2px solid var(--info); border-radius: var(--radius); padding: 16px; background: var(--surface); margin-bottom: 16px; }
.stage-card.late { border-color: var(--bad); }
.stage-card .top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.stage-card .top h3 { margin: 0; }
.stage-card .top .due { margin-inline-start: auto; }
.evidence { display: grid; gap: 12px; margin: 12px 0; }
.evidence-item { border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.evidence-item .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumb { position: relative; width: 92px; height: 92px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: .8rem; text-align: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb form { position: absolute; top: 2px; inset-inline-end: 2px; }
.thumb button { border: 0; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: .75rem; padding: 2px 6px; }

.notice-list { list-style: none; margin: 0; padding: 0; }
.notice-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.notice-list li.unread { background: var(--info-soft); border-radius: 8px; padding-inline: 10px; }
.notice-list .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 9px; background: var(--info); }
.notice-list .dot.Warning { background: var(--warn); }
.notice-list .dot.Critical { background: var(--bad); }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 420px; }
.login-card .brand { color: var(--brand); font-size: 1.5rem; text-align: center; margin-bottom: 4px; }

.matrix th, .matrix td { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: start; }
.matrix input { width: 20px; height: 20px; }

/* A Persian button in place of the browser's English file box; the real input stays reachable by keyboard. */
.file-pick { position: relative; overflow: hidden; }
.file-pick input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-pick:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

.message-body { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font: inherit; font-size: .95rem; margin: 12px 0 0; }

/* A choice that has no effect under the current settings of another choice. */
.card.inactive { opacity: .72; border-style: dashed; }

.flash.warn { background: var(--warn-soft); color: var(--warn); }

/* Printing a page (e.g. a report): only the content, without the menus and the forms. */
@media print {
  .topbar, .sidenav, .mobile-nav, .noprint { display: none !important; }
  body { background: #fff; }
}

/* Import from Excel: numbered steps, a big file target, choice cards, sample cars. */
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.step-head h2 { margin: 0; }
.step-no { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 2px dashed var(--line); border-radius: var(--radius); padding: 30px 14px; text-align: center; cursor: pointer; background: var(--surface-2); }
.dropzone:hover, .dropzone:focus-within { border-color: var(--focus); }
.dropzone input[type=file] { max-width: 100%; }
.dropzone-title { font-size: 1.15rem; font-weight: 700; }
.import-steps { margin: 14px 0 0; padding-inline-start: 22px; color: var(--muted); }
.choice-cards { display: grid; gap: 10px; }
.choice-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; background: var(--surface); }
.choice-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice-card input { width: 20px; height: 20px; margin-top: 4px; flex: none; }
.choice-card .t { display: block; font-weight: 700; }
.choice-card .h { display: block; font-size: .88rem; color: var(--muted); }
.choice-extra { margin-inline-start: 30px; }
.car-samples { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); }
.car-sample { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); min-width: 0; overflow-wrap: anywhere; }
.car-sample .name { font-weight: 700; }
.stats.compact { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stats.compact .stat { padding: 12px 14px; }
.stats.compact .value { font-size: 1.6rem; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.link-code { font-size: 1.5rem; letter-spacing: .2em; }

/* The customer's page for their car: a narrow phone page with the steps as a line of dots. */
.car-page { max-width: 560px; margin: 20px auto; padding: 0 16px; }
.track { list-style: none; margin: 16px 0; padding: 0; }
.track li { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: var(--muted); position: relative; }
.track li .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); flex: none; }
.track li.done { color: var(--ink); }
.track li.done .dot { background: var(--ok); border-color: var(--ok); }
.track li.now { color: var(--ink); font-weight: 700; }
.track li.now .dot { background: var(--info); border-color: var(--info); box-shadow: 0 0 0 4px var(--info-soft); }
.photo-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }

/* 点検整備記録簿 on the job page: one row per item, its mark beside it; marks other than «good» stand out. */
.record-group { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin-top: 8px; }
.record-group summary { font-weight: 700; cursor: pointer; }
.record-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.record-row:last-child { border-bottom: 0; }
.record-row span { min-width: 0; overflow-wrap: anywhere; font-size: .92rem; }
.record-row select { width: auto; max-width: 46%; flex: none; }
.record-row select.marked { border-color: var(--warn); background: var(--warn-soft); }

/* 入庫予約: the week as day cards (one column on a phone), each booking a small card; today is outlined. */
.week { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-bottom: 16px; }
.week-day { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--surface); min-width: 0; }
.week-day.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.week-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.booking { border-top: 1px solid var(--line); padding: 8px 0; overflow-wrap: anywhere; }
.booking.done { opacity: .6; }
.booking .actions { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }

/* The workshop board: one column per step the customer sees; on a phone the columns stack. */
.board { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); align-items: start; }
.board-col { background: var(--surface-2); border-radius: 12px; padding: 10px; min-width: 0; }
.board-col h2 { font-size: 1rem; margin: 0 0 8px; display: flex; justify-content: space-between; }
.board-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; color: var(--ink); overflow-wrap: anywhere; }
.board-card:hover { text-decoration: none; border-color: var(--focus); }
.board-card.late { border-color: var(--bad); }
.board-card div + div { margin-top: 3px; }
@media (max-width: 640px) { .board-col:not(:has(.board-card)) { padding: 6px 10px; } .board-col:not(:has(.board-card)) h2 { margin: 0; } .board-col:not(:has(.board-card)) p { display: none; } }

/* The language buttons, each language written in itself; at the foot of the menu and on the sign-in page. */
.lang-pick { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 10px 4px; border-top: 1px solid var(--line); margin-top: 10px; }
.lang-pick button { flex: 1 1 auto; min-height: 36px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; cursor: pointer; }
.lang-pick button.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.login-card .lang-pick { justify-content: center; border-top: 0; padding: 14px 0 0; }

/* Setup (راه‌اندازی): a progress line, numbered step cards, the bar shown while working on a step elsewhere. */
.launch-progress { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-bottom: 8px; }
.launch-progress span { display: block; height: 100%; background: var(--ok); border-radius: 999px; transition: width .3s; }
.step-no { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 700; flex: none; }
.launch-step.finished { opacity: .75; }
.launch-step.finished .step-no { background: var(--ok); }
.launch-facts { margin: 0 0 10px; padding-inline-start: 20px; font-size: .92rem; }
.launch-facts li.warn { color: var(--warn); font-weight: 500; }
.launch-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.launch-assign { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.launch-assign select { width: auto; max-width: 200px; }
.launch-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 14px; margin-bottom: 14px;
  border-radius: 10px; background: var(--info-soft); color: var(--ink); font-weight: 500; }
.launch-bar .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.launch-banner { display: block; border-color: var(--gold, var(--warn)); }
.launch-banner:hover { text-decoration: none; border-color: var(--focus); }
.launch-banner.mine { background: var(--info-soft); }
.launch-howto { padding-inline-start: 22px; }
.launch-howto > li { margin-bottom: 18px; }
.launch-howto ul { margin: 6px 0; }
.has-error { border-color: var(--bad); }
.warn-text { color: var(--warn); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media print { .launch-passwords { break-inside: avoid; } }

/* Tasks (the company's Task sheet): a card per task, its priority as a coloured edge, late ones in red. */
.todo { background: var(--surface); border: 1px solid var(--line); border-inline-start: 5px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.todo.p-urgent { border-inline-start-color: var(--bad); }
.todo.p-high { border-inline-start-color: var(--warn); }
.todo.p-normal { border-inline-start-color: var(--info); }
.todo.late { background: var(--bad-soft); }
.todo-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.todo-title { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.todo-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }
.todo-last { margin: 6px 0 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.todo-quick { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.todo-quick select { width: auto; max-width: 60%; }
.todo-states { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.todo-notes { list-style: none; padding: 0; margin: 12px 0 0; }
.todo-notes li { padding: 8px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.todo-group h2 { font-size: 1.05rem; margin: 18px 0 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.todo-new summary { display: inline-block; list-style: none; }
.todo-new summary::-webkit-details-marker { display: none; }
.todo-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--ink); }
.todo-strip:hover { text-decoration: none; border-color: var(--focus); }
.todo-strip.late { border-color: var(--bad); }
.badge.prio-urgent { background: var(--bad); color: #fff; }
.badge.prio-high { background: var(--warn-soft); color: var(--warn); }
.badge.prio-low { color: var(--muted); }
.badge.status-done { background: var(--ok-soft); color: var(--ok); }
.badge.status-waiting { background: var(--info-soft); color: var(--info); }
.badge.status-paused { background: var(--surface-2); color: var(--muted); }
.badge.status-inprogress { background: var(--warn-soft); color: var(--warn); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters select, .filters input { width: auto; flex: 1 1 160px; }

/* The sales board: each sale's steps as a line of dots (done / now / later). */
.mini-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 4px; padding: 0; }
.mini-steps li .dot { display: block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); }
.mini-steps li.done .dot { background: var(--ok); border-color: var(--ok); }
.mini-steps li.now .dot { background: var(--info); border-color: var(--info); box-shadow: 0 0 0 3px var(--info-soft); }
.mini-steps li.skipped .dot { background: var(--surface-2); border-style: dashed; }

/* The time clock on the dashboard and the HR page. */
.clock form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.clock.in { border-color: var(--ok); }

/* Shift week (日報・シフト管理): working, off, not registered. */
.shift-grid td { text-align: center; font-size: .85rem; }
.shift-grid td:first-child { text-align: start; }
.shift-work { background: color-mix(in srgb, var(--ok, #2e7d32) 12%, transparent); }
.shift-off { color: var(--muted, #777); }
.shift-none { background: color-mix(in srgb, var(--warn, #b26a00) 12%, transparent); }

/* 伝言メモ: one message per row */
.call-row { display: grid; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.call-row:last-child { border-bottom: 0; }
.call-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.checklist { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.checklist li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* オークションチェックシート: the paper's box, one line per check */
.bid-box { border: 2px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 12px 0; display: grid; gap: 8px; }
.bid-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bid-row strong { min-width: 7em; }
.bid-row input[type=number] { max-width: 90px; }
.bid-row input:not([type]) { flex: 1 1 160px; min-width: 0; }

/* The links page: one line per site, wrapping on phones */
.link-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.link-list li { overflow-wrap: anywhere; }
details.inline { display: inline-block; margin-inline-start: 6px; }

/* 車検証 QR reader (partial _ShakenQr) */
.qr-box { border: 1px dashed var(--line, #ccc); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; }
.qr-box > summary { cursor: pointer; font-weight: 600; }
.qr-video { display: block; width: 100%; max-width: 480px; border-radius: 8px; margin: 8px 0; background: #000; }
.qr-filled { outline: 2px solid var(--ok, #2e7d32); outline-offset: 1px; }

/* Live position of the tow driver (live-track.js) */
.live-map { display: block; width: 100%; height: 280px; border: 0; border-radius: 8px; margin: 8px 0; }
.live-track.bad { background: var(--bad-soft); color: var(--bad); }
.flash.info { background: var(--info-soft); color: var(--info); }

/* Processes designer (process-designer.js) */
.flow { list-style: none; display: flex; flex-wrap: wrap; gap: 18px 26px; padding: 0; margin: 10px 0 12px; }
.flow-step { position: relative; flex: 0 1 200px; min-width: 150px; border: 1px solid var(--line); border-radius: var(--radius, 10px); padding: 10px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.flow-step:not(:last-child)::after { content: "→"; position: absolute; inset-inline-end: -21px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; }
[dir=rtl] .flow-step:not(:last-child)::after { content: "←"; }
.flow-step.custom { border-color: var(--ok); border-style: dashed; cursor: grab; }
.flow-step.off { opacity: .55; }
.flow-step.dragging { opacity: .4; }
.flow-step.drop-before { box-shadow: inset 4px 0 0 var(--brand); }
[dir=rtl] .flow-step.drop-before { box-shadow: inset -4px 0 0 var(--brand); }
.flow-name { font-weight: 600; overflow-wrap: anywhere; }
.flow-meta { font-size: 12px; color: var(--muted); }
.flow-badges, .flow-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.flow-add { margin: 0 0 10px; }
.flow-add > summary { display: inline-block; list-style: none; }
.flow-details { margin-top: 6px; }
@media (max-width: 600px) {
  .flow { flex-direction: column; gap: 22px; }
  .flow-step { flex-basis: auto; }
  .flow-step:not(:last-child)::after, [dir=rtl] .flow-step:not(:last-child)::after { content: "↓"; inset-inline-end: auto; left: 50%; top: auto; bottom: -21px; transform: translateX(-50%); }
}
