/* =====================================================
   Service CSP - ServiceNow-Style Enterprise UI
   ===================================================== */

/* CSS Variables - ServiceNow Color Palette */
:root {
    --sn-primary: #032D60;
    --sn-primary-light: #0A4D8C;
    --sn-primary-lighter: #1B6EC2;
    --sn-accent: #17B169;
    --sn-accent-hover: #14995C;
    --sn-danger: #E02020;
    --sn-warning: #FF9F00;
    --sn-info: #1B96FF;
    --sn-success: #2ECC71;
    --sn-surface: #F4F6F9;
    --sn-bg: #ECEEF1;
    --sn-white: #FFFFFF;
    --sn-dark: #1D1D1D;
    --sn-text: #333333;
    --sn-text-secondary: #666666;
    --sn-text-muted: #999999;
    --sn-border: #D6D6D6;
    --sn-border-light: #E8E8E8;
    --sn-sidebar-width: 250px;
    --sn-topbar-height: 50px;
    --sn-radius: 4px;
    --sn-radius-lg: 8px;
    --sn-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --sn-shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --sn-shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --sn-transition: all 0.2s ease;
    --sn-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* SLA Colors */
    --sla-green: #2ECC71;
    --sla-amber: #F39C12;
    --sla-red: #E74C3C;

    /* Priority Colors */
    --priority-critical: #E74C3C;
    --priority-high: #E67E22;
    --priority-medium: #F1C40F;
    --priority-low: #3498DB;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--sn-font);
    color: var(--sn-text);
    background: var(--sn-bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--sn-info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- LOGIN PAGE ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--sn-primary) 0%, var(--sn-primary-light) 50%, var(--sn-primary-lighter) 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--sn-white);
    border-radius: var(--sn-radius-lg);
    box-shadow: var(--sn-shadow-lg);
    padding: 40px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo i {
    font-size: 40px;
    color: var(--sn-primary);
    margin-bottom: 12px;
    display: block;
}

.login-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--sn-primary);
    margin-bottom: 4px;
}

.login-logo p {
    color: var(--sn-text-muted);
    font-size: 13px;
}

/* ---- FORMS ---- */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--sn-text);
    font-size: 13px;
}

.form-group label .required {
    color: var(--sn-danger);
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--sn-border);
    border-radius: var(--sn-radius);
    font-size: 14px;
    font-family: var(--sn-font);
    color: var(--sn-text);
    background: var(--sn-white);
    transition: var(--sn-transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--sn-info);
    box-shadow: 0 0 0 3px rgba(27, 150, 255, 0.15);
}

.form-control::placeholder {
    color: var(--sn-text-muted);
}

select.form-control {
    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 fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-error {
    color: var(--sn-danger);
    font-size: 12px;
    margin-top: 4px;
}

/* ---- BUTTONS ---- */
.btn {
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: var(--sn-radius);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--sn-font);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--sn-transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
    background: var(--sn-primary);
    color: var(--sn-white);
    border-color: var(--sn-primary);
}
.btn-primary:hover { background: var(--sn-primary-light); }

.btn-success {
    background: var(--sn-accent);
    color: var(--sn-white);
}
.btn-success:hover { background: var(--sn-accent-hover); }

