/* Command Center — shared styles (pq-crm look). */
.navbar-brand { font-weight: 700; letter-spacing: .5px; }
.metric-card { transition: transform .15s; border: 1px solid var(--bs-border-color); }
.metric-card:hover { transform: translateY(-2px); border-color: var(--bs-primary); }
.metric-card .display-6 { font-weight: 700; }
.table td, .table th { vertical-align: middle; }
.kanban-col { min-width: 260px; }
.timeline-item { border-left: 3px solid var(--bs-border-color); padding: .4rem .75rem; margin-bottom: .4rem; }

/* ---------------------------------------------------------------- email builder */
.eb-name { max-width: 340px; }
.eb-wrap { display: grid; grid-template-columns: 190px minmax(0, 1fr) 300px; gap: 12px; align-items: start; }
@media (max-width: 1199px) { .eb-wrap { grid-template-columns: 160px minmax(0, 1fr); } .eb-props { grid-column: 1 / -1; } }
@media (max-width: 767px) { .eb-wrap { grid-template-columns: 1fr; } }
.eb-palette, .eb-props { position: sticky; top: 8px; max-height: calc(100vh - 16px); overflow: auto; }
.eb-props { border: 1px solid var(--bs-border-color); border-radius: .375rem; padding: 10px; background: var(--bs-body-bg); }
.eb-pal { cursor: grab; }
.eb-ico { display: inline-block; width: 1.6em; text-align: center; opacity: .75; }
.eb-cols-ico { display: inline-flex; width: 2em; height: .9em; gap: 2px; margin-right: .4em; vertical-align: middle; }
.eb-cols-ico i { background: currentColor; opacity: .45; border-radius: 1px; }
.eb-canvas-bg { padding: 16px 8px; border-radius: .375rem; overflow-x: auto; }
.eb-canvas { width: 600px; max-width: 100%; margin: 0 auto; color: #1f2933; min-height: 200px; box-shadow: 0 1px 4px rgba(0,0,0,.12); position: relative; }
.eb-canvas.is-over { outline: 2px dashed #3b82f6; }
.eb-empty { padding: 48px 16px; text-align: center; color: #6b7280; }
.eb-row { position: relative; outline: 1px dashed transparent; }
.eb-row:hover, .eb-row:focus { outline-color: #93c5fd; }
.eb-row.is-sel { outline: 2px solid #2563eb; z-index: 1; }
.eb-row-handle { position: absolute; left: -2px; top: -18px; font-size: 11px; background: #2563eb; color: #fff; padding: 0 6px; border-radius: 3px 3px 0 0; cursor: grab; display: none; z-index: 2; }
.eb-row:hover .eb-row-handle, .eb-row.is-sel .eb-row-handle { display: block; }
.eb-cols { display: flex; gap: 0; }
.eb-col { min-height: 36px; min-width: 0; }
.eb-col.is-over { background: rgba(59,130,246,.06); }
.eb-col-empty { border: 1px dashed #cbd5e1; color: #94a3b8; font-size: 12px; text-align: center; padding: 10px 4px; margin: 4px; }
.eb-block { position: relative; cursor: pointer; outline: 1px dashed transparent; }
.eb-block:hover, .eb-block:focus { outline-color: #93c5fd; }
.eb-block.is-sel { outline: 2px solid #2563eb; z-index: 2; }
.eb-block.has-error { box-shadow: inset 3px 0 0 #dc2626; }
.eb-block.has-warn { box-shadow: inset 3px 0 0 #f59e0b; }
.eb-block.is-dragging { opacity: .4; }
.eb-block img { max-width: 100%; height: auto; display: inline-block; }
.eb-tag { position: absolute; right: 2px; top: 2px; font-size: 10px; background: rgba(37,99,235,.9); color: #fff; padding: 0 4px; border-radius: 2px; display: none; }
.eb-block:hover .eb-tag, .eb-block.is-sel .eb-tag { display: block; }
.eb-toolbar { position: absolute; right: 2px; bottom: -30px; z-index: 5; display: flex; gap: 2px; background: #fff; border: 1px solid #cbd5e1; border-radius: 4px; padding: 2px; }
.eb-toolbar .btn { padding: 0 6px; line-height: 1.4; color: #111; }
.eb-indicator { height: 4px; background: #2563eb; border-radius: 2px; margin: 2px 4px; pointer-events: none; }
.eb-footer { border-top: 1px solid #e5e7eb; padding: 20px 24px; font-size: 12px; line-height: 18px; font-family: Arial, Helvetica, sans-serif; cursor: pointer; }
.eb-footer.is-sel { outline: 2px solid #2563eb; }
.eb-lock { font-size: 10px; background: #f3f4f6; color: #374151; border-radius: 3px; padding: 0 4px; margin-left: 4px; }
.eb-chip { display: inline-block; background: #dbeafe; color: #1e3a8a; border-radius: 10px; padding: 0 6px; font-size: .85em; font-weight: normal; line-height: 1.5; }
.eb-chip::before { content: "{"; opacity: .5; } .eb-chip::after { content: "}"; opacity: .5; }
.eb-chip-bad { background: #fee2e2; color: #991b1b; }
.eb-btn { display: inline-block; padding: 12px 24px; font-weight: bold; line-height: 20px; }
.eb-spacer { background: repeating-linear-gradient(45deg, transparent, transparent 6px, rgba(148,163,184,.12) 6px, rgba(148,163,184,.12) 12px); font-size: 10px; color: #94a3b8; text-align: center; overflow: hidden; }
.eb-hole { background: #e5e7eb; color: #6b7280; text-align: center; padding: 28px 8px; font-size: 13px; border-radius: 3px; }
.eb-video { position: relative; }
.eb-play { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); background: rgba(0,0,0,.6); color: #fff; width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; pointer-events: none; }
.eb-it { display: flex; gap: 16px; align-items: flex-start; } .eb-it-txt { flex: 1 1 0; min-width: 0; }
.eb-gallery { display: flex; } .eb-gallery > div { flex: 1 1 0; min-width: 0; }
.eb-gallery img { width: 100%; }
.eb-logo-group { display: inline-flex; align-items: center; gap: 0; flex-wrap: wrap; justify-content: center; }
.eb-sep { color: #9ca3af; padding: 0 10px; font-size: 20px; } .eb-sep-gap { width: 16px; display: inline-block; }
.eb-sep-line { display: inline-block; width: 1px; height: 32px; background: #d1d5db; margin: 0 13px; }
.eb-logo-text { font-weight: bold; font-size: 22px; }
.eb-social { display: inline-block; border: 1px solid; border-radius: 14px; padding: 4px 12px; font-size: 13px; }
.eb-rich p { margin: 0 0 12px; } .eb-rich ul, .eb-rich ol { margin: 0 0 12px; padding-left: 22px; }
.eb-rich-edit { min-height: 120px; max-height: 320px; overflow: auto; }
.eb-rich-edit p { margin: 0 0 8px; }
.eb-swatch { width: 24px; height: 24px; border-radius: 4px; border: 1px solid rgba(0,0,0,.2); padding: 0; }
.eb-swatch.active { outline: 2px solid #2563eb; outline-offset: 1px; }
.eb-swatch-none { background: linear-gradient(135deg, #fff 45%, #dc2626 45%, #dc2626 55%, #fff 55%); }
.eb-color-custom { width: 34px; height: 26px; padding: 1px; }
.eb-prop-thumb { max-width: 100%; max-height: 90px; display: block; margin-bottom: 4px; border: 1px solid var(--bs-border-color); }
.eb-logo-mini { height: 22px; max-width: 80px; object-fit: contain; background: #f3f4f6; }
.eb-issues li { margin-bottom: 2px; }
.eb-preview-box { background: var(--bs-tertiary-bg); padding: 8px; border-radius: .375rem; overflow-x: auto; }
.eb-frame { width: 100%; min-width: 640px; height: 760px; display: block; margin: 0 auto; transition: width .2s; }
.eb-frame.is-mobile { width: 390px; min-width: 390px; }
.eb-suggest { z-index: 20; max-height: 260px; overflow: auto; }
.eb-merge-menu { max-height: 360px; overflow: auto; position: absolute; width: 260px; z-index: 1060; }
.eb-modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1055; display: flex; align-items: center; justify-content: center; }
.eb-modal[hidden] { display: none; }
.eb-modal-box { background: var(--bs-body-bg); border-radius: .5rem; padding: 14px; width: min(860px, 94vw); max-height: 86vh; overflow: auto; }
.eb-modal.is-over .eb-modal-box, .eb-drop.is-over { outline: 3px dashed #3b82f6; }
.eb-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.eb-media-item { border: 1px solid var(--bs-border-color); border-radius: 4px; background: #f8fafc; padding: 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: #111; }
.eb-media-item img { max-width: 100%; height: 80px; object-fit: contain; }
.eb-media-item:hover, .eb-media-item:focus { outline: 2px solid #2563eb; }
.eb-thumb { height: 140px; display: flex; align-items: center; justify-content: center; background: repeating-conic-gradient(#f1f5f9 0 25%, #fff 0 50%) 50% / 16px 16px; border-bottom: 1px solid var(--bs-border-color); }
.eb-thumb img { max-width: 100%; max-height: 136px; object-fit: contain; }
.eb-starter { cursor: pointer; } .eb-starter:has(input:checked) { border-color: #2563eb; box-shadow: 0 0 0 1px #2563eb; }
.ei-code { display: flex; border: 1px solid var(--bs-border-color); border-radius: .375rem; height: 640px; overflow: hidden; background: var(--bs-body-bg); }
.ei-lines { margin: 0; padding: 8px 6px; text-align: right; color: #94a3b8; background: var(--bs-tertiary-bg); font: 12px/18px ui-monospace, SFMono-Regular, Menlo, monospace; overflow: hidden; user-select: none; min-width: 3.2em; }
.ei-code textarea { flex: 1; border: 0; resize: none; padding: 8px; font: 12px/18px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; overflow: auto; outline: none; background: transparent; color: inherit; }

/* ---------------------------------------------------------------- phones & tablets (mobile pass, 2026-10-28) */
/* Touch screens: 44 px tap targets, 16 px form text (iOS Safari zooms into anything smaller). */
@media (pointer: coarse), (max-width: 767.98px) {
  .form-control, .form-select, textarea, input.form-control-sm, select.form-select-sm { font-size: 16px; }
  .btn, .form-control, .form-select, .nav-link, .dropdown-item, .page-link { min-height: 44px; }
  .btn { display: inline-flex; align-items: center; justify-content: center; }
  .btn.d-none, .d-none.btn { display: none !important; }
  .btn-link.p-0, .btn-link.py-0 { min-height: 0; }
  textarea.form-control { min-height: 88px; }
  .form-check-input { width: 1.35em; height: 1.35em; }
  .form-check { min-height: 32px; display: flex; align-items: center; gap: .4rem; }
  .form-check-input { margin-top: 0; flex: 0 0 auto; }
  .form-switch .form-check-input { width: 2.4em; }
  .dropdown-menu { max-width: calc(100vw - 16px); }
  .navbar-collapse { max-height: calc(100vh - 64px); overflow-y: auto; }
  .btn-close { width: 1.5em; height: 1.5em; }
}
/* Phones */
@media (max-width: 767.98px) {
  main.container-fluid { padding-left: 12px; padding-right: 12px; }
  .page-actions { width: 100%; }
  .action-bar > .btn, .action-bar > span > .btn { flex: 1 1 auto; }
  .btn-group:not(.cb-split):not(.sp-keypad) { flex-wrap: wrap; }
  .card-header { flex-wrap: wrap; gap: .25rem; }
  .nav-pills, .nav-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; white-space: nowrap; scrollbar-width: none; }
  .nav-pills::-webkit-scrollbar, .nav-tabs::-webkit-scrollbar { display: none; }
  .toast-container { left: 0; right: 0; width: 100%; padding: 8px !important; }
  .toast-container .toast { width: 100%; max-width: 100%; }
  pre, code { white-space: pre-wrap; word-break: break-word; }
  .modal-dialog { margin: .5rem; }
  /* Stacked tables: rows become cards; labels come from the header (static/app.js). */
  table.table-stack thead { display: none; }
  table.table-stack, table.table-stack tbody, table.table-stack tr, table.table-stack td { display: block; width: 100%; }
  table.table-stack tr { border: 1px solid var(--bs-border-color); border-radius: .5rem; margin-bottom: .6rem; padding: .35rem .6rem; overflow: hidden; }
  table.table-stack td { border: 0; padding: .2rem 0 .2rem 6.75rem; position: relative; white-space: normal !important; text-align: left !important; min-height: 1.6em; }
  table.table-stack td::before { content: attr(data-label); position: absolute; left: 0; top: .25rem; width: 6.25rem; font-size: .75rem; font-weight: 600; color: var(--bs-secondary-color); }
  table.table-stack td.td-nolabel { padding-left: 0; }
  table.table-stack td.td-nolabel::before { content: none; }
  table.table-stack td:empty { display: none; }
  .table-responsive:has(> table.table-stack) { overflow-x: visible; }
  /* Filters + bulk actions fold behind a toggle */
  .mobile-fold.collapse:not(.show) { display: none; }
  /* Long preview iframes */
  #copy-preview { height: 70vh !important; }
}
@media (min-width: 768px) {
  .mobile-fold.collapse:not(.show) { display: block; }
  .mobile-only { display: none !important; }
}

/* Softphone: a fixed bottom sheet on phones (dialer page) */
.sp-keypad { display: inline-flex; flex-wrap: wrap; }
@media (max-width: 991.98px) {
  body.has-sheet { padding-bottom: var(--sheet-h, 320px); }
  .sp-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035; margin: 0 !important; border-radius: 1rem 1rem 0 0;
              box-shadow: 0 -6px 24px rgba(0,0,0,.18); max-height: 75vh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
  .sp-sheet .card-header { position: sticky; top: 0; z-index: 1; background: var(--bs-body-bg); }
  .sp-sheet .card-body { padding: .6rem .75rem; }
  .sp-sheet #btn-call, .sp-sheet #btn-hangup, .sp-sheet #btn-own-phone, .sp-sheet .sp-own-link { min-height: 56px; font-size: 1.1rem; font-weight: 600; }
  .sp-sheet #dial-phone { min-height: 56px; font-size: 18px; }
  .sp-sheet #btn-mute, .sp-sheet #btn-keypad { min-height: 52px; flex: 1 1 0; }
  .sp-sheet .sp-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: 100%; }
  .sp-sheet .sp-keypad > .btn { min-height: 52px; font-size: 1.3rem; border-radius: .5rem !important; margin: 0 !important; }
  .sp-sheet .sp-keypad.sp-hidden { display: none; }
  .sp-sheet.sp-min .card-body { display: none; }
}
@media (min-width: 992px) { #btn-keypad { display: none !important; } }
@media (max-width: 767.98px) {
  .d-flex:not(.flex-nowrap):not(.flex-column):not(.input-group):not(.btn-group) { flex-wrap: wrap; }
  .eb-frame.is-mobile { min-width: 0; width: 100%; }
  .eb-name { max-width: 100%; }
}

/* ---------------------------------------------------------------- Social module (calendar, composer previews) */
.soc-ic { display: inline-flex; align-items: center; justify-content: center; width: 1.25rem; height: 1.25rem; border-radius: .3rem; font-size: .75rem; font-weight: 700; color: #fff; margin-right: .15rem; vertical-align: -.15em; }
.soc-facebook { background: #1877f2; } .soc-instagram { background: linear-gradient(45deg, #f58529, #dd2a7b, #8134af); } .soc-threads { background: #111; }
.soc-st-draft { background: var(--bs-secondary-bg); color: var(--bs-body-color); } .soc-st-approved { background: #cfe2ff; color: #052c65; }
.soc-st-scheduled { background: #d1ecf1; color: #0c5460; } .soc-st-publishing, .soc-st-waiting, .soc-st-pending { background: #fff3cd; color: #664d03; }
.soc-st-posted { background: #d1e7dd; color: #0a3622; } .soc-st-failed, .soc-st-cancelled { background: #f8d7da; color: #58151c; }
.soc-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--bs-border-color); border-top: 1px solid var(--bs-border-color); }
.soc-dow { font-size: .75rem; font-weight: 600; padding: .25rem .4rem; border-right: 1px solid var(--bs-border-color); border-bottom: 1px solid var(--bs-border-color); background: var(--bs-tertiary-bg); }
.soc-day { min-height: 7rem; padding: .2rem; border-right: 1px solid var(--bs-border-color); border-bottom: 1px solid var(--bs-border-color); overflow: hidden; }
.soc-week .soc-day { min-height: 22rem; }
.soc-day.soc-out { background: var(--bs-tertiary-bg); opacity: .7; } .soc-day.soc-today .soc-dnum { color: #fff; background: #2563eb; border-radius: 1rem; display: inline-block; padding: 0 .4rem; }
.soc-day.soc-over { outline: 2px dashed #2563eb; outline-offset: -2px; }
.soc-dnum { font-size: .75rem; color: var(--bs-secondary-color); }
.soc-item { display: block; font-size: .75rem; line-height: 1.3; padding: .15rem .3rem; margin-top: .15rem; border-radius: .3rem; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.soc-item[draggable="true"] { cursor: grab; }
.soc-list .soc-item { font-size: .9rem; padding: .5rem .6rem; min-height: 44px; white-space: normal; }
.soc-thumb { position: relative; width: 96px; text-align: center; } .soc-thumb img { width: 96px; height: 96px; object-fit: cover; border-radius: .3rem; border: 1px solid var(--bs-border-color); }
.soc-thumb .btn-close { position: absolute; top: 2px; right: 2px; background-color: #fff; border-radius: 50%; padding: .25rem; }
.soc-pick img { width: 120px; height: 90px; object-fit: cover; } .soc-pick { width: 132px; }
.soc-issue { padding: .15rem 0 .15rem 1.1rem; position: relative; } .soc-issue::before { position: absolute; left: 0; }
.soc-error { color: var(--bs-danger-text-emphasis); } .soc-error::before { content: "✕"; }
.soc-warning { color: var(--bs-warning-text-emphasis); } .soc-warning::before { content: "!"; font-weight: 700; }
.soc-info { color: var(--bs-secondary-color); } .soc-info::before { content: "i"; font-style: italic; }
.soc-av { width: 32px; height: 32px; border-radius: 50%; background: var(--bs-secondary-bg); display: inline-flex; align-items: center; justify-content: center; overflow: hidden; font-weight: 700; }
.soc-av img { width: 100%; height: 100%; object-fit: cover; }
.soc-pv-text { font-size: .9rem; white-space: normal; word-break: break-word; margin-bottom: .4rem; } .soc-link { color: #1d4ed8; }
.soc-pv-media { display: grid; gap: 2px; position: relative; margin-bottom: .4rem; } .soc-pv-media img { width: 100%; object-fit: cover; max-height: 320px; border-radius: .2rem; }
.soc-pv-media.soc-n2, .soc-pv-media.soc-n3, .soc-pv-media.soc-n4 { grid-template-columns: 1fr 1fr; } .soc-pv-ig img { aspect-ratio: 4 / 5; max-height: none; }
.soc-pv-count { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: .7rem; border-radius: 1rem; padding: 0 .4rem; }
@media (max-width: 767.98px) { .soc-thumb, .soc-thumb img { width: 80px; } .soc-thumb img { height: 80px; } }
