/* InvestorsTree Invitations Admin CSS - Sprint 8 Final Locked */

:root {
    --admin-bg: #f8fafc;
    --admin-sidebar-bg: #0f172a;
    --admin-sidebar-text: #94a3b8;
    --admin-sidebar-active-text: #ffffff;
    --admin-sidebar-active-bg: #1e293b;
    --admin-gold: #c5a059;
    --admin-gold-hover: #b08d4b;
    --admin-gold-light: #fef3c7;
    --admin-text-main: #1e293b;
    --admin-text-muted: #64748b;
    --admin-card-bg: #ffffff;
    --admin-border: #e2e8f0;
    
    /* Typography Tokens */
    --font-body: 13px;
    --font-table: 12px;
    --font-label: 11px;
    --font-meta: 11px;
    --font-input: 13px;
    --font-page-title: 18px;
    --font-section-title: 14px;
    --font-card-title: 14px;
    --font-kpi-large: 24px;
    --font-button: 12px;
    --font-badge: 11px;
    --font-nav: 12px;

    /* Spacing Tokens */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
}

body {
    background-color: var(--admin-bg);
    color: var(--admin-text-main);
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: var(--font-body);
    margin: 0;
    padding: 0;
}

/* Layout Wrapper */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 220px;
    background-color: var(--admin-sidebar-bg);
    color: var(--admin-sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid var(--admin-border);
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 100;
}

.sidebar-header {
    height: 56px;
    padding: 0 var(--space-4);
    display: flex;
    align-items: center;
    border-bottom: 1px solid #1e293b;
    white-space: nowrap;
    overflow: hidden;
    box-sizing: border-box;
}

.sidebar-brand-full {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    color: var(--admin-gold);
    font-size: var(--font-section-title);
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.sidebar-brand-mini {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: var(--admin-gold);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    user-select: none;
    cursor: pointer;
}

.sidebar-collapse-btn {
    background: transparent;
    border: none;
    color: var(--admin-sidebar-text);
    cursor: pointer;
    padding: 4px 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.sidebar-collapse-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: #ffffff;
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    color: var(--admin-text-main);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background-color: #f1f5f9;
    color: var(--admin-gold);
    border-color: #cbd5e1;
}

.sidebar-section-heading {
    padding: 12px 18px 4px 18px;
    list-style: none;
}

.sidebar-section-text {
    display: block;
    color: var(--admin-text-muted, #64748b);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-section-divider {
    display: none;
}

.sidebar-menu {
    list-style: none;
    padding: var(--space-3) 0;
    margin: 0;
    flex-grow: 1;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    height: 38px;
    padding: 0 16px;
    color: var(--admin-sidebar-text);
    text-decoration: none;
    font-size: var(--font-nav);
    font-weight: 500;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.sidebar-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-right: 12px;
    color: inherit;
}

.sidebar-item-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-item a:hover {
    color: var(--admin-sidebar-active-text);
    background-color: var(--admin-sidebar-active-bg);
}

.sidebar-item.active a {
    color: var(--admin-sidebar-active-text);
    background-color: var(--admin-sidebar-active-bg);
    border-left: 3px solid var(--admin-gold);
    padding-left: calc(16px - 3px);
}

/* Main Area */
.admin-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    height: 100vh;
    min-width: 0;
}

.admin-header {
    background-color: #ffffff;
    height: 56px;
    min-height: 56px;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
}

.header-title {
    font-size: var(--font-page-title);
    font-weight: 600;
    color: var(--admin-text-main);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.header-user {
    font-size: var(--font-meta);
    font-weight: 500;
    color: var(--admin-text-muted);
}

.admin-content {
    padding: var(--space-5) var(--space-6);
    overflow-y: auto;
    flex-grow: 1;
}

/* Typography Enhancements */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: var(--space-3);
}
h1 { font-size: var(--font-page-title); }
h2 { font-size: var(--font-section-title); }
h3 { font-size: var(--font-card-title); }

/* Cards & Components */
.admin-card {
    background-color: var(--admin-card-bg);
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-bottom: var(--space-4);
    padding: var(--space-4);
}

.card-title {
    font-size: var(--font-card-title);
    font-weight: 600;
    margin-top: 0;
    margin-bottom: var(--space-3);
    border-bottom: 1px solid var(--admin-border);
    padding-bottom: var(--space-2);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    background-color: var(--admin-card-bg);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-table);
    margin: 0;
}

.admin-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-table th {
    background-color: #f1f5f9;
    color: var(--admin-text-muted);
    font-size: var(--font-meta);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--admin-border);
    white-space: nowrap;
    height: 36px;
    box-sizing: border-box;
}

.admin-table td {
    padding: 0 var(--space-3);
    border-bottom: 1px solid var(--admin-border);
    color: var(--admin-text-main);
    vertical-align: middle;
    height: 44px; /* Standard row height */
    box-sizing: border-box;
}

.admin-table tr:hover td {
    background-color: #f8fafc;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

/* Buttons */
.btn-admin-primary, .btn-admin-outline, .btn-admin-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-1) var(--space-3);
    border-radius: 4px;
    font-weight: 500;
    font-size: var(--font-button);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    height: 36px;
    box-sizing: border-box;
    white-space: nowrap;
}

.btn-admin-primary {
    background-color: var(--admin-gold);
    color: #ffffff;
}

.btn-admin-primary:hover {
    background-color: var(--admin-gold-hover);
}

.btn-admin-outline {
    background-color: transparent;
    color: var(--admin-text-main);
    border-color: var(--admin-border);
}

