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

:root {
    --primary: #072c93;
    --primary-light: #0a3bbf;
    --primary-dark: #072c93;
    --accent: #0b4fc8;
    --accent-light: #5d8dee;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #4f7fa8;
    --chart-blue-1: #072c93;
    --chart-blue-2: #0a3bbf;
    --chart-blue-3: #2563eb;
    --chart-blue-4: #5d8dee;
    --chart-blue-5: #93b4f6;
    --chart-blue-6: #dbe8ff;
    --chart-neutral: #64748b;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-width: 250px;
    --topbar-height: 52px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

html, body {
    min-height: 100%;
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

body { margin: 0; }

a { color: inherit; }

/* ========== Top Bar ========== */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: var(--topbar-height);
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-right { gap: 14px; }

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
}

.topbar-logo {
    width: 36px;
    height: 36px;
    border-radius: 0;
    object-fit: contain;
}

.topbar-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: .2px;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 4px 6px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: background .15s;
}

.sidebar-toggle:hover { background: rgba(255,255,255,.15); }
.toggle-icon { line-height: 1; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .5px;
    flex-shrink: 0;
}

.topbar-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.topbar-user-info strong {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .82rem;
}

.topbar-user-info small { font-size: .68rem; opacity: .65; }

.topbar-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 4px;
    border-radius: 4px;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    font-size: 1.05rem;
    line-height: 1;
    filter: grayscale(1);
    transition: all .15s;
}

.topbar-action:hover {
    color: #fff;
    background: rgba(255,255,255,.12);
}

.topbar-logout-form { margin: 0; }
.topbar-action-button { border: none; background: transparent; cursor: pointer; }

/* ========== Sidebar ========== */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    z-index: 100;
    width: var(--sidebar-width);
    background: var(--primary-dark);
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width .25s cubic-bezier(.4,0,.2,1), transform .25s cubic-bezier(.4,0,.2,1);
}

.sidebar.collapsed {
    width: 0;
    transform: translateX(calc(-1 * var(--sidebar-width)));
}

.sidebar.expanded {
    width: var(--sidebar-width);
    transform: translateX(0);
}

.sidebar-nav {
    list-style: none;
    padding: 8px 0;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.nav-group-label {
    padding: 10px 18px;
    border-top: 1px solid rgba(255,255,255,.06);
    color: rgba(255,255,255,.5);
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.1px;
    user-select: none;
}

.nav-group-label:first-child { border-top: none; }

.sidebar-nav li a,
.sidebar-nav li .nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px 8px 24px;
    border-left: 3px solid transparent;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    font-size: .84rem;
    transition: all .15s;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
}
.sidebar-nav li a:hover,
.sidebar-nav li .nav-btn:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.sidebar-nav li a.active {
    background: rgba(255,255,255,.12);
    color: #fff;
    font-weight: 600;
    border-left-color: var(--accent);
}

.nav-icon {
    font-size: .9rem;
    width: 18px;
    text-align: center;
    filter: grayscale(1);
    opacity: .65;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px 18px;
    border-top: 1px solid rgba(255,255,255,.1);
    color: rgba(255,255,255,.35);
    font-size: .72rem;
    text-align: center;
}

/* ========== Main content ========== */
.main-content {
    margin-top: var(--topbar-height);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--topbar-height));
    transition: margin-left .25s cubic-bezier(.4,0,.2,1);
}

.main-content.sidebar-is-expanded { margin-left: var(--sidebar-width); }
.main-content.sidebar-is-collapsed { margin-left: 0; }

.content-area {
    width: 100%;
    max-width: none;
    padding: 24px 32px;
    flex: 1;
}

.public-content-area { max-width: none; }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    top: var(--topbar-height);
    background: rgba(0,0,0,.45);
    z-index: 90;
    display: none;
}

/* ========== MudBlazor overrides to match Ask_ICTAZ theme ========== */
/* Remove default MudBlazor app bar / drawer when using custom layout */
.mud-appbar { display: none !important; }
.mud-drawer { display: none !important; }
.mud-main-content { padding-top: 0 !important; margin-left: 0 !important; }

/* Cards */
.mud-card {
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow) !important;
}
.mud-card:hover { box-shadow: var(--shadow-md) !important; }

/* Paper */
.mud-paper {
    border-radius: var(--radius) !important;
}

/* Primary button colour */
.mud-button-filled-primary {
    background-color: var(--primary) !important;
}
.mud-button-filled-primary:hover {
    background-color: var(--primary-light) !important;
}

