/* ================================================================
   GeniusPayHR Admin Portal - Design System CSS
   Based on PRD Design System
   ================================================================ */

/* ─── CSS Variables ───────────────────────────────────────────── */
:root {
    --primary: #2563EB;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --primary-lighter: #eff6ff;

    --dark-text: #0F172A;
    --body-text: #0F172A;
    --muted-text: #64748b;
    --light-text: #94a3b8;

    --light-bg: #F8FAFC;
    --white: #ffffff;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    --success: #16A34A;
    --success-bg: #dcfce7;
    --success-text: #166534;

    --warning: #F59E0B;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;

    --error: #DC2626;
    --error-bg: #fee2e2;
    --error-text: #991b1b;

    --info: #0ea5e9;
    --info-bg: #e0f2fe;
    --info-text: #0369a1;

    --purple: #7c3aed;
    --purple-bg: #f3e8ff;
    --purple-text: #7c3aed;

    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    --login-gradient-start: #667eea;
    --login-gradient-end: #764ba2;

    --transition: all 0.3s ease;
}

/* ─── Base Styles ─────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.6;
    color: var(--body-text);
    background-color: var(--light-bg);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--dark-text);
    font-weight: 600;
    margin-top: 0;
    line-height: 1.3;
}

/* Override Bootstrap 5 responsive font sizes (RFS) globally.
   Bootstrap uses calc() values that inflate headings beyond our design system.
   site.css loads after bootstrap.min.css, so same-specificity rules win by cascade order. */
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
h5 { font-size: 14px; }
h6 { font-size: 13px; }

a {
    text-decoration: none;
    color: inherit;
}

/* ─── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--white);
    border-right: 1px solid var(--border-color);
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    flex-shrink: 0;
}

.sidebar-logo {
    max-width: 180px;
    height: auto;
    margin-bottom: 5px;
}

.tagline {
    display: block;
    font-size: 11px;
    color: var(--muted-text);
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 15px 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-text);
    padding: 16px 20px 8px;
    margin: 0;
}

.nav-item {
    display: block;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--body-text);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
    border-top: none;
    border-right: none;
    border-bottom: none;
    background: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.nav-link:hover {
    background: var(--light-bg);
    color: var(--dark-text);
    text-decoration: none;
}

.nav-link.active {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-link i {
    width: 24px;
    margin-right: 12px;
    font-size: 18px;
    text-align: center;
    flex-shrink: 0;
}

.nav-link .nav-text {
    flex: 1;
}

.nav-link .chevron {
    font-size: 12px;
    transition: transform 0.2s ease;
    margin-left: auto;
}

.nav-link .chevron.rotated {
    transform: rotate(180deg);
}

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--light-bg);
}

.nav-submenu.open {
    max-height: 400px;
}

.nav-submenu .nav-link {
    padding: 10px 20px 10px 56px;
    font-size: 13px;
    color: var(--muted-text);
    border-left: 3px solid transparent;
}

.nav-submenu .nav-link i {
    width: 18px;
    font-size: 12px;
    margin-right: 10px;
    text-align: center;
    color: var(--muted-text);
}
.nav-submenu .nav-link:hover {
    color: var(--dark-text);
    background-color: var(--white);
}

.nav-submenu .nav-link:hover i,
.nav-submenu .nav-link.active i {
    color: var(--primary);
}

/* Active submenu item: keep submenu indent, add left border accent */
.nav-submenu .nav-link.active {
    color: var(--primary);
    background-color: rgba(37, 99, 235, 0.05);
    border-left-color: var(--primary);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* ─── Header ──────────────────────────────────────────────────── */
.main-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 50;
    margin-left: var(--sidebar-width);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--body-text);
    cursor: pointer;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--dark-text);
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--muted-text);
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 18px;
    height: 18px;
    background: var(--error);
    color: var(--white);
    font-size: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
}

.user-dropdown-toggle:hover {
    background: var(--light-bg);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.user-info {
    text-align: left;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark-text);
    line-height: 1.2;
}

.user-role {
    font-size: 12px;
    color: var(--muted-text);
    line-height: 1.2;
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    padding: 8px 0;
}

.user-dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--body-text);
    font-size: 14px;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
}

.dropdown-item:hover {
    background: var(--light-bg);
    text-decoration: none;
    color: var(--dark-text);
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--muted-text);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.dropdown-item.danger {
    color: var(--error);
}

.dropdown-item.danger i {
    color: var(--error);
}

/* ─── Main Content ────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: calc(100vh - var(--header-height));
}

/* ─── KPI Cards ───────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.kpi-icon.blue { background: rgba(37, 99, 235, 0.1); color: var(--primary); }
.kpi-icon.green { background: rgba(22, 163, 74, 0.1); color: var(--success); }
.kpi-icon.yellow { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.kpi-icon.red { background: rgba(220, 38, 38, 0.1); color: var(--error); }
.kpi-icon.purple { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.kpi-icon.info { background: var(--info-bg); color: var(--info); }

.kpi-details h3 {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
}

.kpi-details p {
    font-size: 14px;
    color: var(--muted-text);
    margin-bottom: 0;
}

.kpi-content {
    flex: 1;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark-text);
    line-height: 1.2;
}

.kpi-label {
    font-size: 14px;
    color: var(--muted-text);
}

.kpi-change {
    font-size: 12px;
    margin-top: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.kpi-change.up {
    background: var(--success-bg);
    color: var(--success);
}

.kpi-change.down {
    background: var(--error-bg);
    color: var(--error);
}

/* ─── Cards ───────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    border: none;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
}

.card-header h3,
.card-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-text);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--light-bg);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* ─── Data Tables ─────────────────────────────────────────────── */
.table-container {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    background: var(--light-bg);
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted-text);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--body-text);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: var(--light-bg);
}

/* ─── Bootstrap Table Overrides (global) ─────────────────────── */
/* Ensures all Bootstrap tables match the reference design system */
.table > thead > tr > th,
.table thead th {
    background: var(--light-bg);
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted-text);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    vertical-align: middle;
}

