:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; } :root[data-theme="dark"] { color-scheme: dark; }
:root {
  --bg: #f6f5f2; --panel: #ffffff; --ink: #1d1d1f; --muted: #6b6b73; --line: #e4e2dc; --hover: #f0eee9;
  --accent: #0b8f8a; --accent-ink: #fff; --accent-soft: #dcf3f1; --danger: #c93a3a; --ok: #1f8a4c; --warn: #b7791f;
  --rail: #18181b; --rail-ink: #d4d4d8; --rail-active: #2a2a30; --shadow: 0 8px 30px rgba(0,0,0,.12);
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
    --bg: #131316; --panel: #1c1c21; --ink: #ececef; --muted: #9a9aa5; --line: #2c2c33; --hover: #26262d;
    --accent: #2dd4cb; --accent-ink: #062a2c; --accent-soft: #123a3d; --danger: #ff6b6b; --ok: #4cc380; --warn: #e0a84a;
    --rail: #0c0c0e; --rail-active: #1f1f25; --shadow: 0 8px 30px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
    --bg: #131316; --panel: #1c1c21; --ink: #ececef; --muted: #9a9aa5; --line: #2c2c33; --hover: #26262d;
    --accent: #2dd4cb; --accent-ink: #062a2c; --accent-soft: #123a3d; --danger: #ff6b6b; --ok: #4cc380; --warn: #e0a84a;
    --rail: #0c0c0e; --rail-active: #1f1f25; --shadow: 0 8px 30px rgba(0,0,0,.5);
  }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 16px; }

