:root {
    --sidebar-bg: #1B4332;
    --sidebar-text: rgba(255, 255, 255, 0.9);
    --sidebar-muted: rgba(255, 255, 255, 0.5);
    --active-gold: #C9A84C;
    --active-bg: rgba(201, 168, 76, 0.15);
    --page-bg: #F8F9FA;
    --card-bg: #FFFFFF;
    --text-primary: #333333;
    --text-muted: #888888;
    --border: #E0E0E0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --radius: 8px;
    --green-dark: #1B4332;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--page-bg);
    color: var(--text-primary);
}

a {
    color: inherit;
    text-decoration: none;
}

.app-body {
    min-height: 100vh;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1200;
    background: var(--green-dark);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 18px;
    cursor: pointer;
}

.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1100;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
    padding: 20px 16px 12px;
}

.sidebar-brand-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.sidebar-brand-sub {
    font-size: 0.75rem;
    color: var(--sidebar-muted);
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0 16px;
}

.nav-section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.65;
    padding: 12px 16px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.9rem;
    color: var(--sidebar-text);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
    background: var(--active-bg);
    border-left-color: var(--active-gold);
}

.nav-item[data-tooltip] {
    position: relative;
}

.nav-item[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translate(8px, -50%);
    background: #111;
    color: #fff;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 2000;
    pointer-events: none;
}

.nav-icon {
    width: 18px;
    text-align: center;
    opacity: 0.9;
}

.sidebar-user {
    padding: 12px 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.8rem;
}

.sidebar-user-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.sidebar-user-name {
    font-weight: 600;
}

.sidebar-user-email {
    opacity: 0.8;
    word-break: break-all;
}

.sidebar-user-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ecc71;
}

.sidebar-logout {
    display: inline-block;
    margin-top: 10px;
    color: var(--active-gold);
    font-weight: 500;
}

.main-area {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-content {
    padding: 32px;
    flex: 1;
}

.top-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 32px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.notif-wrap {
    position: relative;
}

.notif-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 320px;
    max-height: 400px;
    overflow: auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 1300;
    padding: 0 0 8px;
}

.notif-dropdown[hidden] {
    display: none !important;
}

.notif-dropdown-title {
    font-weight: 600;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.notif-list {
    max-height: 300px;
    overflow-y: auto;
}

.notif-item {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    text-align: left;
    width: 100%;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    font: inherit;
    color: inherit;
}

.notif-item.unread {
    background: #f9fafb;
}

.notif-item-title {
    font-weight: 600;
    font-size: 0.85rem;
}

.notif-item-body {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.notif-item-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.notif-mark-all {
    width: 100%;
    margin-top: 4px;
    padding: 8px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--green-dark);
    font-family: inherit;
}

.notif-bell {
    position: relative;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: #c0392b;
    color: #fff;
    font-size: 0.65rem;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 4px;
}

.page-subtitle {
    color: var(--text-muted);
    margin: 0 0 20px;
}

.flash {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    background: #fff8e6;
    color: var(--text-primary);
}

.flash-error {
    background: #fdecea;
    border-color: #f5c6cb;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-icon {
    font-size: 1.5rem;
    opacity: 0.35;
}

.two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.panel {
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    padding: 16px;
}

.panel-title {
    font-weight: 600;
    margin: 0 0 12px;
}

.empty-state {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 12px 0;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.qa-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
}

.qa-btn.primary {
    background: var(--green-dark);
    color: #fff;
    border-color: var(--green-dark);
}

.qa-btn.primary:hover:not(:disabled) {
    background: var(--active-gold);
    border-color: var(--active-gold);
    color: var(--text-primary);
}

.qa-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
}

.btn-primary {
    background: var(--green-dark);
    color: #fff;
}

.btn-primary:hover {
    background: var(--active-gold);
    color: var(--text-primary);
}

.btn-secondary {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--page-bg);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    padding: 28px 28px 32px;
    border: 1px solid var(--border);
}

.login-logo {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--green-dark);
    margin-bottom: 8px;
}

.login-sub {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 22px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-family: inherit;
}

