/* Email-style notification inbox for the header bell (resources/views/layouts/partials/header-notifications.blade.php). */

.cmn-bell {
    position: relative;
    list-style: none;
}

.cmn-bell-toggle {
    position: relative;
    cursor: pointer;
}

.cmn-bell-badge {
    position: absolute;
    top: -6px;
    right: -7px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #e5484d;
    color: #fff;
    font: 700 11px/18px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    text-align: center;
    pointer-events: none;
    box-shadow: 0 0 0 2px var(--theme-900, #00359e);
}

.cmn-bell-badge:empty {
    display: none;
}

/* CMMCP-MKT-002: the SAME bell (header-notifications.blade.php), reused as-is
   on the POS toolbar (layouts/partials/header-pos.blade.php). Only the button
   chrome is re-skinned here to match the white/bordered POS action buttons --
   the badge, dropdown, tabs, list and detail markup/behaviour are untouched. */
.pos-header-bell .cmn-bell-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    background: #fff;
    border: 2px solid currentColor;
    border-radius: 6px;
    color: #4b5563; /* tw-text-gray-600, matching the sibling POS toolbar buttons */
    box-shadow: rgba(17, 17, 26, 0.1) 0px 0px 16px;
}

.pos-header-bell .cmn-bell-toggle:hover {
    background: rgba(255, 255, 255, 0.6);
    color: #4b5563;
}

.pos-header-bell .cmn-bell-badge {
    box-shadow: 0 0 0 2px #fff;
}

.cmn-bell .dropdown-menu.cmn-inbox {
    left: auto !important;
    right: 0;
    top: calc(100% + 8px);
    width: 400px;
    max-width: calc(100vw - 16px);
    margin: 0;
    transition: none;
    padding: 0;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    background: #fff;
    color: #101828;
    font-size: 14px;
    text-align: left;
    box-shadow: 0 12px 32px rgba(16, 24, 40, 0.16), 0 2px 6px rgba(16, 24, 40, 0.08);
    overflow: hidden;
    z-index: 1050;
}

/* Keep list and detail the same width so switching folders cannot move the panel. */
.cmn-bell .dropdown-menu.cmn-inbox.cmn-inbox--reading {
    width: 400px;
    max-width: calc(100vw - 16px);
}

/* Narrow-screen height only; notification-inbox.js places the panel within
   the viewport at every width, including a left-side POS bell on desktop. */
@media (max-width: 991px) {
    .cmn-bell > .dropdown-menu.cmn-inbox,
    .cmn-bell > .dropdown-menu.cmn-inbox.cmn-inbox--reading {
        max-height: calc(100dvh - 88px);
        overflow: hidden;
    }

    .cmn-inbox__list,
    .cmn-inbox__detail-view {
        max-height: calc(100dvh - 190px);
    }
}

.cmn-inbox__close {
    flex: none;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #344054;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.cmn-inbox__close:hover,
.cmn-inbox__close:focus-visible {
    background: #f2f4f7;
}

.cmn-inbox [hidden] {
    display: none !important;
}

.cmn-inbox button {
    font-family: inherit;
}

/* Header + tabs */
.cmn-inbox__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 14px 8px 16px;
}

