:root {
    --or-blue-dark: #0B3C5D;
    --or-steel: #6C757D;
    --or-white: #FFFFFF;
    --or-accent: #2FA4FF;
    --navy: var(--or-blue-dark);
    --navy-soft: #123f5f;
    --blue: var(--or-accent);
    --blue-soft: #e5f4ff;
    --green: #16a34a;
    --green-soft: #dcfce7;
    --red: #B42318;
    --red-soft: #FEE4E2;
    --yellow: #B54708;
    --yellow-soft: #FEF0C7;
    --slate: #344054;
    --muted: var(--or-steel);
    --line: #d8e0e8;
    --page: #f4f7fa;
    --white: var(--or-white);
    --shadow: 0 18px 45px rgba(11, 60, 93, 0.09);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--page);
    color: var(--navy);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--or-blue-dark), #082f49);
}

.login-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    width: min(100%, 420px);
    padding: 32px;
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}

.login-logo {
    display: block;
    width: 160px;
    height: auto;
    margin: 0 auto 24px;
}

.login-card h1 {
    margin: 0;
    color: var(--or-blue-dark);
    font-size: 1.6rem;
    font-weight: 850;
}

.login-subtitle {
    margin: 6px 0 22px;
    color: var(--or-steel);
    font-weight: 650;
}

a {
    text-decoration: none;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    padding: 24px 18px;
    background: linear-gradient(180deg, var(--or-blue-dark), #072d47);
    color: var(--white);
    overflow-y: auto;
}

.brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 4px 8px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand img {
    width: 100%;
    max-width: 180px;
    height: auto;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    background: var(--or-accent);
    color: var(--white);
    font-weight: 800;
    letter-spacing: 0;
}

.brand h1 {
    margin: 0;
    color: var(--white);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0;
}

.brand span {
    color: #c8d7e5;
    font-size: 0.82rem;
}

.nav-menu {
    display: grid;
    gap: 8px;
    margin: 24px 0 0;
    padding: 0;
    list-style: none;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius);
    color: #d7e4ef;
    font-weight: 650;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(47, 164, 255, 0.2);
    color: var(--white);
}

.nav-menu a:hover {
    transform: translateX(2px);
}

.nav-section-label {
    padding: 16px 12px 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(215, 228, 239, 0.45);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 8px;
}

.nav-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.08);
    color: #d7efff;
    font-size: 0.78rem;
    font-weight: 800;
}

.sidebar-logo {
    margin-top: auto;
    padding: 24px 10px 4px;
    text-align: center;
}

.sidebar-logo img {
    display: block;
    width: 100%;
    max-width: 160px;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-logo img:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

.sidebar-logo span {
    display: block;
    margin-top: 10px;
    color: #c8d7e5;
    font-size: 0.75rem;
    font-weight: 650;
}

.content {
    width: calc(100% - 280px);
    margin-left: 280px;
    padding: 32px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
    padding: 22px 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--white), #f7fbff);
    box-shadow: var(--shadow);
}

.app-header h2 {
    margin: 0;
    color: var(--or-blue-dark);
    font-size: 1.35rem;
    font-weight: 850;
}

.app-header p:last-child {
    margin: 4px 0 0;
    color: var(--or-steel);
    font-weight: 600;
}

.app-footer {
    margin-top: 34px;
    padding: 18px 0 4px;
    color: var(--or-steel);
    font-size: 0.86rem;
    font-weight: 650;
    text-align: center;
}

.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(7, 45, 71, 0.48);
}

.onboarding-overlay.show {
    display: flex;
}

.onboarding-card {
    width: min(100%, 520px);
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

.onboarding-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.onboarding-skip-link {
    border: 0;
    background: transparent;
    color: var(--or-blue-dark);
    font: inherit;
    font-weight: 800;
    text-decoration: underline;
    cursor: pointer;
}

.onboarding-bar {
    height: 8px;
    margin: 14px 0 22px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--blue-soft);
}

.onboarding-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--or-accent);
    transition: width 0.18s ease;
}

.onboarding-card h2 {
    margin: 0;
    color: var(--or-blue-dark);
    font-size: 1.55rem;
    font-weight: 850;
}

.onboarding-card p {
    margin: 12px 0 24px;
    color: var(--slate);
    font-size: 1rem;
}

.onboarding-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.onboarding-actions .btn {
    min-width: 120px;
}

.onboarding-actions .btn[disabled],
.onboarding-skip-link[disabled] {
    cursor: wait;
    opacity: 0.65;
}

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

.page-header h1 {
    margin: 0;
    color: var(--or-blue-dark);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--or-accent);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.date-pill {
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--white);
    color: var(--or-blue-dark);
    font-weight: 700;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.metric-card,