.btn-danger {
    background: var(--sn-danger);
    color: var(--sn-white);
}
.btn-danger:hover { background: #C0392B; }

.btn-warning {
    background: var(--sn-warning);
    color: var(--sn-white);
}

.btn-info {
    background: var(--sn-info);
    color: var(--sn-white);
}
.btn-info:hover { background: #0D7FE9; }

.btn-outline {
    background: transparent;
    color: var(--sn-text);
    border-color: var(--sn-border);
}
.btn-outline:hover { background: var(--sn-surface); }

.attachment-link {
    background: none;
    border: 0;
    color: var(--sn-info);
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-align: left;
}

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

.attachment-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.readonly-priority {
    min-height: 44px;
    border: 1px solid var(--sn-border);
    border-radius: var(--sn-radius);
    background: var(--sn-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
}

.priority-meta {
    color: var(--sn-text-secondary);
    font-size: 12px;
}

.compact-stats {
    margin-bottom: 24px;
}

.report-visual-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.report-visual-grid-wide {
    margin-bottom: 24px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-panel {
    background: var(--sn-white);
    border: 1px solid var(--sn-border-light);
    border-radius: var(--sn-radius-lg);
    box-shadow: var(--sn-shadow);
    min-height: 100%;
}

.chart-panel-header {
    padding: 16px 18px 0;
}

.chart-panel-header h4 {
    font-size: 14px;
    font-weight: 600;
}

.chart-panel-body {
    padding: 18px;
}

.chart-pie-layout {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 20px;
    align-items: center;
}

.chart-donut {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    position: relative;
    margin: 0 auto;
}

.chart-donut-center {
    position: absolute;
    inset: 28px;
    background: var(--sn-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
}

.chart-donut-center strong {
    font-size: 24px;
}

.chart-donut-center span {
    color: var(--sn-text-secondary);
    font-size: 12px;
}

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chart-legend-item {
    display: grid;
    grid-template-columns: 12px 1fr auto;
    gap: 10px;
    align-items: center;
    font-size: 13px;
}

.chart-legend-item .swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bar-chart-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bar-chart-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.bar-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: var(--sn-surface);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 999px;
}

.chart-empty {
    padding: 24px 18px;
    color: var(--sn-text-secondary);
    text-align: center;
}

.shift-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.shift-card {
    background: var(--sn-white);
    border: 1px solid var(--sn-border-light);
    border-radius: var(--sn-radius-lg);
    box-shadow: var(--sn-shadow);
    padding: 18px;
}

.shift-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 8px;
}

.shift-card-header h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.shift-meta,
.roster-item-meta {
    color: var(--sn-text-secondary);
    font-size: 12px;
}

.shift-card-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin: 14px 0;
}

.roster-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.roster-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--sn-border-light);
    border-radius: var(--sn-radius);
    background: var(--sn-surface);
}

.roster-item-title {
    display: flex;
    gap: 8px;
    align-items: center;
    font-weight: 600;
    margin-bottom: 4px;
}

.weekday-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.weekday-chip {
    position: relative;
    cursor: pointer;
}

.weekday-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.weekday-chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid var(--sn-border);
    background: var(--sn-white);
    font-size: 12px;
    font-weight: 600;
}

.weekday-chip input:checked + span {
    background: rgba(27, 150, 255, 0.12);
    border-color: var(--sn-info);
    color: var(--sn-primary);
}

@media (max-width: 1100px) {
    .report-visual-grid,
    .report-visual-grid-wide,
    .shift-grid {
        grid-template-columns: 1fr;
    }

    .chart-pie-layout {
        grid-template-columns: 1fr;
    }
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

.btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---- LAYOUT ---- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sn-sidebar-width);
    background: var(--sn-primary);
    color: var(--sn-white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand i {
    font-size: 24px;
    color: var(--sn-accent);
}

.sidebar-brand h2 {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
}

.sidebar-brand span {
    font-size: 10px;
    display: block;
    opacity: 0.7;
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-section-title {
    padding: 8px 20px 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
    font-weight: 600;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    transition: var(--sn-transition);
    cursor: pointer;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.08);
    color: var(--sn-white);
    text-decoration: none;
}

.sidebar-link.active {
    background: rgba(255,255,255,0.12);
    color: var(--sn-white);
    border-left-color: var(--sn-accent);
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 14px;
}

.sidebar-link .badge-count {
    margin-left: auto;
    background: var(--sn-danger);
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.sidebar-user {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--sn-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-info .name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-info .role {
    font-size: 11px;
    opacity: 0.6;
    text-transform: capitalize;
}

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

/* Top Bar */
.topbar {
    height: var(--sn-topbar-height);
    background: var(--sn-white);
    border-bottom: 1px solid var(--sn-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--sn-text-secondary);
}

.topbar-breadcrumb .separator {
    color: var(--sn-text-muted);
}

.topbar-breadcrumb .current {
    color: var(--sn-text);
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--sn-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--sn-transition);
    position: relative;
}

.topbar-btn:hover {
    background: var(--sn-surface);
    color: var(--sn-text);
}

.topbar-btn .notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--sn-danger);
    border-radius: 50%;
    border: 2px solid var(--sn-white);
}

.topbar-search {
    display: flex;
    align-items: center;
    background: var(--sn-surface);
    border-radius: 20px;
    padding: 6px 14px;
    gap: 8px;
    width: 280px;
}