.cmn-inbox__heading {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.cmn-inbox__title {
    font-size: 15px;
    font-weight: 700;
    color: #101828;
}

.cmn-inbox__pill {
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef4ff;
    color: var(--theme-800, #0040c1);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.cmn-inbox__pill:empty {
    display: none;
}

.cmn-link-btn {
    padding: 4px 8px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--theme-800, #0040c1);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.cmn-link-btn:hover {
    background: #f2f4f7;
}

.cmn-link-btn--danger {
    color: #e5484d;
}

.cmn-link-btn--danger:hover {
    background: #fef1f1;
}

.cmn-inbox__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 0 10px;
    border-bottom: 1px solid #eaecf0;
}

.cmn-inbox__folder-tabs {
    display: flex;
    flex-wrap: wrap;
    min-width: 0;
    overflow: visible;
}

.cmn-inbox__tabs .cmn-js-mark-all {
    margin-left: auto;
    flex: none;
    align-self: center;
    white-space: nowrap;
}

.cmn-tab {
    flex: none;
    margin-bottom: -1px;
    padding: 8px 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: #667085;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.cmn-tab:hover {
    color: #101828;
}

.cmn-tab.is-active {
    border-bottom-color: var(--theme-800, #0040c1);
    color: var(--theme-800, #0040c1);
}

/* List: about six cards visible, the rest scrolls */
.cmn-inbox__list,
.cmn-inbox__detail-view {
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #d0d5dd transparent;
}

.cmn-inbox__list {
    max-height: 470px;
    padding: 6px;
}

.cmn-inbox__detail-view {
    max-height: 560px;
}

.cmn-inbox__list::-webkit-scrollbar,
.cmn-inbox__detail-view::-webkit-scrollbar {
    width: 8px;
}

.cmn-inbox__list::-webkit-scrollbar-thumb,
.cmn-inbox__detail-view::-webkit-scrollbar-thumb {
    border-radius: 8px;
    background: #d0d5dd;
}

.cmn-inbox__empty {
    padding: 36px 16px;
    color: #98a2b3;
    text-align: center;
}

.cmn-inbox__more {
    display: block;
    width: calc(100% - 12px);
    margin: 2px 6px 8px;
    padding: 8px;
    border: 1px solid #eaecf0;
    border-radius: 8px;
    background: #fff;
    color: #344054;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.cmn-inbox__more:hover {
    background: #f9fafb;
}

/* Card */
/* CMMCP-MKT-002.1: swipe-reveal action rail. .cmn-card-row is the fixed
   clipping frame; .cmn-card-row__rail sits underneath at the right edge;
   .cmn-card is the opaque foreground that slides left (via transform, set
   by notification-inbox.js) to reveal it. touch-action:pan-y lets native
   vertical scrolling through untouched -- only a confirmed horizontal drag
   ever calls preventDefault(). Trash cards (.cmn-card-row--static) have no
   rail and never receive pointer/swipe handlers. */
.cmn-card-row {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    touch-action: pan-y;
}

.cmn-card-row + .cmn-card-row {
    margin-top: 2px;
}

.cmn-card-row__rail {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px;
    background: #f2f4f7;
}

.cmn-card-row:not(.is-swiping) .cmn-card {
    transition: transform 0.18s ease;
}

.cmn-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 10px 10px 18px;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    outline: none;
    transition: background-color 0.15s ease;
    touch-action: pan-y;
}

.cmn-card:hover,
.cmn-card:focus-visible {
    background: #f5f7fa;
}

.cmn-card:focus-visible {
    box-shadow: inset 0 0 0 2px var(--theme-700, #004eeb);
}

.cmn-card.is-unread {
    background: #f5f8ff;
}

.cmn-card.is-unread:hover {
    background: #edf2ff;
}

.cmn-card__dot {
    position: absolute;
    top: 23px;
    left: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: transparent;
}

.cmn-card.is-unread .cmn-card__dot {
    background: var(--theme-700, #004eeb);
}

.cmn-card__icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f2f4f7;
    color: #475467;
    font-size: 13px;
    overflow: hidden;
}

.cmn-card__icon i {
    display: inline-block;
    width: 32px;
    height: 32px;
    line-height: 32px;
    border-radius: 50%;
    text-align: center;
}

.cmn-card__body {
    flex: 1;
    min-width: 0;
}

.cmn-card__top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.cmn-card__title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: #344054;
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.cmn-card.is-unread .cmn-card__title {
    color: #101828;
    font-weight: 700;
}

.cmn-card__meta {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cmn-card__time {
    color: #98a2b3;
    font-size: 12px;
    white-space: nowrap;
}

.cmn-card.is-unread .cmn-card__time {
    color: var(--theme-800, #0040c1);
    font-weight: 600;
}

.cmn-card__star-flag {
    display: none;
    width: 13px;
    height: 13px;
    fill: #f5b400;
}

.cmn-card.is-starred .cmn-card__star-flag {
    display: inline-block;
}

.cmn-card__snippet {
    display: -webkit-box;
    margin-top: 2px;
    overflow: hidden;
    color: #667085;
    font-size: 13px;
    line-height: 18px;
    word-break: break-word;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cmn-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

/* Hover actions replace the time, Gmail-style */
.cmn-card__actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 2px;
    padding-left: 6px;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
}

.cmn-card:hover .cmn-card__actions,
.cmn-card:focus-within .cmn-card__actions {
    opacity: 1;
    pointer-events: auto;
    background: #f5f7fa;
}

.cmn-card.is-unread:hover .cmn-card__actions,
.cmn-card.is-unread:focus-within .cmn-card__actions {
    background: #edf2ff;
}

.cmn-card:hover .cmn-card__meta,
.cmn-card:focus-within .cmn-card__meta {
    visibility: hidden;
}

@media (hover: none) {
    .cmn-card__actions {
        position: static;
        align-self: center;
        opacity: 1;
        pointer-events: auto;
    }

    .cmn-card:hover .cmn-card__meta {
        visibility: visible;
    }
}

/* Tags */
.cmn-tag {
    padding: 1px 7px;
    border-radius: 999px;
    background: #f2f4f7;
    color: #475467;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
}

.cmn-tag--info {
    background: #eff8ff;
    color: #175cd3;
}

.cmn-tag--medium {
    background: #fffaeb;
    color: #b54708;
}

.cmn-tag--high {
    background: #fff4ed;
    color: #c4320a;
}

.cmn-tag--urgent {
    background: #d92d20;
    color: #fff;
}

/* Icon buttons */
.cmn-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #667085;
    cursor: pointer;
}

.cmn-icon-btn:hover {
    background: #e4e7ec;
    color: #101828;
}

.cmn-icon-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cmn-icon-btn.cmn-js-star.is-on {
    color: #f5b400;
}

.cmn-icon-btn.cmn-js-star.is-on svg {
    fill: currentColor;
}

.cmn-icon-btn--danger:hover {
    background: #fef3f2;
    color: #d92d20;
}

/* Reading pane */
.cmn-detail__toolbar {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid #eaecf0;
    background: #fff;
}

.cmn-detail__tools {
    display: flex;
    gap: 2px;
}

.cmn-detail__subject {
    margin: 14px 16px 10px;
    color: #101828;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.35;
    word-break: break-word;
}

.cmn-detail__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px 12px;
    border-bottom: 1px solid #f2f4f7;
}

.cmn-detail__meta-text {
    min-width: 0;
}

.cmn-detail__from {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    color: #344054;
    font-size: 13px;
    font-weight: 600;
}

.cmn-detail__date {
    margin-top: 2px;
    color: #98a2b3;
    font-size: 12px;
}

.cmn-detail__body {
    padding: 14px 16px 18px;
    color: #344054;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.cmn-detail__text {
    margin: 0;
}

.cmn-detail__callout {
    margin-top: 14px;
    padding: 10px 12px;
    border-left: 3px solid var(--theme-700, #004eeb);
    border-radius: 0 8px 8px 0;
    background: #f5f8ff;
}

.cmn-detail__callout-title {
    margin-bottom: 4px;
    color: var(--theme-800, #0040c1);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.cmn-detail__foot {
    margin-top: 12px;
    color: #98a2b3;
    font-size: 12px;
}

.cmn-detail__open {
    display: inline-flex;
    margin-top: 14px;
    padding: 7px 14px;
    border-radius: 8px;
    background: var(--theme-800, #0040c1);
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
}

.cmn-detail__open:hover {
    background: var(--theme-700, #004eeb);
}

/* CMMCP-MKT-003 Phase 1B: shared AI/human operational workspace. */

.cmn-card__pin-flag {
    width: 12px;
    height: 12px;
    fill: var(--theme-800, #0040c1);
}

.cmn-tag--origin-human {
    background: #f4ebff;
    color: #6941c6;
}

.cmn-tag--needs-organize {
    background: #fef3f2;
    color: #b42318;
}

.cmn-tag--checklist {
    background: #ecfdf3;
    color: #027a48;
}

.cmn-quick-note {
    padding: 10px 16px 14px;
    border-bottom: 1px solid #eaecf0;
}

.cmn-quick-note__input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
}

.cmn-quick-note__actions {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 6px;
}

.cmn-btn-primary {
    padding: 5px 12px;
    border: 0;
    border-radius: 6px;
    background: var(--theme-800, #0040c1);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.cmn-btn-primary:hover {
    background: var(--theme-700, #004eeb);
}

.cmn-detail__section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    margin-bottom: 4px;
    color: #98a2b3;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.cmn-origin-dot {
    display: inline-block;
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: 999px;
}

.cmn-origin-dot--human,
.cmn-origin-dot--user {
    background: #6941c6;
}

.cmn-origin-dot--ai {
    background: var(--theme-800, #0040c1);
}

.cmn-checklist {
    margin-top: 10px;
}

.cmn-checklist__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13.5px;
    color: #344054;
    cursor: pointer;
}

.cmn-checklist__item input[type='checkbox'] {
    flex: none;
    width: 16px;
    height: 16px;
}

.cmn-checklist__item:has(input:checked) .cmn-checklist__text {
    color: #98a2b3;
    text-decoration: line-through;
}

.cmn-checklist__text {
    flex: 1 1 auto;
    word-break: break-word;
}

.cmn-checklist__add,
.cmn-notes__add {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.cmn-checklist__input,
.cmn-notes__input {
    flex: 1 1 auto;
    padding: 6px 9px;
    border: 1px solid #d0d5dd;
    border-radius: 7px;
    font-size: 13px;
}

.cmn-notes__input {
    resize: vertical;
}

.cmn-notes__item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    padding: 6px 0;
    border-top: 1px solid #f2f4f7;
}

.cmn-notes__author {
    color: #667085;
    font-size: 12px;
    font-weight: 600;
}

.cmn-notes__text {
    flex: 1 0 100%;
    margin: 2px 0 0;
    color: #344054;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}

.cmn-detail__workspace-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 16px;
    padding-top: 10px;
    border-top: 1px solid #eaecf0;
}

.cmn-link-btn.is-on {
    background: #eff8ff;
    color: #175cd3;
}

/* Detail content scrolls vertically within the fixed-width panel. */
.cmn-inbox--reading .cmn-detail__body {
    padding-bottom: 20px;
}
