/* Colours and layout follow docs/mockup (Main.dc.html etc.). System fonts only: no external requests. */
:root {
  --bg: #EEF1EC; --text: #16201A; --muted: #5F6B62; --link: #3F6A1E;
  --side: #15241B; --side-text: #DCE6DA; --side-active: #4F7A23; --side-hover: #21352A; --badge: #2A3F31;
  --primary: #3F7A2A; --primary-hover: #356A23; --soft: #E3ECD8;
  --line: #DDE3DA; --input: #CFD8CC; --row: #E7ECE4; --thead: #F5F7F3;
  --red: #B4372A; --pink: #FBEAE6; --amber: #E0A526; --grey: #9AA59C; --green: #2E7D3A;
  --col: #E4E9E1; --colh: #C9D3C5; --card: #D3DBD0; --note: #FFF4D6; --note-line: #E9CF8F;
}
* { box-sizing: border-box; }
body { margin: 0; display: flex; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--link); text-decoration: none; } a:hover { color: #2C4C14; text-decoration: underline; }
.side { width: 230px; flex: none; background: var(--side); color: var(--side-text); padding: 16px 0; }
.brand { padding: 0 18px 16px; font-weight: 700; font-size: 16px; }
.brand small { display: block; color: #9FB09F; font-weight: 400; font-size: 12px; }
.nav a { display: flex; justify-content: space-between; padding: 9px 18px; color: var(--side-text); }
.nav a:hover { background: var(--side-hover); text-decoration: none; }
.nav a.active { background: var(--side-active); color: #fff; font-weight: 600; }
.cnt { background: var(--badge); border-radius: 10px; padding: 0 8px; font-size: 12px; }
.cnt.red { background: var(--red); color: #fff; }
.main { flex: 1; min-width: 0; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--line); }
.top h1 { margin: 0; font-size: 20px; font-weight: 600; flex: 0 1 auto; }
.top .grow { flex: 1 1 220px; min-width: 180px; }
.search input { width: 100%; max-width: 460px; padding: 7px 14px; border: 1px solid var(--input); border-radius: 20px; font: inherit; }
.content { padding: 20px 24px; }
.btn { display: inline-block; padding: 7px 12px; border: 1px solid var(--input); border-radius: 8px; background: #fff;
  color: var(--text); font: inherit; cursor: pointer; }
.btn.go { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn.go:hover { background: var(--primary-hover); text-decoration: none; }
.btn.warn { color: var(--red); border-color: var(--red); }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.pill { padding: 4px 12px; border: 1px solid var(--input); border-radius: 999px; background: #fff; color: var(--text); }
.pill.on { background: var(--soft); border-color: #9FBF7E; color: #2C4C14; }
.muted { color: var(--muted); }
.tbox { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th { text-align: left; font-size: 12.5px; color: var(--muted); background: var(--thead); padding: 9px 12px; }
td { padding: 10px 12px; border-top: 1px solid var(--row); }
.tag { background: var(--bg); border-radius: 6px; padding: 1px 7px; font-size: 12.5px; }
.tag.deal { background: var(--soft); }
.over { color: var(--red); } .today { color: #7A4A00; }
.box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.box h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; color: var(--muted); }
.kv { display: grid; grid-template-columns: 9rem 1fr; gap: 6px 10px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 16px; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } body { flex-direction: column; } .side { width: auto; } }
.alert { background: var(--pink); border: 1px solid #D58A7E; border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }
.notice { background: var(--note); border: 1px solid var(--note-line); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.board { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; }
.col { width: 250px; flex: none; background: var(--col); border-radius: 10px; padding: 8px; }
.colh { border-bottom: 1px solid var(--colh); padding: 4px 4px 8px; margin-bottom: 8px; font-weight: 600; }
.colh small { display: block; color: var(--muted); font-weight: 400; }
.card { background: #fff; border: 1px solid var(--card); border-radius: 8px; padding: 10px; margin-bottom: 8px; position: relative; }
.card.cold { background: var(--pink); }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; background: var(--grey); }
.dot.red { background: var(--red); } .dot.green { background: var(--green); } .dot.none { background: var(--amber); }
.stagebar { display: flex; gap: 4px; margin: 10px 0 16px; flex-wrap: wrap; }
.stagebar form { flex: 1; min-width: 90px; }
.stagebar button { width: 100%; padding: 8px 4px; border: 0; background: #DCE3D8; border-radius: 6px; font: inherit; cursor: pointer; }
.stagebar button.done { background: #BFD3A6; color: #2C4C14; }
.stagebar button.cur { background: var(--primary); color: #fff; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { padding: 8px 0; border-top: 1px solid var(--row); }
form.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 8px; }
input, select, textarea { font: inherit; padding: 6px 10px; border: 1px solid var(--input); border-radius: 8px; }
textarea { width: 100%; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.tile b { display: block; font-size: 26px; }

/* call session: big tap targets for one-handed use on a phone */
.session { max-width: 640px; }
.session .big { min-height: 44px; padding: 10px 14px; font-size: 15px; }
.session .phones { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.session .phones small { opacity: .8; margin-left: 4px; }
.session .results { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.session label.pill { cursor: pointer; }
.session label.pill.term { border-color: #D58A7E; }
.session label.pill:has(input:checked) { background: var(--soft); border-color: var(--primary); font-weight: 600; }
.session label.pill.term:has(input:checked) { background: var(--pink); border-color: var(--red); }
.session input[type=radio] { margin-right: 4px; }

/* edit in place: looks like text until hovered or focused */
form.ef { margin: 0; }
.ef input, .ef select, .ef textarea { width: 100%; border-color: transparent; background: transparent; padding: 2px 6px; margin: -2px -6px; border-radius: 6px; }
.ef:hover input, .ef:hover select, .ef:hover textarea { border-color: var(--input); background: #fff; }
.ef input:focus, .ef select:focus, .ef textarea:focus { border-color: var(--primary); background: #fff; outline: none; }
.newform { max-width: 560px; }
.newform label { display: block; margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.newform label input, .newform label select { display: block; width: 100%; margin-top: 3px; color: var(--text); font-size: 14px; }
.newform .req { color: var(--red); }

.card[draggable] { cursor: grab; }
.card.dragging { opacity: .4; }
.col.over { outline: 2px dashed var(--primary); background: var(--soft); }

details.cols { position: relative; } details.cols summary { list-style: none; } details.cols > .box { position: absolute; z-index: 5; margin-top: 4px; min-width: 200px; }
details.cols label { display: block; padding: 2px 0; }
th a { color: var(--muted); } th a:hover { color: var(--text); }

/* insights charts: plain CSS bars, no external libraries */
.meter { display: block; height: 6px; background: var(--row); border-radius: 3px; margin-top: 8px; } .meter i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.vbars { display: flex; gap: 8px; align-items: flex-end; height: 150px; padding-top: 18px; }
.vb { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.vb i { display: block; width: 100%; max-width: 44px; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; } .vb span { font-size: 12px; } .vb small { color: var(--muted); font-size: 11px; margin-top: 4px; }
.hrow { display: flex; align-items: center; gap: 10px; margin: 6px 0; } .hl { width: 9rem; flex: none; } .hn { width: 11rem; flex: none; }
.hb { flex: 1; height: 14px; background: var(--row); border-radius: 7px; overflow: hidden; } .hb i { display: block; height: 100%; background: var(--primary); } .hb.lost i { background: var(--red); }

details.ed { display: inline-block; vertical-align: top; margin-left: 8px; } details.ed summary { cursor: pointer; font-size: 12px; }
details.ed[open] { display: block; margin: 6px 0; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.focusrow { display: flex; gap: 8px; align-items: center; margin: 4px 0; } .focusrow .ef:nth-of-type(1) { flex: 1; } .focusrow form { margin: 0; }
.prodrow { display: grid; grid-template-columns: 1fr 7rem 7rem auto; gap: 8px; align-items: center; margin: 4px 0; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 900px) { .cal { grid-template-columns: 1fr; } }
.calday { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-height: 160px; } .calday.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.calh { display: flex; justify-content: space-between; font-weight: 600; border-bottom: 1px solid var(--row); padding-bottom: 4px; margin-bottom: 6px; }
.calitem { border-top: 1px solid var(--row); padding: 6px 0; font-size: 13px; word-break: break-word; } .calitem.done { opacity: .55; text-decoration: line-through; } .calitem form { margin: 4px 0 0; }

.bulkbar { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }

.chips { margin: 0 0 12px; } .chips .tag { text-decoration: none; }

.search { position: relative; } .suggest { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; max-width: 460px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; margin-top: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.12); overflow: hidden; }
.suggest a { display: block; padding: 9px 14px; color: var(--text); border-top: 1px solid var(--row); } .suggest a:first-child { border-top: 0; }
.suggest a:hover, .suggest a.on { background: var(--soft); text-decoration: none; } .suggest small { color: var(--muted); }

/* phone (SPEC: works at 390 px, 44 px tap targets) */
@media (max-width: 700px) {
  body { display: block; }
  .side { width: auto; padding: 8px 0; position: sticky; top: 0; z-index: 30; }
  .brand { padding: 0 14px 6px; } .brand small { display: none; }
  .nav { display: flex; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .nav a { padding: 10px 14px; flex: none; gap: 6px; min-height: 44px; align-items: center; }
  .side form { display: none; }
  .top { flex-wrap: wrap; padding: 10px 14px; gap: 8px; } .top h1 { font-size: 18px; } .top .grow { order: 5; flex-basis: 100%; }
  .search input { max-width: none; }
  .suggest { max-width: none; }
  .content { padding: 14px; }
  .btn, .pill, input, select, textarea { min-height: 44px; font-size: 16px; }      /* 16px stops iOS zooming into fields */
  .pill { display: inline-flex; align-items: center; }
  .btn { display: inline-flex; align-items: center; justify-content: center; }
  .ef input, .ef select, .ef textarea { min-height: 36px; }
  .kv { grid-template-columns: 7rem 1fr; }
  .bar { gap: 6px; } .bar form, form.bar { width: 100%; }
  .bar select, .bar input[name=q] { flex: 1 1 140px; }
  .newform, .box.newform { max-width: none !important; }
  .hrow { flex-wrap: wrap; } .hl { width: 100%; } .hn { width: auto; }
  .prodrow { grid-template-columns: 1fr 1fr; }
  .focusrow { flex-wrap: wrap; }
  .stagebar button { min-height: 44px; }
  .col { width: 80vw; }
  .tiles { grid-template-columns: 1fr 1fr; }
  table { min-width: 560px; }
  .vbars { gap: 4px; } .vb small { font-size: 10px; }
}

h3.sec { margin: 22px 0 8px; font-size: 15px; }

.calday.over { outline: 2px dashed var(--primary); background: var(--soft); } .calitem[draggable] { cursor: grab; }

.newform textarea { width: 100%; margin-top: 3px; }
.nw { white-space: nowrap; }
a.cell { color: inherit; text-decoration: none; display: block; }
a.cell:hover { color: var(--primary); }
.tbox tr:hover td { background: var(--soft); }
.tbox tr td { cursor: pointer; }
.tbox tr td:has(input, select, textarea, button) { cursor: auto; }
