/* styles.css - ERP Territórios */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #3b82f6;
    --accent: #0ea5e9;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --neutral: #6b7280;
    --neutral-light: #9ca3af;
    --neutral-dark: #374151;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.1), 0 10px 10px rgba(0,0,0,0.04);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    height: 100vh;
    overflow: auto;
    transition: background-color 0.3s, color 0.3s;
    font-size: 14px;
    line-height: 1.6;
}

/* ── Themes ── */
body.light {
    --bg: #f8fafc;
    --bg-surface: #ffffff;
    --bg-elevated: #f1f5f9;
    --border: #e5e7eb;
    --text: #111827;
    --text-muted: #6b7280;
    --input-bg: #ffffff;
    --sidebar-bg: #1f2937;
    --table-stripe: #f9fafb;
    background-color: var(--bg);
    color: var(--text);
}

body.dark {
    --bg: #111827;
    --bg-surface: #1f2937;
    --bg-elevated: #374151;
    --border: #4b5563;
    --text: #f9fafb;
    --text-muted: #d1d5db;
    --input-bg: #374151;
    --sidebar-bg: #111827;
    --table-stripe: #374151;
    background-color: var(--bg);
    color: var(--text);
}

/* ── Header ── */
.header {
    display: flex;
    align-items: center;
    padding: 0 2rem;
    height: 64px;
    background: var(--bg-surface);
    color: var(--text);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1.5rem;
}

.logo-container { flex-shrink: 0; }

.logo {
    height: 38px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.title-group {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding-left: 0.5rem;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.2;
    color: var(--text);
    margin: 0;
}

.congregacao-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
}

.user-info {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

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

#theme-toggle {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    font-weight: 500;
}

#theme-toggle:hover {
    background: var(--border);
    color: var(--text);
}

/* ── Sidebar ── */
.sidebar {
    width: 240px;
    background-color: var(--bg-surface);
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    transition: transform 0.3s;
    z-index: 99;
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
}

.menu { list-style: none; display: flex; flex-direction: column; gap: 4px; }

.menu-item {
    padding: 0;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border-left: none;
}

.menu-item a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: var(--radius);
    transition: var(--transition);
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.menu-item:hover a {
    background: var(--bg-elevated);
    color: var(--text);
}

.menu-item.active a {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
    font-weight: 600;
}

/* ── Main ── */
.main {
    margin-left: 240px;
    margin-top: 64px;
    padding: 2rem 2.5rem;
    height: calc(100vh - 64px);
    overflow-y: auto;
    background: var(--bg);
}

.page {
    display: none;
    overflow-y: auto;
    max-height: calc(100vh - 64px);
}
.page.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.page > h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 2rem;
    letter-spacing: -0.025em;
    color: var(--text);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

/* ── Tabs ── */
.tabs-container { margin-top: 0.5rem; }

.tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    width: fit-content;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.55rem 1.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: inherit;
}

.tab-btn:hover { color: var(--text); background: var(--bg-elevated); }

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 2px 8px rgba(99,102,241,0.35);
    font-weight: 600;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.25s ease-out; }

.tab-pane > h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text);
}

/* ── Form Card ── */
.form-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    width: auto;
    margin-bottom: 2rem;
    max-height: 70vh;
    overflow-y: auto;
}

.form-container h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary);
}

/* Grid layout para formulários */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem 1.5rem;
}

.form-grid .form-group.full { grid-column: 1 / -1; }

.form-group { margin-bottom: 0; }

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text);
    letter-spacing: 0.025em;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--input-bg);
    color: var(--text);
    appearance: none;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
    background: var(--bg-surface);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.form-group textarea { resize: vertical; min-height: 90px; }

.form-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    transition: var(--transition);
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

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

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: var(--shadow);
}

.btn-danger:hover {
    background: #b91c1c;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.78rem;
    border-radius: 6px;
}

/* ── Tables ── */
.usuarios-list,
.territorios-list {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.usuarios-list h4,
.territorios-list h4 {
    padding: 1.25rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 60vh;
}

#usuarios-table,
#territorios-table,
#reservas-table {
    width: 100%;
    border-collapse: collapse;
}