.panel,
.table-container {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.metric-card {
    position: relative;
    min-height: 165px;
    padding: 22px;
    overflow: hidden;
    border-top: 3px solid transparent;
}

.metric-card::after {
    content: "";
    position: absolute;
    inset: 0 0 auto auto;
    width: 90px;
    height: 90px;
    border-radius: 0 0 0 90px;
    background: rgba(47, 164, 255, 0.08);
    pointer-events: none;
}

.metric-card h3 {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.metric-card .value {
    color: var(--or-blue-dark);
    font-size: 2rem;
    font-weight: 850;
    letter-spacing: 0;
}

.metric-card p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.metric-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    margin-bottom: 16px;
    border-radius: var(--radius);
    font-weight: 850;
}

.metric-blue .metric-icon {
    background: var(--blue-soft);
    color: var(--or-blue-dark);
}

.metric-blue {
    border-top-color: var(--or-accent);
}

.metric-green .metric-icon {
    background: var(--green-soft);
    color: var(--green);
}

.metric-green {
    border-top-color: var(--green);
}

.metric-warning .metric-icon {
    background: var(--yellow-soft);
    color: var(--yellow);
}

.metric-warning {
    border-top-color: var(--yellow);
}

.panel {
    padding: 22px;
}

.compact-panel {
    padding: 18px;
    margin-bottom: 20px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
}

.panel-header h2,
.panel-header h3 {
    margin: 0;
    color: var(--or-blue-dark);
    font-size: 1.05rem;
    font-weight: 800;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.flash-stack {
    margin-bottom: 18px;
}

.today-panel {
    margin-bottom: 24px;
}

.today-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 22px;
}

.today-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fbff;
}

.today-card span {
    display: block;
    color: var(--or-steel);
    font-size: 0.82rem;
    font-weight: 750;
    text-transform: uppercase;
}

.today-card strong {
    display: block;
    margin-top: 8px;
    color: var(--or-blue-dark);
    font-size: 1.6rem;
}

.detail-list {
    display: grid;
    gap: 12px;
    padding: 4px 0 22px;
}

.detail-list div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.detail-list span {
    color: var(--or-steel);
    font-weight: 650;
}

.detail-list strong {
    color: var(--or-blue-dark);
}

.notes-form {
    margin-top: 10px;
}

.filters {
    display: flex;
    align-items: end;
    gap: 14px;
}

.filters label,
.form-group label,
.summary-filter-form label {
    display: block;
    margin-bottom: 6px;
    color: var(--or-blue-dark);
    font-size: 0.82rem;
    font-weight: 750;
}

.search-field {
    flex: 1 1 340px;
}

.filter-field {
    flex: 0 0 190px;
}

.filters input,
.filters select,
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #cfd8e3;
    border-radius: var(--radius);
    background: var(--white);
    color: var(--or-blue-dark);
    font: inherit;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.filters input:focus,
.filters select:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--or-accent);
    box-shadow: 0 0 0 4px rgba(47, 164, 255, 0.16);
}

.table-container {
    overflow: hidden;
}

.data-card {
    margin-top: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #eef6fc;
}

th,
td {
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--or-blue-dark);
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

td {
    color: #2f3f4f;
    font-size: 0.94rem;
}

tbody tr {
    transition: background 0.16s ease;
}

tbody tr:hover {
    background: #f5fbff;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn {
    border-radius: var(--radius);
    font-weight: 750;
    border-width: 1px;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--or-blue-dark);
    border-color: var(--or-blue-dark);
    color: var(--white);
}

.btn-primary:hover,
.btn-primary:focus {
    background: #082f49;
    border-color: #082f49;
    box-shadow: 0 12px 24px rgba(11, 60, 93, 0.22);
}

.btn-success {
    background: var(--green);
    border-color: var(--green);
}

.btn-outline-primary {
    color: var(--or-blue-dark);
    border-color: var(--or-accent);
    background: var(--white);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    color: var(--white);
    border-color: var(--or-accent);
    background: var(--or-accent);
    box-shadow: 0 12px 24px rgba(47, 164, 255, 0.2);
}

.btn-outline-secondary {
    color: var(--or-steel);
    border-color: #cfd8e3;
    background: var(--white);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    color: var(--white);
    border-color: var(--or-steel);
    background: var(--or-steel);
}

.btn-outline-danger {
    color: var(--red);
    border-color: #f5b5ae;
    background: var(--white);
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
    color: var(--white);
    border-color: var(--red);
    background: var(--red);
}

.btn-warning {
    color: var(--white);
    background: var(--yellow);
    border-color: var(--yellow);
}

.btn-sm {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.82rem;
}

.badge,
.method-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 850;
}

.badge-success {
    background: var(--green-soft);
    color: #166534;
}

.badge-danger {
    background: var(--red-soft);
    color: #991b1b;
}

.badge-warning {
    background: var(--yellow-soft);
    color: var(--yellow);
}

.badge-active {
    background: var(--blue-soft);
    color: var(--or-blue-dark);
}