.table > tbody > tr > td,
.table tbody td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--body-text);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table-hover > tbody > tr:hover > td,
.table-hover > tbody > tr:hover {
    background-color: var(--light-bg);
}

/* ─── Bootstrap Action Button Group Override (global) ────────── */
/* Makes btn-group-sm action buttons match reference: rounded rect colored icons */
.btn-group-sm {
    gap: 4px;
}

.btn-group-sm > .btn,
.btn-group.btn-group-sm .btn {
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    transition: all 0.3s;
    box-shadow: none;
}

.btn-group-sm > .btn + .btn {
    margin-left: 0;
}

.btn-group-sm > .btn.btn-outline-info {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    border: none;
}
.btn-group-sm > .btn.btn-outline-info:hover {
    background: rgba(37, 99, 235, 0.2);
}

/* Edit action uses primary class but should appear amber per design reference */
.btn-group-sm > .btn.btn-outline-primary {
    background: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
    border: none;
}
.btn-group-sm > .btn.btn-outline-primary:hover {
    background: rgba(245, 158, 11, 0.2);
}

.btn-group-sm > .btn.btn-outline-secondary {
    background: rgba(100, 116, 139, 0.1);
    color: var(--muted-text);
    border: none;
}
.btn-group-sm > .btn.btn-outline-secondary:hover {
    background: rgba(100, 116, 139, 0.2);
}

.btn-group-sm > .btn.btn-outline-danger {
    background: rgba(220, 38, 38, 0.1);
    color: var(--error);
    border: none;
}
.btn-group-sm > .btn.btn-outline-danger:hover {
    background: rgba(220, 38, 38, 0.2);
}

.btn-group-sm > .btn.btn-outline-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: none;
}
.btn-group-sm > .btn.btn-outline-warning:hover {
    background: rgba(245, 158, 11, 0.2);
}

.btn-group-sm > .btn.btn-outline-success {
    background: rgba(22, 163, 74, 0.1);
    color: var(--success);
    border: none;
}
.btn-group-sm > .btn.btn-outline-success:hover {
    background: rgba(22, 163, 74, 0.2);
}

/* ─── Bootstrap Pagination Override (global) ─────────────────── */
.pagination {
    gap: 4px;
    margin: 0;
}

.pagination .page-link {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    color: #334155;
    font-size: 13px;
    font-weight: 500;
    background: var(--white);
    transition: all 0.15s;
}

.pagination .page-link:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination .page-item.disabled .page-link {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ─── Bootstrap Form/Filter Override (global) ────────────────── */

.form-control,
.form-select {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--body-text);
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ─── Card Header Override (global) ──────────────────────────── */
.card-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-text);
}

.table-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.table-user-name {
    font-weight: 600;
    color: var(--dark-text);
    line-height: 1.3;
}

.table-user-sub {
    font-size: 12px;
    color: var(--muted-text);
}

/* ─── Status Badges (custom variants with dot indicator) ─────── */
.badge[class*="badge-"] {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    gap: 4px;
}

.badge[class*="badge-"]::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-active,
.badge-completed,
.badge-green,
.badge-paid,
.badge-converted {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-active::before,
.badge-completed::before,
.badge-green::before,
.badge-paid::before,
.badge-converted::before {
    background: var(--success);
}

.badge-inactive,
.badge-grey,
.badge-default {
    background: #f1f5f9;
    color: #475569;
}

.badge-inactive::before,
.badge-grey::before,
.badge-default::before {
    background: #94a3b8;
}

.badge-new,
.badge-blue,
.badge-trial,
.badge-pipeline {
    background: var(--primary-light);
    color: #1e40af;
}

.badge-new::before,
.badge-blue::before,
.badge-trial::before,
.badge-pipeline::before {
    background: var(--primary);
}

.badge-contacted,
.badge-yellow,
.badge-expiring {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.badge-contacted::before,
.badge-yellow::before,
.badge-expiring::before {
    background: var(--warning);
}

.badge-scheduled,
.badge-purple {
    background: var(--purple-bg);
    color: var(--purple-text);
}

.badge-scheduled::before,
.badge-purple::before {
    background: var(--purple);
}

.badge-expired,
.badge-cancelled,
.badge-red,
.badge-lost {
    background: var(--error-bg);
    color: var(--error-text);
}

.badge-expired::before,
.badge-cancelled::before,
.badge-red::before,
.badge-lost::before {
    background: var(--error);
}

.badge-info,
.badge-cyan {
    background: var(--info-bg);
    color: var(--info-text);
}

.badge-info::before,
.badge-cyan::before {
    background: var(--info);
}

/* Role-specific badge colors */
.badge-role-super-admin {
    background: #fef3c7;
    color: #92400e;
}

.badge-role-super-admin::before {
    background: #f59e0b;
}

.badge-role-bd {
    background: #dbeafe;
    color: #1e40af;
}

.badge-role-bd::before {
    background: #2563eb;
}

.badge-role-ops {
    background: #dcfce7;
    color: #166534;
}

.badge-role-ops::before {
    background: #16a34a;
}

.badge-role-finance {
    background: #f3e8ff;
    color: #7c3aed;
}

.badge-role-finance::before {
    background: #7c3aed;
}

.badge-role-support {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-role-support::before {
    background: #0ea5e9;
}

.badge-role-default {
    background: #f1f5f9;
    color: #475569;
}

.badge-role-default::before {
    background: #94a3b8;
}

/* Badge without dot */
.badge-flat {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.badge-flat::before {
    display: none;
}

/* Permission tags */
.permission-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-weight: 500;
    margin: 2px;
}

/* ─── Action Buttons ──────────────────────────────────────────── */
.action-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-action {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--white);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}

.btn-action:hover {
    box-shadow: var(--shadow);
}

.btn-action.view {
    color: var(--primary);
}

.btn-action.view:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.btn-action.edit {
    color: var(--warning);
}

.btn-action.edit:hover {
    background: var(--warning-bg);
    border-color: var(--warning);
}

.btn-action.delete {
    color: var(--error);
}

.btn-action.delete:hover {
    background: var(--error-bg);
    border-color: var(--error);
}

.btn-action.toggle {
    color: var(--success);
}

.btn-action.toggle:hover {
    background: var(--success-bg);
    border-color: var(--success);
}

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
    padding: 10px 24px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn:hover {
    text-decoration: none;
}

.btn i {
    font-size: 14px;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--white);
}

.btn-success {
    background: var(--success);
    color: var(--white);
    border-color: var(--success);
}

.btn-success:hover {
    background: #15803d;
    border-color: #15803d;
    color: var(--white);
}

.btn-secondary {
    background-color: var(--light-bg);
    color: var(--body-text);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #e2e8f0;
    border-color: var(--muted-text);
    color: var(--dark-text);
}

.btn-danger {
    background: var(--error);
    color: var(--white);
    border-color: var(--error);
}

.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: var(--white);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
    border-color: var(--warning);
}

.btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
    color: var(--white);
}

.btn-outline {
    background: var(--white);
    color: var(--body-text);
    border-color: var(--border-color);
}

.btn-outline:hover {
    background: var(--light-bg);
    border-color: var(--muted-text);
    color: var(--dark-text);
}

.btn-outline-primary {
    background: var(--white);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-outline-danger {
    background: var(--white);
    color: var(--error);
    border-color: var(--error);
}

.btn-outline-danger:hover {
    background: var(--error);
    color: var(--white);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--body-text);
}

.btn-ghost:hover {
    background: var(--light-bg);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
    border-radius: 6px;
    font-weight: 500;
    gap: 6px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ─── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal-card {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.modal-card.modal-lg {
    max-width: 700px;
}

.modal-card.modal-xl {
    max-width: 900px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--muted-text);
    cursor: pointer;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

/* ─── Detail Panel (Slide-in) ─────────────────────────────────── */
.detail-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.3);
    z-index: 2000;
    display: none;
}

.detail-panel-overlay.show {
    display: block;
}

.detail-panel {
    position: fixed;
    top: 0;
    right: -480px;
    width: 480px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 2001;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.detail-panel.open {
    right: 0;
}

.detail-panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.detail-panel-header h3 {
    margin: 0;
    font-size: 18px;
}

.detail-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.detail-panel-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.detail-grid label {
    display: block;
    font-size: 12px;
    color: var(--muted-text);
    margin-bottom: 2px;
}

.detail-grid p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

/* ─── Filter Bar ──────────────────────────────────────────────── */
.filter-bar {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 24px;
    position: sticky;
    top: var(--header-height);
    z-index: 40;
    box-shadow: var(--shadow-sm);
}

/* When filter-bar is inside a card, remove its own border/bg/shadow */
.card-body .filter-bar {
    border: none;
    padding: 0;
    margin-bottom: 0;
    position: static;
    box-shadow: none;
    background: transparent;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group .form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0;
}

.filter-bar .form-control,
.filter-bar .form-select {
    width: auto;
    min-width: 140px;
    padding: 8px 36px 8px 12px;
    font-size: 14px;
}

.filter-bar .form-control {
    padding-right: 12px;
}

.filter-bar .search-input,
.filter-group .form-control[type="text"] {
    flex: 1;
    min-width: 180px;
}

/* ─── Toast Notifications ─────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast-container .toast {
    display: flex !important;
    opacity: 1 !important;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--white);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid;
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease forwards;
    animation-delay: 0s, var(--toast-duration, 4.7s);
    min-width: 300px;
}

.toast-success {
    border-left-color: var(--success);
}

.toast-success .toast-icon {
    color: var(--success);
}

.toast-error {
    border-left-color: var(--error);
}

.toast-error .toast-icon {
    color: var(--error);
}

.toast-warning {
    border-left-color: var(--warning);
}

.toast-warning .toast-icon {
    color: var(--warning);
}

.toast-info {
    border-left-color: var(--primary);
}

.toast-info .toast-icon {
    color: var(--primary);
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--dark-text);
    font-size: 14px;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--muted-text);
}

.toast-close {
    background: none;
    border: none;
    font-size: 14px;
    color: var(--muted-text);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translateX(50%);
    }
}

/* ─── Toggle Switch ───────────────────────────────────────────── */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* ─── Pagination ──────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--white);
    border-radius: 0 0 var(--radius) var(--radius);
}

.pagination-info {
    font-size: 13px;
    color: var(--muted-text);
}

.pagination-buttons {
    display: flex;
    gap: 4px;
}

.pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    background: var(--white);
    color: var(--body-text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover {
    background: var(--light-bg);
    border-color: var(--muted-text);
}

.pagination-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ─── Form Controls ───────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--dark-text);
    margin-bottom: 8px;
}

.form-label .required {
    color: var(--error);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font-family);
    color: var(--body-text);
    background: var(--white);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
    color: var(--light-text);
}

.form-control.is-invalid {
    border-color: var(--error);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font-family);
    color: var(--body-text);
    background: var(--white);
    transition: var(--transition);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%2364748b'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-text {
    font-size: 12px;
    color: var(--muted-text);
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: var(--error);
    margin-top: 4px;
}

.input-group {
    position: relative;
}

.input-group .form-control {
    padding-left: 40px;
}

.input-group .input-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: var(--muted-text);
    font-size: 14px;
    z-index: 1;
}

.input-group .input-icon-right {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: var(--muted-text);
    font-size: 14px;
    z-index: 1;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

/* ─── Login Page ──────────────────────────────────────────────── */
.login-page,
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--login-gradient-start), var(--login-gradient-end));
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-text {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark-text);
}

.login-logo .logo-text span {
    color: var(--primary);
}

.login-logo .logo-subtitle {
    font-size: 14px;
    color: var(--muted-text);
    margin-top: 4px;
}

.login-logo h1 {
    font-size: 28px;
    color: var(--primary);
    font-weight: 700;
}

