/* ========================================================================
   Admin Panel — ClickUp-inspired SaaS UI on Bootstrap 5
   ======================================================================== */

:root {
    --pm-primary:        #7B68EE;
    --pm-primary-hover:  #6c5ce7;
    --pm-primary-soft:   #f3f0ff;
    --pm-primary-active: #ede8ff;

    --pm-bg:             #ffffff;
    --pm-bg-soft:        #fafbfc;
    --pm-bg-deep:        #f5f6f8;
    --pm-card:           #ffffff;
    --pm-border:         #eef0f3;
    --pm-border-strong:  #e1e4ea;

    --pm-text:           #1f2937;
    --pm-text-muted:     #7c828d;
    --pm-text-soft:      #9aa0ab;

    --pm-sidebar-bg:     #ffffff;
    --pm-sidebar-border: #eef0f3;
    --pm-sidebar-text:   #44546f;
    --pm-sidebar-hover:  #f5f6f8;
    --pm-sidebar-active-bg:   #f3f0ff;
    --pm-sidebar-active-text: #5b46c2;

    --pm-success:        #2ecd6f;
    --pm-success-soft:   #defaeb;
    --pm-warning:        #ffb547;
    --pm-warning-soft:   #fff3da;
    --pm-danger:         #f25767;
    --pm-danger-soft:    #ffe4e7;
    --pm-info:           #49ccf9;
    --pm-info-soft:      #e0f7ff;

    --pm-radius:         7px;
    --pm-radius-lg:      11px;
    --pm-shadow:         0 1px 2px rgba(15, 23, 42, 0.04);
    --pm-shadow-lg:      0 8px 24px rgba(15, 23, 42, 0.08);
    --pm-sidebar-w:      252px;
}

/* ── Base ──────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
    background: var(--pm-bg-deep);
    color: var(--pm-text);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--pm-primary); text-decoration: none; }
a:hover { color: var(--pm-primary-hover); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d8dce4; border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #c2c7d1; background-clip: padding-box; border: 2px solid transparent; }

/* ── App layout ────────────────────────────────────────────────────────── */

.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--pm-sidebar-w);
    flex-shrink: 0;
    background: var(--pm-sidebar-bg);
    color: var(--pm-sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 1030;
    border-right: 1px solid var(--pm-sidebar-border);
    transition: transform .25s ease;
}

.app-main {
    flex: 1;
    margin-left: var(--pm-sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--pm-bg-deep);
}

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.is-open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(15,23,42,0.10);
    }
    .app-main { margin-left: 0; }
}

/* ── Collapsible sidebar (desktop) ─────────────────────────────────────
 * The "collapsed" class slides the sidebar fully off-screen to give
 * the user as much horizontal space as possible. A floating "show
 * sidebar" button appears in the top-left when collapsed. The state
 * is persisted to localStorage so navigation preserves it.
 * ───────────────────────────────────────────────────────────────────── */
