/* ============================================================
   Bitscore Security - Quoting System
   Status is carried by the dot, echoing the mark and a panel LED.
   ============================================================ */

:root {
  --green:      #3CB346;
  --green-dark: #2E8F37;
  --green-wash: #EEF7EF;

  --ink:    #262626;
  --muted:  #6E7377;
  --line:   #E2E5E4;
  --surface:#FFFFFF;
  --wash:   #F6F8F6;

  --amber:  #D9922B;
  --red:    #C0392B;
  --idle:   #A8ADAC;

  --radius: 4px;
  --rail-w: 208px;
  --bar-h:  60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Barlow', 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--wash);
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { font-weight: 600; line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }
p  { margin: 0 0 1rem; max-width: 68ch; }
a  { color: var(--green-dark); }

/* ---------- status dot ---------- */
.dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--idle);
  margin-right: .5rem;
  vertical-align: baseline;
  flex: none;
}
.dot.live      { background: var(--green); }
.dot.waiting   { background: var(--amber); }
.dot.stopped   { background: var(--red); }
.dot.done      { background: var(--idle); }

/* ============================================================
   Signed out: login and password change
   ============================================================ */
body.bare {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: var(--surface);
  min-height: 100vh;
}

.gate {
  width: 100%;
  max-width: 360px;
  padding: 4.5rem 1.5rem 3rem;
}
.gate img.mark { width: 168px; height: auto; display: block; margin-bottom: 2.75rem; }
.gate h1 { font-size: 1.375rem; margin-bottom: .25rem; }
.gate .sub { color: var(--muted); margin-bottom: 2rem; }
.gate hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.25rem 0 1.25rem;
}
.gate .foot { color: var(--muted); font-size: .875rem; }

/* ---------- forms ---------- */
label {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: .3125rem;
}
input[type=text], input[type=email], input[type=password],
input[type=number], input[type=date], select, textarea {
  width: 100%;
  padding: .6875rem .75rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-wash);
}
.field { margin-bottom: 1.125rem; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .6875rem 1.125rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--green);
  border: 1px solid var(--green);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--green-dark); border-color: var(--green-dark); }
button:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--green-dark);
  outline-offset: 2px;
}
button.wide { width: 100%; }
button.quiet, .btn.quiet {
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
}
button.quiet:hover, .btn.quiet:hover { background: var(--wash); border-color: var(--muted); }
button.linkish {
  background: none; border: none; padding: 0;
  color: var(--muted); font-weight: 500; text-decoration: underline;
}
button.linkish:hover { background: none; color: var(--ink); }

