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

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: #f5f7fa;
    color: #2d3748;
    padding: 16px;
}

.espelho-container {
    max-width: 1200px;
    margin: 0 auto;
}

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

.header-left h1 {
    font-size: 20px;
    font-weight: 700;
    color: #1a365d;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-left h1 .material-icons {
    font-size: 28px;
    color: #3182ce;
}

.header-right {
    display: flex;
    gap: 8px;
}

.select-field {
    padding: 8px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: #2d3748;
    cursor: pointer;
    min-width: 180px;
}

.select-field:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49,130,206,0.15);
}

.btn-admin {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: #edf2f7;
    color: #4a5568;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-admin:hover {
    background: #e2e8f0;
    color: #2b6cb0;
}

.btn-admin .material-icons {
    font-size: 20px;
}

/* Abas de Torres */
.torre-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
    padding: 0 4px;
}

.torre-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 20px;
    border: none;
    background: #e2e8f0;
    color: #4a5568;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px 10px 0 0;
    transition: all 0.15s ease;
}

.torre-tab .material-icons {
    font-size: 18px;
}

.torre-tab:hover {
    background: #cbd5e0;
}

.torre-tab.active {
    background: #fff;
    color: #2b6cb0;
    box-shadow: 0 -2px 6px rgba(0,0,0,0.06);
}

.legenda-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 16px;
    background: #fff;
    border-radius: 10px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    flex-wrap: wrap;
}

.legenda-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #4a5568;
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-block;
}

.dot.disponivel { background: #38a169; }
.dot.reservado { background: #d69e2e; }
.dot.negociacao { background: #dd6b20; }
.dot.vendido { background: #e53e3e; }

.resumo-vendas {
    margin-left: auto;
    font-size: 13px;
    color: #718096;
    font-weight: 500;
}

/* Grid do espelho */
.espelho-grid {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    overflow-x: auto;
}

.torre-section {
    margin-bottom: 24px;
}

.torre-title {
    font-size: 15px;
    font-weight: 700;
    color: #2b6cb0;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.torre-title .material-icons {
    font-size: 20px;
}

.grid-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 4px;
}

.grid-table th {
    font-size: 11px;
    color: #a0aec0;
    font-weight: 600;
    text-transform: uppercase;
    padding: 4px 8px;
    text-align: center;
}

.grid-table .floor-label {
    font-size: 12px;
    font-weight: 700;
    color: #4a5568;
    text-align: right;
    padding-right: 12px;
    white-space: nowrap;
    width: 80px;
}

.unit-cell {
    text-align: center;
    padding: 10px 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 12px;
    font-weight: 600;
    min-width: 80px;
    position: relative;
}

.unit-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 2;
}

.unit-cell.status-100 {
    background: #c6f6d5;
    color: #22543d;
    border: 2px solid #38a169;
}

.unit-cell.status-403 {
    background: #fefcbf;
    color: #744210;
    border: 2px solid #d69e2e;
}

.unit-cell.status-800 {
    background: #feebc8;
    color: #7b341e;
    border: 2px solid #dd6b20;
}

.unit-cell.status-900 {
    background: #fed7d7;
    color: #742a2a;
    border: 2px solid #e53e3e;
}

.unit-cell .unit-code {
    display: block;
    font-size: 13px;
    font-weight: 700;
}

.unit-cell .unit-price {
    display: block;
    font-size: 10px;
    font-weight: 400;
    margin-top: 2px;
    opacity: 0.8;
}

.unit-cell .unit-area {
    display: block;
    font-size: 10px;
    margin-top: 1px;
    opacity: 0.7;
}

.empty-cell {
    min-width: 80px;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: #a0aec0;
}

.loading .material-icons {
    font-size: 40px;
    margin-bottom: 12px;
}

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

.spin {
    animation: spin 1s linear infinite;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-card {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #2b6cb0;
    color: #fff;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
}

.modal-close:hover {
    background: rgba(255,255,255,0.2);
}

.modal-body {
    padding: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #edf2f7;
    font-size: 14px;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: #718096;
    font-weight: 500;
}

.detail-value {
    color: #2d3748;
    font-weight: 600;
}

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

.status-badge.s-100 { background: #c6f6d5; color: #22543d; }
.status-badge.s-403 { background: #fefcbf; color: #744210; }
.status-badge.s-800 { background: #feebc8; color: #7b341e; }
.status-badge.s-900 { background: #fed7d7; color: #742a2a; }

/* Responsivo */
@media (max-width: 600px) {
    .espelho-header { flex-direction: column; align-items: flex-start; }
    .header-right { width: 100%; }
    .select-field { flex: 1; min-width: 0; }
    .legenda-bar { gap: 12px; }
    .unit-cell { min-width: 60px; padding: 8px 4px; }
    .unit-cell .unit-code { font-size: 11px; }
}
