/* IT Pro Source CRM Dashboard */
:root {
    --navy: #0d2137;
    --navy-light: #132d47;
    --navy-hover: #1a3a5c;
    --blue: #1565c0;
    --blue-dark: #0b3d91;
    --blue-light: #2196f3;
    --blue-accent: #42a5f5;
    --orange: #c17b24;
    --orange-light: #f59e0b;
    --white: #ffffff;
    --bg: #f0f2f5;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;
    --green: #16a34a;
    --green-light: #dcfce7;
    --red: #dc2626;
    --red-light: #fef2f2;
    --yellow: #ca8a04;
    --yellow-light: #fefce8;
    --purple: #7c3aed;
    --purple-light: #f5f3ff;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --sidebar-width: 240px;
    --topbar-height: 60px;
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--gray-900);
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--navy);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon {
    background: var(--blue);
    color: var(--white);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    padding: 0.4rem 0.5rem;
    border-radius: var(--radius-sm);
}

.brand-text {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    cursor: pointer;
}

.nav-item:hover {
    color: var(--white);
    background: var(--navy-hover);
}

.nav-item.active {
    color: var(--white);
    background: var(--blue);
}

.nav-item svg { flex-shrink: 0; opacity: 0.8; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.nav-external { color: rgba(255,255,255,0.5); font-size: 0.85rem; }

/* ── Main Content ── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    height: var(--topbar-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-300);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--gray-700);
    cursor: pointer;
    padding: 0.25rem;
}

.page-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--navy);
}

.top-bar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 0.4rem 0.75rem;
    width: 260px;
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: var(--blue);
    background: var(--white);
}

.search-box svg { color: var(--gray-500); flex-shrink: 0; }

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--gray-800);
    width: 100%;
}

.content-area {
    flex: 1;
    padding: 1.5rem;
    width: 100%;
}

/* ── Dashboard Layout (main + activity) ── */
.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.5rem;
    align-items: start;
}

.dashboard-main { min-width: 0; }

/* ── Activity Sidebar (stacked panels) ── */
.activity-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: calc(var(--topbar-height) + 1.5rem);
    max-height: calc(100vh - var(--topbar-height) - 3rem);
}

/* ── Loading ── */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    color: var(--gray-500);
    gap: 1rem;
}