.btn-admin-outline:hover {
    background-color: var(--admin-bg);
    border-color: var(--admin-text-muted);
}

.btn-admin-secondary {
    background-color: #f1f5f9;
    color: var(--admin-text-main);
    border-color: #e2e8f0;
}
.btn-admin-secondary:hover {
    background-color: #e2e8f0;
}

.btn-admin-sm {
    height: 30px !important;
    font-size: 11.5px !important;
    padding: 0 10px !important;
}

/* Fallback normalization for standard button classes in admin context */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
    box-sizing: border-box;
}

.btn-sm {
    height: 30px;
    font-size: 11.5px;
    padding: 0 10px;
}

.btn-outline-secondary {
    background-color: transparent;
    color: var(--admin-text-main);
    border-color: var(--admin-border);
}

.btn-outline-secondary:hover {
    background-color: var(--admin-bg);
    border-color: var(--admin-text-muted);
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--admin-text-muted);
    padding: 0;
    cursor: pointer;
}

.btn-link:hover {
    color: var(--admin-text-main);
}

.btn-admin-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    color: var(--admin-text-muted);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-admin-icon:hover {
    background-color: #f1f5f9;
    color: var(--admin-text-main);
}

/* Global Disabled Button Styling */
button:disabled,
input[type="submit"]:disabled,
input[type="button"]:disabled,
.btn-admin-primary:disabled,
.btn-admin-outline:disabled,
.btn-admin-secondary:disabled,
.btn-admin-icon:disabled,
.btn-admin-primary[disabled],
.btn-admin-outline[disabled],
.btn-admin-secondary[disabled],
.btn-admin-icon[disabled] {
    background-color: #94a3b8 !important;
    border-color: #94a3b8 !important;
    color: #ffffff !important;
    opacity: 0.55 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    filter: grayscale(100%) !important;
    box-shadow: none !important;
}

