/* Codeo prospect-demo UI (built by ui.js). Desktop: brand bar top-left, side panel right, toolbar bottom-left.
   ≤ 860 px: the panel becomes a bottom sheet, the toolbar moves to the top. Brand colours: --accent, --ink, --font. */
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; font-family: var(--font); color: var(--ink); }
#ui > * { pointer-events: auto; }
#ui button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
#ui [hidden] { display: none !important; }

:root {
  --panel-w: 384px;
  --line: color-mix(in srgb, var(--ink) 11%, transparent);
  --muted: color-mix(in srgb, var(--ink) 58%, transparent);
  --soft: color-mix(in srgb, var(--ink) 5%, white);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, white);
  --radius: 14px;
  --shadow: 0 10px 40px rgba(16, 24, 40, .12), 0 2px 8px rgba(16, 24, 40, .06);
}

/* ------------------------------------------------------------ brand bar */
.cd-brandbar {
  position: absolute; left: 20px; top: 18px; display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 2px 12px rgba(16, 24, 40, .08);
}
.cd-mark img { display: block; height: 30px; max-width: 200px; object-fit: contain; }
.cd-wordmark { font-weight: 700; font-size: 18px; letter-spacing: .01em; }
.cd-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 4px 9px; border-radius: 99px;
}
.cd-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: cd-pulse 2s infinite; }
@keyframes cd-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ------------------------------------------------------------ panel */
.cd-panel {
  position: absolute; top: 16px; right: 16px; bottom: 16px; width: var(--panel-w);
  display: flex; flex-direction: column; background: var(--paper, #fff); border-radius: 18px; box-shadow: var(--shadow);
  /* clip, not hidden: a hidden box can still be scrolled by focus, which slid the head and options out of view */
  overflow: hidden; overflow: clip;
}
.cd-handle { display: none; }
.cd-head { padding: 22px 24px 12px; border-bottom: 1px solid var(--line); }
.cd-head h1 { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.25; }
.cd-head p { margin: 4px 0 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
/* positioned, so absolutely placed controls inside (switch checkboxes) scroll and clip with the options */
.cd-body { position: relative; flex: 1; overflow-y: auto; padding: 6px 24px 18px; overscroll-behavior: contain; }
.cd-body::-webkit-scrollbar { width: 8px; }
.cd-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }

.cd-presets h2, .cd-section-head span {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.cd-presets { padding: 14px 0 6px; }
.cd-presets h2 { margin: 0 0 10px; }
.cd-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.cd-chips::-webkit-scrollbar { display: none; }
#ui .cd-chip {
  flex: 0 0 auto; text-align: left; padding: 9px 12px; border-radius: 12px; border: 1.5px solid var(--line);
  background: #fff; max-width: 190px; transition: border-color .15s, background .15s;
}
.cd-chip b { display: block; font-size: 13px; font-weight: 600; }
.cd-chip small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ui .cd-chip:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
#ui .cd-chip.on { border-color: var(--accent); background: var(--accent-soft); }

.cd-section { border-top: 1px solid var(--line); }
.cd-presets + .cd-section { margin-top: 8px; }
#ui .cd-section-head { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 16px 0 10px; }
.cd-section-head svg { width: 16px; height: 16px; color: var(--muted); transition: transform .2s; }
.cd-section.collapsed .cd-section-head svg { transform: rotate(-90deg); }
.cd-section.collapsed .cd-section-body { display: none; }
.cd-section-body { padding-bottom: 12px; }

.cd-opt { margin: 4px 0 16px; }
.cd-opt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.cd-opt-head label { font-size: 14px; font-weight: 600; }
.cd-opt-value { font-size: 12.5px; color: var(--muted); text-align: right; min-width: 0; max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-help { margin: -4px 0 8px; font-size: 12px; color: var(--muted); line-height: 1.4; }

/* segmented choice */
.cd-seg { display: flex; background: var(--soft); border-radius: 11px; padding: 3px; gap: 3px; }
#ui .cd-seg button {
  flex: 1; padding: 8px 6px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--muted);
  transition: background .15s, color .15s, box-shadow .15s; white-space: nowrap;
}
.cd-seg button b { font-weight: inherit; }
.cd-seg button small { display: block; font-size: 10.5px; opacity: .75; }
#ui .cd-seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 4px rgba(16, 24, 40, .12); }

/* card choice */
.cd-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
#ui .cd-cards button {
  text-align: left; padding: 10px 12px; border-radius: 11px; border: 1.5px solid var(--line); background: #fff;
  transition: border-color .15s, background .15s;
}
.cd-cards button b { display: block; font-size: 13px; font-weight: 600; line-height: 1.25; }
.cd-cards button small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.3; }
#ui .cd-cards button:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
#ui .cd-cards button.on { border-color: var(--accent); background: var(--accent-soft); }

