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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
    font-size: 24px;
}

/* Navbar */
.navbar {
    background: #2c3e50;
    color: #fff;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 56px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
}

.navbar-left {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.navbar h1 {
    font-size: 18px;
    font-weight: 600;
}

.navbar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    flex-direction: column;
    gap: 4px;
}

.navbar-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-user {
    font-size: 14px;
    opacity: 0.9;
}

.navbar-right a {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 14px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
    transition: background 0.2s;
}

.navbar-right a:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Container */
.container {
    max-width: 900px;
    margin: 30px auto;
    padding: 0 20px;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 24px;
    margin-bottom: 20px;
}

.card h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 20px;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, opacity 0.2s;
    text-align: center;
}

.btn-primary {
    background: #3498db;
    color: #fff;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: #fff;
}

.btn-success:hover {
    background: #219a52;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: #f39c12;
    color: #fff;
}

.btn-warning:hover {
    background: #d68910;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
    font-size: 14px;
}

table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table tr:hover {
    background: #f8f9fa;
}

.actions {
    display: flex;
    gap: 6px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-admin {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-comum {
    background: #e3f2fd;
    color: #1565c0;
}

.badge-ativo {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-bloqueado {
    background: #ffebee;
    color: #c62828;
}

/* Flash messages */
.flash {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.flash-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Dashboard stats */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: center;
}

.stat-card .number {
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
}

.stat-card .label {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-lg {
    max-width: 700px;
}

.modal h3 {
    margin-bottom: 16px;
    color: #2c3e50;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header h3 {
    margin-bottom: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #888;
    padding: 0 4px;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* Container wide (for infos table) */
.container-wide {
    max-width: 1200px;
}

/* Upload area */
.upload-area {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.upload-area input[type="file"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Detail view */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 15px;
    color: #333;
}

.detail-pre {
    background: #f8f9fa;
    border: 1px solid #ecf0f1;
    border-radius: 4px;
    padding: 12px;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin-top: 4px;
}

/* Status badges */
.badge-novo {
    background: #e3f2fd;
    color: #1565c0;
}

.badge-andamento {
    background: #fff3e0;
    color: #e65100;
}

.badge-recusado {
    background: #ffebee;
    color: #c62828;
}

.badge-feito {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-contato {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #ecf0f1;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar-right select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
}

.selecionados-count {
    font-size: 13px;
    color: #555;
    font-weight: 600;
    padding: 0 8px;
}

/* Status select inline */
.status-form {
    display: inline;
}

.status-select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 600;
}

.status-novo { background: #e3f2fd; color: #1565c0; }
.status-contato-iniciado { background: #f3e5f5; color: #7b1fa2; }
.status-em-andamento { background: #fff3e0; color: #e65100; }
.status-recusado { background: #ffebee; color: #c62828; }
.status-feito { background: #e8f5e9; color: #2e7d32; }

/* Filter bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-separator {
    color: #ccc;
    font-size: 18px;
    margin: 0 4px;
}

.filter-user-form {
    display: inline-flex;
}

.filter-user-form select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    min-width: 200px;
}

.btn-outline {
    background: #fff;
    color: #555;
    border: 1px solid #ddd;
}

.btn-outline:hover {
    background: #f0f2f5;
    border-color: #bbb;
}

/* Table responsive */
.table-responsive {
    overflow-x: auto;
}

/* Responsive - Tablet */
@media (max-width: 900px) {
    .container {
        padding: 0 12px;
        margin: 16px auto;
    }

    .stats {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card .number {
        font-size: 26px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left,
    .toolbar-right {
        justify-content: center;
    }

    .toolbar-right select {
        min-width: 160px;
    }

    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Responsive - Mobile */
@media (max-width: 600px) {
    .navbar {
        padding: 0 12px;
    }

    .navbar-left {
        width: 100%;
    }

    .navbar-toggle {
        display: flex;
    }

    .navbar-right {
        display: none;
        flex-direction: column;
        width: 100%;
        padding: 8px 0 12px;
        gap: 4px;
        align-items: stretch;
    }

    .navbar-right.open {
        display: flex;
    }

    .navbar-right a {
        text-align: center;
        padding: 10px 14px;
    }

    .navbar-user {
        text-align: center;
        padding: 8px 0;
        border-bottom: 1px solid rgba(255,255,255,0.15);
        margin-bottom: 4px;
    }

    .container {
        padding: 0 10px;
        margin: 12px auto;
    }

    .card {
        padding: 16px;
    }

    .card h2 {
        font-size: 17px;
        margin-bottom: 14px;
    }

    .login-box {
        padding: 24px;
        margin: 0 12px;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-card .number {
        font-size: 22px;
    }

    .stat-card .label {
        font-size: 11px;
    }

    /* Table as cards */
    table,
    table thead,
    table tbody,
    table tr,
    table th,
    table td {
        display: block;
    }

    table thead {
        display: none;
    }

    table tr {
        background: #fff;
        border: 1px solid #ecf0f1;
        border-radius: 8px;
        padding: 12px;
        margin-bottom: 12px;
    }

    table tr:hover {
        background: #fff;
    }

    table td {
        padding: 6px 0;
        font-size: 14px;
        border-bottom: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 12px;
        color: #888;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-right: 12px;
        flex-shrink: 0;
    }

    table td:last-child {
        padding-top: 10px;
        margin-top: 4px;
        border-top: 1px solid #ecf0f1;
    }

    table td.td-checkbox {
        justify-content: flex-start;
    }

    table td.td-checkbox::before {
        display: none;
    }

    .actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-end;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px;
    }

    .toolbar-left,
    .toolbar-right {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-right select {
        min-width: 0;
        width: 100%;
    }

    .filter-bar {
        gap: 6px;
    }

    .filter-bar .btn-sm {
        padding: 5px 10px;
        font-size: 12px;
    }

    .filter-separator {
        display: none;
    }

    .filter-user-form {
        width: 100%;
    }

    .filter-user-form select {
        width: 100%;
        min-width: 0;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .modal {
        margin: 10px;
        padding: 16px;
        max-height: 85vh;
    }

    .modal-lg {
        max-width: 100%;
    }

    .upload-area {
        flex-direction: column;
        align-items: stretch;
    }
}
