/* Order board. Built for a phone held in the workshop: big touch targets, strong contrast,
   and columns that scroll sideways rather than being squeezed onto the screen width. */
:root {
  --bg: #14171a;
  --surface: #1d2126;
  --card: #262b31;
  --line: #333a42;
  --text: #e8eaed;
  --muted: #9aa4af;
  --accent: #2b7a4b;
  --accent-light: #3fa46a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}

header h1 { font-size: 1.05rem; margin: 0 0 8px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select, .filters input {
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 15px;
}
.filters input { flex: 1; min-width: 120px; }

button {
  font: inherit; border-radius: 6px; padding: 8px 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
}
button.primary { background: var(--accent); border-color: var(--accent-light); color: #fff; font-weight: 600; }
button.secondary { background: transparent; }
button[disabled] { opacity: 0.6; cursor: default; }

/* Columns run sideways, each a fixed width -- on a phone you swipe between them. */
.board {
  display: flex; gap: 12px; padding: 12px;
  overflow-x: auto; align-items: flex-start;
  scroll-snap-type: x proximity;
}
.column {
  flex: 0 0 270px; scroll-snap-align: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px;
}
.column h2 {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); margin: 0 0 10px; display: flex; justify-content: space-between;
}
.count { background: var(--card); border-radius: 10px; padding: 0 8px; color: var(--text); }
.cards { display: flex; flex-direction: column; gap: 8px; }
.empty { color: var(--line); text-align: center; margin: 6px 0; }

.card {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--muted);
  border-radius: 8px; padding: 10px; cursor: pointer;
}
.card:active { transform: scale(0.99); }
.cat-doors { border-left-color: #3fa46a; }
.cat-sliding { border-left-color: #4a8fd4; }
.cat-windows { border-left-color: #c9a227; }
.cat-other { border-left-color: #8b6bb1; }

.job-no { font-weight: 600; font-size: 0.85rem; }
.client { color: var(--text); margin-top: 2px; }
.meta {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-top: 8px; font-size: 0.75rem; color: var(--muted);
}
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1px 8px; }

/* Detail. Slides up from the bottom on a phone, sits at the right edge on a wide screen. */
.panel {
  position: fixed; z-index: 20; background: var(--surface);
  border: 1px solid var(--line); padding: 16px; overflow-y: auto;
  inset: auto 0 0 0; max-height: 85vh; border-radius: 14px 14px 0 0;
}
@media (min-width: 760px) {
  .panel { inset: 0 0 0 auto; width: 400px; max-height: none; border-radius: 0; }
}
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 15; }
.close {
  float: right; border: none; background: transparent; color: var(--muted);
  font-size: 1.6rem; line-height: 1; padding: 0 6px;
}
.panel h2 { margin: 0; font-size: 1rem; }
.panel h3 { font-size: 0.78rem; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; }
.panel dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 12px 0; }
.panel dt { color: var(--muted); font-size: 0.85rem; }
.panel dd { margin: 0; text-align: right; }

.row { display: flex; gap: 8px; align-items: center; }
.row input[type="date"] { flex: 1; }

.links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.links a { color: var(--accent-light); }

.stages { display: flex; flex-direction: column; gap: 6px; }
.stage { text-align: left; }
.stage.current { background: var(--accent); border-color: var(--accent-light); font-weight: 600; }

.panel textarea, .panel input[type="date"], dialog textarea, dialog input, dialog select {
  width: 100%; background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px; font: inherit;
}
.history { list-style: none; padding: 0; margin: 0; font-size: 0.8rem; color: var(--muted); }
.history li { padding: 3px 0; border-bottom: 1px solid var(--line); }

dialog {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 18px; width: min(92vw, 420px);
}
dialog::backdrop { background: rgba(0,0,0,0.6); }
dialog h2 { margin: 0 0 12px; font-size: 1rem; }
dialog label { display: block; margin-bottom: 10px; font-size: 0.85rem; color: var(--muted); }
dialog menu { display: flex; gap: 8px; justify-content: flex-end; padding: 0; margin: 14px 0 0; }

/* Who is using the board, top right. */
header h1 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.who { font-size: 0.8rem; font-weight: normal; color: var(--muted); }
button.scan { font-weight: 600; }

/* Scanner: the camera fills the dialog, with a frame to aim the code into. */
.scanner video { width: 100%; border-radius: 8px; background: #000; display: block; }
.scanner .status { margin: 10px 0 0; color: var(--muted); min-height: 1.4em; }

/* Phones list and pairing code. */
.devices { list-style: none; padding: 0; margin: 0 0 12px; }
.devices li { display: flex; justify-content: space-between; align-items: center; gap: 8px;
              padding: 8px 0; border-bottom: 1px solid var(--line); }
.devices small { display: block; color: var(--muted); font-size: 0.75rem; }
.pair-code { background: #fff; padding: 10px; border-radius: 8px; max-width: 260px; margin: 10px auto; }
.pair-code svg { display: block; width: 100%; height: auto; }
.hint { color: var(--muted); font-size: 0.8rem; }
.note-text { white-space: pre-wrap; color: var(--text); margin: 0; }

/* Sign-in page. */
.login { max-width: 360px; margin: 12vh auto; padding: 0 16px; }
.login h1 { font-size: 1.2rem; }
.login label { display: block; margin-bottom: 12px; font-size: 0.85rem; color: var(--muted); }
.login input {
  display: block; width: 100%; margin-top: 4px; background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; padding: 10px; font: inherit;
}
.login button { width: 100%; padding: 10px; }
.error { color: #e57373; }

/* Photos and files on an order. */
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.file { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
        background: var(--card); min-height: 84px; display: flex; }
.file a { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text);
          text-decoration: none; font-size: 0.75rem; padding: 6px; word-break: break-all; text-align: center; }
.file.img a { padding: 0; aspect-ratio: 1; }
.file img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file .remove { position: absolute; top: 2px; right: 2px; padding: 0 7px; border: none;
                background: rgba(0,0,0,0.65); color: #fff; font-size: 0.9rem; }
.file .remove.sure { background: #b3261e; font-size: 0.7rem; }
.empty-files { color: var(--muted); font-size: 0.85rem; margin: 0; grid-column: 1 / -1; }
.add-files { margin-top: 8px; }
.filebtn { flex: 1; text-align: center; cursor: pointer; border: 1px solid var(--line); border-radius: 6px;
           padding: 10px 8px; background: var(--card); color: var(--text); font-size: 0.9rem; margin: 0 !important; }
.filebtn input { display: none; }
dialog .field { margin-bottom: 10px; font-size: 0.85rem; color: var(--muted); }
.new-files { list-style: none; padding: 0; margin: 6px 0 0; color: var(--text); font-size: 0.85rem; }
.new-files li { display: flex; justify-content: space-between; align-items: center; padding: 3px 0;
                border-bottom: 1px solid var(--line); word-break: break-all; }
.new-files button { padding: 0 8px; }

/* Log of stage moves. */
dialog.log { width: min(94vw, 520px); }
.log .row select { flex: 1; background: var(--card); color: var(--text); border: 1px solid var(--line);
                   border-radius: 6px; padding: 8px; font: inherit; }
.log-list { max-height: 60vh; overflow-y: auto; }
.log-list h3 { font-size: 0.75rem; text-transform: uppercase; color: var(--muted); margin: 12px 0 4px; }
.log-row { display: flex; gap: 10px; width: 100%; text-align: left; background: transparent; border: none;
           border-bottom: 1px solid var(--line); border-radius: 0; padding: 8px 2px; }
.log-row .t { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 42px; }
.log-row small { color: var(--muted); }

/* Archive / deleted list, and removing an order. */
.column.wide { flex: 1 1 auto; max-width: 640px; }
.banner { background: var(--card); border: 1px solid var(--line); border-left: 3px solid #c9a227;
          border-radius: 6px; padding: 8px 10px; margin: 0 0 12px; font-size: 0.85rem; }
.remove-job { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line); }
button.danger { background: transparent; border-color: #b3261e; color: #f28b82; width: 100%; }

/* Back to home.timbwindoor.com, all the apps. */
.homebtn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin-right: 4px;
           border-radius: 6px; border: 1px solid var(--line); color: var(--text); vertical-align: middle; }

/* Adding a phone: name and what it may do. */
.pair-form { display: flex; flex-direction: column; gap: 8px; }
.pair-form input[name=name] { width: 100%; background: var(--card); color: var(--text); border: 1px solid var(--line);
                              border-radius: 6px; padding: 8px; font: inherit; }
.seg { display: flex; gap: 8px; }
.seg label { flex: 1; margin: 0; cursor: pointer; }
.seg input { display: none; }
.seg span { display: block; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--text); }
.seg small { display: block; color: var(--muted); font-size: .72rem; }
.seg input:checked + span { border-color: var(--accent-light); background: color-mix(in srgb, var(--accent) 35%, var(--card)); }
.devices select { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px; font: inherit; }
.devices li > span { flex: 1; }
[hidden] { display: none !important; }
