/*
 * admin.css — the whole panel's styling.
 *
 * The palette is copied from NikoTheme, the same values nikoapp_customer and the iOS
 * app use, so the tool support staff work in looks like the product they are answering
 * questions about. Copied rather than imported: this is a different origin and a
 * different deploy, and a stylesheet fetched across origins is one more thing that can
 * fail and leave the panel unstyled.
 *
 * One file, no build step, no preprocessor. It is a four-page internal tool.
 */

:root {
  --bg: #090b13;
  --bg-2: #0b0e16;
  --surface: #14171f;
  --surface-2: #1c2029;

  --hairline: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);

  --text: #eceef4;
  --muted: #99a1b0;
  --muted-2: #868da2;

  --accent: #41d5ec;
  --accent-soft: rgba(65, 213, 236, .12);
  --accent-stroke: rgba(65, 213, 236, .35);
  --on-accent: #06202a;

  --ok: #46d07e;
  --attention: #e8a33d;
  --danger: #ff6b6b;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 6px 20px -6px rgba(0, 0, 0, .55);
  --shadow-pop: 0 24px 60px -12px rgba(0, 0, 0, .7);
  --ok-soft: rgba(70, 208, 126, .12);
  --attention-soft: rgba(232, 163, 61, .13);
  --danger-soft: rgba(255, 107, 107, .11);
  --danger-stroke: rgba(255, 107, 107, .34);

  --r-card: 14px;
  --r-button: 10px;
  --r-pill: 999px;

  --sidebar-w: 216px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Focus is never removed, only restyled. A keyboard user in a support queue needs to
   see where they are more than a mouse user needs the outline gone. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── layout ─────────────────────────────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
}

.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--hairline);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand {
  font-weight: 650;
  letter-spacing: -.01em;
  padding: 0 10px 18px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar nav a {
  color: var(--muted);
  padding: 9px 10px;
  border-radius: var(--r-button);
  font-weight: 500;
  text-decoration: none;
}

.sidebar nav a:hover { background: var(--surface); color: var(--text); }

.sidebar nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-stroke);
}

.sidebar .spacer { flex: 1; }

.who {
  border-top: 1px solid var(--hairline);
  padding-top: 14px;
  font-size: 13px;
  color: var(--muted-2);
}

.who strong { display: block; color: var(--text); font-weight: 550; }

/* The connection lamp. The single most important pixel on the page: it is the
   difference between "nobody has written in" and "you stopped receiving messages an
   hour ago". Both look like an empty inbox otherwise. */
.live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted-2);
  margin-top: 10px;
}

.live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
  flex: none;
}

.live[data-state="live"]::before { background: var(--ok); }
.live[data-state="connecting"]::before { background: var(--attention); }
.live[data-state="down"]::before { background: var(--danger); }

.main {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  border-bottom: 1px solid var(--hairline);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
}

.topbar h1 { font-size: 18px; font-weight: 620; margin: 0; letter-spacing: -.01em; }
.topbar .grow { flex: 1; }

.content { overflow: auto; padding: 22px 24px; }

/* ── controls ───────────────────────────────────────────────────────────────────── */

input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
  background: var(--bg-2);
  transition: border-color .12s, box-shadow .12s;
  border: 1px solid var(--hairline);
  border-radius: var(--r-button);
  color: var(--text);
  font: inherit;
  padding: 9px 11px;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-stroke);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
textarea { resize: vertical; min-height: 76px; }
::placeholder { color: var(--muted-2); }

.button {
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: var(--r-button);
  font: inherit;
  font-weight: 600;
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
}

.button:hover { filter: brightness(1.08); }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .5; cursor: not-allowed; filter: none; transform: none; }
.button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.button.small { padding: 6px 12px; font-size: 13px; }

/* Destructive. Outlined rather than filled: it must read as dangerous without competing
   with the primary action for attention on a card that has both. */
.button.danger {
  background: var(--danger-soft);
  color: #ffc2c2;
  box-shadow: inset 0 0 0 1px var(--danger-stroke);
}
.button.danger:hover { background: rgba(255, 107, 107, .18); filter: none; }

