/* ===========================================
   Utilities - Pagination, Toast, Status, etc.
   =========================================== */

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.page-link {
    padding: 0.5rem 1rem;
    background: var(--c-secondary);
    color: var(--c-text-on-dark);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.85rem;
}

.page-link:hover {
    background: var(--surface-hover);
    border-color: var(--border-subtle);
}

.page-link.disabled {
    background: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
}

.page-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: var(--c-text-on-dark);
    font-size: 0.9rem;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.success { background: var(--c-success); }
.toast.error { background: var(--c-danger-bold); }

.toast.widget-toast {
    bottom: 80px;
    padding: 10px 16px;
    font-size: 0.85rem;
    z-index: 1001;
}

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

/* Status Indicator */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    vertical-align: middle;
    margin-left: 0.5rem;
}

.status-indicator.active {
    background: var(--c-success-ghost);
    color: var(--c-success);
}

.status-indicator.inactive {
    background: var(--c-muted-ghost);
    color: var(--text-muted);
}

/* Status Dots */
.breathing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-faint);
    transition: background 0.3s ease;
}

.auto-update-btn.active .breathing-dot,
.status-indicator.active .breathing-dot {
    background: var(--c-success-dim);
    animation: breathing 2s ease-in-out infinite;
}

.static-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

@keyframes breathing {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

@keyframes breathe {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: var(--breathing-shadow-on);
    }
    50% {
        opacity: 0.8;
        transform: scale(0.9);
        box-shadow: var(--breathing-shadow-off);
    }
}

/* Schedule Status */
.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.status-indicator .status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-indicator.active .status-dot {
    background: var(--c-success);
    box-shadow: 0 0 8px var(--c-success-ghost);
    animation: pulse-green 2s infinite;
}

.status-indicator.inactive .status-dot {
    background: var(--c-danger);
}

.status-indicator.scheduled .status-dot {
    background: var(--c-secondary);
}

