/* THE HORSE BOUTIQUE - admin panel.
 *
 * The palette and type are the brand's: noir, graphite, steel, mist, paper,
 * white, and a light geometric sans with wide tracking on caps. The panel is
 * an internal tool, but it is the owner's own brand looking back at him, and a
 * tool that looks considered gets treated as trustworthy.
 *
 * Two signal colours exist and are used nowhere decorative - only where a
 * figure is wrong or money is being lost. A warning colour spent on ordinary
 * chrome stops meaning anything.
 */

:root {
  --noir: #0C0C0C;
  --graphite: #3A3A3A;
  --steel: #8C8C8C;
  --mist: #D8D8D8;
  --paper: #F2F2F2;
  --white: #FFFFFF;

  --alert: #A3181C;
  --alert-bg: #FBEFEF;
  --note: #6B5A1F;
  --note-bg: #FAF6E8;

  --r: 2px;
  --shadow: 0 1px 2px rgba(12, 12, 12, .05), 0 10px 28px rgba(12, 12, 12, .05);
  --sans: 'Inter', 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--noir);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

/* Money and quantities are tabular so digits line up in a column and a long
 * number cannot be misread at a glance. */
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  white-space: nowrap;
}

/* ===================================================== gate and setup === */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--noir);
}

.gate[hidden], .shell[hidden], .view[hidden] { display: none; }

.gate-card {
  background: var(--white);
  width: 100%;
  max-width: 400px;
  padding: 40px 36px;
  border-radius: var(--r);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}

.gate-card.wide { max-width: 640px; }

.gate-mark { width: 40px; height: 42px; display: block; margin: 0 auto 22px; }
.gate-mark path { fill: var(--noir); }

.gate-card h1 {
  font-size: 13px;
  font-weight: 300;
  letter-spacing: .34em;
  text-transform: uppercase;
  text-align: center;
  margin: 0 0 4px;
}

.gate-card .sub {
  text-align: center;
  color: var(--steel);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin: 0 0 30px;
}

.gate-card .who {
  text-align: center;
  font-size: 12.5px;
  color: var(--graphite);
  margin: 0 0 20px;
  padding: 9px 12px;
  background: var(--paper);
  border-radius: var(--r);
}

/* ============================================================== shell === */

header.top {
  background: var(--noir);
  color: var(--white);
  padding: 13px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

header.top .mark { width: 24px; height: 25px; flex: none; }
header.top .mark path { fill: var(--white); }

header.top h1 {
  font-size: 12px;
  font-weight: 300;
  letter-spacing: .32em;
  margin: 0;
  text-transform: uppercase;
}

header.top .spacer { margin-left: auto; }

header.top .user {
  font-size: 11.5px;
  color: var(--mist);
  display: flex;
  align-items: center;
  gap: 12px;
}

nav.tabs {
  background: var(--white);
  border-bottom: 1px solid var(--mist);
  display: flex;
  overflow-x: auto;
  position: sticky;
  top: 0;
  z-index: 40;
}

nav.tabs button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 13px 18px;
  font: inherit;
  font-size: 13.5px;
  color: var(--graphite);
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: .02em;
}

nav.tabs button:hover { background: var(--paper); }

nav.tabs button[aria-selected="true"] {
  color: var(--noir);
  border-bottom-color: var(--noir);
  font-weight: 600;
}

nav.tabs .count { font-size: 11px; color: var(--steel); margin-left: 6px; }

main { padding: 22px; max-width: 1760px; margin: 0 auto; }

h2.sec { font-size: 14.5px; font-weight: 600; margin: 0 0 4px; letter-spacing: .01em; }

p.hint {
  color: var(--graphite);
  font-size: 13px;
  margin: 0 0 16px;
  max-width: 78ch;
}