/* Badges */
.badge-admin {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    font-size: var(--font-badge);
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

.badge-draft { background-color: #f1f5f9; color: #475569; }
.badge-active { background-color: #dcfce7; color: #15803d; }
.badge-completed { background-color: #dbeafe; color: #1d4ed8; }
.badge-cancelled { background-color: #fee2e2; color: #b91c1c; }
.badge-pending { background-color: #fef08a; color: #854d0e; }
.badge-failed { background-color: #fee2e2; color: #b91c1c; }
.badge-generated { background-color: #dbeafe; color: #1d4ed8; }

/* Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.form-group {
    margin-bottom: var(--space-3);
}

.form-label {
    display: block;
    font-size: var(--font-label);
    font-weight: 600;
    margin-bottom: var(--space-1);
    color: var(--admin-text-muted);
}

.form-control {
    width: 100%;
    padding: var(--space-2) var(--space-2);
    font-size: var(--font-input);
    border: 1px solid var(--admin-border);
    border-radius: 4px;
    background-color: #ffffff;
    box-sizing: border-box;
    font-family: inherit;
    color: var(--admin-text-main);
    transition: border-color 0.2s ease;
    height: 36px;
}

.form-control:focus {
    outline: none;
    border-color: var(--admin-gold);
}

/* TomSelect Integration */
.ts-wrapper.form-control {
    padding: 0;
    border: none;
    height: auto;
    background: transparent;
    box-shadow: none;
}
.ts-control {
    padding: var(--space-2) var(--space-2);
    font-size: var(--font-input);
    border: 1px solid var(--admin-border);
    border-radius: 4px;
    background-color: #ffffff;
    min-height: 36px;
    display: flex;
    align-items: center;
}
.ts-wrapper.focus .ts-control {
    border-color: var(--admin-gold);
    box-shadow: none;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.kpi-card {
    background: var(--admin-card-bg);
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    padding: var(--space-3) var(--space-4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100px;
    box-sizing: border-box;
}

.kpi-title {
    font-size: var(--font-meta);
    color: var(--admin-text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-1);
}

.kpi-value {
    font-size: var(--font-kpi-large);
    font-weight: 700;
    color: var(--admin-text-main);
    margin-bottom: var(--space-2);
}

.kpi-subtext {
    font-size: var(--font-meta);
    color: var(--admin-text-muted);
    display: flex;
    gap: var(--space-3);
}

/* Pagination Control */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-3);
    padding-top: var(--space-3);
}

.pagination-info {
    font-size: var(--font-meta);
    color: var(--admin-text-muted);
}

.pagination-buttons {
    display: flex;
    gap: var(--space-2);
}

.pagination-controls-group {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.pagination-page-size {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-meta);
    color: var(--admin-text-muted);
}

.admin-select-sm {
    padding: 3px 8px;
    font-size: var(--font-meta);
    border: 1px solid var(--admin-border);
    border-radius: 4px;
    background-color: var(--admin-card-bg);
    color: var(--admin-text-main);
    cursor: pointer;
    line-height: 1.4;
}

.admin-select-sm:focus {
    outline: none;
    border-color: var(--admin-gold);
}

/* Utilities */
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-3 { margin-top: var(--space-3); }
.mb-3 { margin-bottom: var(--space-3); }

/* Responsive Adjustments */

/* ========================================================
   COLLAPSIBLE SIDEBAR RULES (DESKTOP & TABLETS >= 769px)
   ======================================================== */
@media (min-width: 769px) {
    .admin-wrapper.sidebar-collapsed .admin-sidebar {
        width: 68px;
        overflow: visible !important;
    }

    .admin-wrapper.sidebar-collapsed .sidebar-header {
        padding: 0;
        justify-content: center;
    }

    .admin-wrapper.sidebar-collapsed .sidebar-brand-full {
        display: none !important;
    }

    .admin-wrapper.sidebar-collapsed .sidebar-brand-mini {
        display: flex !important;
    }

    .admin-wrapper.sidebar-collapsed .sidebar-section-heading {
        padding: 4px 12px;
        margin: 4px 0;
    }

    .admin-wrapper.sidebar-collapsed .sidebar-section-text {
        display: none !important;
    }

    .admin-wrapper.sidebar-collapsed .sidebar-section-divider {
        display: block !important;
        height: 1px;
        background-color: rgba(255, 255, 255, 0.08);
        margin: 0 auto;
        width: 32px;
    }

    .admin-wrapper.sidebar-collapsed .sidebar-menu {
        overflow: visible !important;
    }

    .admin-wrapper.sidebar-collapsed .sidebar-item {
        overflow: visible !important;
    }

    .admin-wrapper.sidebar-collapsed .sidebar-item a {
        padding: 0 !important;
        justify-content: center !important;
        overflow: visible !important;
        position: relative !important;
    }

    .admin-wrapper.sidebar-collapsed .sidebar-item-icon {
        margin-right: 0 !important;
    }

    .admin-wrapper.sidebar-collapsed .sidebar-item-text {
        display: none !important;
    }

    .admin-wrapper.sidebar-collapsed .sidebar-item.active a {
        padding-left: 0 !important;
        border-left: 3px solid var(--admin-gold);
    }

    /* Floating Tooltip on Icon Hover when Collapsed */
    .admin-wrapper.sidebar-collapsed .sidebar-item a:hover::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        transform: translateY(-50%);
        background-color: #0f172a;
        color: #ffffff;
        font-size: 0.78rem;
        font-weight: 500;
        letter-spacing: 0.2px;
        white-space: nowrap;
        padding: 6px 12px;
        border-radius: 6px;
        border: 1px solid #334155;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
        pointer-events: none;
        z-index: 1060;
        line-height: 1.3;
        animation: sidebarTooltipIn 0.15s cubic-bezier(0, 0, 0.2, 1);
    }

    .admin-wrapper.sidebar-collapsed .sidebar-item a:hover::before {
        content: '';
        position: absolute;
        left: calc(100% + 6px);
        top: 50%;
        transform: translateY(-50%);
        border-width: 5px 6px 5px 0;
        border-style: solid;
        border-color: transparent #334155 transparent transparent;
        pointer-events: none;
        z-index: 1060;
    }

    @keyframes sidebarTooltipIn {
        from {
            opacity: 0;
            transform: translateY(-50%) translateX(-4px);
        }
        to {
            opacity: 1;
            transform: translateY(-50%) translateX(0);
        }
    }
}

/* Mobile Sidebar Backdrop */
.admin-sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

/* Mobile: Drawer Overlay */
@media (max-width: 768px) {
    .admin-sidebar-backdrop.active {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-sidebar {
        position: fixed;
        left: -220px;
        width: 220px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .admin-sidebar.open {
        left: 0;
    }
    
    .sidebar-header, .sidebar-item a {
        font-size: var(--font-nav);
        padding: 0 var(--space-5);
        justify-content: flex-start;
    }
    
    .sidebar-item.active a {
        padding-left: calc(var(--space-5) - 3px);
    }
    
    .menu-toggle {
        display: block !important;
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--admin-text-main);
        padding: 0;
    }
    
    .admin-header {
        padding: 0 var(--space-4);
    }
    
    .admin-content {
        padding: var(--space-4);
    }
    
    /* Responsive Table to Cards */
    .table-responsive .admin-table,
    .admin-table tbody {
        display: block;
    }
    .admin-table thead {
        display: none;
    }
    .admin-table tr {
        display: flex;
        flex-direction: column;
        background: var(--admin-card-bg);
        border: 1px solid var(--admin-border);
        border-radius: 8px;
        margin-bottom: var(--space-4);
        padding: var(--space-3);
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    .admin-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none;
        padding: 4px 0;
        text-align: right;
    }
    .admin-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--admin-text-muted);
        text-align: left;
    }
    .admin-table td[data-label="Actions"] {
        justify-content: flex-start;
        flex-wrap: wrap;
        border-top: 1px solid var(--admin-border);
        margin-top: var(--space-3);
        padding-top: var(--space-3);
    }
    .admin-table td[data-label="Actions"]::before {
        display: none;
    }
}

/* Custom Clock Picker */
.clock-picker-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 2000; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.clock-picker-modal.active { opacity: 1; pointer-events: auto; }
.clock-picker-content { background: var(--admin-card-bg); border: 1px solid var(--admin-border); border-radius: 12px; width: 90%; max-width: 320px; padding: 25px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); box-sizing: border-box; }
.clock-header { text-align: center; font-size: 2rem; font-weight: 700; color: var(--admin-gold); margin-bottom: 25px; display: flex; justify-content: center; align-items: baseline; gap: 10px; font-family: 'Outfit', sans-serif; }
.clock-header span { cursor: pointer; transition: color 0.2s; }
.clock-header span.active { color: var(--admin-text-main); }
.clock-header span.inactive { color: var(--admin-text-muted); opacity: 0.6; }
.clock-header span:hover { color: var(--admin-text-main); opacity: 1; }
.clock-face { position: relative; width: 240px; height: 240px; border-radius: 50%; background: var(--admin-bg); margin: 0 auto 25px; border: 1px solid var(--admin-border); }
.clock-number { position: absolute; width: 36px; height: 36px; text-align: center; line-height: 36px; border-radius: 50%; font-weight: 500; cursor: pointer; transform: translate(-50%, -50%); transition: all 0.2s; color: var(--admin-text-main); }
.clock-number:hover { background: rgba(197, 160, 89, 0.2); }
.clock-number.disabled { opacity: 0.3; cursor: not-allowed; }
.clock-number.disabled:hover { background: transparent; }
.clock-number.selected { background: var(--admin-gold); color: white; box-shadow: 0 4px 10px rgba(197, 160, 89, 0.3); }
.clock-hand { position: absolute; bottom: 50%; left: 50%; width: 2px; height: 100px; background: var(--admin-gold); transform-origin: bottom center; pointer-events: none; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.clock-hand::after { content: ''; position: absolute; top: -6px; left: -5px; width: 12px; height: 12px; border-radius: 50%; background: var(--admin-gold); }
.clock-center { position: absolute; top: 50%; left: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--admin-gold); transform: translate(-50%, -50%); }
.clock-ampm { display: flex; justify-content: center; gap: 20px; margin-bottom: 25px; }
.ampm-btn { flex: 1; padding: 10px; border-radius: 8px; border: 1px solid var(--admin-border); background: var(--admin-bg); cursor: pointer; font-weight: 600; color: var(--admin-text-muted); transition: all 0.2s; }
.ampm-btn.selected { background: rgba(197, 160, 89, 0.15); color: var(--admin-gold); border-color: var(--admin-gold); }
.clock-actions { display: flex; justify-content: space-between; gap: 15px; }
.clock-actions button { flex: 1; padding: 10px; font-weight: 600; border-radius: 6px; cursor: pointer; transition: all 0.2s; }
.clock-cancel { background: transparent; border: 1px solid var(--admin-border); color: var(--admin-text-main); }
.clock-cancel:hover { background: var(--admin-bg); }
.clock-ok { background: var(--admin-text-main); border: 1px solid var(--admin-text-main); color: white; }
.clock-ok:hover { background: var(--admin-gold); border-color: var(--admin-gold); }

/* Alerts */
.alert {
    position: relative;
    padding: 1rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: var(--font-body);
}

.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.alert-danger {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

.alert-dismissible {
    padding-right: 3rem;
}

.alert-dismissible .btn-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    padding: 1.25rem 1rem;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.alert-dismissible .btn-close::before {
    content: "\2715"; /* Unicode cross symbol */
    color: inherit;
    font-size: 14px;
    font-weight: bold;
}

.schedule-list-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 900px) {
    .schedule-list-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Dynamic Field Sample Preview Helper */
.field-sample-preview {
    margin-top: 6px;
    padding: 6px 10px;
    background: #f1f5f9;
    border: 1px solid var(--admin-border);
    border-radius: 4px;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.field-sample-preview .sample-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: #475569;
}
.field-sample-preview .sample-value {
    color: #0f172a;
    font-family: monospace;
    font-size: 11px;
    word-break: break-all;
}
.field-sample-preview .sample-meta-tag {
    font-size: 10px;
    color: #64748b;
    margin-top: 2px;
}

/* ==============================================================================
   WhatsApp Inbox Operational Workspace (Sprint 8 / Phase 23 Polish)
   ============================================================================== */

/* Top Sub-Header */
.inbox-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.inbox-page-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.inbox-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #25d366;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 2px 4px rgba(37,211,102,0.25);
}

.inbox-brand-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.inbox-brand-subtitle {
    font-size: 12px;
    color: #64748b;
    margin-top: 1px;
}

.inbox-status-pill-online {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #15803d;
    background: #f0fdf4;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid #bbf7d0;
}

.inbox-status-dot-green {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
}

/* Body & Admin Content overrides for WhatsApp Inbox full-height operational screen */
body:has(.inbox-workspace) {
    height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
}

body:has(.inbox-workspace) .admin-wrapper {
    height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
}

body:has(.inbox-workspace) .admin-main {
    height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

body:has(.inbox-workspace) .admin-content {
    flex: 1 1 0 !important;
    height: calc(100vh - 56px) !important;
    max-height: calc(100vh - 56px) !important;
    overflow: hidden !important;
    padding: 8px 16px 10px 16px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
}

/* Three-Pane Workspace Container */
.inbox-workspace {
    display: grid;
    grid-template-columns: 320px 1fr 340px;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    flex: 1 1 0;
    background: #ffffff;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* 1. Left Pane: Conversations List */
.inbox-pane-conversations {
    border-right: 1px solid var(--admin-border);
    display: flex;
    flex-direction: column;
    background: #ffffff;
    min-width: 0;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.inbox-pane-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--admin-border);
    background: #ffffff;
}

.inbox-search-wrap {
    position: relative;
    margin-bottom: 10px;
}

.inbox-search-wrap .form-control {
    padding-right: 32px;
    border-radius: 6px;
    font-size: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.inbox-search-wrap .form-control:focus {
    background: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}

.inbox-search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    font-size: 13px;
}

.inbox-filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
}

.inbox-filter-select {
    width: auto;
    max-width: 140px;
    font-size: 11.5px;
    padding: 3px 20px 3px 8px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.inbox-attention-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: #475569;
    cursor: pointer;
    margin-bottom: 0;
    white-space: nowrap;
}

.inbox-conversations-list {
    flex: 1;
    overflow-y: scroll;
    scrollbar-gutter: stable;
    padding: 6px 8px;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
}

.inbox-conversations-list::-webkit-scrollbar {
    width: 6px;
}

.inbox-conversations-list::-webkit-scrollbar-track {
    background: #f8fafc;
}

.inbox-conversations-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.inbox-conversations-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.inbox-view-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    font-size: 13px;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    outline: none;
}

.inbox-view-toggle-btn:hover {
    background-color: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
}

.inbox-view-toggle-btn.active {
    background-color: #e0e7ff;
    color: #4338ca;
    border-color: #c7d2fe;
}

.inbox-conv-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 8px;
    margin-bottom: 4px;
    text-decoration: none;
    color: var(--admin-text-main);
    border-left: 3px solid transparent;
    transition: all 0.15s ease-in-out;
}

.inbox-conv-item:hover {
    background-color: #f8fafc;
    color: var(--admin-text-main);
}

.inbox-conv-item.active {
    background-color: #f1f5f9;
    border-left-color: var(--admin-gold);
}

/* Compact list mode */
.inbox-conversations-list.compact-view .inbox-conv-item {
    padding: 6px 8px;
    gap: 8px;
    margin-bottom: 2px;
}

.inbox-conversations-list.compact-view .inbox-avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

.inbox-conversations-list.compact-view .inbox-conv-phone {
    display: none;
}

.inbox-conversations-list.compact-view .inbox-conv-name {
    font-size: 12.5px;
}

.inbox-conversations-list.compact-view .inbox-conv-preview {
    font-size: 11px;
}

.inbox-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.inbox-conv-body {
    flex: 1;
    min-width: 0;
}

.inbox-conv-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.inbox-conv-name {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inbox-conv-time {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    margin-left: 6px;
}

.inbox-conv-phone {
    font-size: 11.5px;
    color: #64748b;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inbox-conv-preview {
    font-size: 11.5px;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.inbox-unread-pill {
    background: #22c55e;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.4;
}

.inbox-attention-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    display: inline-block;
}

/* 2. Center Pane: Chat & Reply */
.inbox-pane-chat {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    min-height: 0;
    background: #f0f2f5;
    position: relative;
    overflow: hidden;
}

.inbox-chat-header {
    padding: 10px 18px;
    background: #ffffff;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
}

.inbox-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.inbox-chat-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inbox-chat-header-title h6 {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.inbox-chat-header-meta {
    font-size: 11.5px;
    color: #64748b;
    margin-top: 1px;
}

.inbox-chat-badge-running {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
}

.inbox-chat-badge-attention {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
}

.inbox-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #64748b;
}

.inbox-chat-icon-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 15px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.inbox-chat-icon-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* Messages Stream */
.inbox-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.inbox-messages-container::-webkit-scrollbar {
    width: 6px;
}

.inbox-messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.inbox-messages-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.inbox-messages-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.inbox-date-divider {
    display: flex;
    justify-content: center;
    margin: 6px 0;
}

.inbox-date-badge {
    background: #ffffff;
    color: #54656f;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 12px;
    border-radius: 12px;
    box-shadow: 0 1px 1px rgba(11,20,26,.1);
}

.inbox-bubble-wrap {
    display: flex;
    width: 100%;
}

.inbox-bubble-wrap.inbound {
    justify-content: flex-start;
}

.inbox-bubble-wrap.outbound {
    justify-content: flex-end;
}

.inbox-bubble {
    max-width: 68%;
    padding: 8px 12px 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.45;
    position: relative;
    word-break: break-word;
    box-shadow: 0 1px 0.5px rgba(11,20,26,.13);
}

.inbox-bubble.inbound {
    background: #ffffff;
    color: #111b21;
    border-top-left-radius: 0px;
}

.inbox-bubble.outbound {
    background: #d9fdd3;
    color: #111b21;
    border-top-right-radius: 0px;
}

.inbox-bubble .bubble-content {
    white-space: pre-wrap;
    font-size: 12.5px;
}

.inbox-bubble .bubble-meta {
    margin-top: 4px;
    font-size: 10.5px;
    color: #667781;
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

.inbox-bubble .bubble-meta .check-read {
    color: #53bdeb;
    font-size: 13px;
    line-height: 1;
}

.inbox-bubble .bubble-meta .check-delivered {
    color: #8696a0;
    font-size: 13px;
    line-height: 1;
}

/* Reply Area */
.inbox-reply-container {
    background: #ffffff;
    border-top: 1px solid var(--admin-border);
    padding: 10px 16px 8px 16px;
    flex-shrink: 0;
    margin-top: auto;
}

.inbox-reply-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inbox-reply-attach-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 18px;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.inbox-reply-attach-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.inbox-reply-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.inbox-reply-input {
    width: 100%;
    border-radius: 20px;
    padding: 8px 36px 8px 16px;
    border: 1px solid #cbd5e1;
    font-size: 12.5px;
    outline: none;
    resize: none;
    line-height: 1.4;
    min-height: 38px;
    max-height: 90px;
    background: #f8fafc;
}

.inbox-reply-input:focus {
    background: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}

.inbox-reply-emoji-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: #64748b;
    font-size: 17px;
    cursor: pointer;
    padding: 2px;
}

.inbox-reply-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
    font-size: 14px;
}

.inbox-reply-send-btn:hover {
    background: #1d4ed8;
    transform: scale(1.04);
}

.inbox-reply-send-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

.inbox-reply-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    padding: 0 4px;
    font-size: 11px;
    color: #64748b;
}

/* Modern Composer Mode Switcher & Template Selection Bar */
.inbox-mode-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    gap: 8px;
}

.inbox-mode-pills {
    display: inline-flex;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 7px;
    gap: 2px;
}

.inbox-mode-pill {
    border: none;
    background: transparent;
    color: #475569;
    font-size: 11.5px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
}

.inbox-mode-pill:hover {
    color: #0f172a;
}

.inbox-mode-pill.active {
    background: #ffffff;
    color: #0f172a;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.inbox-template-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.inbox-filter-select-modern {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 11.5px;
    color: #334155;
    padding: 4px 8px;
    height: 30px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

.inbox-filter-select-modern:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

.inbox-template-select-modern {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #0f172a;
    padding: 4px 10px;
    height: 32px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    cursor: pointer;
    min-width: 220px;
    max-width: 320px;
}

.inbox-template-select-modern:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

.inbox-control-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 0;
}

/* 3. Right Pane: Context & Actions */
.inbox-pane-context {
    border-left: 1px solid var(--admin-border);
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-width: 0;
    height: 100%;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
}

.inbox-pane-context::-webkit-scrollbar {
    width: 6px;
}

.inbox-pane-context::-webkit-scrollbar-track {
    background: #f8fafc;
}

.inbox-pane-context::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.inbox-pane-context::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.inbox-context-tabs {
    display: flex;
    border-bottom: 1px solid var(--admin-border);
    background: #ffffff;
    flex-shrink: 0;
}

.inbox-context-tab {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid transparent;
    text-decoration: none;
    cursor: pointer;
}

.inbox-context-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.inbox-context-close-btn {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: #64748b;
    padding: 0 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.inbox-context-close-btn:hover {
    color: #0f172a;
}

.inbox-context-section {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.inbox-context-section:last-child {
    border-bottom: none;
}

.inbox-section-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inbox-section-title .edit-link {
    font-size: 11px;
    font-weight: 500;
    color: #2563eb;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.inbox-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 11.5px;
    margin-bottom: 6px;
}

.inbox-info-label {
    color: #64748b;
    flex-shrink: 0;
}

.inbox-info-value {
    color: #0f172a;
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

.inbox-badge-green {
    background: #dcfce7;
    color: #15803d;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
}

.inbox-badge-blue {
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
}

.inbox-context-actions-footer {
    padding: 12px 16px;
    margin-top: auto;
    border-top: 1px solid #f1f5f9;
    background: #ffffff;
    flex-shrink: 0;
}

/* Diagnostic View Logs Link in Right Context Pane */
.inbox-btn-view-logs {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 7px 12px;
    background: #ffffff;
    color: #475569 !important;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
}

.inbox-btn-view-logs:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a !important;
    text-decoration: none;
}

/* ========================================================================== */
/* WhatsApp Inbox: Premium Empty States & Handoff Controls                     */
/* ========================================================================== */

/* 1. Left Pane Empty State */
.inbox-empty-conversations {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    height: 100%;
    min-height: 280px;
}

.inbox-empty-conv-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #bbf7d0;
    color: #16a34a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.12);
}

.inbox-empty-conv-title {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
}

.inbox-empty-conv-desc {
    font-size: 12.5px;
    color: #64748b;
    line-height: 1.5;
    max-width: 230px;
    margin-bottom: 16px;
}

.inbox-btn-reset-filter {
    font-size: 11.5px;
    font-weight: 600;
    color: #2563eb;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.inbox-btn-reset-filter:hover {
    background: #dbeafe;
    color: #1d4ed8;
}

/* 2. Center Pane Empty State */
.inbox-empty-chat-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 48px 32px;
    text-align: center;
    background: radial-gradient(circle at 50% 35%, #ffffff 0%, #f8fafc 100%);
    position: relative;
    overflow-y: auto;
}

.inbox-empty-hero-icon {
    width: 84px;
    height: 84px;
    border-radius: 24px;
    background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin-bottom: 22px;
    box-shadow: 0 12px 28px -6px rgba(34, 197, 94, 0.4);
    position: relative;
}

.inbox-empty-hero-icon::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 30px;
    border: 2px dashed rgba(34, 197, 94, 0.25);
}

.inbox-empty-hero-title {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.inbox-empty-hero-desc {
    font-size: 13.5px;
    color: #64748b;
    max-width: 440px;
    line-height: 1.6;
    margin: 0 auto 24px auto;
}

.inbox-feature-chips {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.inbox-feature-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.inbox-feature-chip i {
    font-size: 14px;
}

.inbox-empty-actions-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* 3. Right Pane Empty State */
.inbox-empty-context-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 36px 20px;
    text-align: center;
    background: #ffffff;
    overflow-y: auto;
}

.inbox-empty-context-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 14px;
}

.inbox-empty-context-title {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
}

.inbox-empty-context-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
    max-width: 220px;
    margin-bottom: 20px;
}

