/* Braille Sign Supplies brand tokens */
:root {
  --blue: #0A6FC2;
  --blue-hi: #148EFD;
  --blue-tint: #E8F2FB;
  --black: #0D0D0D;
  --panel: #3D3D3D;
  --ink: #2B2E31;
  --muted: #6E6E6E;
  --line: #E7E9EB;
  --paper: #F7F7F5;
  --white: #FFFFFF;
  /* status colours (functional, not brand) */
  --red: #B42318;  --red-bg: #FDECEA;
  --amber: #8A5300; --amber-bg: #FFF4DE;
  --green: #1E6B35; --green-bg: #E6F4EA;
  --radius: 10px;
  --font: "Inter", "Segoe UI", Calibri, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  font-feature-settings: "tnum" 1, "cv11" 1;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue-hi); outline-offset: 2px; }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--white); color: var(--ink);
  padding: 12px 28px;
  border-bottom: 4px solid var(--blue);
}
.brand { display: flex; align-items: center; gap: 18px; }
.logo { height: 60px; width: auto; display: block; }
.eyebrow { display: block; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.topbar h1 { padding-left: 18px; border-left: 2px solid var(--line); color: var(--ink); }
.sync { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sync form { margin: 0; }
.sync-status { font-size: 14px; color: var(--muted); }
.sync-status::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #4CC37A; margin-right: 8px; vertical-align: 1px; }
.sync-status.stale::before { background: #F5B740; }
.sync-status.err::before { background: #FF6B5E; }

.btn { border: 1px solid transparent; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 14px; }
.btn-ghost { background: var(--white); border-color: #CBD0D5; color: var(--ink); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }

main { padding: 24px 28px 48px; max-width: 1880px; margin: 0 auto; }

/* ---- Board tabs ---- */
.tabs { display: flex; gap: 4px; padding: 0 28px; background: var(--white); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 14px 18px 12px; white-space: nowrap;
  font-weight: 700; font-size: 15px; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--blue); border-bottom-color: var(--blue); }
.tab-count { background: #EEF0F2; color: #4A4F54; border-radius: 999px; padding: 1px 9px; font-size: 13px; }
.tab[aria-current="page"] .tab-count { background: var(--blue-tint); color: var(--blue); }

/* Design tab: shipping columns aren't relevant yet */
.jobs.design-mode .ship-col { display: none; }

/* ---- Material chips (process colours, agreed with the team) ---- */
.mat { display: inline-block; border-radius: 6px; padding: 3px 9px; margin: 0 4px 4px 0; font-size: 13px; font-weight: 700; color: #FFFFFF; white-space: nowrap; }
.mat-tactile { background: #1D4ED8; }
.mat-brailleface { background: #C62828; }
.mat-moulded { background: #0D0D0D; }
.mat-uv { background: #2E7D32; }
.mat-other { background: #E7E9EB; color: var(--ink); }

/* ---- KPI tiles ---- */
.kpis { display: grid; grid-template-columns: repeat(var(--tiles, 6), minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.kpi:hover { border-color: var(--blue); }
.kpi[aria-pressed="true"] { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 32px; font-weight: 700; line-height: 1.15; color: var(--ink); }
.kpi.alert .value { color: var(--red); }
.kpi.good .value { color: var(--green); }

/* ---- Toolbar ---- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--white); border-radius: 999px;
  padding: 7px 14px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink);
}
.chip:hover { border-color: var(--blue); }
.chip[aria-selected="true"] { background: var(--blue); border-color: var(--blue); color: var(--white); }
.chip .count { opacity: .75; margin-left: 4px; font-weight: 500; }
.toolbar-right { display: flex; gap: 10px; flex-wrap: wrap; }
.field select, .field input {
  border: 1px solid #CBD0D5; background: var(--white); border-radius: 8px; padding: 8px 12px; min-height: 40px;
}
.search input { width: 300px; max-width: 100%; }

.banner { background: var(--amber-bg); color: var(--amber); border: 1px solid #F1D49A; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }

/* ---- Job table ---- */
.board { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.jobs { width: 100%; border-collapse: collapse; min-width: 1500px; }
.jobs th {
  position: sticky; top: 0; z-index: 1;
  background: var(--white); text-align: left; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 12px 12px; border-bottom: 2px solid var(--line); white-space: nowrap;
}
.jobs td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 15px; }
.jobs tbody tr:nth-child(even) td { background: #FBFBFA; }
.jobs tbody tr:hover td { background: var(--blue-tint); }
.jobs tr.overdue td:first-child { box-shadow: inset 4px 0 0 var(--red); }
.jobs tr.today td:first-child { box-shadow: inset 4px 0 0 var(--amber); }
.num { text-align: right; }

.jobno { font-weight: 700; color: var(--blue); white-space: nowrap; }
.sub { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.cust { font-weight: 600; min-width: 160px; max-width: 220px; }
.qty { font-weight: 700; font-size: 18px; text-align: right; white-space: nowrap; }

/* Due column */
.due { white-space: nowrap; min-width: 150px; }
.due-date { font-weight: 700; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 700; line-height: 1.6; white-space: nowrap; }
.b-red { background: var(--red-bg); color: var(--red); }
.b-amber { background: var(--amber-bg); color: var(--amber); }
.b-green { background: var(--green-bg); color: var(--green); }
.b-grey { background: #EEF0F2; color: #4A4F54; }
.b-blue { background: var(--blue-tint); color: var(--blue); }

.toggle {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
  border: 1px dashed #B9C0C6; background: var(--white); border-radius: 999px; padding: 3px 10px;
  font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer;
}
.toggle[aria-pressed="true"] { border: 1px solid var(--green); background: var(--green-bg); color: var(--green); }
.toggle:hover { border-color: var(--blue); }

/* Production */
.prod { min-width: 190px; }
.stage { font-weight: 600; }
.stage .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--blue-hi); margin-right: 6px; vertical-align: 1px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.bar { display: flex; gap: 3px; margin-top: 6px; }
.bar span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.bar span.done { background: var(--blue); }
.bar span.active { background: var(--blue-hi); }
.bar span.blocked { background: var(--red); }
.bar-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

.material { font-weight: 600; min-width: 110px; }

/* Inline editors */
.pill-select {
  appearance: none; -webkit-appearance: none;
  border: 1px solid #CBD0D5; border-radius: 8px; background: var(--white)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236E6E6E' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") no-repeat right 10px center;
  padding: 6px 28px 6px 10px; font-size: 14px; font-weight: 600; cursor: pointer; min-width: 150px;
}
.pill-select:hover { border-color: var(--blue); }
.pill-select.yes { background-color: var(--green-bg); border-color: #9CCFAB; color: var(--green); }
.pill-select.no { background-color: #F3F4F5; color: #4A4F54; }
.pill-select.unset { color: var(--muted); border-style: dashed; }
.auto-tag { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

.note {
  width: 100%; min-width: 200px; min-height: 40px; resize: vertical;
  border: 1px solid transparent; border-radius: 8px; background: transparent; padding: 6px 8px; font-size: 14px; line-height: 1.4;
}
.note:hover { border-color: var(--line); background: var(--white); }
.note:focus { border-color: var(--blue); background: var(--white); outline: none; box-shadow: 0 0 0 3px rgba(10,111,194,.15); }
.note::placeholder { color: #A3A9AE; }
.saved { font-size: 12px; color: var(--green); font-weight: 600; height: 16px; display: block; padding-left: 8px; }
.saved.err { color: var(--red); }
.signos-notes { margin: 4px 0 0; padding: 0 8px; list-style: none; font-size: 13px; color: var(--muted); }
.signos-notes li::before { content: "SignOS · "; font-weight: 600; color: #8A9096; }

.empty { padding: 40px; text-align: center; color: var(--muted); margin: 0; }

/* ---- Narrow screens: cards ---- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar, main, .tabs { padding-left: 16px; padding-right: 16px; }
  .board { background: transparent; border: 0; overflow: visible; }
  .jobs { min-width: 0; }
  .jobs thead { display: none; }
  .jobs, .jobs tbody { display: block; }
  .jobs tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
  .jobs tr.overdue { border-left: 4px solid var(--red); }
  .jobs tr.today { border-left: 4px solid var(--amber); }
  .jobs td, .jobs tbody tr:nth-child(even) td, .jobs tbody tr:hover td { display: block; padding: 0; border: 0; background: none; box-shadow: none !important; }
  .jobs td::before { content: attr(data-label); display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
  .jobs td.wide { grid-column: 1 / -1; }
  .qty { text-align: left; }
  .cust { max-width: none; }
}
@media (max-width: 600px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .value { font-size: 26px; }
  .jobs tr { grid-template-columns: 1fr; }
  .search input { width: 100%; }
  .toolbar-right, .toolbar-right .field { width: 100%; }
}