.loader {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-300);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Stat Cards ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--blue-accent);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon.blue { background: #e3f2fd; color: var(--blue); }
.stat-icon.orange { background: #fff8e1; color: var(--orange); }
.stat-icon.green { background: var(--green-light); color: var(--green); }
.stat-icon.red { background: var(--red-light); color: var(--red); }
.stat-icon.purple { background: var(--purple-light); color: var(--purple); }
.stat-icon.yellow { background: var(--yellow-light); color: var(--yellow); }

.stat-info { display: flex; flex-direction: column; }
.stat-number { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; line-height: 1.2; color: var(--gray-900); }
.stat-label { font-size: 0.8rem; color: var(--gray-600); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }

/* ── Cards / Panels ── */
.panel {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.panel-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--navy);
}

.panel-body { padding: 0; }

/* ── Ticket Table ── */
.ticket-table {
    width: 100%;
    border-collapse: collapse;
}

.ticket-table th {
    text-align: left;
    padding: 0.6rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.ticket-table td {
    padding: 0.7rem 1rem;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.ticket-table tr {
    cursor: pointer;
    transition: background 0.1s;
}

.ticket-table tbody tr:hover {
    background: #f8fafd;
}

.ticket-id {
    color: var(--blue);
    font-weight: 600;
    font-size: 0.82rem;
    white-space: nowrap;
}

.ticket-subject {
    font-weight: 600;
    color: var(--gray-900);
    max-width: 350px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-requester {
    color: var(--gray-700);
    font-size: 0.85rem;
}

.ticket-date {
    color: var(--gray-500);
    font-size: 0.82rem;
    white-space: nowrap;
}

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.badge-open { background: #dbeafe; color: #1e40af; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-resolved { background: var(--green-light); color: #166534; }
.badge-closed { background: var(--gray-200); color: var(--gray-700); }
.badge-waiting { background: #fce7f3; color: #9d174d; }
.badge-progress { background: #e0e7ff; color: #3730a3; }
.badge-ordered { background: #f3e8ff; color: #6b21a8; }

.badge-low { background: var(--green-light); color: var(--green); }
.badge-medium { background: #fef3c7; color: #92400e; }
.badge-high { background: #fed7aa; color: #c2410c; }
.badge-urgent { background: var(--red-light); color: var(--red); }

/* ── Filter Bar ── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--gray-300);
    border-radius: 999px;
    background: var(--white);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.15s;
}

.filter-btn:hover { border-color: var(--blue); color: var(--blue); }
.filter-btn.active { background: var(--blue); color: var(--white); border-color: var(--blue); }

/* ── Ticket Detail ── */
.ticket-detail-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.ticket-detail-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.ticket-detail-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--navy);
    flex: 1;
    min-width: 0;
}

.freshdesk-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--blue);
    text-decoration: none;
    white-space: nowrap;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    flex-shrink: 0;
    margin-top: 2px;
}

.freshdesk-link:hover {
    background: #e3f2fd;
    border-color: var(--blue);
}

.ticket-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--gray-600);
}

.ticket-meta-item { display: flex; align-items: center; gap: 0.35rem; }
.ticket-meta-label { font-weight: 600; color: var(--gray-500); }

.ticket-description {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.92rem;
    line-height: 1.7;
}

.conversation-list {
    padding: 0;
}

.conversation-item {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.conversation-item:last-child { border-bottom: none; }

.conv-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.conv-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--white);
    flex-shrink: 0;
}

.conv-avatar.agent { background: var(--blue); }
.conv-avatar.customer { background: var(--gray-500); }
.conv-avatar.note { background: var(--orange); }

.conv-name { font-weight: 600; font-size: 0.88rem; color: var(--gray-900); }
.conv-date { font-size: 0.78rem; color: var(--gray-500); margin-left: auto; }
.conv-type { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.conv-type.reply { color: var(--blue); }
.conv-type.note { color: var(--orange); }

.conv-body {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--gray-800);
    padding-left: 2.75rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.conv-body img { max-width: 100%; height: auto; }
.conv-body a { color: var(--blue); text-decoration: underline; }
.conv-body blockquote { border-left: 3px solid var(--gray-300); padding-left: 0.75rem; margin: 0.5rem 0; color: var(--gray-600); }
.conv-body p { margin-bottom: 0.5rem; }
.conv-body ul, .conv-body ol { padding-left: 1.5rem; margin-bottom: 0.5rem; }
.conv-body table { border-collapse: collapse; max-width: 100%; margin-bottom: 0.5rem; }
.conv-body td, .conv-body th { padding: 0.25rem 0.5rem; border: 1px solid var(--gray-300); }

.ticket-description a { color: var(--blue); text-decoration: underline; }
.ticket-description p { margin-bottom: 0.5rem; }
.ticket-description blockquote { border-left: 3px solid var(--gray-300); padding-left: 0.75rem; margin: 0.5rem 0; color: var(--gray-600); }
.ticket-description ul, .ticket-description ol { padding-left: 1.5rem; margin-bottom: 0.5rem; }
.ticket-description table { border-collapse: collapse; max-width: 100%; margin-bottom: 0.5rem; }
.ticket-description td, .ticket-description th { padding: 0.25rem 0.5rem; border: 1px solid var(--gray-300); }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--blue);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 1rem;
    cursor: pointer;
}

.back-link:hover { text-decoration: underline; }

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
}

.page-btn {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--gray-700);
    cursor: pointer;
}

.page-btn:hover { border-color: var(--blue); color: var(--blue); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-btn.active { background: var(--blue); color: var(--white); border-color: var(--blue); }
.page-info { font-size: 0.82rem; color: var(--gray-500); }

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--gray-500);
}

.empty-state svg { margin-bottom: 1rem; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; }

/* ── Timer Bar ── */
.timer-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--navy);
    border-radius: var(--radius-lg);
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.timer-display {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--white);
}

.timer-display svg { color: var(--blue-accent); }

.timer-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--white);
}