.inbox-empty-context-mock {
    width: 100%;
    max-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.inbox-empty-mock-card {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 10px 12px;
    text-align: left;
}

.inbox-empty-mock-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 6px;
}

.inbox-empty-mock-line {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    margin-bottom: 4px;
}

.inbox-empty-mock-line.short {
    width: 60%;
    margin-bottom: 0;
}

/* 4. Handoff Alert Banner in Chat Timeline */
.inbox-handoff-alert-banner {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 12px 16px;
    margin: 12px 18px 6px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.08);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.inbox-handoff-alert-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.inbox-handoff-alert-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #f59e0b;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.inbox-handoff-alert-text {
    font-size: 12.5px;
    color: #78350f;
    line-height: 1.4;
}

.inbox-handoff-alert-text strong {
    color: #92400e;
}

.inbox-handoff-alert-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.inbox-handoff-alert-actions form {
    display: inline-flex;
    margin: 0;
}

.inbox-btn-claim {
    background: #d97706;
    color: #ffffff !important;
    border: none;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: background 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
}

.inbox-btn-claim:hover {
    background: #b45309;
}

.inbox-btn-resume {
    background: #16a34a;
    color: #ffffff !important;
    border: none;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: background 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
}

.inbox-btn-resume:hover {
    background: #15803d;
}