.button.ghost {
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.button.ghost:hover { background: var(--surface); }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters input[type="search"] { max-width: 300px; }
.filters select { width: auto; }

/* ── inbox ──────────────────────────────────────────────────────────────────────── */

.inbox {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  height: 100%;
  overflow: hidden;
}

.threads {
  border-right: 1px solid var(--hairline);
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.thread-row {
  border: 0;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 13px 16px;
  cursor: pointer;
  display: grid;
  gap: 4px;
}

.thread-row:hover { background: var(--surface); }
.thread-row[aria-selected="true"] { background: var(--surface-2); }

.thread-row .line { display: flex; align-items: baseline; gap: 8px; }
.thread-row .name { font-weight: 570; flex: 1; min-width: 0; }
.thread-row .when { color: var(--muted-2); font-size: 12px; flex: none; }
.thread-row .preview {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  flex: none;
}

.tag {
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  box-shadow: inset 0 0 0 1px var(--hairline);
  color: var(--muted);
  flex: none;
}

.tag.feedback { color: var(--attention); box-shadow: inset 0 0 0 1px rgba(232, 163, 61, .35); }
.tag.closed { color: var(--muted-2); }
.tag.waiting { color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-stroke); }

.conversation { display: flex; flex-direction: column; overflow: hidden; }

.conversation-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.conversation-head h2 { font-size: 15px; margin: 0; font-weight: 600; }
.conversation-head .who-line { font-size: 13px; color: var(--muted); }

.messages {
  flex: 1;
  overflow: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: min(620px, 78%);
  padding: 10px 13px;
  border-radius: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble.owner {
  background: var(--surface);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.bubble.support {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-stroke);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* An optimistic reply, not yet acknowledged by the server. Dimmed rather than hidden:
   the person who typed it should see it went somewhere, and see when it lands. */
.bubble.pending { opacity: .55; }

.bubble .meta {
  display: block;
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 5px;
}

.composer {
  border-top: 1px solid var(--hairline);
  padding: 12px 20px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex: none;
}

.composer textarea { min-height: 44px; max-height: 200px; }
.composer .hint { font-size: 12px; color: var(--muted-2); padding-bottom: 11px; }

/* ── tables ─────────────────────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th {
  text-align: left;
  font-weight: 560;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--hairline);
}

td { padding: 12px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface); }
tbody tr:last-child td { border-bottom: 0; }
td.mono { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }

/* ── cards, states ──────────────────────────────────────────────────────────────── */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.tile {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 14px 16px;
  box-shadow: var(--shadow-1);
}

.tile .n { font-size: 26px; font-weight: 640; letter-spacing: -.02em; }
.tile .k { color: var(--muted); font-size: 13px; margin-top: 2px; }

.empty { color: var(--muted); padding: 40px 20px; text-align: center; }

.notice {
  border-radius: var(--r-button);
  padding: 10px 13px;
  font-size: 14px;
  margin-bottom: 14px;
}

.notice.error {
  background: rgba(255, 107, 107, .1);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 107, .35);
  color: #ffc2c2;
}

.notice[hidden] { display: none; }

/* ── sign in ────────────────────────────────────────────────────────────────────── */

.signin {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.signin form {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 26px;
  display: grid;
  gap: 13px;
}

.signin h1 { font-size: 19px; margin: 0 0 4px; font-weight: 620; }
.signin label { font-size: 13px; color: var(--muted); display: grid; gap: 5px; }

/* ── phones and narrow windows ───────────────────────────────────────────────────────
 *
 * This used to be three lines, and one of them was `.sidebar { display: none }`. That
 * did not adapt the navigation to a small screen — it deleted it, along with the sign-out
 * link and the connection lamp. On a phone the panel became one page with no way off it.
 *
 * So the sidebar becomes a horizontal bar instead of disappearing, and the two-pane inbox
 * becomes one pane at a time rather than two half-height ones stacked.
 */
@media (max-width: 880px) {
  .app {
    grid-template-columns: 1fr;
    /* rows, not columns: the nav is a strip above the content, and `auto 1fr` is what
       stops it stealing height from the page below it. */
    grid-template-rows: auto 1fr;
    height: 100dvh;   /* dvh, not vh: vh is the tall viewport and hides content behind
                         mobile Safari's toolbar, which is where the composer sits. */
  }

  .sidebar {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--hairline);
    padding: 10px 12px;
    overflow-x: auto;
    scrollbar-width: none;
    position: sticky;
    top: 0;
    z-index: 20;
  }
  .sidebar::-webkit-scrollbar { display: none; }

  /* The wordmark is the first thing to go: on a 390px screen the four destinations are
     worth more than the name of the tool somebody has already signed in to. */
  .brand { display: none; }
  .sidebar .spacer { display: none; }

  .sidebar nav { flex-direction: row; gap: 6px; }
  .sidebar nav a { white-space: nowrap; padding: 8px 12px; }

  /* Identity collapses to what is still worth knowing on a phone: whether the socket is
     live, and the way out. */
  .who {
    border-top: 0;
    padding-top: 0;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
  }
  .who strong, .who > span { display: none; }
  .who .live { margin-top: 0; }
  .who p { margin: 0 !important; }

  /* The heading and its filters stop competing for one row. */
  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
  }
  .topbar h1 { width: 100%; }
  .filters { width: 100%; }
  .filters input[type="search"] { max-width: none; flex: 1 1 100%; }
  .filters select { flex: 1 1 auto; }

  .content { padding: 14px; }

  /* One pane at a time. `.viewing` is set by inbox.js when a conversation is open; the
     list is the default, because arriving at a phone screen with a conversation already
     chosen for you is disorienting. */
  .inbox { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .inbox .threads { border-right: 0; }
  .inbox .conversation { display: none; }
  .inbox.viewing .threads { display: none; }
  .inbox.viewing .conversation { display: flex; }

  /* Touch targets. 8px of padding is a comfortable mouse target and a frustrating thumb. */
  .button { padding: 11px 18px; }
  .button.small { padding: 9px 14px; }
  .thread-row { padding: 14px 16px; }

  /* A table cannot reflow, so it scrolls inside its own card rather than pushing the
     whole page sideways. */
  .card { overflow-x: auto; }
  table { min-width: 520px; }
}

/* The back control only exists on a screen that shows one pane at a time. */
.back-to-list { display: none; }
@media (max-width: 880px) {
  .back-to-list {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    background: none;
    border: 0;
    color: var(--accent);
    font: inherit;
    padding: 4px 0;
    cursor: pointer;
  }
}

/* iOS zooms the page in when a focused input's text is under 16px, and then leaves it
   zoomed. Every input on this panel inherits 15px, so every input was a zoom trap. */
@media (max-width: 880px) {
  input[type="text"], input[type="email"], input[type="password"],
  input[type="search"], select, textarea { font-size: 16px; }
}

/* ── the customer record ─────────────────────────────────────────────────────────────
 *
 * Everything below is the surface for acting on an account, and it is built around one
 * idea: an action is never a bare button. It is a row with a name, a sentence saying
 * what it will do, and the current state it acts on — because the person clicking is on
 * the phone to somebody and has one chance to read it.
 */

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-1);
  margin-bottom: 16px;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent);
}