@media (min-width: 992px) {
    .app-shell.sidebar-collapsed .app-sidebar { transform: translateX(-100%); }
    .app-shell.sidebar-collapsed .app-main { margin-left: 0; }
}
.sidebar-fab {
    position: fixed;
    top: 14px; left: 14px; z-index: 1031;
    width: 36px; height: 36px;
    border-radius: 8px;
    border: 1px solid var(--pm-border, #e5e7eb);
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    color: var(--pm-text, #111827);
    display: none;
    align-items: center; justify-content: center;
    cursor: pointer;
    transition: background .12s ease, transform .12s ease;
}
.sidebar-fab:hover { background: var(--pm-bg-soft, #f9fafb); transform: translateY(-1px); }
.app-shell.sidebar-collapsed .sidebar-fab { display: inline-flex; }

/* ── Sidebar — workspace block + nav ───────────────────────────────────── */

.workspace-block {
    padding: 16px;
    border-bottom: 1px solid var(--pm-sidebar-border);
}
.workspace-pill {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    border-radius: var(--pm-radius);
    border: 1px solid var(--pm-border);
    background: #fff;
    cursor: pointer;
    transition: background .15s ease;
}
.workspace-pill:hover { background: var(--pm-bg-soft); }
.workspace-icon {
    width: 32px; height: 32px;
    border-radius: 7px;
    background: linear-gradient(135deg, #7B68EE, #5b46c2);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
    flex-shrink: 0;
}
.workspace-meta { line-height: 1.25; min-width: 0; }
.workspace-meta .name { font-weight: 600; font-size: 14px; color: var(--pm-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace-meta .plan { font-size: 12px; color: var(--pm-text-muted); }

.sidebar-section-label {
    padding: 18px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--pm-text-soft);
    font-weight: 600;
}

.sidebar-nav { list-style: none; padding: 4px 0; margin: 0; flex: 1; overflow-y: auto; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 16px;
    margin: 2px 8px;
    border-radius: var(--pm-radius);
    color: var(--pm-sidebar-text);
    font-size: 14px;
    font-weight: 500;
    transition: background .12s ease, color .12s ease;
}
.sidebar-nav a:hover { background: var(--pm-sidebar-hover); color: var(--pm-text); }
.sidebar-nav a.active {
    background: var(--pm-sidebar-active-bg);
    color: var(--pm-sidebar-active-text);
    font-weight: 600;
}
.sidebar-nav a .icon {
    width: 20px;
    font-size: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    opacity: .95;
    transition: transform .12s ease;
}
.sidebar-nav a:hover .icon  { transform: scale(1.08); }
.sidebar-nav a.active .icon { opacity: 1; }

/* Per-module icon colors — only applied while NOT active (active is purple-themed) */
.sidebar-nav a:not(.active) [data-nav="dashboard"] .icon,
.sidebar-nav a:not(.active)[data-nav="dashboard"] .icon  { color: #6366f1; } /* indigo */
.sidebar-nav a:not(.active)[data-nav="clients"] .icon    { color: #ec4899; } /* pink */
.sidebar-nav a:not(.active)[data-nav="projects"] .icon   { color: #7B68EE; } /* purple */
.sidebar-nav a:not(.active)[data-nav="tasks"] .icon      { color: #10b981; } /* green */
.sidebar-nav a:not(.active)[data-nav="social.kanban"]   .icon { color: #f97316; } /* orange */
.sidebar-nav a:not(.active)[data-nav="social.calendar"] .icon { color: #14b8a6; } /* teal */
.sidebar-nav a:not(.active)[data-nav="social.list"]     .icon { color: #64748b; } /* slate */
.sidebar-nav a:not(.active)[data-nav="reports"] .icon    { color: #3b82f6; } /* blue */
.sidebar-nav a:not(.active)[data-nav="users"] .icon      { color: #f59e0b; } /* amber */

.sidebar-sub {
    list-style: none; margin: 0; padding: 0 0 0 32px;
}
.sidebar-sub a { padding: 7px 16px; font-size: 13.5px; }

/* ── Collapsible nav group (e.g. Settings) ─────────────────────────────
 * The toggle button mimics a top-level nav-link visually. The chevron
 * rotates to indicate open/closed. Sub-items are indented and revealed
 * only when .is-open is set on the group.
 * ───────────────────────────────────────────────────────────────────── */
.sidebar-group { list-style: none; }
.sidebar-group-toggle {
    display: flex; align-items: center; gap: 12px;
    width: calc(100% - 16px);
    padding: 9px 16px;
    margin: 2px 8px;
    /* Strip every native button affordance — the row should look exactly
       like the <a> nav links above. */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 0;
    outline: 0;
    background: transparent;
    border-radius: var(--pm-radius);
    color: var(--pm-sidebar-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background .12s ease, color .12s ease;
}
.sidebar-group-toggle:hover { background: var(--pm-sidebar-hover); color: var(--pm-text); }
.sidebar-group-toggle:focus { outline: 0; box-shadow: none; }
/* Subtle ring for keyboard users, but no rectangle on plain mouse clicks. */
.sidebar-group-toggle:focus-visible {
    outline: 2px solid rgba(123,104,238,.45);
    outline-offset: -2px;
}
.sidebar-group-toggle .icon {
    width: 20px; font-size: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #64748b;
    opacity: .95;
}
.sidebar-group-toggle .label { flex: 1; }
.sidebar-group-toggle .group-chev {
    font-size: 11px;
    color: var(--pm-text-muted, #9ca3af);
    transition: transform .18s ease;
}
.sidebar-group.is-open .sidebar-group-toggle .group-chev { transform: rotate(90deg); }

.sidebar-subnav {
    list-style: none;
    margin: 0;
    padding: 0;
    /* Hidden by default; .is-open on the parent flips display.
       (max-height + transition fought with a Bootstrap reset rule that's
       inaccessible via CORS — display toggling is the robust fix.) */
    display: none;
}
.sidebar-group.is-open .sidebar-subnav { display: block; padding: 2px 0 6px 0; }
/* Belt-and-braces — kill the <li> bullet markers that leak through some
   user-agent stylesheets even when the parent <ul> has list-style: none. */
.sidebar-subnav li { list-style: none; padding: 0; margin: 0; }
.sidebar-subnav li::marker { content: ''; color: transparent; }
.sidebar-subnav a {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 16px 7px 36px;     /* deeper indent for sub-items */
    margin: 1px 8px;
    border-radius: var(--pm-radius);
    color: var(--pm-sidebar-text);
    font-size: 13px;
    font-weight: 500;
    transition: background .12s ease, color .12s ease;
}
.sidebar-subnav a:hover { background: var(--pm-sidebar-hover); color: var(--pm-text); }
/* Category section header used inside dynamic sub-nav trees (e.g. Tools
   Directory groups its Sub-category links under each Category heading).
   Plain <li> with this class — no link, no hover, just a label. */
.sidebar-subnav-section {
    padding: 10px 16px 4px 20px;
    font-size: 11px;
    font-weight: 700;
    color: var(--pm-text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: .04em;
    pointer-events: none;
    list-style: none;
}
.sidebar-subnav-section::marker { content: ''; color: transparent; }
.sidebar-subnav a.active {
    background: var(--pm-sidebar-active-bg);
    color: var(--pm-sidebar-active-text);
    font-weight: 600;
}
.sidebar-subnav a .icon {
    width: 18px; font-size: 14px;
    display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-subnav a:not(.active)[data-nav="users"] .icon         { color: #f59e0b; } /* amber */
.sidebar-subnav a:not(.active)[data-nav="settings.mail"] .icon { color: #0ea5e9; } /* sky */
.sidebar-subnav a:not(.active)[data-nav="settings.ai"] .icon   { color: #a855f7; } /* fuchsia */
.sidebar-subnav a:not(.active)[data-nav="settings.social"] .icon { color: #ec4899; } /* pink */
.sidebar-subnav a:not(.active)[data-nav="settings.permissions"] .icon { color: #ef4444; } /* red */

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--pm-sidebar-border);
    font-size: 12px;
    color: var(--pm-text-muted);
}
.sidebar-footer .help-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    border-radius: var(--pm-radius);
    cursor: pointer;
}
.sidebar-footer .help-row:hover { background: var(--pm-bg-soft); color: var(--pm-text); }

/* ── Top bar (navbar) ──────────────────────────────────────────────────── */

.app-navbar {
    background: #fff;
    border-bottom: 1px solid var(--pm-border);
    height: 60px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 1020;
}
.breadcrumb-trail {
    display: flex; align-items: center; gap: 8px;
    color: var(--pm-text-muted);
    font-size: 14px;
}
.breadcrumb-trail .crumb { color: var(--pm-text-muted); }
.breadcrumb-trail .crumb:last-child { color: var(--pm-text); font-weight: 600; }
.breadcrumb-trail .sep { color: var(--pm-text-soft); }

.navbar-search {
    flex: 1;
    max-width: 440px;
    margin-left: 14px;
}
.navbar-search input {
    width: 100%;
    height: 38px;
    padding: 0 12px 0 36px;
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius);
    background: var(--pm-bg-soft) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237c828d' stroke-width='2'><circle cx='11' cy='11' r='7'/><path d='m21 21-4.35-4.35'/></svg>") 11px center / 16px no-repeat;
    font-size: 14px;
    outline: none;
}
.navbar-search input:focus {
    border-color: var(--pm-primary);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(123,104,238,0.12);
}

.navbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.navbar-icon-btn {
    border: none;
    background: transparent;
    width: 38px; height: 38px;
    border-radius: var(--pm-radius);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--pm-text-muted);
    font-size: 18px;
    position: relative;
    cursor: pointer;
}
.navbar-icon-btn:hover { background: var(--pm-bg-deep); color: var(--pm-text); }

/* Persistent "Download App" link in the navbar — wider than the
   icon-only siblings (it has a label) and brand-tinted so it reads
   as a CTA without being loud. Hidden by default until the JS in
   admin.blade.php confirms a release is published. */
.navbar-download-btn {
    width: auto !important;
    height: 32px !important;
    padding: 0 12px !important;
    background: var(--pm-primary-soft, #eef0ff) !important;
    color: var(--pm-primary, #5b5fc7) !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    text-decoration: none;
    transition: background 0.12s ease;
}
.navbar-download-btn:hover { background: var(--pm-primary, #5b5fc7) !important; color: #fff !important; }
.navbar-icon-btn .badge-dot {
    position: absolute; top: 8px; right: 8px;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--pm-danger);
    border: 2px solid #fff;
    display: none;
}
.navbar-icon-btn.has-unread .badge-dot { display: block; }

.navbar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 10px 5px 5px;
    border-radius: var(--pm-radius);
    cursor: pointer;
}
.navbar-user:hover { background: var(--pm-bg-deep); }
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7B68EE, #5b46c2);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 12px;
    flex-shrink: 0;
}
.navbar-user .user-meta { line-height: 1.2; }
.navbar-user .user-meta .name { font-weight: 600; font-size: 13px; }
.navbar-user .user-meta .email { font-size: 11px; color: var(--pm-text-muted); }

/* ── Content ───────────────────────────────────────────────────────────── */

.app-content { padding: 26px 28px; flex: 1; }
@media (max-width: 575.98px) { .app-content { padding: 16px; } }

.page-header {
    display: flex; flex-wrap: wrap;
    align-items: center; justify-content: space-between;
    gap: 14px;
    margin-bottom: 22px;
}
.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: var(--pm-text);
    letter-spacing: -0.01em;
}
.page-header .subtitle {
    color: var(--pm-text-muted);
    font-size: 14px;
    margin-top: 4px;
}

/* ── Cards ─────────────────────────────────────────────────────────────── */

.card {
    background: var(--pm-card);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    box-shadow: var(--pm-shadow);
}
.card-header {
    background: linear-gradient(180deg, #fafaff 0%, #ffffff 100%);
    border-bottom: 1px solid var(--pm-border);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 14px;
    color: var(--pm-text);
}
.card-header .bi {
    color: var(--pm-primary);
}

/* Page header with a small primary-color accent */
.page-header h1 {
    position: relative;
    padding-left: 14px;
}
.page-header h1::before {
    content: '';
    position: absolute;
    left: 0; top: 4px; bottom: 4px;
    width: 4px;
    border-radius: 4px;
    background: var(--pm-primary);
}
.card-body { padding: 22px; }

.stat-card {
    background: var(--pm-card);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    padding: 22px;
    box-shadow: var(--pm-shadow);
    transition: box-shadow .15s ease, transform .15s ease;
}
.stat-card:hover { box-shadow: var(--pm-shadow-lg); }
.stat-card .row-top {
    display: flex; align-items: center; justify-content: space-between;
}
.stat-card .label {
    font-size: 12px;
    color: var(--pm-text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
}
.stat-card .value {
    font-size: 30px;
    font-weight: 700;
    color: var(--pm-text);
    margin-top: 8px;
    letter-spacing: -0.02em;
}
.stat-card .delta {
    font-size: 12px;
    color: var(--pm-text-muted);
    margin-top: 4px;
}
.stat-card .delta.up    { color: var(--pm-success); }
.stat-card .delta.down  { color: var(--pm-danger); }
.stat-card .icon-bubble {
    width: 42px; height: 42px;
    border-radius: var(--pm-radius);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--pm-primary-soft);
    color: var(--pm-primary);
    font-size: 18px;
}

/* ── Stat card tones ── colored top accent + matching icon bubble */
.stat-card { position: relative; overflow: hidden; }
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--pm-primary);
    opacity: .85;
}
.stat-card.tone-success::before { background: var(--pm-success); }
.stat-card.tone-info::before    { background: var(--pm-info); }
.stat-card.tone-warning::before { background: var(--pm-warning); }
.stat-card.tone-danger::before  { background: var(--pm-danger); }
.stat-card.tone-pink::before    { background: #ec4899; }
.stat-card.tone-orange::before  { background: #f97316; }
.stat-card.tone-teal::before    { background: #14b8a6; }

.stat-card.tone-success .icon-bubble { background: var(--pm-success-soft); color: #137a48; }
.stat-card.tone-info    .icon-bubble { background: var(--pm-info-soft);    color: #0c87b0; }
.stat-card.tone-warning .icon-bubble { background: var(--pm-warning-soft); color: #946100; }
.stat-card.tone-danger  .icon-bubble { background: var(--pm-danger-soft);  color: #b8232f; }
.stat-card.tone-pink    .icon-bubble { background: #fce7f3;                color: #be185d; }
.stat-card.tone-orange  .icon-bubble { background: #ffedd5;                color: #c2410c; }
.stat-card.tone-teal    .icon-bubble { background: #ccfbf1;                color: #0f766e; }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn { font-weight: 500; font-size: 14px; padding: 9px 16px; border-radius: var(--pm-radius); }
.btn-primary {
    background: var(--pm-primary);
    border-color: var(--pm-primary);
    box-shadow: 0 1px 2px rgba(123,104,238,0.25);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background: var(--pm-primary-hover) !important;
    border-color: var(--pm-primary-hover) !important;
}
.btn-outline-secondary {
    border-color: var(--pm-border-strong);
    color: var(--pm-text);
    background: #fff;
}
.btn-outline-secondary:hover {
    background: var(--pm-bg-soft);
    color: var(--pm-text);
    border-color: var(--pm-border-strong);
}
.btn-ghost {
    border: 1px solid transparent;
    background: transparent;
    color: var(--pm-text);
}
.btn-ghost:hover { background: var(--pm-bg-deep); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Row-action icons — colored on hover for visual feedback */
.row-actions .btn-ghost { color: var(--pm-text-muted); }
.row-actions .btn-ghost:hover             { color: var(--pm-primary); background: var(--pm-primary-soft); }
.row-actions .btn-ghost.text-danger:hover { color: var(--pm-danger);  background: var(--pm-danger-soft); }

/* ── Tables ────────────────────────────────────────────────────────────── */

.table { margin-bottom: 0; color: var(--pm-text); }
.table thead th {
    background: linear-gradient(180deg, #f5f3ff 0%, #fafaff 100%);
    color: #5b46c2;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
    border-bottom: 1px solid #e0d8f5;
    padding: 12px 16px;
}
.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--pm-border);
    vertical-align: middle;
    font-size: 14px;
    background: #ffffff;            /* explicit so zebra has a base */
}
/* Zebra striping — even rows get a faint purple wash; bulk-add rows opt out */
.table tbody tr:nth-child(even):not(.bulk-row) td { background: #fafaff; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td      { background: #f3f0ff; }   /* stronger than zebra so hover wins */
.table tbody td .row-actions {
    display: flex; gap: 6px;
}

/* ── Forms ─────────────────────────────────────────────────────────────── */

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--pm-text);
    margin-bottom: 6px;
}
.form-control, .form-select {
    border: 1px solid var(--pm-border-strong);
    border-radius: var(--pm-radius);
    font-size: 14px;
    padding: 9px 14px;
    background: #fff;
    line-height: 1.5;
}
.form-control:focus, .form-select:focus {
    border-color: var(--pm-primary);
    box-shadow: 0 0 0 3px rgba(123,104,238,0.15);
}

/* ── Pills (status badges) ─────────────────────────────────────────────── */

.pill {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #e7eaef;
    color: #44546f;
    line-height: 1.55;
}
.pill.success  { background: var(--pm-success-soft); color: #137a48; }
.pill.warning  { background: var(--pm-warning-soft); color: #946100; }
.pill.danger   { background: var(--pm-danger-soft);  color: #b8232f; }
.pill.info     { background: var(--pm-info-soft);    color: #0c87b0; }
.pill.primary  { background: var(--pm-primary-soft); color: #5b46c2; }
.pill.neutral  { background: #eef0f3; color: #44546f; }

/* ── Empty states ──────────────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 44px 24px;
    color: var(--pm-text-muted);
    font-size: 14px;
}
.empty-state .icon {
    font-size: 34px;
    opacity: .35;
    margin-bottom: 8px;
}

/* ── Kanban ────────────────────────────────────────────────────────────── */

.kanban-board {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
}
.kanban-column {
    background: var(--pm-bg-deep);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    width: 304px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 220px);
}
.kanban-column-header {
    padding: 12px 16px;
    border-bottom: 2px solid var(--pm-border);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--pm-text-muted);
    display: flex; align-items: center; justify-content: space-between;
}
.kanban-column-header .count {
    background: #fff;
    border: 1px solid var(--pm-border);
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 11px;
    color: var(--pm-text-muted);
}
.kanban-column-header .add-card {
    background: transparent;
    border: 0;
    color: var(--pm-text-muted);
    padding: 2px 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: background .12s, color .12s;
}
.kanban-column-header .add-card:hover {
    background: var(--pm-primary-soft);
    color: var(--pm-primary);
}
.kanban-column-header .col-tools {
    display: flex; align-items: center; gap: 4px;
}
.kanban-empty-hint {
    border: 1.5px dashed var(--pm-border-strong);
    border-radius: var(--pm-radius);
    padding: 14px 10px;
    font-size: 12px;
    text-align: center;
    color: var(--pm-text-soft);
    background: rgba(255,255,255,.5);
    margin: 4px 2px;
}

/* Color the column accent strip to match the workflow stage */
.kanban-column[data-status="planning"]       .kanban-column-header { border-bottom-color: #94a3b8; }
.kanban-column[data-status="content_ready"]  .kanban-column-header { border-bottom-color: #06b6d4; }
.kanban-column[data-status="creative_ready"] .kanban-column-header { border-bottom-color: #7B68EE; }
.kanban-column[data-status="review"]         .kanban-column-header { border-bottom-color: #f59e0b; }
.kanban-column[data-status="scheduled"]      .kanban-column-header { border-bottom-color: #3b82f6; }
.kanban-column[data-status="posted"]         .kanban-column-header { border-bottom-color: var(--pm-success); }
.kanban-cards {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 60px;
}
.kanban-card {
    background: #fff;
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius);
    padding: 12px 14px;
    margin-bottom: 8px;
    box-shadow: var(--pm-shadow);
    cursor: grab;
    font-size: 14px;
    transition: box-shadow .12s ease, transform .12s ease;
}
.kanban-card:hover { box-shadow: var(--pm-shadow-lg); }
.kanban-card:active { cursor: grabbing; }
.kanban-card .title { font-weight: 600; margin-bottom: 6px; }
.kanban-card .meta {
    font-size: 12px;
    color: var(--pm-text-muted);
    display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.kanban-card.is-ghost { opacity: .35; }
.kanban-card.is-chosen { box-shadow: 0 6px 20px rgba(123,104,238,0.30); }
.kanban-card .proj-pill {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--pm-bg-soft);
    border: 1px solid var(--pm-border);
    color: var(--pm-text-muted);
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
}
.kanban-card .platform-ig { color: #d6249f; }
.kanban-card .platform-fb { color: #1877f2; }
.kanban-card .platform-li { color: #0a66c2; }
.kanban-card .platform-yt { color: #ff0000; }

/* Per-column subtle card stripe so visual scanning is fast */
.kanban-column[data-status="planning"]       .kanban-card { border-left: 3px solid #94a3b8; }
.kanban-column[data-status="content_ready"]  .kanban-card { border-left: 3px solid #06b6d4; }
.kanban-column[data-status="creative_ready"] .kanban-card { border-left: 3px solid #7B68EE; }
.kanban-column[data-status="review"]         .kanban-card { border-left: 3px solid #f59e0b; }
.kanban-column[data-status="scheduled"]      .kanban-card { border-left: 3px solid #3b82f6; }
.kanban-column[data-status="posted"]         .kanban-card { border-left: 3px solid var(--pm-success); }

/* ── Calendar ──────────────────────────────────────────────────────────── */

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--pm-border);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    overflow: hidden;
}
.cal-dow {
    background: var(--pm-bg-soft);
    text-align: center;
    padding: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--pm-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.cal-day {
    background: #fff;
    min-height: 110px;
    padding: 8px 10px;
    font-size: 13px;
    cursor: pointer;
    transition: background .12s ease;
    position: relative;
}
.cal-day:hover { background: var(--pm-primary-soft); }
.cal-day:hover .cal-add-hint { opacity: 1; }
.cal-day.dim { background: var(--pm-bg-soft); color: #b3b8c2; }
.cal-day.dim:hover { background: var(--pm-primary-soft); }
.cal-day.today {
    box-shadow: inset 0 0 0 2px var(--pm-primary);
    background: var(--pm-primary-soft);
}
.cal-day.today .num {
    color: var(--pm-primary);
    background: var(--pm-primary);
    color: #fff;
    width: 22px; height: 22px;
    border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px;
    margin-bottom: 4px;
}
.cal-day .num { font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.cal-day .cal-add-hint {
    position: absolute; top: 8px; right: 8px;
    font-size: 13px;
    color: var(--pm-primary);
    opacity: 0;
    transition: opacity .12s ease;
    pointer-events: none;
}
.cal-pill {
    display: flex; align-items: center; gap: 5px;
    padding: 3px 8px;
    margin-top: 3px;
    background: var(--pm-primary-soft);
    color: var(--pm-sidebar-active-text);
    border-radius: 4px;
    font-size: 12px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    border-left: 3px solid var(--pm-primary);
    cursor: pointer;
    transition: background .12s, transform .12s;
}
.cal-pill:hover { background: #ede8ff; transform: translateX(1px); }
.cal-pill .pf-dot {
    flex-shrink: 0;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--pm-primary);
}
.cal-pill .pf-dot.pf-instagram { background: #d6249f; }
.cal-pill .pf-dot.pf-facebook  { background: #1877f2; }
.cal-pill .pf-dot.pf-linkedin  { background: #0a66c2; }
.cal-pill .pf-dot.pf-youtube   { background: #ff0000; }
.cal-pill .pill-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.cal-pill[data-status="planning"]       { border-left-color: #94a3b8; background: #f1f5f9; color: #475569; }
.cal-pill[data-status="content_ready"]  { border-left-color: #06b6d4; background: #e0f7ff; color: #0369a1; }
.cal-pill[data-status="creative_ready"] { border-left-color: #7B68EE; background: #f3f0ff; color: #5b46c2; }
.cal-pill[data-status="review"]         { border-left-color: #f59e0b; background: #fff3da; color: #92561a; }
.cal-pill[data-status="scheduled"]      { border-left-color: #3b82f6; background: #dbeafe; color: #1e40af; }
.cal-pill[data-status="posted"]         { border-left-color: var(--pm-success); background: var(--pm-success-soft); color: #186b3a; }

/* Platform multi-select chips (modal + planner) */
.platform-cb-group { font-size: 13px; }
.platform-chip-cb {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    border: 1.5px solid var(--pm-border-strong);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    user-select: none;
    transition: all .15s ease;
}
.platform-chip-cb input[type="checkbox"] {
    margin: 0;
    accent-color: var(--pm-primary);
}
.platform-chip-cb:hover { border-color: var(--pm-primary); background: var(--pm-primary-soft); }
.platform-chip-cb:has(input:checked) {
    background: var(--pm-primary-soft);
    border-color: var(--pm-primary);
    color: var(--pm-primary);
    font-weight: 500;
}
.platform-chip-cb[data-pf="instagram"]:has(input:checked) { background:#fde7f3; border-color:#d6249f; color:#a01471; }
.platform-chip-cb[data-pf="facebook"]:has(input:checked)  { background:#dbeafe; border-color:#1877f2; color:#0c52a8; }
.platform-chip-cb[data-pf="linkedin"]:has(input:checked)  { background:#cfe5f7; border-color:#0a66c2; color:#064a8c; }
.platform-chip-cb[data-pf="youtube"]:has(input:checked)   { background:#ffe5e5; border-color:#ff0000; color:#aa0000; }

/* Inline platform-icon row used on cards / list rows */
.pf-row { display: inline-flex; gap: 4px; align-items: center; }
.pf-row .pf-icon {
    width: 18px; height: 18px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 10px;
    background: var(--pm-bg-soft);
    color: var(--pm-text-muted);
}
.pf-row .pf-icon.pf-instagram { background:#fde7f3; color:#d6249f; }
.pf-row .pf-icon.pf-facebook  { background:#dbeafe; color:#1877f2; }
.pf-row .pf-icon.pf-linkedin  { background:#cfe5f7; color:#0a66c2; }
.pf-row .pf-icon.pf-youtube   { background:#ffe5e5; color:#ff0000; }

/* Calendar legend strip */
.cal-legend {
    display: flex; flex-wrap: wrap; gap: 12px;
    padding: 10px 4px 0;
    font-size: 11.5px;
    color: var(--pm-text-muted);
}
.cal-legend .item { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .swatch {
    width: 12px; height: 12px; border-radius: 3px;
    display: inline-block;
}

/* ── Login ─────────────────────────────────────────────────────────────── */

.auth-shell {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(ellipse at top, #f3f0ff 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, #e0f7ff 0%, transparent 50%),
        var(--pm-bg-deep);
    padding: 20px;
}
.auth-card {
    background: #fff;
    border: 1px solid var(--pm-border);
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(15,23,42,0.06);
    padding: 42px 36px;
    width: 100%;
    max-width: 440px;
}
.auth-card .brand-mark {
    width: 52px; height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, #7B68EE, #5b46c2);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 20px;
    margin: 0 auto 18px;
}
.auth-card h1 {
    font-size: 26px; font-weight: 700; margin: 0 0 6px;
    text-align: center;
    letter-spacing: -0.01em;
}
.auth-card .sub {
    text-align: center; color: var(--pm-text-muted);
    font-size: 14px; margin-bottom: 28px;
}

/* ── Footer ────────────────────────────────────────────────────────────── */

.app-footer {
    border-top: 1px solid var(--pm-border);
    background: #fff;
    padding: 12px 28px;
    color: var(--pm-text-muted);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap; gap: 10px;
}

/* ── Utilities ─────────────────────────────────────────────────────────── */

.spinner-mini {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(123,104,238,0.25);
    border-top-color: var(--pm-primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal tweaks */
.modal-content { border: 1px solid var(--pm-border); border-radius: var(--pm-radius-lg); }
.modal-header { border-bottom: 1px solid var(--pm-border); padding: 16px 22px; }
.modal-header .modal-title { font-size: 17px; font-weight: 600; }
.modal-body { padding: 22px; }
.modal-footer { border-top: 1px solid var(--pm-border); padding: 14px 22px; }

/* Toast */
.toast-stack {
    position: fixed; bottom: 24px; right: 24px;
    z-index: 1080;
    display: flex; flex-direction: column; gap: 10px;
}
.toast-item {
    background: #fff;
    border: 1px solid var(--pm-border);
    border-left: 4px solid var(--pm-primary);
    border-radius: var(--pm-radius);
    box-shadow: var(--pm-shadow-lg);
    padding: 12px 16px;
    font-size: 14px;
    min-width: 260px;
    max-width: 380px;
    animation: toast-in .25s ease;
}
.toast-item.success { border-left-color: var(--pm-success); }
.toast-item.error   { border-left-color: var(--pm-danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Chat: navbar/sidebar badges + bell dropdown ─────────────────────── */
.navbar-icon-btn .badge-count {
    position: absolute; top: 4px; right: 4px;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 10px;
    background: var(--pm-danger); color: #fff;
    font-size: 10px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1;
}
.sidebar-nav .sidebar-badge {
    margin-left: auto;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 10px;
    background: var(--pm-danger); color: #fff;
    font-size: 10px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1;
}
.notifications-dropdown {
    position: absolute; right: 0; top: calc(100% + 6px);
    background: #fff;
    border: 1px solid var(--pm-border, #e5e7eb);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,.08);
    width: 340px; max-height: 420px; overflow-y: auto;
    z-index: 1050;
}
.notifications-dropdown .notif-item {
    display: block;
    padding: 10px 14px;
    border-bottom: 1px solid var(--pm-border, #f1f1f4);
    color: var(--pm-text, #1a1a23);
    text-decoration: none;
}
.notifications-dropdown .notif-item:hover { background: var(--pm-bg-deep, #f7f7fa); }
.notifications-dropdown .notif-title { font-size: 13px; font-weight: 600; }
.notifications-dropdown .notif-preview { font-size: 12px; color: var(--pm-text-muted, #6b7280); margin-top: 2px; }
.notifications-dropdown .notif-foot {
    display: block; text-align: center;
    padding: 9px; font-size: 12px;
    color: var(--pm-primary, #7B68EE); text-decoration: none;
    border-top: 1px solid var(--pm-border, #f1f1f4);
}
.notifications-dropdown .notif-foot:hover { background: var(--pm-primary-soft, #f3f0ff); }

/* ── Chat page ───────────────────────────────────────────────────────── */
.chat-shell {
    display: grid; grid-template-columns: 320px 1fr;
    height: calc(100vh - 140px); min-height: 480px;
    border: 1px solid var(--pm-border, #e5e7eb);
    border-radius: 12px; background: #fff; overflow: hidden;
}
.chat-list {
    border-right: 1px solid var(--pm-border, #e5e7eb);
    display: flex; flex-direction: column;
}
.chat-list-head {
    padding: 12px 14px;
    border-bottom: 1px solid var(--pm-border, #e5e7eb);
    display: flex; align-items: center; gap: 8px;
}
.chat-list-head .form-control { flex: 1; }
.chat-list-items { overflow-y: auto; flex: 1; }
.chat-list-item {
    padding: 10px 14px; cursor: pointer;
    border-bottom: 1px solid var(--pm-border, #f1f1f4);
    display: flex; align-items: center; gap: 10px;
}
.chat-list-item:hover { background: var(--pm-bg-deep, #f7f7fa); }
.chat-list-item.is-active { background: var(--pm-primary-soft, #f3f0ff); }
.chat-list-item .ci-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--pm-primary, #7B68EE); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.chat-list-item .ci-meta { flex: 1; min-width: 0; }
.chat-list-item .ci-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list-item .ci-preview { font-size: 12px; color: var(--pm-text-muted, #6b7280); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list-item .ci-unread {
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 10px; background: var(--pm-danger); color: #fff;
    font-size: 10px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1;
}

.chat-pane { display: flex; flex-direction: column; min-width: 0; }
.chat-pane-head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--pm-border, #e5e7eb);
    font-weight: 600;
}
.chat-stream { flex: 1; overflow-y: auto; padding: 14px 16px; background: #fafbfd; }
.chat-bubble { display: flex; flex-direction: column; max-width: 70%; margin-bottom: 12px; }
.chat-bubble .cb-meta { font-size: 11px; color: var(--pm-text-muted, #6b7280); margin-bottom: 3px; }
.chat-bubble .cb-body {
    background: #fff; border: 1px solid var(--pm-border, #e5e7eb);
    border-radius: 12px; padding: 8px 12px; font-size: 13.5px;
    word-wrap: break-word; white-space: pre-wrap;
}
.chat-bubble.is-mine { align-self: flex-end; }
.chat-bubble.is-mine .cb-body { background: var(--pm-primary-soft, #f3f0ff); border-color: var(--pm-primary-soft, #f3f0ff); }
.chat-bubble .cb-attachment {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 6px; padding: 6px 10px;
    background: #fff; border: 1px solid var(--pm-border, #e5e7eb);
    border-radius: 8px; font-size: 12px; text-decoration: none;
    color: var(--pm-text, #1a1a23);
}
.chat-bubble .cb-attachment:hover { background: var(--pm-bg-deep, #f7f7fa); }

.chat-composer {
    border-top: 1px solid var(--pm-border, #e5e7eb);
    padding: 10px 12px;
    display: flex; gap: 8px; align-items: end;
}
.chat-composer textarea {
    flex: 1; resize: none; min-height: 38px; max-height: 140px;
    border: 1px solid var(--pm-border, #e5e7eb); border-radius: 8px;
    padding: 8px 12px; font-size: 13.5px;
}
.chat-composer .composer-actions { display: flex; gap: 6px; align-items: center; }
.chat-composer-attach-list { padding: 0 12px; font-size: 12px; color: var(--pm-text-muted, #6b7280); }
.chat-composer-attach-list .pending {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--pm-bg-deep, #f7f7fa);
    border: 1px solid var(--pm-border, #e5e7eb);
    border-radius: 6px; padding: 2px 6px; margin: 4px 4px 0 0;
}
.chat-empty {
    flex: 1; display: flex; align-items: center; justify-content: center;
    color: var(--pm-text-muted, #6b7280); font-size: 13px;
}

/* ──────────────────────────────────────────────────────────────────────
   Floating chat widget (tawk.to-style)
   ────────────────────────────────────────────────────────────────────── */
#chat-widget { position: fixed; bottom: 22px; right: 22px; z-index: 1050; font-family: 'Inter', system-ui, sans-serif; }

/* Bubble (FAB) */
.cw-fab {
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--pm-primary, #7B68EE); color: #fff;
    border: none; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 26px;
    box-shadow: 0 10px 28px rgba(123,104,238,.40);
    transition: transform .15s ease, box-shadow .15s ease;
    position: relative;
}
.cw-fab:hover { transform: scale(1.06); }
.cw-fab.is-open { box-shadow: 0 4px 14px rgba(123,104,238,.30); }
.cw-fab-count {
    position: absolute; top: -2px; right: -2px;
    min-width: 22px; height: 22px; padding: 0 6px;
    border-radius: 11px;
    background: var(--pm-danger, #ef4444); color: #fff;
    font-size: 11px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1;
    border: 2px solid #fff;
}

/* Popup panel */
.cw-panel {
    position: absolute; bottom: 78px; right: 0;
    width: 380px; height: 620px; max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0,0,0,.18), 0 4px 12px rgba(0,0,0,.06);
    overflow: hidden;
    display: flex; flex-direction: column;
    animation: cw-pop-in .22s cubic-bezier(.16,1,.3,1);
}
@keyframes cw-pop-in {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 480px) {
    #chat-widget { right: 14px; bottom: 14px; }
    .cw-panel { width: calc(100vw - 28px); right: -6px; }
}

/* Header (two flavors: hero on Home, compact elsewhere) */
.cw-header {
    background: var(--pm-primary, #7B68EE);
    color: #fff;
    flex-shrink: 0;
    position: relative;
}
.cw-header-compact {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 14px;
    min-height: 52px;
}
.cw-header-compact .cw-h-title {
    flex: 1; font-weight: 600; font-size: 15px; color: #fff;
    display: flex; align-items: center; gap: 8px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cw-header-hero {
    padding: 24px 22px 30px;
    background: linear-gradient(135deg, var(--pm-primary, #7B68EE), var(--pm-primary-hover, #6c5ce7));
}
.cw-hero-greet {
    color: #fff; font-size: 22px; font-weight: 700;
    line-height: 1.2; margin-bottom: 6px;
}
.cw-hero-sub {
    color: rgba(255,255,255,.85); font-size: 13.5px; line-height: 1.4;
}

.cw-icon-btn {
    background: transparent; border: none; cursor: pointer;
    width: 32px; height: 32px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 16px;
    transition: background .12s ease;
}
.cw-icon-btn:hover { background: rgba(255,255,255,.18); }
.cw-close-x { margin-left: auto; }
.cw-header-hero .cw-close-x {
    position: absolute; top: 14px; right: 14px;
}
.cw-header-hero .cw-mute-btn {
    position: absolute; top: 14px; right: 54px;
}

/* Body */
.cw-body { flex: 1; overflow-y: auto; background: #fff; }
.cw-body-home {
    padding: 0 14px 14px;
    margin-top: -16px; /* overlap the hero gradient slightly */
}
.cw-body-stream { background: #f8f9fc; padding: 12px 12px; }

/* Cards (Home view) */
.cw-card {
    background: #fff;
    border: 1px solid var(--pm-border, #e9eaee);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
    position: relative;
}
.cw-card:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,.08); border-color: var(--pm-primary-soft, #ddd6fe); }
.cw-card-title { font-weight: 700; font-size: 14.5px; color: var(--pm-text, #1a1a23); }
.cw-card-sub   { font-size: 13px; color: var(--pm-text-muted, #6b7280); margin-top: 4px; }
.cw-card-arrow {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    color: var(--pm-primary, #7B68EE); font-size: 22px;
}
.cw-card-action { padding-right: 44px; }
.cw-card-recent .cw-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cw-card-recent .cw-card-body { display: flex; align-items: center; gap: 10px; padding-right: 24px; }

/* Search */
.cw-search-row {
    padding: 10px 12px;
    border-bottom: 1px solid var(--pm-border, #f0f1f4);
    display: flex; align-items: center; gap: 8px;
    color: var(--pm-text-muted, #9ca3af);
    flex-shrink: 0;
}
.cw-search {
    flex: 1; border: none; outline: none;
    font-size: 13.5px; background: transparent;
    color: var(--pm-text, #1a1a23);
}

/* Conversation rows */
.cw-list { padding: 4px 0; }
.cw-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--pm-border, #f4f5f7);
    transition: background .1s ease;
}
.cw-row:hover { background: var(--pm-bg-deep, #f7f7fa); }
.cw-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--pm-primary, #7B68EE); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; flex-shrink: 0;
    position: relative;
}
.cw-avatar-sm { width: 36px; height: 36px; font-size: 12px; }
.cw-group-mark {
    position: absolute; bottom: -2px; right: -2px;
    background: #fff; color: var(--pm-primary, #7B68EE);
    border-radius: 50%; padding: 2px;
    font-size: 9px;
    border: 1.5px solid var(--pm-primary, #7B68EE);
}
.cw-row-meta { flex: 1; min-width: 0; }
.cw-row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cw-row-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--pm-text, #1a1a23); }
.cw-row-time { font-size: 11px; color: var(--pm-text-muted, #9ca3af); flex-shrink: 0; }
.cw-row-bot  { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.cw-row-prev { font-size: 12.5px; color: var(--pm-text-muted, #6b7280); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.cw-row-unread {
    min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 10px; background: var(--pm-danger, #ef4444); color: #fff;
    font-size: 10.5px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1; flex-shrink: 0;
}

/* Empty state */
.cw-empty { padding: 28px 18px; text-align: center; font-size: 13px; color: var(--pm-text-muted, #6b7280); }

/* Thread / messages */
.cw-stream { display: flex; flex-direction: column; gap: 4px; }
.cw-bubble { max-width: 80%; margin-bottom: 8px; display: flex; flex-direction: column; }
.cw-bubble.is-mine { align-self: flex-end; }
.cw-meta { font-size: 10.5px; color: var(--pm-text-muted, #9ca3af); margin-bottom: 3px; padding: 0 4px; }
.cw-bubble.is-mine .cw-meta { text-align: right; }
.cw-body-bubble {
    background: #fff; border-radius: 14px;
    padding: 8px 12px; font-size: 13.5px;
    border: 1px solid var(--pm-border, #e9eaee);
    word-wrap: break-word; white-space: pre-wrap;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.cw-bubble.is-mine .cw-body-bubble {
    background: var(--pm-primary, #7B68EE); color: #fff;
    border-color: var(--pm-primary, #7B68EE);
}
.cw-attach-link {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 6px; padding: 6px 10px;
    background: #fff; border: 1px solid var(--pm-border, #e9eaee);
    border-radius: 10px; font-size: 12px; text-decoration: none;
    color: var(--pm-text, #1a1a23);
}
.cw-attach-link:hover { background: var(--pm-bg-deep, #f7f7fa); }

/* Composer */
.cw-foot { flex-shrink: 0; }
.cw-foot-composer { background: #fff; border-top: 1px solid var(--pm-border, #f0f1f4); }
.cw-attach-list { padding: 6px 12px 0; font-size: 12px; }
.cw-pending {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--pm-bg-deep, #f7f7fa);
    border: 1px solid var(--pm-border, #e9eaee);
    border-radius: 6px; padding: 2px 6px; margin: 4px 4px 0 0;
}
.cw-composer {
    display: flex; align-items: end; gap: 6px;
    padding: 10px 12px;
}
.cw-composer textarea {
    flex: 1; resize: none; min-height: 38px; max-height: 110px;
    border: 1px solid var(--pm-border, #e9eaee); border-radius: 10px;
    padding: 9px 12px; font-size: 13.5px;
    outline: none;
    transition: border-color .12s ease;
    font-family: inherit;
}
.cw-composer textarea:focus { border-color: var(--pm-primary, #7B68EE); }
.cw-composer .cw-icon-btn { color: var(--pm-text-muted, #6b7280); }
.cw-composer .cw-icon-btn:hover { background: var(--pm-bg-deep, #f7f7fa); color: var(--pm-text, #1a1a23); }
.cw-composer .cw-send {
    background: var(--pm-primary, #7B68EE); color: #fff;
    width: 38px; height: 38px;
}
.cw-composer .cw-send:hover { background: var(--pm-primary-hover, #6c5ce7); color: #fff; }
.cw-composer .cw-send:disabled { opacity: .5; cursor: not-allowed; }

/* Tab bar (Home / Messages) */
.cw-tabbar {
    display: flex; border-top: 1px solid var(--pm-border, #f0f1f4);
    background: #fff;
}
.cw-tab {
    flex: 1; border: none; background: transparent; cursor: pointer;
    padding: 12px 8px;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--pm-text-muted, #9ca3af); font-size: 11.5px; font-weight: 600;
    position: relative;
    transition: color .12s ease;
}
.cw-tab i { font-size: 20px; }
.cw-tab:hover { color: var(--pm-text, #1a1a23); }
.cw-tab.is-active { color: var(--pm-primary, #7B68EE); }
.cw-tab.is-active::after {
    content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 3px;
    background: var(--pm-primary, #7B68EE);
    border-radius: 0 0 3px 3px;
}
.cw-tab-dot {
    position: absolute; top: 8px; right: calc(50% - 16px);
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--pm-danger, #ef4444);
    border: 2px solid #fff;
}

/* Foot variants */
.cw-foot-actions {
    display: flex; gap: 8px; padding: 12px;
    background: #fff; border-top: 1px solid var(--pm-border, #f0f1f4);
}
.cw-foot-btn {
    flex: 1; border: 1px solid var(--pm-border, #e9eaee);
    background: #fff; color: var(--pm-text, #1a1a23);
    border-radius: 10px; padding: 9px 10px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    transition: background .12s ease;
}
.cw-foot-btn:hover { background: var(--pm-bg-deep, #f7f7fa); }
.cw-foot-btn.primary {
    background: var(--pm-primary, #7B68EE); color: #fff;
    border-color: var(--pm-primary, #7B68EE);
}
.cw-foot-btn.primary:hover { background: var(--pm-primary-hover, #6c5ce7); }

/* Group form */
.cw-form { padding: 14px 16px; }
.cw-label { font-size: 12px; font-weight: 600; color: var(--pm-text-muted, #6b7280); display: block; margin-bottom: 4px; }
.cw-input {
    width: 100%; border: 1px solid var(--pm-border, #e9eaee); border-radius: 8px;
    padding: 8px 12px; font-size: 13.5px; outline: none;
    transition: border-color .12s ease;
}
.cw-input:focus { border-color: var(--pm-primary, #7B68EE); }
.cw-checkbox-list {
    border: 1px solid var(--pm-border, #e9eaee); border-radius: 8px;
    padding: 6px 10px; max-height: 280px; overflow-y: auto;
}
.cw-check { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; cursor: pointer; }
.cw-check input { margin-right: 4px; }
