:root {
    --primary: #1a73e8;
    --primary-light: #e8f0fe;
    --success: #28a745;
    --danger: #dc3545;
    --bg-body: #f8f9fa;
    --text-main: #333333;
    --text-muted: #5f6368;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    margin: 0;
    padding: 16px;
    color: var(--text-main);
}

.container { max-width: 650px; margin: 0 auto; }
header { text-align: center; margin-bottom: 20px; }
header h1 { margin: 0; font-size: 1.5rem; color: var(--primary); }
header p { margin: 5px 0 0 0; font-size: 0.9rem; color: var(--text-muted); }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; background: #e0e2e5; padding: 4px; border-radius: 10px; }
.tab-btn {
    flex: 1; padding: 12px; border: none; border-radius: 8px; background: transparent;
    font-weight: bold; cursor: pointer; font-size: 0.95rem; color: var(--text-muted);
    transition: all 0.2s ease; -webkit-tap-highlight-color: transparent;
}
.tab-btn.active { background: white; color: var(--primary); box-shadow: 0 2px 6px rgba(0,0,0,0.1); }

.card { background: white; padding: 20px; border-radius: 14px; box-shadow: var(--card-shadow); margin-bottom: 16px; }
h2 { margin-top: 0; color: var(--primary); font-size: 1.15rem; border-bottom: 2px solid var(--primary-light); padding-bottom: 8px; margin-bottom: 16px; }

.form-group { margin-bottom: 14px; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.85rem; color: #4a4a4a; }
input, select {
    width: 100%; padding: 12px; border: 1px solid #dadce0; border-radius: 8px;
    font-size: 1rem; background: #fafafa; font-family: inherit;
}
input:focus, select:focus { border-color: var(--primary); background: white; outline: none; }
.hint { display: block; margin-top: 4px; font-size: 0.75rem; color: var(--text-muted); }

.piso-row { display: flex; align-items: center; gap: 12px; background: #fdfdfd; border: 1px solid #f0f0f0; padding: 10px; border-radius: 8px; margin-bottom: 8px; }
.piso-row span { font-weight: bold; font-size: 0.95rem; min-width: 60px; }
.piso-row input { flex: 1; padding: 8px; }

.btn-action { padding: 8px 12px; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; font-size: 0.85rem; }
.btn-add { background: var(--primary-light); color: var(--primary); width: 100%; margin-top: 8px; padding: 10px; border-radius: 8px; border: 1px dashed var(--primary); }
.btn-del { background: #fee8e6; color: var(--danger); }

button.calc-btn {
    width: 100%; background: var(--success); color: white; padding: 14px; border: none;
    border-radius: 10px; font-weight: bold; font-size: 1.1rem; cursor: pointer; margin-top: 10px;
}

.result-box { background: white; border-left: 6px solid var(--success); padding: 20px; margin-top: 16px; border-radius: 14px; display: none; box-shadow: var(--card-shadow); }
.item-res { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f1f3f4; font-size: 0.95rem; }
.total-highlight { font-weight: bold; color: var(--danger); font-size: 1.05rem; }

.piso-card-res { background: var(--primary-light); padding: 12px; font-weight: bold; border-radius: 8px; margin: 6px 0; border-left: 4px solid var(--primary); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.piso-card-res small { font-weight: normal; color: var(--text-muted); }
.piso-user { background: #e6f4ea; border-left-color: var(--success); }

.chart-container { margin-top: 20px; position: relative; height: 260px; width: 100%; }

.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 15px; }
.btn-footer { padding: 12px; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; font-size: 0.9rem; text-align: center; }
.btn-copy { background: #e8eaed; color: #3c4043; }
.btn-print { background: #1a73e8; color: white; }

/* Optimización para impresión / PDF */
@media print {
    body { background: white; color: black; padding: 0; }
    .tabs, .card:not(.result-box), .btn-footer, .btn-add, .btn-del { display: none !important; }
    .result-box { display: block !important; border: none !important; box-shadow: none !important; padding: 0 !important; margin: 0 !important; }
    .piso-card-res { border: 1px solid #333 !important; background: #f9f9f9 !important; page-break-inside: avoid; }
    .chart-container { max-height: 200px !important; }
}