.inbox-btn-release {
    background: #ffffff;
    color: #475569 !important;
    border: 1px solid #cbd5e1;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
}

.inbox-btn-release:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a !important;
}

/* Pagination Bar in Conversation List */
.inbox-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #ffffff;
    border-top: 1px solid var(--admin-border);
    flex-shrink: 0;
    min-height: 42px;
}

.inbox-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    text-decoration: none;
    transition: all 0.15s ease;
}

.inbox-page-btn:hover:not(.disabled) {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

.inbox-page-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: #f8fafc;
}

.inbox-page-info {
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
}

/* Unknown Contact Quick Guest Creation Box */
.inbox-create-guest-card {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    padding: 12px;
    margin-top: 8px;
}

.inbox-btn-create-guest {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 8px 14px;
    background-color: #2563eb !important;
    color: #ffffff !important;
    border: 1px solid #2563eb !important;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}

.inbox-btn-create-guest:hover {
    background-color: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    box-shadow: 0 2px 5px rgba(29, 78, 216, 0.35);
}

.inbox-btn-create-guest:active {
    transform: scale(0.98);
}

/* Responsive Overrides */
/* Inbox Context Drawer Backdrop */
.inbox-context-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1045;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

@media (min-width: 992px) {
    .inbox-btn-context-toggle {
        display: none !important;
    }
}

@media (max-width: 1200px) {
    .inbox-workspace {
        grid-template-columns: 290px 1fr 310px;
    }
}

@media (max-width: 992px) {
    .inbox-workspace {
        grid-template-columns: 280px 1fr;
    }
    .inbox-context-backdrop.active {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }
    .inbox-pane-context {
        display: none;
    }
    .inbox-pane-context.show-drawer {
        display: flex;
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 320px;
        max-width: 90vw;
        z-index: 1050;
        box-shadow: -2px 0 10px rgba(0,0,0,0.15);
    }
}

@media (max-width: 768px) {
    .inbox-workspace {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 120px);
    }
    .inbox-pane-conversations.hide-mobile {
        display: none;
    }
    .inbox-pane-chat.hide-mobile {
        display: none;
    }
}


