/* Backworth Skip Hire office dashboard.
   Palette tokens from the validated reference instance; status colours are the
   reserved four and always ship with a text label, never colour alone. */
/* Light only. The office uses this on a tablet in daylight, so the dark
   variants are deliberately not shipped. */
:root {
  color-scheme: light only;
  --surface-1: #fcfcfb;
  --plane:     #f9f9f7;
  --ink:       #0b0b0b;
  --ink-2:     #52514e;
  --muted:     #898781;
  --grid:      #e1e0d9;
  --axis:      #c3c2b7;
  --border:    rgba(11,11,11,0.10);
  --good:      #0ca30c;
  --warning:   #fab219;
  --serious:   #ec835a;
  --critical:  #d03b3b;
  --good-ink:  #006300;
  --brand:     #2a78d6;
  --brand-soft:#cde2fb;
  /* conversation: two clearly different washes so you can skim who said what */
  --them-wash:  #fdf1e9;   /* customer */
  --them-edge:  #eb6834;
  --us-wash:    #e9f1fd;   /* our reply */
  --us-edge:    #2a78d6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(11,11,11,0.05), 0 4px 14px rgba(11,11,11,0.04);
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--plane); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

header.top {
  background: var(--surface-1); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.top-in {
  max-width: 1240px; margin: 0 auto; padding: 12px 18px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand span { color: var(--muted); font-weight: 500; }
nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
nav a, .btn, button.btn {
  padding: 7px 13px; border-radius: 8px; color: var(--ink-2);
  font-size: 14px; font-weight: 550; border: 1px solid transparent;
  background: transparent; cursor: pointer;
}
nav a:hover, .btn:hover { background: var(--plane); text-decoration: none; }
nav a.on { background: var(--brand-soft); color: var(--brand); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.08); background: var(--brand); }
.btn.line { border-color: var(--border); }

main { max-width: 1240px; margin: 0 auto; padding: 20px 18px 64px; }
h1 { font-size: 24px; margin: 4px 0 2px; letter-spacing: -0.02em; }
h2 { font-size: 15px; margin: 26px 0 10px; text-transform: uppercase;
     letter-spacing: 0.06em; color: var(--muted); font-weight: 650; }
h3 { font-size: 16px; margin: 0 0 6px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 14px; }

.card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.pad { padding: 16px 18px; }

/* stat tiles */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.tile { background: var(--surface-1); border: 1px solid var(--border);
        border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile .label { font-size: 13px; color: var(--muted); font-weight: 550; }
.tile .value { font-size: 30px; font-weight: 680; letter-spacing: -0.03em; margin-top: 2px; }
.tile .foot { font-size: 12.5px; color: var(--muted); }

/* status pills — colour plus a written label, never colour alone */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  font-weight: 600; padding: 3px 9px 3px 7px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--plane); color: var(--ink-2);
  white-space: nowrap;
}
.pill .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--muted); flex: none; }
.pill.good .dot { background: var(--good); }
.pill.warn .dot { background: var(--warning); }
.pill.bad  .dot { background: var(--critical); }
.pill.muted .dot { background: var(--axis); }
.pill.flag { border-color: var(--critical); color: var(--critical); }

.money { font-variant-numeric: tabular-nums; font-weight: 620; }