.form-error {
    color: #c0392b;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.member-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.member-card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border);
    padding: 16px;
    position: relative;
}

.member-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
}

.avatar-super_admin { background: #0f2a1f; }
.avatar-admin { background: #1B4332; }
.avatar-hr { background: #1d6fb8; }
.avatar-accounts { background: #7d3cff; }
.avatar-sales_manager { background: #e67e22; }
.avatar-employee { background: #7f8c8d; }

.member-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.badge-you {
    font-size: 0.65rem;
    background: var(--active-gold);
    color: var(--text-primary);
    padding: 2px 6px;
    border-radius: 999px;
    font-weight: 700;
}

.role-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 999px;
    font-weight: 600;
    text-transform: capitalize;
}

.rb-super_admin { background: #d1e7dd; color: #0f2a1f; }
.rb-admin { background: #d8f3e4; color: #1B4332; }
.rb-hr { background: #dbeafe; color: #1d4ed8; }
.rb-accounts { background: #ede9fe; color: #5b21b6; }
.rb-sales_manager { background: #ffedd5; color: #c2410c; }
.rb-employee { background: #e5e7eb; color: #374151; }

.status-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 999px;
    font-weight: 600;
}

.st-active { background: #d1fae5; color: #065f46; }
.st-suspended { background: #fee2e2; color: #991b1b; }
.st-invited { background: #fef3c7; color: #92400e; }
.st-deleted { background: #e5e7eb; color: #4b5563; }

.member-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.5;
}

.menu-wrap {
    position: absolute;
    top: 12px;
    right: 12px;
}

.menu-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px 8px;
    border-radius: 6px;
}

.menu-btn:hover {
    background: #f3f4f6;
}

.dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    min-width: 180px;
    display: none;
    z-index: 50;
}

.dropdown.open {
    display: block;
}

.dropdown button,
.dropdown a {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: none;
    background: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.dropdown button:hover,
.dropdown a:hover {
    background: #f9fafb;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.search-input {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    min-width: 240px;
    font-family: inherit;
}

/* Modal Overlay */
.modal-overlay,
.modal-backdrop,
[class*="modal-overlay"],
[class*="modal-backdrop"] {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2400;
    display: none;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 40px 16px;
    box-sizing: border-box;
}

.modal-overlay.open,
.modal-backdrop.open {
    display: flex;
}

/* Modal Content Box */
.modal,
.modal-content,
.modal-box,
.modal-card,
[class*="modal-content"],
[class*="modal-box"] {
    background: #ffffff;
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    position: relative;
    margin: auto;
    box-sizing: border-box;
}

/* Wide modals (for forms with many fields) */
.modal-wide,
.modal-content-wide {
    max-width: 720px;
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h2,
.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #333333;
    margin: 0;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #333333;
    margin: 0 0 20px;
}

/* Modal Close Button */
.modal-close,
.modal-header .close-btn,
[class*="modal-close"] {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #888888;
    padding: 4px;
    line-height: 1;
    position: absolute;
    top: 20px;
    right: 20px;
}

.modal-close:hover {
    color: #333333;
}

/* Modal Body */
.modal-body {
    max-height: none;
    overflow: visible;
}

/* Modal Footer / Actions */
.modal-footer,
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
}

.invite-result {
    margin-top: 14px;
    padding: 12px;
    border-radius: 8px;
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    font-size: 0.85rem;
    word-break: break-all;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.role-pill {
    display: inline-block;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    text-transform: capitalize;
}

.setup-box {
    max-width: 520px;
    margin: 48px auto;
    background: #fff;
    padding: 24px;
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: inline-flex;
    }
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-area {
        margin-left: 0;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .two-col,
    .member-grid {
        grid-template-columns: 1fr;
    }
}

.login-card-wide {
    max-width: 420px;
    border-radius: 12px;
}

.password-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.password-input-row input {
    flex: 1;
}

.password-toggle {
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 1rem;
}

.credentials-box {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: #eef7f2;
    border: 1px solid #7cb89a;
    font-size: 0.85rem;
    line-height: 1.5;
}

.credentials-box code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
}

.team-stats-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.team-stat {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px 14px;
}

.team-stat .label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.team-stat .value {
    font-size: 1.25rem;
    font-weight: 700;
}

.sidebar-session {
    font-size: 0.75rem;
    color: var(--sidebar-muted);
    margin-bottom: 10px;
}

.sidebar-user-emp {
    font-size: 0.75rem;
    color: var(--sidebar-muted);
    margin-top: 2px;
}

.av-role-super_admin { border: 2px solid var(--active-gold); }
.av-role-admin { border: 2px solid rgba(255, 255, 255, 0.35); }
.av-role-hr { border: 2px solid #60a5fa; }
.av-role-accounts { border: 2px solid #c4b5fd; }
.av-role-sales_manager { border: 2px solid #fdba74; }
.av-role-employee { border: 2px solid rgba(255, 255, 255, 0.2); }

.stats-grid-icons {
    gap: 16px;
}

.stat-card-icon {
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}

.stat-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(27, 67, 50, 0.1);
    color: var(--green-dark);
    font-size: 1.1rem;
}

.quick-actions-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.qa-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card-bg);
    box-shadow: var(--shadow);
    cursor: pointer;
    font-family: inherit;
    color: var(--text-primary);
    position: relative;
}

.qa-card:hover {
    border-color: var(--active-gold);
}

.qa-card-icon {
    font-size: 1.5rem;
}

.qa-card-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.empty-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.35;
}

.btn-danger {
    background: #fff;
    color: #c0392b;
    border: 1px solid #c0392b;
}

.btn-danger:hover {
    background: #c0392b;
    color: #fff;
}

.idle-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
}

.idle-modal.open {
    display: flex;
}

.idle-modal-card {
    background: #fff;
    border-radius: 12px;
    padding: 22px 24px;
    max-width: 400px;
    width: 90%;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.idle-countdown {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 12px 0;
    text-align: center;
}

@media (max-width: 1024px) {
    .team-stats-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .member-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* --- Phase 2 CRM --- */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.agent-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 1100px) {
    .agent-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .agent-card-grid {
        grid-template-columns: 1fr;
    }
}

.agent-card {
    position: relative;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 16px 16px 16px 16px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.agent-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.template-card .agent-card-avatar {
    font-size: 1.5rem;
}

.agent-card-menu-wrap {
    position: absolute;
    top: 8px;
    right: 8px;
}

.menu-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-muted);
    padding: 4px 8px;
    line-height: 1;
}

.agent-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 160px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--border);
    z-index: 100;
    display: none;
    flex-direction: column;
    padding: 4px 0;
}

.agent-dropdown.open {
    display: flex;
}

.agent-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.agent-card-title {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.agent-card-muted {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 4px;
}

.agent-card-row {
    font-size: 0.9rem;
    margin: 4px 0;
}

.tick-yes {
    color: #2e7d32;
    font-weight: 700;
}

.status-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.status-pill:hover {
    border-color: var(--active-gold);
}

.status-pill.active {
    background: var(--sidebar-bg);
    color: #fff;
    border-color: var(--sidebar-bg);
}

.status-pill-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.pill-blue {
    background: #e3f2fd;
    color: #1565c0;
}

.pill-green {
    background: #e8f5e9;
    color: #2e7d32;
}

.pill-purple {
    background: #f3e5f5;
    color: #6a1b9a;
}

.pill-amber {
    background: #fff8e1;
    color: #f57f17;
}

.pill-red {
    background: #ffebee;
    color: #c62828;
}

.pill-grey {
    background: #f5f5f5;
    color: #616161;
}

.call-log-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.call-log-card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    border-left-width: 4px;
    padding: 12px 14px;
}

.call-border-green {
    border-left-color: #2e7d32;
}

.call-border-grey {
    border-left-color: #9e9e9e;
}

.call-border-blue {
    border-left-color: #1565c0;
}

.call-border-gold {
    border-left-color: var(--active-gold);
}

.call-border-default {
    border-left-color: var(--border);
}

.call-log-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.call-icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-muted);
}

.call-agent-link {
    color: var(--green-dark);
    font-weight: 600;
}

.call-notes {
    font-size: 0.9rem;
    margin: 6px 0;
    max-height: 4.5em;
    overflow: hidden;
}

.follow-up-date {
    color: #1565c0;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 4px 0;
}

.call-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
    font-size: 0.85rem;
}

.call-del {
    border: none;
    background: none;
    color: #c62828;
    cursor: pointer;
    text-decoration: underline;
    font: inherit;
}

.email-list-wrap {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.email-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
}

.email-row:last-child {
    border-bottom: none;
}

.email-row:hover {
    background: #fafafa;
}

.email-row-icon {
    font-size: 1.25rem;
    opacity: 0.6;
}

.email-row-main {
    flex: 1;
    min-width: 0;
}

.smtp-warn {
    background: #fff8e1;
    border: 1px solid #ffe082;
    color: #6d4c41;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.info-tip-box {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    color: #0d47a1;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.info-tip-box code {
    background: rgba(255, 255, 255, 0.7);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

.btn-danger-text {
    color: #c62828 !important;
}

.task-card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-card {
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    background: var(--card-bg);
    border-left: 4px solid var(--border);
    padding-left: 0;
}

.task-pri-urgent {
    border-left-color: #c62828;
}

.task-pri-high {
    border-left-color: #ef6c00;
}

.task-pri-medium {
    border-left-color: #1565c0;
}

.task-pri-low {
    border-left-color: #9e9e9e;
}

.task-due-overdue {
    background: #fff5f5;
}

.task-due-today {
    background: #fffbf0;
}

.task-card-inner {
    padding: 14px 16px 14px 18px;
}

.task-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.task-card-actions {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.task-tab-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
}

.task-tab {
    padding: 8px 14px;
    border-radius: 999px 999px 0 0;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -5px;
}

.task-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--active-gold);
}

.dash-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dash-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.dash-list li:last-child {
    border-bottom: none;
}

.globly-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 4000;
    padding: 12px 18px;
    border-radius: 8px;
    background: #2e7d32;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.globly-toast-error {
    background: #c62828;
}

.globly-toast-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Phase 3: Sales, contracts, certifications, settings, webhooks --- */

.sales-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.sales-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.sales-tab {
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.sales-tab.active {
    border-color: var(--active-gold);
    color: var(--green-dark);
    background: var(--active-bg);
}

.sales-table-wrap {
    margin-top: 8px;
}

.sales-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.sales-table thead th {
    text-align: left;
    padding: 12px 10px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: #fafafa;
}

.sales-table tbody tr:nth-child(even) {
    background: #f6f8f7;
}

.sales-table tbody tr:nth-child(odd) {
    background: var(--card-bg);
}

.sales-table tbody td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.sales-table tbody tr:hover {
    background: rgba(201, 168, 76, 0.08);
}

.source-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.source-pill.source-auto {
    background: #dcfce7;
    color: #166534;
}

.source-pill.source-manual {
    background: #e5e7eb;
    color: #4b5563;
}

.contracts-table-wrap .sales-table,
.contracts-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.contracts-table-wrap tbody tr:nth-child(even) {
    background: #f6f8f7;
}

.contracts-table-wrap tbody tr:nth-child(odd) {
    background: var(--card-bg);
}

.contracts-table-wrap tbody tr:hover {
    background: rgba(201, 168, 76, 0.08);
}

.cert-card-border-warn {
    border: 2px solid #f59e0b !important;
}

.cert-card-border-expired {
    border: 2px solid #dc2626 !important;
}

.cert-days-amber {
    color: #b45309;
    font-weight: 600;
}

.cert-days-red {
    color: #b91c1c;
    font-weight: 600;
}

.expiry-alert-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: var(--radius);
    color: #92400e;
    font-weight: 600;
}

.settings-section-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.settings-section-title {
    margin: 0 0 16px;
    padding-left: 12px;
    border-left: 4px solid var(--active-gold);
    font-size: 1.15rem;
}

.settings-subheading {
    margin: 20px 0 10px;
    font-size: 1rem;
    color: var(--text-primary);
}

.settings-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px 18px;
}

.settings-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 8px 0 0;
}

