/* ================================================================
   Recados Clinica - Design System Lenog (Dark Theme)
   Baseado no padrao visual de transcricao.lenog.app.br
   ================================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0f1117;
    --bg-subtle: #161922;
    --surface: #1a1d27;
    --surface-hover: #21242f;
    --surface-active: #252836;
    --primary: #22c55e;
    --primary-dim: rgba(34, 197, 94, 0.12);
    --primary-hover: #16a34a;
    --danger: #ef4444;
    --danger-dim: rgba(239, 68, 68, 0.12);
    --success: #22c55e;
    --warning: #f59e0b;
    --warning-dim: rgba(245, 158, 11, 0.12);
    --info: #3b82f6;
    --info-dim: rgba(59, 130, 246, 0.12);
    --purple: #a78bfa;
    --purple-dim: rgba(167, 139, 250, 0.12);
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.1);
    --radius: 10px;
    --radius-sm: 8px;
    --radius-lg: 14px;
    --shadow: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.3);
    --sidebar-width: 260px;
    --sidebar-bg: #161922;
    --sidebar-text: #94a3b8;
    --sidebar-hover: rgba(255,255,255,0.05);
    --sidebar-active: rgba(34, 197, 94, 0.15);
    --transition: all .2s cubic-bezier(.4, 0, .2, 1);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100dvh;
}

/* ---- Layout ---- */
.layout {
    display: flex;
    min-height: 100dvh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.25s ease;
    border-right: 1px solid var(--border);
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--border);
}
.topbar-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(34, 197, 94, 0.2);
}
.topbar-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.topbar-brand { min-width: 0; }
.topbar-sub {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    display: block;
}
.sidebar-logo { font-size: 28px; }
.sidebar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid transparent;
}
.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: var(--text);
}
.sidebar-link.active {
    background: var(--primary-dim);
    color: var(--primary);
    font-weight: 600;
    border-color: rgba(34, 197, 94, 0.2);
}
.sidebar-icon { font-size: 15px; width: 22px; text-align: center; flex-shrink: 0; }

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 4px;
}
.sidebar-section {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 6px 12px 4px;
}

.sidebar-footer {
    padding: 10px 8px;
    border-top: 1px solid var(--border);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: capitalize;
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
}

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    background: var(--bg);
}

/* ---- Login ---- */
.login-bg {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
}
.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}
.login-icon { font-size: 48px; margin-bottom: 16px; }
.login-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.login-sub { color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }

/* ---- Alerts ---- */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.alert-error { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
input[type="text"], input[type="password"], input[type="date"], input[type="tel"],
select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: var(--transition);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-dim);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select option { background: var(--surface); color: var(--text); }
textarea { resize: vertical; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
    transform: translateY(-1px);
}
.btn-success {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
}
.btn-success:hover:not(:disabled) { background: var(--primary-hover); }
.btn-danger {
    background: var(--danger-dim);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; border-color: transparent; }
.btn-action {
    background: var(--warning-dim);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.btn-action:hover:not(:disabled) { background: var(--warning); color: #fff; border-color: transparent; }
.btn-archive {
    background: rgba(139, 92, 246, 0.12);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.2);
}
.btn-archive:hover:not(:disabled) { background: #8b5cf6; color: #fff; border-color: transparent; }
.btn-ghost {
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
}
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.08); color: var(--text); border-color: var(--border-strong); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; }

