.stat-card .display-6 { font-weight: 600; }
.stat-card a { text-decoration: none; color: inherit; }
.ticket-table td { vertical-align: middle; }
.ticket-subject { max-width: 32rem; }
.comment.internal { background: #fff8e1; border-color: #ffe082 !important; }
.comment .body, .ticket-description { white-space: pre-wrap; }
.activity-list { font-size: .875rem; max-height: 24rem; overflow-y: auto; }
.overdue { color: var(--bs-danger); font-weight: 600; }
.login-card { max-width: 380px; }

.template-card { transition: border-color .15s, box-shadow .15s; }
.template-card:hover { border-color: var(--bs-primary); box-shadow: 0 .25rem .75rem rgba(0,0,0,.08) !important; }
.border-dashed { border-style: dashed; }

.kb-article { font-size: 1.02rem; line-height: 1.6; }
.kb-article p:last-child { margin-bottom: 0; }

.navbar-nav .nav-link { white-space: nowrap; }
/* Desktops narrower than 1400px: the full menu is tight, the logo already links home. */
@media (min-width: 1200px) and (max-width: 1399.98px) {
  .navbar-expand-xl .navbar-nav .nav-link { padding-left: .4rem; padding-right: .4rem; font-size: .95rem; }
  .navbar-expand-xl .nav-home { display: none; }
}
/* Long translations wrap onto a second row instead of widening the page. */
@media (min-width: 1200px) {
  .navbar-expand-xl .navbar-collapse > .navbar-nav { flex-wrap: wrap; min-width: 0; }
  .navbar-expand-xl .navbar-collapse > .btn, .navbar-expand-xl .navbar-collapse > .dropdown { flex-shrink: 0; }
}
.daily-chart { display: flex; align-items: flex-end; gap: 2px; height: 180px; border-bottom: 1px solid var(--bs-border-color); }
.daily-col { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; min-width: 0; }
.daily-bars { display: flex; align-items: flex-end; gap: 1px; width: 100%; height: 100%; }
.daily-bars .bar { flex: 1 1 0; min-height: 0; border-radius: 2px 2px 0 0; }
.bar-created, .legend-created { background: var(--bs-primary); }
.bar-resolved, .legend-resolved { background: var(--bs-success); }
.legend { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; vertical-align: middle; }

/* Phones: filters fold behind a button; from md up they sit inline in the row. */
@media (min-width: 768px) {
  .filters-collapse, .filters-collapse > .row { display: contents !important; }
}
.ticket-cards .badge { font-size: .75em; }
/* Installed app (standalone): respect the notch and home indicator. */
@media (display-mode: standalone) {
  body { padding-bottom: env(safe-area-inset-bottom); }
  .navbar { padding-top: max(.5rem, env(safe-area-inset-top)); }
}

/* Section tabs scroll sideways on phones instead of wrapping into rows. */
.scroll-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.scroll-tabs::-webkit-scrollbar { display: none; }
.scroll-tabs .nav-link { white-space: nowrap; }

/* Lets a flex child shrink so text-truncate works inside it. */
.min-w-0 { min-width: 0; }
.cal-freeze { background-image: repeating-linear-gradient(135deg, rgba(220,53,69,.07) 0 8px, transparent 8px 16px); }
.cal-events { max-height: 6rem; }
.task-status { width: auto; min-width: 9rem; }

/* Timesheet grid: the name column stays put while the days scroll. */
.timesheet td, .timesheet th { white-space: nowrap; min-width: 2.75rem; }
.timesheet .ts-name { position: sticky; left: 0; z-index: 1; background: var(--bs-body-bg); min-width: 10rem; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; }
.timesheet thead .ts-name, .timesheet tfoot .ts-name { background: var(--bs-tertiary-bg); }
.timesheet .ts-weekend { background: var(--bs-tertiary-bg); }
@media (max-width: 575.98px) { .timesheet .ts-name { min-width: 7rem; max-width: 8rem; } }

/* Notifications */
.inbox-unread { background: var(--bs-primary-bg-subtle); }
.inbox-dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--bs-primary); flex-shrink: 0; margin-top: .45rem; }
.inbox-bell { position: relative; }
.inbox-bell .badge { position: absolute; top: -.15rem; right: -.45rem; font-size: .65rem; }
.saved-view-toggle { max-width: 16rem; }

