/* MyChatbot.live: site and dashboard styles (plain CSS, no build step) */
:root {
  --ink: #15120F; --red: #A8202E; --red-dark: #861A26; --gold: #B48C55; --cream: #F4EFE6; --paper: #FBF8F2;
  --line: #DED5C8; --muted: #766D63; --green: #15803D; --amber: #B45309;
  --font: "Manrope", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--cream); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--red); }
h1 { font-size: 26px; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--red-dark); font-size: 13px; font-weight: 600; margin: 2px 0 0; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 22px; background: var(--ink); color: #fff; }
.logo { color: #fff; font-weight: 800; font-size: 19px; text-decoration: none; letter-spacing: -.01em; }
.logo em { color: #E2A3AA; font-style: normal; }
.topnav { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.topnav a, .topnav .link { color: #F4EFE6; text-decoration: none; }
.topnav .who { color: #B9AFA3; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav form { margin: 0; }
button.link { border: 0; background: none; padding: 0; font: inherit; cursor: pointer; color: inherit; }

.flash { max-width: 1100px; margin: 14px auto 0; padding: 10px 16px; border-left: 3px solid var(--green); background: #E8F3EB; border-radius: 6px; }
.page { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.page.narrow { max-width: 460px; }
.page.wide { max-width: none; padding: 0; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 24px; box-shadow: 0 2px 10px rgba(46, 34, 19, .05); }
.stack { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
label { font-weight: 700; font-size: 13px; }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=date], input[type=number], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #CFC5B8; border-radius: 8px; background: #fff; font: inherit; color: inherit;
}
textarea { min-height: 64px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.google-btn { width: 100%; margin-top: 12px; gap: 10px; }
.code-input { font-size: 26px !important; letter-spacing: 8px; text-align: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 9px 18px; border: 1px solid var(--red); border-radius: 999px; background: var(--red); color: #fff; font: 700 14px var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--red-dark); }
.btn.secondary { background: #fff; color: var(--ink); border-color: #CFC5B8; }
.btn.secondary:hover { border-color: var(--red); color: var(--red); }
.btn.green { background: var(--green); border-color: var(--green); }
.btn.small { min-height: 32px; padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Dashboard */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.bots { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.bot-card { display: flex; flex-direction: column; gap: 10px; }
.bot-card .top { display: flex; align-items: center; gap: 12px; }
.bot-card h2 { margin: 0; font-size: 17px; }
.bot-dot { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; flex: 0 0 42px; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.bot-dot img { width: 30px; height: 30px; object-fit: contain; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.live { background: #E3F2E7; color: var(--green); }
.badge.draft { background: #F3EBDD; color: #7A5A2B; }
.badge.paused { background: #F6E3E5; color: var(--red-dark); }
.badge.changes { background: #FFF3D6; color: var(--amber); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.notice-box { padding: 14px 16px; border-radius: 10px; background: #FFF8E8; border: 1px solid #EBD9AE; margin-bottom: 18px; }
.empty { text-align: center; padding: 40px 20px; }

/* Create */
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.type { position: relative; display: block; padding: 14px; border: 1px solid #CFC5B8; border-radius: 10px; background: #fff; cursor: pointer; font-weight: 400; }
.type input { position: absolute; opacity: 0; }
.type b { display: block; font-size: 15px; }
.type span { color: var(--muted); font-size: 13px; }
.type:has(input:checked) { border-color: var(--red); box-shadow: 0 0 0 2px var(--red) inset; }
.addr { display: flex; align-items: center; border: 1px solid #CFC5B8; border-radius: 8px; background: #fff; overflow: hidden; }
.addr span { padding: 10px 0 10px 12px; color: var(--muted); white-space: nowrap; }
.addr input { border: 0 !important; padding-left: 2px !important; outline: 0 !important; }

/* Builder */
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 440px; min-height: calc(100vh - 54px); }
.builder-main { padding: 18px 24px 90px; min-width: 0; }
.builder-side { position: sticky; top: 0; height: 100vh; padding: 14px; background: #EDE6DA; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.builder-side iframe { flex: 1; width: 100%; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.builder-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.builder-head h1 { font-size: 22px; margin: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button { padding: 10px 14px; border: 0; border-bottom: 3px solid transparent; background: none; font: 700 14px var(--font); color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--red); }
.panel[hidden] { display: none; }
.field { margin-bottom: 14px; }
.field .help { color: var(--muted); font-size: 12.5px; margin: 2px 0 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.colours { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.colour { display: flex; align-items: center; gap: 8px; }
.colour input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid #CFC5B8; border-radius: 8px; background: #fff; flex: 0 0 44px; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.preset { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #CFC5B8; cursor: pointer; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border: 1px solid #CFC5B8; border-radius: 999px; background: #fff; font-weight: 600; cursor: pointer; }
.logo-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-prev { width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; overflow: hidden; }
.logo-prev img { width: 40px; height: 40px; object-fit: contain; }
.save-bar { position: fixed; left: 0; right: 440px; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 10px 24px; background: #fff; border-top: 1px solid var(--line); z-index: 5; flex-wrap: wrap; }
.save-bar .state { color: var(--muted); font-size: 13px; margin-right: auto; }
.save-bar .state.dirty { color: var(--amber); font-weight: 700; }
.problems { margin: 0 0 14px; padding: 12px 16px 12px 32px; border: 1px solid #E7B9BE; border-radius: 10px; background: #FDF1F2; color: var(--red-dark); font-size: 13px; }
.problems[hidden] { display: none; }

/* Questions editor */
.q-list { display: flex; flex-direction: column; gap: 10px; }
.q { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.q > summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; }
.q > summary::-webkit-details-marker { display: none; }
.q > summary .qtext { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q > summary .qkind { color: var(--muted); font-size: 12px; white-space: nowrap; }
.q .qbody { padding: 12px 14px 14px; border-top: 1px solid #EFE8DD; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #F3EBDD; color: #7A5A2B; font-size: 11px; font-weight: 700; }
.answers { display: flex; flex-direction: column; gap: 6px; }
.answer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 220px) 34px; gap: 6px; align-items: center; }
.answer.no-go { grid-template-columns: minmax(0, 1fr) 34px; }
.icon-btn { width: 34px; height: 34px; border: 1px solid #CFC5B8; border-radius: 8px; background: #fff; cursor: pointer; font-size: 16px; color: var(--muted); }
.icon-btn:hover { border-color: var(--red); color: var(--red); }
.menu-items { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 0 10px; }
/* Home */
.hero { max-width: 760px; padding: 26px 0 18px; }
.hero h1 { font-size: 36px; line-height: 1.15; letter-spacing: -.02em; }
.hero h1 em { color: var(--red); font-style: normal; }
.lead { font-size: 17px; color: #4A4139; margin: 0 0 18px; }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 24px 0; }
.features .card { padding: 18px; }
.features p { margin: 0; font-size: 14px; }
.quote { max-width: 760px; scroll-margin-top: 20px; }
.quote-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.quote-form .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .quote-form { grid-template-columns: 1fr; } .hero h1 { font-size: 28px; } }

/* Admin */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); text-decoration: none; }
.stat b { display: block; font-size: 24px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.on { border-color: var(--red); box-shadow: 0 0 0 1px var(--red) inset; }
.stat.warn b { color: var(--amber); }
.stat.bad b { color: var(--red-dark); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { padding: 10px 12px; text-align: left; color: var(--muted); font-size: 12px; font-weight: 700; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 10px 12px; border-bottom: 1px solid #EFE8DD; vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list a { font-weight: 700; }
.acct { font-weight: 700; font-size: 12px; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.acct-active { background: #E3F2E7; color: var(--green); }
.acct-overdue { background: #F6E3E5; color: var(--red-dark); }
.acct-paused { background: #EDE7F6; color: #5B21B6; }
.acct-not-active { background: #F3EBDD; color: #7A5A2B; }
.days-bad { color: var(--red-dark); font-weight: 700; }
.days-warn { color: var(--amber); font-weight: 700; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.admin-grid .card h2 { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 860px) { .admin-grid, .form-grid { grid-template-columns: 1fr; } }

/* Add to website tab */
.installed { margin-bottom: 18px; padding: 12px 14px; border-radius: 10px; background: #F3EBDD; font-size: 14px; }
.installed.ok { background: #E3F2E7; color: #14532D; }
.guides { display: flex; flex-direction: column; gap: 6px; }
.guides details { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.guides summary { padding: 10px 14px; font-weight: 700; cursor: pointer; }
.guides ol { margin: 0; padding: 0 16px 12px 34px; font-size: 14px; }
.guides li { margin-bottom: 4px; }

/* Change requests */
.ticket { margin-bottom: 10px; padding: 0; }
.ticket > summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; list-style: none; }
.ticket > summary::-webkit-details-marker { display: none; }
.ticket[open] > summary { border-bottom: 1px solid #EFE8DD; }
.tstate { flex: 0 0 auto; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #F3EBDD; color: #7A5A2B; }
.tstate-ready, .tstate-question { background: #FFF3D6; color: var(--amber); }
.tstate-done { background: #E3F2E7; color: var(--green); }
.tstate-outside { background: #F6E3E5; color: var(--red-dark); }
.tstate-cancelled { background: #EEE; color: #777; }
.thread { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px; }
.tmsg { max-width: 640px; padding: 10px 12px; border-radius: 10px; background: #F7F2EA; }
.tmsg-ai, .tmsg-admin { background: #EEF3FA; align-self: flex-start; }
.tmsg-customer { align-self: flex-end; }
.tmeta { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.tbody { white-space: pre-wrap; overflow-wrap: anywhere; }
.ready-box { margin: 0 18px 12px; padding: 12px 14px; border-radius: 10px; background: #E8F3EB; }
.reply-form { padding: 0 18px 16px; margin-top: 4px; }

/* Enquiries page */
.enq-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.enq-side { display: flex; flex-direction: column; gap: 16px; }
.enq-list { display: flex; flex-direction: column; gap: 8px; }
.enq { padding: 0; }
.enq > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; }
.enq > summary::-webkit-details-marker { display: none; }
.enq-main { display: flex; flex-direction: column; min-width: 0; }
.enq-main .muted { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.enq-when { white-space: nowrap; }
.enq[open] > summary { border-bottom: 1px solid #EFE8DD; }
.enq-answers { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; padding: 14px 16px; }
.enq-answers dt { color: var(--muted); font-size: 13px; }
.enq-answers dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.enq .row { padding: 0 16px 14px; }
.months { width: 100%; border-collapse: collapse; font-size: 14px; }
.months td { padding: 5px 0; border-bottom: 1px solid #EFE8DD; }
.months .num { text-align: right; font-weight: 700; }
.steps { padding-left: 18px; }
.steps li { margin-bottom: 8px; }
@media (max-width: 860px) { .enq-layout { grid-template-columns: 1fr; } }

/* Questions: quick jump bar (stays at the top while scrolling) */
.qnav { position: sticky; top: 0; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -6px 0 12px; padding: 10px 0; background: var(--cream); border-bottom: 1px solid var(--line); }
.qnav-label { color: var(--muted); font-size: 12px; font-weight: 800; margin-right: 2px; }
.qnav button { padding: 5px 12px; border: 1px solid #CFC5B8; border-radius: 999px; background: #fff; font: 600 12.5px var(--font); color: var(--ink); cursor: pointer; }
.qnav button:hover { border-color: var(--red); color: var(--red); }
.qnav .qnav-contact { background: #F3EBDD; }
#panel-questions [data-menu], #panel-questions .qcard, #contact-section { scroll-margin-top: 120px; }
.answer.flash { animation: card-flash 1.6s ease; border-radius: 8px; }

/* Picture on a question */
.pic-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.pic-thumb { display: block; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; line-height: 0; }
.pic-thumb img { width: 72px; height: auto; }
.pic-actions { display: flex; flex-direction: column; gap: 6px; }
.video-form { display: flex; gap: 6px; width: 100%; max-width: 520px; }
.video-form[hidden] { display: none; }
.video-form input { flex: 1; }

/* Questions tree */
.tree { display: flex; flex-direction: column; gap: 10px; }
.qcard { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; transition: box-shadow .3s; }
.qcard.start { border: 2px solid #D9C8AE; background: #FFFDF9; }
.qcard.flash { animation: card-flash 1.6s ease; }
@keyframes card-flash { 0%, 40% { box-shadow: 0 0 0 4px var(--gold); } 100% { box-shadow: none; } }
.qhead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.qhead .icon-btn { margin-left: auto; }
.qtag { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.qtext-input { font-weight: 700; font-size: 15px; min-height: 48px; }
.start-msg { margin: 0 0 2px; font-weight: 700; font-size: 16px; }
.kind-switch { display: inline-flex; margin: 10px 0 4px; border: 1px solid #CFC5B8; border-radius: 999px; overflow: hidden; background: #fff; }
.kind-switch button { padding: 6px 14px; border: 0; border-right: 1px solid #CFC5B8; background: none; font: 600 13px var(--font); color: var(--muted); cursor: pointer; }
.kind-switch button:last-child { border-right: 0; }
.kind-switch button[aria-pressed=true] { background: var(--ink); color: #fff; }
.answers-head { display: grid; grid-template-columns: 22px minmax(110px, 1fr) minmax(0, 240px) 34px 112px; gap: 6px; margin: 12px 0 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.answer { grid-template-columns: 22px minmax(110px, 1fr) minmax(0, 240px) 34px 112px; }
.answer.no-go, .answers-head.no-go { grid-template-columns: 22px minmax(0, 1fr) 34px; }
.go-select { font-size: 13px; }
.nest { margin: 2px 0 10px 16px; padding: 4px 0 4px 16px; border-left: 3px solid #E2D3BC; }
.if-label { margin: 2px 0 6px; color: var(--red); font-size: 12.5px; font-weight: 800; }
.nest > .qcard { background: #FFFEFB; }
.then { margin: 2px 0 2px 14px; color: var(--muted); font-size: 12px; font-weight: 800; }
.jump { padding: 8px 12px; border-radius: 8px; background: #F7F2EA; font-size: 13px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--red); font: 700 13px var(--font); text-decoration: underline; cursor: pointer; }
.after { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.after label { font-size: 13px; }
.more { margin-top: 10px; }
.more > summary { color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.more[open] > summary { margin-bottom: 10px; }
h2.section-title { display: block; margin: 26px 0 4px; font-size: 18px; }
@media (max-width: 640px) {
  .answer, .answers-head { grid-template-columns: 22px 1fr 34px 104px; }
  .answer.no-go, .answers-head.no-go { grid-template-columns: 22px 1fr 34px; }
  .answer .go-select { grid-column: 2 / -1; grid-row: 2; }
  .answers-head span:nth-child(2) { display: none; }
  .nest { margin-left: 6px; padding-left: 10px; }
}

.install pre { white-space: pre-wrap; word-break: break-all; padding: 14px; border-radius: 10px; background: var(--ink); color: #F4EFE6; font-size: 13px; }

@media (max-width: 980px) {
  .builder { grid-template-columns: 1fr; }
  .builder-side { position: static; height: 640px; border-left: 0; border-top: 1px solid var(--line); }
  .save-bar { right: 0; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}

/* Drag handle and open/close arrow on button and answer rows */
.drag-handle { display: grid; place-items: center; height: 34px; color: #A89F93; font-size: 16px; cursor: grab; border-radius: 6px; user-select: none; }
.drag-handle:hover, .drag-handle:focus-visible { color: var(--ink); background: #F3EBDD; outline: none; }
.answer.dragging { opacity: .4; }
.answer.drop-above { box-shadow: 0 -3px 0 var(--red); }
.answer.drop-below { box-shadow: 0 3px 0 var(--red); }
.toggle-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 34px; padding: 0 8px; border: 1px solid #CFC5B8; border-radius: 8px; background: #fff; color: var(--ink); cursor: pointer; font: 700 12px var(--font); }
.toggle-btn:hover { border-color: var(--red); color: var(--red); }
.toggle-btn .chev { display: inline-block; transition: transform .15s; }
.toggle-btn[aria-expanded=true] .chev { transform: rotate(90deg); }
.toggle-btn .count { color: var(--muted); font-weight: 600; }
.nest[hidden] { display: none; }

/* "Next, depending on their earlier answer" rows */
.after-rules { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.after-rules > label { display: block; margin-bottom: 6px; font-size: 13px; }
.rule-label { font-size: 13px; font-weight: 700; color: #4A4139; }
.nest.shared { margin-left: 0; }