.login-logo p {
    color: var(--muted-text);
    font-size: 14px;
    margin-top: 5px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .form-control {
    padding: 12px 14px;
    font-size: 15px;
}

.login-form .btn-primary {
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.login-footer a {
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
}

.login-error {
    background: var(--error-bg);
    color: var(--error-text);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-success {
    background: var(--success-bg);
    color: var(--success-text);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Password Strength ──────────────────────────────────────── */
.password-strength {
    margin-top: 8px;
}

.strength-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--border-color);
    overflow: hidden;
    margin-bottom: 8px;
}

.strength-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease, background 0.3s ease;
}

.strength-bar-fill.weak {
    width: 25%;
    background: var(--error);
}

.strength-bar-fill.fair {
    width: 50%;
    background: var(--warning);
}

.strength-bar-fill.good {
    width: 75%;
    background: #84cc16;
}

.strength-bar-fill.strong {
    width: 100%;
    background: var(--success);
}

.password-requirements {
    list-style: none;
    padding: 0;
    margin: 0;
}

.password-requirements li {
    font-size: 12px;
    color: var(--muted-text);
    padding: 2px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.password-requirements li.met {
    color: var(--success);
}

.password-requirements li i {
    font-size: 11px;
    width: 14px;
    text-align: center;
}

/* ─── Permission Grid ─────────────────────────────────────────── */
.permission-grid {
    display: grid;
    gap: 20px;
}

.permission-category {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    overflow: hidden;
}

.permission-category-header {
    background: var(--light-bg);
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    color: var(--dark-text);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
}

.permission-category-body {
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.permission-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--body-text);
    cursor: pointer;
    min-width: 140px;
}

.permission-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ─── Alert Cards ─────────────────────────────────────────────── */
.alert-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-radius: var(--radius);
    border: 1px solid;
    margin-bottom: 12px;
}

.alert-card.alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
}

.alert-card.alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
}

.alert-card.alert-info {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.alert-card.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.alert-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.alert-warning .alert-icon {
    background: var(--warning-bg);
    color: var(--warning);
}

.alert-danger .alert-icon {
    background: var(--error-bg);
    color: var(--error);
}

.alert-info .alert-icon {
    background: var(--info-bg);
    color: var(--info);
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    color: var(--dark-text);
    font-size: 14px;
}

.alert-description {
    font-size: 13px;
    color: var(--muted-text);
    margin-top: 2px;
}

/* ─── Quick Actions ───────────────────────────────────────────── */
.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--body-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.quick-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-lighter);
    text-decoration: none;
}

.quick-action-btn i {
    font-size: 15px;
}

/* ─── Settings Sections ───────────────────────────────────────── */
.settings-section {
    margin-bottom: 30px;
}

.settings-section > h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--dark-text);
}

.settings-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.settings-section-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.settings-section-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.settings-section-header p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--muted-text);
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item-info {
    flex: 1;
}

.settings-item-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--dark-text);
}

.settings-item-info p {
    font-size: 13px;
    color: var(--muted-text);
    margin: 0;
}

.settings-item-label {
    font-weight: 500;
    color: var(--dark-text);
    font-size: 14px;
}

.settings-item-description {
    font-size: 13px;
    color: var(--muted-text);
    margin-top: 2px;
}

/* ─── Access Denied ───────────────────────────────────────────── */
.access-denied {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.access-denied-icon {
    font-size: 64px;
    color: var(--error);
    margin-bottom: 24px;
}

.access-denied h1 {
    font-size: 28px;
    margin-bottom: 12px;
}

.access-denied p {
    color: var(--muted-text);
    font-size: 16px;
    margin-bottom: 24px;
}

/* ─── Error Page ──────────────────────────────────────────────── */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.error-page h1 {
    font-size: 72px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.error-page h2 {
    font-size: 24px;
    margin-bottom: 16px;
}

.error-page p {
    color: var(--muted-text);
    max-width: 500px;
}

/* ─── Mobile Overlay ──────────────────────────────────────────── */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 999;
    display: none;
}

.sidebar-overlay.show {
    display: block;
}

/* ─── Custom Utility Classes (non-Bootstrap) ─────────────────── */
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-16 { font-size: 16px; }
.fs-18 { font-size: 18px; }
.fs-20 { font-size: 20px; }
.fs-24 { font-size: 24px; }

.mr-1 { margin-right: 8px; }
.mr-2 { margin-right: 16px; }
.ml-1 { margin-left: 8px; }
.ml-2 { margin-left: 16px; }

.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

.text-right { text-align: right; }
.overflow-hidden { overflow: hidden; }
.cursor-pointer { cursor: pointer; }

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-header {
        margin-left: 0;
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .hamburger {
        display: block;
    }

    .detail-panel {
        width: 100%;
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 20px 16px;
    }

    .main-header {
        padding: 0 16px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-bar .form-control,
    .filter-bar .form-select,
    .filter-bar .search-input {
        width: 100%;
        min-width: unset;
    }

    .data-table {
        display: block;
        overflow-x: auto;
    }

    .modal-card {
        max-width: 100%;
        margin: 10px;
    }

    .login-card {
        padding: 30px 24px;
    }

    .quick-actions {
        flex-direction: column;
    }

    .quick-action-btn {
        justify-content: center;
    }

    .pagination {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .user-info {
        display: none;
    }

    .detail-panel {
        width: 100%;
        max-width: 100%;
    }

    .settings-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-title {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .header-right {
        gap: 12px;
    }

    .main-content {
        padding: 16px 12px;
    }

    .kpi-card {
        padding: 16px;
    }

    .kpi-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .kpi-value {
        font-size: 22px;
    }
}

/* ─── Page Loader Overlay ─────────────────────────────────────── */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99998;
    backdrop-filter: blur(2px);
}

.page-loader .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
}

/* ─── Button Loading State ────────────────────────────────────── */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.75;
}

.btn-loading .spinner-border {
    width: 1em;
    height: 1em;
    border-width: 0.15em;
    vertical-align: middle;
}

/* ─── Confirmation Modal ──────────────────────────────────────── */
#confirmActionModal .modal-body {
    padding: 24px;
    text-align: center;
}

#confirmActionModal .confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
}

#confirmActionModal .confirm-icon.danger {
    background: var(--error-bg);
    color: var(--error);
}

#confirmActionModal .confirm-icon.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

#confirmActionModal .confirm-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 8px;
}

#confirmActionModal .confirm-message {
    font-size: 14px;
    color: var(--muted-text);
    line-height: 1.5;
}