.card-head h2 {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.card-head .grow { flex: 1; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }

/* The person, at the top of their own record. */
.identity { display: flex; align-items: center; gap: 14px; padding: 18px; }

.avatar {
  width: 46px; height: 46px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-stroke);
  color: var(--accent);
  display: grid; place-items: center;
  font-size: 17px; font-weight: 640;
  flex: none;
}

.identity .name { font-size: 19px; font-weight: 640; letter-spacing: -.015em; }
.identity .sub { color: var(--muted); font-size: 13.5px; margin-top: 1px; }

/* A labelled fact. Used wherever the panel states something rather than offers it. */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* One action: what it is, what it does, and the control. */
.action {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
}

.action:last-child { border-bottom: 0; }
.action .text { flex: 1; min-width: 0; }
.action .title { font-weight: 560; font-size: 14.5px; }
.action .why { color: var(--muted); font-size: 13px; margin-top: 2px; line-height: 1.45; }

/* Actions that cannot be undone live together, below everything else, behind a heading
   that says so. Grouping them is the warning; a red button on its own is not. */
.danger-zone { border-color: var(--danger-stroke); }
.danger-zone .card-head { background: var(--danger-soft); }
.danger-zone .card-head h2 { color: #ffc2c2; }

/* Status. A pill states a fact; it is never a control. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 560;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.pill.on   { background: var(--ok-soft);        color: #9fe6bd; box-shadow: inset 0 0 0 1px rgba(70, 208, 126, .3); }
.pill.off  { background: var(--surface-2);      color: var(--muted-2); }
.pill.warn { background: var(--attention-soft); color: #f0c88a; box-shadow: inset 0 0 0 1px rgba(232, 163, 61, .3); }
.pill.bad  { background: var(--danger-soft);    color: #ffc2c2; box-shadow: inset 0 0 0 1px var(--danger-stroke); }

/* A form inside a card. */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; color: var(--muted); font-size: 12.5px; margin-bottom: 5px; }
.field .help { color: var(--muted-2); font-size: 12.5px; margin-top: 5px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* A preference: a checkbox that is a row, so the whole row is the hit area. */
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  cursor: pointer;
  font-size: 14px;
}
.toggle input { width: auto; margin: 0; accent-color: var(--accent); }

