:root {
  /* TDRTI brand: navy + gold accent on white. Layout: navy sidebar, initiative tabs on top, work area on mist */
  --navy: #1E3350;
  --navy-2: #263f63;
  --navy-3: #2f4b75;
  --gold: #F0CB3F;
  --gold-tint: #FDF6DD;
  --ink: #26303F;
  --slate: #5A6779;
  --line: #DFE4EC;
  --mist: #F7F9FC;
  --white: #FFFFFF;
  --good: #1f8a5b;
  --good-tint: #e3f4ec;
  --warn: #a86a00;
  --warn-tint: #fff3d6;
  --bad: #b3352b;
  --bad-tint: #fde7e4;
  --info-tint: #e8eef8;
  --wa: #dcf8c6;
  --display: "Montserrat", "Segoe UI", Arial, sans-serif;
  --body: "Open Sans", "Segoe UI", Arial, sans-serif;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(30, 51, 80, .06), 0 4px 16px rgba(30, 51, 80, .06);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14.5px/1.5 var(--body); color: var(--ink); background: var(--mist); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--display); color: var(--navy); margin: 0; text-wrap: balance; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 14.5px; font-weight: 700; }
a { color: var(--navy-3); }
.linklike { background: none; border: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.linklike b { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.linklike:hover b { color: var(--navy-3); text-decoration-color: var(--navy-3); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--slate); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; align-items: start; }

/* ---------- auth screen ---------- */
.auth { min-height: 100%; display: grid; place-items: center; background: var(--navy); padding: 24px; }
.auth .card { width: min(420px, 100%); padding: 32px; border-radius: 14px; }
.auth .brand-big { font: 800 30px/1 var(--display); color: var(--navy); letter-spacing: .02em; }
.auth .brand-big span { display: block; font: 600 13px/1.6 var(--display); color: var(--slate); letter-spacing: .12em; text-transform: uppercase; margin-top: 6px; }
.rule { height: 3px; width: 56px; background: var(--gold); border-radius: 2px; margin: 14px 0 20px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; height: 100%; }
.side { background: var(--navy); color: #d8e0ec; display: flex; flex-direction: column; padding: 18px 12px; gap: 4px; overflow-y: auto; }
.brand { padding: 4px 10px 14px; }
.brand b { display: block; font: 800 20px/1 var(--display); color: #fff; letter-spacing: .04em; }
.brand small { display: block; font: 600 10.5px/1.6 var(--display); color: var(--gold); letter-spacing: .14em; text-transform: uppercase; margin-top: 5px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #d8e0ec; text-decoration: none; font-weight: 600; font-size: 14px; }
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a.on { background: var(--navy-3); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav .badge { margin-left: auto; background: var(--gold); color: var(--navy); border-radius: 99px; font-size: 11.5px; padding: 0 7px; font-weight: 700; line-height: 19px; }
.side .spacer { flex: 1; }
.side .me { border-top: 1px solid rgba(255,255,255,.12); padding: 12px 10px 0; font-size: 13px; }
.side .me b { color: #fff; display: block; }
.side .me button { background: none; border: 0; color: var(--gold); padding: 0; cursor: pointer; font-size: 13px; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100%; }
.top { background: var(--white); border-bottom: 1px solid var(--line); display: flex; align-items: stretch; gap: 4px; padding: 0 20px; min-height: 58px; }
.tabs { display: flex; gap: 2px; align-items: stretch; overflow-x: auto; }
.tabs a { display: flex; align-items: center; gap: 8px; padding: 0 16px; text-decoration: none; color: var(--slate); font: 700 14px var(--display); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--navy); border-bottom-color: var(--gold); }
.tabs a:hover { color: var(--navy); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #c2c9d4; flex: none; }
.dot.open { background: var(--good); }
.dot.qr, .dot.connecting, .dot.reconnecting, .dot.starting { background: var(--warn); }
.dot.logged_out { background: var(--bad); }
.top .right { margin-left: 10px; display: flex; align-items: center; gap: 10px; }
.top #bell { margin-left: auto; align-self: center; height: 30px; padding: 0 12px; border-radius: 99px; font-size: 12.5px; white-space: nowrap; }
.menu-btn { display: none; }
.content { flex: 1; overflow-y: auto; padding: 22px; }
.content.flush { padding: 0; overflow: hidden; }
/* Short description: buttons sit beside it on one line. Long description: it uses the full width and the buttons go on the line below. */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head > :first-child { flex: 1 1 max-content; min-width: 0; max-width: 100%; }
.page-head > :not(:first-child) { flex: 0 0 auto; }
.page-head p { margin: 4px 0 0; color: var(--slate); }
@media (max-width: 760px) { .page-head { flex-wrap: wrap; } .page-head > :not(:first-child) { flex: 1 1 100%; } }

/* ---------- building blocks ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.tight { padding: 0; overflow: hidden; }
.card h2 + p, .card h3 + p { margin-top: 4px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--navy); background: var(--navy); color: #fff; border-radius: 8px; padding: 8px 14px; font-weight: 600; cursor: pointer; text-decoration: none; font-size: 14px; line-height: 1.2; }
.btn:hover { background: var(--navy-2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn.gold:hover { background: #e9bf22; }
.btn.ghost { background: var(--white); color: var(--navy); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--navy); }
.btn.danger { background: var(--white); color: var(--bad); border-color: #f0c4bf; }
.btn.danger:hover { background: var(--bad-tint); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
label.f { display: grid; gap: 5px; font-weight: 600; font-size: 13px; color: var(--navy); }
label.f .hint { font-weight: 400; color: var(--slate); font-size: 12.5px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid #cdd5e1; border-radius: 8px; padding: 8px 11px; background: #fff; font-weight: 400; font-size: 14px; color: var(--ink); }
.pwrap { position: relative; display: block; }
.pwrap .input { padding-right: 36px; }
.pwrap .pweye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: none; background: none; padding: 6px; margin: 0; line-height: 0; color: var(--slate); cursor: pointer; border-radius: 6px; }
.pwrap .pweye:hover { color: var(--navy); background: #eef1f5; }
.pwrap .pweye svg { width: 18px; height: 18px; display: block; }
textarea.input { min-height: 90px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--navy-3); outline: none; box-shadow: 0 0 0 3px rgba(240, 203, 63, .35); }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--info-tint); color: var(--navy); white-space: nowrap; }
.pill.good { background: var(--good-tint); color: var(--good); }
.pill.warn { background: var(--warn-tint); color: var(--warn); }
.pill.bad { background: var(--bad-tint); color: var(--bad); }
.pill.gold { background: var(--gold-tint); color: #7a5f00; }
.pill.grey { background: #eef1f5; color: var(--slate); }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #c9d1dc; border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(20px); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.tile .k { font-size: 12.5px; color: var(--slate); font-weight: 600; }
.tile .v { font: 700 26px/1.2 var(--display); color: var(--navy); font-variant-numeric: tabular-nums; margin-top: 4px; }
.tile .s { font-size: 12px; color: var(--slate); }
.tile.accent::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--gold); }
.tile.alert::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--bad); }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font: 700 11.5px var(--display); text-transform: uppercase; letter-spacing: .04em; color: #fff; background: var(--navy); padding: 9px 10px; }
.card:has(> table.t), .card:has(> div > table.t) { overflow-x: auto; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:nth-child(even) td { background: var(--mist); }
table.t tr:hover td { background: var(--gold-tint); }
.tablewrap { overflow-x: auto; }
.bar { height: 8px; background: #e7ebf1; border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--navy-3); border-radius: 4px; }
.bar.gold i { background: var(--gold); }
.empty { text-align: center; padding: 34px 18px; color: var(--slate); }
.empty b { display: block; color: var(--navy); font-family: var(--display); font-size: 15px; margin-bottom: 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 12px; font-size: 13px; cursor: pointer; font-weight: 600; color: var(--slate); }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip:hover:not(.on) { border-color: var(--navy); color: var(--navy); }
.callout { background: var(--gold-tint); border: 1px solid #f3df9a; border-radius: var(--radius); padding: 12px 14px; font-size: 13.5px; }
.callout.info { background: var(--info-tint); border-color: #cfdaec; }
.callout.bad { background: var(--bad-tint); border-color: #f2c3bd; }
.divider { height: 1px; background: var(--line); margin: 6px 0; }

/* ---------- inbox ---------- */
.inbox { display: grid; grid-template-columns: 330px 1fr 290px; height: 100%; }
.inbox .list { border-right: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; min-height: 0; }
.inbox .list .filters { padding: 12px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.inbox .list .items { overflow-y: auto; flex: 1; }
.ci { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; padding: 11px 14px; border-bottom: 1px solid #eef1f5; cursor: pointer; text-decoration: none; color: inherit; }
.ci:hover { background: var(--mist); }
.ci.on { background: var(--gold-tint); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font: 700 14px var(--display); }
.avatar.g { background: var(--gold); color: var(--navy); }
.ci .n { font-weight: 700; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci .l { font-size: 13px; color: var(--slate); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci .r { text-align: right; font-size: 11.5px; color: var(--slate); display: grid; gap: 4px; justify-items: end; }
.ci .unread { background: var(--good); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 700; padding: 0 7px; line-height: 18px; }
.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #efeae2; }
.thread .head { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.thread .msgs { flex: 1; overflow-y: auto; padding: 18px 6%; display: flex; flex-direction: column; gap: 6px; }
.bub { max-width: min(560px, 80%); padding: 7px 11px 6px; border-radius: 9px; background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.08); white-space: pre-wrap; word-wrap: break-word; font-size: 14px; }
.bub.me { align-self: flex-end; background: var(--wa); }
.bub.ai { align-self: flex-end; background: #e6edf9; border: 1px solid #cad8f0; }
.bub .meta { display: block; text-align: right; font-size: 11px; color: var(--slate); margin-top: 3px; }
.bub .who { font-size: 11.5px; font-weight: 700; color: var(--navy-3); display: block; margin-bottom: 2px; }
.daysep { align-self: center; background: #fff; color: var(--slate); font-size: 12px; padding: 3px 10px; border-radius: 8px; margin: 8px 0; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.composer { background: #f6f6f6; padding: 10px 14px; display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; min-height: 42px; max-height: 160px; border-radius: 20px; padding: 10px 14px; }
.side-panel { border-left: 1px solid var(--line); background: #fff; overflow-y: auto; padding: 16px; display: grid; gap: 14px; align-content: start; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 10px; font-size: 13.5px; }
.kv dt { color: var(--slate); }
.kv dd { margin: 0; font-weight: 600; color: var(--ink); word-break: break-word; }
.ai-state { display: flex; align-items: center; gap: 8px; }

/* ---------- requests ---------- */
.reqs { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.req { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: grid; gap: 8px; border-left: 4px solid var(--gold); }
.req.call { border-left-color: var(--navy-3); }
.req.handoff { border-left-color: var(--bad); }
.req.done { opacity: .7; border-left-color: var(--good); }
.req .name { font: 700 15px var(--display); color: var(--navy); }

/* ---------- stories ---------- */
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.thumb { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; position: relative; }
.thumb .img { aspect-ratio: 9 / 14; background: #e9edf3 center / cover no-repeat; display: grid; place-items: center; color: var(--slate); font-size: 12px; }
.thumb video { width: 100%; aspect-ratio: 9 / 14; object-fit: cover; display: block; background: #000; }
.thumb .cap { padding: 7px 9px; font-size: 12px; display: grid; gap: 4px; }
.thumb .x { position: absolute; top: 6px; right: 6px; background: rgba(30,51,80,.85); color: #fff; border: 0; border-radius: 6px; padding: 2px 7px; cursor: pointer; font-size: 12px; }
/* Zoom button overlaid on a thumbnail, bottom-right, so it never collides with the score badge
   (top-left) or the delete "x" (top-right). Opens the lightbox without toggling a pick/select input. */
.thumb .zoom { position: absolute; bottom: 6px; right: 6px; width: 26px; height: 26px; display: grid; place-items: center; background: rgba(30,51,80,.85); color: #fff; border: 0; border-radius: 99px; cursor: pointer; font-size: 13px; line-height: 1; padding: 0; }
.thumb .zoom:hover { background: rgba(30,51,80,1); }
.slot .mini { cursor: zoom-in; }

/* ---------- lightbox ---------- */
.lightbox-bg { position: fixed; inset: 0; background: rgba(10, 16, 28, .9); display: grid; place-items: center; z-index: 60; padding: 24px; }
.lightbox-bg img, .lightbox-bg video { max-width: 100%; max-height: 86vh; border-radius: 8px; display: block; background: #000; }
.lightbox-bg .close { position: absolute; top: 18px; right: 22px; background: rgba(255,255,255,.15); color: #fff; border: 0; width: 38px; height: 38px; border-radius: 99px; font-size: 20px; cursor: pointer; }
.lightbox-bg .close:hover { background: rgba(255,255,255,.3); }
.drop { border: 2px dashed #c3ccda; border-radius: 12px; padding: 22px; text-align: center; color: var(--slate); background: #fff; cursor: pointer; }
.drop.over { border-color: var(--gold); background: var(--gold-tint); }
.sched-day { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sched-day .d { font: 700 13px var(--display); color: var(--navy); }
.slots { display: flex; gap: 10px; flex-wrap: wrap; }
.slot { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px 6px 6px; background: #fff; min-width: 240px; }
.slot .mini { width: 42px; height: 56px; border-radius: 6px; background: #e9edf3 center / cover no-repeat; flex: none; }
.slot.posted { background: var(--good-tint); border-color: #bfe3cf; }
.slot.failed { background: var(--bad-tint); }

/* ---------- modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 32, 52, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: min(620px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal .mh { padding: 18px 20px 0; display: flex; justify-content: space-between; align-items: center; }
.modal .mb { padding: 16px 20px; display: grid; gap: 14px; }
.modal .mf { padding: 0 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }
.modal .close { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--slate); line-height: 1; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 60; font-weight: 600; max-width: 90vw; border-left: 4px solid var(--gold); }
#toast.err { border-left-color: #ff8a80; }
#toast { display: flex; align-items: center; gap: 14px; }
#toast button { background: none; border: 0; color: #fff; font-size: 20px; line-height: 1; cursor: pointer; opacity: .8; padding: 0 2px; }
.qr-box { display: grid; place-items: center; gap: 10px; padding: 10px; }
.qr-box img { width: 260px; height: 260px; border: 1px solid var(--line); border-radius: 12px; }
.chart text { font: 11px var(--body); fill: var(--slate); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--slate); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .inbox { grid-template-columns: 300px 1fr; } .inbox .side-panel { display: none; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; inset: 0 auto 0 0; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .menu-btn { display: flex; align-items: center; background: none; border: 0; padding: 0 10px 0 0; cursor: pointer; color: var(--navy); }
  .top { padding: 0 12px; }
  .content { padding: 14px; }
  .inbox { grid-template-columns: 1fr; }
  .inbox.has-chat .list { display: none; }
  .inbox:not(.has-chat) .thread { display: none; }
  .sched-day { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
html, body, #app { height: 100%; }
.shell { height: 100vh; }
.main { overflow: hidden; }
.content { flex: 1; overflow-y: auto; min-height: 0; }
.content.flush .inbox { height: 100%; }
/* locked (saved) sections */
.card.locked .input, .card.locked input:not([type=checkbox]), .card.locked textarea, .card.locked select { background: #eef1f5; color: #5d6878; border-color: #e1e6ed; cursor: not-allowed; box-shadow: none; }
.card.locked textarea { resize: none; }
.card.locked .switch, .card.locked input[type=checkbox] { opacity: .55; cursor: not-allowed; }
.card.editing { box-shadow: 0 0 0 2px var(--gold), 0 6px 18px rgba(30,51,80,.08); }
.saved-note { color: #1f8a4c; font-weight: 600; font-size: 13px; align-self: center; }
.card [data-nolock] .input:disabled { background: #eef1f5; }
.card.locked [data-nolock] .input:not(:disabled) { background: #fff; color: var(--ink, #1E3350); border-color: var(--line); cursor: text; }
.bub-img { display: block; max-width: 280px; max-height: 320px; border-radius: 8px; margin: 2px 0 6px; background: #e9edf2; }
.bub-img.sticker { max-width: 140px; background: none; }
.bub-doc { display: inline-block; padding: 8px 10px; background: rgba(30,51,80,.06); border-radius: 8px; margin-bottom: 6px; font-weight: 600; }
.bub a { color: #1a5fb4; text-decoration: underline; word-break: break-all; }
.tip { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; background: #dfe5ee; color: var(--navy); font: 700 10px/1 var(--body, sans-serif); margin-left: 5px; cursor: help; position: relative; vertical-align: 1px; text-transform: none; letter-spacing: 0; }
.tip:hover::after, .tip:focus::after { content: attr(data-tip); position: absolute; left: 50%; top: 20px; transform: translateX(-50%); width: 240px; background: var(--navy); color: #fff; padding: 9px 11px; border-radius: 8px; font: 400 12.5px/1.45 var(--body, sans-serif); z-index: 30; white-space: normal; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.chip .num { opacity: .7; font-weight: 700; margin-left: 2px; }
.practice .pchat { height: 440px; overflow-y: auto; background: #efeae2; border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.practice .composer { border: 1px solid var(--line); border-radius: 10px; }
.link-btn { background: none; border: 0; color: #1a5fb4; font-weight: 600; font-size: 12.5px; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.link-btn.del { color: var(--bad); }
.lesson { border-top: 1px solid var(--line); padding: 9px 0; display: grid; gap: 4px; font-size: 13.5px; }
.lesson .btn { justify-self: start; }
.tile, .card { overflow: visible; }
.tile:hover, .card:hover { z-index: 5; position: relative; }
.f > b + .hint, .f > b + span.hint { display: block; margin-top: 2px; }
.bubtext { white-space: pre-wrap; background: #f4f7fb; border-radius: 8px; padding: 8px 10px; margin-top: 4px; }

.thumb { position: relative; }
.thumb .score { position: absolute; top: 6px; left: 6px; background: rgba(255,255,255,.92); border-radius: 99px; padding: 1px 6px; font-size: 16px; line-height: 1.4; box-shadow: 0 1px 3px rgba(0,0,0,.2); cursor: help; }

.slot .pick { width: 20px; height: 20px; flex: none; accent-color: var(--navy); cursor: pointer; align-self: center; }
.slot.scheduled { cursor: pointer; }
.slot.picked { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset; background: #fffbea; }
#delpicked:not([disabled]) { background: #c0392b; color: #fff; border-color: #c0392b; }

/* AI agent page: one section at a time, full width */
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 4px 0 16px; overflow-x: auto; }
.subtabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font: 600 14px var(--display, inherit); color: var(--slate); cursor: pointer; white-space: nowrap; }
.subtabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--gold); }
.subtabs .n { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--gold-tint); color: var(--navy); font-size: 12px; margin-left: 4px; }
.infogrid { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .infogrid { grid-template-columns: 1fr; } }
.behgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 28px; margin-top: 12px; align-items: start; }
.behgrid .beh-replies { grid-column: 1 / -1; }
.behfields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 20px; }
@media (max-width: 1000px) { .behfields { grid-template-columns: 1fr; } }
.behgrid h3 { margin: 0 0 10px; font-size: 15px; color: var(--navy); }
@media (max-width: 1000px) { .behgrid { grid-template-columns: 1fr; } }
table.kb td { vertical-align: top; }
#deals { display: block; }
.infogrid .row { flex-wrap: wrap; }
.infogrid #site { flex: 1 1 100%; }
.infogrid #readsite { white-space: nowrap; }
#deals .lesson { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0; }
.behfields .f { display: flex; flex-direction: column; } .behfields .f > .input { margin-top: auto; }

/* Visual pickers (campaign flyer and stories) */
.picklib { max-height: 300px; overflow: auto; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important; padding: 2px; }
.thumb.pickable { cursor: pointer; }
.thumb.pickable.picked { outline: 3px solid var(--gold); outline-offset: -3px; }
.thumb.pickable .noimg { display: grid; place-items: center; color: var(--slate); font-size: 13px; background: #f4f6f9; }

/* Training */
h2.sect { font-size: 17px; margin: 22px 0 10px; color: var(--navy); }
.traingrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.trainvid { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: start; }
.vidthumb { height: 86px; border-radius: 10px; border: 0; background: linear-gradient(135deg, var(--navy), #2c4a73); display: grid; place-items: center; cursor: pointer; }
.vidthumb span { color: var(--gold); font-size: 28px; }
.vidthumb.soon { background: #eef1f5; cursor: default; }
.vidthumb.soon span { color: var(--slate); font-size: 12.5px; }
ol.clist { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
/* Guided tour */
.tour { position: fixed; inset: 0; z-index: 9000; }
.tour-hole { position: fixed; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(15, 25, 40, .62); border: 2px solid var(--gold); transition: all .2s; pointer-events: none; }
.tour-pop { position: fixed; width: 340px; background: #fff; border-radius: 12px; padding: 14px 16px; box-shadow: 0 12px 32px rgba(0,0,0,.25); }
.tour-pop p { margin: 6px 0 12px; font-size: 14px; }
/* Print only the checklists */
@media print {
  body.print-checklists .side, body.print-checklists .top, body.print-checklists .content > *:not(.checklists):not(h2.sect:last-of-type) { display: none !important; }
  body.print-checklists .checklists { grid-template-columns: 1fr; }
}

.bub .teach { display: block; margin-top: 4px; font-size: 12px; }

.nav .navgrp { font: 700 10.5px var(--display, inherit); letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.45); padding: 14px 12px 4px; }
.nav .navgrp:first-child { padding-top: 2px; }

/* Settings: one section at a time */
.setgrid { display: grid; gap: 16px; }
.setgrid > .card[data-sec="conn"] { max-width: none; }
.setgrid .fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .setgrid .fields { grid-template-columns: 1fr; } }
.setgrid .card[data-sec="social"] { columns: 2 420px; column-gap: 32px; }
.setgrid .card[data-sec="social"] > * { break-inside: avoid; }
.setgrid .card[data-sec="limits"] .fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.setgrid .card[data-sec="social"] .fields { grid-template-columns: 1fr 1fr; }
.setgrid .card[data-sec="social"] > .divider:first-of-type { break-before: column; height: 0; margin: 0; border: 0; }
@media (max-width: 1000px) { .setgrid .card[data-sec="limits"] .fields, .setgrid .card[data-sec="social"] .fields { grid-template-columns: 1fr; } }
@media (min-width: 900px) { .btn { white-space: nowrap; } }
.storygrid { grid-template-columns: minmax(320px, 1fr) minmax(320px, 1.2fr); }
@media (max-width: 860px) { .storygrid { grid-template-columns: minmax(0, 1fr); } }
.sched-day > * { min-width: 0; }
.slot > div:not(.mini):not(.stack) { min-width: 0; flex: 1; overflow-wrap: anywhere; }
@media (max-width: 860px) { .slot { min-width: 0; flex: 1 1 100%; } }
.keygrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 10px; align-items: start; }
.keygrid .f .input { height: 40px; min-height: 40px; }
.keygrid .f .small { margin-top: 4px; font-weight: 400; }
@media (max-width: 1000px) { .keygrid { grid-template-columns: 1fr; } }
.dealcalc { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; align-items: start; margin: 12px 0; }
.dealfinal { font: 700 22px var(--display); color: var(--navy); background: #fffbea; border: 1px solid var(--gold); border-radius: 10px; padding: 6px 12px; margin-top: 4px; min-height: 40px; }
.listgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 20px; margin-top: 12px; align-items: start; }
.listgrid textarea { min-height: 260px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.listgrid .tablewrap { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.listgrid .t tr.muted td { opacity: .55; }
#listCard .card-head { align-items: flex-start; }
@media (max-width: 1000px) { .listgrid, .dealcalc { grid-template-columns: 1fr; } }
.rulesgrid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 10px; }
.rulesgrid textarea { min-height: 130px; }
.rulehelp { background: #f7f8fb; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; line-height: 1.6; }
@media (max-width: 1000px) { .rulesgrid { grid-template-columns: 1fr; } }
.rulesgrid { align-items: stretch; }
.rulesgrid > label.f { display: flex; flex-direction: column; }
.rulesgrid > label.f textarea { flex: 1; }
.bkgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; margin-top: 12px; }
.bkgrid .input { height: 40px; }
@media (max-width: 1000px) { .bkgrid { grid-template-columns: 1fr; } }
.keygrid:has(> :only-child) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.aibar { display: flex; gap: 4px; justify-content: flex-end; margin-top: 4px; }
.aiw { border: 1px solid #e6d27a; background: #fffbea; color: var(--navy); font: 600 12.5px var(--body, inherit); border-radius: 999px; padding: 4px 11px; cursor: pointer; }
.aiw:hover { background: #fff3c2; }
.aiw.more { padding: 4px 9px; }
.aiw:disabled { opacity: .55; cursor: wait; }
textarea:disabled + .aibar, input:disabled + .aibar { opacity: .45; pointer-events: none; }
.aibar.incomposer { margin: 0; align-items: center; flex-shrink: 0; }
.aiw.emoji { padding: 4px 9px; font-size: 14px; line-height: 1; }
/* Emoji picker popover: a grid of emoji buttons anchored under the 😊 button that opened it. */
.emoji-pop { position: fixed; z-index: 70; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 8px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; width: 260px; max-height: 190px; overflow-y: auto; }
.emoji-pop button { border: 0; background: none; font-size: 18px; line-height: 1; padding: 5px; border-radius: 6px; cursor: pointer; }
.emoji-pop button:hover { background: var(--mist); }
.keybox:not(:placeholder-shown) { -webkit-text-security: disc; font-family: monospace; }
.keybox:disabled::placeholder { opacity: .8; }
.whogrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-top: 12px; }
.bandbar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.band { background: #f7f8fb; border: 1px solid var(--line); border-radius: 10px; padding: 8px 6px; text-align: center; }
.band.on { background: #fffbea; border-color: var(--gold); }
.band .bv { font: 700 18px var(--display); color: var(--navy); }
.band .bk { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
@media (max-width: 760px) { .bandbar { grid-template-columns: repeat(3, 1fr); } }
.permtable td.num, .permtable th.num { text-align: center; width: 110px; }
.permtable input[type=checkbox] { width: 17px; height: 17px; }

/* Sortable table headers on Clients & leads */
.t th.sortable { cursor: pointer; user-select: none; white-space: nowrap }
.t th.sortable:hover { color: var(--gold, #F0CB3F) }
.t th .ar { margin-left: 6px; opacity: .35; font-size: 11px }
.t th.sortable.on .ar { opacity: 1 }

/* Bookings/calls/discounts table: fixed, even column widths so rows line up as a clean grid
   instead of each column auto-sizing to its own content, and content sits flush left/top in
   every cell rather than drifting to the vertical middle of a tall row. */
.reqtable { table-layout: fixed; }
.reqtable th, .reqtable td { text-align: left; vertical-align: top; }
.reqtable td { word-wrap: break-word; }
.reqtable .pill { margin-top: 1px; }

/* Editing a campaign that's already running: the part that already went out is shown but
   can't be touched, so it's visually dimmed and ignores clicks/typing, while whatever hasn't
   sent yet (a later flyer, the stories still to come) stays fully editable. */
.locked-step { position: relative; opacity: .55; pointer-events: none; }
.locked-step .locked-note { position: absolute; top: 0; right: 0; background: var(--mist); color: var(--slate); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; pointer-events: none; }
/* Locking a step shouldn't stop you checking what it actually sent — the zoom button still works
   even though everything else in a locked step ignores clicks. */
.locked-step .zoom { pointer-events: auto; }

/* Dragging a picture from the library onto the schedule */
.lib .thumb[draggable="true"] { cursor: grab }
.lib .thumb[draggable="true"]:active { cursor: grabbing }
.sched-day.dropping, .slot.dropping { outline: 2px dashed var(--gold, #F0CB3F); outline-offset: 2px; background: rgba(240,203,63,.08) }
.slot.empty-slot { color: var(--muted, #6b7785); font-size: 13px; font-style: italic; justify-content: center; border-style: dashed }

/* Staff booking calendar */
.cal-month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-monthhead { font-size: 12px; font-weight: 700; color: var(--slate); text-align: center; padding: 4px 0; }
.cal-monthday { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; min-height: 70px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; padding: 8px 4px; font: inherit; }
.cal-monthday:hover { border-color: var(--navy-3); }
.cal-monthday.dim { opacity: .4; }
.cal-monthday.today .cal-monthnum { color: var(--gold-ink, #7a5f00); font-weight: 800; }
.cal-monthnum { font-size: 13px; font-weight: 600; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-week-single { grid-template-columns: 1fr; max-width: 320px; }
.cal-day { display: flex; flex-direction: column; gap: 4px; }
.cal-daylabel { font-size: 12px; font-weight: 700; color: var(--slate); text-align: center; padding-bottom: 4px; }
.cal-slot { border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; font-size: 13px; text-align: center; cursor: pointer; background: #fff; user-select: none; }
.cal-slot:hover { border-color: var(--navy-3); }
.cal-slot.booked { background: var(--good-tint); color: var(--good); border-color: var(--good); font-weight: 700; }
.cal-slot.partial { background: var(--warn-tint, #fff6e0); color: var(--warn, #a66c00); border-color: var(--warn, #a66c00); font-weight: 700; }
.cal-name { font-size: 11px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1000px) { .cal-week:not(.cal-week-single) { grid-template-columns: repeat(7, minmax(90px, 1fr)); overflow-x: auto; } }

/* ---------- Marketing homepage ---------- */
.home { background: var(--mist); min-height: 100%; }
.home-nav { display: flex; align-items: center; justify-content: space-between; max-width: 1120px; margin: 0 auto; padding: 18px 24px; }
.home-nav .brand-big { font: 800 20px/1 var(--display); color: var(--navy); letter-spacing: .02em; }
.home-nav .brand-big span { display: block; font: 600 9.5px/1.6 var(--display); color: var(--slate); letter-spacing: .14em; text-transform: uppercase; margin-top: 3px; }
.home-nav .actions { display: flex; gap: 10px; }
.home-hero { background: var(--navy); color: #fff; padding: 64px 24px 56px; }
.home-hero-in { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.home-hero h1 { color: #fff; font-size: 40px; line-height: 1.15; margin: 0 0 16px; }
.home-hero p.lead { color: #c9d4e4; font-size: 17px; line-height: 1.6; margin: 0 0 28px; max-width: 48ch; }
.home-hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }
.home-hero .btn.lg { padding: 12px 22px; font-size: 15.5px; border-radius: 10px; }
.home-video-wrap { background: #0f1b2e; border-radius: 16px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.08); }
.home-video-wrap video { display: block; width: 100%; height: auto; background: #000; }
.home-section { max-width: 1120px; margin: 0 auto; padding: 56px 24px; }
.home-section h2 { font-size: 27px; text-align: center; margin-bottom: 8px; }
.home-section p.sub { text-align: center; color: var(--slate); max-width: 56ch; margin: 0 auto 36px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.home-feat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.home-feat .icn { width: 42px; height: 42px; border-radius: 10px; background: var(--gold-tint); color: var(--gold-ink, #7a5f00); display: grid; place-items: center; margin-bottom: 14px; }
.home-feat .icn svg { width: 22px; height: 22px; }
.home-feat h3 { font-size: 15.5px; margin-bottom: 6px; }
.home-feat p { color: var(--slate); font-size: 13.5px; margin: 0; line-height: 1.5; }
.home-cta { background: var(--navy-2); color: #fff; text-align: center; padding: 56px 24px; }
.home-cta h2 { color: #fff; }
.home-cta p { color: #c9d4e4; margin: 8px 0 24px; }
.home-foot { text-align: center; padding: 28px 24px; color: var(--slate); font-size: 12.5px; }
.home-foot a { color: var(--slate); }
@media (max-width: 860px) { .home-hero-in { grid-template-columns: 1fr; } .home-hero h1 { font-size: 30px; } }

/* Auth screens reached from the homepage (login / register), with a way back */
.auth .back { display: block; margin-bottom: 14px; color: var(--slate); font-size: 13px; text-decoration: none; }
.auth .switch { text-align: center; margin: 16px 0 0; font-size: 13.5px; color: var(--slate); }
