/* BdRBuild app styles, on top of the fleet palette in shared/bdr.css. */
body { padding: 16px 16px 64px; }
main { max-width: 1200px; margin: 0 auto; }
.site-header, .topnav { max-width: 1200px; margin-left: auto; margin-right: auto; }
.site-header { margin-bottom: 12px; }
h1 { font-size: 1.5em; margin: 0 0 .25rem; }
h3.sub { font-size: 13px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 8px; }
.dim { color: var(--text-dim); }
.small { font-size: 12px; }
.pre { white-space: pre-wrap; margin: .3em 0; }
.empty { color: var(--text-dim); padding: 8px 0; }
.card { margin-bottom: 16px; padding: 16px; }
.card.empty { padding: 20px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.bad { color: var(--error); }
.good { color: var(--good); }
.pending { color: var(--pending); }
.warn { color: var(--pending); border: 1px solid #eab30855; background: #eab30814; border-radius: 8px; padding: 8px 12px; }

/* buttons + links that look like buttons */
button, a.button {
  min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; font: inherit; cursor: pointer; border-radius: 6px; padding: 8px 14px;
  border: 1px solid var(--card-border); background: transparent; color: var(--text);
}
a.button:hover { border-color: var(--text-dim); }
a.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.small, a.small.button { min-height: 32px; padding: 4px 10px; font-size: 13px; }
button.big { min-height: 48px; padding: 10px 22px; font-size: 16px; }
button.danger { border-color: #f8717166; color: var(--error); }
button.danger:hover { border-color: var(--error); }
button.icon { min-height: 32px; min-width: 32px; padding: 0 6px; }
button.link { border: none; color: var(--accent); padding: 0 4px; min-height: 0; }
button.on { border-color: var(--good); color: var(--good); }
button:disabled { opacity: .45; cursor: default; }

/* inputs */
input, select, textarea {
  font: inherit; color: var(--text); background: #0b0d11; border: 1px solid var(--card-border);
  border-radius: 6px; padding: 8px 10px; min-height: 40px; width: 100%;
}
textarea { resize: vertical; min-height: 60px; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; }
.row2, .row3 { display: grid; gap: 0 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.actions.left { justify-content: flex-start; }
.form { max-width: 720px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; }
label.inline input { width: 90px; }

/* top nav */
.topnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--card-border); padding-bottom: 8px; }
.topnav a { color: var(--text-dim); text-decoration: none; padding: 8px 12px; border-radius: 6px; font-weight: 600; }
.topnav a.on { color: var(--text); background: var(--card); }
.topnav .who { font-size: 12px; margin-right: 6px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.signin { max-width: 520px; margin: 40px auto; text-align: center; }

/* chips + pills + badges */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 32px; padding: 4px 10px; font-size: 12px; border-radius: 16px; color: var(--text-dim); }
.chip.on { border-color: var(--accent); color: var(--text); background: #4f8cff22; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--card-border); color: var(--text-dim); white-space: nowrap; }
.badge { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.badge.bad { background: #f8717122; color: var(--error); }
.badge.pending { background: #eab30822; color: var(--pending); }
/* status colours: green good, amber in progress/pending, red bad, grey n/a */
.ps-done, .st-received { color: var(--good) !important; border-color: #22c55e66 !important; }
.ps-inprogress, .st-ordered, .st-incart { color: var(--pending) !important; border-color: #eab30866 !important; }
.ps-blocked { color: var(--error) !important; border-color: #f8717166 !important; }
.st-quoted { color: var(--accent) !important; border-color: #4f8cff66 !important; }

/* tables (fleet: collapsed borders, ~13px, uppercase muted headers, own scroller) */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
.grid th { text-align: left; font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--card-border); white-space: nowrap; }
.grid td { padding: 6px 8px; border-bottom: 1px solid var(--card-border); vertical-align: top; }
.grid td input, .grid td select, .grid td textarea { min-width: 90px; padding: 6px 8px; min-height: 36px; }
.grid tr.overdue td { background: #f871710d; }
.grid tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--error); }
.grid tr.done td { color: var(--text-dim); }
.et-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.et-head h2 { margin: 0; }
.et-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hint { font-size: 12px; margin: 6px 0 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.filters select { width: auto; max-width: 100%; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; cursor: pointer; }
.big-photo { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; }

/* overview cards */
.build-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.build-card { display: block; background: var(--card); border: 1px solid var(--card-border); border-left: 4px solid var(--text-dim); border-radius: 10px; padding: 14px; color: var(--text); text-decoration: none; }
.build-card:hover { border-color: var(--text-dim); }
.build-card.status-active { border-left-color: var(--good); }
.build-card.status-planning { border-left-color: var(--accent); }
.build-card.status-onhold { border-left-color: var(--pending); }
.bc-top { display: flex; justify-content: space-between; gap: 8px; font-size: 16px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 4px 0; }
.build-card dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 8px 0 0; font-size: 13px; }
.build-card dt { color: var(--text-dim); }
.build-card dd { margin: 0; }
.bar { height: 6px; border-radius: 3px; background: var(--card-border); margin-top: 10px; overflow: hidden; }
.bar.big { height: 10px; margin: 4px 0 16px; }
.bar span { display: block; height: 100%; background: var(--good); }
.bar.over span { background: var(--error); }

/* build page */
.build-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.build-head a { text-decoration: none; }
.head-actions { display: flex; gap: 8px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; margin: 12px 0 16px; border-bottom: 1px solid var(--card-border); scrollbar-width: thin; }
.tabs a { padding: 10px 14px; color: var(--text-dim); text-decoration: none; font-weight: 600; white-space: nowrap; border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.subnav a { padding: 6px 12px; border: 1px solid var(--card-border); border-radius: 16px; text-decoration: none; color: var(--text-dim); font-size: 13px; }
.subnav a.on { background: var(--card); color: var(--text); border-color: var(--accent); }
.stale-note { font-size: 13px; }
.section-title { margin: 20px 0 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--card-border); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.tile b { font-size: 20px; }
.tile.bad { border-left: 4px solid var(--error); } .tile.bad b { color: var(--error); }
.tile.good { border-left: 4px solid var(--good); }
.t-title { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.buylist { list-style: none; margin: 0; padding: 0; }
.buylist li { padding: 8px 0; border-bottom: 1px solid var(--card-border); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.buylist .when { font-family: var(--mono); font-size: 12px; min-width: 110px; color: var(--text-dim); }
.buylist li.overdue .when { color: var(--error); font-weight: 700; }
.quickadd { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.quickadd input { flex: 1 1 220px; }
.quickadd select { width: auto; flex: 0 0 auto; }
.claude-box { margin-top: 14px; padding: 10px 12px; border: 1px dashed var(--card-border); border-radius: 8px; }
.claude-box p { margin: 4px 0 0; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 6px 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--card-border); }

/* price grid */
.pricegrid td.pcell { min-width: 120px; border-left: 1px solid var(--card-border); }
.pcell { display: table-cell; }
.pcell > * { display: block; margin-bottom: 2px; }
.pcell button { display: inline-flex; margin-top: 4px; }
.pcell.cheap { box-shadow: inset 0 0 0 2px #22c55e88; }
.pcell.chosen { background: #22c55e1c; }
.pcell.offcat { opacity: .6; }
.pcell.editable { cursor: pointer; }
.pcell.editable:hover { background: #4f8cff14; }
.pcell.dirty { background: #eab30814; }
.pcell .note { white-space: pre-wrap; }
.carts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.cart-sum { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin: 10px 0 4px; }

/* timeline */
.tl { display: flex; flex-direction: column; gap: 10px; }
.tl-entry { border-left: 3px solid var(--card-border); padding: 4px 0 4px 12px; }
.tl-entry.milestone { border-left-color: var(--accent); }
.tl-entry.t-failure { border-left-color: var(--error); }
.tl-entry.t-milestone .pill { color: var(--accent); border-color: #4f8cff66; }
.tl-entry.t-failure .pill { color: var(--error); border-color: #f8717166; }
.tl-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.photos img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; cursor: pointer; }
.photos .ph { position: relative; }
.photos .ph button { position: absolute; top: 2px; right: 2px; background: #000a; }
.vtl { position: relative; padding: 4px 0; }
.vtl-bands { position: relative; height: 70px; }
.band { position: absolute; height: 20px; border-radius: 4px; font-size: 11px; padding: 2px 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  background: #4f8cff33; border: 1px solid #4f8cff66; color: var(--text) !important; }
.band.ps-done { background: #22c55e2a; } .band.ps-inprogress { background: #eab30833; } .band.ps-blocked { background: #f8717133; }
.vtl-axis { position: relative; height: 18px; border-top: 1px solid var(--card-border); }
.mark { position: absolute; top: 3px; width: 10px; height: 10px; margin-left: -5px; transform: rotate(45deg); background: var(--accent); }
.mark.bad { transform: none; border-radius: 50%; background: var(--error); }
.today { position: absolute; top: -74px; bottom: 0; width: 0; border-left: 1px dashed var(--pending); }
.vtl-ends { display: flex; justify-content: space-between; gap: 8px; }

/* requests */
.req { border: 1px solid var(--card-border); border-left: 4px solid var(--pending); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.req.status-approved { border-left-color: var(--accent); }
.req.status-done { border-left-color: var(--good); }
.req.status-rejected { border-left-color: var(--error); }
.req.status-needs_info { border-left-color: #c084fc; }
.req-top { display: flex; justify-content: space-between; gap: 8px; }
.req textarea { margin-top: 8px; }
.admin-comment { background: #4f8cff14; border-radius: 6px; padding: 6px 10px; }
details summary { cursor: pointer; }

/* modal + toasts */
.modal-back { position: fixed; inset: 0; background: #000a; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; z-index: 50; overflow-y: auto; }
.modal { background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 18px; width: 100%; max-width: 640px; }
.modal h3 { margin: 0 0 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(92vw, 520px); }
.toast { background: #1f2430; border: 1px solid var(--card-border); border-left: 4px solid var(--good); border-radius: 8px; padding: 10px 14px; box-shadow: 0 6px 20px #0008; }
.toast.error { border-left-color: var(--error); }

/* phones: stack forms, tables become cards */
@media (max-width: 700px) {
  .row2, .row3 { grid-template-columns: 1fr; }
  .sh-name { font-size: 22px; }
  .sh-logo { width: 48px; height: 48px; }
  .etable table.grid thead { display: none; }
  .etable table.grid, .etable .grid tbody, .etable .grid tr, .etable .grid td { display: block; width: 100%; }
  .etable .grid tr { border: 1px solid var(--card-border); border-radius: 8px; margin-bottom: 10px; padding: 6px 8px; }
  .etable .grid td { border: none; padding: 3px 0; display: grid; grid-template-columns: 110px 1fr; gap: 8px; align-items: center; }
  .etable .grid td::before { content: attr(data-label); font-size: 11px; color: var(--text-dim); text-transform: uppercase; }
  .etable .grid tr.overdue { border-color: #f8717188; }
  .carts { grid-template-columns: 1fr; }
}
