* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --table-header-bg: #1e293b;
    --table-header-color: #ffffff;
    --border-color: #e2e8f0;
    --success-color: #16a34a;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --admin-color: #9333ea;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* ============
   TELA DE LOGIN
   ============ */
#loginScreen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    text-align: center;
}

.login-box h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.login-subtitle {
    color: var(--secondary-color);
    margin-bottom: 2rem;
}

.form-group {
    text-align: left;
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-primary {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
}

.message.error {
    background: #fee2e2;
    color: var(--danger-color);
}

.message.success {
    background: #dcfce7;
    color: var(--success-color);
}

/* ============
   TELA PRINCIPAL
   ============ */
#mainScreen {
    min-height: 100vh;
    background-color: var(--bg-color);
}

.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

#userWelcome {
    font-size: 0.9rem;
    opacity: 0.9;
}

#currentUserName {
    font-weight: 600;
}

/* ============
   ABAS E SEÇÕES
   ============ */
.tabs-container {
    display: flex;
    background: white;
    padding: 0.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--secondary-color);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 0.5rem 0.5rem 0 0;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: #f1f5f9;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    background: #f8fafc;
}

.tab-section {
    display: none;
    padding: 2rem;
    animation: fadeIn 0.3s;
}

.tab-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============
   FILTROS E TABELAS
   ============ */
