/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #f0f4f8; color: #2d3748; min-height: 100vh; }
a { color: #2c5282; text-decoration: none; }
a:hover { text-decoration: underline; }
input, button, select, textarea { font: inherit; }

/* ── Topbar ── */
.topbar {
    display: flex; align-items: center; gap: 16px;
    background: #2c5282; color: #fff; padding: 12px 24px;
    flex-wrap: wrap;
}
.topbar-brand { font-weight: 700; font-size: 1.2rem; letter-spacing: 1px; }
.topbar-prop  { font-size: .95rem; opacity: .85; flex: 1; }
.topbar-user  { font-size: .9rem; display: flex; align-items: center; gap: 8px; }
.topbar-nav   { display: flex; gap: 16px; }
.topbar-nav a { color: #bee3f8; font-size: .9rem; }
.topbar-nav a:hover { color: #fff; }

/* ── Role badges ── */
.role-badge {
    display: inline-block; padding: 2px 8px; border-radius: 12px;
    font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
}
.role-corredor    { background: #2b6cb0; color: #fff; }
.role-propietario { background: #c05621; color: #fff; }

/* ── Auth pages ── */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-box {
    background: #fff; border-radius: 10px; padding: 40px;
    width: 100%; max-width: 420px; box-shadow: 0 4px 20px rgba(0,0,0,.1);
}
.auth-logo { font-size: 1.5rem; font-weight: 700; color: #2c5282; margin-bottom: 8px; }
.auth-box h2 { font-size: 1.1rem; margin-bottom: 24px; color: #4a5568; font-weight: 400; }
.auth-link { text-align: center; margin-top: 16px; font-size: .9rem; }

/* ── Forms ── */
label { display: block; font-size: .85rem; font-weight: 600; color: #4a5568; margin-bottom: 14px; }
label input, label select { display: block; width: 100%; margin-top: 4px; }
input[type=text], input[type=email], input[type=password] {
    border: 1px solid #cbd5e0; border-radius: 6px; padding: 9px 12px;
    width: 100%; transition: border-color .2s;
}
input:focus { outline: none; border-color: #2c5282; box-shadow: 0 0 0 3px rgba(44,82,130,.15); }
button[type=submit], .btn-primary, button.btn-primary {
    display: block; width: 100%; padding: 11px;
    background: #2c5282; color: #fff; border: none; border-radius: 6px;
    font-weight: 600; cursor: pointer; margin-top: 8px; transition: background .2s;
}
button[type=submit]:hover, .btn-primary:hover { background: #2a4a7f; }
.btn-secondary {
    padding: 10px 20px; background: #e2e8f0; color: #2d3748;
    border: none; border-radius: 6px; font-weight: 600; cursor: pointer; transition: background .2s;
}
.btn-secondary:hover { background: #cbd5e0; }
.btn-danger {
    padding: 10px 20px; background: #e53e3e; color: #fff;
    border: none; border-radius: 6px; font-weight: 600; cursor: pointer; transition: background .2s;
}
.btn-danger:hover { background: #c53030; }
.btn-block {
    display: block; text-align: center; padding: 11px;
    background: #2c5282; color: #fff; border-radius: 6px; font-weight: 600; margin-top: 12px;
}

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: .9rem; }
.alert-error   { background: #fff5f5; border: 1px solid #fc8181; color: #c53030; }
.alert-success { background: #f0fff4; border: 1px solid #68d391; color: #276749; }

/* ── Calendar layout ── */
.cal-wrap { max-width: 900px; margin: 32px auto; padding: 0 16px; }
.cal-toolbar {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.cal-toolbar button {
    background: #2c5282; color: #fff; border: none; border-radius: 6px;
    padding: 8px 18px; cursor: pointer; font-size: 1.1rem; transition: background .2s;
}
.cal-toolbar button:hover { background: #2a4a7f; }
.cal-toolbar h2 { font-size: 1.3rem; text-transform: capitalize; }

.cal-legend { display: flex; gap: 20px; font-size: .85rem; margin-bottom: 12px; align-items: center; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 4px; }
.dot-corredor    { background: #2b6cb0; }
.dot-propietario { background: #c05621; }
.dot-selecting   { background: #68d391; }

/* ── Calendar grid ── */
.cal-grid {
    background: #fff; border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,.08); overflow: hidden;
}
.cal-weekdays {
    display: grid; grid-template-columns: repeat(7, 1fr);
    background: #2c5282; color: #fff; text-align: center;
    font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
}
.cal-weekdays div { padding: 10px 0; }
.cal-days { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day {
    min-height: 64px; padding: 6px; border: 1px solid #e2e8f0;
    position: relative; cursor: default;
    transition: background .15s;
}
.cal-day.in-month { cursor: pointer; }
.cal-day.in-month:hover { background: #ebf4ff; }
.cal-day.other-month { background: #f7fafc; }
.cal-day.past { opacity: .45; cursor: default; }
.cal-day .day-num { font-size: .8rem; font-weight: 600; color: #718096; }
.cal-day.in-month .day-num { color: #2d3748; }
.cal-day.today .day-num {
    background: #2c5282; color: #fff; border-radius: 50%;
    width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
}

/* Reserved bands */
.cal-day.res-corredor    { background: #ebf4ff; }
.cal-day.res-propietario { background: #fffaf0; }
.cal-day.res-start.res-corredor    { border-left: 4px solid #2b6cb0; }
.cal-day.res-start.res-propietario { border-left: 4px solid #c05621; }
.cal-day.res-end.res-corredor    { border-right: 4px solid #2b6cb0; }
.cal-day.res-end.res-propietario { border-right: 4px solid #c05621; }

.res-label {
    font-size: .68rem; font-weight: 600; border-radius: 3px;
    padding: 1px 4px; margin-top: 2px; display: inline-block;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.res-label.lbl-corredor    { background: #2b6cb0; color: #fff; }
.res-label.lbl-propietario { background: #c05621; color: #fff; }

/* Selecting range */
.cal-day.selecting { background: #c6f6d5 !important; }
.cal-day.sel-start { background: #48bb78 !important; }
.cal-day.sel-start .day-num { color: #fff; }

.cal-hint { text-align: center; font-size: .85rem; color: #718096; margin-top: 12px; min-height: 20px; }

/* ── Toast ── */
.toast {
    position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%);
    background: #2d3748; color: #fff; padding: 12px 24px;
    border-radius: 8px; font-size: .9rem; box-shadow: 0 4px 16px rgba(0,0,0,.2);
    z-index: 1000; animation: fadeIn .2s ease;
}
.toast.toast-error { background: #c53030; }
@keyframes fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }

/* ── Modal ── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 500; padding: 16px;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
    background: #fff; border-radius: 10px; padding: 32px;
    max-width: 440px; width: 100%; box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.modal-box h3 { margin-bottom: 12px; color: #2c5282; }
.modal-box p  { margin-bottom: 16px; line-height: 1.5; }
.modal-box label { margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* ── Admin ── */
.admin-wrap { max-width: 860px; margin: 32px auto; padding: 0 16px; }
.admin-card {
    background: #fff; border-radius: 10px; padding: 28px;
    box-shadow: 0 2px 10px rgba(0,0,0,.07); margin-bottom: 24px;
}
.admin-card h3 { margin-bottom: 18px; color: #2c5282; }
.inline-form { display: flex; gap: 12px; align-items: flex-end; }
.inline-form input { flex: 1; }
.inline-form button {
    padding: 9px 20px; background: #2c5282; color: #fff;
    border: none; border-radius: 6px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.badge-ok   { color: #276749; font-weight: 600; }
.badge-warn { color: #c05621; font-weight: 600; }
.muted { color: #a0aec0; font-size: .9rem; }

/* ── History table ── */
.history-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.history-table th, .history-table td {
    padding: 8px 10px; text-align: left; border-bottom: 1px solid #e2e8f0;
}
.history-table th { background: #f7fafc; font-weight: 600; color: #4a5568; }
.history-table tr:hover td { background: #f7fafc; }
