/* Small layer on top of Bootstrap 5.3. Colors come from Bootstrap variables so dark mode just works. */
:root { --sidebar-w: 240px; }

.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1 1 auto; min-width: 0; }
.app-sidebar { background: var(--bs-tertiary-bg); border-right: 1px solid var(--bs-border-color); }
@media (min-width: 992px) {
  .app-sidebar { width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); position: sticky; top: 0; height: 100vh; }
}
.app-sidebar .nav-link { color: var(--bs-body-color); border-radius: .5rem; padding: .4rem .75rem; }
.app-sidebar .sidebar-scroll { overflow-y: auto; scrollbar-width: thin; }
.app-sidebar .nav-heading { font-size: .72rem; letter-spacing: .04em; }
.app-sidebar .nav-link.active { color: #fff; }

.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--bs-primary); color: #fff; font-size: 18px;
}
.guest-page { background: var(--bs-tertiary-bg); }

.avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bs-secondary-bg); color: var(--bs-secondary-color); font-weight: 600;
}
.min-w-0 { min-width: 0; }

th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable::after { content: "\F127"; font-family: bootstrap-icons; opacity: .25; margin-left: .25rem; font-size: .75em; }
th.sortable[data-dir="asc"]::after { content: "\F235"; opacity: .8; }
th.sortable[data-dir="desc"]::after { content: "\F229"; opacity: .8; }

tbody[aria-busy="true"] { opacity: .5; transition: opacity .15s; }

