/* ------------------------------------------------------------------
   Tokens. The palette comes from the cutting table: worsted navy cloth,
   tailor's chalk, and the yellow of a measuring tape.
------------------------------------------------------------------- */
:root {
  --cloth: #1e2a3f;
  --cloth-deep: #162032;
  --cloth-soft: #2b3a54;
  --chalk: #f5f7f6;
  --paper: #ffffff;
  --tape: #e9b824;
  --tape-deep: #c99a0c;
  --ink: #1f242b;
  --pencil: #5f6975;
  --line: #d8dde1;
  --madder: #a8322a;
  --madder-wash: #fbeceb;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;

  --radius: 6px;
  --touch: 52px; /* minimum height for anything a salesman taps */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--chalk);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--tape);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------
   Selvedge: the woven edge of a suiting cloth, where the mill weaves
   its name. Here it carries the shop's name down the edge of the app.
------------------------------------------------------------------- */
.selvedge {
  background: var(--cloth-deep);
  border-right: 2px solid var(--tape);
  overflow: hidden;
  user-select: none;
}

.selvedge__text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  /* one vertical line of text, exactly as wide as the band, so it sits centred */
  width: calc(var(--selvedge) - 2px);
  line-height: calc(var(--selvedge) - 2px);
  height: 100%;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
}

.selvedge__text span {
  padding-inline-end: 3.4em;
}

/* ------------------------------------------------------------------
   Buttons and fields
------------------------------------------------------------------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  padding: 0 26px;
  border: 0;
  border-radius: var(--radius);
  background: var(--tape);
  color: var(--ink);
  font: 600 17px/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--tape-deep);
}

.button--quiet {
  background: transparent;
  color: inherit;
  border: 1.5px solid currentColor;
  min-height: 44px;
  padding: 0 16px;
  font-size: 15px;
}

.button--quiet:hover {
  background: rgba(255, 255, 255, 0.1);
}

.field {
  display: block;
  margin-bottom: 18px;
}

.field__label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  min-height: var(--touch);
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.2 var(--font-body);
}

.field input:focus {
  border-color: var(--cloth);
  outline: 3px solid var(--tape);
  outline-offset: 0;
}

.notice {
  border-left: 4px solid var(--madder);
  background: var(--madder-wash);
  color: var(--madder);
  padding: 12px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 20px;
  font-weight: 600;
}

/* ------------------------------------------------------------------
   Sign-in screen
------------------------------------------------------------------- */
.signin {
  --selvedge: 84px;
  display: grid;
  grid-template-columns: var(--selvedge) 1fr;
  min-height: 100vh;
}

.signin__panel {
  padding: 15vh 8vw 48px;
}

.signin__inner {
  max-width: 400px;
}

.signin__name {
  font-size: clamp(40px, 6vw, 60px);
  margin-bottom: 10px;
}

.signin__lead {
  color: var(--pencil);
  margin-bottom: 36px;
  max-width: 32ch;
}

.signin .button {
  width: 100%;
  margin-top: 6px;
}

/* ------------------------------------------------------------------
   Signed-in shell
------------------------------------------------------------------- */
.shell {
  --selvedge: 34px;
  display: grid;
  grid-template-columns: var(--selvedge) 232px 1fr;
  min-height: 100vh;
}

.rail {
  background: var(--cloth);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 26px 0 20px;
}

.rail__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  padding: 0 22px;
  margin-bottom: 30px;
}

.rail__nav {
  flex: 1;
}

.nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 22px;
  color: rgba(255, 255, 255, 0.86);
  text-decoration: none;
  border-left: 3px solid transparent;
}

a.nav__item:hover {
  background: var(--cloth-soft);
}

.nav__item.is-current {
  background: var(--cloth-soft);
  border-left-color: var(--tape);
  color: #fff;
  font-weight: 600;
}

.nav__item.is-off {
  color: rgba(255, 255, 255, 0.42);
}

.nav__item small {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.42);
}

.rail__who {
  padding: 18px 22px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  margin-top: 18px;
}

.rail__who strong {
  display: block;
}

.rail__who span {
  display: block;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.62);
  margin-bottom: 14px;
}

.main {
  padding: 44px clamp(22px, 5vw, 64px) 64px;
  min-width: 0;
}

.main__title {
  font-size: clamp(32px, 4.4vw, 48px);
  margin-bottom: 8px;
}

.main__lead {
  color: var(--pencil);
  max-width: 60ch;
  margin-bottom: 40px;
}

/* Counts sit on one ruled line, like entries in a stock ledger. */
.tally {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 44px;
  padding: 0;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
}

.tally__entry {
  padding: 20px 44px 20px 0;
  margin-right: 44px;
  border-right: 1px solid var(--line);
}

.tally__entry:last-child {
  border-right: 0;
  margin-right: 0;
}

.tally dt {
  color: var(--pencil);
  font-size: 15px;
}

.tally dd {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 44px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.next {
  max-width: 60ch;
}

.next h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.next p {
  color: var(--pencil);
  margin-bottom: 20px;
}

/* ------------------------------------------------------------------
   Narrow screens: tablet held upright, or a phone
------------------------------------------------------------------- */
@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .shell > .selvedge {
    display: none;
  }

  .rail {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 0;
    border-bottom: 3px solid var(--tape);
  }

  .rail__name {
    margin: 0;
    padding: 14px 18px;
    font-size: 19px;
  }

  .rail__nav {
    order: 3;
    flex: 1 0 100%;
    min-width: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
  }

  .nav {
    display: flex;
    overflow-x: auto;
  }

  .nav__item {
    padding: 0 16px;
    white-space: nowrap;
    gap: 8px;
    border-left: 0;
    border-bottom: 3px solid transparent;
  }

  .nav__item.is-current {
    border-bottom-color: var(--tape);
  }

  .rail__who {
    margin: 0 0 0 auto;
    padding: 8px 14px;
    border-top: 0;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .rail__who strong,
  .rail__who span {
    display: none;
  }

  .main {
    padding-top: 28px;
  }

  .tally__entry {
    padding-right: 28px;
    margin-right: 28px;
  }
}

@media (max-width: 560px) {
  .signin {
    --selvedge: 30px;
  }

  .signin__panel {
    padding: 9vh 22px 32px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .button,
  a.nav__item {
    transition: background-color 120ms ease;
  }
}