.badge-muted {
    background: #eef1f4;
    color: var(--or-steel);
}

.badge-info {
    background: #e0f2fe;
    color: #075985;
}

.badge-purple {
    background: #f3e8ff;
    color: #6b21a8;
}

/* ── Foto de cliente ─────────────────────────────────────────────────────── */

/* Header: avatar inline with name */
.client-header-identity {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.client-header-avatar {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--or-border);
    cursor: pointer;
    flex-shrink: 0;
}

.client-header-avatar:hover .avatar-overlay {
    opacity: 1;
}

.avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 0;
    transition: opacity 0.15s;
    padding: 4px;
    line-height: 1.2;
}

/* Shared photo primitives (used in header avatar) */
.client-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.client-photo-placeholder {
    background: var(--blue-soft);
    color: var(--or-blue-dark);
    font-size: 1.75rem;
    font-weight: 700;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Legacy classes kept for backward compat */
.client-photo-section { display: none; }
.client-photo-wrap { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; border: 2px solid var(--or-border); }
.client-photo-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }

/* ── Paginación ──────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--or-steel);
}

.method-pill {
    background: var(--blue-soft);
    color: var(--or-blue-dark);
}

.form-group {
    margin-bottom: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.settings-form,
.bonus-form,
.inline-form {
    margin-top: 12px;
}

.inline-form {
    display: flex;
    justify-content: flex-start;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    padding: 18px;
    background: rgba(11, 60, 93, 0.58);
}

.modal-content {
    position: relative;
    width: min(100%, 560px);
    max-height: calc(100vh - 36px);
    margin: 6vh auto;
    padding: 28px;
    overflow-y: auto;
    border: 0;
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: 0 24px 60px rgba(11, 60, 93, 0.22);
}

.modal-content h2 {
    margin: 0;
    color: var(--or-blue-dark);
    font-size: 1.35rem;
    font-weight: 850;
}

.modal-subtitle {
    margin: 6px 0 22px;
    color: var(--muted);
}

.close {
    position: absolute;
    top: 16px;
    right: 18px;
    color: var(--muted);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.close:hover {
    color: var(--or-blue-dark);
}

.toast {
    visibility: hidden;
    min-width: 280px;
    max-width: 420px;
    padding: 14px 16px;
    position: fixed;
    z-index: 1001;
    right: 28px;
    bottom: 28px;
    border-radius: var(--radius);
    background: var(--or-blue-dark);
    color: var(--white);
    box-shadow: var(--shadow);
    font-weight: 700;
}

.toast.show {
    visibility: visible;
    animation: fadein 0.25s, fadeout 0.35s 2.65s;
}

.toast.success {
    background: var(--green);
}

.toast.error {
    background: var(--red);
}

.summary-filter-form {
    display: flex;
    align-items: end;
    gap: 12px;
    width: 100%;
}

.payment-filter-form {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
    align-items: end;
    gap: 12px;
    width: 100%;
}

.payment-filter-form input,
.payment-filter-form select {
    min-height: 42px;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.summary-filter-form > div {
    min-width: 160px;
}

.summary-filter-form input,
.summary-filter-form select {
    min-height: 42px;
}

.report-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 20px;
    margin-top: 24px;
}

.bar-list {
    display: grid;
    gap: 13px;
    padding: 20px 22px 24px;
}

.bar-label {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 7px;
    color: var(--slate);
    font-size: 0.9rem;
    font-weight: 750;
}

.bar-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--or-blue-dark), var(--or-accent));
}

@keyframes fadein {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeout {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(8px);
    }
}

@media (max-width: 1180px) {
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        padding: 16px;
    }

    .brand {
        padding-bottom: 14px;
    }

    .nav-menu {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: 14px;
    }

    .sidebar-logo {
        margin-top: 16px;
        padding: 16px 0 0;
    }

    .sidebar-logo img {
        max-width: 120px;
        padding: 8px 10px;
    }

    .content {
        width: 100%;
        margin-left: 0;
        padding: 22px 16px;
    }

    .app-header {
        margin-bottom: 20px;
        padding: 18px;
    }

    .app-header h2 {
        font-size: 1.18rem;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .today-grid {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .filters,
    .summary-filter-form {
        align-items: stretch;
        flex-direction: column;
    }

    .payment-filter-form {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        flex-wrap: wrap;
    }

    .filter-field,
    .search-field,
    .payment-filter-form > div,
    .summary-filter-form > div {
        flex: auto;
        min-width: 0;
        width: 100%;
    }

    .table-container {
        overflow-x: auto;
    }

    table {
        min-width: 760px;
    }

    .onboarding-overlay {
        align-items: flex-end;
        padding: 12px;
    }

    .onboarding-card {
        padding: 22px;
    }

    .onboarding-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .onboarding-actions .btn {
        width: 100%;
    }
}
