:root {
  --wine: #c93003; --wine-600: #a82802; --wine-50: #fdf1ec; --wine-100: #fbdccd; /* CHG logo orange (#d03202), a touch deeper for readable text */
  --ink: #1f2430; --ink-2: #4a5160; --ink-3: #7a808c; --line: #e6e2dc; --line-2: #efece7;
  --bg: #f7f5f1; --panel: #ffffff; --sand: #fbfaf7;
  --blue: #2f5d8a; --blue-50: #eef3f9; --green: #2f7a55; --green-50: #eaf5ef;
  --amber: #a46a12; --amber-50: #fdf5e6; --red: #b3261e; --red-50: #fcebea; --grey-50: #f1f1f0;
  --wa: #1f8f5a; --radius: 10px; --shadow: 0 1px 2px rgba(31,36,48,.06), 0 4px 14px rgba(31,36,48,.05);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); font-size: 14px; line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--wine); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 60px; text-align: center; color: var(--ink-3); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.nav { background: #0e0d0d; color: #ececec; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark { width: 40px; height: 40px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex: none; padding: 3px; box-sizing: border-box; }
.brand-mark img { width: 100%; height: 100%; display: block; }
.brand-name { font-weight: 600; font-size: 14px; line-height: 1.15; }
.brand-name small { display: block; font-weight: 400; color: #a9a9a9; font-size: 12px; }
.nav-block { margin-top: 4px; }
.nav-group { display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: 0; color: #8c8c8c; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 12px 10px 6px; cursor: pointer; text-align: left; font-weight: 600; }
.nav-group:hover { color: #ececec; }
.nav-group .caret { width: 10px; font-size: 10px; }
.nav-group .count { text-transform: none; letter-spacing: 0; }
.nav-group[aria-expanded="true"] .count { display: none !important; }
.nav-sub a { padding-left: 26px; }
.nav-h { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8c8c8c; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 7px; color: #ececec; text-decoration: none; font-size: 13.5px; }
.nav a:hover { background: rgba(255,255,255,.06); }
.nav a.on { background: rgba(255,255,255,.10); color: #fff; box-shadow: inset 3px 0 0 var(--wine); }
.nav .count { font-size: 11.5px; background: rgba(255,255,255,.12); border-radius: 10px; padding: 0 7px; min-width: 22px; text-align: center; }
.nav .count.hot { background: var(--wine); color: #fff; }
.nav-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 12.5px; color: #a9a9a9; }
.nav-foot b { color: #fff; font-weight: 600; display: block; }
.nav-foot a { display: inline; padding: 0; color: #f0a07e; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 18px; margin: 0; font-weight: 600; flex: 1; min-width: 0; }
.page { padding: 20px 24px 48px; }
.devbar { background: var(--amber-50); color: var(--amber); font-size: 12.5px; padding: 6px 24px; border-bottom: 1px solid #f1e1c2; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 13px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--sand); border-color: #d8d2ca; }
.btn.primary { background: var(--wine); border-color: var(--wine); color: #fff; }
.btn.primary:hover { background: var(--wine-600); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--grey-50); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; outline: none; }
.input:focus { border-color: var(--wine); box-shadow: 0 0 0 3px var(--wine-50); }
textarea.input { resize: vertical; min-height: 70px; }
label.f { display: block; font-size: 12px; color: var(--ink-3); margin: 10px 0 4px; font-weight: 500; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { min-width: 0; }
.grow { flex: 1; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.search { position: relative; width: 320px; max-width: 40vw; }
.search input { padding-left: 32px; }
.search svg { position: absolute; left: 10px; top: 9px; color: var(--ink-3); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { padding: 12px 16px; border-bottom: 1px solid var(--line-2); font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-b { padding: 14px 16px; }
.empty { padding: 48px; text-align: center; color: var(--ink-3); }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-new { background: var(--wine-50); color: var(--wine); }
.st-open { background: var(--blue-50); color: var(--blue); }
.st-pending { background: var(--amber-50); color: var(--amber); }
.st-resolved { background: var(--green-50); color: var(--green); }
.st-closed { background: var(--grey-50); color: var(--ink-3); }
.pr-high { color: var(--amber); } .pr-urgent { color: var(--red); font-weight: 600; }
.ch { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 5px; background: var(--grey-50); color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; }
.ch.email { background: var(--blue-50); color: var(--blue); } .ch.sms { background: #f1ecfa; color: #5b3fa0; }
.ch.whatsapp { background: #e7f6ee; color: var(--wa); } .ch.form { background: var(--amber-50); color: var(--amber); }
.ch.note { background: #fff4cc; color: #8a6500; } .ch.phone, .ch.manual { background: var(--wine-50); color: var(--wine); }
.tag { font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; }

/* ---------- ticket list ---------- */
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--sand); }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.list tr.tk { cursor: pointer; }
table.list tr.tk:hover td { background: #fcfbf9; }
table.list tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--wine); }
.tnum { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.tsub { font-weight: 600; color: var(--ink); }
.tcust { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

/* ---------- ticket view ---------- */
.tv { display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 18px; align-items: start; }
.tv-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.tv-title { flex: 1; min-width: 0; }
.tv-title .subj { font-size: 19px; font-weight: 600; border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; margin-left: -7px; width: 100%; background: transparent; }
.tv-title .subj:hover { border-color: var(--line); } .tv-title .subj:focus { border-color: var(--wine); background: #fff; outline: none; }
.tv-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.msg.out { border-left: 3px solid var(--wine); }
.msg.in { border-left: 3px solid var(--blue); }
.msg.note { background: #fffbea; border-color: #f3e3a6; border-left: 3px solid #d9a400; }
.msg.auto { opacity: .9; }
.msg-h { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.msg.note .msg-h { border-color: #f3e3a6; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--blue-50); color: var(--blue); flex-shrink: 0; }
.msg.out .avatar { background: var(--wine-50); color: var(--wine); }
.msg.note .avatar { background: #fff0b3; color: #8a6500; }
.msg-from { font-weight: 600; }
.msg-addr { font-size: 12px; color: var(--ink-3); word-break: break-all; }
.msg-when { margin-left: auto; text-align: right; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.msg-b { padding: 12px 14px; position: relative; }
.msg-b.clip { max-height: 380px; overflow: hidden; }
.msg-b.clip::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 60px; background: linear-gradient(transparent, #fff); }
.msg.note .msg-b.clip::after { background: linear-gradient(transparent, #fffbea); }
.msg-b iframe { width: 100%; border: 0; display: block; min-height: 40px; }
.msg-b .txt { white-space: pre-wrap; word-wrap: break-word; }
.msg-subj { font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.msg-f { padding: 0 14px 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.att { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 7px; padding: 4px 9px; font-size: 12.5px; text-decoration: none; color: var(--ink); background: var(--sand); max-width: 280px; }
.att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att:hover { border-color: var(--wine); }
.att .x { cursor: pointer; color: var(--ink-3); margin-left: 2px; border: 0; background: none; padding: 0; }
.status-failed { color: var(--red); font-weight: 600; }
.more { font-size: 12.5px; padding: 0 14px 10px; }

/* composer */
.composer { margin-top: 16px; }
.composer.note-mode { border-color: #f3e3a6; }
.ctabs { display: flex; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--line-2); align-items: flex-end; }
.ctab { border: 0; background: none; padding: 8px 12px; border-bottom: 2px solid transparent; cursor: pointer; font-weight: 600; color: var(--ink-3); }
.ctab.on { color: var(--wine); border-color: var(--wine); }
.composer.note-mode .ctab.on { color: #8a6500; border-color: #d9a400; }
.chans { margin-left: auto; display: flex; gap: 4px; padding-bottom: 6px; }
.chan { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.chan.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chan:disabled { opacity: .4; cursor: not-allowed; }
.cfields { padding: 6px 14px 0; }
.cfield { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line-2); }
.cfield > span { width: 54px; font-size: 12.5px; color: var(--ink-3); flex-shrink: 0; }
.cfield input { border: 0; outline: none; padding: 7px 0; flex: 1; background: transparent; }
.cfield .lnk { font-size: 12px; color: var(--ink-3); cursor: pointer; background: none; border: 0; }
.warn { margin: 8px 14px 0; background: var(--amber-50); color: var(--amber); border-radius: 7px; padding: 7px 10px; font-size: 12.5px; }
.cfoot { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.drop-hint { outline: 2px dashed var(--wine); outline-offset: -6px; }

/* rich text editor */
.rte { border: 0; }
.rte-tb { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 10px; border-bottom: 1px solid var(--line-2); background: var(--sand); align-items: center; }
.rte-tb button { border: 0; background: transparent; width: 30px; height: 28px; border-radius: 6px; cursor: pointer; display: grid; place-items: center; color: var(--ink-2); font-size: 13px; }
.rte-tb button:hover { background: #ece8e2; }
.rte-tb button.on { background: #e3ddd5; color: var(--ink); }
.rte-tb select { border: 1px solid transparent; background: transparent; border-radius: 6px; height: 28px; padding: 0 4px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.rte-tb select:hover { background: #ece8e2; }
.rte-tb .sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.rte-tb label.color { position: relative; width: 30px; height: 28px; border-radius: 6px; display: grid; place-items: center; cursor: pointer; }
.rte-tb label.color:hover { background: #ece8e2; }
.rte-tb label.color input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.rte-tb label.color b { font-size: 13px; border-bottom: 3px solid currentColor; line-height: 1; padding: 0 2px; }
.rte-area { min-height: 170px; max-height: 520px; overflow-y: auto; padding: 12px 14px; outline: none; font-family: "Segoe UI", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.55; }
.rte-area:empty::before { content: attr(data-placeholder); color: var(--ink-3); }
.rte-area p { margin: 0 0 .7em; } .rte-area blockquote { margin: 0 0 .7em; border-left: 3px solid var(--line); padding-left: 12px; color: var(--ink-2); }
.rte-area table { border-collapse: collapse; } .rte-area td, .rte-area th { border: 1px solid #cfc8bf; padding: 4px 8px; min-width: 60px; }
.sms-area { width: 100%; border: 0; outline: none; padding: 12px 14px; min-height: 130px; resize: vertical; font-family: inherit; }
.counter { font-size: 12px; color: var(--ink-3); }

/* sidebar */
.side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; padding-bottom: 16px; scrollbar-width: thin; }
.side > * { flex: none; }
.prop { display: grid; grid-template-columns: 96px 1fr; gap: 6px 10px; align-items: center; }
.prop > label { font-size: 12px; color: var(--ink-3); }
.prop .input { padding: 5px 8px; font-size: 13px; }
.prop textarea.input { min-height: 60px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--grey-50); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 12.5px; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--ink-3); width: 20px; height: 20px; border-radius: 50%; }
.chip button:hover { background: #e2dfdb; }
.act { font-size: 12.5px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.act:last-child { border: 0; }
.act b { font-weight: 600; }
.act .muted { font-size: 11.5px; }

/* templates */
.tpl-grid { display: grid; grid-template-columns: 300px minmax(0,1fr); gap: 18px; align-items: start; }
.tpl-list a { display: block; padding: 9px 14px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line-2); }
.tpl-list a:hover { background: var(--sand); }
.tpl-list a.on { background: var(--wine-50); }
.tpl-list .grp { padding: 10px 14px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); background: var(--sand); border-bottom: 1px solid var(--line-2); }
.tpl-list .nm { font-weight: 600; font-size: 13px; }
.tpl-list .cs { display: flex; gap: 4px; margin-top: 3px; }
.tpl-list .off { opacity: .5; }
.preview { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.preview iframe { width: 100%; border: 0; min-height: 260px; display: block; }
.phone-bubble { background: #e7f6ee; border-radius: 14px 14px 14px 4px; padding: 10px 12px; white-space: pre-wrap; max-width: 360px; font-size: 13.5px; margin: 14px; }
.phone-bubble.sms { background: #eceff3; }
.tabs { display: flex; gap: 4px; margin-bottom: 10px; }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; background: rgba(28,22,24,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { width: min(780px, 100%); }
.modal-h { padding: 16px 20px 0; font-size: 16px; font-weight: 600; }
.modal-b { padding: 6px 20px 16px; }
.modal-f { padding: 12px 20px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 13.5px; cursor: pointer; }
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; border-radius: 8px; padding: 10px 14px; font-size: 13.5px; box-shadow: var(--shadow); max-width: 420px; animation: tin .2s ease-out; }
.toast.err { background: var(--red); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.login { max-width: 440px; margin: 10vh auto; }
.login a.u { display: flex; justify-content: space-between; padding: 11px 16px; border-bottom: 1px solid var(--line-2); text-decoration: none; color: var(--ink); }
.login a.u:hover { background: var(--sand); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.sim { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

@media (max-width: 1100px) { .tv { grid-template-columns: 1fr; } .side { position: static; max-height: none; overflow: visible; } .tpl-grid, .sim { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; } .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .nav-h, .nav-foot { display: none; } .brand { padding-bottom: 6px; width: 100%; }
  .page, .topbar { padding-left: 14px; padding-right: 14px; } .search { width: auto; flex: 1; max-width: none; }
  table.list .hide-sm { display: none; } .grid2, .grid3 { grid-template-columns: 1fr; }
}

/* suggestions */
.sugg-card { margin-top: 16px; border-color: #e8d9a8; background: #fffdf6; }
.sugg { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.sugg:last-child { border: 0; }
.score { font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.score.s3 { background: var(--green-50); color: var(--green); } .score.s2 { background: var(--blue-50); color: var(--blue); } .score.s1 { background: var(--grey-50); color: var(--ink-3); }

/* events calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); overflow: hidden; }
.cal-h { padding: 8px 10px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); background: var(--sand); border-bottom: 1px solid var(--line); font-weight: 600; }
.cal-cell { min-height: 118px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 4px 5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.other { background: #fbfaf8; } .cal-cell.other .cal-d { color: #c4bfb8; }
.cal-cell.today .cal-d { background: var(--wine); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; }
.cal-d { font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 2px 4px; }
.cal-ev { text-align: left; border: 0; border-left: 3px solid; background: var(--sand); border-radius: 4px; padding: 3px 6px; font-size: 11.5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.cal-ev:hover { background: var(--wine-50); }
.cal-ev.prospect { background: repeating-linear-gradient(135deg, #fff, #fff 4px, #f5f1ea 4px, #f5f1ea 8px); color: var(--ink-2); font-style: italic; }
@media (max-width: 760px) { .cal-cell { min-height: 70px; } .cal-ev { font-size: 10px; } }

/* dashboard + insights */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); display: block; }
a.kpi:hover { border-color: var(--wine); }
.kpi-l { font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-v { font-size: 28px; font-weight: 600; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-s { font-size: 12.5px; color: var(--ink-3); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; margin-top: 4px; align-items: start; }
.dash-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; align-items: start; }
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 64px; gap: 8px; align-items: center; font-size: 12.5px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bar-track { background: var(--grey-50); border-radius: 4px; height: 10px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--wine); border-radius: 4px; }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.insight { margin-top: 12px; padding: 9px 11px; border-radius: 8px; background: var(--sand); border: 1px solid var(--line-2); font-size: 13px; display: block; }
.insight > span + .btn { float: right; margin-top: -2px; }
.insight ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 12.5px; }
.insight.lvl-urgent { background: var(--red-50); border-color: #f3c9c6; } .insight.lvl-high { background: var(--amber-50); border-color: #f1e1c2; }
.tag.spam { color: var(--red); border-color: #f3c9c6; background: var(--red-50); }
@media (max-width: 1100px) { .dash-grid, .dash-grid3 { grid-template-columns: 1fr; } }
.autosave { font-size: 12px; color: var(--muted, #777); margin-left: 8px; font-weight: 400; }
.autosave.err { color: #b3261e; }
.sec-h { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2, #555); margin: 6px 0 8px; }
.perm-grid td { vertical-align: top; }
.perm-grid td:first-child { width: 38%; }
.multi-sel { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.ms-opt { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px 3px 7px; font-size: 12.5px; cursor: pointer; background: #fff; user-select: none; }
.ms-opt:has(input:checked) { background: var(--brand-50, #fbe9e1); border-color: var(--brand, #c93003); color: var(--brand, #c93003); font-weight: 600; }
.ms-opt input { margin: 0; }
.ms-opt.old { border-style: dashed; opacity: .8; }
.side .multi-sel { margin-bottom: 4px; }
.bk-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #eef6f1; border: 1px solid #cfe5d8; color: #1f5a3c; border-radius: 10px; padding: 9px 12px; margin-bottom: 12px; font-size: 13.5px; }
.bk-banner span { flex: 1; }
details.ev-notes > summary { cursor: pointer; list-style: none; }
details.ev-notes > summary::-webkit-details-marker { display: none; }
details.ev-notes > summary::before { content: '▸ '; }
details.ev-notes[open] > summary::before { content: '▾ '; }
.bk-map th { width: 34%; text-align: left; font-weight: 600; color: var(--ink-2, #555); vertical-align: top; }
.linkbtn { background: none; border: 0; color: var(--brand, #c93003); cursor: pointer; font-size: 12px; padding: 0 0 0 6px; text-decoration: underline; }
.abr-list { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; margin-top: 4px; }
.abr-row { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 12.5px; color: var(--ink, #222); }
.abr-row:hover { border-color: var(--brand, #c93003); }
.addr-block { border: 1px dashed var(--line); border-radius: 10px; padding: 4px 12px 12px; margin-top: 10px; }
.thread-order { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin: 10px 0 8px; }
td.ev-name { font-weight: 600; font-size: 13.5px; max-width: 260px; }
/* attachments drop zone + file rows */
.dropzone { margin-top: 8px; border: 1.5px dashed var(--line); border-radius: 10px; padding: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--ink-2); background: var(--bg, #faf9f7); }
.dropzone > .small { flex-basis: 100%; }
.dropzone.over { border-color: var(--wine); background: #fdf3ee; }
.dropzone.busy { opacity: .6; pointer-events: none; }
.ev-files { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.ev-file { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--line-2, #eee); border-radius: 8px; }
.ev-file a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-file .ok { color: #2f7a55; } .ev-file .err { color: var(--red, #b42318); }
/* one booking page */
.bk-page { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.bk-page > div > .card { margin-bottom: 18px; }
@media (max-width: 900px) { .bk-page { grid-template-columns: 1fr; } }
.bk-form { display: grid; grid-template-columns: 1fr; gap: 4px; max-width: 720px; }
.bk-field { padding: 6px 0; }
.bk-field .f { margin-top: 0; }
.bk-ro { padding: 8px 0; color: var(--ink-2); }
.req { color: var(--red, #b42318); }
.fd-log { max-height: 340px; overflow: auto; background: #1f1b1c; color: #e9e4e0; font-size: 12px; padding: 10px 12px; border-radius: 8px; white-space: pre-wrap; margin: 0; }
.ch.fd { background: #e8f1ec; color: #25603f; text-decoration: none; }
.src-table td, .src-table th { vertical-align: top; }
.src-table td:first-child { min-width: 200px; }
.src-table .bar-track { display: block; height: 6px; max-width: 260px; }
.src-total td { background: var(--bg, #faf9f7); }
/* tabs (Staff, roles & settings) */
.tabs-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 18px; overflow-x: auto; position: sticky; top: 0; background: var(--bg, #f6f4f1); z-index: 5; }
.tab-btn { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font: inherit; font-weight: 500; color: var(--ink-2); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tab-btn:hover { color: var(--ink); }
.tab-btn.on { color: var(--wine); border-bottom-color: var(--wine); }
.tab-panel-grid { gap: 18px; align-items: start; }
/* global save indicator */
.save-flag { position: fixed; top: 104px; right: 24px; z-index: 9999; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; box-shadow: 0 2px 10px rgba(0,0,0,.12); transition: opacity .4s; pointer-events: none; }
.save-flag.busy { background: #fff; color: var(--ink-2, #555); border: 1px solid var(--line, #ddd); }
.save-flag.ok { background: #2f7a55; color: #fff; }
.save-flag.err { background: var(--red, #b42318); color: #fff; max-width: 60vw; }
.save-flag.fade { opacity: 0; }
/* automations */
.au-list { display: flex; flex-direction: column; gap: 12px; max-width: 1000px; }
.au-rule.off { opacity: .65; }
.au-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--grey-50, #eee); font-size: 12px; font-weight: 600; }
.au-sum { margin-top: 8px; font-size: 14px; line-height: 1.6; }
.au-row { display: grid; grid-template-columns: 220px 190px 1fr auto; gap: 8px; align-items: start; margin-bottom: 8px; }
.au-row.act { grid-template-columns: 220px 1fr auto; }
.au-when { margin-top: 14px; padding: 8px 12px; background: var(--grey-50, #f3f1ee); border-radius: 8px; }
@media (max-width: 700px) { .au-row, .au-row.act { grid-template-columns: 1fr; } }
/* rich-text editors: expand / minimize */
.rte-tb { position: relative; }
.rte-exp { margin-left: auto !important; }
.rte-maxbar { display: none; }
.rte.rte-max { position: fixed; inset: 28px 40px; z-index: 9000; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line) !important; border-radius: 12px !important; box-shadow: 0 0 0 100vmax rgba(31, 27, 28, .45), 0 20px 60px rgba(0,0,0,.25); overflow: hidden; }
.rte.rte-max .rte-maxbar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.rte.rte-max .rte-maxbar .btn { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; }
.rte.rte-max .rte-area { flex: 1; max-height: none !important; min-height: 0 !important; font-size: 15px; padding: 18px 22px; }
body.rte-open { overflow: hidden; }
@media (max-width: 700px) { .rte.rte-max { inset: 0; border-radius: 0 !important; } }
.rte:not(.rte-max) .rte-area { resize: vertical; }
.mail-mode { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 10px 14px; border-radius: 8px; flex-wrap: wrap; }
.mail-mode.live { background: #e8f1ec; color: #25603f; }
.mail-mode.test { background: #fff4e0; color: #8a5a00; }
/* CRM conversations */
.crm-thread { padding: 10px 18px 16px; }
.crm-msg { margin-bottom: 14px; }
.crm-msg-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 4px 2px; }
.crm-msg-h .tnum { text-decoration: none; }
/* CRM list selection: merge / delete */
.sel-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; margin-bottom: 10px; background: #fdf3ee; border: 1px solid #ecd3d7; border-radius: 10px; position: sticky; top: 0; z-index: 4; }
.merge-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.merge-opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.merge-opt:has(input:checked) { border-color: var(--wine); background: #fdf3ee; }

/* new-enquiry contact finder */
.cp { margin-bottom: 6px; }
.cp-search { position: relative; }
.cp-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 320px; overflow: auto; }
.cp-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line-2, #eee); background: none; cursor: pointer; font: inherit; }
.cp-item:hover, .cp-item:focus { background: var(--grey-50, #f5f3f0); }
.cp-new b { color: var(--accent, #7a1f2b); }
.cp-chip { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; padding: 8px 12px; border-radius: 8px; background: #eef7ee; border: 1px solid #cfe6cf; }
.cp-panel { margin: 10px 0 4px; padding: 10px 12px; border: 1px solid #e8d9a8; background: #fffdf6; border-radius: 10px; }
.cp-h { font-weight: 600; margin: 4px 0 6px; }
.cp-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-2, #eee); }
.cp-row:last-of-type { border-bottom: 0; }
.cp-opt { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.cp [hidden] { display: none !important; }

.move-box { margin-bottom: 12px; padding: 10px 12px; border: 1px solid #e8c48a; background: #fff8ea; border-radius: 10px; }
.move-box ul { margin: 4px 0; padding-left: 18px; }
.bc-res { margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; max-height: 260px; overflow: auto; }
.bc-res:empty { display: none; }
.bc-new { margin-top: 10px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; }
.move-box[hidden], .bc-new[hidden], .cp-chip[hidden] { display: none !important; }
.co-box { margin: 10px 0 4px; padding: 10px 12px; border: 1px solid #c9d8ec; background: #f5f9ff; border-radius: 10px; }
.co-box[hidden] { display: none !important; }
.cp-item.on { background: var(--grey-50, #f0ece6); }
.cp-search > .cp-results[hidden] { display: none; }
.input.bad-phone, input.bad-phone { border-color: #b3261e !important; background: #fff6f5; }

/* delivery log under sent messages */
.msg-log { font-size: 12px; padding: 6px 14px 8px; border-top: 1px dashed var(--line-2); color: var(--green); }
.msg-log.warn { color: var(--amber); } .msg-log.bad { color: var(--red); font-weight: 600; } .msg-log.muted { color: var(--ink-3); }
/* expand a past message */
.msg-exp { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; cursor: pointer; font-size: 13px; line-height: 1; padding: 3px 6px; margin-left: 6px; color: var(--ink-2); }
.msg-exp:hover { border-color: var(--wine); color: var(--wine); }
.modal.focus-view { width: min(1200px, 96vw); max-width: none; height: 94vh; max-height: 94vh; display: flex; flex-direction: column; }
.modal.focus-view .modal-b { flex: 1; overflow: auto; }
.modal.focus-view iframe { min-height: 70vh; }
/* live alerts */
.live-box { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 10px; width: 340px; max-width: calc(100vw - 36px); }
.live-card { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--wine); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 10px 12px; animation: live-in .25s ease-out; }
.live-card.mine { border-left-color: var(--green); }
.live-h { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.live-x { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--ink-3); font-size: 14px; }
.live-ex { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@keyframes live-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- Help: How to? button, side panel, Help Centre ---- */
.btn.howto { gap: 6px; color: var(--ink-2, #555); white-space: nowrap; }
.btn.howto:hover { color: var(--wine); }
.howto-i { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--wine); color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.modal-h .btn.howto { padding: 4px 8px; font-size: 12.5px; font-weight: 500; }
.nav-help { margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.08); }
.help-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 94vw); background: #fff; box-shadow: -12px 0 40px rgba(0,0,0,.18); z-index: 200; display: flex; flex-direction: column; animation: helpIn .18s ease-out; }
@keyframes helpIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.help-dh { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.help-crumb { font-size: 12px; color: #777; margin-top: 1px; }
.help-body { padding: 4px 22px 30px; overflow: auto; flex: 1; }
.guide { font-size: 14px; line-height: 1.6; color: #222; }
.guide h2 { font-size: 20px; margin: 18px 0 8px; }
.guide h3 { font-size: 16.5px; margin: 0 0 8px; }
.guide p { margin: 0 0 10px; }
.guide ul, .guide ol { margin: 0 0 10px; padding-left: 22px; }
.guide li { margin: 3px 0; }
.guide li > ul, .guide li > ol { margin: 4px 0; }
.guide table { border-collapse: collapse; width: 100%; margin: 6px 0 14px; font-size: 13.5px; }
.guide th, .guide td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.guide th { background: #faf6f4; font-weight: 600; }
.guide code { background: #f3efed; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.guide .tip { background: #fff6f1; border-left: 4px solid var(--wine); padding: 10px 14px; border-radius: 6px; margin: 8px 0 14px; }
.guide figure { margin: 10px 0 18px; }
.guide figure img { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.06); cursor: zoom-in; display: block; }
.guide figcaption { font-size: 12.5px; color: #777; margin-top: 6px; font-style: italic; }
.guide a { color: var(--wine); }
.guide .help-sub { list-style: none; padding: 0; }
.guide .help-sub li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.help-wrap { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
.help-side { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; overflow-x: hidden; padding-bottom: 20px; min-width: 0; }
.help-side .search { width: 100%; }
.help-side .search .input { width: 100%; }
.help-dl { padding: 12px 14px; }
.help-toc .toc-block { margin-bottom: 10px; }
.help-toc a { display: block; padding: 4px 10px; border-radius: 6px; color: #333; text-decoration: none; font-size: 13px; }
.help-toc a.toc-ch { font-weight: 600; color: #111; margin-top: 4px; }
.help-toc a:not(.toc-ch) { padding-left: 22px; }
.help-toc a:hover { background: #f3efed; }
.help-toc a.on { background: #fbe9e1; color: var(--wine); }
.help-content { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 32px 40px; max-width: 900px; }
.help-content section { scroll-margin-top: 84px; padding: 14px 0 6px; border-bottom: 1px solid #f0ebe8; border-radius: 6px; transition: background .6s; }
.help-content section.g-ch h2 { font-size: 22px; color: var(--wine); margin-top: 18px; }
.help-content section.flash { background: #fff4ee; }
@media (max-width: 900px) { .help-wrap { grid-template-columns: 1fr; } .help-side { position: static; max-height: none; } .help-content { padding: 8px 16px 30px; } }

.merge-list { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; }
.merge-opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: #fff; }
.merge-opt:hover { border-color: var(--wine); }
.merge-opt input { margin-top: 3px; }
