/* The back office.
 *
 * Never merged with shop.css. A shopper should not download the tooling for
 * administering a shop, and the two have opposite jobs: the storefront is a
 * page to be persuaded by, this is a page to work in. Denser, plainer, and
 * built around tables and forms rather than pictures.
 *
 * Deliberately dark-neutral rather than branded. The back office sitting in a
 * second tab should never be mistaken at a glance for the live site — that
 * mistake is how somebody edits the wrong thing.
 */

:root {
  --ink: #10202f;
  --muted: #5a6a79;
  --line: #d8e0e7;
  --paper: #ffffff;
  --ground: #eef2f5;
  --navy: #0b1623;
  --accent: #d2652a;
  --link: #14567d;
  --good: #1d7a4c;
  --warn: #9a6a06;
  --bad: #a32b1e;
  --radius: 6px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--link); }
a:hover { color: var(--accent); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

/* --- Chrome ----------------------------------------------------------- */

.top {
  background: var(--navy);
  color: #eaf0f5;
  border-bottom: 3px solid var(--accent);
}

.top-in {
  max-width: 1180px;
  margin: 0 auto;
  padding: .6rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.top-name {
  font-weight: 700;
  letter-spacing: .02em;
  color: #fff;
  text-decoration: none;
}

.top-name span { color: var(--accent); }

.top nav { display: flex; gap: .25rem; flex-wrap: wrap; }

.top nav a {
  color: #c8d5e0;
  text-decoration: none;
  padding: .3rem .6rem;
  border-radius: var(--radius);
  font-size: .92rem;
}

.top nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.top nav a[aria-current="page"] { background: rgba(255, 255, 255, .16); color: #fff; }

.top-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; font-size: .88rem; }
.top-right .who { color: #9fb2c2; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }

/* --- Banners ---------------------------------------------------------- */

.notice, .banner {
  border-radius: var(--radius);
  padding: .6rem .85rem;
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  background: var(--paper);
}

.notice.ok { border-color: #b7ddc7; background: #f0faf4; color: var(--good); }
.notice.err { border-color: #edc0ba; background: #fdf3f1; color: var(--bad); }
.banner.warn { border-color: #e6d3a2; background: #fdf8ea; color: var(--warn); }

/* --- Cards and grids --------------------------------------------------- */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0 0 1rem;
}

.card > :last-child { margin-bottom: 0; }

.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin: 0 0 1rem;
}

.tiles {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.tile {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .75rem .9rem;
  text-decoration: none;
  color: inherit;
  display: block;
}

.tile:hover { border-color: var(--accent); }
.tile .n { display: block; font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.tile .k { display: block; font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tile.flag .n { color: var(--bad); }
.tile.quiet .n { color: var(--muted); }

/* --- Tables ------------------------------------------------------------ */

.tablewrap { overflow-x: auto; }

table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: .93rem;
}

table.grid th, table.grid td {
  text-align: left;
  padding: .45rem .6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.grid th {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  white-space: nowrap;
}

table.grid tbody tr:hover { background: #f7fafc; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Bits -------------------------------------------------------------- */

.pill {
  display: inline-block;
  font-size: .75rem;
  padding: .1rem .45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--ground);
  color: var(--muted);
  white-space: nowrap;
}

.pill.ok { border-color: #b7ddc7; background: #f0faf4; color: var(--good); }
.pill.warn { border-color: #e6d3a2; background: #fdf8ea; color: var(--warn); }
.pill.bad { border-color: #edc0ba; background: #fdf3f1; color: var(--bad); }

.muted { color: var(--muted); }
.small { font-size: .87rem; }
.right { text-align: right; }
.stack > * + * { margin-top: .75rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

.btn {
  display: inline-block;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: .45rem .9rem;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { background: #16283c; color: #fff; }
.btn.ghost { background: transparent; color: var(--navy); }
.btn.ghost:hover { background: var(--ground); color: var(--navy); }

.block { display: block; }

/* Kept out of the flow rather than hidden: a label a sighted person does not
   need is still the only thing a screen reader has to name the field. */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* --- Tabs and pager ---------------------------------------------------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin: 0 0 1rem;
}

.tabs a {
  padding: .35rem .7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-size: .9rem;
}

.tabs a:hover { border-color: var(--accent); }
.tabs a[aria-current="page"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.tabs .tab-n { color: var(--muted); font-variant-numeric: tabular-nums; }
.tabs a[aria-current="page"] .tab-n { color: #cddae6; }

.pager {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin: 1rem 0 0;
  font-size: .9rem;
}

/* --- Order screen ------------------------------------------------------ */

/* The address is the one thing on the page that gets copied onto a label, so
   it is set at a size you can read across a packing bench and left as one
   selectable block. */
.addr {
  font-style: normal;
  font-size: 1.05rem;
  line-height: 1.5;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .7rem .8rem;
}

.quote {
  border-left: 3px solid var(--line);
  padding-left: .7rem;
  margin: .3rem 0 0;
  color: var(--ink);
}

/* PayPal's refusals arrive as JSON. Wrapped rather than scrolled — the useful
   half is usually the `details` array at the end of it. */
pre.raw {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .6rem .7rem;
  font-size: .82rem;
  margin: .3rem 0 0;
}

/* The only card on the site that does something irreversible. */
.card.danger { border-color: #edc0ba; }
.card.danger h2 { color: var(--bad); }
.btn.bad { background: var(--bad); border-color: var(--bad); }
.btn.bad:hover { background: #8c261a; border-color: #8c261a; }

/* --- Forms ------------------------------------------------------------- */

label { display: block; font-weight: 600; font-size: .9rem; margin: 0 0 .2rem; }

input[type=text], input[type=password], input[type=email], input[type=number],
input[type=search], select, textarea {
  width: 100%;
  padding: .45rem .55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--link);
  outline-offset: 1px;
  border-color: var(--link);
}

.field + .field { margin-top: .8rem; }
.hint { color: var(--muted); font-size: .84rem; margin: .2rem 0 0; }

/* --- Chart ------------------------------------------------------------- */

.chart { width: 100%; height: auto; display: block; }
.chart polyline { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .base { stroke: var(--line); stroke-width: 1; }

/* --- Sign-in ----------------------------------------------------------- */

.signin {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background: var(--navy);
}

.signin-box {
  width: 100%;
  max-width: 22rem;
  background: var(--paper);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

.signin-box h1 { font-size: 1.25rem; margin-bottom: .25rem; }
.signin-box .btn { width: 100%; text-align: center; margin-top: 1rem; }
.signin-back { text-align: center; margin: 1rem 0 0; font-size: .87rem; }
.signin-back a { color: #9fb2c2; }

/* --- Working screens ---------------------------------------------------
 *
 * Everything below arrived with the rest of the back office in v0.2.1 and is
 * appended rather than woven in: the blocks above are what the dashboard, the
 * orders list and the sign-in box are built from, and editing them to suit a
 * new screen is how three working pages break for one that does not exist yet.
 */

/* Two columns on a wide screen, one on a narrow one. The product editor is the
   only screen with a genuine main-and-aside shape: the form is the work and
   the pictures, the sync state and the eBay link are reference beside it. */
.split {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  align-items: start;
}

@media (max-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr); }
}

/* Fields that belong on one line — price and was-price, quantity and postage.
   `minmax(0, …)` rather than `1fr` alone because a bare 1fr refuses to shrink
   below the width of its input and overflows the card on a phone. */
.pair {
  display: grid;
  gap: .8rem;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.pair + .field, .field + .pair, .pair + .pair { margin-top: .8rem; }

/* The filter bar over a list: search box, two dropdowns and a sort, wrapping
   rather than scrolling, with the search allowed to take the slack. */
.bar {
  display: flex;
  gap: .6rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}

.bar .field { margin: 0; flex: 0 0 auto; }
.bar .field.grow { flex: 1 1 14rem; min-width: 0; }
.bar select, .bar input { width: auto; min-width: 8rem; }
.bar .field.grow input { width: 100%; }

/* Pictures. A strip on the product screen, a grid on the images screen. Both
   are the same tile so a thumbnail looks the same wherever it appears. */
.shots {
  display: grid;
  gap: .7rem;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
}

.shot {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .4rem;
  background: var(--paper);
}

.shot img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: var(--ground);
  border-radius: 4px;
}

.shot.first { border-color: var(--accent); }
.shot .field + .row { margin-top: .4rem; }

/* A row's thumbnail in a table. Fixed so the column does not jump about as
   pictures of different shapes load down the page. */
.thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--ground);
  border: 1px solid var(--line);
  display: block;
}

.thumb.none { display: block; }

/* Analytics: a bar per row, drawn with a background rather than an element, so
   a table row keeps working as a table row. The number is the width. */
.bars { list-style: none; margin: 0; padding: 0; }

.bars li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .6rem;
  align-items: baseline;
  padding: .3rem .45rem;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.bars li::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: var(--w, 0%);
  background: #eaf1f6;
  border-radius: 3px;
}

.bars li > * { position: relative; }
.bars .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .val { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .87rem; }
.bars li:last-child { border-bottom: 0; }
/* The day currently opened into its hours. Weight rather than colour, so it
   still reads as the open row when the bar behind it is nearly full width. */
.bars .lbl a[aria-current] { font-weight: 700; }

/* A filter in force, on the traffic screen. It is a link, and following it
   removes the filter — hence the × in the label rather than a button beside
   it, which would need a form of its own for a GET. */
.chip {
  display: inline-block;
  margin: 0 .35rem .25rem 0;
  padding: .12rem .5rem;
  border: 1px solid var(--line, #d7dee6);
  border-radius: 999px;
  background: #fff;
  font-size: .82rem;
  text-decoration: none;
}
.chip:hover { border-color: var(--accent); }

/* A tickbox in a table cell should not be full width — the element selector
   above does not touch checkboxes, but the column still needs to be narrow. */
table.grid td.tick, table.grid th.tick { width: 1.6rem; padding-right: 0; }

/* Sticky bulk-action bar under a long list of tickboxes. It sits at the foot
   of the form rather than the top: the selection is made going down the page,
   and an action bar you have scrolled past is an action bar you cannot use. */
.bulk {
  position: sticky;
  bottom: 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: .6rem 0 0;
  margin: .8rem 0 0;
}

.bulk select { width: auto; min-width: 10rem; }

/* Long single-line values that must not be broken up to fit — an eBay policy
   id, a merchant location key, a redirect path. */
code.id {
  font-size: .85rem;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .05rem .3rem;
  word-break: break-all;
}

/* A smaller button for the ones that live inside a table row, where a
   full-size button makes every row twice as tall as the text in it. */
.btn.small {
  padding: .25rem .55rem;
  font-size: .82rem;
}

/* A card that wants reading before the others — an enquiry nobody has answered.
   A left edge rather than a tint: the page is a column of cards, and tinting
   the ones that need attention makes the ones that do not look disabled. */
.card.attention { border-left: 3px solid var(--accent); }

/* One editable thing in a list of dozens, collapsed until it is wanted. The
   filing screen would otherwise open as forty open textareas nobody scrolls
   past. */
.rowblock {
  border-bottom: 1px solid var(--line);
  padding: .55rem 0;
}

.rowblock:last-of-type { border-bottom: 0; }

.rowblock > summary {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5rem;
}

.rowblock > summary::marker { color: var(--muted); }
.rowblock[open] > summary { margin-bottom: .8rem; }
.rowblock > form { padding-left: 1rem; border-left: 2px solid var(--line); }

@media (max-width: 720px) {
  .top-right { width: 100%; margin-left: 0; }
  .bar .field, .bar .field.grow { flex: 1 1 100%; }
  .bar select, .bar input { width: 100%; }
}