/* Table */
.mud-table-head th {
    background: var(--bg) !important;
    color: var(--text-muted) !important;
    text-transform: uppercase !important;
    font-size: .75rem !important;
    letter-spacing: .5px !important;
    font-weight: 600 !important;
}
.mud-table-row:hover td { background: #f8fafc !important; }

/* ========== Page Header ========== */
.page-header {
    background: var(--surface);
    color: var(--text);
    padding: 22px 24px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}
.page-header-icon { font-size: 1.7rem; opacity: .8; filter: grayscale(.4); }
.page-header h1 { margin: 0; font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.page-header p  { margin: 4px 0 0; color: var(--text-muted); font-size: .9rem; }

/* ========== Cards ========== */
.card {
    background: var(--surface);
    border: 1px solid rgba(226,232,240,.8);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

/* ========== Alerts ========== */
.alert {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 16px; border-radius: var(--radius); margin-bottom: 16px;
    font-size: .9rem;
}
.alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #dcfce7; color: #166534; border-left: 4px solid var(--success); }
.alert-error   { background: #fecaca; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid var(--accent); }
.alert strong  { font-weight: 600; }

/* ========== Toast / Snackbar ========== */
.toast-container {
    position: fixed; bottom: 24px; right: 24px;
    z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 18px; border-radius: var(--radius);
    box-shadow: var(--shadow-md); font-size: .9rem; font-weight: 500;
    animation: toastIn .25s ease;
    min-width: 260px; max-width: 380px;
}
.toast-success { background: #166534; color: #fff; }
.toast-error   { background: #991b1b; color: #fff; }
.toast-warning { background: #92400e; color: #fff; }
.toast-info    { background: var(--primary); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ========== Modal / Dialog ========== */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 500; display: flex; align-items: center; justify-content: center; padding: 16px;
    overflow-y: auto;
}
.modal {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    width: 100%; max-width: 480px; overflow: hidden;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
}
.modal-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    flex-shrink: 0;
}
.modal-header h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
}
.modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.modal-close { background: none; border: none; font-size: 1.25rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-close:hover { color: var(--text); }

/* ========== Buttons ========== */
.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
    border: none; border-radius: var(--radius); font-size: .85rem; font-weight: 500;
    cursor: pointer; transition: all .15s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-light); }
.btn-secondary { background: var(--text-muted); color: #fff; }
.btn-secondary:hover { opacity: .85; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 4px 10px; font-size: .8rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-link { background: none; border: none; color: var(--accent); text-decoration: none; padding: 0; }
.btn-link:hover { text-decoration: underline; }

/* ========== Forms ========== */
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: .85rem; font-weight: 500; color: var(--text-muted); }
.form-control {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: .9rem; outline: none; transition: border .15s;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,165,233,.15); }
select.form-control { appearance: auto; }

.login-page {
    min-height: calc(100vh - var(--topbar-height) - 48px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.login-card {
    width: 100%;
    max-width: 430px;
    padding: 0;
    overflow: hidden;
}

.login-logo-header {
    background: var(--primary);
    padding: 28px 0 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-logo {
    height: 60px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.login-card-body {
    padding: 28px;
}

.login-header {
    text-align: center;
    margin-bottom: 20px;
}

.login-header h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.login-header p {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: .9rem;
}

.login-brand {
    margin-bottom: 24px;
    text-align: center;
}

.login-brand h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.login-brand h1:focus {
    outline: none;
}

.login-brand p {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: .9rem;
}

.login-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-button {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    font-size: .95rem;
    font-weight: 600;
    text-align: center;
    display: inline-flex;
    align-items: center;
}

.login-note {
    text-align: center;
    font-size: .9rem;
    color: var(--text-muted);
    margin: 18px 0 0;
    line-height: 1.55;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-submit,
.external-login-button {
    width: 100%;
    justify-content: center;
    min-height: 42px;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: .85rem;
}

.login-divider span:first-child,
.login-divider span:last-child {
    height: 1px;
    background: var(--border);
    flex: 1;
}

.external-login-form,
.external-login-actions {
    width: 100%;
}

.external-login-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filters-bar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 20px; }
.filters-bar .form-group { min-width: 180px; }
.search-input { min-width: 280px; }

/* ========== Table ========== */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th {
    text-align: left; padding: 12px 16px; background: var(--bg); font-weight: 600;
    color: var(--text-muted); text-transform: uppercase; font-size: .75rem; letter-spacing: .5px;
    border-bottom: 2px solid var(--border);
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr { cursor: pointer; transition: background .1s; }
tbody tr:hover { background: #f8fafc; }

/* ========== Pagination ========== */
.pagination { display: flex; gap: 4px; justify-content: center; align-items: center; margin-top: 20px; }
.pagination button { min-width: 36px; height: 36px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); cursor: pointer; font-size: .85rem; }
.pagination button:hover:not(:disabled) { background: var(--bg); }
.pagination button:disabled { opacity: .4; cursor: default; }
.pagination .page-info { font-size: .85rem; color: var(--text-muted); padding: 0 8px; }

/* ========== Form grid & actions ========== */
.form-section-title {
    font-size: .95rem; font-weight: 600; color: var(--text);
    margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.form-grid   { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 16px; margin-bottom: 20px; }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 20px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
@media (max-width: 640px) {
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}
.form-row   { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.form-row .form-group { flex: 1; min-width: 200px; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.form-error   { color: var(--danger); font-size: .8rem; margin-top: 4px; }
.form-hint    { color: var(--text-muted); font-size: .8rem; margin-top: 4px; }
textarea.form-control { resize: vertical; min-height: 80px; font-family: inherit; }

.form-divider {
    height: 1px;
    border: 0;
    background: var(--border);
    margin: 16px 0 20px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.col-md-4 {
    width: 100%;
    max-width: 440px;
}

.form-floating {
    display: flex;
    flex-direction: column-reverse;
    gap: 4px;
    margin-bottom: 12px;
}

.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.w-100 { width: 100%; }
.btn-lg { padding: 10px 18px; font-size: .95rem; }
.text-danger { color: var(--danger); }
.checkbox { display: flex; align-items: center; gap: 8px; }

/* ========== Stat Cards ========== */
.stats-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card   { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; border-left: 4px solid var(--border); }
.stat-card.clickable { cursor: pointer; transition: all .15s; }
.stat-card.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-value  { font-size: 2rem; font-weight: 700; }
.stat-label  { font-size: .85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-primary { border-left-color: var(--primary); }
.stat-success { border-left-color: var(--success); }
.stat-warning { border-left-color: var(--warning); }
.stat-info    { border-left-color: var(--info); }
.stat-accent  { border-left-color: var(--accent); }

/* Ask_ICTAZ style semantic stat cards */
.stat-card.open { border-left: 4px solid var(--accent); }
.stat-card.in-progress { border-left: 4px solid var(--warning); }
.stat-card.awaiting { border-left: 4px solid var(--info); }
.stat-card.resolved { border-left: 4px solid var(--success); }
.stat-card.closed { border-left: 4px solid var(--text-muted); }
.stat-card.total { border-left: 4px solid var(--primary); }
.stat-card.today { border-left: 4px solid var(--danger); }
.stat-card.users { border-left: 4px solid var(--primary-light); }

/* ========== Page toolbar (search + buttons above table) ========== */
.page-toolbar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-toolbar .search-input  { flex: 1; min-width: 220px; }
.page-toolbar .toolbar-right { margin-left: auto; display: flex; gap: 8px; }

/* ========== Loading spinner ========== */
.spinner {
    display: inline-block; width: 24px; height: 24px;
    border: 3px solid var(--border); border-top-color: var(--accent);
    border-radius: 50%; animation: spin .7s linear infinite;
    margin-right: 8px; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner-container {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 12px; padding: 64px 24px; color: var(--text-muted);
}
.spinner-container .spinner { width: 32px; height: 32px; border-width: 3.5px; margin: 0; }

/* Full-area loading state */
.loading {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 16px; padding: 64px 24px; color: var(--text-muted);
    animation: fadeIn .3s ease;
}
.loading .spinner { width: 36px; height: 36px; border-width: 3.5px; margin: 0; }
.loading-text { font-size: .95rem; font-weight: 500; letter-spacing: .01em; }
.loading-subtext { font-size: .8rem; color: var(--text-muted); opacity: .7; margin-top: -8px; }

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

/* Skeleton shimmer base */
.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, #e8edf2 37%, var(--border) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
    border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Skeleton card grid (e.g. dashboard stats) */
.skeleton-cards {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px; margin-bottom: 24px; animation: fadeIn .3s ease;
}
.skeleton-card {
    background: var(--surface); border-radius: var(--radius); padding: 24px;
    box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.skeleton-card .skeleton-number { width: 60px; height: 36px; }
.skeleton-card .skeleton-label { width: 90px; height: 14px; }

/* Skeleton table */
.skeleton-table { animation: fadeIn .3s ease; }
.skeleton-table-header {
    display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr; gap: 16px;
    padding: 14px 20px; border-bottom: 2px solid var(--border);
}
.skeleton-table-header .skeleton { height: 14px; border-radius: 4px; }
.skeleton-table-row {
    display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr; gap: 16px;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.skeleton-table-row .skeleton { height: 16px; border-radius: 4px; }
.skeleton-table-row:nth-child(odd) .skeleton { opacity: .85; }

/* Skeleton content block */
.skeleton-block { animation: fadeIn .3s ease; }
.skeleton-line { height: 14px; margin-bottom: 12px; border-radius: 4px; }
.skeleton-line.w-full { width: 100%; }
.skeleton-line.w-3\/4 { width: 75%; }
.skeleton-line.w-1\/2 { width: 50%; }
.skeleton-line.w-1\/3 { width: 33%; }
.skeleton-line.w-1\/4 { width: 25%; }
.skeleton-line.h-lg { height: 24px; margin-bottom: 16px; }
.skeleton-line.h-xl { height: 32px; margin-bottom: 20px; }

/* Skeleton section with card wrapper */
.skeleton-section {
    background: var(--surface); border-radius: var(--radius);
    padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px;
    animation: fadeIn .3s ease;
}

/* Pulse variant for inline action indicators */
.skeleton-pulse { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* Inline loading badge */
.loading-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 16px;
    background: rgba(14, 165, 233, .08); color: var(--accent);
    font-size: .8rem; font-weight: 500;
}
.loading-badge .spinner { width: 14px; height: 14px; border-width: 2px; margin: 0; }

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .3px;
    white-space: nowrap;
}
.badge-resolved  { background: #dcfce7; color: #166534; }
.badge-open      { background: #dbeafe; color: #1e40af; }
.badge-inprogress{ background: #fef3c7; color: #92400e; }
.badge-awaiting  { background: #e0e7ff; color: #3730a3; }
.badge-closed    { background: #f1f5f9; color: #475569; }
.badge-escalated { background: #fecaca; color: #991b1b; }
.badge-default   { background: rgba(100,116,139,.12); color: #475569; }

.badge-low     { background: #f1f5f9; color: #475569; }
.badge-medium   { background: #dbeafe; color: #1e40af; }
.badge-high     { background: #fef3c7; color: #92400e; }
.badge-critical { background: #fecaca; color: #991b1b; }
.badge-warning  { background: #ffedd5; color: #c2410c; }  /* Orange - SLA due soon (15-30 min) */
.badge-soon     { background: #fef9c3; color: #854d0e; }    /* Yellow - SLA approaching (30-120 min) */

/* ========== Star rating display ========== */
.star-display { display: inline-flex; gap: 2px; color: var(--warning); font-size: .95rem; }
.star-display .empty { color: var(--border); }

/* ========== Details / meta grids ========== */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 12px; margin: 16px 0; }
.meta-item { display: flex; flex-direction: column; gap: 2px; }
.meta-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); font-weight: 600; }
.meta-value { font-size: .9rem; }

/* ========== Empty state ========== */
.empty-state {
    text-align: center; padding: 48px 24px; color: var(--text-muted);
}
.empty-state p { margin: 8px 0 0; font-size: .9rem; }

/* ========== Utility helpers ========== */
.text-muted    { color: var(--text-muted); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }
.text-accent   { color: var(--accent); }
.font-bold     { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.w-full { width: 100%; }
.flex-1 { flex: 1; }
.pre-wrap { white-space: pre-wrap; }

/* ========== KPI Cards (icon + value + label + sub) ========== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 28px; }
.kpi-card {
    background: var(--surface); border-radius: var(--radius); padding: 20px 20px 16px;
    box-shadow: var(--shadow); display: flex; align-items: flex-start; gap: 16px;
    border-left: 4px solid var(--border); transition: all .15s;
}
.kpi-card.clickable { cursor: pointer; }
.kpi-card.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; flex-shrink: 0;
}
.kpi-icon.primary   { background: rgba(7,44,147,.1);   color: var(--primary); }
.kpi-icon.success   { background: rgba(34,197,94,.12); color: #15803d; }
.kpi-icon.warning   { background: rgba(245,158,11,.12); color: #b45309; }
.kpi-icon.danger    { background: rgba(239,68,68,.12); color: #b91c1c; }
.kpi-icon.accent    { background: rgba(14,165,233,.12); color: #0369a1; }
.kpi-icon.info      { background: rgba(79,127,168,.12); color: var(--info); }
.kpi-body { flex: 1; min-width: 0; }
.kpi-value { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.kpi-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.kpi-sub   { font-size: .76rem; color: var(--text-muted); margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.kpi-card.k-primary { border-left-color: var(--primary); }
.kpi-card.k-success { border-left-color: var(--success); }
.kpi-card.k-warning { border-left-color: var(--warning); }
.kpi-card.k-danger  { border-left-color: var(--danger);  }
.kpi-card.k-accent  { border-left-color: var(--accent);  }
.kpi-card.k-info    { border-left-color: var(--info);    }

/* ========== Progress Bar ========== */
.progress-wrap { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-bar  { height: 100%; border-radius: 99px; transition: width .5s ease; }
.progress-bar.primary  { background: var(--primary); }
.progress-bar.success  { background: var(--success); }
.progress-bar.warning  { background: var(--warning); }
.progress-bar.accent   { background: var(--accent); }
.progress-bar.danger   { background: var(--danger); }

/* ========== Bar Chart (CSS-only horizontal/vertical) ========== */
.chart-bars-v { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-bottom: 28px; position: relative; }
.chart-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.chart-bar-fill {
    background: var(--accent); border-radius: 4px 4px 0 0; width: 100%;
    min-height: 4px; transition: height .45s ease;
}
.chart-bar-fill.success { background: var(--success); }
.chart-bar-fill.warning { background: var(--warning); }
.chart-bar-fill.primary { background: var(--primary); }
.chart-bar-label { font-size: .7rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.chart-bar-value { font-size: .7rem; color: var(--text-muted); position: absolute; top: 0; }

.chart-bars-h { display: flex; flex-direction: column; gap: 10px; }
.chart-h-row  { display: flex; align-items: center; gap: 10px; }
.chart-h-label { min-width: 56px; font-size: .82rem; font-weight: 600; text-align: right; white-space: nowrap; }
.chart-h-track { flex: 1; height: 24px; background: var(--border); border-radius: 4px; overflow: hidden; }
.chart-h-fill  { height: 100%; border-radius: 4px; transition: width .5s ease; display: flex; align-items: center; padding-left: 8px; }
.chart-h-count { font-size: .75rem; font-weight: 600; color: #fff; }

/* ========== Person / Profile Card ========== */
.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.person-card {
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
    overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s;
}
.person-card:hover { box-shadow: var(--shadow-md); }
.person-card-header {
    padding: 16px 16px 12px; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid var(--border);
}
.avatar {
    width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: 1rem; font-weight: 700; color: #fff;
    flex-shrink: 0; text-transform: uppercase; letter-spacing: .5px;
}
.avatar.primary { background: var(--primary); }
.avatar.accent  { background: var(--accent); }
.avatar.success { background: var(--success); }
.avatar.warning { background: linear-gradient(135deg, var(--warning), #d97706); }
.avatar.info    { background: var(--info); }
.avatar.danger  { background: var(--danger); }
.person-name  { font-weight: 600; font-size: .93rem; color: var(--text); line-height: 1.2; }
.person-role  { font-size: .75rem; color: var(--text-muted); margin-top: 1px; }
.person-card-body { padding: 12px 16px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.person-meta  { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--text-muted); }
.person-meta-icon { width: 16px; text-align: center; flex-shrink: 0; }
.person-card-footer {
    padding: 10px 16px; border-top: 1px solid var(--border);
    display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}

/* ========== Tag / Chip ========== */
.tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: .73rem; font-weight: 500; background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.tag.primary { background: rgba(7,44,147,.08); color: var(--primary); border-color: rgba(7,44,147,.2); }
.tag.accent  { background: rgba(14,165,233,.08); color: #0369a1; border-color: rgba(14,165,233,.2); }
.tag.success { background: rgba(34,197,94,.08); color: #15803d; border-color: rgba(34,197,94,.2); }
.tag.warning { background: rgba(245,158,11,.08); color: #b45309; border-color: rgba(245,158,11,.2); }
.tag.danger  { background: rgba(239,68,68,.08); color: #b91c1c; border-color: rgba(239,68,68,.2); }

/* ========== Section divider ========== */
.section-header { display: flex; justify-content: space-between; align-items: center; margin: 28px 0 16px; }
.section-title  { font-size: 1rem; font-weight: 600; }

.mobile-only { display: none; }

/* ========== Responsive ========== */
@media (max-width: 768px) {
    :root { --sidebar-width: 260px; }

    .topbar { padding: 0 14px; }
    .topbar-title { font-size: .95rem; }
    .topbar-user-info { display: none; }
    .topbar-right { gap: 8px; }

    .sidebar.expanded {
        width: var(--sidebar-width);
        transform: translateX(0);
        box-shadow: 16px 0 32px rgba(15,39,68,.18);
    }

    .main-content.sidebar-is-expanded,
    .main-content.sidebar-is-collapsed {
        margin-left: 0;
    }

    .mobile-only { display: block; }
    .sidebar-overlay { display: block; }
    .content-area { padding: 16px; }
    .public-content-area { padding: 18px 16px; }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