.settings-inline-msg {
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.pwd-toggle-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pwd-toggle-wrap input {
    flex: 1;
}

.btn-pwd-toggle {
    flex-shrink: 0;
    white-space: nowrap;
}

.globly-info-box {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: var(--radius);
    border-left: 4px solid #1d4ed8;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.9rem;
}

.globly-info-box code,
.settings-code-block {
    font-family: ui-monospace, monospace;
    font-size: 0.82rem;
}

.settings-code-block {
    background: rgba(255, 255, 255, 0.8);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    border: 1px solid rgba(29, 78, 216, 0.2);
}

.webhook-log-wrap {
    margin-top: 8px;
}

.webhook-log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.webhook-log-table th,
.webhook-log-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.webhook-log-table .wh-event {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.85rem;
}

/* --- Phase 4: HR, attendance, payroll, screen time --- */

.hr-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.hr-cal-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.att-cal-scroll {
    overflow-x: auto;
    margin-bottom: 12px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--card-bg);
}

.att-cal-table {
    border-collapse: collapse;
    min-width: max-content;
    font-size: 0.8rem;
}

.att-cal-table th,
.att-cal-table td {
    border: 1px solid var(--border);
    width: 36px;
    height: 36px;
    text-align: center;
    vertical-align: middle;
    padding: 2px;
}