.filter-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-input {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    width: 100%;
    max-width: 400px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-count {
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.table-container {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background-color: var(--table-header-bg);
    color: var(--table-header-color);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table tr:hover {
    background-color: #f1f5f9;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table th:first-child,
.data-table td:first-child {
    width: 120px;
}

.data-table th:last-child,
.data-table td:last-child {
    width: 150px;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-active {
    background-color: #dcfce7;
    color: var(--success-color);
}

.status-inactive {
    background-color: #fee2e2;
    color: var(--danger-color);
}

/* Responsáveis */
.responsible-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    background-color: #e0e7ff;
    color: var(--primary-color);
}

/* ============
   PANEL DE DISTRIBUIÇÃO
   ============ */
.distribution-panel {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 2rem;
}

.distribution-panel h2 {
    color: var(--admin-color);
    margin-bottom: 0.5rem;
}

.distribution-panel p {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.users-list {
    margin-bottom: 2rem;
}

.users-list h3 {
    color: var(--text-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.user-card {
    background: #f8fafc;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-card strong {
    color: var(--primary-color);
}

.user-card p {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.distribution-actions {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

#redistributeBtn {
    background: var(--admin-color);
    width: auto;
    padding: 0.75rem 2rem;
}

#redistributeBtn:hover {
    background: #7e22ce;
}

/* ============
   BOTÃO DE SAIR
   ============ */
.btn-logout {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.75rem 1.5rem;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: background 0.3s, transform 0.2s;
}

.btn-logout:hover {
    background: #b91c1c;
    transform: translateY(-2px);
}

/* ============
   LOADING E ERROS
   ============ */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--secondary-color);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error {
    background-color: #fee2e2;
    border: 1px solid var(--danger-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 1rem;
    color: var(--danger-color);
}

.error p {
    margin: 0;
}

/* ============
   RODAPÉ
   ============ */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--secondary-color);
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* ============
   RESPONSIVO
   ============ */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .tabs-container {
        padding: 0.5rem;
    }
    
    .tab-btn {
        flex: 1;
        text-align: center;
        padding: 0.75rem 1rem;
    }
    
    .filter-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input {
        max-width: none;
    }
    
    .data-table {
        font-size: 0.9rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
    
    .login-box {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .btn-logout {
        bottom: 1rem;
        right: 1rem;
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
}

/* ============
   BARRA DE FERRAMENTAS (upload da planilha)
   ============ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 2rem;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.file-label {
    font-weight: 600;
    color: var(--text-color);
}

.toolbar input[type="file"] {
    padding: 0.5rem;
    border: 2px dashed var(--border-color);
    border-radius: 0.5rem;
    background: var(--bg-color);
}

.file-info {
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.btn-logout-header {
    padding: 0.5rem 1.25rem;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-logout-header:hover {
    background: rgba(255, 255, 255, 0.3);
}

.warning {
    margin: 1rem 2rem 0;
    padding: 1rem;
    border-radius: 0.5rem;
    background: #fef3c7;
    border: 1px solid var(--warning-color);
    color: #92400e;
    font-size: 0.9rem;
}

.error {
    margin: 1rem 2rem 0;
}

.empty-cell {
    text-align: center;
    padding: 2rem;
    color: var(--secondary-color);
}

/* Tabelas dinâmicas podem ter muitas colunas: evita quebra agressiva
   e mantém a rolagem horizontal legível. */
.data-table th,
.data-table td {
    white-space: nowrap;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table th:first-child,
.data-table td:first-child,
.data-table th:last-child,
.data-table td:last-child {
    width: auto;
}

.table-container {
    max-height: 70vh;
    overflow: auto;
}

/* ============
   ATENDIMENTO
   ============ */
.upload-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-secondary {
    padding: 0.6rem 1.25rem;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #475569;
}

.select-filter {
    max-width: 220px;
}

.status-cell {
    min-width: 190px;
    white-space: normal;
}

.status-select {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border-radius: 0.4rem;
    border: 1px solid var(--border-color);
    font-weight: 600;
    cursor: pointer;
}

.status-select:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Cor do seletor acompanha a situação atual do registro. */
.status-select.status-pendente {
    background: #fef3c7;
    color: #92400e;
}

.status-select.status-atendido {
    background: #dcfce7;
    color: var(--success-color);
}

.status-select.status-nao_atendido {
    background: #fee2e2;
    color: var(--danger-color);
}

.status-badge.status-pendente {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.status-atendido {
    background: #dcfce7;
    color: var(--success-color);
}

.status-badge.status-nao_atendido {
    background: #fee2e2;
    color: var(--danger-color);
}

.marked-info {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.72rem;
    color: var(--secondary-color);
}

.percent-badge {
    padding: 0.4rem 0.9rem;
    border-radius: 1rem;
    background: var(--primary-color);
    color: white;
    font-weight: 700;
}

/* A coluna de atendimento precisa respirar; as demais seguem truncadas. */
.data-table td.status-cell {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
}

/* ============
   SINO DE NOTIFICAÇÃO
   ============ */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-bell {
    position: relative;
    padding: 0.45rem 0.7rem;
    font-size: 1.2rem;
    line-height: 1;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 0.5rem;
    cursor: pointer;
}

.btn-bell.has-alerts {
    animation: bell-pulse 1.8s ease-in-out infinite;
}

@keyframes bell-pulse {
    0%, 100% { background: rgba(255, 255, 255, 0.15); }
    50% { background: rgba(251, 191, 36, 0.55); }
}

.bell-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    padding: 0.1rem 0.3rem;
    background: var(--danger-color);
    color: white;
    border-radius: 1rem;
    font-size: 0.7rem;
    font-weight: 700;
}

/* ============
   ANOTAÇÃO NA TABELA
   ============ */
.note-cell {
    min-width: 220px;
    max-width: 260px;
    white-space: normal;
}

.note-preview {
    display: block;
    font-size: 0.82rem;
    color: var(--text-color);
    margin-bottom: 0.3rem;
}

.note-empty {
    display: block;
    font-size: 0.8rem;
    color: var(--secondary-color);
    font-style: italic;
    margin-bottom: 0.3rem;
}

.btn-note {
    padding: 0.25rem 0.7rem;
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-note:hover {
    background: var(--primary-color);
    color: white;
}

/* ============
   MODAL
   ============ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 100;
}

.modal-box {
    background: white;
    border-radius: 0.75rem;
    padding: 1.75rem;
    width: 100%;
    max-width: 620px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.modal-box h3 {
    margin-bottom: 0.35rem;
}

.modal-target {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 1rem;
}

.modal-box textarea {
    width: 100%;
    padding: 0.85rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

.modal-box textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-info {
    margin: 0.6rem 0 1rem;
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
}

.form-actions .btn-primary,
.form-actions .btn-secondary {
    width: auto;
}

/* ============
   CALENDÁRIO E LEMBRETES
   ============ */
.reminders-layout {
    display: grid;
    grid-template-columns: minmax(320px, 480px) 1fr;
    gap: 1.5rem;
    align-items: start;
}

.calendar-panel,
.reminder-card,
.notebook-panel {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.25rem;
}

.reminder-side {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.calendar-header h3 {
    font-size: 1.05rem;
}

.btn-icon {
    padding: 0.3rem 0.6rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.4rem;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-color);
}

.btn-icon:hover {
    background: var(--border-color);
}

.btn-icon.danger:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0 0 0.75rem;
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--secondary-color);
    text-transform: uppercase;
    padding-bottom: 0.35rem;
}

.calendar-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-height: 54px;
    padding: 0.35rem 0.2rem;
    background: var(--bg-color);
    border: 1px solid transparent;
    border-radius: 0.45rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.calendar-day:hover {
    border-color: var(--primary-color);
}

.calendar-day.outside {
    opacity: 0.4;
}

.calendar-day.today .day-number {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
}

.calendar-day.selected {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.calendar-day.has-items {
    font-weight: 600;
}

.day-number {
    font-size: 0.85rem;
}

.day-dots {
    display: flex;
    align-items: center;
    gap: 2px;
    min-height: 8px;
}

.day-dots .more {
    font-size: 0.62rem;
    color: var(--secondary-color);
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.dot-pending { background: var(--primary-color); }
.dot-done { background: var(--success-color); }
.dot-late { background: var(--danger-color); }

.calendar-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--secondary-color);
}

.calendar-legend span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Cartões de lembrete */
.reminder-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    font-size: 1rem;
}

.count-pill {
    padding: 0.1rem 0.55rem;
    background: var(--danger-color);
    color: white;
    border-radius: 1rem;
    font-size: 0.75rem;
}

.reminder-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 320px;
    overflow-y: auto;
}

.reminder-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.7rem;
    background: var(--bg-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 0.45rem;
}

.reminder-item.late {
    border-left-color: var(--danger-color);
    background: #fef2f2;
}

.reminder-item.done {
    border-left-color: var(--success-color);
    opacity: 0.65;
}

.reminder-item.done .reminder-body strong {
    text-decoration: line-through;
}

.reminder-body {
    flex: 1;
    min-width: 0;
}

.reminder-body strong {
    display: block;
    font-size: 0.9rem;
    word-break: break-word;
}

.reminder-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.25rem;
    font-size: 0.78rem;
    color: var(--secondary-color);
}

.reminder-cnpj {
    font-family: 'Consolas', monospace;
    font-size: 0.75rem;
    color: var(--primary-color);
}

.reminder-description {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-color);
    white-space: pre-wrap;
    word-break: break-word;
}

.reminder-actions {
    display: flex;
    gap: 0.25rem;
}

.reminder-check input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-top: 2px;
}

.empty-hint {
    font-size: 0.85rem;
    color: var(--secondary-color);
    font-style: italic;
}

/* Formulário de lembrete */
.reminder-form {
    margin-top: 1.1rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--border-color);
}

.reminder-form .form-group {
    margin-bottom: 0.85rem;
}

.reminder-form label {
    font-size: 0.82rem;
}

.reminder-form input,
.reminder-form textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 2px solid var(--border-color);
    border-radius: 0.45rem;
    font-family: inherit;
    font-size: 0.9rem;
}

.reminder-form input:focus,
.reminder-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* ============
   CADERNO
   ============ */
.notebook-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.notebook-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.notebook-status {
    font-size: 0.82rem;
    color: var(--secondary-color);
}

.notebook-status.success-text { color: var(--success-color); }
.notebook-status.error-text { color: var(--danger-color); }

.notebook-text {
    width: 100%;
    min-height: 60vh;
    padding: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.7;
    resize: vertical;
}

.notebook-text:focus {
    outline: none;
    border-color: var(--primary-color);
}

.notebook-text[readonly] {
    background: var(--bg-color);
    color: var(--secondary-color);
}

/* ============
   AVISOS FLUTUANTES
   ============ */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    z-index: 200;
    max-width: 360px;
}