.timer-btn.pause { background: rgba(255,255,255,0.15); }
.timer-btn.play { background: var(--green); }
.timer-btn:hover { opacity: 0.85; }

.timer-others {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: 0.5rem;
}

.timer-other-badge {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.1);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

.timer-prompt {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--navy-light);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    animation: slideUp 0.3s ease-out;
    max-width: 280px;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.timer-prompt-text {
    color: var(--white);
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.timer-prompt-actions {
    display: flex;
    gap: 0.5rem;
}

.timer-prompt-yes {
    padding: 0.4rem 0.75rem;
    background: var(--blue-accent);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
}

.timer-prompt-yes:hover { opacity: 0.85; }

.timer-prompt-no {
    padding: 0.4rem 0.75rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
}

.timer-prompt-no:hover { background: rgba(255,255,255,0.05); }

.call-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.call-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--green); color: var(--green); }
.call-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.resolve-btn {
    padding: 0.35rem 0.85rem;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--green);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    margin-left: auto;
}

.resolve-btn:hover { background: #15803d; }

.timer-bar .freshdesk-link {
    color: rgba(255,255,255,0.6);
    border-color: rgba(255,255,255,0.2);
    font-size: 0.72rem;
}

.timer-bar .freshdesk-link:hover {
    color: var(--white);
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.4);
}

/* ── Active Call Bar ── */
.call-bar {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    background: var(--green);
    color: var(--white);
    padding: 0.6rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 300;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
}

.call-bar-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    font-weight: 600;
}

.call-bar-pulse {
    width: 10px;
    height: 10px;
    background: var(--white);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.call-bar-ticket { font-weight: 400; opacity: 0.8; font-size: 0.82rem; }

.call-bar-duration {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    margin-left: auto;
}

.call-bar-end {
    padding: 0.35rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.2);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.call-bar-end:hover { background: rgba(255,255,255,0.3); }

/* ── Resolve Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 400;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 480px;
    overflow: hidden;
}

.modal-header {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--navy);
    padding: 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-body { padding: 1.25rem; }

.modal-field {
    margin-bottom: 0.85rem;
}

.modal-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.modal-field input[type="number"],
.modal-field input[type="text"] {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: var(--gray-800);
}

.modal-field input:focus,
.modal-field select:focus { border-color: var(--blue); outline: none; }

.modal-field .filter-select { width: 100%; }

.modal-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    flex-wrap: wrap;
}

.resolve-skip-btn {
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
}

.resolve-skip-btn:hover { border-color: var(--orange); color: var(--orange); }

.modal-cancel {
    padding: 0.5rem 0.85rem;
    border: none;
    background: none;
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--gray-500);
    cursor: pointer;
    margin-left: auto;
}

.modal-cancel:hover { color: var(--gray-800); }

/* ── Filter Input ── */
.filter-input {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--gray-700);
    width: 100%;
}

.filter-input:focus { border-color: var(--blue); outline: none; }

