/* WashCore owner portal - light and clean (Ali, 1 Nov). No inline styles anywhere (CSP style-src 'self'). */
:root {
  --red: #c62828; --red-dark: #9f1d1d; --red-soft: #fdecec;
  --ink: #1f2933; --ink-2: #52606d; --ink-3: #8a96a3;
  --line: #e4e7eb; --bg: #f5f6f8; --card: #ffffff;
  --green: #1e8e3e; --green-soft: #e6f4ea; --amber: #b26a00; --amber-soft: #fff4e0; --grey-soft: #eef0f3;
  --radius: 12px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 15px;
       color: var(--ink); background: var(--bg); line-height: 1.45; -webkit-text-size-adjust: 100%; }
a { color: var(--red); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
.hidden { display: none !important; }
.muted { color: var(--ink-3); } .small { font-size: .85rem; } .right { text-align: right; }
.nowrap { white-space: nowrap; }
.noscript { padding: 24px; }

/* splash / spinner */
.splash { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ink-2); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px;
       border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--grey-soft); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); }
.btn.danger { color: var(--red); border-color: #f2c4c4; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: .85rem; }
.btn.link { border: none; background: none; color: var(--red); padding: 4px; min-height: 0; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea, .inline-input {
  min-height: 42px; padding: 8px 12px; border: 1px solid #cfd5dc; border-radius: 10px; background: #fff; width: 100%; }
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .inline-input:focus { outline: 2px solid #f3b4b4; border-color: var(--red); }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0 12px; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 160px; }
.msg { padding: 10px 12px; border-radius: 10px; margin: 8px 0 12px; font-size: .92rem; }
.msg.error { background: var(--red-soft); color: var(--red-dark); }
.msg.ok { background: var(--green-soft); color: var(--green); }
.msg.info { background: var(--grey-soft); color: var(--ink-2); }

/* sign-in */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 28px 24px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 14px; }
.auth-logo img { max-width: 260px; max-height: 110px; }
.auth-name { font-size: 1.35rem; font-weight: 700; text-align: center; }
.auth-card h1 { text-align: center; font-size: 1.25rem; }
.auth-card .sub { text-align: center; color: var(--ink-2); margin-bottom: 18px; }
.auth-card .btn.primary { width: 100%; margin-top: 4px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 14px; font-size: .9rem; }
.qr { display: flex; justify-content: center; margin: 8px 0; }
.qr svg { width: 200px; height: 200px; }
.secret { font-family: ui-monospace, Consolas, monospace; background: var(--grey-soft); padding: 8px; border-radius: 8px;
          word-break: break-all; text-align: center; font-size: .9rem; }
.powered { text-align: center; color: var(--ink-3); font-size: .8rem; margin-top: 18px; }

/* app frame */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-in { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 10px 16px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.brand img { height: 40px; max-width: 160px; object-fit: contain; }
.brand .bname { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-pick { min-height: 38px; border: 1px solid #cfd5dc; border-radius: 10px; padding: 4px 10px; background: #fff; max-width: 210px; }
.user { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--ink-2); }
.user .who { text-align: right; line-height: 1.2; }
.user .who b { color: var(--ink); display: block; }
.nav { background: #fff; border-bottom: 1px solid var(--line); }
.nav-in { max-width: 1200px; margin: 0 auto; display: flex; gap: 4px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
.nav-in::-webkit-scrollbar { display: none; }
.nav a { padding: 12px 12px 10px; text-decoration: none; color: var(--ink-2); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.nav a.on { color: var(--red); border-bottom-color: var(--red); }
.main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: none; background: none; padding: 8px 14px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.seg button.on { background: var(--red); color: #fff; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.cards .card { margin-bottom: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.kpi .v { font-size: 1.35rem; font-weight: 700; }
.kpi .l { font-size: .8rem; color: var(--ink-2); }
.kpi .d { font-size: .8rem; font-weight: 600; }
.up { color: var(--green); } .down { color: var(--red); } .flat { color: var(--ink-3); }
.status-line { display: flex; gap: 14px; flex-wrap: wrap; font-size: .9rem; color: var(--ink-2); margin-top: 8px; }

/* chart */
.chart { width: 100%; height: auto; aspect-ratio: 4 / 1; display: block; }
.chart .bar { fill: var(--red); }
.chart .bar.zero { fill: var(--line); }
.chart .axis { fill: var(--ink-3); font-size: 12px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); font-weight: 700; background: #fafbfc; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.total td { font-weight: 700; background: #fafbfc; }
tr.click { cursor: pointer; } tr.click:hover td { background: #fafbfc; }
.empty { padding: 28px 12px; text-align: center; color: var(--ink-3); }

/* badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red-dark); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.grey { background: var(--grey-soft); color: var(--ink-2); }
.badge.sev { margin-left: 8px; }

/* prices */
.wash-block { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.wash-block h3 { display: flex; justify-content: space-between; align-items: center; }
.price-row { display: grid; grid-template-columns: minmax(120px, 1fr) 110px 90px; gap: 8px; align-items: center; margin-bottom: 8px; }
.price-row .inline-input { min-height: 38px; }
.price-row.head { font-size: .78rem; color: var(--ink-3); font-weight: 700; text-transform: uppercase; margin-bottom: 4px; }
.changed { border-color: var(--amber) !important; background: #fffaf0 !important; }

/* part 3 */
.biz-list { display: flex; flex-direction: column; gap: 8px; }
.btn.biz { justify-content: flex-start; width: 100%; }
.brand .badge { flex: 0 0 auto; }
.biz-pick { max-width: 220px; }
.timeline { list-style: none; padding: 0; margin: 0 0 12px; border-left: 2px solid var(--line); }
.timeline li { padding: 4px 0 8px 12px; }
.timeline .badge { margin-left: 8px; }
h2.gap { margin-top: 18px; }
.plate { font-family: ui-monospace, Consolas, monospace; letter-spacing: .06em; }
.photo img { max-width: 100%; border-radius: 8px; display: block; }
.btn.danger-ok { background: var(--red); }

/* customers */
.plate-list { display: flex; flex-wrap: wrap; gap: 6px; }
.plate-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; background: #fff; }
.plate-chip.blocked { border-color: #f2c4c4; background: var(--red-soft); }
.plate-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); }
.plate-acts { margin-left: auto; display: inline-flex; gap: 6px; }
.field.grow { flex: 3 1 260px; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 32, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 14px; max-width: 520px; width: 100%; padding: 22px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); max-height: 92vh; overflow-y: auto; }
.modal h2 { margin-bottom: 10px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff;
         padding: 10px 18px; border-radius: 10px; z-index: 60; max-width: 92vw; box-shadow: var(--shadow); }
.detail-grid { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: .92rem; margin-bottom: 12px; }
.detail-grid dt { color: var(--ink-2); } .detail-grid dd { margin: 0; }
.site-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; margin-bottom: 12px; }

@media (max-width: 640px) {
  body { font-size: 14px; }
  .topbar-in { flex-wrap: wrap; gap: 8px; }
  .brand img { height: 32px; }
  .user .who { display: none; }
  .site-pick { max-width: none; flex: 1 1 100%; order: 3; }
  .cards { grid-template-columns: 1fr; }
  .main { padding: 14px 12px 40px; }
  .price-row { grid-template-columns: 1fr 90px 70px; }
  .detail-grid { grid-template-columns: 110px 1fr; }
  .biz-pick { max-width: none; flex: 1 1 100%; order: 3; }
}
@media print { .topbar, .nav, .btn { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }

/* 1.3.0: fault photos, fix form, past fixes */
.file-in { display: none; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 12px; }
.thumb { margin: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.thumb img { width: 112px; height: 112px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--grey-soft); }
.photo-big { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto 8px; border-radius: 8px; }
.fix-form { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 4px; }
.parts .part { margin-bottom: 6px; }
.parts .p-no { flex: 0 1 120px; } .parts .p-desc { flex: 3 1 180px; } .parts .p-qty { flex: 0 1 80px; }
.fixes { display: flex; flex-direction: column; gap: 12px; }
.fix { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.fix-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.fix .detail-grid { margin: 0; }
details.past { margin: 8px 0 12px; }
details.past summary { cursor: pointer; font-weight: 600; }