.att-cal-namecell {
    width: 160px !important;
    min-width: 140px;
    text-align: left !important;
    padding: 6px 10px !important;
    position: sticky;
    left: 0;
    background: var(--card-bg);
    z-index: 1;
    font-weight: 600;
}

.att-cal-dayhead.att-cal-today {
    background: #e8f5e9;
}

.att-cal-dayhead.att-cal-weekend {
    background: #fafafa;
}

.att-dash {
    color: #bbb;
}

.att-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.att-dot-present {
    background: #2e7d32;
}

.att-dot-absent {
    background: #c62828;
}

.att-dot-late {
    background: #f59e0b;
}

.att-half {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(90deg, #fbbf24 50%, #e5e7eb 50%);
}

.att-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 4px;
    color: #fff;
}

.att-b-al {
    background: #1565c0;
}

.att-b-cl {
    background: #0d9488;
}

.att-b-sl {
    background: #db2777;
}

.att-b-nh {
    background: #7c3aed;
}

.att-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.btn-clock-in {
    background: #1b4332;
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
}

.btn-clock-out {
    background: #dc2626;
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
}

.hr-working-display {
    font-family: ui-monospace, Consolas, monospace;
    font-weight: 700;
    font-size: 0.95rem;
}

.leave-row-pending {
    border-left: 4px solid #f59e0b;
}