/* ── Call Log Badges ── */
.badge-inbound { background: #e8f5e9; color: #2e7d32; }
.badge-outbound { background: #e3f2fd; color: #1565c0; }

/* ── Timecard Summary ── */
.timecard-summary {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.tc-stat {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
}

.tc-stat-number {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--navy);
}

.tc-stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    margin-top: 0.15rem;
}

/* ── Grid Layouts ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* ── Responsive ── */
@media (max-width: 1024px) {
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .content-area { padding: 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .search-box { width: 180px; }
    .ticket-table { font-size: 0.82rem; }
    .ticket-table th, .ticket-table td { padding: 0.5rem 0.6rem; }
    .call-bar { left: 0; }
    .timer-bar { gap: 0.4rem; }
    .call-btn { font-size: 0.72rem; padding: 0.3rem 0.5rem; }
    .timecard-summary { flex-wrap: wrap; }
    .tc-stat { min-width: 45%; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .search-box { display: none; }
}

/* ── Sidebar overlay for mobile ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
}

.sidebar-overlay.active { display: block; }

/* ── Activity Panel ── */
.activity-panel {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(50vh - var(--topbar-height) - 1rem);
    min-height: 200px;
}

.activity-header {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--navy);
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.activity-stream {
    overflow-y: auto;
    flex: 1;
}

.activity-loading {
    display: flex;
    justify-content: center;
    padding: 2rem 0;
}

.activity-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--gray-400);
    font-size: 0.85rem;
}

.activity-item {
    display: flex;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    text-decoration: none;
    color: inherit;
    transition: background 0.1s;
    cursor: pointer;
}

.activity-item:hover { background: #f8fafd; }
.activity-item:last-child { border-bottom: none; }

.act-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.act-icon.act-reply { background: #e3f2fd; color: var(--blue); }
.act-icon.act-note { background: #fff8e1; color: var(--orange); }
.act-icon.act-customer { background: var(--gray-200); color: var(--gray-600); }
.act-icon.act-update { background: var(--purple-light); color: var(--purple); }

.act-content { flex: 1; min-width: 0; }

.act-actor {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.3;
}

.act-label { font-weight: 400; color: var(--gray-500); }

.act-subject {
    font-size: 0.78rem;
    color: var(--blue);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.act-snippet {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 2px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.act-time {
    font-size: 0.72rem;
    color: var(--gray-400);
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ── User Avatar (top bar) ── */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--blue);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: default;
    flex-shrink: 0;
}

/* ── Reply Composer ── */
.reply-composer {
    padding: 1.25rem 1.5rem;
    border-top: 2px solid var(--gray-200);
    background: var(--gray-50);
}

.reply-composer.note-mode {
    background: #fffbeb;
    border-top-color: var(--orange);
}

.reply-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    overflow: hidden;
    width: fit-content;
}

.reply-toggle-btn {
    padding: 0.4rem 1rem;
    border: none;
    background: var(--white);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.15s;
}

.reply-toggle-btn:not(:last-child) {
    border-right: 1px solid var(--gray-300);
}

.reply-toggle-btn.active {
    background: var(--blue);
    color: var(--white);
}

.note-mode .reply-toggle-btn.active {
    background: var(--orange);
}

.reply-identity {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.reply-identity strong {
    color: var(--gray-800);
}

.reply-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--gray-900);
    background: var(--white);
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s;
}

.reply-textarea:focus {
    outline: none;
    border-color: var(--blue);
}

.note-mode .reply-textarea:focus {
    border-color: var(--orange);
}

.reply-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.reply-send-btn {
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    background: var(--blue);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.reply-send-btn:hover { background: var(--blue-dark); }
.reply-send-btn:active { transform: scale(0.98); }
.reply-send-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.note-mode .reply-send-btn {
    background: var(--orange);
}

.note-mode .reply-send-btn:hover {
    background: #a86a1f;
}

.reply-status {
    font-size: 0.82rem;
    font-weight: 600;
}

.reply-status.success { color: var(--green); }
.reply-status.error { color: var(--red); }

/* ── Filter Dropdowns ── */
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filter-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
}

.filter-select {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    min-width: 140px;
}

.filter-select:focus { border-color: var(--blue); outline: none; }

.filter-count {
    margin-left: auto;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-500);
}

/* ── Agent columns ── */
.agent-assigned { font-size: 0.85rem; color: var(--gray-700); font-weight: 600; white-space: nowrap; }
.agent-unassigned { font-size: 0.85rem; color: var(--red); font-weight: 600; font-style: italic; white-space: nowrap; }
.ticket-group { font-size: 0.8rem; color: var(--gray-500); white-space: nowrap; }
.unassigned-row { background: #fffbeb; }
.unassigned-row:hover { background: #fef3c7 !important; }

/* ── Responsive tweaks for layout ── */
@media (max-width: 1200px) {
    .dashboard-layout { grid-template-columns: 1fr; }
    .activity-sidebar {
        position: static;
        max-height: none;
        flex-direction: row;
    }
    .activity-panel {
        max-height: 400px;
        flex: 1;
        min-width: 0;
    }
}

@media (max-width: 768px) {
    .filter-bar { gap: 0.75rem; }
    .filter-select { min-width: 110px; font-size: 0.78rem; }
    .ticket-table .ticket-subject { max-width: 200px; }
}