.user-panel { --bs-offcanvas-width: min(560px, 100vw); }
/* History timeline in the user panel */
.user-history .hist-day { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--bs-secondary-color); margin: 1rem 0 .5rem; }
.user-history .hist-day:first-child { margin-top: 0; }
.user-history .hist-item { position: relative; display: flex; gap: .75rem; padding-bottom: .9rem; }
.user-history .hist-item::before { content: ""; position: absolute; left: .875rem; top: 1.9rem; bottom: .15rem; width: 1px; background: var(--bs-border-color); }
.user-history .hist-item:last-child::before { display: none; }
.user-history .hist-dot { flex: 0 0 1.75rem; height: 1.75rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .85rem; }
.user-history .hist-body { flex: 1; min-width: 0; }
.user-history .hist-chip { display: inline-block; border-radius: 999px; padding: .05rem .5rem; margin: .15rem .2rem 0 0; font-size: .75rem; border: 1px solid transparent; }
.user-history .hist-chip.add { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); border-color: var(--bs-success-border-subtle); }
.user-history .hist-chip.rm { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); border-color: var(--bs-danger-border-subtle); text-decoration: line-through; }
.user-history .hist-chip.now { background: var(--bs-tertiary-bg); color: var(--bs-body-color); border-color: var(--bs-border-color); }
.user-sms-summary .stat { min-width: 4.5rem; }
.user-sms-summary .stat .n { font-size: 1.15rem; font-weight: 600; line-height: 1.2; }
.user-sms .sms-thread { display: block; border: 1px solid var(--bs-border-color); border-radius: .5rem; padding: .65rem .75rem; color: inherit; text-decoration: none; transition: border-color .15s, background-color .15s; }
.user-sms .sms-thread:hover { border-color: var(--bs-primary-border-subtle); background: var(--bs-tertiary-bg); }
.user-sms .sms-thread.unread { border-left: 3px solid var(--bs-danger); }
.user-sms .sms-bubble { display: inline-block; max-width: 85%; padding: .4rem .65rem; border-radius: .9rem; white-space: pre-wrap; word-break: break-word; }
.user-sms .sms-bubble.in { background: var(--bs-secondary-bg); border-bottom-left-radius: .25rem; }
.user-sms .sms-bubble.out { background: var(--bs-primary); color: #fff; border-bottom-right-radius: .25rem; }
.user-sms .sms-bubble.out.failed { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.user-history details > summary { cursor: pointer; color: var(--bs-secondary-color); font-size: .75rem; }
.audit-details { max-width: 420px; }

/* ---- SMS inbox ---- */
.inbox { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 1rem; height: calc(100vh - 3rem); }
.inbox > .card { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.inbox-scroll { overflow-y: auto; flex: 1 1 auto; }
.inbox-thread { position: relative; }
.thread-body { overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; background: var(--bs-tertiary-bg); }
.conv-item { cursor: pointer; }
.conv-item.active { background: var(--bs-primary-bg-subtle); color: var(--bs-body-color); border-color: var(--bs-border-color); }
.conv-item:hover { background: var(--bs-tertiary-bg); }
.conv-item .conv-preview { font-size: .85rem; }
.conv-item.unread .conv-name, .conv-item.unread .conv-preview { font-weight: 600; color: var(--bs-body-color); }
.bubble { max-width: min(75%, 560px); padding: .5rem .75rem; border-radius: 1rem; word-break: break-word; }
.bubble .text { white-space: pre-wrap; }
.bubble.in { align-self: flex-start; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-bottom-left-radius: .25rem; }
.bubble.out { align-self: flex-end; background: var(--bs-primary); color: #fff; border-bottom-right-radius: .25rem; }
.bubble.out.failed { background: var(--bs-danger); }
.bubble .meta { font-size: .72rem; opacity: .75; margin-top: .25rem; }
.bubble img.mms { max-width: 220px; max-height: 220px; border-radius: .5rem; display: block; margin-top: .25rem; }
.day-sep { align-self: center; font-size: .75rem; color: var(--bs-secondary-color); }
@media (max-width: 991.98px) {
  .inbox { grid-template-columns: 1fr; height: calc(100vh - 7rem); }
  .inbox.thread-open .inbox-list { display: none !important; }
  .inbox:not(.thread-open) .inbox-thread { display: none !important; }
}

/* ---- Public ads board ---- */
.brand-mark-sm { width: 30px; height: 30px; font-size: 1rem; border-radius: .5rem; }
/* Paid add-ons on the board (no "ad"/"promo" in names: ad blockers hide those). */
.listing-card .title-strong { font-size: 1.08rem; font-weight: 800; letter-spacing: -.005em; }
.label-chip { font-size: .72rem; vertical-align: .1em; }
.listing-desc { white-space: pre-line; overflow-wrap: anywhere; }
.code-input { letter-spacing: .5em; font-size: 1.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.legal h2 { font-size: 1.1rem; margin-top: 1.75rem; }
.legal p, .legal li { line-height: 1.6; }

/* Featured row on the public board: one sliding row (swipe on phones, arrows on wider screens). */
.spotlight { position: relative; }
.spotlight-row { display: flex; gap: .5rem; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; padding: 2px 2px .5rem; scrollbar-width: thin; }
.spotlight-nav { position: absolute; top: 40%; z-index: 2; width: 2.25rem; height: 2.25rem; border-radius: 50%; display: none; align-items: center; justify-content: center; }
.spotlight-nav.prev { left: -.75rem; } .spotlight-nav.next { right: -.75rem; }
@media (hover: hover) and (min-width: 768px) { .spotlight.scrolls .spotlight-nav:not([disabled]) { display: flex; } }

/* Checkout: PayPal's card field iframes */
.pp-field { min-height: 3.1rem; }
.pp-field iframe { width: 100% !important; }

/* ♥ save button on board cards (sits over the card, outside its link) */
.save-heart { width: 2.1rem; height: 2.1rem; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.save-heart .bi { font-size: 1rem; }

/* Phone numbers typed in ad text, hidden until "Show number" */
.masked-phone { white-space: nowrap; }

/* ---- Menu as icons only ("rail") and the "Needs attention" panel beside it (layouts/app.blade.php) ---- */
:root { --rail-w: 68px; --todo-w: 264px; }
.app-todo { background: var(--bs-body-bg); border-right: 1px solid var(--bs-border-color); }
@media (min-width: 1200px) {
  .app-todo { width: var(--todo-w); flex: 0 0 var(--todo-w); position: sticky; top: 0; height: 100vh; }
  .todo-hidden .app-todo { display: none !important; }
}
.todo-scroll { overflow-y: auto; scrollbar-width: thin; }
.todo-title { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color); }
.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.todo-item { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: .6rem; border: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg); color: var(--bs-body-color); text-decoration: none; font-size: .9rem; line-height: 1.25; }
.todo-item:hover { border-color: var(--bs-secondary-color); color: var(--bs-body-color); }
.todo-item .bi { font-size: 1.05rem; flex: 0 0 auto; }
.todo-item .todo-label { flex: 1 1 auto; min-width: 0; }
.todo-item .todo-n { font-weight: 700; margin-left: auto; }
.todo-item.tone-danger { border-color: rgba(var(--bs-danger-rgb), .35); background: rgba(var(--bs-danger-rgb), .06); }
.todo-item.tone-danger .bi, .todo-item.tone-danger .todo-n { color: var(--bs-danger); }
.todo-item.tone-warning { border-color: rgba(var(--bs-warning-rgb), .45); background: rgba(var(--bs-warning-rgb), .1); }
.todo-item.tone-warning .bi { color: #b45309; }
.todo-empty { color: var(--bs-secondary-color); font-size: .9rem; padding: .25rem 0; }
.todo-empty .bi { color: var(--bs-success); }
.todo-fab { position: fixed; right: 1rem; bottom: 1rem; z-index: 1030; align-items: center; }
.todo-link { border: 0; background: none; }

@media (min-width: 992px) {
  .app-sidebar { transition: width .15s, flex-basis .15s; }
  .rail-icons .app-sidebar { width: var(--rail-w); flex-basis: var(--rail-w); }
  .rail-icons .app-sidebar .sidebar-scroll { padding-left: .55rem !important; padding-right: .55rem !important; }
  .rail-icons .app-sidebar .nav-link { display: flex; justify-content: center; font-size: 0; padding: .5rem; position: relative; }
  .rail-icons .app-sidebar .nav-link > .bi { font-size: 1.15rem; margin: 0 !important; }
  .rail-icons .app-sidebar .nav-link .badge { position: absolute; top: 1px; right: 1px; font-size: .6rem; padding: .25em .45em; margin: 0 !important; }
  .rail-icons .app-sidebar .nav-heading { font-size: 0; height: 1px; padding: 0 !important; margin: .6rem .4rem !important; background: var(--bs-border-color); }
  .rail-icons .rail-top { flex-direction: column; gap: .5rem !important; }
  .rail-icons .rail-top .logo { margin: 0 !important; }
  .rail-icons .rail-top .logo-word, .rail-icons .rail-top .logo-sub { display: none !important; }
  .rail-icons .rail-bottom .lh-sm { display: none; }
  .rail-icons .rail-bottom > .d-flex { flex-direction: column; align-items: center; }
  .rail-icons .rail-bottom form .btn { font-size: 0; }
  .rail-icons .rail-bottom form .btn .bi { font-size: .9rem; margin: 0 !important; }
}

/* Staff "Online now" in the side panel */
.staff-online { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.staff-row { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.staff-av { position: relative; flex: 0 0 auto; display: inline-flex; }
.staff-dot { position: absolute; right: -1px; bottom: -1px; width: .7rem; height: .7rem; border-radius: 50%; border: 2px solid var(--bs-body-bg); background: var(--bs-success); }
.staff-row.is-idle .staff-dot { background: #f59e0b; }
.staff-row.is-idle .staff-av img, .staff-row.is-idle .staff-av .avatar-fallback { opacity: .7; }
.staff-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.staff-name { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-meta { font-size: .78rem; color: var(--bs-secondary-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-row.is-active .staff-meta { color: var(--bs-success-text-emphasis); }

/* ---- Staff chat: list in the side panel, conversation bottom right (full screen on phones) ---- */
.chat-threads { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .15rem; }
.chat-thread { width: 100%; display: flex; align-items: center; gap: .55rem; padding: .4rem .45rem; border: 0; border-radius: .55rem; background: none; text-align: left; color: var(--bs-body-color); }
.chat-thread:hover, .chat-thread.is-open { background: var(--bs-tertiary-bg); }
.chat-thread-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.2; }
.chat-thread-name { font-size: .88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-thread-last { font-size: .77rem; color: var(--bs-secondary-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-thread.is-unread .chat-thread-last { color: var(--bs-body-color); font-weight: 600; }
.chat-team-icon { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); font-size: .85rem; }
.chat-people { max-height: 320px; overflow-y: auto; min-width: 220px; }
.staff-row[data-chat-user] { cursor: pointer; border-radius: .5rem; padding: .15rem .25rem; margin: -.15rem -.25rem; }
.staff-row[data-chat-user]:hover { background: var(--bs-tertiary-bg); }

.chat-dock { position: fixed; right: 1rem; bottom: 1rem; z-index: 1045; width: 360px; height: min(520px, calc(100vh - 2rem));
  display: flex; flex-direction: column; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .9rem; overflow: hidden; }
.chat-dock[hidden] { display: none; }
.chat-head { display: flex; align-items: center; gap: .55rem; padding: .55rem .6rem .55rem .8rem; border-bottom: 1px solid var(--bs-border-color); }
.chat-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-body { flex: 1 1 auto; overflow-y: auto; padding: .75rem; display: flex; flex-direction: column; gap: .2rem; background: var(--bs-tertiary-bg); }
.chat-empty { margin: auto; color: var(--bs-secondary-color); font-size: .9rem; }
.chat-day { align-self: center; font-size: .72rem; color: var(--bs-secondary-color); margin: .6rem 0 .3rem; }
.chat-msg { display: flex; flex-direction: column; align-items: flex-start; margin-top: .45rem; max-width: 85%; }
.chat-msg.is-cont { margin-top: 0; }
.chat-msg.is-mine { align-self: flex-end; align-items: flex-end; }
.chat-who { font-size: .72rem; color: var(--bs-secondary-color); margin: 0 0 .1rem .5rem; }
.chat-bubble { padding: .4rem .65rem; border-radius: .9rem; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); font-size: .9rem; line-height: 1.35; word-break: break-word; }
.chat-msg.is-mine .chat-bubble { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }
.chat-msg.is-mine .chat-bubble a { color: #fff; }
.chat-time { font-size: .66rem; opacity: .6; margin-left: .45rem; white-space: nowrap; }
.chat-form { display: flex; gap: .4rem; padding: .5rem; border-top: 1px solid var(--bs-border-color); align-items: flex-end; }
.chat-form textarea { resize: none; max-height: 140px; }
@media (max-width: 575.98px) {
  .chat-dock { inset: 0; width: auto; height: auto; border-radius: 0; border: 0; }
}
/* The "Needs attention" bell in the corner moves out of the way of an open conversation. */
.chat-open .todo-fab { display: none !important; }
/* Chat notice: the whole line opens the conversation; above the chat window's typing box. */
.chat-notice .toast-body { color: inherit; }
.chat-notice .toast-body:hover { text-decoration: underline; }
.chat-open #toasts { bottom: 5rem !important; }
@media (max-width: 575.98px) { .chat-open #toasts { bottom: 4.5rem !important; } }
