/* Opportunity Hub. The Auto-Wares report world on a TSM's iPad (DESIGN.md). Light only. Every word and number is ink;
   gray is for rules and the soft fill of a total row, never a word. Red #C32034 is the brand and the TSM's own rows; rose
   #EBA9B1 is the comparison; charcoal #3A3A3A carries column heads. One family, a fixed scale, tabular numerals. */

:root {
  --ink: #111111; --paper: #ffffff;
  --red: #C32034; --red-deep: #7A1A26; --rose: #EBA9B1; --rose-soft: #fbf1f2;
  --charcoal: #3A3A3A; --rule: #E2E2E2; --rule-strong: #CFCFCF; --soft: #F3F3F3;
  --gutter: 24px; --tap: 44px; --tap-big: 48px;
  --fs: 17px; --h1: 1.6rem; --h2: 1.15rem; --big: 1.9rem;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Bahnschrift, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: var(--fs); line-height: 1.35; font-variant-numeric: tabular-nums; }
::selection { background: var(--rose); color: var(--ink); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
main { padding: 8px var(--gutter) 56px; max-width: 1180px; margin: 0 auto; }
h1, h2, h3 { color: var(--ink); line-height: 1.2; text-wrap: balance; }
h1 { font-size: var(--h1); margin: 20px 0 6px; }
h2 { font-size: var(--h2); margin: 28px 0 8px; }
p { margin: 6px 0; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 3px; }
button, .button { font: inherit; font-weight: 700; min-height: var(--tap); padding: 10px 18px; border: 2px solid var(--red); background: var(--red);
  color: #fff; cursor: pointer; }
button.quiet { background: var(--paper); color: var(--ink); border-color: var(--charcoal); }
button:disabled { opacity: .5; cursor: default; }

/* top bar */
header.top { display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 0 var(--gutter); border-bottom: 4px solid var(--red); }
header.top .brand { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 700; font-size: 1.1rem; text-decoration: none; }
header.top .who { margin-left: auto; font-weight: 600; }
header.top .signout button { min-height: var(--tap); padding: 6px 14px; background: var(--paper); color: var(--ink); border: 1px solid var(--rule-strong); font-weight: 600; }

/* page furniture */
.through, .foot, .note { font-size: .95rem; }
.foot { margin-top: 10px; max-width: 70ch; }
.back a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 4px; font-weight: 600; }
.banner { display: inline-block; margin: 8px 0; padding: 10px 14px; border: 2px solid var(--charcoal); font-weight: 700; }
.banner.adjacent { border-color: var(--red); background: var(--rose-soft); }
.missing { max-width: 50ch; }

/* the number: two figures lead (this month, year to date), each with what it is and one comparison line under it */
.number { margin-top: 12px; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule-strong); padding: 10px 0 14px; }
.number h2 { margin: 0 0 10px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 32px; }
.fig .lead { font-size: 2.6rem; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.fig .what { font-size: 1rem; font-weight: 600; margin-top: 6px; }
.fig .vs { font-size: .95rem; margin-top: 4px; }
.fig .chg { display: inline-block; font-weight: 700; padding: 2px 10px; border: 2px solid var(--charcoal); margin-right: 4px; color: var(--ink); }
.chg.neg { background: #F4B8BE; border-color: #C32034; }      /* a drop: red tint, black text (Chris 10/20) */
.chg.pos { background: #BFE3C6; border-color: #1B7F3B; }      /* a gain: green tint, black text */
.chg.flat { background: var(--soft); }
.chg.noly { background: var(--paper); }
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0 16px; }
.tile .big { font-size: var(--big); font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; white-space: nowrap; }
.tile .small { font-size: .9rem; margin-top: 2px; }

/* tables: sized to content, pushed left, numbers right beside their labels (rule 9/30, 10/19) */
table.lb { border-collapse: collapse; width: auto; max-width: 100%; margin: 6px 0 4px; }
table.lb th { text-align: left; background: var(--charcoal); color: #fff; padding: 8px 12px; font-weight: 600; font-size: .9rem; line-height: 1.15; vertical-align: bottom; }
table.lb th.num, table.lb td.num { text-align: right; }
table.lb td.num { white-space: nowrap; }
table.lb th { white-space: normal; max-width: 9ch; }
table.lb td { padding: 0 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; height: var(--tap); }
table.lb tr.total td { background: var(--soft); font-weight: 700; }
table.lb tr.store td a, table.lb td.name a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; }
.mono { font-variant-numeric: tabular-nums; }
.status { font-weight: 700; margin-left: 8px; }

table.lb td.name .under { display: none; }
table.lb.share td.name .under:last-child { display: block; font-size: .9rem; }
table.lb.share td.name { overflow-wrap: break-word; word-break: normal; }

/* tags on account rows */
.tag { display: inline-block; padding: 3px 9px; font-size: .85rem; font-weight: 600; line-height: 1.2; border: 1px solid var(--charcoal); white-space: nowrap; }
.tag.mine { background: var(--red); border-color: var(--red); color: #fff; }
.tag.house { background: var(--charcoal); color: #fff; }
.tag.other { background: var(--rose); border-color: var(--rose); }

/* the house toggle: the one control on a store page */
.toggle { position: relative; display: inline-flex; align-items: center; gap: 12px; min-height: var(--tap-big); margin: 14px 0 6px; padding: 6px 16px 6px 8px;
  border: 2px solid var(--charcoal); font-weight: 700; cursor: pointer; user-select: none; }
.toggle.on { border-color: var(--red); }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .switch { width: 56px; height: 32px; border-radius: 16px; background: var(--rule-strong); position: relative; flex: none; }
.toggle .switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 13px; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: left 150ms cubic-bezier(.2, .8, .2, 1); }
.toggle.on .switch { background: var(--red); }
.toggle.on .switch::after { left: 27px; }
.toggle input:focus-visible + .switch { outline: 3px solid var(--red); outline-offset: 2px; }
.yours { font-size: 1.05rem; margin-top: 10px; }

.showall { margin: 10px 0 4px; }

/* Home: the queue cannot be hidden; one red block, the count first, a sentence, the whole thing is the tap target */
.queue, .losing { margin-top: 20px; }
.queue-link, .losing-link { display: flex; align-items: center; gap: 16px; min-height: 72px; padding: 12px 16px; text-decoration: none;
  border: 3px solid var(--red); }
.losing-link { border-color: var(--charcoal); }
.queue-link .count, .losing-link .count { font-size: 2.4rem; font-weight: 700; line-height: 1; min-width: 2ch; text-align: center; color: var(--red); }
.losing-link .count { color: var(--ink); }
.queue-link .words, .losing-link .words { font-size: 1.05rem; }
.queue.empty p, .losing p { max-width: 60ch; }
.count-line { font-size: 1.1rem; }
.count-line .count { font-weight: 700; color: var(--red); font-size: 1.4rem; }
.lead { max-width: 60ch; font-size: 1.05rem; }
.scope { max-width: 70ch; font-size: .95rem; font-weight: 600; }
.done { font-size: 1.05rem; font-weight: 600; }
.flag { display: inline-block; margin-left: 8px; padding: 2px 8px; border: 2px solid var(--red); font-size: .85rem; font-weight: 700; }

/* the queue list: one row per account, a big box to tap, name first */
ul.qlist { list-style: none; margin: 8px 0 0; padding: 0; }
li.qrow { display: grid; grid-template-columns: var(--tap-big) 1fr; grid-template-rows: auto auto auto; column-gap: 14px; align-items: start;
  padding: 12px 0; border-bottom: 1px solid var(--rule); }
li.qrow .box { grid-row: 1 / span 3; width: var(--tap-big); height: var(--tap-big); margin-top: 2px; padding: 0; background: var(--paper);
  border: 3px solid var(--red); }
li.qrow .box:active { background: var(--rose-soft); }
li.qrow .who { font-size: 1.05rem; }

/* the two-answer sheet */
.sheet { position: fixed; inset: 0; background: rgba(17, 17, 17, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet[hidden] { display: none; }
.sheet .card { width: 100%; max-width: 520px; background: var(--paper); padding: 20px var(--gutter) calc(20px + env(safe-area-inset-bottom));
  border-top: 4px solid var(--red); box-shadow: 0 -6px 24px rgba(0, 0, 0, .25); }
.sheet .q { font-size: 1.2rem; font-weight: 700; margin: 0 0 12px; }
.sheet button { display: block; width: 100%; min-height: 56px; margin-top: 10px; font-size: 1.05rem; }
.sheet button.cancel { min-height: var(--tap); margin-top: 14px; }
@media (min-width: 601px) { .sheet { align-items: center; } .sheet .card { border: 3px solid var(--red); } }

/* campaign tiles on Home: one per open campaign, the whole tile is the tap target */
.campaigns h3 { margin: 16px 0 6px; font-size: 1rem; }
.ctile { display: grid; gap: 4px; margin: 10px 0; padding: 14px 16px; border: 2px solid var(--charcoal); text-decoration: none; }
.ctile.own { border-color: var(--red); }
.ctile .ctitle { font-weight: 700; font-size: 1.1rem; }
.ctile .cplays { font-size: .95rem; }
.ctile .chead { font-size: 1rem; margin-top: 4px; }
.ctile .chead .big { font-size: 1.5rem; font-weight: 700; margin-right: 6px; }
.ctile .cfacts { font-size: .95rem; }
ul.plays, ul.plain { padding-left: 22px; }
ul.plays li, ul.plain li { min-height: 28px; }
.reports-link { margin-top: 20px; }
ul.files { list-style: none; margin: 8px 0; padding: 0; }
ul.files li { display: flex; align-items: center; gap: 14px; min-height: 56px; border-bottom: 1px solid var(--rule); }
ul.files a.file { display: inline-flex; align-items: center; min-height: var(--tap-big); font-weight: 600; font-size: 1.05rem; }
ul.files .when { font-size: .95rem; }

/* admin */
ul.users { list-style: none; margin: 8px 0; padding: 0; }
li.urow { padding: 14px 0; border-bottom: 1px solid var(--rule-strong); }
li.urow.off .uhead { opacity: .6; }
.uhead { margin-bottom: 8px; }
.uform { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; margin: 6px 0; }
.uform label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .95rem; }
.uform input { font: inherit; min-height: var(--tap); padding: 8px 10px; border: 2px solid var(--charcoal); min-width: 16ch; }
.uform .suggest { font-size: .95rem; align-self: center; }
.uactions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.linkbox input.link { width: 100%; font: inherit; padding: 10px; min-height: var(--tap); border: 2px solid var(--red); }

/* tiles: every fact in its own labelled spot, same place on every tile, thin rules between the groups (Chris 10/21) */
.rule { display: block; height: 1px; background: var(--rule); margin: 10px 0; }
.slots { display: grid; gap: 8px 16px; }
.slots.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.slots.one { grid-template-columns: 1fr; gap: 10px; }
.slots.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.slot { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.slot .lbl { font-size: .8rem; font-weight: 600; letter-spacing: .01em; }
.slot .val { font-size: 1.05rem; font-weight: 700; }
.slot .val.text { font-weight: 500; font-size: 1rem; }
.slot .sub { font-size: .85rem; }
.slot .val a { display: inline-flex; align-items: center; min-height: var(--tap); }
li.qrow { grid-template-rows: auto; align-items: start; }
li.qrow .box { grid-row: 1; }
li.qrow .tile-body { min-width: 0; }
li.qrow .head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 1.05rem; }
li.qrow .head .ids { font-size: .95rem; }
li.qrow .head strong { font-size: 1.1rem; }
.queue-link .words, .losing-link .words { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.queue-link .sub, .losing-link .sub { font-size: .95rem; }
.mini { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--rule); }
.mini .slot .val { font-size: 1rem; }
.ctile { gap: 6px; }
.ctile .slots.six .slot .val { font-size: 1.15rem; }
@media (max-width: 1023px) { .ctile .slots.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .ctile .slots.six { grid-template-columns: repeat(2, minmax(0, 1fr)); } .slots.three { gap: 8px 10px; } }


/* reports: the Report Hub's cards, in miniature (Chris 10/21) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 10px 0; }
.card { display: flex; flex-direction: column; text-decoration: none; background: var(--paper); border: 1px solid var(--rule);
  border-top: 4px solid var(--red); overflow: hidden; }
.card .pic { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-bottom: 1px solid var(--rule); background: var(--paper); }
.card .pic img { width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; }
.card .pic.none { display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; }
.card .body { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; flex: 1; }
.card .t { font-size: 1.1rem; font-weight: 700; line-height: 1.25; }
.card .q { font-size: .95rem; }
.card .when { font-size: .85rem; margin-top: auto; padding-top: 6px; }
.card .acts .act { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; margin-top: 6px; border: 2px solid var(--red); font-weight: 700; }
.reports-link .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.reports-link .card .q { display: none; }
.viewbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 0 10px; border-bottom: 1px solid var(--rule-strong); }
.viewbar .vt { font-weight: 700; font-size: 1.05rem; margin-right: auto; }
.viewbar .button { display: inline-flex; align-items: center; text-decoration: none; }
iframe.report { width: 100%; height: calc(100vh - 150px); min-height: 480px; border: 1px solid var(--rule); background: var(--paper); }
\n\n/* sign in */
.signin { max-width: 440px; margin: 40px auto; }
.signin label { display: block; font-weight: 600; margin-bottom: 6px; }
.signin input { width: 100%; font: inherit; padding: 12px; min-height: var(--tap); border: 2px solid var(--charcoal); background: var(--paper); color: var(--ink); }
.signin input::placeholder { color: var(--ink); opacity: .55; }
.signin button { width: 100%; margin-top: 14px; }

/* iPad portrait and under: the number wraps to three across; the account table folds its right-hand columns under the name */
@media (max-width: 1023px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
  table.lb th.fold, table.lb td.fold { display: none; }
  table.lb td.name { max-width: 34ch; }
  table.lb td.name .under { display: block; font-size: .9rem; }
}
/* phone: 16px gutters, two across, store table drops the two comparison columns, account table keeps name, who and YTD */
@media (max-width: 600px) {
  :root { --gutter: 16px; --fs: 16px; --big: 1.6rem; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pair { grid-template-columns: 1fr; gap: 16px; }
  .fig .lead { font-size: 2.2rem; }
  table.lb th, table.lb td { padding-left: 8px; padding-right: 8px; }
  table.lb.stores th.fold, table.lb.stores td.fold { display: none; }
  table.lb th.fold2, table.lb td.fold2 { display: none; }
  table.lb.accounts { width: 100%; table-layout: fixed; }
  table.lb.accounts th:nth-child(3), table.lb.accounts td:nth-child(3) { width: 98px; }
  table.lb.accounts th:nth-child(4), table.lb.accounts td:nth-child(4) { width: 84px; }
  table.lb td.name { overflow-wrap: anywhere; }
  table.lb .tag { white-space: normal; overflow-wrap: normal; word-break: keep-all; }
  table.lb .tag.mine, table.lb .tag.house { white-space: nowrap; }
  table.lb th.fold3, table.lb td.fold3 { display: none; }
  table.lb td.name { overflow-wrap: break-word; }
  table.lb.share, table.lb.ctable, table.lb.cats, table.lb.drill { width: 100%; table-layout: fixed; }
  table.lb.drill th:nth-child(1), table.lb.drill td:nth-child(1) { width: 84px; }
  table.lb.drill th:nth-child(3), table.lb.drill td:nth-child(3), table.lb.drill th:nth-child(5), table.lb.drill td:nth-child(5) { width: 76px; }
  table.lb.ctable th:nth-child(3), table.lb.ctable td:nth-child(3) { width: 92px; }
  table.lb.ctable th:nth-child(4), table.lb.ctable td:nth-child(4) { width: 80px; }
  table.lb.ctable th:nth-child(6), table.lb.ctable td:nth-child(6) { width: 64px; }
  table.lb.cats th:nth-child(n+2), table.lb.cats td:nth-child(n+2) { width: 60px; }
  table.lb.cats td:first-child { overflow-wrap: break-word; }
  table.lb.share th:nth-child(3), table.lb.share td:nth-child(3) { width: 94px; }
  table.lb.share th:nth-child(4), table.lb.share td:nth-child(4) { width: 84px; }
  table.lb.share th:nth-child(6), table.lb.share td:nth-child(6) { width: 64px; }
  table.lb.stores { width: 100%; table-layout: fixed; }
  table.lb.stores th:nth-child(2), table.lb.stores td:nth-child(2) { width: 84px; }
  table.lb.stores th:nth-child(4), table.lb.stores td:nth-child(4) { width: 76px; }
  table.lb.stores td a { overflow-wrap: anywhere; }
  .tile .big { white-space: normal; }
  header.top .who { display: none; }
}
