/* ==========================================================================
   CIMC — Client Issue Management CRM
   Bootstrap 5.3 theme layer
   ========================================================================== */

:root {
    --cimc-primary: #3b4bd8;
    --cimc-primary-rgb: 59, 75, 216;
    --cimc-primary-dark: #2f3cb0;
    --cimc-primary-soft: #eceeff;
    --cimc-bg: #f4f6fb;
    --cimc-line: #e4e8f1;
    --cimc-ink: #111827;
    --cimc-muted: #64748b;
    --cimc-sidebar: #0f1631;
    --cimc-sidebar-2: #18213f;
    --cimc-radius: 14px;
    --cimc-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --cimc-shadow-lg: 0 10px 30px -12px rgba(16, 24, 40, .25);

    --bs-primary: var(--cimc-primary);
    --bs-primary-rgb: var(--cimc-primary-rgb);
    --bs-link-color: var(--cimc-primary);
    --bs-link-color-rgb: var(--cimc-primary-rgb);
    --bs-link-hover-color: var(--cimc-primary-dark);
    --bs-body-bg: var(--cimc-bg);
    --bs-body-color: #1f2937;
    --bs-border-color: var(--cimc-line);
    --bs-primary-bg-subtle: var(--cimc-primary-soft);
    --bs-primary-text-emphasis: #2a37a6;
    --bs-focus-ring-color: rgba(var(--cimc-primary-rgb), .25);
}