/* swatches */
.cd-sw-group { font-size: 11.5px; color: var(--muted); margin: 6px 0 6px; font-weight: 500; }
.cd-swatches { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 6px; }
#ui .cd-sw {
  width: 36px; height: 36px; border-radius: 50%; padding: 0; position: relative;
  background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14), inset 0 -6px 10px rgba(0, 0, 0, .12), inset 0 5px 8px rgba(255, 255, 255, .22);
  transition: transform .12s;
}
#ui .cd-sw:hover { transform: scale(1.08); }
#ui .cd-sw.on::after {
  content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--accent);
}

/* slider */
.cd-num { display: inline-flex; align-items: center; gap: 6px; }
.cd-num input {
  width: 78px; padding: 6px 8px; border: 1.5px solid var(--line); border-radius: 9px; font: inherit; font-size: 13.5px;
  font-weight: 600; text-align: right; color: var(--ink); background: #fff; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.cd-num input:focus { outline: none; border-color: var(--accent); }
.cd-num input::-webkit-inner-spin-button { -webkit-appearance: none; }
.cd-num em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.cd-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 6px; margin: 8px 0 4px;
  background: linear-gradient(to right, var(--accent) 0, var(--accent) var(--p, 50%), var(--line) var(--p, 50%));
}
.cd-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  border: 2px solid var(--accent); box-shadow: 0 1px 4px rgba(16, 24, 40, .2); cursor: grab;
}
.cd-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); cursor: grab; }
.cd-range-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* toggle */
.cd-switch { position: relative; display: grid; grid-template-columns: 40px 1fr; align-items: center; column-gap: 12px; cursor: pointer; }
.cd-switch input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cd-track { width: 40px; height: 23px; border-radius: 23px; background: var(--line); position: relative; transition: background .15s; }
.cd-track::after {
  content: ''; position: absolute; top: 2.5px; left: 2.5px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s;
}
.cd-switch input:checked + .cd-track { background: var(--accent); }
.cd-switch input:checked + .cd-track::after { transform: translateX(17px); }
.cd-switch-label { font-size: 14px; font-weight: 600; }
.cd-switch small { grid-column: 2; font-size: 12px; color: var(--muted); margin-top: 2px; }