.topbar-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    font-family: var(--sn-font);
    color: var(--sn-text);
    width: 100%;
}

.topbar-search i {
    color: var(--sn-text-muted);
    font-size: 13px;
}

/* Page Content */
.page-content {
    flex: 1;
    padding: 24px;
}

/* ---- PAGE HEADER ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--sn-dark);
}

.page-header h1 .subtitle {
    font-size: 14px;
    font-weight: 400;
    color: var(--sn-text-secondary);
    margin-left: 8px;
}

.page-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ---- CARDS ---- */
.card {
    background: var(--sn-white);
    border-radius: var(--sn-radius-lg);
    box-shadow: var(--sn-shadow);
    border: 1px solid var(--sn-border-light);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--sn-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--sn-dark);
}

.card-header .card-actions {
    display: flex;
    gap: 6px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--sn-border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ---- STAT CARDS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--sn-white);
    border-radius: var(--sn-radius-lg);
    padding: 20px;
    box-shadow: var(--sn-shadow);
    border: 1px solid var(--sn-border-light);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--sn-transition);
}

.stat-card:hover {
    box-shadow: var(--sn-shadow-md);
    transform: translateY(-1px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.blue { background: rgba(27,150,255,0.1); color: var(--sn-info); }
.stat-icon.green { background: rgba(46,204,113,0.1); color: var(--sn-success); }
.stat-icon.red { background: rgba(231,76,60,0.1); color: var(--sn-danger); }
.stat-icon.orange { background: rgba(243,156,18,0.1); color: var(--sn-warning); }
.stat-icon.purple { background: rgba(155,89,182,0.1); color: #9B59B6; }

.stat-info h3 {
    font-size: 26px;
    font-weight: 700;
    color: var(--sn-dark);
    line-height: 1;
}

.stat-info p {
    font-size: 12px;
    color: var(--sn-text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* ---- TABLES ---- */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    background: var(--sn-surface);
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--sn-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--sn-border-light);
    white-space: nowrap;
}

table td {
    padding: 12px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--sn-border-light);
    vertical-align: middle;
}

table tr:hover td {
    background: rgba(27, 150, 255, 0.03);
}

table tr.clickable {
    cursor: pointer;
}

table tr.clickable:hover td {
    background: rgba(27, 150, 255, 0.06);
}

.table-empty {
    padding: 40px;
    text-align: center;
    color: var(--sn-text-muted);
}

.table-empty i {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
    opacity: 0.4;
}

/* ---- BADGES ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* Status badges */
.badge-new { background: #EBF5FF; color: #1B6EC2; }
.badge-open { background: #E8F5E9; color: #2E7D32; }
.badge-assigned { background: #FFF3E0; color: #E65100; }
.badge-in_progress, .badge-in-progress { background: #E3F2FD; color: #1565C0; }
.badge-on_hold, .badge-on-hold { background: #FFF8E1; color: #F57F17; }
.badge-awaiting_info, .badge-awaiting-info { background: #F3E5F5; color: #7B1FA2; }
.badge-resolved { background: #E0F2F1; color: #00695C; }
.badge-closed { background: #F5F5F5; color: #616161; }
.badge-force_closed, .badge-force-closed { background: #FFEBEE; color: #C62828; }

/* Priority badges */
.badge-critical { background: #FFEBEE; color: #C62828; }
.badge-high { background: #FFF3E0; color: #E65100; }
.badge-medium { background: #FFFDE7; color: #F57F17; }
.badge-low { background: #E3F2FD; color: #1565C0; }

/* SLA badges */
.badge-sla-green { background: #E8F5E9; color: #2E7D32; }
.badge-sla-amber { background: #FFF8E1; color: #F57F17; }
.badge-sla-red { background: #FFEBEE; color: #C62828; animation: pulse-red 2s infinite; }

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ---- FILTERS BAR ---- */
.filters-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.filters-bar .form-control {
    width: auto;
    min-width: 150px;
    padding: 7px 12px;
    font-size: 13px;
}

.filters-bar .search-input {
    min-width: 250px;
}

/* ---- PAGINATION ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 0;
}

.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--sn-border);
    background: var(--sn-white);
    border-radius: var(--sn-radius);
    font-size: 13px;
    cursor: pointer;
    transition: var(--sn-transition);
    font-family: var(--sn-font);
    color: var(--sn-text);
}

.pagination button:hover:not(:disabled) {
    background: var(--sn-surface);
    border-color: var(--sn-info);
}

.pagination button.active {
    background: var(--sn-primary);
    color: var(--sn-white);
    border-color: var(--sn-primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .page-info {
    font-size: 13px;
    color: var(--sn-text-secondary);
    margin: 0 8px;
}

/* ---- TICKET DETAIL ---- */
.ticket-detail {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
}

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

.ticket-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.ticket-header-info { flex: 1; }

.ticket-header-info .ticket-number {
    font-size: 13px;
    color: var(--sn-text-muted);
    font-weight: 500;
}

.ticket-header-info h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--sn-dark);
    margin-top: 4px;
}

.ticket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 10px;
}

.ticket-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--sn-text-secondary);
}

.ticket-meta-item i {
    font-size: 12px;
    color: var(--sn-text-muted);
}

.ticket-description {
    padding: 16px 20px;
    background: var(--sn-surface);
    border-radius: var(--sn-radius);
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 24px;
}

/* Sidebar Fields */
.ticket-sidebar .field-group {
    margin-bottom: 16px;
}

.ticket-sidebar .field-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--sn-text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.ticket-sidebar .field-value {
    font-size: 14px;
    color: var(--sn-text);
    font-weight: 500;
}

/* Timeline / Comments */
.timeline {
    position: relative;
    padding-left: 32px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--sn-border-light);
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--sn-border-light);
}

.timeline-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -25px;
    top: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--sn-white);
    border: 2px solid var(--sn-info);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: var(--sn-info);
}

.timeline-dot.system {
    border-color: var(--sn-text-muted);
    color: var(--sn-text-muted);
}

.timeline-dot.internal {
    border-color: var(--sn-warning);
    color: var(--sn-warning);
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.timeline-header .author {
    font-weight: 600;
    font-size: 13px;
    color: var(--sn-dark);
}

.timeline-header .time {
    font-size: 12px;
    color: var(--sn-text-muted);
}

.timeline-header .tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.timeline-header .tag.work-note {
    background: #FFF3E0;
    color: #E65100;
}

.timeline-header .tag.status-change {
    background: #E3F2FD;
    color: #1565C0;
}

.timeline-content {
    font-size: 14px;
    line-height: 1.6;
    color: var(--sn-text);
}

.comment-form {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment-form textarea {
    min-height: 80px;
}

.comment-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* SLA Timer */
.sla-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--sn-radius);
    font-size: 13px;
    font-weight: 600;
}

.sla-timer.green {
    background: #E8F5E9;
    color: #2E7D32;
}

.sla-timer.amber {
    background: #FFF8E1;
    color: #F57F17;
}

.sla-timer.red {
    background: #FFEBEE;
    color: #C62828;
    animation: pulse-red 2s infinite;
}

.sla-timer i {
    font-size: 16px;
}

/* ---- MODAL ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 24px;
    animation: fadeIn 0.15s ease;
}

.modal {
    background: var(--sn-white);
    border-radius: var(--sn-radius-lg);
    box-shadow: var(--sn-shadow-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.2s ease;
}

.modal.modal-lg { max-width: 720px; }
.modal.modal-xl { max-width: 900px; }

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--sn-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--sn-dark);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 18px;
    color: var(--sn-text-muted);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--sn-transition);
}

.modal-close:hover {
    background: var(--sn-surface);
    color: var(--sn-text);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--sn-border-light);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ---- TABS ---- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--sn-border-light);
    margin-bottom: 20px;
    gap: 0;
}

.tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--sn-text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--sn-transition);
}

.tab:hover {
    color: var(--sn-text);
}

.tab.active {
    color: var(--sn-primary);
    border-bottom-color: var(--sn-primary);
    font-weight: 600;
}

/* ---- TOAST / ALERTS ---- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--sn-white);
    border-radius: var(--sn-radius);
    box-shadow: var(--sn-shadow-lg);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    max-width: 420px;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid;
}

.toast.success { border-color: var(--sn-success); }
.toast.error { border-color: var(--sn-danger); }
.toast.warning { border-color: var(--sn-warning); }
.toast.info { border-color: var(--sn-info); }

.toast i { font-size: 18px; }
.toast.success i { color: var(--sn-success); }
.toast.error i { color: var(--sn-danger); }
.toast.warning i { color: var(--sn-warning); }
.toast.info i { color: var(--sn-info); }

.toast-message { flex: 1; font-size: 13px; }

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--sn-text-muted);
    font-size: 16px;
    padding: 0;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---- DROPDOWN ---- */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--sn-white);
    border: 1px solid var(--sn-border-light);
    border-radius: var(--sn-radius);
    box-shadow: var(--sn-shadow-lg);
    min-width: 180px;
    z-index: 1500;
    padding: 6px 0;
    display: none;
    animation: fadeIn 0.15s ease;
}

.dropdown-menu.show { display: block; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--sn-text);
    cursor: pointer;
    transition: var(--sn-transition);
}

.dropdown-item:hover {
    background: var(--sn-surface);
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--sn-text-secondary);
}

.dropdown-divider {
    height: 1px;
    background: var(--sn-border-light);
    margin: 4px 0;
}

/* ---- NOTIFICATION PANEL ---- */
.notif-panel {
    position: fixed;
    top: 0;
    right: -380px;
    width: 380px;
    height: 100vh;
    background: var(--sn-white);
    box-shadow: -4px 0 20 rgba(0,0,0,0.15);
    z-index: 2000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.notif-panel.open { right: 0; }

.notif-panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--sn-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notif-panel-header h3 { font-size: 16px; font-weight: 700; }

.notif-list {
    flex: 1;
    overflow-y: auto;
}

.notif-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--sn-border-light);
    cursor: pointer;
    transition: var(--sn-transition);
}

.notif-item:hover { background: var(--sn-surface); }
.notif-item.unread { background: rgba(27,150,255,0.04); border-left: 3px solid var(--sn-info); }

.notif-item .notif-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--sn-dark);
    margin-bottom: 2px;
}

.notif-item .notif-message {
    font-size: 12px;
    color: var(--sn-text-secondary);
}

.notif-item .notif-time {
    font-size: 11px;
    color: var(--sn-text-muted);
    margin-top: 4px;
}

/* ---- DASHBOARD GRID ---- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dashboard-grid .full-width {
    grid-column: 1 / -1;
}

/* ---- KNOWLEDGE BASE ---- */
.kb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.kb-card {
    background: var(--sn-white);
    border: 1px solid var(--sn-border-light);
    border-radius: var(--sn-radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: var(--sn-transition);
}

.kb-card:hover {
    box-shadow: var(--sn-shadow-md);
    border-color: var(--sn-info);
}

.kb-card .kb-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--sn-dark);
    margin-bottom: 6px;
}

.kb-card .kb-summary {
    font-size: 13px;
    color: var(--sn-text-secondary);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kb-card .kb-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--sn-text-muted);
}