.leave-row-approved {
    border-left: 4px solid #2e7d32;
}

.leave-row-rejected {
    border-left: 4px solid #c62828;
    opacity: 0.85;
}

.holiday-row-upcoming {
    background: #fffbeb;
}

.payroll-net {
    font-weight: 700;
    color: #2e7d32;
}

.payroll-ded {
    font-weight: 600;
    color: #333;
}

.payroll-rec-table .payroll-ded {
    color: #c62828;
}

.payroll-status-processing {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.75rem;
    font-weight: 600;
}

.payroll-status-paid {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 0.75rem;
    font-weight: 600;
}

.payroll-status-hold {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 0.75rem;
    font-weight: 600;
}

.st-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.st-badge-manual {
    background: #e5e7eb;
    color: #374151;
}

.st-badge-idle {
    background: #fef3c7;
    color: #92400e;
}

.st-badge-admin {
    background: #fee2e2;
    color: #991b1b;
}

.st-badge-exp {
    background: #dbeafe;
    color: #1e40af;
}

.st-idle-flag {
    color: #dc2626;
    cursor: help;
    margin-left: 4px;
}

.st-active-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    animation: st-pulse 1.2s ease-in-out infinite;
}

@keyframes st-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.45;
    }
}

.dash-emp-clock-panel .hr-toolbar-actions {
    margin-top: 8px;
}

