html, body {
    font-family: 'Roboto', 'Segoe UI', Helvetica, Arial, sans-serif;
}

.cursor-pointer { cursor: pointer; }
.text-muted { color: var(--mud-palette-text-secondary); }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-icon { vertical-align: text-bottom; }
code.small { font-size: 0.75rem; }
.struck { text-decoration: line-through; opacity: 0.7; }

/* ---------- login (static SSR, no MudBlazor) ---------- */
.empty-layout { min-height: 100vh; background: #f5f7fb; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; box-shadow: 0 10px 30px rgba(30, 94, 255, .12); padding: 28px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-title { font-size: 1.25rem; font-weight: 600; color: #1b2a4a; }
.login-subtitle { font-size: .85rem; color: #6b7a99; }
.login-form { display: flex; flex-direction: column; }
.login-label { font-size: .8rem; color: #4a5a7a; margin: 10px 0 4px; }
.login-input { padding: 10px 12px; border: 1px solid #cfd8ea; border-radius: 8px; font-size: 1rem; }
.login-input:focus { outline: none; border-color: #1e5eff; box-shadow: 0 0 0 3px rgba(30, 94, 255, .15); }
.login-validation { color: #c62828; font-size: .8rem; }
.login-error { background: #fdecea; color: #b71c1c; border-radius: 8px; padding: 10px 12px; font-size: .9rem; }
.login-submit { margin-top: 18px; padding: 11px; border: none; border-radius: 8px; background: #1e5eff; color: #fff; font-size: 1rem; font-weight: 500; cursor: pointer; }
.login-submit:hover { background: #164bd1; }
.login-footer { margin-top: 18px; text-align: center; font-size: .8rem; color: #6b7a99; }
.login-footer a { color: #1e5eff; text-decoration: none; }

/* ---------- lists ---------- */
.search-box { min-width: 280px; }
.filters .filter { min-width: 170px; }
.cell-customer, .cell-subject { display: flex; flex-direction: column; line-height: 1.25; }
.cell-name { font-weight: 500; }
.cell-sub { font-size: .78rem; color: var(--mud-palette-text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.waiting-hot { color: var(--mud-palette-error); font-weight: 600; }
.tag-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }
.tag-dot.large { width: 22px; height: 22px; border: 1px solid rgba(0,0,0,.15); }
.color-field { max-width: 130px; }
.tickets-table .mud-table-cell { padding-top: 6px; padding-bottom: 6px; }
.status-chip { min-width: 84px; justify-content: center; }
.header-select { min-width: 200px; }
.header-select-sm { min-width: 130px; }
.subject-link { font-size: 1rem; color: inherit !important; }
.facts-table td:first-child { color: var(--mud-palette-text-secondary); white-space: nowrap; padding-right: 12px; }
.customer-facts .mud-list-item { padding-top: 2px; padding-bottom: 2px; }
.canned-cell { max-width: 260px; white-space: pre-wrap; font-size: .82rem; }
.canned-preview { display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mud-palette-text-secondary); }
.audit-change { font-size: .8rem; }
.page { padding: 16px 24px 32px; }
@media (max-width: 600px) { .page { padding: 12px; } }
.section-title { display: block; color: var(--mud-palette-text-secondary); letter-spacing: .08em; margin: 4px 0 8px; }
.kpi { height: 100%; min-height: 96px; display: flex; flex-direction: column; justify-content: center; }
.kpi .kpi-label { color: var(--mud-palette-text-secondary); line-height: 1.2; }
.kpi .kpi-value { font-weight: 600; line-height: 1.3; }
.kpi .kpi-sub { color: var(--mud-palette-text-secondary); }
.chart-card { height: 100%; display: flex; flex-direction: column; }
.chart-card .chart-body { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: flex-end; }
.history-item { cursor: pointer; }

/* ---------- conversation thread ---------- */
.thread { height: calc(100vh - 330px); min-height: 320px; overflow-y: auto; padding: 12px 16px; background: var(--mud-palette-background-gray); display: flex; flex-direction: column; gap: 6px; }
.thread.compact { height: auto; max-height: 520px; }
.day-sep { text-align: center; margin: 10px 0 4px; font-size: .75rem; color: var(--mud-palette-text-secondary); }
.day-sep span { background: var(--mud-palette-surface); padding: 2px 10px; border-radius: 10px; }
.sys-row { text-align: center; font-size: .78rem; }
.bubble { max-width: 72%; border-radius: 14px; padding: 8px 12px; background: var(--mud-palette-surface); box-shadow: 0 1px 2px rgba(0,0,0,.08); position: relative; }
.bubble.inbound { align-self: flex-start; border-top-left-radius: 4px; }
.bubble.outbound { align-self: flex-end; background: #e3ecff; border-top-right-radius: 4px; }
.bubble.note { align-self: flex-end; background: #fff6d6; border: 1px dashed #e0c46c; }
.bubble.deleted { opacity: .75; background: var(--mud-palette-background-gray); border: 1px dashed var(--mud-palette-lines-default); }
.mud-theme-dark .bubble.outbound { background: #233a6b; }
.mud-theme-dark .bubble.note { background: #4a3f16; border-color: #8a7430; }
.bubble-head { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--mud-palette-text-secondary); margin-bottom: 2px; }
.bubble-author { font-weight: 600; color: var(--mud-palette-text-primary); }
.bubble-delivery.ok { color: var(--mud-palette-success); }
.bubble-delivery.fail { color: var(--mud-palette-error); }
.bubble-menu { margin-left: auto; }
.bubble-text { white-space: pre-wrap; word-break: break-word; font-size: .95rem; }
.bubble-meta { font-size: .72rem; color: var(--mud-palette-text-secondary); margin-top: 4px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.bubble-meta.deleted { color: var(--mud-palette-error); }
.history-toggle { font-size: .72rem; }
.revisions { margin-top: 6px; border-left: 3px solid var(--mud-palette-lines-default); padding-left: 8px; display: flex; flex-direction: column; gap: 6px; }
.revision-head { font-size: .7rem; color: var(--mud-palette-text-secondary); }
.revision-text { font-size: .85rem; white-space: pre-wrap; text-decoration: line-through; opacity: .8; }
.bubble-media { margin-bottom: 6px; }
.msg-image { max-width: 320px; max-height: 320px; border-radius: 8px; display: block; }
.msg-video { max-width: 360px; border-radius: 8px; display: block; }
.msg-audio { width: 280px; }
.msg-file { display: inline-flex; align-items: center; gap: 4px; }
.msg-file-size { font-size: .75rem; color: var(--mud-palette-text-secondary); }
.composer-note .mud-input-outlined-border { border-color: #e0c46c !important; }

@media (max-width: 960px) {
    .bubble { max-width: 92%; }
    .thread { height: 55vh; }
    .search-box { min-width: 200px; }
}

/* ---------- blazor error ui ---------- */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ---------- simple bars ---------- */
.bars-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 140px; height: 100%; color: var(--mud-palette-text-secondary); font-size: .85rem; }
.vbars { display: flex; align-items: flex-end; gap: 4px; width: 100%; border-bottom: 1px solid var(--mud-palette-lines-default); padding-bottom: 18px; position: relative; }
.vbar-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; position: relative; }
.vbar-track { flex: 1 1 auto; width: 100%; display: flex; align-items: flex-end; }
.vbar-fill { width: 100%; max-width: 28px; margin: 0 auto; border-radius: 4px 4px 0 0; transition: height .3s; }
.vbar-value { font-size: .65rem; color: var(--mud-palette-text-secondary); height: 14px; line-height: 14px; }
.vbar-label { position: absolute; bottom: -18px; font-size: .65rem; color: var(--mud-palette-text-secondary); white-space: nowrap; }
.vbar-label { font-size: .65rem; color: var(--mud-palette-text-secondary); margin-top: 4px; height: 14px; white-space: nowrap; }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar-row { display: grid; grid-template-columns: 90px 1fr 36px; align-items: center; gap: 8px; font-size: .85rem; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 14px; background: var(--mud-palette-background-gray); border-radius: 7px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 7px; min-width: 2px; }
.hbar-value { text-align: right; color: var(--mud-palette-text-secondary); }