/* ========================================================
   RESPONSIVE COMPACT DENSITY (SCREENS <= 1600px & LAPTOPS)
   Solves oversized controls on 1366x768, 1440x900, 1600x900
   and 1080p displays with 125%/150% Windows display scaling.
   ======================================================== */
@media (max-width: 1600px) {
    :root {
        --font-body: 12px;
        --font-table: 11.5px;
        --font-label: 11px;
        --font-meta: 10.5px;
        --font-input: 12px;
        --font-page-title: 16px;
        --font-section-title: 13px;
        --font-card-title: 13px;
        --font-kpi-large: 20px;
        --font-button: 11.5px;
        --font-badge: 10px;
        --font-nav: 11.5px;

        --space-1: 3px;
        --space-2: 6px;
        --space-3: 10px;
        --space-4: 12px;
        --space-5: 14px;
        --space-6: 18px;
    }

    .admin-header {
        height: 48px;
        min-height: 48px;
        padding: 0 16px;
    }

    .header-title {
        font-size: 15px;
        gap: 10px;
    }

    .header-user {
        font-size: 11px;
    }

    .admin-content {
        padding: 12px 16px;
    }

    .admin-card {
        padding: 12px 14px;
        margin-bottom: 12px;
        border-radius: 5px;
    }

    .card-title {
        font-size: 13px;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }

    /* Form Controls & Buttons */
    .form-control {
        height: 32px;
        padding: 4px 8px;
        font-size: 12px;
    }

    .ts-control {
        min-height: 32px;
        height: 32px;
        padding: 2px 8px;
        font-size: 12px;
    }

    .btn-admin-primary, 
    .btn-admin-outline, 
    .btn-admin-secondary {
        height: 32px;
        padding: 0 12px;
        font-size: 11.5px;
    }

    .btn-admin-icon {
        width: 30px;
        height: 30px;
    }

    .sidebar-toggle-btn {
        width: 30px;
        height: 30px;
    }

    /* Table density */
    .admin-table {
        font-size: 11.5px;
    }

    .admin-table th {
        height: 32px;
        padding: 2px 8px;
        font-size: 10.5px;
    }

    .admin-table td {
        height: 36px;
        padding: 0 8px;
        font-size: 11.5px;
    }

    /* KPI Cards */
    .kpi-grid {
        gap: 10px;
        margin-bottom: 12px;
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }

    .kpi-card {
        height: 74px;
        padding: 8px 12px;
    }

    .kpi-title {
        font-size: 10px;
        margin-bottom: 2px;
    }

    .kpi-value {
        font-size: 20px;
        margin-bottom: 2px;
    }

    /* Form Grid */
    .form-grid {
        gap: 12px;
    }

    .form-group {
        margin-bottom: 10px;
    }

    /* Sidebar Items */
    .sidebar-item a {
        height: 34px;
        padding: 0 14px;
        font-size: 11.5px;
    }

    .sidebar-section-heading {
        padding: 8px 14px 2px 14px;
    }

    .sidebar-section-text {
        font-size: 0.68rem;
    }

    /* Pagination */
    .pagination-container {
        margin-top: 8px;
        padding-top: 8px;
    }
}