/* shell */
#app { display: flex; height: 100vh; }
.rail { width: 208px; background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; padding: 14px 10px; flex-shrink: 0; overflow-y: auto; }
.brand { font-weight: 700; font-size: 16px; color: #fff; padding: 6px 10px 14px; letter-spacing: -.01em; }
.brand b { color: var(--accent); }
.nav a { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 8px; color: var(--rail-ink); }
.nav a:hover { background: var(--rail-active); }
.nav a.active { background: var(--rail-active); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.nav details.setup { margin-top: 2px; } .nav summary.sep { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; user-select: none; } .nav summary.sep::-webkit-details-marker { display: none; } .nav summary.sep::after { content: '▸'; font-size: 10px; } .nav details[open] > summary.sep::after { content: '▾'; } .nav summary.sep:hover { color: #a1a1aa; }
.nav .sep { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #71717a; padding: 14px 10px 4px; }
.me { margin-top: auto; padding: 10px; border-top: 1px solid #2a2a30; font-size: 12px; }
.me button { background: none; border: 0; color: #a1a1aa; padding: 0; cursor: pointer; text-decoration: underline; margin-right: 10px; }
main { flex: 1; overflow: auto; padding: 24px 32px 60px; min-width: 0; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

/* controls */
.btn { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: none; }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: default; }
input, select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { width: auto; }
textarea { min-height: 72px; resize: vertical; }
label.f { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.search { max-width: 260px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; font-size: 12px; cursor: pointer; background: var(--panel); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 5px 12px; cursor: pointer; }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* cards, tables */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.stat { cursor: pointer; } .stat:hover { border-color: var(--accent); }
.stat .n { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--panel); position: sticky; top: 0; cursor: default; white-space: nowrap; }
th.sortable { cursor: pointer; } th.sortable:hover { color: var(--ink); }
tbody tr { cursor: pointer; } tbody tr:hover { background: var(--hover); } tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.c1 { background: #e6f4ec; color: #1f7a45; } .badge.c2 { background: #fdf0d9; color: #96600f; }
.badge.c3 { background: #e3effc; color: #2a62a8; } .badge.c4 { background: #fbe4e4; color: #b03333; } .badge.c5 { background: #efe6fa; color: #7a43b5; }
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) .badge.c1 { background: #17321f; color: #6bd493; }
:root:not([data-theme="light"]) .badge.c2 { background: #3a2c10; color: #f0bf68; }
:root:not([data-theme="light"]) .badge.c3 { background: #15293f; color: #7db5f0; }
:root:not([data-theme="light"]) .badge.c4 { background: #3d1a1a; color: #ff9b9b; }
:root:not([data-theme="light"]) .badge.c5 { background: #2c1d40; color: #c39bf0; }
}
:root[data-theme="dark"] .badge.c1 { background: #17321f; color: #6bd493; }
:root[data-theme="dark"] .badge.c2 { background: #3a2c10; color: #f0bf68; }
:root[data-theme="dark"] .badge.c3 { background: #15293f; color: #7db5f0; }
:root[data-theme="dark"] .badge.c4 { background: #3d1a1a; color: #ff9b9b; }
:root[data-theme="dark"] .badge.c5 { background: #2c1d40; color: #c39bf0; }

.empty { text-align: center; padding: 40px; color: var(--muted); }

/* board */
.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.col { background: var(--hover); border-radius: var(--radius); width: 270px; flex-shrink: 0; padding: 10px; min-height: 120px; }
.col.over { outline: 2px dashed var(--accent); }
.col h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; }
.kcard { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; margin-bottom: 8px; cursor: grab; }
.kcard:hover { border-color: var(--accent); } .kcard b { display: block; }

/* drawer / modal */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; display: flex; justify-content: flex-end; }
.overlay.center { justify-content: center; align-items: center; }
.drawer { width: min(560px, 100vw); background: var(--panel); height: 100%; overflow-y: auto; box-shadow: var(--shadow); padding: 22px; }
.modal { width: auto; min-width: min(560px, 94vw); max-width: 94vw; background: var(--panel); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .full { grid-column: 1 / -1; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 14px; }
.tabs button { background: none; border: 0; padding: 8px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.tl { border-left: 2px solid var(--line); padding-left: 12px; margin: 0 0 14px 4px; }
.tl .meta { font-size: 12px; color: var(--muted); }
.tl pre { white-space: pre-wrap; margin: 4px 0 0; font: inherit; }

/* flow builder */
.flow { max-width: 640px; margin: 0 auto; }
.node { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; position: relative; }
.node.trigger { border-color: var(--accent); }
.node .tag { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--accent); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.node .tag .tools { margin-left: auto; display: flex; gap: 2px; }
.link { width: 2px; height: 22px; background: var(--line); margin: 0 auto; position: relative; }
.link.add::after { content: ''; }
.addbtn { display: block; margin: 0 auto; border: 1px dashed var(--accent); color: var(--accent); background: none; border-radius: 99px; padding: 3px 14px; cursor: pointer; }
.addbtn:hover { background: var(--accent-soft); }
.vars { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.vars code, code.k { background: var(--hover); padding: 1px 6px; border-radius: 5px; font-size: 12px; cursor: pointer; }
pre.code { background: #111114; color: #e8e8ee; padding: 12px 14px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; margin: 6px 0 14px; }
.bar { height: 22px; background: var(--accent); border-radius: 5px; min-width: 2px; }
.barrow { display: grid; grid-template-columns: 150px 1fr 70px; gap: 10px; align-items: center; margin: 5px 0; font-size: 13px; }
.barrow span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 8px; z-index: 50; box-shadow: var(--shadow); }
.toast.err { background: var(--danger); color: #fff; }
.callout { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 8px; padding: 10px 12px; margin: 10px 0; word-break: break-all; }
.login { width: 100%; max-width: 400px; }
.authwrap { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 1fr) minmax(380px, 1fr); }
.authside { background: linear-gradient(145deg, var(--accent), #2b2470 85%); color: #fff; padding: 56px clamp(32px, 6vw, 88px); display: flex; flex-direction: column; justify-content: center; gap: 28px; position: relative; overflow: hidden; }
.authside::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; background: rgba(255,255,255,.08); }
.authside h2 { font-size: clamp(26px, 3vw, 38px); line-height: 1.2; margin: 0; max-width: 460px; } .authside ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; } .authside li { display: flex; gap: 12px; align-items: center; font-size: 16px; opacity: .95; }
.authside li span { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.16); display: grid; place-items: center; } .authfoot { font-size: 13px; opacity: .7; }
.authmain { display: grid; place-items: center; padding: 32px 24px; background: var(--bg, var(--panel)); }
.authbrand { color: var(--ink); padding-left: 0; font-size: 26px; margin-bottom: 18px; } .authbrand.light { color: #fff; }
.authtitle { font-size: 28px; margin: 0 0 4px; } .login input { padding: 11px 12px; font-size: 15px; } .login .btn.primary { padding: 12px; font-size: 16px; }
@media (max-width: 820px) { .authwrap { grid-template-columns: 1fr; } .authside { display: none; } .authmain { min-height: 100vh; align-items: start; padding-top: 12vh; } }
.ok { color: var(--ok); } .bad { color: var(--danger); }
/* phones & small tablets: the menu becomes a drawer behind a top bar, so the page gets the whole width */
.topbar, .scrim { display: none; }
@media (max-width: 800px) {
  #app { display: block; height: auto; min-height: 100vh; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; padding: 8px 12px; background: var(--rail); color: #fff; }
  .burger { background: none; border: 0; color: #fff; font-size: 24px; line-height: 1; padding: 4px 8px; cursor: pointer; }
  .rail { position: fixed; top: 0; bottom: 0; left: 0; width: 270px; max-width: 84vw; z-index: 50; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .rail.open { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45); } .scrim.open { display: block; }
  main { padding: 16px 14px 60px; overflow: visible; } .grid2 { grid-template-columns: 1fr; }
  .head { flex-wrap: wrap; } .drawer { padding: 16px; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
.row.wrap > select, .row.wrap > input:not([type=checkbox]) { width: auto; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.cal .dow { padding: 6px 8px; font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); background: var(--panel); }
.cal .day { min-height: 104px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; position: relative; overflow: hidden; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.off { background: var(--bg); } .cal .day.off .dn { opacity: .45; }
.cal .dn { font-size: 12px; color: var(--muted); padding: 0 2px 2px; display: flex; justify-content: space-between; }
.cal .today .dn span:first-child { background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 0 7px; font-weight: 700; }
.cal .add { visibility: hidden; border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0 4px; }
.cal .day:hover .add { visibility: visible; }
.ev { display: block; width: 100%; text-align: left; border: 0; font-size: 12px; padding: 2px 6px; border-radius: 5px; margin-bottom: 2px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--accent-soft); color: var(--accent); }
.ev.done { text-decoration: line-through; opacity: .55; }
.ev.c1 { background: #e6f4ec; color: #1f7a45; } .ev.c2 { background: #fdf0d9; color: #96600f; } .ev.c3 { background: #e3effc; color: #2a62a8; } .ev.c4 { background: #fbe4e4; color: #b03333; } .ev.c5 { background: #efe6fa; color: #7a43b5; }
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) .ev.c1 { background: #17321f; color: #6bd493; }
:root:not([data-theme="light"]) .ev.c2 { background: #3a2c10; color: #f0bf68; }
:root:not([data-theme="light"]) .ev.c3 { background: #15293f; color: #7db5f0; }
:root:not([data-theme="light"]) .ev.c4 { background: #3d1a1a; color: #ff9b9b; }
:root:not([data-theme="light"]) .ev.c5 { background: #2c1d40; color: #c39bf0; }
}
:root[data-theme="dark"] .ev.c1 { background: #17321f; color: #6bd493; }
:root[data-theme="dark"] .ev.c2 { background: #3a2c10; color: #f0bf68; }
:root[data-theme="dark"] .ev.c3 { background: #15293f; color: #7db5f0; }
:root[data-theme="dark"] .ev.c4 { background: #3d1a1a; color: #ff9b9b; }
:root[data-theme="dark"] .ev.c5 { background: #2c1d40; color: #c39bf0; }

.more { font-size: 11px; color: var(--muted); cursor: pointer; padding: 0 6px; }
@media (max-width: 760px) { .cal .day { min-height: 70px; } .ev { font-size: 10px; } }

/* dashboard widgets */
.dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.w { position: relative; } .w.s { grid-column: span 1; } .w.m { grid-column: span 2; } .w.l { grid-column: span 3; }
@media (max-width: 760px) { .w.m, .w.l { grid-column: span 1; } }
.w .wt { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; }
.w .big { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.w .tools { display: flex; gap: 2px; margin-bottom: 6px; }
.w.editing { outline: 2px dashed var(--accent); }
.donut { display: flex; gap: 16px; align-items: center; }
.donut .ring { width: 110px; height: 110px; border-radius: 50%; flex-shrink: 0; -webkit-mask: radial-gradient(circle 32px, transparent 98%, #000 100%); mask: radial-gradient(circle 32px, transparent 98%, #000 100%); }
.donut .lg div { font-size: 12.5px; display: flex; gap: 6px; align-items: center; } .donut .lg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.wl { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; } .wl:last-child { border: 0; } .wl:hover b { color: var(--accent); }
.notif { padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; } .notif.unread { font-weight: 600; } .notif .muted { font-weight: 400; }
.dot { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; text-align: center; margin-left: 4px; }
.grid2 > * { min-width: 0; }
pre.code { max-width: 100%; }

/* landing page builder */
.pgbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.pg { display: grid; grid-template-columns: 230px minmax(0, 1fr) 320px; gap: 12px; height: calc(100vh - 140px); min-height: 520px; }
.pg > div { overflow: auto; min-height: 0; }
.pal { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pchip { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 8px 4px; cursor: grab; text-align: center; font-size: 12px; user-select: none; }
.pchip:hover { border-color: var(--accent); background: var(--accent-soft); }
.srow { display: flex; gap: 6px; align-items: center; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; cursor: pointer; font-size: 13px; }
.srow.sel { border-color: var(--accent); background: var(--accent-soft); }
.srow.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.sl { min-height: 60px; padding-bottom: 8px; } .sl.drop-end { box-shadow: inset 0 -3px 0 var(--accent); }
.stage { background: #e4e2dd; border-radius: 10px; padding: 10px; display: flex; justify-content: center; position: relative; overflow: hidden !important; }
.stage iframe { border: 0; background: #fff; border-radius: 6px; height: 100%; width: 100%; transition: width .2s; }
.stage.mobile iframe { width: 390px; }
.dropov { position: absolute; inset: 10px; background: rgba(91, 75, 219, .18); border: 3px dashed var(--accent); border-radius: 8px; display: none; align-items: center; justify-content: center; font-weight: 700; color: var(--accent); z-index: 2; }
.dropov.on { display: flex; }
.imgp { display: flex; gap: 10px; align-items: center; } .imgp img { width: 72px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.litem { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 8px; background: var(--bg); }
@media (max-width: 1100px) { .pg { grid-template-columns: 1fr; height: auto; } .stage { height: 560px; } }
input[type=radio] { width: auto; }

/* affiliates */
.tabs.sub { margin-top: 0; }
.permgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 14px; }
.permgrid label { display: flex; gap: 8px; align-items: center; padding: 4px 0; font-size: 13.5px; }
.codebox { background: var(--hover); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; word-break: break-all; }
.portal-top { display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.portal-top img { height: 30px; } .portal-top .nav2 { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.portal-top .nav2 a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; cursor: pointer; } .portal-top .nav2 a.on { background: var(--accent-soft); color: var(--accent); }
.portal-main { max-width: 1180px; margin: 0 auto; padding: 24px 28px 60px; }

.big { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }

.portal #app { display: block; height: auto; min-height: 100vh; }
.portal .portal-top { position: sticky; top: 0; z-index: 5; }

.rel { color: var(--accent); text-decoration: none; cursor: pointer; } .rel:hover { text-decoration: underline; }
.branch { margin: 12px 0 0 14px; padding-left: 14px; border-left: 3px solid var(--line); }
.branch > b { display: inline-block; margin-bottom: 4px; }

.dropzone { border:2px dashed var(--line); border-radius:10px; padding:18px; text-align:center; color:var(--muted); cursor:pointer; } .dropzone.over, .dropzone:hover { border-color:var(--brand,#3b5bdb); background:rgba(59,91,219,.05); }
.hide { display:none !important; }

.nbadge { margin-left: auto; background: #e03131; color: #fff; border-radius: 99px; font-size: 11px; font-weight: 700; padding: 0 6px; min-width: 18px; text-align: center; }
.nbadge:empty { display: none; }
/* live chat */
.chat { display: grid; grid-template-columns: 320px 1fr; gap: 14px; height: calc(100vh - 190px); min-height: 420px; }
.chat-list, .chat-thread { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-y: auto; }
.chat-list { padding: 10px; display: flex; flex-direction: column; gap: 8px; } .chat-thread { display: flex; flex-direction: column; overflow: hidden; }
.chat-item { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; } .chat-item:hover, .chat-item.on { border-color: var(--accent); background: var(--accent-soft); }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.cm-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.cm { max-width: 78%; } .cm.me { align-self: flex-end; text-align: right; } .cm .who { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.cm .txt { display: inline-block; text-align: left; padding: 8px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); white-space: pre-wrap; word-wrap: break-word; } .cm.me .txt { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chat-reply { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); } .chat-reply textarea { flex: 1; resize: none; }
@media (max-width: 800px) { .chat { grid-template-columns: 1fr; height: auto; } .chat-list { max-height: 260px; } .chat-thread { min-height: 420px; } }

/* surveys */
.sbar { display: grid; grid-template-columns: 110px 1fr 56px; gap: 8px; align-items: center; margin: 5px 0; font-size: 13px; } .sbar .st { background: var(--hover); border-radius: 99px; height: 10px; overflow: hidden; display: block; } .sbar .st i { display: block; height: 100%; background: var(--accent); border-radius: 99px; } .sbar .sl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .sbar .sn { text-align: right; color: var(--muted); }
.kpis { gap: 12px; } .kpi { background: var(--hover); border-radius: 10px; padding: 10px 16px; min-width: 110px; } .kpi b { font-size: 24px; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 40px; } .spark i { flex: 1; background: var(--accent); border-radius: 2px; opacity: .8; }
.quote { border-left: 3px solid var(--accent); padding: 4px 10px; margin: 8px 0; white-space: pre-wrap; }

/* alerts: a big round bell on the right + phone-style banners */
.fab-bell { position: fixed; right: 22px; bottom: 26px; width: 62px; height: 62px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 28px; cursor: pointer; z-index: 60; box-shadow: 0 8px 28px rgba(0,0,0,.28); display: grid; place-items: center; transition: transform .15s; }
.fab-bell:hover { transform: scale(1.06); } .fab-bell .ico { line-height: 1; }
.fab-bell .cnt { position: absolute; top: -4px; right: -4px; } .fab-bell .cnt:empty { display: none; }
.fab-bell .cnt span { display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px; background: #e03131; color: #fff; font-size: 13px; font-weight: 800; border: 2px solid var(--bg); }
.fab-bell.has { animation: bellpulse 2s infinite; } .fab-bell.has .ico { animation: bellring 2.4s infinite; transform-origin: 50% 12%; }
@keyframes bellpulse { 0%, 100% { box-shadow: 0 8px 28px rgba(0,0,0,.28), 0 0 0 0 rgba(224,49,49,.5); } 50% { box-shadow: 0 8px 28px rgba(0,0,0,.28), 0 0 0 14px rgba(224,49,49,0); } }
@keyframes bellring { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(14deg); } 80% { transform: rotate(-12deg); } 85% { transform: rotate(8deg); } 90% { transform: rotate(-5deg); } }
.banners { position: fixed; top: 16px; right: 16px; z-index: 70; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 24px)); pointer-events: none; }
.banner { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; box-shadow: 0 12px 40px rgba(0,0,0,.28); cursor: pointer; animation: bannerin .35s cubic-bezier(.2,.9,.3,1.2); }
.banner.out { opacity: 0; transform: translateY(-14px) scale(.97); transition: opacity .3s, transform .3s; }
.banner .bi { width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 18px; }
.banner .bt { flex: 1; min-width: 0; } .banner .bh { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; } .banner .bb { color: var(--muted); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.banner .bx { background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
@keyframes bannerin { from { opacity: 0; transform: translateY(-24px) scale(.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fab-bell.has, .fab-bell.has .ico, .banner { animation: none; } }
@media (max-width: 800px) { .fab-bell { width: 56px; height: 56px; right: 16px; bottom: 20px; font-size: 25px; } .banners { top: 60px; } }

/* record page layout (sections) */
.grid1 { display: grid; grid-template-columns: 1fr; gap: 12px; } .grid1 > * { min-width: 0; }
.lsec { margin-bottom: 14px; } .lsec-h { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line); padding: 4px 0 6px; margin-bottom: 10px; cursor: pointer; user-select: none; } .lsec-h .car { width: 12px; }
.lsec.shut > .grid1, .lsec.shut > .grid2 { display: none; }
/* layout editor */
.lay-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 14px; align-items: start; } .lay, .lay-tray { min-width: 0; } @media (max-width: 900px) { .lay-wrap { grid-template-columns: minmax(0, 1fr); } .lay-tray { position: static; } }
.lay { display: flex; flex-direction: column; gap: 12px; } .lay-sec { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); } .lay-sec.over { outline: 2px dashed var(--accent); } .lay-sec.dragging, .chip.dragging { opacity: .4; }
.lay-head { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--hover); border-radius: var(--radius) var(--radius) 0 0; } .lay-head input { flex: 1; font-weight: 600; } .lay-head select { width: auto; }
.grip { cursor: grab; color: var(--muted); padding: 0 4px; user-select: none; }
.lay-body { display: grid; gap: 8px; padding: 10px; min-height: 52px; border-radius: 0 0 var(--radius) var(--radius); } .lay-body.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .lay-body.c1 { grid-template-columns: minmax(0, 1fr); } .lay-body.over { background: var(--accent-soft); }
.chip { display: flex; align-items: center; gap: 6px; padding: 7px 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; cursor: grab; min-width: 0; } .chip:hover { border-color: var(--accent); } .chip .cl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .chip .req { color: var(--danger); } .chip .mv { width: 34px; padding: 2px; font-size: 12px; } .chip.wide { grid-column: 1 / -1; }
.lay-empty { grid-column: 1 / -1; text-align: center; padding: 10px; border: 1px dashed var(--line); border-radius: 8px; } .lay-tray { background: var(--hover); border-radius: var(--radius); padding: 10px; position: sticky; top: 0; } .lay-trayh { margin-bottom: 8px; }

/* routing */
.rbar { display: grid; grid-template-columns: 170px 1fr 44px minmax(120px, auto); gap: 8px; align-items: center; margin: 4px 0; font-size: 13px; } .rbar .rt { background: var(--hover); border-radius: 99px; height: 10px; overflow: hidden; display: block; } .rbar .rt i { display: block; height: 100%; background: var(--accent); border-radius: 99px; } .rbar .rp { text-align: right; font-weight: 700; } .rbar .rn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 800px) { .rbar { grid-template-columns: 1fr 1fr; } }

/* accounting + charts */
.pie { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; } .pie svg { flex: none; } .pie-total { font: 700 15px system-ui; fill: var(--ink); } .pie-sub { font: 12px system-ui; fill: var(--muted); }
.legend { flex: 1; min-width: 160px; } .legend .lg { display: grid; grid-template-columns: 14px 1fr auto 42px; gap: 8px; align-items: center; padding: 3px 0; font-size: 13px; } .legend .lg i { width: 12px; height: 12px; border-radius: 3px; display: block; } .legend .ln { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .legend .lp { color: var(--muted); text-align: right; }
.legend.row { display: flex; gap: 14px; margin-top: 6px; font-size: 12px; color: var(--muted); } .legend .lk { display: inline-flex; gap: 5px; align-items: center; } .legend .lk i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; } .sw-inc { background: #12b886; } .sw-exp { background: #e8590c; } .sw-net { background: #3b5bdb; border-radius: 50% !important; }
.mbwrap { overflow-x: auto; } .mbars { width: 100%; min-width: 520px; height: auto; } .mbars .inc { fill: #12b886; } .mbars .exp { fill: #e8590c; } .mbars .axis { stroke: var(--line); } .mbars .xl { font: 11px system-ui; fill: var(--muted); } .mbars .netline { stroke: #3b5bdb; stroke-width: 2; } .mbars .netdot { fill: #3b5bdb; }
.kpi.inc b { color: #12805c; } .kpi.exp b { color: #c2410c; } .chg { font-size: 12px; display: block; } .chg.good, .good { color: #12805c; } .chg.bad, .bad { color: #c92a2a; }
.bud { margin: 8px 0; } .btrack { background: var(--hover); border-radius: 99px; height: 8px; overflow: hidden; margin-top: 3px; } .btrack i { display: block; height: 100%; background: var(--accent); border-radius: 99px; } .btrack i.over { background: #e03131; }
input.amt { width: 140px; text-align: right; } .ygrid td, .ygrid th { text-align: right; font-size: 12px; white-space: nowrap; } .ygrid td:first-child, .ygrid th:first-child { text-align: left; } .ygrid td.cell { cursor: pointer; } .ygrid td.cell:hover { background: var(--accent-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } .chip2 { display: inline-flex; gap: 4px; align-items: center; background: var(--accent-soft); border-radius: 99px; padding: 3px 4px 3px 10px; font-size: 13px; } .chip2 button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 16px; line-height: 1; } .chips input { width: 240px; }
@media print { .rail, .topbar, .fab-bell, .banners, .head .btn, .tabs, .noprint { display: none !important; } main { padding: 0 !important; overflow: visible !important; } #app { display: block !important; height: auto !important; } }

.cbars { display: flex; align-items: flex-end; gap: 6px; height: 150px; } .ccol { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.cstack { width: 100%; max-width: 26px; display: flex; flex-direction: column-reverse; border-radius: 4px 4px 0 0; overflow: hidden; min-height: 2px; } .cseg.paid, .cdot.paid { background: #12805c; } .cseg.approved, .cdot.approved { background: var(--accent); } .cseg.pending, .cdot.pending { background: #f5a524; }
.cdot { display: inline-block; width: 9px; height: 9px; border-radius: 99px; vertical-align: middle; } .rulerow { margin: 4px 0; padding-left: 10px; border-left: 3px solid var(--border, #ddd); } tr.me td { background: var(--hover); font-weight: 600; }
.tablewrap { overflow-x: auto; }

.freezebar { position: fixed; top: 0; left: 0; right: 0; z-index: 60; background: #c92a2a; color: #fff; padding: 9px 16px; text-align: center; font-size: 14px; height: 38px; box-sizing: border-box; overflow: hidden; } body.frozen #app { margin-top: 38px; height: calc(100vh - 38px); }
@media (max-width: 820px) { body.frozen #app { height: auto; } }

/* itinerary builder */
body.tb-open { overflow: hidden; } .tb { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: flex; flex-direction: column; }
.tb-head { display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tb-body { flex: 1; display: grid; grid-template-columns: 290px 1fr 330px; min-height: 0; } .tb-cat, .tb-side { padding: 12px; overflow-y: auto; background: var(--panel); } .tb-cat { border-right: 1px solid var(--line); display: flex; flex-direction: column; } .tb-side { border-left: 1px solid var(--line); }
.tb-h { font-weight: 700; margin: 2px 0 8px; } .tb-catlist { flex: 1; overflow-y: auto; margin-top: 4px; } .tb-svc { display: flex; gap: 8px; align-items: center; padding: 7px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; background: var(--bg); cursor: grab; } .tb-svc img, .tb-ph { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; flex: none; } .tb-ph { background: var(--hover); display: grid; place-items: center; font-size: 20px; }
.clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-days { overflow-y: auto; padding: 16px 20px; } .tb-day { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; } .tb-day.open { border-color: var(--accent); } .tb-dt { flex: 1; border: 0 !important; background: transparent !important; font-weight: 600; padding: 4px 6px !important; } .tb-notes { min-height: 34px !important; height: 34px; margin: 6px 0; font-size: 13px; }
.tb-list { min-height: 46px; padding: 2px 0; } .tb-item { display: flex; gap: 8px; align-items: center; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; margin: 6px 0; background: var(--bg); cursor: pointer; } .tb-item.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); } .tb-item.opt { border-style: dashed; } .tb-grip { cursor: grab; color: var(--muted); user-select: none; } .tb-ico { font-size: 18px; } .tb-price { font-weight: 600; white-space: nowrap; }
.tb-item.drop-before { box-shadow: 0 -3px 0 var(--accent); } .tb-list.drop-end { box-shadow: inset 0 -3px 0 var(--accent); } .tb-empty { border: 2px dashed var(--line); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }
@media (max-width: 1000px) { .tb-body { display: block; overflow-y: auto; } .tb-cat { display: none; } .tb-side { border: 0; border-top: 1px solid var(--line); overflow: visible; } .tb-days { overflow: visible; padding: 12px; } }
/* itinerary builder: dialogs and toasts must sit above the full-screen editor */
body.tb-open .overlay { z-index: 100; } body.tb-open .toast { z-index: 120; }
.tb-state { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--hover); color: var(--muted); white-space: nowrap; } .tb-state.ok { color: #2b8a3e; background: rgba(43,138,62,.12); } .tb-state.warn { color: #b26a00; background: rgba(240,160,0,.15); } .tb-state.bad { color: #fff; background: var(--danger); }
.tb-head { position: sticky; top: 0; z-index: 2; } .tb-day .btn.ghost.sm { font-size: 15px; padding: 2px 6px; } .tb-days { background: var(--bg); padding: 18px 24px; } .tb-days > * { max-width: 860px; margin-left: auto; margin-right: auto; }
.tb-day { box-shadow: 0 1px 2px rgba(0,0,0,.04); } .tb-day.closed { padding-bottom: 8px; } .tb-day.closed .tb-list { display: none; }
.tb-item { transition: border-color .12s, box-shadow .12s; } .tb-item:hover { border-color: var(--accent); }
.tb-add { width: 100%; margin-top: 8px; padding: 10px; border: 1.5px dashed var(--line); border-radius: 10px; background: transparent; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; } .tb-add:hover { background: var(--accent-soft); border-color: var(--accent); }
.tb-empty { cursor: pointer; } .tb-empty:hover { border-color: var(--accent); color: var(--accent); }
.tb-pick { max-height: 52vh; overflow-y: auto; } .tb-pick .tb-svc { cursor: pointer; font: inherit; color: inherit; } .tb-pick .tb-svc:hover { border-color: var(--accent); }
.tb-side { background: var(--panel); } .tb-cat { background: var(--panel); }
.tb-svc .clip, .tb-item .clip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .tb-svc > button, .tb-svc > .btn { flex: none; } .tb-svc > .grow { flex: 1 1 0; min-width: 0; }
/* record opened as a full page (the choice is remembered per browser) */
.overlay.full { background: var(--bg); } .drawer.full { width: 100vw; box-shadow: none; padding: 26px max(22px, calc((100vw - 1040px) / 2)); }
/* full-page record: the fields on the left, Activity / Related / Travel / Documents… on the right, at the top */
@media (min-width: 1100px) {
  .drawer.full { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 500px); column-gap: 32px; align-content: start; max-width: none; padding-left: max(22px, calc((100vw - 1320px) / 2)); padding-right: max(22px, calc((100vw - 1320px) / 2)); }
  .drawer.full > * { grid-column: 1; } .drawer.full > :nth-child(-n+2) { grid-column: 1 / -1; }
  .drawer.full > .tabpane { grid-column: 2; grid-row: 3 / span 40; align-self: start; position: sticky; top: 0; max-height: calc(100vh - 60px); overflow-y: auto; border-left: 1px solid var(--line); padding-left: 20px; }
}
/* Cyremo sign-in screens: teal and deep navy (scoped here, so the colours inside a customer's CRM stay their own) */
.authwrap { --accent: #0b8f8a; --accent-soft: #dcf3f1; --accent-ink: #fff; }
.authside { background: linear-gradient(150deg, #0e9f9a 0%, #0b5f72 45%, #0b2a3c 100%); }
.authside::after { background: rgba(255,255,255,.07); }
.authbrand { display: flex; align-items: center; gap: 10px; font-weight: 500; letter-spacing: -.02em; } .authbrand b { font-weight: 800; color: var(--accent); } .authbrand.light b { color: #8ff0e8; }
.cymark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff; background: linear-gradient(145deg, #12b5ae, #0b6f78); margin-right: -2px; } .authbrand.light .cymark { background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.35); }
.authwrap .login a { color: var(--accent); } .authwrap .login input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
@media (prefers-color-scheme: dark) { .authwrap { --accent: #2dd4cb; --accent-soft: #123a3d; --accent-ink: #062a2c; } .authbrand b { color: var(--accent); } }
.helpq { width: 30px; height: 30px; padding: 0; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; color: var(--muted); border: 1px solid var(--line); text-decoration: none; } .helpq:hover { color: var(--accent); border-color: var(--accent); }
