/* The PDF maker's editor (studio.js): page rail, canvas, side panel. The
   pages themselves are pages.css. */

#view[data-r=studio] { max-width: none; padding-bottom: 20px; }
.grow { flex: 1; }

/* start screen */
.sx-start { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 28px; padding: 24px; align-items: center; }
.sx-start h2 { margin: 0 0 12px; font-size: 18px; }
.sx-start textarea { width: 100%; font: 500 16px/1.5 var(--sans); padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 12px; resize: vertical; min-height: 96px; color: var(--ink); }
.sx-start textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
.sx-groups { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.sx-g { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font: 600 13px var(--sans); cursor: pointer; color: var(--ink); }
.sx-g:hover { background: var(--brand-tint); border-color: var(--brand); }
.sx-start-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sx-for { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.sx-for select { height: 36px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; font: 500 13px var(--sans); max-width: 260px; }
.sx-start-r .mini.big.pt { width: 200px; height: 281px; }
.sx-start-r .mini.big { width: 380px; height: 270px; border-radius: 12px; box-shadow: 0 10px 30px rgba(17,19,24,.12); }
/* the agency's own list of hotels, tours and rates */
.sx-kb { padding: 20px 24px; margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.sx-kb h2 { margin: 0; font-size: 16px; }
.sx-kb p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink); max-width: 760px; }
.sx-kb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sx-kb-head > span { font-weight: 600; font-size: 13px; }
.sx-kb-places, .sx-kb-files, .sx-kb-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.sx-kb-places b, .sx-kb-rows b { margin-right: 6px; }
.sx-kb-files li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; }
.sx-kb-files li span:first-child { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-kb-opts { display: flex; gap: 16px; flex-wrap: wrap; }
.sx-kb-opts .field { min-width: 220px; }
.sx-kb-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.sx-kb-map { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.sx-kb-map th, .sx-kb-map td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
.sx-kb-map th select { display: block; height: 30px; border: 1px solid var(--line-2); border-radius: 8px; font: 600 13px var(--sans); padding: 0 6px; }
.sx-kb-map th small { display: block; margin-top: 4px; font-weight: 600; font-size: 12px; color: var(--ink); }
.sx-kb-err { color: #B42318; font-weight: 600; }
.sx-kb-actions { display: flex; gap: 10px; justify-content: flex-end; }
@media (max-width: 640px) { .sx-kb { padding: 16px; } .sx-kb-opts .field { min-width: 0; width: 100%; } }

.sx-list h2 { font-size: 16px; margin: 0 0 12px; }
.sx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 18px; }
.sx-card { display: flex; flex-direction: column; gap: 6px; color: var(--ink); text-decoration: none; position: relative; }
.sx-card .mini { width: 236px; height: 168px; border-radius: 10px; box-shadow: 0 1px 2px rgba(17,19,24,.08), 0 0 0 1px var(--line); transition: transform .15s, box-shadow .15s; }
.sx-card:hover .mini { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(17,19,24,.12), 0 0 0 1px var(--line); }

/* a page drawn small */
.mini { position: relative; overflow: hidden; background: #F4EFE7; flex: none; }
.mini-in { position: absolute; left: 0; top: 0; width: 1440px; height: 1024px; transform-origin: 0 0; pointer-events: none; }

/* segmented format switch */
.sx-seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; height: 32px; }
.sx-seg button { border: 0; background: #fff; padding: 0 12px; font: 600 12.5px var(--sans); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.sx-seg button.on { background: var(--brand-deep); color: #fff; }
.sx-seg button:disabled { cursor: default; color: var(--ink-2); }
.sx-bar .sx-seg { height: 30px; flex: none; }
.sx-bar .sx-seg button { padding: 0 10px; font-size: 12px; }
.sx-seg em { font-style: normal; font-size: 10.5px; font-weight: 700; background: var(--brand); color: var(--brand-on); border-radius: 4px; padding: 1px 5px; }

/* editor */
.sx { display: flex; flex-direction: column; gap: 14px; height: calc(100vh - 64px - 28px - 20px); min-height: 560px; }
.sx-canvas { position: relative; }
.sx-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sx-bar { flex-wrap: nowrap; }
.sx-name { font: 700 18px var(--sans); border: 1px solid transparent; border-radius: 8px; padding: 4px 8px; min-width: 120px; flex: 1 1 380px; color: var(--ink); background: transparent; text-overflow: ellipsis; }
.sx-name:hover { border-color: var(--line-2); }
.sx-name:focus { outline: 2px solid var(--brand); background: #fff; }
.sx-saved { font-size: 12.5px; font-weight: 600; color: var(--good); }
.sx-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 168px minmax(0, 1fr) 340px; gap: 16px; }

.sx-rail { overflow-y: auto; padding-right: 4px; display: flex; flex-direction: column; gap: 10px; }
.sx-rail ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sx-rail li { cursor: grab; display: flex; flex-direction: column; gap: 4px; border-radius: 10px; padding: 4px; border: 2px solid transparent; position: relative; }
.sx-rail li .mini { width: 132px; height: 94px; border-radius: 6px; box-shadow: 0 0 0 1px var(--line-2); }
.sx-rail li .mini.pt { width: 100px; height: 141px; }
.sx-rail li span { font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sx-rail li.on { border-color: var(--brand); background: var(--brand-tint); }
.sx-rail li.off .mini { opacity: .4; }
.sx-rail li.above::before, .sx-rail li.below::after { content: ''; position: absolute; left: 4px; right: 4px; height: 3px; border-radius: 3px; background: var(--brand); }
.sx-rail li.above::before { top: -7px; } .sx-rail li.below::after { bottom: -7px; }
.sx-rail li.drop { border-color: var(--brand); background: var(--brand-tint); }
.sx-addp { width: 100%; justify-content: center; }

.sx-canvas { overflow-y: auto; background: #E9E6E1; border-radius: 14px; padding: 18px 20px 40px; --s: .5; }
.sx-pg { margin: 0 auto 26px; width: calc(var(--pw, 1440px) * var(--s)); }
.sx-pg-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; min-height: 30px; font-size: 13px; color: var(--ink); }
.sx-pg-bar b { font-weight: 700; }
.sx-pg-bar .btn.sm { height: 28px; font-size: 12px; opacity: 0; transition: opacity .12s; }
.sx-pg:hover .sx-pg-bar .btn.sm, .sx-pg.on .sx-pg-bar .btn.sm { opacity: 1; }
.sx-pg-bar .btn svg { width: 12px; height: 12px; color: var(--brand); }
.sx-pg-frame { width: calc(var(--pw, 1440px) * var(--s)); height: calc(var(--ph, 1024px) * var(--s)); overflow: hidden; border-radius: 6px; box-shadow: 0 2px 8px rgba(17,19,24,.12); position: relative; }
.sx-pg.on .sx-pg-frame { box-shadow: 0 0 0 3px var(--brand), 0 6px 18px rgba(17,19,24,.16); }
.sx-pg.off .sx-pg-frame { opacity: .45; }
.sx-pg.drop .sx-pg-frame { box-shadow: 0 0 0 4px var(--brand), 0 6px 18px rgba(17,19,24,.16); }
.sx-pg-in { width: var(--pw, 1440px); height: var(--ph, 1024px); transform: scale(var(--s)); transform-origin: 0 0; }
.sx-end { text-align: center; font-size: 13px; color: var(--ink); padding: 8px 0; }
/* Pages and thumbnails out of view are not drawn until they scroll near: a
   30-page itinerary opens and scrolls like a 3-page one. */
.sx-pg:not(.on) { content-visibility: auto; contain-intrinsic-size: auto calc(var(--pw, 1440px) * var(--s)) auto calc(var(--ph, 1024px) * var(--s) + 38px); }
.sx-rail li { content-visibility: auto; contain-intrinsic-size: auto 120px; }
.sx-card { content-visibility: auto; contain-intrinsic-size: auto 236px auto 230px; }
.sx-ph-grid .skel { aspect-ratio: 1; border-radius: 8px; }

/* editing on the page (sizes are page px, so they scale with it) */
.sx .sp [data-e] { cursor: text; border-radius: 6px; transition: box-shadow .1s; min-width: 40px; display: inline-block; }
.sx .sp p[data-e], .sx .sp h1[data-e], .sx .sp div[data-e] { display: block; }
.sx .sp [data-e]:hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--p) 45%, transparent); }
.sx .sp [data-e][contenteditable=plaintext-only] { box-shadow: 0 0 0 4px var(--a); outline: none; background: rgba(255,255,255,.5); }
.sx .sp [data-e]:empty::before { content: attr(data-ph); opacity: .42; }
.sx .sp .calc[data-go] { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 6px; }
.sx .sp .sugg { text-decoration: underline dotted var(--a) 4px; text-underline-offset: 8px; }
.sx .sp .ph[data-p] { cursor: pointer; }
.sx .sp .ph[data-p]:hover { box-shadow: 0 0 0 6px color-mix(in srgb, var(--p) 45%, transparent); }
.sx .sp .ph.empty[data-p] { background: repeating-linear-gradient(135deg, var(--tint), var(--tint) 14px, color-mix(in srgb, var(--tint) 70%, #fff) 14px, color-mix(in srgb, var(--tint) 70%, #fff) 28px); }
.sx .sp .ph.sel { box-shadow: 0 0 0 8px var(--a); }
.sx .sp .ph.drop { box-shadow: 0 0 0 10px var(--p); }
.sx .sp li.add button, .sx .sp li.add { list-style: none; }
.sx .sp li.add::before, .sx .sp li.add::after { display: none; }
.sx .sp li.add button { border: 2px dashed color-mix(in srgb, var(--p) 50%, transparent); background: transparent; color: var(--p); border-radius: 10px; font: 600 18px var(--body); padding: 6px 14px; cursor: pointer; margin-left: -40px; }
.sx .sp .dc li.add button, .sx .sp .pk-notes li.add button { margin-left: 0; }

/* side panel */
.sx-side { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.sx-tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 8px; flex: none; }
.sx-tabs button { border: 0; background: none; padding: 12px 12px 10px; font: 600 13.5px var(--sans); color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.sx-tabs button.on { color: var(--ink); border-bottom-color: var(--brand); }
.sx-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 14px; gap: 12px; overflow-y: auto; }

.sx-log { flex: 1; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.sx-m { font-size: 13.5px; line-height: 1.5; padding: 10px 12px; border-radius: 12px; max-width: 92%; color: var(--ink); }
.sx-m.me { align-self: flex-end; background: var(--brand); color: var(--brand-on); border-bottom-right-radius: 4px; }
.sx-m.wb { align-self: flex-start; background: var(--tile); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.sx-m.work { display: flex; align-items: center; gap: 10px; }
.sx-m .dots { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--brand-soft); border-top-color: var(--brand); animation: sxspin .8s linear infinite; flex: none; }
@keyframes sxspin { to { transform: rotate(360deg); } }
.sx-fills { display: flex; flex-wrap: wrap; gap: 6px; flex: none; }
.sx-fills p { width: 100%; margin: 0 0 2px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.sx-fill { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--brand-line); background: var(--brand-tint); font: 600 12.5px var(--sans); color: var(--ink); cursor: grab; }
.sx-fill svg { width: 12px; height: 12px; color: var(--brand); }
.sx-fill:hover { background: var(--brand-soft); }
.sx-ask { display: flex; flex-direction: column; gap: 8px; flex: none; }
.sx-ask textarea { width: 100%; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; font: 500 14px/1.45 var(--sans); resize: none; color: var(--ink); }
.sx-ask textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
.sx-ask .btn { align-self: flex-end; }

.sx-ph-top { display: flex; flex-direction: column; gap: 10px; }
.sx-slot { margin: 0; font-size: 13px; color: var(--ink); }
.sx-ph-form { display: flex; gap: 6px; }
.sx-ph-form input { flex: 1; min-width: 0; height: 32px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; font: 500 13px var(--sans); }
.sx-ph-row { display: flex; gap: 6px; flex-wrap: wrap; }
.sx-ph-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sx-ph { border: 0; padding: 0; border-radius: 8px; overflow: hidden; aspect-ratio: 1; cursor: grab; background: var(--tile); }
.sx-ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .15s; }
.sx-ph:hover img { transform: scale(1.06); }
.sx-ph-note { font-size: 12px; color: var(--ink); margin: 0; grid-column: 1 / -1; }
.sx-h3 { font-size: 13px; margin: 6px 0 0; }

.sx-det { display: flex; flex-direction: column; gap: 10px; }
.sx-det .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sx-det .field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.sx-det .field > span:first-child { font-size: 12px; font-weight: 600; color: var(--ink); }
.sx-det input, .sx-det select { height: 34px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 9px; font: 500 13px var(--sans); color: var(--ink); background: #fff; min-width: 0; width: 100%; }
.sx-det .inline { display: flex; gap: 6px; }
.sx-cities { display: flex; flex-direction: column; gap: 6px; }
.sx-city { display: grid; grid-template-columns: minmax(0, 1fr) 54px auto 74px auto; gap: 6px; align-items: center; font-size: 12px; font-weight: 600; }
.sx-det-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 600; }
.sx-fine { font-size: 12px; margin: 0; color: var(--ink); }

/* trip goal chips double as the library filter */
.sx-g { display: inline-flex; align-items: center; gap: 6px; }
.sx-g b { font-size: 11px; background: var(--tile); border-radius: 999px; padding: 1px 7px; }
.sx-g.on { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.sx-g.on b { background: rgba(255,255,255,.2); }

/* the library: search, filters, sort, cards with a menu */
.sx-libbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.sx-list .sx-libbar h2 { margin: 0 auto 0 0; display: flex; align-items: baseline; gap: 8px; }
.sx-libbar h2 span { font-size: 13px; font-weight: 600; color: var(--ink); }
.sx-search { display: inline-flex; align-items: center; gap: 8px; height: 34px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; background: #fff; min-width: 280px; }
.sx-search svg { width: 15px; height: 15px; color: var(--ink); flex: none; }
.sx-search input { border: 0; outline: 0; font: 500 13px var(--sans); width: 100%; background: transparent; color: var(--ink); }
.sx-search:focus-within { outline: 2px solid var(--brand); border-color: transparent; }
.sx-libbar select { height: 34px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; font: 500 13px var(--sans); background: #fff; color: var(--ink); }
.sx-libbar .btn.on { background: var(--brand-tint); border-color: var(--brand-line); }
.sx-pill { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--brand-deep); color: #fff; font: 600 12.5px var(--sans); cursor: pointer; margin-bottom: 12px; }
.sx-none { padding: 30px 0; font-size: 14px; color: var(--ink); }
.sx-cardrow { display: flex; align-items: center; gap: 6px; position: relative; }
.sx-cardname { font-size: 14px; font-weight: 700; color: var(--ink); text-decoration: none; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sx-cardname:hover { text-decoration: underline; }
.sx-rename { flex: 1; min-width: 0; height: 28px; border: 1px solid var(--brand); border-radius: 6px; padding: 0 8px; font: 600 13.5px var(--sans); }
.sx-more { border: 0; background: transparent; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; color: var(--ink); display: grid; place-items: center; flex: none; }
.sx-more:hover { background: var(--tile); }
.sx-more svg { width: 18px; height: 18px; }
.sx-menu { position: absolute; right: 0; top: 30px; z-index: 20; background: #fff; border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 10px 30px rgba(17,19,24,.16); padding: 6px; display: flex; flex-direction: column; min-width: 170px; }
.sx-menu button { border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 6px; font: 500 13px var(--sans); cursor: pointer; color: var(--ink); }
.sx-menu button:hover { background: var(--tile); }
.sx-menu .danger { color: var(--crit); }
.sx-meta { font-size: 12.5px; color: var(--ink); line-height: 1.35; }
.sx-card .chip { align-self: flex-start; }
.sx-card.trashed .mini { opacity: .55; }

/* teammates on this PDF */
.sx-peers { display: flex; align-items: center; gap: 4px; }
.sx-av { width: 28px; height: 28px; border-radius: 50%; background: var(--c); color: #fff; font: 700 11.5px/28px var(--sans); text-align: center; box-shadow: 0 0 0 2px #fff; flex: none; }
.sx-av.sm { width: 22px; height: 22px; font-size: 10px; line-height: 22px; }
.sx-live { font-size: 12.5px; font-weight: 600; color: var(--ink); margin-left: 4px; white-space: nowrap; }
.sx-pg-bar .peers { display: inline-flex; gap: 2px; }
.sx-rail li .peerdot { position: absolute; top: 8px; right: 8px; width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px #fff; }
.sx .sp .peer { box-shadow: 0 0 0 4px var(--peer) !important; position: relative; }
.sx .sp .peer::after { content: attr(data-peer); position: absolute; left: -4px; top: -34px; background: var(--peer); color: #fff; font: 700 18px/1 var(--sans); padding: 6px 9px; border-radius: 6px 6px 6px 0; white-space: nowrap; z-index: 9; letter-spacing: 0; text-transform: none; }

/* the format bar: what the last click selected */
.sx-fmt { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 40px; padding: 4px 8px; background: #fff; border: 1px solid var(--line-2); border-radius: 10px; }
.sx-fgroup { display: inline-flex; align-items: center; gap: 2px; padding-right: 8px; margin-right: 4px; border-right: 1px solid var(--line); }
.sx-fgroup > b { font-size: 12px; margin: 0 6px 0 2px; }
.sx-fb { display: inline-flex; align-items: center; gap: 5px; height: 30px; min-width: 30px; justify-content: center; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; font: 600 12.5px var(--sans); color: var(--ink); cursor: pointer; }
.sx-fb:hover { background: var(--tile); }
.sx-fb.on { background: var(--brand-tint); color: var(--brand-text); }
.sx-fb svg { width: 16px; height: 16px; }
.sx-fb.danger { color: var(--crit); }
.sx-fval { font: 600 12px var(--sans); min-width: 40px; text-align: center; }
.sx-sw { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); margin: 0 2px; cursor: pointer; padding: 0; }
.sx-sw.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand); }
.sx-ftip { font-size: 12.5px; color: var(--ink); margin-left: 4px; }

/* selection on the page (page px, scaled with it) */
.sx .sp .e.sel { box-shadow: 0 0 0 4px var(--a); }
.sx .sp .ph.sel img { cursor: grab; }
.sx .sp .ph.sel:active img { cursor: grabbing; }
.sx .sp .fx { cursor: pointer; }
.sx .sp .fx:hover { outline: 3px dashed color-mix(in srgb, var(--p) 55%, transparent); outline-offset: 4px; }
.sx .sp .fx.sel { outline: 4px solid var(--p); outline-offset: 4px; cursor: move; }
.sx .sp .fx.sel .fx-h { display: block; position: absolute; right: -16px; bottom: -16px; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 4px solid var(--p); cursor: nwse-resize; z-index: 6; }
.sx .sp .fx-text [data-e]:empty::before { content: attr(data-ph); opacity: .45; }

/* what the assistant reads */
.sx-refs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: none; }
.sx-refs > p { width: 100%; margin: 0; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.sx-ref { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 4px 0 8px; border-radius: 6px; background: var(--brand-tint); font: 600 12px var(--sans); color: var(--ink); max-width: 100%; }
.sx-ref svg { width: 13px; height: 13px; flex: none; }
.sx-ref.past { background: var(--tile); padding-right: 8px; }
.sx-ref.rules { padding-right: 8px; box-shadow: inset 0 0 0 1px var(--brand); }
/* what the agent should confirm before sending: in the chat, never on a page */
.sx-checks { display: block; margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--tile); }
.sx-checks b { display: block; margin-bottom: 4px; }
.sx-checks span { display: block; padding-left: 12px; position: relative; }
.sx-checks span::before { content: ''; position: absolute; left: 2px; top: .6em; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.sx-ref button { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; color: var(--ink); padding: 0 4px; }
.sx-refadd { display: inline-flex; gap: 12px; font-size: 12.5px; }
.sx-refadd .linkish { cursor: pointer; }
.sx-refpick { width: 100%; max-height: 160px; overflow-y: auto; border: 1px solid var(--line-2); border-radius: 8px; display: flex; flex-direction: column; }
.sx-refpick button { border: 0; background: #fff; text-align: left; padding: 7px 10px; font: 500 12.5px var(--sans); cursor: pointer; border-bottom: 1px solid var(--line); color: var(--ink); }
.sx-refpick button:hover { background: var(--tile); }

/* the Add page dialog */
.sx-dialog { position: fixed; inset: 0; z-index: 60; background: rgba(17,19,24,.38); display: grid; place-items: center; padding: 24px; }
.sx-dialog[hidden] { display: none; }
.sx-dlg { background: #fff; border-radius: 16px; width: min(1080px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(17,19,24,.3); }
.sx-dlg header { display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.sx-dlg header h2 { margin: 0; font-size: 18px; }
.sx-dlg header p { margin: 0; font-size: 13px; color: var(--ink); flex: 1; }
.sx-tiles { padding: 18px 22px 24px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(206px, 1fr)); gap: 16px; }
.sx-tile { display: flex; flex-direction: column; gap: 4px; cursor: pointer; border-radius: 12px; padding: 6px; border: 2px solid transparent; }
.sx-tile .mini { width: 200px; height: 142px; border-radius: 8px; box-shadow: 0 0 0 1px var(--line-2); }
.sx-tile b { font-size: 13.5px; margin-top: 4px; }
.sx-tile span { font-size: 12px; color: var(--ink); line-height: 1.35; }
.sx-tile:hover { border-color: var(--brand); background: var(--brand-tint); }
.sx-tile.have .mini { opacity: .55; }
.sx-tile select { height: 28px; border: 1px solid var(--line-2); border-radius: 6px; font: 500 12px var(--sans); margin-top: 4px; max-width: 200px; }

.sx-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.sx-old { font-size: 12.5px; color: var(--ink); margin: 16px 0 0; }
.sx-old a { color: var(--brand-text); }
.sx-travbtn { gap: 6px; }
.sx-travbtn.on { background: var(--brand-tint); border-color: var(--brand-line); }

/* costs: the internal sheet (never printed) */
.sx-pane.cs { gap: 10px; }
.cs-head { font-size: 12.5px; color: var(--ink); background: var(--brand-tint); border-radius: 8px; padding: 8px 10px; }
.cs-fx { font-size: 12px; color: var(--ink); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.cs-fx input { width: 70px; height: 24px; border: 1px solid var(--line-2); border-radius: 5px; padding: 0 5px; font: 500 12px var(--sans); }
.cs-src { font-size: 11px; color: var(--ink); }
.cs-lines { display: flex; flex-direction: column; gap: 8px; }
.cs-empty { font-size: 12.5px; margin: 4px 0; color: var(--ink); }
.cs-line { border: 1px solid var(--line-2); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; background: #fff; }
.cs-r { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.cs-line input, .cs-line select { height: 28px; border: 1px solid var(--line-2); border-radius: 6px; padding: 0 6px; font: 500 12px var(--sans); color: var(--ink); background: #fff; min-width: 0; }
.cs-line .grow { flex: 1 1 120px; }
.cs-amt { width: 92px; }
.cs-qty { width: 46px; }
.cs-sup { width: 112px; }
.cs-sum { margin-left: auto; font-size: 12.5px; white-space: nowrap; }
.cs-x { border: 0; background: none; font-size: 17px; line-height: 1; cursor: pointer; color: var(--ink); padding: 0 4px; margin-left: auto; }
.cs-chk { font-size: 11.5px; color: var(--ink); margin-left: auto; }
.cs-was.up { color: var(--crit); font-weight: 700; }
.cs-was.down { color: var(--good); font-weight: 700; }
.cs-add { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-add .btn svg { width: 12px; height: 12px; color: var(--brand); }
.cs-paste { display: flex; flex-direction: column; gap: 6px; }
.cs-paste textarea { width: 100%; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; font: 500 12.5px/1.4 var(--sans); resize: vertical; }
.cs-calc { border-top: 1px solid var(--line-2); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.cs-mini { position: sticky; top: -14px; z-index: 2; margin: -14px -14px 0; padding: 9px 14px; background: var(--brand-deep); color: #fff; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; }
.cs-mini b { font-weight: 700; }
.cs-mini .low { color: #FFB4A9; }
.cs-ctl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.cs-ctl label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--ink); }
.cs-ctl input:not([type=range]), .cs-ctl select { height: 28px; border: 1px solid var(--line-2); border-radius: 6px; padding: 0 6px; font: 500 12.5px var(--sans); }
.cs-ctl .cs-mk { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 8px; }
.cs-ctl .cs-mk input { flex: 1; accent-color: var(--brand); }
.cs-qs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.cs-q dl { display: grid; grid-template-columns: auto auto; gap: 3px 8px; margin: 0; font-size: 12.5px; }
.cs-q dt { color: var(--ink); }
.cs-q dd { margin: 0; text-align: right; font-weight: 600; }
.cs-q dd span { display: block; font-size: 11px; font-weight: 500; }
.cs-q .big { font-size: 14px; font-weight: 700; padding-top: 4px; border-top: 1px solid var(--line); }
.cs-q .low { color: var(--crit); }
.cs-qh { display: block; font-size: 12px; margin-bottom: 4px; }
.cs-out { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-fine { font-size: 11px; color: var(--ink); margin: 0; }

/* the traveller box: floats over everything, drag it by its header */
.sx-trav { position: fixed; z-index: 50; width: 320px; max-height: min(560px, calc(100vh - 24px)); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 18px 50px rgba(17,19,24,.22); overflow: hidden; }
.sx-trav[hidden] { display: none; }
.sx-trav header { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; background: var(--brand-deep); color: #fff; cursor: grab; user-select: none; touch-action: none; }
.sx-trav header:active { cursor: grabbing; }
.sx-trav header b { display: block; font-size: 14px; }
.sx-trav header span:not(.sx-av) { font-size: 11.5px; opacity: .85; }
.sx-trav header .sx-av { box-shadow: 0 0 0 2px rgba(255,255,255,.35); background: var(--brand-soft); color: var(--brand-deep); }
.sx-trav header button { border: 0; background: rgba(255,255,255,.14); color: #fff; width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font: 700 15px/1 var(--sans); }
.tv-body { padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; font-size: 12.5px; }
.tv-body p { margin: 0; }
.tv-body select { height: 32px; border: 1px solid var(--line-2); border-radius: 8px; font: 500 12.5px var(--sans); }
.tv-body dl { display: grid; grid-template-columns: 76px 1fr; gap: 4px 8px; margin: 0; }
.tv-body dt { font-weight: 600; }
.tv-body dd { margin: 0; }
.tv-note { background: var(--brand-tint); border-radius: 8px; padding: 8px 10px; white-space: pre-line; }
.tv-h { font-weight: 700; font-size: 12px; }
.tv-past { margin: 0; padding-left: 16px; }
.tv-chat { display: flex; flex-direction: column; gap: 5px; max-height: 190px; overflow-y: auto; }
.tv-m { padding: 6px 9px; border-radius: 10px; max-width: 88%; line-height: 1.35; }
.tv-m.in { background: var(--tile); align-self: flex-start; border-bottom-left-radius: 3px; }
.tv-m.out { background: var(--brand-tint); align-self: flex-end; border-bottom-right-radius: 3px; }
.tv-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.tv-acts .btn svg { width: 12px; height: 12px; color: var(--brand); }

@media (max-width: 1280px) {
  .sx-body { grid-template-columns: minmax(0, 1fr) 320px; }
  .sx-rail { display: none; }
}
@media (max-width: 900px) {
  .sx { height: auto; }
  /* the top bar and each page's tools wrap, so every button stays on screen */
  .sx-bar { flex-wrap: wrap; row-gap: 8px; }
  .sx-name { flex: 1 1 calc(100% - 150px); min-width: 0; }
  .sx-pg-bar { flex-wrap: wrap; row-gap: 6px; }
  .sx-pg-bar .btn.sm { opacity: 1; }
  .sx-body { grid-template-columns: 1fr; }
  .sx-canvas { max-height: 70vh; }
  .sx-start { grid-template-columns: 1fr; }
  .sx-start-r { display: none; }
}

/* costs: what was paid last time, suppliers, the margin floor */
.cs-memo { font-size: 11.5px; color: var(--ink); background: var(--tile); border-radius: 6px; padding: 5px 8px; }
.cs-memo a { color: var(--brand-text); font-weight: 600; }
.cs-sup-view { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.cs-tab { width: 100%; border-collapse: collapse; font-size: 12px; }
.cs-tab th, .cs-tab td { text-align: left; padding: 5px 4px; border-bottom: 1px solid var(--line); }
.cs-tab th { font-weight: 600; color: var(--ink-2); }
.cs-tab td.low { color: var(--crit); font-weight: 700; }
.cs-supq { height: 32px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; font: inherit; font-size: 12.5px; }
.cs-rates { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow: auto; }
.cs-rates > div { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; font-size: 12px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.cs-rates b { font-weight: 600; } .cs-rates span { text-align: right; } .cs-rates em { grid-column: 1 / -1; font-style: normal; font-size: 11px; color: var(--ink-2); }
.cs-floor { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink); }
.cs-floor label { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.cs-floor input { width: 64px; height: 28px; border: 1px solid var(--line-2); border-radius: 6px; padding: 0 6px; font: inherit; }
.cs-under { font-size: 11.5px; color: var(--crit); font-weight: 600; margin: 6px 0 0; }
.cs-okd { background: var(--warn-bg); color: var(--warn); border-radius: 6px; padding: 5px 8px; font-weight: 600; }
.cs-add .btn.on { background: var(--brand-tint); color: var(--brand-text); }

/* a note for the owner, and what changed since they opened it */
.sx-note { width: min(520px, 100%); }
.sx-note-b { padding: 16px 22px 20px; display: flex; flex-direction: column; gap: 10px; }
.sx-note-b p { margin: 0; font-size: 13.5px; color: var(--ink); }
.sx-note-b textarea { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 13.5px; resize: vertical; }
.sx-note-r { display: flex; justify-content: flex-end; gap: 8px; }
.sx-chgd { width: min(720px, 100%); }
.sx-chg-list { list-style: none; margin: 0; padding: 12px 22px 20px; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.sx-chg-list li { display: flex; flex-direction: column; gap: 3px; font-size: 13px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.sx-chg-list del { color: var(--crit); background: var(--crit-bg); text-decoration: line-through; border-radius: 4px; padding: 2px 6px; }
.sx-chg-list ins { color: var(--good); background: var(--good-bg); text-decoration: none; border-radius: 4px; padding: 2px 6px; }
.sx-chg-list em { font-style: normal; color: var(--ink-2); }
.sx-chgb { border: 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; }
.sx-host { gap: 10px; padding: 8px 10px; background: var(--brand-tint); border-radius: 8px; }

/* Asking suppliers (0167): the panel, and the answers under each line */
.cs-ans { display: flex; flex-direction: column; gap: 4px; }
.cs-ans:empty { display: none; }
.cs-a { font-size: 12px; color: var(--ink); background: var(--tile); border-radius: 6px; padding: 5px 8px; line-height: 1.45; }
.cs-a b { font-weight: 700; }
.cs-a.best { background: var(--brand-tint); }
.cs-a.wait { background: #fff; border: 1px dashed var(--line-2); }
.cs-a .linkish { font-weight: 700; margin-left: 4px; }
.cs-best, .cs-using, .cs-fit { font-style: normal; font-weight: 700; font-size: 11px; color: var(--brand-text); }
/* Market prices under a line (0177) */
.cs-mkt { display: flex; flex-direction: column; gap: 4px; }
.cs-mkt-h { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--ink); }
.cs-mkt-h b { font-weight: 700; }
.cs-mkt-h .linkish { font-weight: 700; margin-left: auto; }
.cs-mkt-msg { margin: 0; font-size: 12px; color: var(--ink); }
.cs-a.mkt { background: #fff; border: 1px solid var(--line-2); }
.cs-a.mkt.best { background: var(--brand-tint); border-color: transparent; }
.cs-mkt-ask { display: flex; gap: 6px; }
.cs-mkt-ask input { flex: 1; min-width: 0; font-size: 12px; }
.cs-mkt-ans { margin: 0; font-size: 12px; color: var(--ink); line-height: 1.45; background: var(--tile); border-radius: 6px; padding: 6px 8px; }
.cs-mkt-ans p { margin: 0 0 2px; }
.cs-mkt-ans .cs-r { gap: 10px; }
.cs-mkt-watch { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: var(--ink); line-height: 1.45; border-radius: 6px; padding: 5px 8px; }
.cs-mkt-watch.good { background: var(--good-bg); }
.cs-mkt-watch.warn { background: var(--warn-bg); }
.cs-mkt-watch.crit { background: var(--crit-bg); }
.cs-mkt-watch span { flex: 1 1 auto; }
.cs-mkt-watch .linkish { font-weight: 700; }
.cs-ask { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.cs-ask p { font-size: 12.5px; color: var(--ink); margin: 0; }
.cs-ask-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cs-ask-col { display: flex; flex-direction: column; gap: 4px; }
.cs-ask-col > b { font-size: 12px; }
.cs-ask textarea { width: 100%; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; font: 500 12.5px/1.4 var(--sans); resize: vertical; }
.cs-pick { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.cs-pick input { margin-top: 2px; flex: none; accent-color: var(--brand); }
.cs-pick em { font-style: normal; font-weight: 600; font-size: 11px; }
.cs-pick.off { cursor: default; opacity: .7; }
.cs-sent { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.cs-book { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.cs-book label { display: inline-flex; align-items: center; gap: 6px; }
.cs-book input[type="number"] { width: 96px; height: 28px; border: 1px solid var(--line-2); border-radius: 6px; padding: 0 6px; font: 500 12px var(--sans); }