/* ---- App Shell ---- */
.app-shell {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ---- Top Bar ---- */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 10;
}
.top-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.top-bar-left h1 { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.logo { font-size: 24px; }
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- Stats ---- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px 16px;
    text-align: center;
    border: 1px solid var(--border);
    border-left: 4px solid transparent;
}
.stat-num { display: block; font-size: 26px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }
.stat-pendente { border-left-color: var(--warning); }
.stat-pendente .stat-num { color: var(--warning); }
.stat-andamento { border-left-color: var(--info); }
.stat-andamento .stat-num { color: var(--info); }
.stat-respondido { border-left-color: var(--primary); }
.stat-respondido .stat-num { color: var(--primary); }
.stat-arquivado { border-left-color: #8b5cf6; }
.stat-arquivado .stat-num { color: #8b5cf6; }
.stat-urgente { border-left-color: var(--danger); }
.stat-urgente .stat-num { color: var(--danger); }
.stat-vencido { border-left-color: #ff2d55; background: rgba(255, 45, 85, 0.08); }
.stat-vencido .stat-num { color: #ff2d55; }

/* ---- Filters ---- */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.filter-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.filters-bar select {
    width: auto;
    min-width: 140px;
    padding: 8px 12px;
    font-size: 13px;
}
.search-group {
    display: flex;
    gap: 6px;
    flex: 1;
    min-width: 200px;
}
.search-group input {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
}

/* ---- Recado Cards ---- */
.recados-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.recado-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--border-strong);
    transition: var(--transition);
}
.recado-card:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

/* Priority borders */
.recado-card.prio-urgente { border-left-color: var(--danger); }
.recado-card.prio-alta { border-left-color: var(--warning); }
.recado-card.prio-normal { border-left-color: var(--info); }
.recado-card.prio-baixa { border-left-color: var(--text-muted); }

/* Responded cards */
.recado-card.status-respondido { opacity: 0.55; }
.recado-card.status-cancelado { opacity: 0.35; }

.recado-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}
.recado-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.badge-tipo { background: rgba(255,255,255,0.05); color: var(--text-secondary); }
.badge-prio-urgente { background: var(--danger-dim); color: var(--danger); }
.badge-prio-alta { background: var(--warning-dim); color: var(--warning); }
.badge-prio-normal { background: var(--info-dim); color: var(--info); }
.badge-prio-baixa { background: rgba(255,255,255,0.04); color: var(--text-muted); }
.badge-status-pendente { background: var(--warning-dim); color: var(--warning); }
.badge-status-em_andamento { background: var(--info-dim); color: var(--info); }
.badge-status-respondido { background: var(--primary-dim); color: var(--primary); }
.badge-status-arquivado { background: rgba(139, 92, 246, 0.12); color: #8b5cf6; }
.badge-status-cancelado { background: rgba(255,255,255,0.04); color: var(--text-muted); }

/* Prazo */
.prazo {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.prazo-vencido { color: var(--danger); font-weight: 600; }
.prazo-hoje { color: var(--warning); font-weight: 600; }
.vencido-tag, .hoje-tag {
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
}
.vencido-tag { background: var(--danger); color: #fff; }
.hoje-tag { background: var(--warning); color: #fff; }

/* Body */
.recado-body { margin-bottom: 12px; }
.paciente-nome { font-size: 15px; font-weight: 600; margin-bottom: 2px; color: var(--text); }
.contato-info { font-size: 12px; color: var(--text-muted); }
.mensagem-preview {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}
.notas-preview {
    margin-top: 6px;
    font-size: 12px;
    color: var(--purple);
    font-style: italic;
}

/* Actions */
.recado-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.inline-form { display: inline; }

/* Footer */
.recado-footer {
    display: flex;
    gap: 16px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.recado-date { font-size: 11px; color: var(--text-muted); }

/* ---- Chat Preview (Dashboard) ---- */
.recado-chat-preview {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.chat-preview-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.chat-preview-msg {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.chat-preview-msg:last-of-type { border-bottom: none; }
.chat-preview-msg strong {
    color: var(--primary);
    font-size: 12px;
}
.chat-preview-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 8px;
}
.chat-preview-msg p {
    margin: 4px 0 0;
    color: var(--text-secondary);
    line-height: 1.5;
}
.chat-preview-more {
    display: block;
    text-align: center;
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
    margin-top: 8px;
    padding: 4px;
}
.chat-preview-more:hover { text-decoration: underline; }

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-icon { font-size: 48px; display: block; margin-bottom: 12px; }

/* ---- Form Container ---- */
.form-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
    margin-bottom: 40px;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}
.form-full { grid-column: 1 / -1; }
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.footer-spacer { height: 40px; }

/* ---- Chat ---- */
.chat-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    border: 1px solid var(--border);
    margin-bottom: 40px;
}
.chat-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 500px;
    overflow-y: auto;
    padding: 8px 0;
    margin-bottom: 16px;
}
.chat-msg {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    max-width: 80%;
}
.chat-msg-other {
    background: var(--surface-active);
    align-self: flex-start;
}
.chat-msg-mine {
    background: var(--primary-dim);
    align-self: flex-end;
    border: 1px solid rgba(34, 197, 94, 0.15);
}
.chat-msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}
.chat-msg-user {
    font-size: 11px;
    text-transform: capitalize;
    color: var(--primary);
    font-weight: 600;
}
.chat-msg-time {
    font-size: 10px;
    color: var(--text-muted);
}
.chat-msg-text {
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-secondary);
}
.chat-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-size: 13px;
}
.chat-input {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.chat-input textarea {
    flex: 1;
    resize: none;
}
.chat-input .btn {
    align-self: flex-end;
    min-height: 42px;
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-toggle {
        display: block;
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 90;
    }
    .sidebar-overlay.show {
        display: block;
    }
    .top-bar {
        padding-left: 52px;
    }

    .stats-row {
        grid-template-columns: repeat(3, 1fr);
    }
    .stat-card { padding: 10px 8px; }
    .stat-num { font-size: 22px; }
    .stat-label { font-size: 10px; }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-group {
        flex-direction: column;
    }
    .filters-bar select {
        width: 100%;
        min-width: unset;
    }
    .search-group {
        min-width: unset;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .top-bar-left h1 { font-size: 16px; }

    .recado-actions .btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ---- IA Model Selector (Sidebar) ---- */
.sidebar-ia-model {
    padding: 4px 8px 12px;
}
.ia-model-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 11px;
    font-family: inherit;
    margin-top: 4px;
}
.ia-model-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-dim);
}
.ia-model-select option {
    background: var(--surface);
    color: var(--text);
}

/* ---- AI Buttons ---- */
.btn-ai {
    background: var(--info-dim);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.2);
    margin-top: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.btn-ai:hover:not(:disabled) { background: var(--info); color: #fff; border-color: transparent; }
.btn-ai:disabled { opacity: 0.4; cursor: wait; }

/* ---- AI Result Box ---- */
.ai-result {
    margin-top: 10px;
    padding: 12px 16px;
    background: var(--info-dim);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.ai-result .badge { font-size: 11px; }
.ai-error { color: var(--danger); font-weight: 600; }

.ai-suggestion {
    background: var(--surface-active);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin: 8px 0;
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* ---- Chat input actions ---- */
.chat-input-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
}

/* ---- Monitoramento ---- */
.monitor-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}
.monitor-section h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.monitor-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 16px 0 10px;
    color: var(--primary);
}
.monitor-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
}