#reservas-table {
    table-layout: fixed;
}

#reservas-table th,
#reservas-table td {
    padding: 1.25rem 1.5rem;
    white-space: normal;
    word-wrap: break-word;
}

#reservas-table th {
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: white;
    background: var(--primary);
}

#reservas-table td {
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text);
    vertical-align: middle;
}

#reservas-table tr:last-child td {
    border-bottom: none;
}

#reservas-table tbody tr:hover {
    background: var(--bg-elevated);
}

#reservas-table tbody tr:nth-child(even) {
    background: var(--table-stripe);
}

#reservas-table tbody tr:nth-child(even):hover {
    background: var(--bg-elevated);
}

#relatorios-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

#relatorios-table th:nth-child(1),
#relatorios-table td:nth-child(1) { width: 8%; }

#relatorios-table th:nth-child(2),
#relatorios-table td:nth-child(2) { width: 18%; }

#relatorios-table th:nth-child(3),
#relatorios-table td:nth-child(3) { width: 12%; }

#relatorios-table th:nth-child(4),
#relatorios-table td:nth-child(4) { width: 14%; }

#relatorios-table th:nth-child(5),
#relatorios-table td:nth-child(5) { width: 14%; }

#relatorios-table th:nth-child(6),
#relatorios-table td:nth-child(6) { width: 14%; }

#relatorios-table th:nth-child(7),
#relatorios-table td:nth-child(7) { width: 12%; }

#relatorios-table th:nth-child(8),
#relatorios-table td:nth-child(8) { width: 10%; }

#relatorios-table th,
#relatorios-table td {
    padding: 1rem 1.25rem;
    white-space: normal;
    word-wrap: break-word;
}

#relatorios-table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: white;
    background: var(--primary);
}

#relatorios-table td {
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--text);
    vertical-align: middle;
}

#relatorios-table tr:last-child td {
    border-bottom: none;
}

#relatorios-table tbody tr:hover {
    background: var(--bg-elevated);
}

#relatorios-table tbody tr:nth-child(even) {
    background: var(--table-stripe);
}

#relatorios-table tbody tr:nth-child(even):hover {
    background: var(--bg-elevated);
}

#usuarios-table th,
#territorios-table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: white;
    background: var(--primary);
    white-space: nowrap;
}

#usuarios-table td,
#territorios-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text);
    vertical-align: middle;
}

#usuarios-table tr:last-child td,
#territorios-table tr:last-child td { border-bottom: none; }

#usuarios-table tbody tr:hover,
#territorios-table tbody tr:hover {
    background: var(--bg-elevated);
}

#usuarios-table tbody tr:nth-child(even),
#territorios-table tbody tr:nth-child(even) {
    background: var(--table-stripe);
}

#usuarios-table tbody tr:nth-child(even):hover,
#territorios-table tbody tr:nth-child(even):hover {
    background: var(--bg-elevated);
}

/* ── Territory Cards ── */
.territorios-main-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 0.5rem 0;
    max-height: 70vh;
    overflow-y: auto;
}

.territorio-main-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0;
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
    position: relative;
}

.territorio-main-card::before {
    content: '';
    display: block;
    height: 4px;
    background: var(--primary);
}

.territorio-main-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.territorio-main-card .card-body {
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.card-content {
    flex: 1;
}

.progress-info {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 600;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: rgba(30, 64, 175, 0.1);
    border-radius: var(--radius-sm);
    display: inline-block;
}

.reservation-info {
    font-size: 0.85rem;
    color: var(--text);
    font-weight: 500;
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}

.reservation-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.completion-date {
    font-size: 0.8rem;
    color: var(--success);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.territorio-main-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

.territorio-main-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.card-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.025em;
    margin-top: 0.75rem;
    text-transform: uppercase;
}

.badge-available {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success);
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.badge-busy {
    background: rgba(217, 119, 6, 0.1);
    color: var(--warning);
    border: 1px solid rgba(217, 119, 6, 0.2);
}

/* ── Quadras ── */
.quadras-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
    max-height: 40vh;
    overflow-y: auto;
}

.quadra-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.quadra-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    background: var(--bg-surface);
}