/* ── confirming ──────────────────────────────────────────────────────────────────────
 *
 * Every irreversible action goes through this, and it is not window.confirm(): that
 * cannot say which customer, cannot name what is about to be destroyed, and is dismissed
 * by the same reflex that produced the click.
 */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, .7);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 50;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pop);
  width: min(460px, 100%);
  padding: 22px;
}

.modal h3 { margin: 0 0 8px; font-size: 17px; font-weight: 620; letter-spacing: -.01em; }
.modal p { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; }

/* ── saying it worked ────────────────────────────────────────────────────────────────
 *
 * An action with no visible result is one somebody does twice.
 */

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-button);
  box-shadow: var(--shadow-pop);
  padding: 11px 18px;
  font-size: 14px;
  z-index: 60;
  animation: toast-in .16s ease-out;
}

.toast.ok  { box-shadow: var(--shadow-pop), inset 0 0 0 1px rgba(70, 208, 126, .4); }
.toast.bad { box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--danger-stroke); color: #ffc2c2; }

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .button:active { transform: none; }
}

/* Narrow windows: support staff work in a half-width window beside a phone system. */
@media (max-width: 720px) {
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 10px; }
  .action { flex-direction: column; align-items: stretch; gap: 10px; }
}

/* A customer record is a column of forms and sentences, and a form field stretched across
   a 2000px monitor is hard to read and harder to scan. The list below it is a table and
   genuinely wants the width, so the cap is on the record only. */
#detail { max-width: 900px; }

/* A table that is the whole body of a card needs its header to sit inside the card rather
   than against its top edge. */
.card > table th, .card-body.flush > table th { padding-top: 12px; }

/* At 375px the nav strip overflowed by 53px and pushed "Sign out" off the right edge —
   reachable only by scrolling a bar that gives no sign it scrolls. Three small savings
   bring it back inside: tighter links, smaller type, and the lamp reduced to its dot.
   The dot is the part that carries the meaning; "Live" is a caption for it, and its
   colour still says the same thing. The word returns above 560px. */
@media (max-width: 560px) {
  .sidebar nav a { padding: 8px 10px; font-size: 14px; }
  .sidebar .who .live {
    gap: 0;
    font-size: 0;          /* hides the caption, keeps the ::before dot */
    line-height: 0;
  }
  .sidebar .who .live::before { width: 9px; height: 9px; }
  .sidebar .who { gap: 10px; }
  .sidebar .who p a { font-size: 14px; }
}

/* A generic spacer. `.topbar .grow` predates this and does the same thing; this is the
   same idea anywhere else it is needed. */
.grow { flex: 1; }

@media (max-width: 560px) {
  /* The name and the "All customers" button were fighting over one row, and the name
     lost — wrapping to two lines behind the button. Giving the spacer a full-basis
     forces the button onto its own line, where it can be a comfortable thumb target. */
  .identity { flex-wrap: wrap; }
  .identity .grow { flex-basis: 100%; height: 0; }
  .identity > .button, .identity > a.button { width: 100%; text-align: center; }
  .identity .name { font-size: 17px; }

  /* 150px missed a second column by nine pixels at 375px, so every tile got its own row
     and the header became a column of four boxes. */
  .tiles { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }

  /* Action controls become full-width rather than a small button squeezed to one side. */
  .action > .button, .action > div > .button { width: 100%; }
}

/* The filters belong to the list, and are hidden while a single record is open. */
.filters[hidden] { display: none; }

/* A VIN is 17 characters of unbroken monospace and the one string on this page that
   cannot be allowed to push the layout sideways on a narrow screen. */
.mono-vin {
  font-family: var(--mono);
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* A car is a form, not a one-line action, so it gets room to breathe rather than the
   tight vertical rhythm of the rows above it. */
.action.vehicle { padding-top: 16px; padding-bottom: 16px; }

@media (max-width: 560px) {
  /* Every button that submits a card is full width, so the record reads as one column
     of controls rather than a mix of full-width and thumbnail-sized ones. */
  .card-body .button[type="submit"], .card-body > .button { width: 100%; }

  /* 40px of padding above and below is a generous void on a 375px screen. */
  .empty { padding: 26px 16px; }

  /* Name and registration stack, and the gap between them was doing double duty as the
     gap between every other pair of fields. */
  .action .grid-2 { gap: 12px; }
}

@media (max-width: 560px) {
  /* "All customers" is a way back, not the point of the screen. Full width gave it more
     visual weight than the name of the customer above it. */
  .identity > .button, .identity > a.button {
    width: auto;
    align-self: flex-start;
    padding: 8px 14px;
    font-size: 14px;
  }
}