/* KB Article View */
.kb-article-content {
    max-width: 800px;
    line-height: 1.8;
    font-size: 15px;
}

.kb-article-content h3 {
    margin: 20px 0 10px;
    font-size: 18px;
}

.kb-article-content ol, .kb-article-content ul {
    margin-left: 24px;
    margin-bottom: 12px;
}

.kb-feedback {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 30px;
    padding: 16px;
    background: var(--sn-surface);
    border-radius: var(--sn-radius);
}

.kb-feedback span {
    font-size: 14px;
    color: var(--sn-text-secondary);
}

/* ---- LOADING  ---- */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--sn-border-light);
    border-top-color: var(--sn-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--sn-text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--sn-text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
    .ticket-detail {
        grid-template-columns: 1fr;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .topbar-search {
        display: none;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

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

/* ---- UTILITY CLASSES ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--sn-text-muted); }
.text-sm { font-size: 12px; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }

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

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

/* Toggle button for mobile */
.sidebar-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
    color: var(--sn-text);
}

@media (max-width: 768px) {
    .sidebar-toggle { display: flex; align-items: center; justify-content: center; }
}

/* Workload bars */
.workload-bar {
    height: 8px;
    background: var(--sn-border-light);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 4px;
}

.workload-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.workload-bar-fill.low { background: var(--sn-success); }
.workload-bar-fill.medium { background: var(--sn-warning); }
.workload-bar-fill.high { background: var(--sn-danger); }
