:root { --sm-sidebar: 210px; }
body { background: #f5f6f8; }
.sm-topbar { background: #fff; border-bottom: 1px solid #e3e6ea; }
.sm-sidebar { width: var(--sm-sidebar); flex-shrink: 0; min-height: calc(100vh - 56px); background: #fff; border-right: 1px solid #e3e6ea; padding: 1rem .5rem; }
.sm-sidebar .nav-link { color: #333; border-radius: .4rem; padding: .5rem .75rem; }
.sm-sidebar .nav-link:hover { background: #f0f2f5; }
.sm-sidebar .nav-link.active { background: #e7f0ff; color: #0d6efd; font-weight: 600; }
.sm-main { min-width: 0; }
.card { border: 1px solid #e3e6ea; box-shadow: none; }
.stat .num { font-size: 1.8rem; font-weight: 700; line-height: 1; }

/* Calendar */
.sm-cal { table-layout: fixed; background: #fff; }
.sm-cal th { font-weight: 600; font-size: .8rem; text-transform: uppercase; color: #6c757d; text-align: center; }
.sm-cal td { height: 120px; vertical-align: top; padding: 4px; position: relative; }
.sm-cal td.other { background: #fafbfc; color: #adb5bd; }
.sm-cal td.today { background: #f2f7ff; }
.sm-cal td.drop-hover { outline: 2px dashed #0d6efd; outline-offset: -3px; background: #eef4ff; }
.sm-cal .day-num { font-size: .8rem; font-weight: 600; }
.sm-cal .add-btn { position: absolute; top: 2px; right: 4px; opacity: 0; font-size: .9rem; }
.sm-cal td:hover .add-btn { opacity: 1; }
.chip { display: block; font-size: .75rem; padding: 2px 6px; margin-top: 3px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; color: #212529; border-left: 3px solid #6c757d; background: #f1f3f5; }
.chip[draggable="true"] { cursor: grab; }
.chip.s-scheduled { border-color: #0d6efd; background: #e7f0ff; }
.chip.s-pending_approval { border-color: #ffc107; background: #fff8e1; }
.chip.s-published { border-color: #198754; background: #e8f5ee; }
.chip.s-failed, .chip.s-partial { border-color: #dc3545; background: #fdecee; }
.chip.s-publishing { border-color: #0dcaf0; background: #e7fafe; }

/* Composer */
.media-thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid #dee2e6; }
.media-item { position: relative; display: inline-block; margin: 0 8px 8px 0; }
.media-item .form-check { position: absolute; bottom: 2px; left: 4px; background: rgba(255,255,255,.9); border-radius: 4px; padding: 0 4px 0 1.6em; font-size: .75rem; }
.account-pick { cursor: pointer; }
.account-pick input:checked + .card { border-color: #0d6efd; background: #f2f7ff; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #e9ecef; }
.preview-box { white-space: pre-wrap; word-break: break-word; font-size: .9rem; }
.char-count.over { color: #dc3545; font-weight: 600; }
.chip.s-archived { border-color: #212529; background: #e9ecef; color: #6c757d; }
.ai-video-item .ai-video-remove { position: absolute; top: 2px; right: 2px; padding: 0 4px; line-height: 1.2; }
.ai-video-item .ai-video-badge { position: absolute; bottom: 4px; left: 4px; font-size: .65rem; }
.ai-video-pending { width: 96px; height: 96px; border-radius: 6px; border: 1px dashed #adb5bd; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; font-size: .7rem; color: #6c757d; vertical-align: top; text-align: center; }

/* Inbox */
.inbox-list { max-height: 75vh; overflow-y: auto; }
.inbox-list .active-thread { background: #e7f0ff; border-left: 3px solid #0d6efd; }
.chat { max-height: 55vh; overflow-y: auto; background: #f7f8fa; }
.chat-row { display: flex; margin-bottom: .6rem; }
.chat-row.out { justify-content: flex-end; }
.chat-row .bubble { max-width: 80%; padding: .5rem .75rem; border-radius: 12px; background: #fff; border: 1px solid #e3e6ea; }
.chat-row.out .bubble { background: #dceaff; border-color: #c6dbff; }
.chat-row .meta { font-size: .7rem; color: #6c757d; margin-top: 2px; }

/* CRM */
tr.clickable { cursor: pointer; }
.pipeline { overflow-x: auto; align-items: flex-start; }
.pipe-col { flex: 0 0 215px; background: #eef0f3; border-radius: 8px; padding: 8px; min-height: 200px; }
.pipe-col.drop-hover { outline: 2px dashed #0d6efd; background: #e7f0ff; }
.pipe-won { background: #e8f5ee; } .pipe-lost { background: #fdecee; }
.pipe-head { padding: 2px 4px 8px; }
.pipe-body { min-height: 120px; }
.deal-card { display: block; background: #fff; border: 1px solid #e3e6ea; border-radius: 6px; padding: 8px; margin-bottom: 8px; color: inherit; text-decoration: none; }
.deal-card[draggable="true"] { cursor: grab; }
.deal-card:hover { border-color: #0d6efd; }
.timeline .preview-box { font-size: .85rem; }
.net-link { cursor: pointer; border-radius: 4px; padding: 1px 4px; margin-left: -4px; }
.net-link:hover, .net-link:focus { background: #e7f0ff; color: #0d6efd; text-decoration: underline; outline: none; }

/* Let long text (e.g. Arabic captions) shrink and end with "…" instead of widening the page. */
.min-w-0 { min-width: 0 !important; }
.sm-main { overflow-x: hidden; }
.text-truncate[dir="auto"] { unicode-bidi: plaintext; }

/* AI Studio cards: keep Use / Download / Pin / Delete on one row, all the same height. */
.ai-card-actions { flex-wrap: nowrap; }
.ai-card-actions .btn { padding: .25rem .5rem; line-height: 1.25; }
@media (max-width: 575.98px) { .ai-card-actions { gap: .2rem !important; } .ai-card-actions .btn { padding: .25rem .4rem; } }
