:root {
  --bg: #f6f4f0; --card: #fff; --ink: #1d1b18; --muted: #77716a; --line: #e7e2da;
  --accent: #b4532a; --red: #c8372d; --red-bg: #fdecea; --amber: #b7791f; --amber-bg: #fdf4e3;
  --green: #2f7d4f; --green-bg: #e8f5ec; --blue: #2b62b8; --blue-bg: #e8effb; --r: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
h1 { font-size: 22px; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; }
h3 { font-size: 15px; margin: 0 0 10px; }
code { background: #f1eee9; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .red { color: var(--red); } .amber { color: var(--amber); }

/* top bar */
.top { display: flex; align-items: center; gap: 18px; padding: 10px 20px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tabs a { text-decoration: none; padding: 6px 12px; border-radius: 8px; color: #d9d4cc; white-space: nowrap; display: flex; align-items: center; gap: 6px; font-size: 14px; }
.tabs a:hover { background: rgba(255,255,255,.08); }
.tabs a.on { background: #fff; color: var(--ink); }
.sw { width: 10px; height: 10px; border-radius: 3px; background: var(--c, #999); display: inline-block; }
.sw.big { width: 16px; height: 16px; border-radius: 4px; }
.me { font-size: 13px; color: #bdb6ad; white-space: nowrap; } .me a { text-decoration: none; }

main { max-width: 1280px; margin: 0 auto; padding: 20px; }
main.narrow { max-width: 420px; padding-top: 8vh; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 14px; }
.card.empty { text-align: center; padding: 40px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.head h1 { margin: 0; } .head.tight { margin-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.grid2.wide-left { grid-template-columns: 1.4fr 1fr; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; background: var(--green-bg); color: var(--green); }
.flash.err { background: var(--red-bg); color: var(--red); } .flash.info { background: var(--blue-bg); color: var(--blue); }

/* forms */
input, select, textarea { font: inherit; border: 1px solid #d8d2c8; border-radius: 8px; padding: 7px 9px; background: #fff; color: var(--ink); max-width: 100%; }
textarea { width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
label input:not([type=checkbox]):not([type=color]):not([type=file]), label select, label textarea { display: block; width: 100%; margin-top: 3px; color: var(--ink); font-size: 15px; }
label small { display: block; margin-top: 3px; }
label.chk { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.form2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form2 h3, .form2 .full, .form2 button.btn, .form2 .hours { grid-column: 1 / -1; }
.form2 h3 { margin-top: 10px; }
.form2 button.btn { justify-self: start; }
.pre { display: flex; align-items: center; gap: 2px; color: var(--muted); } .pre input { margin-top: 0 !important; }
fieldset { border: 0; padding: 0; margin: 0 0 10px; } legend { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--ink); background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 9px; font: 600 14px/1 inherit; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--ink); border-color: #cfc8bd; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.wide { width: 100%; justify-content: center; padding: 11px; }
.btn:hover { filter: brightness(1.08); }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btnrow form { margin: 0; }
form.inline { display: flex; gap: 6px; align-items: center; margin: 0 0 8px; }
.login h1 { justify-content: center; }

/* board */
.search input { width: 260px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; text-decoration: none; color: var(--muted); font-size: 13px; }
.stat b { display: block; font-size: 26px; color: var(--ink); line-height: 1.1; }
.stat.red b { color: var(--red); } .stat.amber b { color: var(--amber); } .stat.green b { color: var(--green); }
.stat.on { outline: 2px solid var(--ink); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { text-decoration: none; font-size: 13px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); } .chip.warn { border-color: var(--amber); color: var(--amber); }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.row { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); text-decoration: none; border-left: 4px solid transparent; }
.row:last-child { border-bottom: 0; } .row:hover { background: #faf8f5; }
.row.st-needs_reply { border-left-color: var(--red); } .row.st-waiting_customer { border-left-color: #e9c46a; }
.row.urgent { background: #fff7f6; }
.ico img, .noico, .tinyico { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: block; }
.tinyico { width: 28px; height: 28px; }
.noico { background: #e9e4dc; display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.main { min-width: 0; } .name { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.snip { display: block; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snip b { color: var(--ink); font-weight: 500; } .who { color: var(--ink); }
.meta { display: grid; justify-items: end; gap: 2px; font-size: 13px; text-align: right; }
.pill { font-style: normal; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--c, #888) 14%, white); color: color-mix(in srgb, var(--c, #555) 80%, black); white-space: nowrap; }
.pill.grey { --c: #8a837a; } .pill.red { --c: var(--red); } .pill.amber { --c: var(--amber); } .pill.green { --c: var(--green); } .pill.blue { --c: var(--blue); }
.stage { font-size: 11.5px; padding: 1px 8px; border-radius: 6px; background: #f0ece6; color: var(--muted); }
.stage.s-booked { background: var(--green-bg); color: var(--green); } .stage.s-quoted, .stage.s-negotiating { background: var(--blue-bg); color: var(--blue); }
.stage.s-lost { text-decoration: line-through; }

/* group page */
.gtitle { display: flex; gap: 12px; align-items: center; } .gicon { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.sub { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.gpage { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 14px; align-items: start; }
.chat { height: calc(100vh - 170px); overflow-y: auto; background: #efeae2; padding: 14px; position: sticky; top: 70px; }
.day { text-align: center; font-size: 12px; color: var(--muted); margin: 14px 0 8px; }
.msg { max-width: 78%; margin: 4px 0; padding: 7px 10px 8px; border-radius: 10px; background: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.06); }
.msg.team { margin-left: auto; background: #dcf6c6; }
.msg.bot { background: #d4ecfb; } .msg.pending { opacity: .65; border: 1px dashed #8bb; }
.msg .who { font-size: 12px; font-weight: 600; color: var(--accent); display: flex; justify-content: space-between; gap: 10px; }
.msg.team .who { color: var(--green); } .msg .who span { font-weight: 400; color: var(--muted); }
.msg .body { white-space: normal; word-wrap: break-word; }
.msg audio { width: 240px; height: 34px; margin-top: 4px; } .mimg { max-width: 260px; border-radius: 8px; display: block; }
.side .card { margin-bottom: 12px; }
.status { border-left: 5px solid var(--line); } .status.st-needs_reply { border-left-color: var(--red); background: #fffafa; } .status.st-waiting_customer { border-left-color: #e9c46a; }
.stline { display: flex; justify-content: space-between; font-size: 16px; margin-bottom: 6px; }
.reason { margin: 0 0 10px; }
.sugg { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; } .sugg:first-of-type { border: 0; margin: 0; padding: 0; }
.sugghead { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; } .code { font-weight: 700; color: var(--accent); }
.sugg textarea { margin-bottom: 6px; }
details summary { list-style: none; cursor: pointer; } details summary::-webkit-details-marker { display: none; }
details summary h3 { display: inline; } details summary::after { content: ' ▾'; color: var(--muted); } details[open] summary { margin-bottom: 10px; }
.summary { margin: 0 0 6px; } .next { margin: 0 0 8px; font-weight: 600; }
.missing { margin-bottom: 10px; font-size: 13px; color: var(--muted); display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.evform { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; } .evform .full, .evform button { grid-column: 1 / -1; } .evform button { justify-self: start; }
.evform label { margin-bottom: 6px; } .evform label.locked::after { content: ' •'; color: var(--accent); }
.qline { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.note { border-top: 1px solid var(--line); padding: 8px 0; font-size: 14px; }
.checks label { margin-bottom: 6px; color: var(--ink); display: flex; gap: 8px; }

/* quote */
.qhead { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
table { border-collapse: collapse; width: 100%; }
.lines th, .tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); }
.lines td, .tbl td { padding: 4px 6px; border-bottom: 1px solid #f2eee8; vertical-align: middle; }
.lines input:not([type=checkbox]) { width: 100%; } .lines td.n input { text-align: right; width: 90px; }
.n { text-align: right; } tr.noprice { background: var(--amber-bg); }
.addmenu { margin-top: 10px; max-width: 520px; }
.totals { margin: 14px 0 14px auto; width: 340px; } .totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.totals .grand { border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 6px; font-size: 18px; }
fieldset[disabled] input, fieldset[disabled] textarea { background: #faf8f5; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dow { font-size: 12px; color: var(--muted); padding: 4px; }
.cell { background: #fff; border: 1px solid var(--line); border-radius: 8px; min-height: 96px; padding: 4px; font-size: 12px; }
.cell.off { background: transparent; border: 0; } .cell.today { outline: 2px solid var(--accent); }
.dn { color: var(--muted); font-size: 12px; }
.cev { display: block; text-decoration: none; margin-top: 3px; padding: 3px 5px; border-radius: 5px; background: color-mix(in srgb, var(--c) 18%, white); border-left: 3px solid var(--c); line-height: 1.25; }
.cev:not(.s-booked) { opacity: .6; } .cev i { color: var(--muted); }

/* settings */
.snav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.snav a { text-decoration: none; padding: 6px 12px; border-radius: 8px; font-size: 14px; } .snav a.on { background: var(--ink); color: #fff; }
.checklist { list-style: none; padding: 0; margin: 0; } .checklist li { padding: 7px 0; border-bottom: 1px solid var(--line); } .checklist a { text-decoration: none; } .checklist li.done { color: var(--muted); }
.bizrow { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; } .bizrow.inactive, tr.inactive, .inactive { opacity: .55; }
.hours { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; margin-bottom: 12px; font-size: 14px; }
.hours div { display: flex; gap: 6px; align-items: center; } .hours b { width: 34px; } .hours small { grid-column: 1 / -1; color: var(--muted); }
.icons { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.icon { position: relative; margin: 0; } .icon img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.icon .x { position: absolute; top: 0; right: 0; border: 0; background: var(--red); color: #fff; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; }
.logoprev { max-height: 60px; display: block; margin-top: 6px; }
.tbl.edit input:not([type=checkbox]) { width: 100%; min-width: 70px; } .tbl.edit td.n input { width: 80px; text-align: right; } .tiny { width: 50px !important; min-width: 0 !important; }
.newrow { background: #fbfaf7; }
.kbrow { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; } .kbrow .full { grid-column: 1 / -1; }
.example p { margin: 4px 0 8px; }
.qr { background: #fff; padding: 10px; display: inline-block; border-radius: 8px; }

@media (max-width: 900px) {
  .gpage, .grid2, .grid2.wide-left { grid-template-columns: 1fr; }
  .chat { height: auto; min-height: 120px; max-height: 50vh; position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .form2, .kbrow, .qhead { grid-template-columns: 1fr; }
  .tbl, .lines { display: block; overflow-x: auto; }
}
@media (max-width: 600px) {
  main { padding: 12px; }
  .top { padding: 8px 12px; gap: 8px; } .me { display: none; }
  .row { grid-template-columns: 36px 1fr; } .row .meta { grid-column: 2; justify-items: start; grid-auto-flow: column; gap: 10px; text-align: left; }
  .search input { width: 100%; } .search { width: 100%; }
  .cal { grid-template-columns: 1fr; } .dow, .cell.off { display: none; } .cell { min-height: 0; } .cell:not(:has(.cev)) { display: none; }
  .totals { width: 100%; }
}

/* reports */
.stats.six { grid-template-columns: repeat(6, 1fr); }
.stats .stat b { font-size: 22px; }
.tbl.rep td a { text-decoration: none; }
.tbl.rep .totrow td { border-top: 2px solid var(--ink); }
.funnel { display: grid; grid-template-columns: 150px 1fr 50px; gap: 10px; align-items: center; margin: 6px 0; font-size: 14px; }
.funnel b { text-align: right; }
.fbar { background: #f0ece6; border-radius: 6px; height: 14px; overflow: hidden; } .fbar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 210px; }
.mcol { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 11px; }
.mstack { width: 70%; display: flex; flex-direction: column-reverse; border-radius: 4px 4px 0 0; overflow: hidden; min-height: 1px; background: #f0ece6; }
.mstack i { display: block; }
.mlbl { color: var(--muted); margin-top: 4px; } .mval { font-weight: 600; min-height: 14px; }
@media (max-width: 900px) { .stats.six { grid-template-columns: repeat(3, 1fr); } .funnel { grid-template-columns: 110px 1fr 40px; } }
.mcol.now .mlbl { color: var(--ink); font-weight: 700; }