@keyframes pulse-green {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.current-time {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.current-time .time-value {
    font-weight: 600;
    font-family: monospace;
    font-size: 1rem;
    color: var(--text-primary);
}

.current-time .time-tz {
    color: var(--text-muted);
}

/* Hints */
.section-hint,
.mode-hint,
.status-hint,
.history-hint,
.content-tip {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.section-hint { margin: -0.5rem 0 1rem 0; }
.status-hint { margin: 1rem 0 0 0; }
.history-hint { margin: 0 0 0.75rem 0; }

/* Mode Badge */
.mode-badge {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Active Now Indicator */
.active-now-indicator {
    margin-top: 0.75rem;
}

/* Periods List (Schedule) */
.periods-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.period-item {
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: 8px;
}

.period-view {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.period-info {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.period-day {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 100px;
}

.period-time {
    color: var(--text-secondary);
    font-family: monospace;
}

.period-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: auto;
}

.period-actions form {
    margin: 0;
    display: flex;
}

.period-edit {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.period-edit .btn-save,
.period-edit .btn-cancel {
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.period-edit .edit-select {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--c-bg);
}

.edit-time {
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--c-bg);
    width: 120px;
    height: 38px !important;
    max-height: 38px !important;
    box-sizing: border-box;
    padding: 0 0.5rem;
}

.period-edit .time-separator {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.no-periods {
    color: var(--text-muted);
    font-style: italic;
    padding: 1rem;
    background: var(--surface);
    border-radius: 8px;
    text-align: center;
}

/* Add Period Form */
.add-period-form {
    margin-top: 1rem;
}

.period-form {
    margin: 0;
}

.period-inputs {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.period-inputs .form-group {
    flex: 0 0 auto;
    margin: 0;
}

.period-inputs .form-group label {
    margin-bottom: 0.4rem;
}

.period-inputs .form-group select {
    height: 38px;
    box-sizing: border-box;
    min-width: 130px;
}

.period-inputs .btn-add {
    height: 38px;
    margin-bottom: 0;
}

/* Content Preview */
.content-preview-container {
    position: relative;
}

.content-preview {
    background: var(--input-bg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.content-preview.collapsed {
    max-height: 0;
    padding: 0;
    border: none;
}

.content-preview.expanded {
    max-height: 300px;
    overflow-y: auto;
}

.content-preview pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    background: transparent;
}

.expand-btn {
    display: block;
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.5rem;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}

.expand-btn:hover {
    background: var(--surface-alt);
    border-color: var(--border);
}

/* Content Empty */
.content-empty {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.content-empty .empty-icon {
    font-size: 1.2rem;
}

.content-empty a {
    color: var(--c-secondary);
    text-decoration: none;
    margin-left: auto;
}

.content-empty a:hover {
    text-decoration: underline;
}

/* Content Meta */
.content-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.meta-label {
    color: var(--text-muted);
}

/* Content Actions */
.content-section-actions .edit-btn,
.content-section-actions .view-btn {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
}

.content-section-actions .edit-btn {
    background: linear-gradient(135deg, var(--c-secondary) 0%, var(--c-secondary-bold) 100%);
    color: var(--c-text-on-dark);
    border: 1px solid transparent;
}

.content-section-actions .edit-btn:hover {
    box-shadow: 0 0 16px color-mix(in srgb, var(--c-secondary), transparent 65%);
}

.content-section-actions .view-btn {
    background: var(--surface-alt);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.content-section-actions .view-btn:hover {
    background: var(--border-light);
}

/* Editor Actions */
.editor-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.editor-actions button {
    padding: 0.6rem 1.5rem;
}

/* History Items */
.history-item {
    cursor: pointer;
}

.history-item:not(.current):hover {
    border-color: var(--c-secondary);
    background: var(--c-secondary-soft);
}

.history-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.history-actions button {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.preview-btn {
    background: var(--c-secondary-soft);
    border-color: var(--c-secondary);
    color: var(--c-secondary);
}

.preview-btn:hover {
    background: var(--c-secondary);
    color: var(--c-text-on-dark);
}

/* Grids */
.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.right-column-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.love-section-inline {
    flex: 1;
}

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

/* Page Layouts */
.chat-history-page,
.message-detail-page,
.incident-detail-page {
    padding: 1rem;
}

.chat-header,
.message-page-header,
.moderation-header,
.incident-header-detail {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.moderation-title { display: flex; flex-direction: column; }

/* Incidents filter row — sits below the header's bottom border, no outline.
   Two dropdowns inline, gap between them, transparent container. */
.moderation-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

/* Override Pico's full-width default on <select> so the two filter
   dropdowns sit side by side instead of each taking a full row. */
.moderation-filters select {
    width: auto;
    min-width: 140px;
    flex: 0 0 auto;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    margin: 0;
}

.chat-header h2,
.message-page-header h2,
.moderation-header h2 {
    margin: 0;
}

.header-left h2 { margin: 0; }
.header-left .subtitle,
.moderation-header .subtitle {
    color: var(--text-secondary);
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
}

/* Chat Container — stretches full width so messages reach the right edge.
   Old layout capped at 900px which left a large empty gutter on wide screens. */
.chat-container {
    width: 100%;
}

.chat-container .msg-list {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
    background: var(--c-bg);
}

/* Search + date filter bar for chat history. Mirrors .inference-filters layout. */
.chat-filters {
    margin-bottom: 0.75rem;
}
.chat-filters .filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.chat-filters .filter-form-input {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--c-bg);
    color: var(--text-primary);
    font-size: 0.85rem;
}
.chat-filters .filter-form-input:not(.filter-date) { flex: 1 1 240px; min-width: 200px; }
.chat-filters .filter-date { width: auto; }

/* Page-level color legend for cat dots. Sits between filter bar and messages. */
.chat-legend {
    margin: 0 0 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.chat-legend summary {
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.4rem;
}
.chat-legend-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding-top: 0.25rem;
}
.chat-legend-grid > span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* Sentiment page header — title + time-window select side by side. */
.sentiment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.sentiment-header h2 { margin: 0; }
.sentiment-header .time-filter select {
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
}

/* Date separators between days in chat history. */
.chat-date-sep {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--c-bg);
    border-bottom: 1px solid var(--border-light);
}
.chat-date-sep::before,
.chat-date-sep::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-light);
}
.chat-date-sep span { white-space: nowrap; }

/* Message Detail Layout */
.message-detail-layout,
.incident-detail-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .message-detail-layout,
    .incident-detail-layout {
        grid-template-columns: 1fr;
    }
}

.message-id-badge {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--surface-hover);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
}

.message-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Incident Images */
.images-expandable {
    cursor: default;
}

.images-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.images-summary::-webkit-details-marker {
    display: none;
}

.images-summary::before {
    content: '\25B6';
    font-size: 0.7rem;
    transition: transform 0.2s;
    color: var(--text-secondary);
}

details.images-expandable[open] > .images-summary::before {
    transform: rotate(90deg);
}

.images-summary h3 {
    margin: 0;
}

.images-warning {
    font-size: 0.75rem;
    color: var(--c-warning);
    background: color-mix(in srgb, var(--c-warning) 12%, transparent);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.images-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.image-thumb {
    width: 160px;
    height: 120px;
    overflow: hidden;
    border-radius: 6px;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: width 0.3s, height 0.3s;
}

.image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-thumb.expanded {
    width: 100%;
    height: auto;
    max-width: 600px;
}

.image-thumb.expanded img {
    height: auto;
    object-fit: contain;
}

/* Moderation Layout */
.moderation-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .moderation-layout {
        grid-template-columns: 1fr;
    }

    .top-offenders {
        order: -1;
    }
}

/* Incidents List */
.incidents-list {
    min-width: 0;
}

.incidents-list h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
}

/* Incident Elements */
.incident-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.user-info .user-link {
    font-size: 1rem;
    font-weight: bold;
    color: var(--c-secondary);
    text-decoration: none;
}

.user-info .user-link:hover {
    text-decoration: underline;
}

.join-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.incident-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Action Tags */
.action-tags,
.actions-taken {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.actions-taken {
    margin-top: 0.75rem;
}

/* Analysis Panels */
.analysis-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.panel {
    padding: 0.75rem;
    border-radius: 0px;
    font-size: 0.85rem;
    background: var(--c-bg);
    border: 1px solid var(--border);
}

.panel h5 {
    margin: 0 0 0 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* .panel.rule-breaking { border-left: 3px solid var(--c-primary); } */
/* .panel.sentiment { border-left: 3px solid var(--c-muted); } */

.score .severity {
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}

.severity.critical { background: var(--c-danger-soft); color: var(--c-danger-dim); }
.severity.warning { background: var(--c-warning-soft); color: var(--c-warning-dim); }
.severity.minor { background: var(--c-success-soft); color: var(--c-success-dim); }

.rules-list {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.8rem;
}

.sentiment-scores {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
}

.sentiment-flag {
    display: inline-block;
    background: var(--c-danger-soft);
    color: var(--c-danger-dim);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
}

@media (max-width: 1024px) {
    .analysis-panels {
        grid-template-columns: 1fr;
    }
}

/* Top Offenders */
.top-offenders {
    height: fit-content;
}

.top-offenders > h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
}

.offenders-section {
    background: var(--c-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.offenders-section:last-child {
    margin-bottom: 0;
}

.offenders-section h4 {
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
}

.top-offenders ol {
    margin: 0;
    padding-left: 1.5rem;
}

.top-offenders li {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.85rem;
}

.offender-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--c-secondary);
    text-decoration: none;
}

.offender-name:hover {
    text-decoration: underline;
}

.offender-count {
    font-weight: 600;
    color: var(--c-danger-dim);
    margin-left: 0.5rem;
}

/* Incident Actions */
.incident-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
}

/* Compact list buttons — sizing only; border/background come from the .btn
   family so the v2 semantic outline shows (no border:none stripping). */
.incident-actions .btn {
    height: 30px;
    padding: 0 0.8rem;
    font-size: 0.8rem;
}

.incident-actions .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Incident Detail */
.incident-reasoning {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.incident-scores {
    display: flex;
    gap: 1.5rem;
    margin: 0.75rem 0;
}

.score-item {
    display: flex;
    flex-direction: column;
}

.score-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.score-value {
    font-size: 1.25rem;
    font-weight: bold;
}

.score-value.critical { color: var(--c-danger); }
.score-value.warning { color: var(--c-warning); }
.score-value.minor { color: var(--c-success); }

.view-incident-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--c-secondary);
    text-decoration: none;
    font-weight: 500;
}

.view-incident-link:hover {
    text-decoration: underline;
}

/* Current Status */
.actions-card .current-status {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.status.banned { color: var(--c-danger); }
.status.muted { color: var(--c-warning); }
.status.active { color: var(--c-success); }

/* Analysis Text */
.analysis-text {
    font-size: 0.85rem;
    line-height: 1.5;
}

.keywords {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.keyword {
    color: var(--c-primary-dim);
    font-size: 0.75rem;
    font-weight: 500;
}

/* Analyzed At */
.analyzed-at {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 1rem;
}

/* Sentiment Badges List */
.sentiment-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* ===========================================
   Overview Page Components
   =========================================== */

/* Live Status Card */
.status-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.status-card-header h4 {
    margin: 0;
}

/* Live Status Bars */
.status-bars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-bar {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.status-progress {
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}

.status-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.status-fill.success { background: var(--c-success); }
.status-fill.warning { background: var(--c-warning); }
.status-fill.danger { background: var(--c-danger); }

/* Overview Grid */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.overview-card h4 {
    margin: 0 0 1rem 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.overview-card h4 a {
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: normal;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.overview-card h4 a:hover {
    background: var(--surface);
}

/* Highlight Items */
.highlight-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-light);
}

.highlight-item:last-child {
    border-bottom: none;
}

.highlight-item.clickable {
    cursor: pointer;
}

.highlight-item.clickable:hover {
    background: var(--surface);
    margin: 0 -0.5rem;
    padding: 0.6rem 0.5rem;
    border-radius: 6px;
}

.highlight-item-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Community Loved: avatar + name link to the user; text links to the message. */
.highlight-avatar-link {
    display: inline-flex;
    flex-shrink: 0;
    text-decoration: none;
}
.highlight-text-link {
    display: block;
    text-decoration: none;
    color: inherit;
}
.highlight-text-link:hover .highlight-text {
    text-decoration: underline;
}

.highlight-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--c-primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--c-primary-dim);
    flex-shrink: 0;
}

img.highlight-avatar {
    object-fit: cover;
}

.highlight-content {
    flex: 1;
    min-width: 0;
}

.highlight-name {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.highlight-name-link {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-highlighted);
    text-decoration: none;
}

.highlight-name-link:hover {
    text-decoration: underline;
}

.highlight-text {
    font-size: 0.8rem;
    color: var(--text-highlighted);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.highlight-meta {
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* Reaction chips — used in Community Loved + Recent Chat */
.reactions-chips,
.msg-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.reaction-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.1rem 0.35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.7rem;
    line-height: 1;
    cursor: default;
}

.reaction-emoji {
    font-size: 0.85rem;
}

.reaction-count {
    color: var(--text-muted);
    font-weight: 500;
}

/* Incident List in Overview */
.incident-list-scroll {
    max-height: 320px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.incident-list-scroll::-webkit-scrollbar {
    width: 6px;
}

.incident-list-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.incident-list-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.incident-list-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.incident-item {
    display: block;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s;
    background: var(--surface);
}

.incident-item:hover {
}

/* Severity-based colors */
.incident-item.severity-critical {
    background: var(--c-danger-ghost);
}
.incident-item.severity-critical:hover {
    background: color-mix(in srgb, var(--c-danger), transparent 82%);
}

.incident-item.severity-high {
    background: var(--c-danger-ghost);
}
.incident-item.severity-high:hover {
    background: color-mix(in srgb, var(--c-danger), transparent 82%);
}

.incident-item.severity-medium {
    background: var(--c-warning-ghost);
}
.incident-item.severity-medium:hover {
    background: color-mix(in srgb, var(--c-warning), transparent 82%);
}

.incident-item.severity-low {
    background: var(--c-success-ghost);
}
.incident-item.severity-low:hover {
    background: color-mix(in srgb, var(--c-success), transparent 82%);
}

.incident-item .incident-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.incident-item .incident-left {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.incident-item .incident-left .action-tag {
    font-size: 0.6rem;
    padding: 0.15rem 0.35rem;
}

.incident-item .incident-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.incident-item .incident-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--c-secondary);
    color: var(--c-text-on-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    flex-shrink: 0;
}

img.incident-avatar {
    object-fit: cover;
}

.incident-item .incident-username {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
}

.incident-item .response-time {
    margin-left: auto;
    font-size: 0.7rem;
}

.incident-item .response-label {
    color: var(--text-muted);
}

.incident-item .response-value {
    color: var(--c-success);
    font-weight: 700;
}


.incident-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: color-mix(in srgb, var(--c-bg), transparent 40%);
    padding: 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chat Preview in Overview */
.chat-preview-container .msg-list {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
    background: var(--c-bg);
}

.chat-preview-container .msg-item {
    padding: 0.5rem 0.75rem;
}

.chat-preview-container .msg-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 0.75rem;
}

.chat-preview-container .msg-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Action List */
.action-list {
    max-height: 280px;
    overflow-y: auto;
}

.action-item {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
    cursor: pointer;
}

.action-item:hover {
    background: var(--surface);
    margin: 0 -1.25rem;
    padding: 0.6rem 1.25rem;
}

.action-item:last-child {
    border-bottom: none;
}

.action-time {
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* Stat Rows */
.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Action Timeline */
.timeline-card h3 {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

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

.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    position: relative;
}

.timeline-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
    z-index: 1;
    border: 2px solid var(--c-bg);
}

.timeline-item.message-sent .timeline-icon {
    background: var(--c-info-soft);
}

.timeline-item.delete .timeline-icon,
.timeline-item.delete_message .timeline-icon {
    background: var(--c-danger-soft);
}

.timeline-item.warn .timeline-icon {
    background: var(--c-warning-soft);
}

.timeline-item.mute .timeline-icon {
    background: var(--c-primary-soft);
}

.timeline-item.ban .timeline-icon,
.timeline-item.ban_pending .timeline-icon {
    background: var(--c-danger-soft);
}

.timeline-item.revoked .timeline-icon {
    opacity: 0.5;
}

.timeline-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.timeline-content .action-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.timeline-content .action-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.timeline-content .action-delay {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.timeline-content .edited-info {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

.timeline-content .revoked-badge {
    display: inline-block;
    font-size: 0.6rem;
    background: var(--c-danger-soft);
    color: var(--c-danger-bold);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-weight: 600;
}

.timeline-item.revoked .action-name {
    text-decoration: line-through;
    opacity: 0.6;
}

/* ===========================================
   Utility Classes
   =========================================== */

/* Text helpers */
.text-muted { color: var(--text-muted); font-size: 0.85rem; }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.text-success { color: var(--c-success-bold); }

/* Layout helpers */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mt-0 { margin-top: 0; }
.mt-05 { margin-top: 0.5rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 1rem; }
.mb-1-5 { margin-bottom: 1.5rem; }
.m-0 { margin: 0; }

/* Container helpers — standalone page cards (login, account, error/forbidden pages).
   Card chrome matches .overview-card/.content-card (cards.css); restores the look that
   Pico's bare <article> styling used to provide. */
.narrow-container,
.medium-container {
    background: var(--c-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem 1.75rem;
}
.narrow-container { max-width: 480px; margin: 2rem auto; padding: 2.25rem 2.5rem; }
.medium-container { max-width: 500px; margin: 2rem auto; }

/* Error page status code (error.html) */
.error-code {
    font-size: 3.5rem;
    font-weight: 600;
    line-height: 1;
    color: var(--text-muted);
    margin: 0 0 0.25rem;
}

/* Page section headers */
.section-header { margin-top: 2rem; font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.section-subtitle { font-size: 0.75rem; font-weight: normal; color: var(--text-muted); }

/* Overview page specific */
.page-title { margin: 0; font-size: 1.5rem; font-weight: 600; }
.page-subtitle { margin: 0.5rem 0 0 0; color: var(--text-muted); font-size: 0.85rem; }
.empty-state-text { color: var(--text-muted); font-size: 0.85rem; margin: 0; }
.empty-state-centered { color: var(--text-muted); font-size: 0.85rem; text-align: center; padding: 2rem; }

/* Content page specific */
.content-description { color: var(--text-secondary); margin-bottom: 1.5rem; }
.preview-title { margin: 0 0 0.5rem 0; }
.preview-meta { margin: 0 0 1rem 0; font-size: 0.8rem; color: var(--text-muted); }

/* Not found / error pages */
.not-found-subtitle { color: var(--text-secondary); }
.not-found-hint { color: var(--text-muted); font-size: 0.85rem; }

/* User page helpers */
.uppercase-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.5rem; }
.faint-note { font-size: 0.65rem; color: var(--text-faint); margin-top: 0.75rem; }

/* Inline badge helper */
.inline-badge { display: inline-flex; margin-left: 0.5rem; vertical-align: middle; }

/* Misc display */
.d-none { display: none; }
.grid-span-2 { grid-column: span 2; }

/* OAuth button stack (Login page) */
.oauth-stack {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-width: 380px;
    margin: 1.5rem auto 0;
}

/* Discord OAuth Button */
.discord-oauth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    background-color: var(--platform-discord);
    color: #fff;
    text-decoration: none;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: filter 0.15s;
}

.discord-oauth-btn:hover {
    filter: brightness(1.1);
    color: #fff;
    text-decoration: none;
}

.discord-oauth-icon {
    width: 24px;
    height: 24px;
    fill: #fff;
    flex-shrink: 0;
}

/* Google OAuth Button — Google brand guidance: white surface, dark text. */
.google-oauth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    background-color: #fff;
    color: #1f1f1f;
    text-decoration: none;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 1rem;
    border: 1px solid #dadce0;
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color 0.15s, box-shadow 0.15s;
}

.google-oauth-btn:hover {
    background-color: #f8f9fa;
    color: #1f1f1f;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.15);
}

.google-oauth-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* Demo auto-login (fallback for no-OAuth users). */
.demo-login-form {
    margin: 0;
}

.demo-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    background-color: transparent;
    color: var(--text-primary);
    border: 1px dashed var(--border);
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    transition: background-color 0.15s, border-color 0.15s;
}

.demo-login-btn:hover {
    background-color: var(--surface-hover);
    border-color: var(--c-secondary);
    color: var(--text-primary);
}

.telegram-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    background-color: #26A5E4;
    color: #fff;
    text-decoration: none;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: filter 0.15s;
}

.telegram-add-btn:hover {
    filter: brightness(1.1);
    color: #fff;
    text-decoration: none;
}

.telegram-add-icon {
    width: 24px;
    height: 24px;
    fill: #fff;
    flex-shrink: 0;
}

.telegram-oauth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    background-color: #26A5E4;
    color: #fff;
    text-decoration: none;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: filter 0.15s;
}

.telegram-oauth-btn:hover {
    filter: brightness(1.1);
    color: #fff;
    text-decoration: none;
}

.telegram-oauth-icon {
    width: 24px;
    height: 24px;
    fill: #fff;
    flex-shrink: 0;
}

.oauth-separator {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0;
}

.oauth-separator hr {
    flex: 1;
    border: none;
    border-top: 1px solid var(--c-neutral);
    margin: 0;
}

.oauth-separator span {
    color: var(--c-muted);
    font-size: 0.875rem;
}

/* Guide page — horizontal scroll wrapper (extracted from projects/guide.html, TASK-291). */
.guide-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