/* job rows */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex; gap: 14px; align-items: center; padding: 12px 16px;
  border-top: 1px solid var(--grid); text-decoration: none; color: inherit;
}
.rows .row:first-child { border-top: none; }
.row:hover { background: var(--plane); text-decoration: none; }
.row .size {
  flex: none; width: 52px; height: 52px; border-radius: 9px;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
  line-height: 1; text-align: center;
}
.row .size small { display: block; font-size: 10px; font-weight: 600; opacity: .8; }
.row .main { min-width: 0; flex: 1; }
.row .name { font-weight: 620; }
.row .meta { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.row .right { margin-left: auto; text-align: right; flex: none;
              display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.empty { padding: 22px 16px; color: var(--muted); font-size: 14px; }

/* calendar */
.cal { width: 100%; border-collapse: separate; border-spacing: 0;
       background: var(--surface-1); border: 1px solid var(--border);
       border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cal th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
          color: var(--muted); font-weight: 650; padding: 10px 8px; text-align: left;
          border-bottom: 1px solid var(--grid); }
.cal td { vertical-align: top; width: 14.28%; height: 118px; padding: 0;
          border-top: 1px solid var(--grid); border-left: 1px solid var(--grid); }
.cal td:first-child { border-left: none; }
.cal td a { display: block; height: 100%; padding: 7px 9px; color: inherit; }
.cal td a:hover { background: var(--plane); text-decoration: none; }
.cal .dnum { font-size: 13px; font-weight: 620; color: var(--ink-2); }
.cal .out .dnum { color: var(--axis); }
.cal .today { background: var(--brand-soft); }
.cal .today .dnum { color: var(--brand); }
.cal .chip { display: block; font-size: 12.5px; font-weight: 600; margin-top: 4px;
             padding: 2px 6px; border-radius: 6px; background: var(--plane);
             border: 1px solid var(--border); }
.cal .collect { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.cal .unpaid { font-size: 11.5px; color: var(--critical); font-weight: 600; margin-top: 3px; }

/* detail */
.grid2 { display: grid; gap: 16px; grid-template-columns: 1.6fr 1fr; align-items: start; }
dl.kv { margin: 0; display: grid; grid-template-columns: minmax(120px,38%) 1fr; gap: 8px 14px; }
dl.kv dt { color: var(--muted); font-size: 13.5px; }
dl.kv dd { margin: 0; font-size: 14.5px; overflow-wrap: anywhere; }
dl.kv dd.miss { color: var(--critical); font-weight: 600; }

.msg { border-top: 1px solid var(--grid); padding: 14px 18px 14px 20px;
       border-left: 4px solid transparent; }
.msg:first-child { border-top: none; }
.msg .who { font-size: 13px; color: var(--ink-2); margin-bottom: 8px; font-weight: 620;
            display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.msg .who .stamp { font-weight: 500; color: var(--muted); }
.msg pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere;
           font: inherit; font-size: 14.5px; }
.msg.in  { background: var(--them-wash); border-left-color: var(--them-edge); }
.msg.out { background: var(--us-wash);   border-left-color: var(--us-edge); }
.msg .who .tag { display: inline-flex; align-items: center; gap: 6px;
                 padding: 2px 9px; border-radius: 999px; font-size: 12.5px;
                 border: 1px solid var(--border); background: var(--surface-1); }
.msg.in  .who .tag { color: #a8471c; border-color: #f0c3a9; }
.msg.out .who .tag { color: #1c5cab; border-color: #b7d3f6; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 10px;
          font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend i.them { background: var(--them-wash); border: 2px solid var(--them-edge); }
.legend i.us   { background: var(--us-wash);   border: 2px solid var(--us-edge); }

/* quick job actions */
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.btn.big { padding: 10px 16px; font-size: 14.5px; }

table.plain { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.plain th { text-align: left; color: var(--muted); font-size: 12.5px;
                 text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px;
                 border-bottom: 1px solid var(--grid); }
table.plain td { padding: 10px; border-bottom: 1px solid var(--grid); }
table.plain td.num { font-variant-numeric: tabular-nums; text-align: right; }

input[type=text], input[type=password], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px; font: inherit;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
form.inline { display: inline-flex; gap: 8px; align-items: center; }
.banner { padding: 10px 14px; border-radius: 8px; font-size: 14px; font-weight: 550;
          border: 1px solid var(--border); margin-bottom: 14px; }
.banner.warn { border-color: var(--warning); }
.banner.bad { border-color: var(--critical); color: var(--critical); }

@media (max-width: 880px) {
  .grid2 { grid-template-columns: 1fr; }
  .cal td { height: auto; min-height: 84px; }
  .row .right { align-items: flex-end; }
}
@media (max-width: 560px) {
  main { padding: 14px 12px 60px; }
  .row { padding: 10px 12px; gap: 10px; }
  .cal th:nth-child(n+6), .cal td:nth-child(n+6) { }
  .tile .value { font-size: 26px; }
}

/* ---------- headline strip ---------- */
.headline {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; margin-bottom: 14px;
}
.headline .big { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.headline .cell { display: flex; flex-direction: column; gap: 3px; padding-right: 18px;
                  border-right: 1px solid var(--grid); min-width: 108px; }
.headline .cell:last-child { border-right: none; padding-right: 0; }
.headline .cap { font-size: 12.5px; color: var(--muted); font-weight: 600;
                 text-transform: uppercase; letter-spacing: .05em; }
.headline .big.good { color: var(--good-ink); }
.headline .big.bad  { color: var(--critical); }

/* ---------- tab bar ---------- */
.tabs {
  display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 12px;
  position: sticky; top: 57px; z-index: 10;
  background: var(--plane); padding: 8px 0;
}
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 15px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-1);
  color: var(--ink-2); font-size: 14.5px; font-weight: 600;
  font-family: inherit; line-height: 1.2;
}
.tab:hover { background: var(--plane); }
.tab .n {
  min-width: 22px; padding: 1px 7px; border-radius: 999px; font-size: 12.5px;
  background: var(--plane); color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.tab[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.tab[aria-selected="true"] .n { background: rgba(255,255,255,0.22); color: #fff; }
.tab.alert { border-color: var(--critical); color: var(--critical); }
.tab.alert .n { background: var(--critical); color: #fff; }
.tab.alert[aria-selected="true"] { background: var(--critical); border-color: var(--critical); color: #fff; }
.panel[hidden] { display: none; }

/* ---------- denser, scannable rows ---------- */
.row .tick { flex: none; width: 20px; height: 20px; border-radius: 999px;
             display: grid; place-items: center; font-size: 12px; font-weight: 800;
             background: var(--good); color: #fff; }
.row .ref { font-variant-numeric: tabular-nums; color: var(--muted);
            font-size: 12.5px; font-weight: 600; }
.row .when { font-size: 13px; font-weight: 620; color: var(--ink-2); white-space: nowrap; }


/* ---------- delete control on a job row ---------- */
.row-wrap { position: relative; border-top: 1px solid var(--grid); }
.rows .row-wrap:first-child { border-top: none; }
.row-wrap .row { border-top: none; padding-right: 58px; }
.row-del {
  position: absolute; top: 10px; right: 12px; z-index: 2;
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  display: grid; place-items: center; line-height: 1;
  border: 1px solid var(--critical); background: var(--surface-1);
  color: var(--critical); font-size: 17px; font-weight: 800; font-family: inherit;
  padding: 0;
}
.row-del:hover { background: var(--critical); border-color: var(--critical); color: #fff; }

/* a quiet note that the page refreshes itself */
.live { font-size: 12.5px; color: var(--muted); }
.live .dot-live { display: inline-block; width: 7px; height: 7px; border-radius: 999px;
                  background: var(--good); margin-right: 6px; vertical-align: 1px; }