.quadra-card h5 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.quadra-card.completed {
    background: var(--success);
    color: white;
    position: relative;
}

.quadra-card.completed::after {
    content: '✓';
    position: absolute;
    top: 0.25rem;
    right: 0.5rem;
    font-size: 1.2rem;
    font-weight: bold;
}

/* ── Dashboard placeholder ── */
#dashboard p,
#reservas p,
#relatorios p {
    color: var(--text-muted);
    font-size: 1rem;
    padding: 4rem 3rem;
    text-align: center;
    background: var(--bg-surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Ensure scrollable content ── */
.page.active,
.form-container,
.table-container,
.modal-body,
.quadras-container,
#blocks-container,
.territorios-main-container {
    overflow-y: auto !important;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }
    .main {
        margin-left: 0;
        padding: 1.5rem 1rem;
    }
    .header {
        padding: 0 1rem;
        height: 60px;
    }
    .header h1 { font-size: 1.1rem; }
    .sidebar { top: 60px; }
    .main { margin-top: 60px; height: calc(100vh - 60px); }
    .form-grid { grid-template-columns: 1fr; }
    .territorios-main-container { grid-template-columns: 1fr; }
    .territorio-main-card .card-body {
        flex-direction: column;
        gap: 0.75rem;
    }
    .card-image {
        align-self: flex-start;
        width: 60px;
        height: 60px;
    }
}

/* ── Login ── */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 64px);
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 3rem;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.login-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.btn-login {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    margin-top: 0.5rem;
}

.dev-password {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    margin-top: 0.5rem;
}

/* ── Permissions ── */
.permissions-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.permissions-header {
    margin-bottom: 2rem;
    text-align: center;
}

.permissions-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.permissions-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.permissions-form {
    max-width: none;
}

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

.permission-group {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.permission-group h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
    text-align: center;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary);
}

.permission-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.permission-options label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: var(--transition);
}

.permission-options label:hover {
    background: var(--bg-surface);
}

.permission-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* ── Modals ── */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: var(--bg-surface);
    margin: 10% auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
    animation: slideIn 0.3s ease-out;
}

.modal-content.large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    border-radius: var(--radius);
    transition: var(--transition);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--border);
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.reserve-info {
    margin-bottom: 1.5rem;
}

.reserve-info p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text);
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}

.checkbox-label:hover {
    border-color: var(--primary);
    background: rgba(30, 64, 175, 0.05);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    pointer-events: auto;
}

/* Blocks container for territory blocks */
#blocks-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    max-height: 50vh;
    overflow-y: auto;
}

.block-item {
    background: var(--success);
    color: white;
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
}

.block-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.block-item.completed {
    background: var(--neutral);
    cursor: default;
}

.block-item.completed::after {
    content: '✓';
    position: absolute;
    top: 0.25rem;
    right: 0.5rem;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Reserved card styling */
.territorio-main-card.reserved {
    border-color: var(--danger);
}

.territorio-main-card.reserved::before {
    background: var(--danger);
}

.territorio-main-card.completed {
    border-color: var(--success);
}

.territorio-main-card.completed::before {
    background: var(--success);
}

.badge-reserved {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.badge-completed {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success);
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.progress-badge {
    background: rgba(30, 64, 175, 0.1);
    color: var(--primary);
    border: 1px solid rgba(30, 64, 175, 0.2);
    margin-left: 0.5rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.status-completed {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success);
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.status-pending {
    background: rgba(217, 119, 6, 0.1);
    color: var(--warning);
    border: 1px solid rgba(217, 119, 6, 0.2);
}

/* ── Relatorios ── */
.relatorios-container {
    max-width: none;
}

.relatorios-header {
    margin-bottom: 2rem;
    text-align: center;
}

.relatorios-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.relatorios-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

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

.summary-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.summary-card h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.relatorios-filters {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
}

.filter-group select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--input-bg);
    color: var(--text);
}

.relatorios-export {
    margin-top: 2rem;
    text-align: center;
}

.status-available {
    background: rgba(156, 163, 175, 0.1);
    color: var(--neutral);
    border: 1px solid rgba(156, 163, 175, 0.2);
}

.status-reserved {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ── Animations ── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