body { background: var(--cimc-bg); font-size: .935rem; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.min-w-0 { min-width: 0; }
code { color: #8b3dd8; }

.btn-primary {
    --bs-btn-bg: var(--cimc-primary);
    --bs-btn-border-color: var(--cimc-primary);
    --bs-btn-hover-bg: var(--cimc-primary-dark);
    --bs-btn-hover-border-color: var(--cimc-primary-dark);
    --bs-btn-active-bg: var(--cimc-primary-dark);
    --bs-btn-active-border-color: var(--cimc-primary-dark);
    --bs-btn-disabled-bg: var(--cimc-primary);
    --bs-btn-disabled-border-color: var(--cimc-primary);
    --bs-btn-focus-shadow-rgb: var(--cimc-primary-rgb);
}
.btn-outline-primary {
    --bs-btn-color: var(--cimc-primary);
    --bs-btn-border-color: var(--cimc-primary);
    --bs-btn-hover-bg: var(--cimc-primary);
    --bs-btn-hover-border-color: var(--cimc-primary);
    --bs-btn-active-bg: var(--cimc-primary);
    --bs-btn-active-border-color: var(--cimc-primary);
}
.btn { border-radius: 10px; font-weight: 500; }
.btn-sm { border-radius: 8px; }
.btn a:hover, .btn:hover { text-decoration: none; }
.btn-icon { width: 40px; height: 40px; border-radius: 10px; display: inline-grid; place-items: center; color: #334155; border: 1px solid transparent; font-size: 1.15rem; }
.btn-icon:hover { background: #f1f4fa; }
.form-control, .form-select { border-radius: 10px; border-color: #dbe0ea; }
.form-control:focus, .form-select:focus { border-color: rgba(var(--cimc-primary-rgb), .55); box-shadow: 0 0 0 .2rem rgba(var(--cimc-primary-rgb), .15); }
.form-label { font-weight: 500; color: #334155; }
.form-check-input:checked { background-color: var(--cimc-primary); border-color: var(--cimc-primary); }
.page-link { color: var(--cimc-primary); }
.active > .page-link, .page-link.active { background-color: var(--cimc-primary); border-color: var(--cimc-primary); }
.nav-tabs .nav-link { color: var(--cimc-muted); font-weight: 500; }
.nav-tabs .nav-link.active { color: var(--cimc-ink); }
.alert { border-radius: 12px; }
.dropdown-menu { border-radius: 12px; border-color: var(--cimc-line); }

/* ----------------------------------------------------------------- shell */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-content { padding: 24px 28px; flex: 1; width: 100%; max-width: 1640px; margin: 0 auto; }
.app-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 14px 28px; font-size: .8rem; color: var(--cimc-muted); border-top: 1px solid var(--cimc-line); }

.app-sidebar {
    width: 268px; flex-shrink: 0; background: linear-gradient(180deg, var(--cimc-sidebar) 0%, var(--cimc-sidebar-2) 100%);
    color: #c3c9de; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding-bottom: 24px;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent;
}
.sidebar-brand { display: flex; align-items: center; padding: 18px 18px 16px; }
.brand-mark { display: flex; align-items: center; gap: 12px; color: #fff; }
.brand-mark:hover { text-decoration: none; color: #fff; }
.brand-mark strong { display: block; font-size: 1.05rem; letter-spacing: .3px; }
.brand-mark small { display: block; font-size: .75rem; color: #9aa3c2; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, #6271ff, #3b4bd8); color: #fff; font-size: 1.1rem; box-shadow: 0 6px 16px -6px rgba(98, 113, 255, .8); }
/* Company logo (public/assets/img/logo.png) on a white tile, so any logo background works */
.brand-logo-img { flex: 0 0 auto; width: 42px; height: 42px; padding: 3px; background: #fff; overflow: hidden; box-shadow: 0 4px 14px -6px rgba(15, 23, 42, .45); }
.brand-logo-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.auth-brand .brand-logo-img { width: 56px; height: 56px; border-radius: 14px; padding: 4px; }
.auth-brand .brand-mark strong { font-size: 1.25rem; }
.sidebar-nav { display: flex; flex-direction: column; padding: 0 10px; gap: 2px; }
.sidebar-nav .nav-link { display: flex; align-items: center; gap: 12px; color: #c3c9de; padding: 9px 12px; border-radius: 10px; font-weight: 500; font-size: .9rem; }
.sidebar-nav .nav-link i { font-size: 1.05rem; opacity: .85; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.sidebar-nav .nav-link.active { background: rgba(98, 113, 255, .22); color: #fff; box-shadow: inset 3px 0 0 #7d8bff; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: #6f7899; padding: 18px 12px 6px; font-weight: 600; }
.nav-workspace { font-size: .85rem !important; }
.ws-dot { width: 22px; height: 22px; border-radius: 7px; display: inline-grid; place-items: center; font-size: .7rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.ws-dot-lg { width: 40px; height: 40px; border-radius: 12px; font-size: 1.1rem; }

.app-topbar { height: 64px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--cimc-line); display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 1020; }
.topbar-search { position: relative; align-items: center; width: min(520px, 50vw); }
.topbar-search i { position: absolute; left: 12px; color: #94a3b8; }
.topbar-search .form-control { padding-left: 36px; background: #f4f6fb; border-color: transparent; }
.topbar-search .form-control:focus { background: #fff; }
.workspace-chip { align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #ecfdf3; color: #067647; font-size: .8rem; font-weight: 600; border: 1px solid #abefc6; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--cimc-line); background: #fff; }
.user-chip:hover { background: #f8f9fc; }
.user-chip small { font-size: .72rem; }

.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
    .app-sidebar { position: fixed; left: -290px; z-index: 1045; transition: left .2s ease; }
    body.sidebar-open .app-sidebar { left: 0; }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 22, 49, .45); z-index: 1040; }
    .app-content { padding: 16px; }
    .app-topbar { padding: 0 12px; }
}

/* ------------------------------------------------------------ page parts */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-title { font-size: 1.55rem; font-weight: 700; color: var(--cimc-ink); margin: 0; letter-spacing: -.01em; }
.page-subtitle { color: var(--cimc-muted); margin: 4px 0 0; max-width: 820px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; color: #067647; background: #ecfdf3; padding: 3px 10px; border-radius: 999px; margin-bottom: 8px; }
.breadcrumb { font-size: .82rem; }
.breadcrumb-item a { color: var(--cimc-muted); }

.card { border-radius: var(--cimc-radius); border-color: var(--cimc-line); box-shadow: var(--cimc-shadow); }
.card-header { background: transparent; border-bottom-color: var(--cimc-line); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; }
.card-header:first-child { border-radius: var(--cimc-radius) var(--cimc-radius) 0 0; }
.card-footer { background: #fafbfe; border-top-color: var(--cimc-line); }
.card-title { font-size: 1rem; font-weight: 600; margin: 0; color: var(--cimc-ink); display: flex; align-items: center; gap: 8px; }
.card-title small { font-weight: 400; color: var(--cimc-muted); font-size: .8rem; }
.filter-card .form-label { margin-bottom: 4px; color: var(--cimc-muted); }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--cimc-muted); font-weight: 600; background: #fafbfe; border-bottom-color: var(--cimc-line); white-space: nowrap; }
.table > :not(caption) > * > * { padding: .7rem .9rem; }
.table-sm > :not(caption) > * > * { padding: .45rem .75rem; }
tr[data-href] { cursor: pointer; }
.sort-link { color: inherit; }
.sort-link:hover { color: var(--cimc-primary); text-decoration: none; }
.row-overdue td:first-child { box-shadow: inset 3px 0 0 #ef4444; }
.ticket-no { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 600; font-size: .82rem; color: var(--cimc-primary); background: var(--cimc-primary-soft); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.ticket-subject { min-width: 260px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--cimc-muted); padding: 28px 16px; text-align: center; }
.empty-state > i { font-size: 2rem; color: #c3cad9; }
.empty-state.small { flex-direction: row; justify-content: center; padding: 22px; }
.empty-state.small > i { font-size: 1.2rem; color: #22c55e; }

/* ------------------------------------------------------------------ badges */
.badge { font-weight: 600; border-radius: 999px; }
.badge-status { padding: .4em .75em; display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; }
.status-new { background: #eef2f7; color: #475569; }
.status-acknowledged { background: #e0f2fe; color: #0369a1; }
.status-in-progress { background: #e7e9ff; color: #3443c8; }
.status-waiting-for-client { background: #fef3c7; color: #a15c07; }
.status-resolved { background: #dcfce7; color: #15803d; }
.status-closed { background: #e2e8f0; color: #334155; }
.status-reopened { background: #ffe4e6; color: #be123c; }
.badge-priority { padding: .38em .7em; font-size: .72rem; border: 1px solid transparent; }
.priority-low { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.priority-medium { background: #eff6ff; color: #1d4ed8; border-color: #dbeafe; }
.priority-high { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.priority-critical { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge-overdue { background: #fee2e2; color: #b91c1c; padding: .38em .7em; font-size: .72rem; }
.badge-atrisk { background: #fff7ed; color: #c2410c; padding: .38em .7em; font-size: .72rem; }
.badge-escalated { background: #fdf2f8; color: #be185d; padding: .38em .7em; font-size: .72rem; }
.badge-internal { background: #fef3c7; color: #92400e; font-size: .7rem; }

/* ---------------------------------------------------------------- avatars */
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: .8rem; color: #fff; flex-shrink: 0; letter-spacing: .02em; }
.avatar-sm { width: 30px; height: 30px; font-size: .7rem; }
.avatar-c0, .ws-dot.avatar-c0 { background: #6366f1; }
.avatar-c1, .ws-dot.avatar-c1 { background: #0ea5e9; }
.avatar-c2, .ws-dot.avatar-c2 { background: #14b8a6; }
.avatar-c3, .ws-dot.avatar-c3 { background: #f59e0b; }
.avatar-c4, .ws-dot.avatar-c4 { background: #ec4899; }
.avatar-c5, .ws-dot.avatar-c5 { background: #8b5cf6; }
.avatar-c6, .ws-dot.avatar-c6 { background: #10b981; }
.avatar-c7, .ws-dot.avatar-c7 { background: #ef4444; }

/* ------------------------------------------------------------------- KPIs */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; }
.kpi-card { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--cimc-line); border-radius: var(--cimc-radius); padding: 14px 16px; color: inherit; box-shadow: var(--cimc-shadow); transition: transform .12s ease, box-shadow .12s ease; }
a.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--cimc-shadow-lg); text-decoration: none; color: inherit; }
.kpi-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0; }
.kpi-body { min-width: 0; }
.kpi-value { display: block; font-size: 1.6rem; font-weight: 700; line-height: 1.15; color: var(--cimc-ink); }
.kpi-label { display: block; font-weight: 500; color: #475569; font-size: .86rem; }
.kpi-hint { display: block; font-size: .74rem; color: #94a3b8; margin-top: 2px; }
.tone-primary .kpi-icon { background: #eceeff; color: var(--cimc-primary); }
.tone-danger .kpi-icon { background: #fee2e2; color: #dc2626; }
.tone-warning .kpi-icon { background: #fef3c7; color: #d97706; }
.tone-info .kpi-icon { background: #e0f2fe; color: #0284c7; }
.tone-success .kpi-icon { background: #dcfce7; color: #16a34a; }
.tone-secondary .kpi-icon { background: #eef2f7; color: #475569; }
.tone-danger .kpi-value { color: #b91c1c; }

.chart-box { position: relative; height: 290px; }
.chart-box-sm { height: 230px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 36px; gap: 10px; align-items: center; margin-bottom: 10px; font-size: .86rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #334155; }
.bar-track { height: 8px; background: #eef1f7; border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, #6271ff, #3b4bd8); border-radius: 99px; }
.bar-value { text-align: right; font-weight: 600; }
.ticket-mini-list .list-group-item { padding: 12px 18px; }
.ticket-mini-list .list-group-item:hover { background: #fafbff; }
.ticket-mini-list a:hover { text-decoration: none; }
.phase-legend li a { display: flex; align-items: center; gap: 8px; padding: 6px 0; color: #334155; border-bottom: 1px dashed var(--cimc-line); }
.phase-legend li:last-child a { border-bottom: 0; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.phase-pending { background: #94a3b8; }
.phase-in_progress { background: #3b4bd8; }
.phase-waiting { background: #f59e0b; }
.phase-resolved { background: #16a34a; }
.phase-closed { background: #334155; }
.client-search { position: relative; display: flex; gap: 8px; align-items: center; }
.client-search > i { position: absolute; left: 16px; color: #94a3b8; font-size: 1.1rem; }
.client-search .form-control { padding-left: 44px; border-radius: 12px; background: #fff; }

/* ------------------------------------------------------------- tickets */
.ticket-header .card-body { padding: 20px 22px; }
.ticket-title { font-size: 1.35rem; font-weight: 700; color: var(--cimc-ink); margin: 0 0 6px; word-break: break-word; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--cimc-muted); font-size: .84rem; }
.ticket-meta i { margin-right: 3px; }
.ticket-body { white-space: normal; word-break: break-word; line-height: 1.6; color: #1f2937; }
.client-action { margin-top: 16px; padding: 12px 16px; border-radius: 12px; background: #f0fdf4; border: 1px solid #bbf7d0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; font-size: .9rem; }
.client-action-warning { background: #fffbeb; border-color: #fde68a; }

.phase-tracker { display: flex; margin-top: 20px; }
.phase-step { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; text-align: center; }
.phase-step::before { content: ''; position: absolute; top: 15px; right: 50%; width: 100%; height: 3px; background: #e5e7eb; }
.phase-step:first-child::before { display: none; }
.phase-step.done::before, .phase-step.current::before { background: var(--cimc-primary); }
.phase-dot { width: 32px; height: 32px; border-radius: 50%; background: #e9edf5; color: #94a3b8; display: grid; place-items: center; position: relative; z-index: 1; font-size: .9rem; }
.phase-step.done .phase-dot { background: var(--cimc-primary); color: #fff; }
.phase-step.current .phase-dot { background: #fff; border: 3px solid var(--cimc-primary); color: var(--cimc-primary); }
.is-waiting .phase-step.current .phase-dot { border-color: #d97706; color: #d97706; }
.is-waiting .phase-step.current::before { background: #f59e0b; }
.phase-label { font-size: .76rem; margin-top: 6px; color: #64748b; font-weight: 500; }
.phase-step.current .phase-label { color: var(--cimc-ink); font-weight: 700; }
.phase-hint { margin: 12px 0 0; font-size: .84rem; color: #475569; background: #f8f9fc; border-radius: 10px; padding: 8px 12px; }

.detail-list { display: grid; grid-template-columns: 120px 1fr; gap: 10px 12px; padding: 16px 18px; margin: 0; font-size: .875rem; }
.detail-list dt { color: var(--cimc-muted); font-weight: 500; }
.detail-list dd { margin: 0; min-width: 0; }
.sla-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.sla-row + .sla-row { border-top: 1px dashed var(--cimc-line); }
.sla-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.sla-success { background: #dcfce7; color: #15803d; }
.sla-danger { background: #fee2e2; color: #b91c1c; }
.sla-primary { background: #e7e9ff; color: #3443c8; }
.sla-secondary { background: #eef2f7; color: #475569; }
.participant-list .list-group-item { display: flex; align-items: center; gap: 10px; padding: 10px 18px; }

.attachment-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.attachment { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--cimc-line); border-radius: 10px; background: #fff; font-size: .85rem; max-width: 520px; }
.attachment.is-internal { background: #fffbeb; border-color: #fde68a; }
.attachment-icon { font-size: 1.35rem; color: var(--cimc-primary); }
.attachment-thumb img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--cimc-line); }
.attachment-list.is-compact .attachment { max-width: none; }

.rca-card.has-rca { border-left: 4px solid #16a34a; }
.rca-label { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--cimc-muted); font-weight: 700; margin-bottom: 6px; }
.rca-text { line-height: 1.6; word-break: break-word; }

/* conversation (chat-style timeline) */
.conversation-card .tab-content { background: #f7f8fc; border-radius: 0 0 var(--cimc-radius) var(--cimc-radius); }
.timeline { display: flex; flex-direction: column; gap: 14px; padding: 22px 20px; max-height: 70vh; overflow-y: auto; scroll-behavior: smooth; }
.tl-comment { display: flex; gap: 10px; align-items: flex-start; max-width: 86%; }
.tl-comment.tl-own { flex-direction: row-reverse; margin-left: auto; }
.tl-bubble { background: #fff; border: 1px solid var(--cimc-line); border-radius: 4px 16px 16px 16px; padding: 10px 14px; min-width: 0; box-shadow: 0 1px 1px rgba(16, 24, 40, .04); }
.tl-own .tl-bubble { background: #eceeff; border-color: #d8dcff; border-radius: 16px 4px 16px 16px; }
.tl-staff:not(.tl-own) .tl-bubble { background: #f2fbf6; border-color: #cdeedb; }
.tl-item.tl-comment.tl-internal .tl-bubble { background: #fffbeb; border: 1px dashed #f59e0b; }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: .82rem; margin-bottom: 4px; }
.tl-role { color: var(--cimc-muted); font-size: .76rem; }
.tl-time { color: #94a3b8; font-size: .75rem; }
.tl-head .tl-time { margin-left: auto; }
.tl-body { word-break: break-word; line-height: 1.55; }
.tl-event { align-self: center; text-align: center; max-width: 94%; }
.tl-event-pill { display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--cimc-line); border-radius: 999px; padding: 5px 14px; font-size: .8rem; color: #475569; }
.tl-event-pill .badge-status { font-size: .68rem; padding: .3em .6em; }
.tl-event-internal .tl-event-pill { background: #fffbeb; border-color: #fde68a; }
.tl-event-note { margin: 6px auto 0; font-size: .85rem; background: #fff; border: 1px solid var(--cimc-line); border-radius: 10px; padding: 8px 12px; max-width: 560px; text-align: left; }
.tl-new { animation: tl-in .45s ease; }
@keyframes tl-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.composer-wrap { border-top: 1px solid var(--cimc-line); padding: 14px 18px 18px; background: #fff; border-radius: 0 0 var(--cimc-radius) var(--cimc-radius); }
.composer textarea { resize: vertical; border-radius: 12px; }
.composer.is-internal textarea { background: #fffbeb; border-color: #f59e0b; }
.composer-hint { font-size: .8rem; color: #92400e; background: #fef3c7; border-radius: 8px; padding: 6px 10px; margin-top: 8px; }
.composer-footer { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.composer-mode .btn { border-radius: 999px; }
.composer-closed { color: var(--cimc-muted); font-size: .9rem; text-align: center; padding: 6px; }

.priority-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.priority-option { display: flex; flex-direction: column; gap: 2px; border: 1.5px solid var(--cimc-line); border-radius: 12px; padding: 10px 12px; cursor: pointer; background: #fff; transition: border-color .12s, box-shadow .12s; }
.priority-option small { color: var(--cimc-muted); font-size: .74rem; line-height: 1.3; }
.btn-check:checked + .priority-option { border-color: currentColor; box-shadow: 0 0 0 3px rgba(var(--cimc-primary-rgb), .12); }
.btn-check:checked + .priority-option.priority-low { background: #f8fafc; }
.btn-check:checked + .priority-option.priority-medium { background: #eff6ff; }
.btn-check:checked + .priority-option.priority-high { background: #fff7ed; }
.btn-check:checked + .priority-option.priority-critical { background: #fef2f2; }
.btn-check:focus-visible + .priority-option { outline: 2px solid var(--cimc-primary); }
@media (max-width: 767.98px) { .priority-picker { grid-template-columns: repeat(2, 1fr); } }
.tips-card { background: linear-gradient(135deg, #f5f6ff, #fff); }

.history-table td { vertical-align: top; }
.org-checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; padding: 12px; border: 1px solid var(--cimc-line); border-radius: 10px; background: #fafbfe; max-height: 240px; overflow-y: auto; }
.org-checklist.is-invalid { border-color: var(--bs-danger); }
.permission-matrix thead.sticky-top th { top: 64px; z-index: 2; }
.permission-matrix .table-group th { background: #f1f4fa; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: #475569; }
.audit-json { background: #fff; border: 1px solid var(--cimc-line); border-radius: 8px; padding: 8px; max-height: 260px; overflow: auto; font-size: .78rem; margin: 4px 0 0; }
.email-preview { width: 100%; height: 640px; border: 0; background: #f2f4fa; border-radius: 0 0 var(--cimc-radius) var(--cimc-radius); }
.email-text { white-space: pre-wrap; font-size: .85rem; max-height: 640px; overflow: auto; }

/* --------------------------------------------------------- notifications */
.notif-badge { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #ef4444; color: #fff; font-size: .66rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.notif-menu { width: min(380px, 92vw); overflow: hidden; }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-item { display: block; padding: 10px 16px; border-bottom: 1px solid #f1f3f8; color: inherit; position: relative; }
.notif-item:hover { background: #f8f9ff; text-decoration: none; color: inherit; }
.notif-item.is-unread { background: #f5f6ff; }
.notif-item.is-unread::before { content: ''; position: absolute; left: 6px; top: 16px; width: 6px; height: 6px; border-radius: 50%; background: var(--cimc-primary); }
.notif-title { display: block; font-weight: 600; font-size: .85rem; }
.notif-msg { display: block; font-size: .8rem; color: var(--cimc-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-time { display: block; font-size: .72rem; color: #94a3b8; }
.notification-page-list .is-unread { background: #f7f8ff; }
.notif-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #eceeff; color: var(--cimc-primary); flex-shrink: 0; }
.notif-icon.notif-internal_note { background: #fef3c7; color: #b45309; }
.notif-icon.notif-sla_alert { background: #fee2e2; color: #dc2626; }
.notif-icon.notif-ticket_resolved { background: #dcfce7; color: #16a34a; }

/* ------------------------------------------------------------------ auth */
.auth-body { background: radial-gradient(1200px 600px at 10% -10%, #dfe3ff 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #d9f5ea 0%, transparent 55%), var(--cimc-bg); min-height: 100vh; }
.auth-wrap { max-width: 460px; margin: 0 auto; padding: 56px 16px 32px; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 22px; }
.auth-brand .brand-mark { color: var(--cimc-ink); }
.auth-brand .brand-mark small { color: var(--cimc-muted); max-width: none; }
.auth-card { box-shadow: var(--cimc-shadow-lg); border: 0; }
.auth-foot { text-align: center; font-size: .8rem; color: var(--cimc-muted); margin-top: 18px; }

/* ------------------------------------------------------------------ toast */
.toast { border-radius: 12px; border: 0; box-shadow: var(--cimc-shadow-lg); }