/* ---------- messages ---------- */
.notice {
  padding: .75rem .875rem;
  border-radius: var(--radius);
  border-left: 3px solid var(--muted);
  background: var(--wash);
  margin-bottom: 1.25rem;
  font-size: .9375rem;
}
.notice.bad  { border-left-color: var(--red);   background: #FBEDEC; }
.notice.good { border-left-color: var(--green); background: var(--green-wash); }
.notice.warn { border-left-color: var(--amber); background: #FCF4E8; }

/* ============================================================
   Signed in: shell
   ============================================================ */
body.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  grid-template-rows: var(--bar-h) 1fr;
  grid-template-areas: "bar bar" "rail content";
  min-height: 100vh;
}

.topbar {
  grid-area: bar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand img { height: 26px; width: auto; display: block; }
.who { display: flex; align-items: center; gap: 1rem; font-size: .875rem; }
.who-name { color: var(--muted); }
form.inline { display: inline; margin: 0; }

.rail {
  grid-area: rail;
  display: flex;
  flex-direction: column;
  padding: 1rem .625rem;
  gap: .125rem;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.rail a {
  padding: .5rem .75rem;
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: .9375rem;
}
.rail a:hover { background: var(--wash); }
.rail a.on { background: var(--green-wash); color: var(--green-dark); }

.content { grid-area: content; padding: 1.75rem 1.75rem 4rem; }
.content > header { margin-bottom: 1.5rem; }

/* ---------- panels and tables ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
th {
  text-align: left;
  font-weight: 600;
  font-size: .8125rem;
  color: var(--muted);
  padding: .5rem .625rem;
  border-bottom: 1px solid var(--line);
}
td { padding: .6875rem .625rem; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty { color: var(--muted); padding: 2rem 0; }
.empty p { margin-bottom: 1rem; }

/* ---------- mobile: rail becomes a bottom bar ---------- */
@media (max-width: 760px) {
  body.app {
    grid-template-columns: 1fr;
    grid-template-rows: var(--bar-h) 1fr auto;
    grid-template-areas: "bar" "content" "rail";
  }
  .rail {
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-top: 1px solid var(--line);
    position: sticky;
    bottom: 0;
    padding: .5rem;
  }
  .rail a { white-space: nowrap; }
  .content { padding: 1.25rem 1rem 2rem; }
  .gate { padding-top: 3rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ============================================================
   Page furniture
   ============================================================ */
.pagehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.pagehead h1 { margin: 0; }
.headactions { display: flex; gap: .5rem; }

.subtle { color: var(--muted); }
.hint { color: var(--muted); font-size: .8125rem; margin: .375rem 0 0; }
.spaced { margin-top: 1rem; }
ul.tight { margin: .5rem 0 .5rem 1.125rem; padding: 0; }

.filters {
  display: flex;
  gap: .625rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.filters input[type=search], .filters input[type=text] { flex: 1 1 15rem; max-width: 22rem; }
.filters select { flex: 0 1 12rem; }

.row2, .row3 { display: grid; gap: 1rem; }
.row2 { grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 2fr 1fr 1fr; }

.choice { display: flex; gap: 1.25rem; }
label.opt {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1rem;
  font-weight: 400;
  color: var(--ink);
  margin: 0 0 .25rem;
  cursor: pointer;
}
label.opt input { width: auto; margin: 0; }

.actions { display: flex; gap: .625rem; align-items: center; margin-bottom: 3rem; }

.rowform { display: flex; gap: .5rem; align-items: center; }
.rowform input { max-width: 18rem; }

.pager { display: flex; gap: .375rem; margin-bottom: 2rem; }
.pager a {
  padding: .375rem .625rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  font-size: .875rem;
}
.pager a.on { background: var(--green); border-color: var(--green); color: #fff; }

/* ---------- catalogue grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(224px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.shot {
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wash);
  border-bottom: 1px solid var(--line);
}
.shot img { width: 100%; height: 100%; object-fit: contain; }
.shot.standalone {
  aspect-ratio: auto;
  max-width: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .5rem;
}
.noshot { color: var(--idle); font-size: .8125rem; }
.cardbody { padding: .875rem; }
.cardbody h3 { font-size: 1rem; margin-bottom: .25rem; }
.cardbody h3 a { text-decoration: none; color: var(--ink); }
.cardbody h3 a:hover { color: var(--green-dark); }
.meta { color: var(--muted); font-size: .8125rem; margin-bottom: .5rem; }
.price { font-weight: 600; font-variant-numeric: tabular-nums; }
.price .per { font-weight: 400; font-size: .8125rem; color: var(--muted); margin-left: .25rem; }

@media (max-width: 760px) {
  .row2, .row3 { grid-template-columns: 1fr; }
  .pagehead { align-items: flex-start; }
  .filters input[type=search] { max-width: none; }
}

/* ============================================================
   Quotes
   ============================================================ */
.lines th:first-child, .lines td:first-child { width: 56px; }
.thumbcell img {
  width: 44px; height: 44px;
  object-fit: contain;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: block;
}
.qty { width: 5.5rem; text-align: right; }

.tag {
  display: inline-block;
  margin-left: .5rem;
  padding: .0625rem .375rem;
  font-size: .75rem;
  color: var(--green-dark);
  background: var(--green-wash);
  border-radius: 2px;
}

.addrow { display: flex; gap: .5rem; margin-top: .75rem; }
.addrow .qty { flex: 0 0 4.5rem; }
.addrow button { flex: 1; }

.totals table { max-width: 26rem; }
.totals .grand td {
  font-weight: 600;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.factgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .875rem 1.5rem;
}
.factlabel {
  display: block;
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: .125rem;
}

@media (max-width: 760px) {
  .lines th:first-child, .lines td:first-child { display: none; }
  .totals table { max-width: none; }
}

/* ---------- one-time credential display ---------- */
.credential {
  display: inline-block;
  margin: .5rem 0;
  padding: .5rem .75rem;
  font-family: 'Consolas', 'SF Mono', ui-monospace, monospace;
  font-size: 1.0625rem;
  letter-spacing: .04em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  user-select: all;
}

/* ---------- dashboard tiles ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.tilelabel { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tilevalue { font-size: 1.75rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tilenote  { font-size: .8125rem; color: var(--muted); }

/* ---------- report furniture ---------- */
.inline-field { margin-bottom: 0; }
.inline-field input, .inline-field select { min-width: 9rem; }

.quickrange { display: flex; gap: 1rem; margin-bottom: 1.25rem; font-size: .875rem; }

tfoot .grand td {
  font-weight: 600;
  border-top: 2px solid var(--line);
  border-bottom: 0;
  padding-top: .75rem;
}