.toast {
    padding: 0.9rem 1.1rem;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    animation: toast-in 0.25s ease-out;
}

.toast.leaving {
    animation: toast-out 0.25s ease-in forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
    to { opacity: 0; transform: translateX(30px); }
}

.toast-info { background: var(--secondary-color); }
.toast-success { background: var(--success-color); }
.toast-error { background: var(--danger-color); }
.toast-reminder {
    background: var(--warning-color);
    border-left: 5px solid #78350f;
}

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

@media (max-width: 600px) {
    .toast-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ============
   AUDITORIA
   ============ */
.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.section-label {
    margin: 1.75rem 0 0.85rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.95rem;
    color: var(--text-color);
}

.section-label:first-of-type {
    margin-top: 0;
}

.online-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.85rem;
}

.online-card {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.85rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 0.5rem;
}

.online-card p {
    font-size: 0.82rem;
    color: var(--secondary-color);
}

.online-card small {
    font-size: 0.72rem;
    color: var(--secondary-color);
}

.online-dot {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--success-color);
    flex-shrink: 0;
    animation: online-pulse 2s ease-in-out infinite;
}

@keyframes online-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
    50% { box-shadow: 0 0 0 5px rgba(22, 163, 74, 0); }
}

.table-container.compact {
    max-height: none;
}

.table-container.compact .data-table th,
.table-container.compact .data-table td {
    padding: 0.6rem 0.85rem;
    font-size: 0.88rem;
}

/* Histórico */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.activity-item {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 0.85rem;
    padding: 0.7rem 0.85rem;
    background: var(--bg-color);
    border-left: 4px solid var(--secondary-color);
    border-radius: 0.45rem;
}

.activity-time {
    font-size: 0.78rem;
    color: var(--secondary-color);
    font-variant-numeric: tabular-nums;
}

.activity-body strong {
    font-size: 0.88rem;
    margin-right: 0.4rem;
}

.activity-action {
    font-size: 0.85rem;
    color: var(--text-color);
}

.activity-detail {
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: var(--secondary-color);
    word-break: break-word;
}

.activity-detail em {
    font-style: normal;
    font-weight: 600;
    color: var(--text-color);
}

/* Cor da borda conforme o tipo de evento. */
.activity-item.kind-session { border-left-color: var(--secondary-color); }
.activity-item.kind-primary { border-left-color: var(--primary-color); }
.activity-item.kind-change { border-left-color: var(--warning-color); }
.activity-item.kind-success { border-left-color: var(--success-color); }
.activity-item.kind-danger { border-left-color: var(--danger-color); }
.activity-item.kind-reminder { border-left-color: var(--admin-color); }
.activity-item.kind-note { border-left-color: #0891b2; }

@media (max-width: 700px) {
    .activity-item {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }
}
