:root {
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --wpp: #16a34a;
    --wpp-hover: #15803d;
    --excel: #0d9488;
    --excel-hover: #0f766e;
    --danger: #dc2626;
    --dark: #1e293b;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 10px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    padding-bottom: 80px;
}

/* BARRA SUPERIOR */
.topbar {
    background-color: var(--dark);
    color: white;
    padding: 16px 24px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    margin-bottom: 24px;
}

.topbar-content {
    max-width: 1350px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.topbar h1 {
    font-size: 1.35rem;
}

.stats {
    background: rgba(255,255,255,0.12);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* LAYOUT PRINCIPAL */
.container {
    max-width: 1350px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 960px) {
    .container {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.card h2 {
    font-size: 1.15rem;
    margin-bottom: 16px;
    color: var(--dark);
}

/* FORMULARIOS */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 14px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-muted);
}

input, select, textarea {
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.smart-paste {
    background: #eff6ff;
    border: 1px dashed #93c5fd;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.smart-paste label {
    color: #1e40af;
    font-weight: 700;
    display: block;
    margin-bottom: 6px;
    font-size: 0.88rem;
}

.smart-paste textarea {
    width: 100%;
    resize: vertical;
    background: white;
}

.grid-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.full-width {
    grid-column: 1 / -1;
}

.hidden {
    display: none !important;
}

/* BOTONES */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary { background: #e2e8f0; color: var(--dark); }
.btn-secondary:hover { background: #cbd5e1; }

.btn-wpp { background: var(--wpp); color: white; }
.btn-wpp:hover { background: var(--wpp-hover); }

.btn-excel { background: var(--excel); color: white; }
.btn-excel:hover { background: var(--excel-hover); }

.btn-dark { background: var(--dark); color: white; }

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}
.btn-danger-outline:hover {
    background: #fef2f2;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

/* TABLA / REGISTROS AGRUPADOS */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.table-header h2 {
    margin-bottom: 0;
}

.export-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.categoria-grupo {
    margin-bottom: 22px;
}

.categoria-titulo {
    background: #f8fafc;
    padding: 8px 12px;
    border-left: 4px solid var(--primary);
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--dark);
    margin-bottom: 10px;
    border-radius: 0 6px 6px 0;
    display: flex;
    justify-content: space-between;
}

.registro-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 8px;
    background: #ffffff;
    gap: 12px;
}

.registro-item:hover {
    background: #f8fafc;
}

.registro-info {
    font-size: 0.93rem;
    line-height: 1.4;
}

.registro-info strong {
    color: var(--dark);
}

.badge-tag {
    background: #e0e7ff;
    color: #3730a3;
    padding: 2px 7px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 700;
    font-size: 0.88rem;
}

.btn-delete-item {
    background: #fee2e2;
    color: var(--danger);
    border: none;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

.btn-delete-item:hover {
    background: #fecaca;
}

.empty-msg {
    text-align: center;
    color: var(--text-muted);
    padding: 30px 10px;
    font-style: italic;
}

/* PANEL DERECHO: EDIFICIOS SIN CONEXIÓN */
.offline-card {
    border-top: 4px solid #f59e0b;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: -10px;
    margin-bottom: 14px;
}

.offline-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.offline-input-group input {
    flex: 1;
}

.offline-list {
    list-style: none;
    margin-bottom: 16px;
    max-height: 380px;
    overflow-y: auto;
}

.offline-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 0.92rem;
    font-weight: 500;
}

.offline-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.full-btn {
    width: 100%;
}

/* NOTIFICACIÓN DESHACER (TOAST) */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1e293b;
    color: white;
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 1000;
    font-size: 0.95rem;
}

.btn-undo {
    background: #f59e0b;
    color: #000;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    font-weight: 700;
    cursor: pointer;
}

.btn-undo:hover {
    background: #d97706;
}