/* Audit log */
.audit-login { background: var(--bs-success); }
.audit-logout { background: var(--bs-secondary); }
.audit-login_failed, .audit-delete { background: var(--bs-danger); }
.audit-create { background: var(--bs-primary); }
.audit-update { background: var(--bs-info); color: var(--bs-dark); }
.audit-changes { padding-left: 1.1rem; }

/* Portal branding: the logo sits in the navbar and on the login card. */
.brand-logo { height: 32px; max-width: 160px; object-fit: contain; }
.navbar-brand { max-width: calc(100vw - 9rem); }
@media (min-width: 1200px) { .navbar-brand { flex-shrink: 0; max-width: 18rem; } }

/* Survey report bars. */
.survey-bar-label { flex: 0 0 38%; max-width: 38%; }
.survey-bar-label.narrow { flex: 0 0 1.25rem; max-width: 1.25rem; }
.survey-bar-count { flex: 0 0 4.5rem; text-align: right; }
.survey-scale { min-width: 2.75rem; }

/* Team absences calendar. */
.absence-grid th, .absence-grid td { min-width: 2rem; padding: .25rem; font-size: .8rem; }
.absence-grid .absence-name { min-width: 11rem; position: sticky; left: 0; background-color: var(--bs-body-bg) !important; z-index: 2; }
.absence-weekend { background: var(--bs-tertiary-bg) !important; }
.absence-grid .absence-today { box-shadow: inset 0 0 0 2px var(--bs-primary) !important; }
.absence-grid thead .absence-today { color: var(--bs-primary); }
.absence-vacation { background: #9ec5fe !important; }
.absence-sick { background: #f1aeb5 !important; }
.absence-trip { background: #a3cfbb !important; }
.absence-other { background: #ffe69c !important; }
.absence-swatch { display: inline-block; width: .8rem; height: .8rem; border-radius: .2rem; vertical-align: -1px; }
.form-narrow { max-width: 640px; }
@media (max-width: 575.98px) { .absence-grid .absence-name { min-width: 8rem; max-width: 8rem; white-space: normal !important; } }

/* Global search in the navbar */
.navbar-search .form-control { width: 100%; }
@media (min-width: 1200px) { .navbar-search .form-control { width: 11rem; } }
@media (min-width: 1200px) and (max-width: 1599.98px) { .new-ticket-label { display: none; } }
@media (min-width: 1200px) and (max-width: 1499.98px) { .navbar-search .form-control { width: 8rem; } }

/* Ticket board */
.kanban { display: flex; gap: 1rem; align-items: flex-start; overflow-x: auto; padding-bottom: .5rem; }
.kanban-column { flex: 1 0 260px; min-width: 260px; }
.kanban-cards { min-height: 6rem; }
.kanban-card { cursor: grab; }
.kanban-over { outline: 2px dashed var(--bs-primary); outline-offset: 2px; }
@media (max-width: 767.98px) {
  .kanban { flex-direction: column; align-items: stretch; overflow-x: visible; }
  .kanban-column { flex: 0 0 auto; min-width: 0; }
}

/* Agent-reported computers can have hundreds of programs. */
.asset-software-list { max-height: 28rem; overflow-y: auto; }

/* CMDB relationship map (assets/<pk>/map/). */
.cmdb-map { overflow: auto; max-height: 75vh; padding: .25rem; }
.cmdb-map svg { display: block; margin: 0 auto; font-family: inherit; }
.cmdb-edge { fill: none; stroke: #8a94a6; stroke-width: 1.5; }
.cmdb-edge.kind-connected_to { stroke-dasharray: 5 4; }
.cmdb-arrow { fill: #8a94a6; }
.cmdb-label { font-size: 11px; fill: #6c757d; paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; }
.cmdb-node, .cmdb-node:hover { text-decoration: none; }
.cmdb-node rect { fill: #fff; stroke: #adb5bd; stroke-width: 1.5; }
.cmdb-node:hover rect, .cmdb-node:focus rect { stroke: var(--bs-primary); stroke-width: 2; }
.cmdb-node.is-center rect { fill: #e7f1ff; stroke: var(--bs-primary); stroke-width: 2.5; }
.cmdb-node .cmdb-name { font-size: 13px; font-weight: 600; fill: #212529; }
.cmdb-node .cmdb-type { font-size: 11px; fill: #6c757d; }
.cmdb-node.status-in_repair rect, .cmdb-legend.status-in_repair { stroke: #ffc107; fill: #fff8e1; }
.cmdb-node.status-retired rect, .cmdb-node.status-disposed rect, .cmdb-node.is-unknown rect { fill: #fff; stroke: #adb5bd; stroke-dasharray: 5 3; }
.cmdb-unknown-icon { fill: #f1f3f5; stroke: #868e96; stroke-width: 1.5; }
.cmdb-unknown-mark { font-size: 16px; font-weight: 700; fill: #495057; }
.cmdb-legend.is-unknown { width: 1.3em; height: 1.3em; border-radius: 50%; border-color: #868e96; background: #f1f3f5;
  font-size: .75em; font-weight: 700; line-height: 1.05em; text-align: center; color: #495057; }
.cmdb-legend.status-retired { stroke: #ced4da; fill: #f1f3f5; stroke-dasharray: 4 3; }
.cmdb-node.status-retired text, .cmdb-node.status-disposed text { fill: #868e96; }
.cmdb-legend { display: inline-block; width: 1.2em; height: .8em; border: 2px solid; border-radius: 3px; vertical-align: middle;
  border-color: #ffc107; background: #fff8e1; }
.cmdb-node.is-unknown rect { fill: #fff; stroke: #adb5bd; stroke-dasharray: 5 3; }
.cmdb-unknown-icon { fill: #f1f3f5; stroke: #868e96; stroke-width: 1.5; }
.cmdb-unknown-mark { font-size: 16px; font-weight: 700; fill: #495057; }
.cmdb-legend.is-unknown { width: 1.3em; height: 1.3em; border-radius: 50%; border-color: #868e96; background: #f1f3f5;
  font-size: .75em; font-weight: 700; line-height: 1.05em; text-align: center; color: #495057; }
.cmdb-legend.status-retired { border-color: #adb5bd; background: #f1f3f5; border-style: dashed; }

/* Portal chat: requester's floating widget and technician's chat page. */
.chat-widget { position: fixed; right: 1rem; bottom: 1rem; z-index: 1040; display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; }
.chat-panel { width: min(360px, calc(100vw - 2rem)); height: min(520px, calc(100vh - 6rem)); display: flex; flex-direction: column; }
.chat-panel.d-none { display: none !important; }
.chat-page { display: flex; flex-direction: column; height: min(640px, calc(100vh - 10rem)); min-height: 360px; }
.chat-messages { flex: 1 1 auto; overflow-y: auto; padding: .75rem; display: flex; flex-direction: column; gap: .5rem; background: var(--bs-tertiary-bg); }
.chat-message { max-width: 85%; align-self: flex-start; background: #fff; border: 1px solid var(--bs-border-color); border-radius: .75rem .75rem .75rem .25rem; padding: .35rem .6rem; }
.chat-message.is-mine { align-self: flex-end; background: #e7f1ff; border-color: #b6d4fe; border-radius: .75rem .75rem .25rem .75rem; }
.chat-message.is-system { align-self: center; background: transparent; border: 0; color: var(--bs-secondary-color); font-size: .8rem; text-align: center; }
.chat-author { font-size: .75rem; font-weight: 600; color: var(--bs-secondary-color); }
.chat-body { white-space: pre-wrap; word-break: break-word; font-size: .9rem; }
.chat-time { font-size: .7rem; color: var(--bs-secondary-color); text-align: right; }
.chat-message.is-system .chat-time { display: inline; margin-left: .35rem; }
.chat-message.is-system .chat-body { display: inline; }
.chat-form { display: flex; gap: .5rem; padding: .5rem; border-top: 1px solid var(--bs-border-color); align-items: flex-end; }
.chat-form textarea { resize: none; }
@media print { .chat-widget { display: none; } }

/* On-call schedule. */
.oncall-grid td { min-width: 8rem; vertical-align: top; position: relative; }
.oncall-weekend { background: var(--bs-tertiary-bg); }
.oncall-today { box-shadow: inset 0 0 0 2px var(--bs-primary); }
.oncall-shift { background: #eef4ff; border-left: 3px solid #6ea8fe; border-radius: .25rem; padding: .15rem .35rem; margin-bottom: .25rem; font-size: .85rem; }
.oncall-shift.is-current { background: #d1e7dd; border-left-color: #198754; }
.oncall-add { display: inline-block; color: var(--bs-secondary-color); opacity: .5; }
.oncall-add:hover, .oncall-add:focus { opacity: 1; }
.two-factor-qr svg { width: 200px; height: 200px; max-width: 100%; }

/* Bulk actions on the ticket list */
.bulk-cell { width: 2rem; }
.bulk-bar.bulk-active { background: var(--bs-primary-bg-subtle); }