/* Alert boxes */
.alert-box {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 13px;
}
.alert-box h3 {
    margin: 0 0 8px;
    border: none;
    padding: 0;
    font-size: 14px;
}
.alert-box ul {
    list-style: none;
    padding: 0;
}
.alert-box li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.alert-box li:last-child { border-bottom: none; }
.alert-box a { color: var(--primary); text-decoration: none; font-weight: 600; }
.alert-box a:hover { text-decoration: underline; }
.alert-vencido { background: var(--danger-dim); border: 1px solid rgba(239, 68, 68, 0.15); color: var(--danger); }
.alert-urgente { background: var(--warning-dim); border: 1px solid rgba(245, 158, 11, 0.15); color: var(--warning); }

/* Tipo distribution bars */
.tipo-bars { display: flex; flex-direction: column; gap: 8px; }
.tipo-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.tipo-bar-label {
    width: 160px;
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
    color: var(--text-secondary);
}
.tipo-bar-track {
    flex: 1;
    height: 18px;
    background: var(--bg-subtle);
    border-radius: 9px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.tipo-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #16a34a 100%);
    border-radius: 9px;
    min-width: 4px;
    transition: width 0.3s;
}
.tipo-bar-count {
    width: 36px;
    text-align: right;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

/* Monitor table */
.table-container {
    overflow-x: auto;
    margin-top: 8px;
}
.monitor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.monitor-table th {
    text-align: left;
    padding: 8px 12px;
    background: var(--bg-subtle);
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-strong);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.monitor-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}
.monitor-table .row-error td {
    background: var(--danger-dim);
    color: var(--danger);
}

/* ---- ANEXOS ---- */
.anexos-container {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
}
.anexos-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.anexo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-subtle, #f5f5f5);
    border-radius: 8px;
    font-size: 14px;
}
.anexo-link {
    flex: 1;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.anexo-link:hover {
    text-decoration: underline;
}
.anexo-meta {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.anexo-delete {
    display: inline;
}
.btn-xs {
    padding: 2px 6px;
    font-size: 12px;
    border-radius: 4px;
}
.anexo-upload-form {
    margin-top: 8px;
}
.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Chat attachment row */
.chat-attach-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.btn-attach {
    cursor: pointer;
    font-size: 13px;
}
.chat-file-names {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}
.chat-msg-anexos {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.chat-anexo-link {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-subtle, #f0f0f0);
    border-radius: 6px;
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
}
.chat-anexo-link:hover {
    text-decoration: underline;
    background: var(--bg-card);
}