/* --- Phase 5: header chat + sidebar unread --- */
.top-header {
    gap: 12px;
}

.header-chat-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--text-primary);
    margin-right: 4px;
}

.header-chat-link:hover {
    background: #f0f4f1;
}

.header-chat-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.header-chat-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #c9a84c;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
}

.nav-chat-unread-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #c9a84c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
}

.nav-item.nav-chat-has-unread {
    font-weight: 600;
}

/* --- Phase 5: Team Chat --- */
.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    height: calc(100vh - 60px);
    overflow: hidden;
    background: #f8f9fa;
}

.chat-inner-shell {
    display: flex;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    background: var(--card-bg);
}

.chat-left,
.chat-left-panel {
    position: relative;
    width: 300px;
    min-width: 300px;
    flex-shrink: 0;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: #fff;
}

.chat-oversight-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.chat-left-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}

.chat-left-title {
    font-weight: 700;
    font-size: 1rem;
}

.chat-new-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
    font-weight: 700;
}

.chat-search {
    margin: 0 12px 8px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
}

.chat-conv-list,
.chat-conversations-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.chat-conv-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    border-left: 3px solid transparent;
    position: relative;
}

.chat-conv-item:hover {
    background: #f5f5f5;
}

.chat-conv-item.active {
    border-left-color: #c9a84c;
    background: #fffbf0;
}

.chat-av-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.chat-av {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    background: #eef4ee;
    color: var(--green-dark);
    position: relative;
}

.chat-av-wrap .chat-online-dot {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #fff;
}

.chat-conv-meta {
    flex: 1;
    min-width: 0;
}

.chat-conv-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.chat-conv-preview {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-conv-right {
    text-align: right;
    flex-shrink: 0;
}

.chat-conv-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.chat-unread-badge {
    display: inline-block;
    margin-top: 4px;
    min-width: 18px;
    padding: 0 6px;
    height: 18px;
    line-height: 18px;
    border-radius: 999px;
    background: #c9a84c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.chat-preview-new {
    font-style: italic;
    color: #888888;
}

.chat-role-pill {
    display: inline-block;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 6px;
    background: #eef4ee;
    color: #333;
    font-weight: 600;
    vertical-align: middle;
}

.chat-new-member-modal {
    z-index: 2000 !important;
}

.chat-modal-search {
    width: 100%;
    margin: 12px 0 0;
    box-sizing: border-box;
}

.chat-modal-member-list {
    max-height: 55vh;
    overflow-y: auto;
    margin-top: 8px;
    text-align: left;
}

.chat-member-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
    width: 100%;
    border: 1px solid transparent;
    background: #fff;
    font-family: inherit;
}

.chat-member-row:hover {
    background: #f5f5f5;
}

.chat-right,
.chat-right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #f8f9fa;
}

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.chat-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.35;
}

.chat-thread {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.chat-topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.chat-topbar-name {
    font-weight: 700;
}

.chat-topbar-status {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 0;
}

.chat-load-earlier {
    text-align: center;
    margin-bottom: 12px;
}

.chat-msg-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 12px;
    max-width: 100%;
}

.chat-msg-row.mine {
    align-items: flex-end;
}

.chat-bubble {
    max-width: 70%;
    padding: 10px 14px;
    word-break: break-word;
}

.chat-bubble-own {
    background: #1b4332;
    color: #fff;
    border-radius: 18px 18px 4px 18px;
}

.chat-bubble-other {
    background: #fff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 18px 18px 18px 4px;
}

.chat-msg-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 6px;
}

.chat-msg-row.mine .chat-msg-time {
    text-align: right;
}

.chat-img-thumb {
    max-width: 200px;
    height: auto;
    border-radius: 8px;
    display: block;
}

.chat-date-divider {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 16px 0;
    position: relative;
}

.chat-date-divider::before,
.chat-date-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 38%;
    height: 1px;
    background: var(--border);
}

