/* ===========================================================================
   Cmagz RPM — console
   ---------------------------------------------------------------------------
   Themed to his website rather than to ours. He signs into something that
   looks like his business, not like a tool somebody else built, and the red
   means the same thing here as it does there.

   Phone first, genuinely rather than as a slogan: he will open this standing
   next to a car with one hand free. Tap targets are large, the important
   action on each card is the leftmost and widest button, and nothing needs a
   dialog.
   ========================================================================= */

:root {
  --bg:      #121215;
  --panel:   #1b1b20;
  --panel-2: #232329;
  --line:    #2e2e36;
  --text:    #f2f2f4;
  --dim:     #a6a6b0;
  --dimmer:  #74747f;
  --red:     #ff1a2e;
  --red-hot: #ff4053;
  --red-ink: #ff5563;
  --go:      #1fbf6b;
  --warn:    #ffc93c;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* -------------------------------------------------------------------- top */
.top {
  display: flex; align-items: center; gap: 1rem;
  padding: .8rem clamp(14px, 3vw, 24px);
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand {
  font-weight: 800; letter-spacing: -.02em; font-size: 19px;
  text-decoration: none; color: var(--text);
}
.brand span { color: var(--red); }
.top nav { display: flex; gap: .3rem; }
.top nav a {
  color: var(--dim); text-decoration: none; font-size: 15px; font-weight: 600;
  padding: .45rem .8rem; border-radius: 10px;
}
.top nav a:hover { background: var(--panel-2); color: var(--text); }
.top nav a.on { background: var(--panel-2); color: var(--text); }
.badge {
  display: inline-block; margin-left: .45rem; min-width: 20px; padding: 0 .35rem;
  background: var(--red); color: #fff; border-radius: 999px;
  font-size: 12px; font-weight: 800; text-align: center;
}
.spacer { flex: 1; }

/* ------------------------------------------------------------ stale banner */
/* The one thing this architecture has to be loud about. The console can hold
   changes the website does not have, and nothing else would ever tell him. */
.stale {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .85rem clamp(14px, 3vw, 24px);
  background: #3a2c08; border-bottom: 1px solid #5a4410; color: #ffe9b0;
}
.stale strong { color: var(--warn); }
.stale .btn { margin-left: auto; background: var(--warn); color: #241a02; }

.wrap { max-width: 1000px; margin: 0 auto; padding: clamp(18px, 4vw, 32px) clamp(14px, 3vw, 24px) 80px; }

.pagehead h1 { margin: 0 0 .2rem; font-size: clamp(24px, 4vw, 30px); letter-spacing: -.02em; }
.sub { margin: 0 0 1.8rem; color: var(--dim); font-size: 15px; }
.dim { color: var(--dimmer); }

/* ----------------------------------------------------------------- groups */
.group { margin-bottom: 2.4rem; }
.group h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--dimmer); margin: 0 0 .9rem; font-family: var(--mono);
}
.count {
  display: inline-block; margin-left: .4rem; padding: 0 .4rem;
  background: var(--panel-2); border-radius: 6px; color: var(--dim);
}
.empty { color: var(--dimmer); font-size: 15px; margin: 0; }

.grid { display: grid; gap: .9rem; }
@media (min-width: 780px) { .grid { grid-template-columns: 1fr 1fr; } }

/* ---------------------------------------------------------------- reviews */
.rev {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 1rem 1.1rem; min-width: 0;
}
.rev.pending { border-left: 3px solid var(--warn); }
.rev.approved { border-left: 3px solid var(--go); }
.rev.declined { opacity: .6; }

.rev__head { display: flex; align-items: baseline; justify-content: space-between; gap: .8rem; }
.rev__head strong { font-size: 16px; }
.veh { display: block; font-size: 13px; color: var(--dimmer); font-family: var(--mono); }
.stars { color: var(--warn); font-size: 14px; white-space: nowrap; }
.stars .dim { color: #44444e; }

.rev__body {
  margin: .7rem 0 .8rem; color: var(--text); font-size: 15.5px;
  /* Reviews are written by strangers, and a stranger can paste a 40-character
     word. Without this it sets a min-content width the grid column cannot go
     below and the page grows wider than the phone. */
  overflow-wrap: anywhere;
}

.rev__foot {
  display: flex; gap: .9rem; flex-wrap: wrap;
  font-size: 12.5px; color: var(--dimmer); font-family: var(--mono);
  padding-bottom: .8rem; border-bottom: 1px solid var(--line);
}
.contact { overflow-wrap: anywhere; }

.rev__acts { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .85rem; }

/* --------------------------------------------------------------- buttons */
.btn {
  font: inherit; font-size: 14.5px; font-weight: 700;
  padding: .6rem 1rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); cursor: pointer;
  /* 44px is the smallest target a thumb hits reliably. */
  min-height: 44px;
}
.btn:hover { border-color: var(--dimmer); }
.btn.tiny { min-height: 34px; padding: .3rem .7rem; font-size: 13px; }
.btn.go { background: var(--go); border-color: var(--go); color: #05240f; flex: 1 1 auto; }
.btn.go:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: #5a1f25; color: var(--red-ink); }
.btn.danger:hover { background: #2a1114; border-color: var(--red); }
.btn:disabled { opacity: .55; cursor: default; }

/* ----------------------------------------------------------------- flash */
.flash {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: .7rem 1.1rem; border-radius: 12px; font-size: 14.5px; font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  max-width: calc(100vw - 28px);
}
.flash.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.flash.undo { display: flex; align-items: center; gap: .9rem; }

/* ----------------------------------------------------------------- login */
.loginpage { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 2rem; width: min(360px, 100%); display: grid; gap: .7rem;
}
.login .brand { font-size: 24px; margin-bottom: .6rem; }
.login label { font-size: 13px; color: var(--dim); font-family: var(--mono); }
.login input {
  font: inherit; font-size: 16px; padding: .75rem .9rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.login input:focus { outline: none; border-color: var(--red); }
.err { color: var(--red-ink); font-size: 14px; margin: .2rem 0 0; }

:focus-visible { outline: 2px solid var(--red-hot); outline-offset: 2px; }
.noname { color: var(--dimmer); font-weight: 600; font-style: italic; }

/* ================================================================ customers
   Dense on a desktop, one column and fat targets on a phone. He is as likely
   to open this standing in a driveway as sitting down. */

.grouphead { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.grouphead h2 { margin: 0; }
.search { margin-left: auto; display: flex; gap: .4rem; align-items: center; }

input, select, textarea {
  font: inherit; font-size: 16px;   /* 16px stops iOS zooming the page on focus */
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: .6rem .75rem; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); }
input::placeholder, textarea::placeholder { color: #5d5d68; }
.saved { border-color: var(--go) !important; }

.addbar { display: flex; gap: .5rem; flex-wrap: wrap; margin: .9rem 0 1.4rem; }
.addbar input, .addbar select { flex: 1 1 150px; }
.addbar--appt input, .addbar--appt select { flex: 1 1 120px; }

/* ------------------------------------------------------------- coming up */
.sched { list-style: none; margin: 0 0 .5rem; padding: 0; }
.sched li {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  padding: .7rem .9rem; background: var(--panel);
  border: 1px solid var(--line); border-left: 3px solid var(--red);
  border-radius: 12px; margin-bottom: .5rem;
}
.sched__date { font-family: var(--mono); font-size: 13.5px; color: var(--warn); }
.sched__who { font-weight: 700; text-decoration: none; color: var(--text); }
.sched__who:hover { color: var(--red-ink); }
.sched__what { color: var(--dim); font-size: 14px; }
.sched__est { font-family: var(--mono); font-size: 13.5px; color: var(--dim); margin-left: auto; }

/* -------------------------------------------------------- customer cards */
.cust {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 1rem 1.1rem; min-width: 0;
}
.cust__name {
  display: block; font-weight: 700; font-size: 17px; text-decoration: none;
  color: var(--text); overflow-wrap: anywhere;
}
.cust__name:hover { color: var(--red-ink); }
.cust__cars { display: flex; gap: .35rem; flex-wrap: wrap; margin: .5rem 0 .2rem; }
.chip {
  font-family: var(--mono); font-size: 12px; color: var(--dim);
  background: var(--panel-2); border-radius: 6px; padding: .15rem .45rem;
}
.cust__meta { display: flex; gap: 1.4rem; margin: .8rem 0 .9rem; }
.cust__meta dt {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--dimmer);
}
.cust__meta dd { margin: .15rem 0 0; font-size: 14px; }
.cust__meta b { color: var(--go); font-family: var(--mono); font-size: 13px; }

/* ------------------------------------------------------- customer detail */
.back { color: var(--dim); text-decoration: none; font-size: 14px; }
.back:hover { color: var(--text); }
h1.editable { outline: none; border-bottom: 1px dashed transparent; }
h1.editable:focus { border-bottom-color: var(--red); }

.cols { display: grid; gap: 1rem; margin-bottom: 2rem; }
@media (min-width: 820px) { .cols { grid-template-columns: 1fr 1fr; } }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 1.1rem 1.2rem; min-width: 0;
}
.panel h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--dimmer); font-family: var(--mono); margin: 0 0 1rem;
}
.row { display: flex; align-items: center; gap: .8rem; margin-bottom: .6rem; }
.row > span {
  flex: 0 0 120px; font-size: 13px; color: var(--dim); font-family: var(--mono);
}
.row input, .row select, .row textarea { flex: 1 1 auto; }
.row.col { flex-direction: column; align-items: stretch; gap: .35rem; }
.row.col > span { flex: none; }
.rowacts { display: flex; gap: .5rem; margin-top: .9rem; }

.veh__row {
  display: grid; gap: .4rem; padding: .8rem; margin-bottom: .7rem;
  background: var(--panel-2); border-radius: 12px;
}
.veh__label { font-weight: 700; }
.veh__sub { display: flex; gap: .4rem; }
.veh__sub input { flex: 1 1 0; }

/* ------------------------------------------------------------- visits */
.appts { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.appts td { padding: .7rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.appts tr.cancelled { opacity: .45; }
.appts tr.booked .ap__status { color: var(--warn); }
.appts tr.done .ap__status { color: var(--go); }
.ap__date { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.ap__money { font-family: var(--mono); text-align: right; white-space: nowrap; }
.ap__money .est { color: var(--dim); }
.ap__status { font-family: var(--mono); font-size: 12px; text-transform: uppercase; }
.ap__acts { text-align: right; white-space: nowrap; }
.ap__acts .btn { margin-left: .3rem; }

@media (max-width: 720px) {
  /* A five-column table on a phone is unreadable, so each visit becomes a
     block. The date and the money are what he is scanning for, so they stay
     on the same line. */
  .appts, .appts tbody, .appts tr, .appts td { display: block; width: 100%; }
  .appts tr { padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .appts td { border: 0; padding: .1rem 0; }
  .appts td:empty { display: none; }
  .ap__money, .ap__acts { text-align: left; }
  .ap__acts { margin-top: .4rem; }
  .row { flex-direction: column; align-items: stretch; gap: .3rem; }
  .row > span { flex: none; }
}

/* --------------------------------------------------------- danger zone */
.danger-zone { border-top: 1px solid var(--line); padding-top: 1.6rem; }
.danger-zone h2 { color: var(--red-ink); }
.danger-zone .sub { max-width: 60ch; }

/* .btn.go grows to fill its row, which is right on a review card and wrong in
   a list row and inside the car block, where it swallowed the whole width. */
.sched .btn, .sched .btn.go { flex: 0 0 auto; }
.veh__row .btn { justify-self: start; }
.search input { min-width: 220px; }

/* ======================================================= quotes & invoices */
.owed { color: var(--warn); font-family: var(--mono); }
.link { color: var(--red-ink); text-decoration: none; border-bottom: 1px solid #5a1f25; }
.link:hover { border-bottom-color: var(--red); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.note { font-size: 13px; color: var(--dimmer); margin: .6rem 0 0; }
.paidnote { color: var(--go); }

.docs, .lines { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.docs td, .lines td, .lines th { padding: .65rem .5rem; border-bottom: 1px solid var(--line); }
.lines th {
  text-align: left; font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .08em; color: var(--dimmer); font-weight: 400;
}
.docs tr.paid { opacity: .6; }
.doc__num a { color: var(--text); font-family: var(--mono); font-size: 13px; text-decoration: none; }
.doc__num a:hover { color: var(--red-ink); }
.doc__kind { color: var(--dim); font-size: 13px; }
.doc__who { font-weight: 600; }
.doc__date { font-family: var(--mono); font-size: 13px; color: var(--dim); white-space: nowrap; }
.doc__amt { font-family: var(--mono); text-align: right; white-space: nowrap; }
.doc__acts { text-align: right; white-space: nowrap; }
.doc__acts .btn, .doc__acts a.btn { margin-left: .3rem; }

.tag {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; padding: .2rem .5rem; border-radius: 6px;
  background: var(--panel-2); color: var(--dim); white-space: nowrap;
}
.tag.ok { color: var(--go); }
.tag.due { color: var(--warn); }

.lines input { width: 100%; }
.w-qty { width: 80px; } .w-amt { width: 130px; }
input.qty { width: 70px; text-align: right; font-family: var(--mono); }
input.amt { width: 120px; text-align: right; font-family: var(--mono); }
.ln__acts { width: 44px; text-align: right; }

.total { text-align: right; font-size: 15px; color: var(--dim); margin-top: 1rem; }
.total b {
  font-family: var(--mono); font-size: 21px; color: var(--text); margin-left: .8rem;
}

.settings { display: grid; gap: 1rem; max-width: 720px; }
.settings textarea, .settings input { width: 100%; }
.savedmsg { color: var(--go); font-size: 14px; margin-left: .8rem; }

@media (max-width: 720px) {
  /* Same reason as the visits table: six columns do not fit a thumb. */
  .docs, .docs tbody, .docs tr, .docs td { display: block; width: 100%; }
  .docs tr { padding: .7rem 0; border-bottom: 1px solid var(--line); }
  .docs td { border: 0; padding: .1rem 0; }
  .doc__amt, .doc__acts { text-align: left; }
  .doc__acts { margin-top: .4rem; }
  .doc__acts .btn { margin: 0 .3rem 0 0; }
  .lines th { display: none; }
  .lines, .lines tbody, .lines tr, .lines td { display: block; width: 100%; }
  .lines tr { padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .lines td { border: 0; padding: .15rem 0; }
  input.qty, input.amt { width: 100%; text-align: left; }
}
.addbar .btn.go { flex: 0 0 auto; }

/* =================================================================== photos */
.warnmsg { color: var(--warn); }

.drop {
  border: 2px dashed var(--line); border-radius: 16px; padding: 1.6rem;
  text-align: center; margin-bottom: 1.6rem; background: var(--panel);
  transition: border-color .15s ease, background .15s ease;
}
.drop.over { border-color: var(--red); background: #1f1418; }
.drop label { display: block; cursor: pointer; }
.drop strong { display: block; font-size: 17px; margin-bottom: .3rem; }
.drop span { color: var(--dim); font-size: 14px; display: block; max-width: 56ch; margin: 0 auto; }
.drop input[type=file] { display: block; margin: 1rem auto 0; max-width: 100%; }
.drop__bar { height: 6px; background: var(--panel-2); border-radius: 999px;
             margin-top: 1rem; overflow: hidden; }
.drop__bar span { display: block; height: 100%; width: 0; background: var(--go);
                  transition: width .15s ease; }

.pics { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.pic {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; min-width: 0; display: flex; flex-direction: column;
}
/* A green edge on what is live, so the ones already on the site are obvious
   at a glance rather than needing the button read. */
.pic--on { border-color: #1f6b45; }
.pic img { width: 100%; height: 190px; object-fit: cover; background: var(--panel-2); }
.pic__body { padding: .9rem; display: grid; gap: .6rem; }
.pic__field { display: grid; gap: .25rem; }
.pic__field > span { font-size: 12px; color: var(--dim); font-family: var(--mono); }
.pic__field em { color: var(--dimmer); font-style: normal; }
.pic__row { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.pic__row select { flex: 0 0 auto; }
.pic__row .btn { flex: 1 1 auto; }
.pic__row .btn.tiny { flex: 0 0 auto; }

.pwintro { font-size: 14.5px; color: var(--dim); margin: 0 0 .4rem; }
.pwintro strong { color: var(--text); display: block; margin-bottom: .2rem; }
.pwhint { font-size: 12.5px; color: var(--dimmer); margin: .2rem 0 0; }