/* Extra density refinement for 1366x768 and smaller laptop screens */
@media (max-width: 1366px) {
    .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .admin-content {
        padding: 10px 14px;
    }

    .admin-table td {
        height: 34px;
        padding: 0 6px;
    }

    .admin-table th {
        height: 30px;
        padding: 2px 6px;
    }

    .form-control, .ts-control, .btn-admin-primary, .btn-admin-outline, .btn-admin-secondary {
        height: 30px;
        min-height: 30px;
        font-size: 11.5px;
    }
}


/* WhatsApp-native historical message components */
.inbox-quoted-reply-box {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    margin: 0 0 7px;
    padding: 6px 9px;
    border: 0;
    border-left: 4px solid #00a884;
    border-radius: 6px;
    background: #f0f2f5;
    color: #111b21;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
}
.inbox-quoted-reply-box:hover { background: #e7ecef; }
.inbox-quoted-sender {
    color: #008f75;
    font-size: 11.5px;
    font-weight: 700;
    margin-bottom: 2px;
}
.inbox-quoted-snippet {
    color: #54656f;
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.inbox-quoted-media {
    color: #54656f;
    font-size: 11px;
}
.inbox-bubble-header-media {
    margin: -8px -12px 8px;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}
.inbox-bubble-header-media img {
    display: block;
    width: 100%;
    max-height: 240px;
    object-fit: cover;
}
.inbox-bubble-footer-text {
    margin-top: 5px;
    color: #667781;
    font-size: 11px;
}
.inbox-bubble-actions {
    margin: 8px -12px -6px;
    border-top: 1px solid rgba(11,20,26,.10);
}
.inbox-bubble-action-row {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(11,20,26,.08);
    color: #008f75;
    text-align: center;
    font-size: 12.5px;
    line-height: 1.35;
    user-select: text;
    cursor: default;
}
.inbox-bubble-action-row:last-child { border-bottom: 0; }
.inbox-bubble-list {
    margin: 8px -12px -6px;
    border-top: 1px solid rgba(11,20,26,.10);
    color: #111b21;
}
.inbox-bubble-list summary {
    padding: 8px 12px;
    color: #008f75;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    list-style-position: inside;
}
.inbox-list-section-title {
    padding: 7px 12px 4px;
    background: rgba(11,20,26,.04);
    color: #667781;
    font-size: 11px;
    font-weight: 700;
}
.inbox-list-row {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    border-top: 1px solid rgba(11,20,26,.07);
    font-size: 12px;
}
.inbox-list-row small {
    margin-top: 2px;
    color: #667781;
    font-size: 11px;
}
.inbox-bubble-link {
    display: block;
    margin-top: 5px;
    color: #027eb5;
    overflow-wrap: anywhere;
}
.inbox-bubble-highlight .inbox-bubble {
    outline: 2px solid #00a884;
    box-shadow: 0 0 0 4px rgba(0,168,132,.15);
    transition: box-shadow .25s ease;
}
/* Utility for toggling visibility */
.d-none {
    display: none !important;
}

/* ========================================================================= */
/* Human Handoff Highlighted Conversation Card & Global Alerts               */
/* ========================================================================= */

.inbox-conv-item.inbox-conv-handoff {
    background-color: #fffbeb !important;
    border-left: 4.5px solid #f59e0b !important;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.2);
    animation: handoffBorderPulse 2.5s infinite ease-in-out;
}

.inbox-conv-item.inbox-conv-handoff.active {
    background-color: #fef3c7 !important;
    border-left: 4.5px solid #d97706 !important;
}

@keyframes handoffBorderPulse {
    0%, 100% {
        border-left-color: #f59e0b;
        box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.2);
    }
    50% {
        border-left-color: #ef4444;
        box-shadow: inset 0 0 10px rgba(245, 158, 11, 0.35);
    }
}

.inbox-conv-handoff-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fde68a;
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 4px;
}

/* Global Floating Toast Alert (rendered on any admin page) */
.handoff-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 400px;
    width: calc(100vw - 48px);
}

.handoff-floating-toast {
    pointer-events: auto;
    background: #ffffff;
    border: 1px solid #fde68a;
    border-left: 5px solid #f59e0b;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.handoff-floating-toast.toast-hiding {
    opacity: 0;
    transform: translateX(30px);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.handoff-toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #fef3c7;
    color: #d97706;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.handoff-toast-content {
    flex: 1;
    min-width: 0;
}

.handoff-toast-title {
    font-size: 13px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.handoff-toast-body {
    font-size: 12px;
    color: #4b5563;
    line-height: 1.4;
    margin-bottom: 8px;
}

.handoff-toast-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.handoff-toast-btn {
    background: #d97706;
    color: #ffffff !important;
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease;
}

.handoff-toast-btn:hover {
    background: #b45309;
}

.handoff-toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 2px;
    margin-left: 4px;
}

.handoff-toast-close:hover {
    color: #374151;
}