/* ─── Print ───────────────────────────────────────────────────── */
@media print {
    .sidebar,
    .main-header,
    .filter-bar,
    .action-buttons,
    .pagination {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
        padding: 0;
    }
}

/* ─── Dashboard Specific Styles ─────────────────────────────── */

/* Alert Cards */
.alert-card {
    border-left-width: 4px !important;
    transition: transform 0.2s ease;
}

.alert-card:hover {
    transform: translateY(-2px);
}

.alert-card.border-warning {
    border-left-color: var(--warning) !important;
}

.alert-card.border-danger {
    border-left-color: var(--error) !important;
}

.alert-card.border-info {
    border-left-color: var(--info) !important;
}

.alert-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

/* Chart & Table Empty States */
.chart-empty-state,
.table-empty-state {
    padding: 60px 20px;
    text-align: center;
    background: var(--light-bg);
    border-radius: var(--radius-sm);
}

.chart-empty-state {
    padding: 80px 20px;
}

.chart-empty-state i,
.table-empty-state i {
    font-size: 32px;
    color: var(--border-color);
    margin-bottom: 12px;
    display: block;
}

.chart-empty-state p,
.table-empty-state p {
    font-size: 13px;
}

/* Quick Action buttons */
.quick-action-btn {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 20px 16px;
    text-align: center;
    color: var(--body-text);
    transition: all 0.2s ease;
    text-decoration: none;
    display: block;
}

.quick-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-lighter);
}

/* KPI trend badges */
.kpi-trend {
    font-size: 12px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 12px;
}

.kpi-trend.up {
    background: var(--success-bg);
    color: var(--success-text);
}

.kpi-trend.down {
    background: var(--error-bg);
    color: var(--error-text);
}

.kpi-trend.neutral {
    background: var(--border-light);
    color: var(--muted-text);
}

