/* OurHQ — interface styles
   Palette taken from the logo: ink #101828, violet #7C6BFF. */

:root {
  --ink-900: #080b11;
  --ink-800: #0b0f17;
  --ink-700: #101828;
  --surface: #141a24;
  --surface-2: #0e141c;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);

  --text: #e9ecf1;
  --text-muted: #93a0b4;
  --text-dim: #6b7789;

  --violet: #7c6bff;
  --violet-hi: #9184ff;
  --violet-dim: rgba(124, 107, 255, 0.16);

  --green: #34d399;
  --amber: #f5a524;
  --red: #ff6b5a;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ink-800);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { margin: 0; font-weight: 620; letter-spacing: -0.015em; }

/* ---------------------------------------------------------------- layouts */

.page-auth {
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  background:
    radial-gradient(900px 520px at 50% -10%, rgba(124, 107, 255, 0.18), transparent 70%),
    radial-gradient(600px 400px at 90% 100%, rgba(124, 107, 255, 0.07), transparent 70%),
    var(--ink-800);
}

.auth-shell { width: 100%; max-width: 400px; }

.shell {
  max-width: 940px;
  margin: 0 auto;
  padding: 2.25rem 1.25rem 4rem;
}
.shell-narrow { max-width: 660px; }

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow);
}
.card-wide { padding: 1.75rem; box-shadow: none; margin-bottom: 1.25rem; }
.card-highlight { border-color: rgba(124, 107, 255, 0.45); background: #171d2b; }
.card-title { font-size: 1.25rem; margin-bottom: 1rem; }

/* ------------------------------------------------------------------ brand */

.brand { text-align: center; margin-bottom: 1.75rem; }
.brand-mark {
  display: block;
  margin: 0 auto 0.9rem;
  border-radius: 14px;
}
.brand-name { font-size: 1.5rem; letter-spacing: -0.02em; }
.brand-sub { margin: 0.3rem 0 0; color: var(--text-muted); font-size: 0.9rem; }

/* ----------------------------------------------------------------- fields */

.field { margin-bottom: 1.05rem; }

.field label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 0.72rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: var(--text-dim); }

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-dim);
}

.input-code {
  font-size: 1.5rem;
  letter-spacing: 0.4em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding-left: 0.4em;
}

.input-group { position: relative; display: flex; }
.input-group input { padding-right: 4.2rem; }

.reveal {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 550;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}
.reveal:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

/* --------------------------------------------------------------- checkbox */

/* A heading over a group of checkboxes.
 *
 * Looks exactly like a .field label, but is not inside a .field -- because
 * `.field label { display: block }` outranks `.checkbox { display: flex }` and
 * silently collapses any checkbox nested in one, dropping the box on top of
 * its own text. Use this instead of wrapping the group in a .field. */
.group-label {
  display: block;
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0.35rem 0 1.4rem;
  cursor: pointer;
  user-select: none;
}
.checkbox input { position: absolute; opacity: 0; width: 0; height: 0; }

.checkbox-box {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-2);
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.checkbox input:checked + .checkbox-box {
  background: var(--violet);
  border-color: var(--violet);
}
.checkbox input:checked + .checkbox-box::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(43deg);
}
.checkbox input:focus-visible + .checkbox-box {
  box-shadow: 0 0 0 3px var(--violet-dim);
}
.checkbox-text { font-size: 0.88rem; line-height: 1.35; }
.checkbox-text small {
  display: block;
  color: var(--text-dim);
  font-size: 0.78rem;
  margin-top: 1px;
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-block;
  padding: 0.72rem 1.15rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 570;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--violet-dim); }

.btn-primary { background: var(--violet); color: #fff; }
.btn-primary:hover { background: var(--violet-hi); }

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.05); }

.btn-danger { background: transparent; border-color: rgba(255, 107, 90, 0.5); color: var(--red); }
.btn-danger:hover { background: rgba(255, 107, 90, 0.1); }

.btn-block { display: block; width: 100%; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.83rem; }

.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--violet-hi);
  font: inherit;
  cursor: pointer;
}
.linkish:hover { text-decoration: underline; }