.chat-date-divider::before {
    left: 0;
}

.chat-date-divider::after {
    right: 0;
}

.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

.chat-attach-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
}

.chat-text-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-family: inherit;
    resize: none;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #c9a84c;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
}

.chat-readonly-banner {
    padding: 8px 16px;
    background: #fffbeb;
    font-size: 0.85rem;
    color: #92400e;
}

.chat-file-preview {
    padding: 8px 16px 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: #fff;
    border-top: 1px dashed var(--border);
}

.chat-av-wrap .chat-av.av-role-super_admin {
    border: 2px solid #c9a84c;
}

.chat-av-wrap .chat-av.av-role-admin {
    border: 2px solid #94a3b8;
}

.chat-av-wrap .chat-av.av-role-hr {
    border: 2px solid #60a5fa;
}

.chat-av-wrap .chat-av.av-role-accounts {
    border: 2px solid #c4b5fd;
}

.chat-av-wrap .chat-av.av-role-sales_manager {
    border: 2px solid #fdba74;
}

.chat-av-wrap .chat-av.av-role-employee {
    border: 2px solid #cbd5e1;
}

/* --- Phase 5: Browser --- */
.browser-main-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: calc(100vh - 60px);
    overflow: hidden;
}

.browser-notice {
    background: #fffbeb;
    font-size: 0.78rem;
    padding: 6px 16px;
    color: #78350f;
}

.browser-toolbar {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 8px 16px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.browser-address {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 6px 16px;
    font-family: inherit;
}

.browser-start {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    background: #f8f9fa;
}

.browser-start-inner {
    text-align: center;
    color: var(--text-muted);
}

.browser-start-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--green-dark);
    margin-bottom: 8px;
}

.browser-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}

.browser-frame {
    flex: 1;
    width: 100%;
    min-height: 0;
    height: calc(100vh - 160px);
    border: none;
    background: #fff;
}

.browser-history-section {
    border-top: 1px solid var(--border);
    background: #fff;
    padding: 8px 16px;
}

.browser-history-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

/* --- Phase 5: Reports --- */
.reports-toolbar-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.reports-range-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.reports-range-pills .pill {
    border: 1px solid var(--border);
    background: #fff;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}

.reports-range-pills .pill.active {
    background: #1b4332;
    color: #fff;
    border-color: #1b4332;
}

.btn-reports-export {
    border: 1px solid #1b4332;
    color: #1b4332;
    background: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.btn-reports-export:hover {
    background: #1b4332;
    color: #fff;
}

.chart-card {
    background: #fff;
    box-shadow: var(--shadow);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.chart-card-title {
    font-weight: 700;
    color: #333;
    margin-bottom: 16px;
}

.reports-chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .reports-chart-row {
        grid-template-columns: 1fr;
    }

    .chat-inner-shell {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 60px);
    }

    .chat-left,
    .chat-left-panel {
        width: 100%;
        min-width: 0;
        max-height: 240px;
    }
}

.rep-row-expired {
    background: #fdecea !important;
}

.rep-row-amber {
    background: #fff8e6 !important;
}

.nav-icon .fas {
    font-size: 0.95rem;
}

.chart-body {
    position: relative;
    min-height: 280px;
}

.chart-body canvas {
    max-height: 360px;
}

.chart-empty-msg {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    color: #888888;
    font-size: 0.95rem;
    padding: 24px;
}

.guide-step {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
}

.guide-step-number {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: #1b4332;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.guide-step-content {
    flex: 1;
}

.guide-step-content h3 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 16px;
}

.code-block {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px 16px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #1b4332;
    position: relative;
    margin: 8px 0;
}

.code-block pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 11px;
    background: #1b4332;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
}

.copy-btn:hover {
    opacity: 0.92;
}

.amber-notice {
    background: #fffbeb;
    border-left: 4px solid #c9a84c;
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
    margin: 16px 0;
}

@media print {
    .sidebar,
    .top-header,
    .no-print {
        display: none !important;
    }

    .page-content {
        margin: 0 !important;
        padding: 20px !important;
    }
}