.card {
  background: var(--white);
  border: 1px solid var(--mist);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

/* ============================================================ figures === */

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

.fig {
  background: var(--white);
  border: 1px solid var(--mist);
  border-radius: var(--r);
  padding: 14px 16px;
}

.fig .k {
  font-size: 10.5px;
  color: var(--steel);
  letter-spacing: .09em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 7px;
}

.fig .v { font-size: 23px; font-weight: 300; display: block; line-height: 1.25; }
.fig .u { font-size: 12px; color: var(--steel); }
.fig.dark { background: var(--noir); border-color: var(--noir); color: var(--white); }
.fig.dark .k { color: var(--mist); }

/* ============================================================== table === */

.scroller {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--mist);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

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

thead th {
  background: var(--paper);
  text-align: left;
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--graphite);
  padding: 9px 10px;
  border-bottom: 1px solid var(--mist);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

thead th .sub {
  display: block;
  font-weight: 400;
  text-transform: none;
  color: var(--steel);
  font-size: 10px;
  letter-spacing: 0;
}

/* The three columns that are the answer - cost, price, profit - are tinted
 * apart from the inputs that feed them. */
thead th.key { background: #E9E9E9; }
tbody td.key { background: #FAFAFA; }

tbody td { padding: 8px 10px; border-bottom: 1px solid var(--paper); vertical-align: middle; }
tbody tr:hover td { background: #FCFCFC; }
tbody tr:hover td.key { background: #F4F4F4; }

tbody tr.alert td { background: var(--alert-bg); }
tbody tr.alert:hover td { background: #F7E4E4; }
tbody tr.note td { background: var(--note-bg); }
tbody tr.note:hover td { background: #F5EFDC; }

.loss { color: var(--alert); font-weight: 600; }
.unknown { color: var(--steel); }

.thumb {
  width: 42px; height: 42px;
  object-fit: cover;
  border: 1px solid var(--mist);
  border-radius: var(--r);
  background: var(--paper);
  display: block;
}

.thumb.empty { display: grid; place-items: center; color: var(--mist); font-size: 17px; }

.pname { font-weight: 600; }
.psku { font-size: 11px; color: var(--steel); }

tfoot td {
  padding: 9px 10px;
  border-top: 1px solid var(--mist);
  background: var(--paper);
  font-weight: 600;
  font-size: 12.5px;
}

/* =============================================================== tags === */

.tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 7px;
  border: 1px solid var(--mist);
  border-radius: 999px;
  color: var(--graphite);
  background: var(--white);
  white-space: nowrap;
  letter-spacing: .03em;
}

.tag.alert { border-color: var(--alert); color: var(--alert); background: var(--alert-bg); }
.tag.note { border-color: var(--note); color: var(--note); background: var(--note-bg); }
.tag.zero { border-color: var(--steel); color: var(--steel); }

/* ============================================================== forms === */

label.f { display: block; margin-bottom: 13px; font-size: 12px; color: var(--graphite); }
label.f > span.lab { display: block; margin-bottom: 5px; letter-spacing: .02em; }
label.f > span.lab b { font-weight: 600; color: var(--noir); }
label.f .note { color: var(--steel); font-size: 11px; }

input[type="text"], input[type="number"], input[type="date"], input[type="email"],
input[type="password"], input[type="search"], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--mist);
  border-radius: var(--r);
  background: var(--white);
  color: var(--noir);
}

input[type="number"] { font-variant-numeric: tabular-nums; }

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--noir);
  outline-offset: -1px;
  border-color: var(--noir);
}

input:disabled, select:disabled, button:disabled { opacity: .55; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); gap: 0 14px; }
.row-actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

/* ============================================================ buttons === */

button.btn {
  appearance: none;
  font: inherit;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: var(--r);
  border: 1px solid var(--noir);
  background: var(--noir);
  color: var(--white);
  cursor: pointer;
  letter-spacing: .03em;
}

button.btn:hover:not(:disabled) { background: var(--graphite); border-color: var(--graphite); }
button.btn:disabled { cursor: not-allowed; }
button.btn.block { width: 100%; padding: 11px; }
button.btn.ghost { background: var(--white); color: var(--noir); }
button.btn.ghost:hover:not(:disabled) { background: var(--paper); }
button.btn.danger { background: var(--white); color: var(--alert); border-color: var(--alert); }
button.btn.danger:hover:not(:disabled) { background: var(--alert-bg); }
button.btn.small { padding: 5px 11px; font-size: 12px; }

button.link {
  appearance: none; background: none; border: 0; padding: 0;
  font: inherit; font-size: 12.5px; color: var(--graphite);
  text-decoration: underline; cursor: pointer;
}
button.link:hover { color: var(--noir); }
button.link.danger { color: var(--alert); }
button.link.quiet { color: var(--steel); font-size: 11.5px; }

header.top button.signout {
  appearance: none;
  background: none;
  border: 1px solid #3A3A3A;
  color: var(--mist);
  font: inherit;
  font-size: 11px;
  padding: 4px 11px;
  border-radius: var(--r);
  cursor: pointer;
  letter-spacing: .05em;
  text-transform: uppercase;
}
header.top button.signout:hover { border-color: var(--steel); color: var(--white); }

/* ============================================================ notices === */

.notice {
  border: 1px solid var(--mist);
  border-left: 3px solid var(--noir);
  background: var(--white);
  padding: 12px 15px;
  border-radius: var(--r);
  font-size: 13px;
  margin-bottom: 16px;
}

.notice.alert { border-left-color: var(--alert); background: var(--alert-bg); }
.notice.note { border-left-color: var(--note); background: var(--note-bg); }
.notice strong { display: block; margin-bottom: 4px; }
.notice ul { margin: 7px 0 0; padding-left: 20px; }
.notice li { margin-bottom: 4px; }
.notice code {
  background: rgba(12, 12, 12, .06);
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 12px;
}

.empty-state { text-align: center; padding: 46px 20px; color: var(--steel); }
.empty-state p { margin: 0 0 14px; }

/* ============================================================== toast === */

#toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--noir);
  color: var(--white);
  padding: 11px 22px;
  border-radius: var(--r);
  font-size: 13px;
  z-index: 100;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .35);
  max-width: 90vw;
  text-align: center;
}
#toast[hidden] { display: none; }
#toast.alert { background: var(--alert); }

/* ============================================================== modal === */

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(12, 12, 12, .6);
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow-y: auto;
}
.modal-back[hidden] { display: none; }

.modal {
  background: var(--white);
  border-radius: var(--r);
  max-width: 640px;
  width: 100%;
  padding: 24px;
  max-height: 88vh;
  overflow-y: auto;
}
.modal h3 { margin: 0 0 15px; font-size: 15.5px; }

/* ======================================================== line editor === */

table.lines { font-size: 12.5px; }
table.lines td { padding: 5px 6px; }
table.lines input, table.lines select { padding: 7px 9px; font-size: 12.5px; }
table.lines .calc { font-size: 12px; color: var(--graphite); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.lines .calc.loss { color: var(--alert); }

/* ============================================================= print === */

@media print {
  nav.tabs, header.top .user, .row-actions, button, #toast, .gate { display: none !important; }
  body { background: var(--white); }
  .card, .scroller, .fig { box-shadow: none; }
  .scroller { overflow: visible; }
  table { font-size: 9.5px; }
}

@media (max-width: 640px) {
  main { padding: 13px; }
  .card { padding: 15px; }
  header.top h1 { letter-spacing: .2em; font-size: 11px; }
  header.top .user { font-size: 10.5px; }
  .fig .v { font-size: 20px; }
  .gate-card { padding: 30px 22px; }
}