.inline-form { display: inline; }

/* ---------------------------------------------------------------- alerts */

.alert {
  margin: 0 0 1.15rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  border: 1px solid;
  line-height: 1.45;
}
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-error   { background: rgba(255, 107, 90, 0.1);  border-color: rgba(255, 107, 90, 0.35);  color: #ffb3a8; }
.alert-info    { background: rgba(124, 107, 255, 0.1); border-color: rgba(124, 107, 255, 0.35); color: #c3bbff; }
.alert-success { background: rgba(52, 211, 153, 0.1);  border-color: rgba(52, 211, 153, 0.32);  color: #8ee9c4; }
.alert-warn    { background: rgba(245, 165, 36, 0.1);  border-color: rgba(245, 165, 36, 0.32);  color: #f3c77a; }

.foot-note {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.78rem;
  margin: 1.5rem 0 0;
}

.card-links {
  margin-top: 1.35rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
  text-align: center;
}

/* ---------------------------------------------------------------- topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 15, 23, 0.9);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 620;
  letter-spacing: -0.01em;
}
.topbar-brand:hover { text-decoration: none; }
.topbar-brand img { border-radius: 8px; }

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  font-size: 0.88rem;
}
.topbar-nav a { color: var(--text-muted); }
.topbar-nav a:hover { color: var(--text); text-decoration: none; }
.topbar-nav a.is-current { color: var(--text); }
.topbar-user { color: var(--text-dim); font-size: 0.83rem; }

/* ------------------------------------------------------------- page bits */

.page-head { margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.5rem; }
.muted { color: var(--text-muted); font-size: 0.88rem; margin: 0.35rem 0 0; }

.tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}
.tabs a {
  padding: 0.6rem 0.9rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 0.9rem;
  font-weight: 540;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.is-active { color: var(--text); border-bottom-color: var(--violet); }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.tool-card {
  display: block;
  padding: 1.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
}
.tool-card:hover { border-color: var(--violet); text-decoration: none; }
.tool-card h2 { font-size: 1.02rem; }
.tool-card p { margin: 0.35rem 0 0; color: var(--text-muted); font-size: 0.86rem; }
.tool-card.is-disabled { opacity: 0.55; }
.tool-card.is-disabled:hover { border-color: var(--line); }

.pill {
  display: inline-block;
  margin-top: 0.8rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* ------------------------------------------------------------ two-factor */

.status-on  { color: var(--green); font-weight: 550; margin: 0.5rem 0 0; }
.status-off { color: var(--text-dim); font-weight: 550; margin: 0.5rem 0 0; }

.steps { margin: 1.25rem 0 0; padding-left: 1.35rem; }
.steps > li { margin-bottom: 1.75rem; }
.steps h3 { font-size: 0.98rem; margin-bottom: 0.3rem; }

.qr {
  width: 188px;
  height: 188px;
  margin: 1rem 0;
  padding: 10px;
  background: #fff;
  border-radius: 10px;
}
.qr img, .qr canvas { display: block; width: 100%; height: 100%; }

.secret-key code {
  display: inline-block;
  padding: 0.55rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  word-break: break-all;
}

/* A command meant to be copied -- the cron line for the weekly digest. Long,
   unbreakable, and useless if any of it is cut off, so it wraps mid-token
   rather than scrolling. */
.cmd {
  display: block;
  margin: 0.6rem 0;
  padding: 0.7rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-muted);
  overflow-wrap: anywhere;
  word-break: break-word;
  user-select: all;              /* one tap selects the whole command */
}

.code-list {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
}
.code-list li {
  padding: 0.5rem 0.6rem;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  text-align: center;
}

.stack { display: grid; gap: 1.25rem; margin-top: 1.5rem; }
.subform {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.subform h3 { font-size: 0.95rem; }
.subform.is-danger { border-color: rgba(255, 107, 90, 0.28); }

.install-log { margin: 0 0 1.25rem; padding-left: 1.2rem; font-size: 0.88rem; line-height: 1.7; }
.install-log .is-ok   { color: var(--text-muted); }
.install-log .is-warn { color: var(--amber); }
.install-log .is-bad  { color: var(--red); }

@media (max-width: 560px) {
  .card { padding: 1.75rem 1.25rem; }
  .topbar-user { display: none; }
  .topbar-nav { gap: 0.8rem; }
}

/* ============================================================ invoices ==== */

.shell-wide { max-width: 1180px; }

.row-between { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.row-gap { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.25rem; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }
.small { font-size: 0.8rem; }
.crumb { margin: 0 0 0.75rem; font-size: 0.85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.amount-pending { color: var(--amber); }
.amount-ok { color: var(--green); }

/* two-column browse */
.split { display: grid; grid-template-columns: 232px 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }

.side-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em;
              color: var(--text-dim); margin-bottom: 0.6rem; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list a {
  display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline;
  padding: 0.45rem 0.6rem; border-radius: 8px; color: var(--text-muted); font-size: 0.87rem;
}
.side-list a:hover { background: rgba(255,255,255,0.05); color: var(--text); text-decoration: none; }
.side-list a.is-current { background: var(--violet-dim); color: var(--text); }
.side-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-count { flex: 0 0 auto; font-size: 0.74rem; color: var(--text-dim); }

.filters { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.filters input[type="search"] {
  flex: 1; min-width: 180px; padding: 0.55rem 0.75rem;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); color: var(--text); font: inherit;
}
.filters input[type="search"]:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-dim); }
.filters select {
  padding: 0.55rem 0.6rem; background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); color: var(--text); font: inherit;
}

/* tables */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; background: var(--surface); }
table.data th {
  text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-dim); font-weight: 600; padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 0.7rem 0.85rem; border-bottom: 1px solid rgba(255,255,255,0.05); vertical-align: top; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: rgba(255,255,255,0.025); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted-cell { color: var(--text-dim); font-size: 0.82rem; }

table.lines { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
/* The delivery breakdown has no thead, so it would otherwise shrink to its
   content and sit oddly narrow next to the full-width items table above it. */
table.lines-full { width: 100%; }
table.lines-full td { padding: 0.5rem 0.85rem; }
table.lines tfoot td { padding: 0.5rem 0.85rem; color: var(--text-muted); border-bottom: 0; }
table.lines tfoot tr.grand td { font-weight: 700; color: var(--text); font-size: 1rem;
                                border-top: 1px solid var(--line); padding-top: 0.7rem; }

/* pills */
.status, .sync, .tag {
  display: inline-block; padding: 0.16rem 0.5rem; border-radius: 999px;
  font-size: 0.73rem; font-weight: 550; white-space: nowrap; border: 1px solid;
}
.status-lg, .sync-lg { font-size: 0.85rem; padding: 0.3rem 0.7rem; }
.status-pending   { background: rgba(245,165,36,0.12);  border-color: rgba(245,165,36,0.4);  color: #f3c77a; }
.status-completed { background: rgba(52,211,153,0.12);  border-color: rgba(52,211,153,0.35); color: #8ee9c4; }
.status-cancelled { background: rgba(255,107,90,0.1);   border-color: rgba(255,107,90,0.3);  color: #ffb3a8; }
/* A courier order's steps before it is paid. Created is quiet -- nothing has
   happened yet; In progress wears the courier's violet; waiting for the
   courier's money is amber, like every other payment still to collect. */
.status-created    { background: transparent; border-color: var(--line-strong); color: var(--text-muted); }
.status-progress   { background: rgba(124,107,255,0.12); border-color: rgba(124,107,255,0.45); color: #b3a8ff; }
.status-courierpay { background: rgba(245,165,36,0.12);  border-color: rgba(245,165,36,0.4);  color: #f3c77a; }

.sync-ok    { background: rgba(52,211,153,0.1);  border-color: rgba(52,211,153,0.3); color: #8ee9c4; }
.sync-warn  { background: rgba(245,165,36,0.1);  border-color: rgba(245,165,36,0.35); color: #f3c77a; }
.sync-bad   { background: rgba(255,107,90,0.1);  border-color: rgba(255,107,90,0.35); color: #ffb3a8; }
.sync-muted { background: transparent; border-color: var(--line-strong); color: var(--text-dim); }

.tag { background: transparent; border-color: var(--line-strong); color: var(--text-dim);
       margin-left: 0.35rem; font-weight: 500; }
.tag-warn { border-color: rgba(245,165,36,0.4); color: #f3c77a; }

/* How the order reached the customer. Only the courier is tinted — it is the
   one that costs money, so it should be the one that catches the eye. */
.tag-courier { border-color: rgba(124,107,255,0.45); color: #b3a8ff; background: rgba(124,107,255,0.10); }
.tag-self    { border-color: var(--line-strong); color: var(--text-dim); }
.tag-pickup  { border-color: var(--line-strong); color: var(--text-dim); }
/* Shown only at phone widths, where the Delivered-by column is hidden. */
.phone-only { display: none; }

/* ------------------------------------------------------------------ report --
   Headline figures. Big numbers, quiet labels: the point of the page is that
   you can read the four that matter without focusing. */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.stat-strong { border-color: rgba(124, 107, 255, 0.45); }
.stat-label { font-size: 0.78rem; font-weight: 550; color: var(--text-muted); }
.stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.stat-note  { font-size: 0.78rem; color: var(--text-dim); }

.period-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.period-tabs a {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}
.period-tabs a:hover { color: var(--text); border-color: var(--violet, #7c6bff); }
.period-tabs a.is-current {
  background: rgba(124, 107, 255, 0.14);
  border-color: rgba(124, 107, 255, 0.5);
  color: #cfc7ff;
}

/* ------------------------------------------------------- shared controls --
   One vocabulary for every dropdown and short input on the app pages: the same
   surface, border, radius and violet focus ring as the sign-in inputs, so a
   select in a filter bar and a select on the invoice page are visibly the same
   thing. Native selects get a drawn chevron: the OS one is white-on-white on
   this palette and looks like it fell in from another site. */
.control,
.filters select {
  height: 2.65rem;
  padding: 0 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select.control,
.filters select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 2.3rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1.5l5 5 5-5' fill='none' stroke='%239aa3b2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
}
.control:hover,
.filters select:hover { border-color: var(--text-dim); }
.control:focus,
.control:focus-within,
.filters select:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-dim);
}
select.control option,
.filters select option { background: var(--surface); color: var(--text); }

/* The money box: the "$" lives inside the frame with the number, so it reads
   as part of the field and not as loose text beside it. */
.control-money {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  width: 8rem;
}
.control-money .control-prefix { color: var(--text-muted); user-select: none; }
.control-money input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
}
.control-money input:focus { outline: none; }
/* Spinner buttons are noise on a two-decimal money field. */
.control-money input::-webkit-outer-spin-button,
.control-money input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.control-money input[type="number"] { -moz-appearance: textfield; }

/* ----------------------------------------------------- delivery section --
   Header row: title on the left, the current answer as a chip on the right —
   the same shape as the invoice title with its status pill at the top of the
   page. */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.35rem; }
.card-head h2 { margin: 0; }

/* Definition-list totals drawn exactly like the table's own tfoot rows above
   (right-aligned label, right-aligned amount, a heavier final line), so the
   delivery figures continue the invoice instead of restating it in a box. */
.totals { margin: 0; }
.totals > div {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.45rem 0.85rem;
  color: var(--text-muted);
}
.totals dt { margin: 0; }
.totals dd { margin: 0; min-width: 6.5rem; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.totals > div.grand {
  margin-top: 0.25rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
}

.note-warn {
  padding: 0.6rem 0.85rem;
  border-left: 3px solid var(--amber);
  background: rgba(245, 165, 36, 0.08);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.note-warn strong { color: #f3c77a; }

/* The change form sits on its own quiet strip below the figures, labels above
   the controls, everything sharing one baseline. */
.deliv-form {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.deliv-field { display: flex; flex-direction: column; gap: 0.35rem; }
.deliv-field label {
  font-size: 0.78rem;
  font-weight: 550;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.deliv-field .control { min-width: 13rem; }
.deliv-form .btn { height: 2.65rem; }

/* ---------------------------------------------------------- phone widths --
   Below 560px the invoice table drops the columns you would never act on from
   a phone (date, Shopify state) and keeps the ones you would: number, who,
   how much, status. The full row is still one tap away on the invoice page. */
@media (max-width: 560px) {
  .shell-wide { padding-left: 0.9rem; padding-right: 0.9rem; }
  .filters select { flex: 1 1 45%; min-width: 0; }
  .filters .btn { flex: 1 1 100%; }
  /* Scoped to the invoice list: the report's tables share .data and their
     third column is real information. Keep number, customer, amount and the
     status pill — the one you tap to collect. Date, delivered-by and Shopify
     state are a tap away on the invoice itself; delivered-by survives as a
     chip under the name when it is the courier, because that one costs money. */
  table.invoice-list th:nth-child(3), table.invoice-list td:nth-child(3),
  table.invoice-list th:nth-child(5), table.invoice-list td:nth-child(5),
  table.invoice-list th:nth-child(7), table.invoice-list td:nth-child(7) { display: none; }
  table.invoice-list th, table.invoice-list td { padding: 0.6rem 0.45rem; }
  table.invoice-list td:first-child .mono { font-size: 0.78rem; white-space: nowrap; }
  table.invoice-list td:nth-child(6) { white-space: nowrap; }
  table.invoice-list .status { font-size: 0.7rem; padding: 0.16rem 0.45rem; }
  /* A status may wrap onto two lines rather than push its column off the
     screen -- it is the one control on the row you tap. It only wraps when it
     has to; with room to spare it stays on one line. */
  table.invoice-list .status { white-space: normal; line-height: 1.25; }
  /* Stock on paper vs on hand: the headers may wrap ("On / hand") so all three
     numbers fit the screen without scrolling sideways. */
  /* th.num too: `table.data .num` (nowrap) outranks a plain `th` rule. */
  table.stock-table th, table.stock-table th.num { white-space: normal; }
  .phone-only { display: inline-block; margin: 0.25rem 0 0; }
  .deliv-field, .deliv-field .control, .control-money { width: 100%; min-width: 0; }
  .deliv-form .btn { width: 100%; }
  .stat-value { font-size: 1.4rem; }
}

.empty { text-align: center; padding: 3rem 1rem; border: 1px dashed var(--line-strong);
         border-radius: var(--radius); color: var(--text-muted); }
.empty p { margin-bottom: 1rem; }

.addr-block { white-space: pre-line; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }

.err-box {
  margin: 0.75rem 0 0; padding: 0.7rem 0.85rem; background: var(--surface-2);
  border: 1px solid rgba(255,107,90,0.28); border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem; color: #ffb3a8; white-space: pre-wrap; word-break: break-word;
}

.log-list { list-style: none; margin: 0.75rem 0 0; padding: 0; font-size: 0.78rem; line-height: 1.8; }
.log-list .ok  { color: var(--green); }
.log-list .bad { color: var(--red); }

details summary { cursor: pointer; color: var(--text-muted); font-size: 0.85rem; }
details summary:hover { color: var(--text); }

.linkish.danger { color: var(--red); }

.row-gap-flush { margin-top: 0; }

/* ------------------------------------------- collect-from-the-list ------- */

button.status.is-clickable {
  cursor: pointer;
  font: inherit;
  font-size: 0.73rem;
  font-weight: 550;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
button.status.is-clickable:hover {
  background: rgba(245, 165, 36, 0.22);
  border-color: rgba(245, 165, 36, 0.7);
  color: #ffd79a;
}
button.status.is-clickable:active { transform: translateY(1px); }
button.status.is-clickable:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(245, 165, 36, 0.3);
}
/* The two courier steps that are not about money keep their own colour on hover. */
button.status-created.is-clickable:hover  { background: rgba(255,255,255,0.06); border-color: var(--text-dim); color: var(--text); }
button.status-progress.is-clickable:hover { background: rgba(124,107,255,0.22); border-color: rgba(124,107,255,0.7); color: #cfc7ff; }

.ohq-confirm {
  position: fixed;
  inset: 0;
  z-index: 9600;
  background: rgba(6, 9, 15, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.ohq-confirm-box {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid rgba(124, 107, 255, 0.4);
  border-radius: var(--radius);
  padding: 1.9rem 1.75rem 1.5rem;
  text-align: center;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
}
.ohq-confirm-box h2 { font-size: 1.12rem; }
.ohq-confirm-amount {
  margin: 0.9rem 0 0.35rem;
  font-size: 2.3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.ohq-confirm-who { margin: 0 0 1.5rem; color: var(--text-muted); font-size: 0.86rem; line-height: 1.6; }
.ohq-confirm-actions { display: flex; gap: 0.6rem; }
.ohq-confirm-actions .btn { flex: 1; }
.ohq-confirm-detail { margin: 0 0 0.9rem; color: var(--text-muted); font-size: 0.84rem; }

/* A courier order's steps on its invoice page: done, current, still to come. */
.stage-track { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.75rem 0 0; padding: 0; }
.stage-track li {
  display: flex; flex-direction: column; gap: 0.1rem; min-width: 7rem;
  padding: 0.45rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 0.8rem; color: var(--text-dim);
}
.stage-track .when { font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.stage-track li.is-done    { border-color: rgba(52,211,153,0.35); color: #8ee9c4; }
.stage-track li.is-current { border-color: rgba(124,107,255,0.55); color: var(--text); background: rgba(124,107,255,0.08); }

/* Stock on paper vs on hand: when the numbers are from, and the refresh. */
.stock-foot { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

/* server-rendered fallback, same question without JavaScript */
.confirm-card { text-align: center; max-width: 460px; margin: 2rem auto 0; }
.confirm-q { font-size: 1.2rem; }
.confirm-amount {
  margin: 1rem 0 0.35rem;
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.confirm-who { margin-bottom: 1.5rem; }
.confirm-actions { display: flex; gap: 0.6rem; justify-content: center; margin-top: 1.5rem; }

/* Radio variant of .checkbox-box.
 *
 * Same control, round, with a filled dot instead of a tick — a square tick on a
 * one-of-several choice reads as "both can be on", which is the opposite of
 * what a radio means. */
.radio-box {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface-2);
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.checkbox input:checked + .radio-box {
  border-color: var(--violet);
}
.checkbox input:checked + .radio-box::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--violet);
}
.checkbox input:focus-visible + .radio-box {
  box-shadow: 0 0 0 3px var(--violet-dim);
}

/* Settings groups. A card can hold several of these; each is one tool or one
 * provider, and needs to read as a unit without becoming a card-in-a-card. */
.subform {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem 1rem 0.4rem;
  margin: 0 0 1rem;
  background: var(--surface-2);
}
.subform .checkbox { margin-bottom: 0.9rem; }
.subform h3 { margin: 0; font-size: 0.95rem; }
.subform table.data td { padding: 0.5rem 0; border: 0; }
.subform table.data tr + tr td { border-top: 1px solid var(--line); }
.subform details { margin: 0 0 0.9rem; }
.subform summary { cursor: pointer; color: var(--muted); }
.steps { margin: 0.6rem 0 0.6rem 1.1rem; }
.steps li { margin-bottom: 0.35rem; }

/* Saved custom invoices.
 *
 * The totals column is right-aligned and the one after it left-aligned, so
 * without a gap "$1,700" and the date it precedes run together into one
 * unreadable string. Fixed widths rather than padding, so the columns line up
 * down the table however long a number happens to be. */
#saved table.data th:nth-child(2),
#saved table.data td:nth-child(2) { width: 8rem; }
#saved table.data th:nth-child(3),
#saved table.data td:nth-child(3) { width: 7rem; padding-right: 1.5rem; }
#saved table.data th:nth-child(4),
#saved table.data td:nth-child(4) { width: 9rem; }
#saved table.data td:last-child { white-space: nowrap; }
#saved table.data td:last-child form { display: inline-flex; margin-left: 0.35rem; }

#saved details { margin-bottom: 0.9rem; }
#saved summary { padding: 0.2rem 0; }

/* Refund form: how many of a line came back. */
.control-qty { width: 5.5rem; }