/* ─── Role Badge Styles ──────────────────────────────────────── */
.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: #e0e7ff;
    color: #3730a3;
}
.role-badge.admin { background: #fef3c7; color: #92400e; }
.role-badge.bd { background: #dbeafe; color: #1e40af; }
.role-badge.ops { background: #dcfce7; color: #166534; }
.role-badge.finance { background: #f3e8ff; color: #7c3aed; }
.role-badge.support { background: #e0f2fe; color: #0369a1; }

/* ─── User Cell & Avatar Small ───────────────────────────────── */
.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

/* ─── Action Buttons (Design Pattern) ────────────────────────── */
.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
    margin-right: 4px;
}
.action-btn.view { background: #dbeafe; color: #2563eb; }
.action-btn.view:hover { background: #bfdbfe; }
.action-btn.edit { background: #fef3c7; color: #d97706; }
.action-btn.edit:hover { background: #fde68a; }
.action-btn.delete { background: #fee2e2; color: #dc2626; }
.action-btn.delete:hover { background: #fecaca; }
.action-btn.toggle { background: #f1f5f9; color: #64748b; }
.action-btn.toggle:hover { background: #e2e8f0; }
.action-btn.info { background: #e0f2fe; color: #0284c7; }
.action-btn.info:hover { background: #bae6fd; }
.action-btn.success { background: #dcfce7; color: #16a34a; }
.action-btn.success:hover { background: #bbf7d0; }
.action-btn.renew { background: #dbeafe; color: #2563eb; }
.action-btn.renew:hover { background: #bfdbfe; }
.action-btn.more { background: #f1f5f9; color: #64748b; }
.action-btn.more:hover { background: #e2e8f0; }
.action-btn.danger { background: #fee2e2; color: #dc2626; }
.action-btn.danger:hover { background: #fecaca; }

/* ─── Client Table Logo Placeholder ──────────────────────────── */
.client-table-logo-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary-lighter);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

/* ─── Billing Toggle (Products Page) ─────────────────────────── */
.billing-toggle {
    display: flex;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}
.billing-toggle-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    color: var(--muted-text);
    transition: var(--transition);
}
.billing-toggle-btn.active {
    background: #2563eb;
    color: white;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

/* ─── Package Grid & Cards (Products Page) ───────────────────── */
.package-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    padding-top: 16px;
}

.package-card {
    position: relative;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s;
}

.package-card:hover {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

.package-card.popular {
    border: 2px solid #dc2626;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.15);
}

.package-card.hidden-package {
    opacity: 0.7;
    background: var(--light-bg);
}

.hidden-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #64748b;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
}

.package-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.package-price-main {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.package-price-main span {
    font-size: 14px;
    font-weight: 400;
    color: var(--muted-text);
}

.package-price-sub {
    font-size: 12px;
    color: var(--muted-text);
    margin-bottom: 12px;
}

.package-employee-info {
    font-size: 13px;
    color: var(--muted-text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.package-modules-count {
    font-size: 13px;
    color: var(--muted-text);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.trial-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 16px;
}

.package-support {
    font-size: 13px;
    color: var(--muted-text);
    padding: 8px 0;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.package-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.package-actions .btn {
    flex: 1;
}

/* ─── Pricing Tiers (Products Page) ──────────────────────────── */
.pricing-tiers {
    margin: 16px 0;
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
}

.pricing-tiers-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--light-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    text-align: center;
}

.tier-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f8fafc;
}

.tier-row:last-child {
    border-bottom: none;
}

.tier-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark-text);
}

.tier-range {
    font-size: 11px;
    color: var(--light-text);
    margin-top: 2px;
}

.tier-connect {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* ─── Module Table (Products Page) ───────────────────────────── */
.module-name-cell {
    display: flex;
    align-items: center;
}

.sub-modules-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.sub-module-tag {
    background: var(--light-bg);
    color: var(--muted-text);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.pkg-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin: 1px;
}

/* ─── Comparison Table (Products Page) ───────────────────────── */
.comparison-table {
    width: 100%;
}

.comparison-table th {
    padding: 12px 16px;
    background: var(--light-bg);
    font-weight: 600;
}

.comparison-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
}

.comparison-cell {
    text-align: center;
}

.feature-name-cell {
    display: flex;
    align-items: center;
    font-weight: 500;
    color: #374151;
}

.module-parent-row td {
    background: var(--light-bg);
    font-weight: 500;
}

.sub-module-row td {
    font-size: 13px;
}

/* ─── Package Form (Modal) ───────────────────────────────────── */
.module-checkbox-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.module-checkbox-item.checked {
    border-color: var(--primary);
    background: var(--primary-lighter);
}

.module-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.module-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.module-sub-checkboxes {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sub-module-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #475569;
    background: white;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.sub-module-checkbox input[type="checkbox"] {
    width: 13px;
    height: 13px;
}

.tier-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--light-text);
    text-transform: uppercase;
}

.tier-header-row span {
    flex: 1;
}

.tier-header-row span:first-child {
    width: 100px;
    flex: none;
}

.tier-header-row span:nth-child(2) {
    width: 25px;
    flex: none;
}

.tier-header-row span:last-child {
    width: 32px;
    flex: none;
}

.tier-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.tier-input-row input {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
}

.tier-input-row input[type="number"] {
    width: 110px;
}

.tier-label {
    font-size: 12px;
    color: var(--light-text);
    min-width: 25px;
}

.popular-toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.popular-toggle-label {
    font-size: 13px;
    color: var(--muted-text);
}

/* ─── Permissions Grid (Roles Page) ──────────────────────────── */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.permission-category h5 {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
}
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    cursor: pointer;
}
.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* ─── Popular Badge (Products Page) ──────────────────────────── */
.popular-badge {
    position: absolute;
    top: -13px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: white;
    padding: 5px 20px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
    white-space: nowrap;
    z-index: 2;
}

/* ─── Reminder Card Hover ────────────────────────────────────── */
.reminder-card {
    transition: var(--transition);
}
.reminder-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ─── Form Hint ──────────────────────────────────────────────── */
.form-hint {
    font-size: 12px;
    color: var(--muted-text);
    margin-top: 4px;
}
.form-hint i {
    margin-right: 4px;
}

/* ─── KPI Hint ───────────────────────────────────────────────── */
.kpi-hint {
    display: block;
    font-size: 11px;
    color: var(--muted-text);
    margin-top: 4px;
}
.kpi-hint i {
    margin-right: 2px;
}
.kpi-card.active-filter {
    border: 2px solid var(--primary) !important;
}

/* ─── Modal Overlay (Custom Modals) ──────────────────────────── */
.modal-overlay .modal {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-overlay .modal.modal-lg {
    max-width: 800px;
}
.modal-overlay .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}
.modal-overlay .modal-body {
    padding: 24px;
}
.modal-overlay .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ─── Status Badge (Design Pattern) ──────────────────────────── */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.status-badge.active { background: rgba(22, 163, 74, 0.1); color: #16A34A; }
.status-badge.inactive { background: #f1f5f9; color: #64748b; }
.status-badge.suspended { background: #fee2e2; color: #dc2626; }
.status-badge.trial { background: #dbeafe; color: #1e40af; }
.status-badge.expired { background: #fef3c7; color: #92400e; }

/* â”€â”€â”€ Dashboard: Filter Bar â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.filter-bar { display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end; background:var(--white); padding:16px 20px; border-radius:var(--radius); border:1px solid var(--border-color); box-shadow:var(--shadow-sm); }
.filter-bar .filter-group { display:flex; flex-direction:column; gap:4px; }
.filter-bar .filter-group label { font-size:12px; font-weight:600; color:var(--muted-text); text-transform:uppercase; letter-spacing:.05em; }
.filter-bar select,
.filter-bar input[type=date] { padding:8px 12px; border:1px solid var(--border-color); border-radius:var(--radius-sm); font-size:13px; background-color:var(--white); color:var(--dark-text); min-width:130px; }
.filter-bar select:focus,
.filter-bar input[type=date]:focus { outline:none; border-color:var(--primary); }

/* â”€â”€â”€ Dashboard: Alerts Grid â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.dash-alerts-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:20px; }
@media(max-width:900px){ .dash-alerts-grid { grid-template-columns:1fr; } }
.dash-alert-card { background:var(--white); border-radius:var(--radius); padding:20px; display:flex; align-items:center; gap:16px; box-shadow:var(--shadow-sm); border:1px solid var(--border-color); border-left:4px solid transparent; }
.dash-alert-card.warning { border-left-color:var(--warning); }
.dash-alert-card.danger  { border-left-color:var(--error); }
.dash-alert-card.info    { border-left-color:var(--info); }
.dash-alert-icon { width:44px; height:44px; border-radius:var(--radius-sm); display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; }
.dash-alert-card.warning .dash-alert-icon { background:var(--warning-bg); color:var(--warning); }
.dash-alert-card.danger  .dash-alert-icon { background:var(--error-bg);   color:var(--error); }
.dash-alert-card.info    .dash-alert-icon { background:var(--info-bg);    color:var(--info); }
.dash-alert-content { flex:1; }
.dash-alert-content h4 { font-size:14px; font-weight:600; margin:0 0 2px; }
.dash-alert-content p  { font-size:13px; color:var(--muted-text); margin:0; }
.dash-alert-action { padding:6px 14px; border-radius:var(--radius-sm); font-size:12px; font-weight:600; background:transparent; border:1px solid var(--border-color); color:var(--muted-text); text-decoration:none; white-space:nowrap; transition:var(--transition); }
.dash-alert-action:hover { background:var(--light-bg); color:var(--dark-text); }

/* â”€â”€â”€ Dashboard: Charts â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.dash-charts-three { display:grid; grid-template-columns:repeat(3,1fr); gap:20px; }
.dash-charts-two   { display:grid; grid-template-columns:repeat(2,1fr); gap:20px; }
@media(max-width:1100px){ .dash-charts-three { grid-template-columns:1fr 1fr; } }
@media(max-width:768px) { .dash-charts-three,.dash-charts-two { grid-template-columns:1fr; } }
.dash-chart-card { background:var(--white); border-radius:var(--radius); padding:24px; box-shadow:var(--shadow-sm); border:1px solid var(--border-color); }
.dash-chart-card h3 { font-size:15px; font-weight:600; margin-bottom:16px; color:var(--dark-text); }

/* â”€â”€â”€ Dashboard: Tables Grid â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.dash-tables-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:20px; margin-bottom:30px; }
@media(max-width:900px){ .dash-tables-grid { grid-template-columns:1fr; } }

/* â”€â”€â”€ Dashboard: Status Badges â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.dash-badge { display:inline-block; padding:4px 10px; border-radius:20px; font-size:12px; font-weight:600; }
.dash-badge.new       { background:var(--primary-light); color:var(--primary); }
.dash-badge.contacted { background:var(--info-bg);       color:var(--info); }
.dash-badge.scheduled { background:var(--warning-bg);    color:var(--warning-text); }
.dash-badge.completed { background:var(--success-bg);    color:var(--success-text); }
.dash-badge.cancelled { background:var(--error-bg);      color:var(--error-text); }
.dash-badge.noshow    { background:#f1f5f9;              color:var(--muted-text); }

/* â”€â”€â”€ Pagination Controls â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.pagination-controls { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; border-top:1px solid var(--border-color); font-size:13px; }
.pg-info { color:var(--muted-text); }
.pg-buttons { display:flex; align-items:center; gap:4px; }
.pg-btn { width:32px; height:32px; border:1px solid var(--border-color); border-radius:var(--radius-xs); background:var(--white); color:var(--body-text); font-size:13px; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:var(--transition); }
.pg-btn:hover:not(:disabled) { background:var(--light-bg); border-color:var(--primary); color:var(--primary); }
.pg-btn.active { background:var(--primary); border-color:var(--primary); color:#fff; }
.pg-btn:disabled { opacity:.4; cursor:not-allowed; }
.pg-ellipsis { padding:0 4px; color:var(--muted-text); }
.today-row { background:rgba(37,99,235,0.04) !important; }

/* ============== Ticket Management (ported from Design V2 mockup) ============== */
.tk-status { display:inline-block; padding:4px 10px; border-radius:12px; font-size:12px; font-weight:600; }
.tk-status-pending-forward { background:#FFEDD5; color:#9A3412; }
.tk-status-open { background:#DBEAFE; color:#1D4ED8; }
.tk-status-assigned { background:#E0E7FF; color:#4338CA; }
.tk-status-in-progress { background:#FEF3C7; color:#92400E; }
.tk-status-on-hold { background:#F3F4F6; color:#374151; }
.tk-status-awaiting-client { background:#FCE7F3; color:#9D174D; }
.tk-status-resolved { background:#D1FAE5; color:#065F46; }
.tk-status-closed { background:#E5E7EB; color:#1F2937; }
.tk-status-reopened { background:#FEE2E2; color:#991B1B; }

.tk-priority { display:inline-block; padding:3px 8px; border-radius:6px; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:0.4px; }
.tk-priority-low { background:#E0F2FE; color:#075985; }
.tk-priority-medium { background:#FEF3C7; color:#92400E; }
.tk-priority-high { background:#FED7AA; color:#9A3412; }
.tk-priority-critical { background:#FEE2E2; color:#991B1B; border:1px solid #FCA5A5; }

.tk-sla { display:inline-flex; align-items:center; gap:4px; padding:3px 8px; border-radius:6px; font-size:12px; font-weight:600; }
.tk-sla-ok { background:#D1FAE5; color:#065F46; }
.tk-sla-risk, .tk-sla-at-risk { background:#FEF3C7; color:#92400E; }
.tk-sla-breached { background:#FEE2E2; color:#991B1B; }

.tk-row-breached { background:#FEF2F2 !important; }
.tk-row-risk { background:#FFFBEB !important; }

.tk-detail-section { padding:16px 0; border-bottom:1px solid #E2E8F0; }
.tk-detail-section:last-child { border-bottom:none; }
.tk-detail-section h4 { margin:0 0 12px 0; font-size:14px; color:#0F172A; }
.tk-detail-section h4 i { margin-right:6px; color:#2563EB; }
.tk-comment { background:#F8FAFC; border-radius:8px; padding:12px; margin-bottom:8px; border-left:3px solid #2563EB; }
.tk-comment.internal { border-left-color:#F59E0B; background:#FFFBEB; }
.tk-comment-meta { font-size:11px; color:#64748B; margin-bottom:6px; display:flex; justify-content:space-between; }
.tk-comment-vis { padding:1px 6px; border-radius:4px; font-weight:600; color:#fff; }
.tk-comment-vis.internal { background:#F59E0B; }
.tk-comment-vis.client { background:#16A34A; }
.tk-history-item { padding:8px 0; border-bottom:1px dashed #E2E8F0; font-size:13px; }
.tk-history-item:last-child { border-bottom:none; }
.tk-history-meta { font-size:11px; color:#64748B; }

/* ─── Tickets Dashboard: KPI tiles ───────────────────────────── */
.tk-kpi-grid { display:grid; grid-template-columns:repeat(5, 1fr); gap:14px; margin-bottom:20px; }
@media (max-width: 1200px) { .tk-kpi-grid { grid-template-columns:repeat(3, 1fr); } }
@media (max-width: 768px) { .tk-kpi-grid { grid-template-columns:repeat(2, 1fr); } }
@media (max-width: 480px) { .tk-kpi-grid { grid-template-columns:1fr; } }
.tk-kpi { background:var(--white); border:1px solid var(--border-color); border-left:4px solid var(--primary); border-radius:var(--radius-sm); padding:16px 18px; box-shadow:var(--shadow-sm); }
.tk-kpi-label { font-size:12px; font-weight:600; color:var(--muted-text); text-transform:uppercase; letter-spacing:.03em; margin-bottom:8px; }
.tk-kpi-value { font-size:28px; font-weight:700; color:var(--dark-text); line-height:1.15; }
.tk-kpi-sub { font-size:12px; color:var(--muted-text); margin-top:4px; }
.tk-kpi.warning { border-left-color:var(--warning); }
.tk-kpi.warning .tk-kpi-value { color:var(--warning); }
.tk-kpi.success { border-left-color:var(--success); }
.tk-kpi.success .tk-kpi-value { color:var(--success); }
.tk-kpi.danger { border-left-color:#DC2626; }
.tk-kpi.danger .tk-kpi-value { color:#DC2626; }

/* ─── Tickets Dashboard: aging / distribution chart wrappers ───── */
.tk-canvas-wrap { position:relative; height:220px; }
.tk-canvas-wrap canvas { max-height:220px; }
.tk-section-title { display:flex; justify-content:space-between; align-items:baseline; margin:24px 0 12px; }
.tk-section-title h2 { font-size:16px; margin:0; display:flex; align-items:center; gap:8px; }
.tk-section-title span { font-size:12px; color:var(--muted-text); }
.tk-chart-caption { font-size:12px; color:var(--muted-text); margin-top:8px; }

/* ─── Tickets Dashboard: Client x Module heatmap ────────────── */
.tk-heatmap-scroll { overflow-x:auto; }
.tk-heatmap { display:grid; gap:4px; min-width:600px; }
.tk-heatmap-corner { position:sticky; left:0; background:var(--white); z-index:1; }
.tk-heatmap-colhead { font-size:11px; font-weight:600; color:var(--muted-text); text-align:center; padding:6px 4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tk-heatmap-rowhead { position:sticky; left:0; background:var(--white); font-size:13px; font-weight:600; color:var(--dark-text); display:flex; align-items:center; padding:8px 10px 8px 0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; z-index:1; }
.tk-heatmap-cell { display:flex; align-items:center; justify-content:center; height:40px; border-radius:6px; font-size:13px; font-weight:600; text-decoration:none; transition:transform .12s ease, box-shadow .12s ease; }
.tk-heatmap-cell:hover { transform:scale(1.06); box-shadow:0 2px 6px rgba(0,0,0,.15); position:relative; z-index:2; }
.tk-heatmap-cell-empty { cursor:default; pointer-events:none; background:#F8FAFC !important; }
.tk-heatmap-legend { display:flex; align-items:center; gap:6px; margin-top:12px; font-size:11px; color:var(--muted-text); }
.tk-heatmap-swatch { width:16px; height:12px; border-radius:3px; display:inline-block; }

/* ─── Tickets Dashboard: recent activity feed ───────────────── */
.tk-activity-item { display:flex; align-items:center; gap:12px; padding:12px 4px; border-bottom:1px solid #F1F5F9; font-size:13px; border-radius:6px; transition:background .12s ease; }
.tk-activity-item:hover { background:var(--light-bg); }
.tk-activity-item:last-child { border-bottom:none; }
.tk-activity-icon { width:30px; height:30px; min-width:30px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:13px; }
.tk-activity-icon-primary { background:var(--primary-lighter); color:var(--primary); }
.tk-activity-icon-success { background:var(--success-bg); color:var(--success); }
.tk-activity-icon-muted { background:var(--light-bg); color:var(--muted-text); }
.tk-activity-label { color:var(--dark-text); flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tk-activity-time { color:var(--muted-text); font-size:12px; white-space:nowrap; }

/* ─── Tickets Dashboard: escalation alert rows ──────────────── */
.tk-alert-item { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:14px 0; border-bottom:1px solid #F1F5F9; font-size:14px; color:var(--dark-text); }
.tk-alert-item:last-child { border-bottom:none; padding-bottom:4px; }
.tk-alert-item:first-child { padding-top:4px; }
.tk-alert-badge { background:#FEE2E2; color:#DC2626; font-size:12px; font-weight:600; padding:4px 12px; border-radius:999px; white-space:nowrap; }

.tk-link-pill { display:inline-block; background:#EFF6FF; color:#1D4ED8; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; cursor:pointer; }
.tk-link-pill:hover { background:#DBEAFE; }

.tk-comment-input { display:flex; flex-direction:column; gap:8px; margin-top:8px; }
.tk-comment-input textarea { width:100%; padding:8px; border:1px solid #CBD5E1; border-radius:6px; font-family:inherit; resize:vertical; min-height:60px; }
.tk-comment-input-row { display:flex; gap:8px; align-items:center; justify-content:space-between; }

.tk-view-tabs { display:flex; gap:6px; margin-bottom:14px; border-bottom:1px solid #E2E8F0; padding-bottom:0; }
.tk-view-tab { background:transparent; border:none; padding:10px 16px; cursor:pointer; font-size:13px; color:#64748B; font-weight:500; border-bottom:2px solid transparent; display:inline-flex; align-items:center; gap:6px; text-decoration:none; }
.tk-view-tab:hover { color:#0F172A; }
.tk-view-tab.active { color:#2563EB; border-bottom-color:#2563EB; font-weight:600; }

.tk-attach-drop { border:2px dashed #CBD5E1; border-radius:8px; padding:18px; text-align:center; cursor:pointer; color:#64748B; display:flex; flex-direction:column; align-items:center; gap:6px; transition:all 0.15s ease; }
.tk-attach-drop:hover, .tk-attach-drop.drag { border-color:#2563EB; background:#EFF6FF; color:#2563EB; }
.tk-attach-drop i { font-size:24px; }
.tk-attach-list { display:flex; flex-direction:column; gap:6px; margin-top:8px; }
.tk-attach-item { display:flex; align-items:center; gap:8px; padding:6px 10px; background:#F8FAFC; border-radius:6px; font-size:13px; }
.tk-attach-remove { margin-left:auto; background:transparent; border:none; color:#DC2626; cursor:pointer; }

.tk-tier { display:inline-block; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; margin-left:6px; }
.tk-tier-enterprise { background:#2563EB; color:#fff; }
.tk-tier-premium { background:#7C3AED; color:#fff; }
.tk-tier-standard { background:#E2E8F0; color:#475569; }

.tk-paused-badge { display:inline-block; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; background:#F59E0B; color:#fff; margin-left:4px; }
.tk-readonly-badge { display:inline-block; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; background:#64748B; color:#fff; margin-left:8px; }

.tk-note { background:#EFF6FF; border-left:3px solid #2563EB; padding:8px 12px; margin-bottom:10px; font-size:13px; color:#0F172A; border-radius:4px; }