.cd-credit { font-size: 11.5px; color: var(--muted); line-height: 1.45; margin: 10px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------ summary footer */
.cd-foot { border-top: 1px solid var(--line); padding: 12px 24px 18px; background: var(--paper, #fff); }
.cd-spec summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer;
  font-size: 13px; font-weight: 600; padding: 2px 0 10px;
}
.cd-spec summary::-webkit-details-marker { display: none; }
.cd-spec summary svg { width: 16px; height: 16px; color: var(--muted); transition: transform .2s; flex: 0 0 auto; }
.cd-spec:not([open]) summary svg { transform: rotate(-90deg); }
.cd-spec dl, .cd-modal dl {
  display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; margin: 0 0 12px; font-size: 12.5px; max-height: 30vh; overflow-y: auto;
}
.cd-spec dt, .cd-modal dt { color: var(--muted); }
.cd-spec dd, .cd-modal dd { margin: 0; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.cd-buy { display: flex; align-items: center; gap: 14px; }
.cd-price { flex: 1; min-width: 0; }
.cd-price small { display: block; font-size: 11.5px; color: var(--muted); }
.cd-price strong { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
#ui .cd-cta {
  flex: 1; padding: 14px 16px; border-radius: 12px; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 14.5px; transition: filter .15s, transform .1s;
}
.cd-price[hidden] + .cd-cta { flex: 1 1 100%; }
#ui .cd-cta:hover { filter: brightness(1.08); }
#ui .cd-cta:active { transform: scale(.98); }

/* ------------------------------------------------------------ toolbar */
.cd-toolbar {
  position: absolute; left: 20px; bottom: 20px; right: calc(var(--panel-w) + 40px);
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; pointer-events: none !important;
}
.cd-toolbar > * { pointer-events: auto; }
.cd-seg-wrap, .cd-tools {
  display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 13px;
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 2px 12px rgba(16, 24, 40, .1);
}
.cd-seg-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 4px 0 8px; }
.cd-toolbar .cd-seg { background: transparent; padding: 0; }
#ui .cd-toolbar .cd-seg button { flex: 0 0 auto; padding: 7px 11px; font-size: 12.5px; }
#ui .cd-toolbar .cd-seg button.on { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
#ui .cd-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--ink); transition: background .15s; }
#ui .cd-icon:hover { background: var(--soft); }
#ui .cd-icon.on { background: var(--accent); color: var(--accent-ink); }
.cd-icon svg { width: 19px; height: 19px; }

.cd-hint {
  position: absolute; left: 50%; bottom: 84px; transform: translateX(calc(-50% - var(--panel-w) / 2));
  padding: 8px 14px; border-radius: 99px; background: rgba(20, 24, 32, .72); color: #fff; font-size: 12.5px;
  pointer-events: none !important; transition: opacity .8s; white-space: nowrap;
}
.cd-hint.gone { opacity: 0; }

.cd-toast {
  position: absolute; left: 50%; top: 22px; transform: translate(-50%, -20px); opacity: 0; pointer-events: none !important;
  padding: 10px 16px; border-radius: 12px; background: #15181e; color: #fff; font-size: 13px; box-shadow: var(--shadow);
  transition: opacity .25s, transform .25s; max-width: 86vw;
}
.cd-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------ quote modal */
.cd-modal { position: absolute; inset: 0; background: rgba(12, 16, 24, .42); display: grid; place-items: center; padding: 20px; z-index: 30; }
.cd-modal-card {
  position: relative; width: min(520px, 100%); max-height: 88vh; overflow-y: auto; background: #fff; border-radius: 18px;
  padding: 26px 26px 22px; box-shadow: var(--shadow);
}
#ui .cd-modal-close { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
#ui .cd-modal-close:hover { background: var(--soft); }
.cd-modal-close svg { width: 18px; height: 18px; }
.cd-modal h3 { margin: 0 34px 8px 0; font-size: 19px; }
.cd-modal-text { margin: 0 0 18px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.cd-modal dl { max-height: none; padding: 14px; background: var(--soft); border-radius: 12px; }
.cd-modal-price { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 2px 18px; }
.cd-modal-price span { font-size: 12.5px; color: var(--muted); }
.cd-modal-price strong { font-size: 22px; }
.cd-modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
#ui .cd-primary, #ui .cd-secondary { padding: 11px 16px; border-radius: 11px; font-weight: 600; font-size: 13.5px; }
#ui .cd-primary { background: var(--accent); color: var(--accent-ink); }
#ui .cd-secondary { background: var(--soft); }

/* ------------------------------------------------------------ phones / small tablets */
@media (max-width: 860px) {
  :root { --panel-w: 0px; }
  .cd-brandbar { left: 10px; top: max(10px, env(safe-area-inset-top)); padding: 7px 10px; gap: 8px; }
  .cd-mark img { height: 22px; max-width: 130px; }
  .cd-wordmark { font-size: 15px; }
  .cd-pill { display: none; }

  .cd-panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 46vh; border-radius: 20px 20px 0 0;
    transition: height .3s ease; padding-bottom: env(safe-area-inset-bottom);
  }
  .cd-panel.expanded { height: 86vh; }
  #ui .cd-handle { display: block; width: 100%; padding: 9px 0 3px; flex: 0 0 auto; }
  .cd-handle span { display: block; width: 42px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto; }
  .cd-head { padding: 4px 18px 10px; }
  .cd-head h1 { font-size: 17px; }
  .cd-head p { display: none; }
  .cd-body { padding: 0 18px 14px; }
  .cd-foot { padding: 10px 18px 12px; }
  .cd-spec dl { max-height: 22vh; }
  .cd-price strong { font-size: 19px; }
  #ui .cd-cta { padding: 12px 14px; font-size: 14px; }

  .cd-toolbar {
    left: auto; right: 10px; top: max(10px, env(safe-area-inset-top)); bottom: auto; flex-direction: column; align-items: flex-end; gap: 6px;
  }
  .cd-seg-label { display: none; }
  .cd-seg-wrap { padding: 4px; }
  #ui .cd-toolbar .cd-seg button { padding: 6px 8px; font-size: 11.5px; }
  .cd-tools { padding: 4px; gap: 2px; }
  #ui .cd-icon { width: 32px; height: 32px; }
  .cd-hint { bottom: calc(46vh + 14px); transform: translateX(-50%); font-size: 11.5px; }
}
@media (max-width: 860px) and (orientation: landscape) and (max-height: 520px) {
  :root { --panel-w: 320px; }
  .cd-panel { top: 8px; right: 8px; bottom: 8px; left: auto; width: var(--panel-w); height: auto; border-radius: 16px; }
  .cd-panel.expanded { height: auto; }
  #ui .cd-handle { display: none; }
  .cd-toolbar { right: calc(var(--panel-w) + 16px); }
  .cd-hint { bottom: 16px; }
}
