@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --brand-plum: #32103f;
    --brand-plum-soft: #4a1f59;
    --brand-plum-deep: #210a2c;

    --accent-orange: #f26a00;
    --accent-orange-soft: #fff1e5;
    --accent-orange-border: #ffd8b8;

    --accent-green: #19b37a;
    --accent-green-deep: #12845a;

    --surface-app: #f4f1eb;
    --surface-page: #f9f7f3;
    --surface-card: #ffffff;
    --surface-muted: #f4f6f8;

    --border-soft: #e8dece;
    --border-mid: #dacdb9;
    --border-strong: #cdbb9f;

    --text-main: #1f2532;
    --text-soft: #637086;
    --text-muted: #8a93a4;

    --danger: #d83454;
    --warning: #f2b642;
    --success: #1d9a67;
    --info: #2f80ed;

    --radius-s: 10px;
    --radius-m: 14px;
    --radius-l: 22px;
    --radius-pill: 999px;

    --shadow-soft: 0 12px 26px rgba(33, 24, 14, 0.08);
    --shadow-card: 0 18px 34px rgba(33, 24, 14, 0.1);
    --shadow-cta: 0 18px 30px rgba(242, 106, 0, 0.2);
}

* {
    box-sizing: border-box;
    font-family: "Manrope", "Segoe UI", "Trebuchet MS", sans-serif;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: #ffffff;
    color: var(--text-main);
    letter-spacing: 0.01em;
}

a {
    color: var(--brand-plum-soft);
    text-decoration: none;
}

a:hover {
    color: var(--brand-plum);
}

img,
svg,
video,
canvas {
    max-width: 100%;
    height: auto;
}

.app-main {
    padding-bottom: 1.1rem;
}

.app-topbar {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 249, 237, 0.92) 100%);
    border: 1px solid var(--border-soft) !important;
    box-shadow: var(--shadow-soft) !important;
    backdrop-filter: blur(6px);
}

.app-topbar h1 {
    color: var(--brand-plum) !important;
    font-size: clamp(1.5rem, 2.1vw, 2rem) !important;
    font-weight: 800;
    line-height: 1.15;
}

.app-topbar h1 i {
    color: var(--accent-orange);
    margin-right: 0.45rem;
}

.app-topbar .container-fluid {
    align-items: center;
}

.app-content-shell {
    border-radius: var(--radius-l);
}

#sidebar {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(250, 244, 235, 0.95) 100%) !important;
    border-right: 1px solid var(--border-soft);
    box-shadow: inset -1px 0 0 rgba(98, 57, 112, 0.08);
}

#sidebar .position-sticky {
    padding-left: 0.6rem;
    padding-right: 0.6rem;
}

#sidebar .nav-link,
#sidebar a.text-decoration-none,
#sidebar .menu-link {
    color: #2d3648 !important;
    border-radius: 12px;
    padding: 0.58rem 0.72rem;
    font-size: 0.93rem;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

#sidebar .nav-link:hover,
#sidebar a.text-decoration-none:hover,
#sidebar .menu-link:hover {
    color: #121a28 !important;
    background: rgba(242, 106, 0, 0.12);
    transform: translateX(1px);
}

#sidebar .nav-link.active,
#sidebar .nav-link[aria-current="page"] {
    color: #f26a00 !important;
    background: rgba(242, 106, 0, 0.12);
    box-shadow: inset 0 0 0 1px rgba(242, 106, 0, 0.2);
}

#sidebar .collapse .nav-link,
#sidebar .collapse a.text-decoration-none {
    font-size: 0.86rem;
    font-weight: 500;
    color: #586176 !important;
}

#sidebar .bi-chevron-down {
    color: #7e8699;
}

.menu-chevron {
    cursor: pointer;
}

.alert-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 0.35rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    box-shadow: 0 6px 10px rgba(32, 18, 8, 0.2);
}

.alert-badge--total {
    background: linear-gradient(140deg, #f24f7f 0%, #dc3f6b 100%);
}

.alert-badge--today {
    background: linear-gradient(140deg, #ff7e37 0%, #f26a00 100%);
}

.sidebar-user-footer {
    margin: 0.75rem 0.25rem 0;
    border-top: 1px solid var(--border-soft) !important;
    border-radius: 14px;
    background: linear-gradient(160deg, #4a1f59 0%, #25102f 100%);
    color: #fff7f0;
    box-shadow: 0 16px 26px rgba(31, 17, 8, 0.24);
}

.sidebar-user-footer .text-muted,
.sidebar-user-footer h5 {
    color: #fff7f0 !important;
}

.sidebar-user-footer .btn.btn-link {
    color: #ff4d4f !important;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.sidebar-user-footer .btn.btn-link:hover {
    color: #ff7a7c !important;
}

#sidebar .sidebar-user-footer .btn.btn-link.nav-link,
#sidebar .sidebar-user-footer .btn.btn-link.nav-link.text-danger {
    color: #ff4d4f !important;
}

#sidebar .sidebar-user-footer .btn.btn-link.nav-link:hover,
#sidebar .sidebar-user-footer .btn.btn-link.nav-link.text-danger:hover {
    color: #ff7a7c !important;
}

.sidebar-meta {
    display: block;
    margin-top: 0.12rem;
    color: #8a8274;
    font-size: 0.75rem;
}

.module-shell {
    padding-bottom: 1.1rem;
}

.module-card .card-header {
    font-weight: 700;
    letter-spacing: 0.01em;
}

.module-filter-body {
    background: linear-gradient(180deg, rgba(255, 249, 239, 0.95) 0%, rgba(255, 255, 255, 0.92) 100%) !important;
}

.module-info-actions {
    margin-top: 0.25rem;
}

.badge-soft-light {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.36);
    font-weight: 700;
}

.metric-total-general {
    font-size: 1.2rem;
    letter-spacing: 0.01em;
}

.module-previsiones .header-section {
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.86) 0%, rgba(255, 245, 225, 0.88) 100%);
    border: 1px solid #eadfc7;
    border-radius: 16px;
    padding: 0.85rem 1rem;
    box-shadow: 0 10px 20px rgba(51, 35, 12, 0.08);
}

.module-previsiones .accordion-button {
    border-radius: 10px !important;
    color: var(--brand-plum) !important;
}

.module-previsiones .accordion-button:not(.collapsed) {
    background: linear-gradient(135deg, rgba(255, 245, 225, 0.95) 0%, rgba(255, 255, 255, 0.96) 100%);
    box-shadow: inset 0 -1px 0 rgba(242, 106, 0, 0.16);
}

.card,
.modal-content,
.table-responsive,
.accordion-item,
.list-group-item,
.dropdown-menu {
    border-color: var(--border-soft) !important;
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-soft);
}

.card,
.modal-content,
.accordion-item {
    background: var(--surface-card);
}

.card-header,
.modal-header {
    border-bottom-color: #efe6d8 !important;
    background: linear-gradient(170deg, #ffffff 0%, #fffbf5 100%);
}

.card-footer,
.modal-footer {
    border-top-color: #efe6d8 !important;
    background: linear-gradient(180deg, #fffefc 0%, #fffbf4 100%);
}

.module-shell .card-body {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 251, 242, 0.92) 100%);
}

.section-title,
.card-title {
    color: var(--brand-plum);
    font-weight: 800;
}

.form-label {
    color: #596277;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-control,
.form-select,
.input-group-text {
    min-height: 2.7rem;
    border-color: #dce2ea;
    border-radius: 12px;
}

.form-check-input {
    width: 1.1rem;
    height: 1.1rem;
    min-height: 1.1rem;
    border: 1px solid #bfc8d8;
    border-radius: 0.28rem;
    background-color: #ffffff;
    box-shadow: none;
    cursor: pointer;
    accent-color: var(--accent-orange);
}

.form-check-input[type="radio"] {
    border-radius: 50%;
}

.form-switch .form-check-input {
    width: 2.2em;
    border-radius: 999px;
}

.form-check-input:checked {
    background-color: var(--accent-orange);
    border-color: #df6f1a;
}

.form-check-input:checked[type="radio"] {
    background-color: #ffffff;
    border-color: var(--accent-orange);
}

.form-check-input[type="radio"]:checked {
    box-shadow: inset 0 0 0 0.28rem var(--accent-orange);
}

.form-check-input:disabled {
    opacity: 0.55;
}

input[type="checkbox"]:not(.form-check-input),
input[type="radio"]:not(.form-check-input) {
    accent-color: var(--accent-orange);
}

.form-control,
.form-select {
    background-color: #f8fafc;
    color: #202c3f;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-control:hover,
.form-select:hover {
    border-color: #cfd8e4;
}

.form-control:focus,
.form-select:focus {
    border-color: #f3a160;
    background-color: #ffffff;
    box-shadow: 0 0 0 0.2rem rgba(242, 106, 0, 0.17) !important;
}

.form-check-input:focus {
    border-color: #f3a160;
    box-shadow: 0 0 0 0.16rem rgba(242, 106, 0, 0.2) !important;
}

.form-control:disabled,
.form-select:disabled,
.form-control[readonly] {
    background-color: #f2f4f7;
    border-color: #e5e8ee;
    color: #6c778c;
}

.input-editable-flat {
    background-color: transparent !important;
    border: 1px solid transparent !important;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0.375rem 0.75rem;
    width: 100%;
    border-radius: 8px;
}

.input-editable-flat:hover {
    background-color: #f3f5f8 !important;
    border-color: #d8deea !important;
}

.input-editable-flat:focus {
    background-color: #ffffff !important;
    border-color: #f3a160 !important;
    box-shadow: 0 0 0 0.2rem rgba(242, 106, 0, 0.16) !important;
    cursor: text;
    outline: 0;
}

.btn {
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: transform 0.18s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    border: 0;
    color: #fff;
    background: linear-gradient(135deg, #ff7d2f 0%, var(--accent-orange) 100%);
    box-shadow: var(--shadow-cta);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    color: #fff;
    background: linear-gradient(135deg, #ff8f4f 0%, #ea5f00 100%) !important;
}

.btn-success {
    border: 0;
    color: #fff;
    background: linear-gradient(135deg, #22c888 0%, var(--accent-green) 100%);
    box-shadow: 0 14px 26px rgba(25, 179, 122, 0.22);
}

.btn-success:hover,
.btn-success:focus,
.btn-success:active {
    color: #fff;
    background: linear-gradient(135deg, #1db076 0%, var(--accent-green-deep) 100%) !important;
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-info,
.btn-outline-danger,
.btn-outline-success {
    border-width: 1px;
    background-color: rgba(255, 255, 255, 0.72);
    font-weight: 600;
}

.btn-outline-primary {
    color: var(--brand-plum-soft);
    border-color: rgba(74, 31, 89, 0.35);
}

.btn-outline-primary:hover {
    color: #fff;
    background-color: var(--brand-plum-soft);
    border-color: var(--brand-plum-soft);
}

.table-responsive {
    border: 1px solid #ebdfcd;
    background: #fff;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(242, 106, 0, 0.05);
    --bs-table-hover-bg: rgba(242, 106, 0, 0.1);
    border-color: #eee2cf !important;
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    border-color: #f1e6d5 !important;
    vertical-align: middle;
}

.table thead th {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table tbody td {
    color: #2b3648;
    font-size: 0.92rem;
}

.module-shell .table > thead > tr > th {
    background-color: rgba(50, 16, 63, 0.95);
    color: #fff;
    border-color: #5c366d !important;
}

.module-shell .table > tbody > tr:hover > * {
    color: #1f1a13;
}

.fondo-morado,
.fondo-morado th,
.card-header.fondo-morado {
    background: linear-gradient(150deg, var(--brand-plum) 0%, var(--brand-plum-deep) 100%) !important;
    color: #ffffff !important;
    border-color: #5a336c !important;
}

.nav-tabs {
    border-bottom-color: #eadfcf;
}

.custom-book-tabs {
    background: #fffaf2;
    border: 1px solid #f0e5d1;
    border-radius: 16px;
    padding: 0.35rem;
    gap: 0.3rem;
}

.custom-book-tabs .nav-item {
    flex: 1 1 auto;
    text-align: center;
}

.custom-book-tabs .nav-link {
    width: 100%;
    border-radius: 12px;
    border: 1px solid transparent !important;
    margin-right: 0;
    color: #5f6a80 !important;
    background-color: transparent !important;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.22s ease;
}

.custom-book-tabs .nav-link:hover {
    color: #2c3650 !important;
    background-color: #fff2e7 !important;
    border-color: #ffd7b8 !important;
}

.custom-book-tabs .nav-link.active {
    color: #f26a00 !important;
    background: #ffffff !important;
    border-color: #ffd5b4 !important;
    box-shadow: 0 8px 14px rgba(242, 106, 0, 0.14);
}

.module-clientes .custom-book-tabs {
    margin-bottom: 1.35rem !important;
}

.module-clientes .card-header h5,
.module-clientes .card-header h4 {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 800;
}

.module-clientes .card-header h5::before,
.module-clientes .card-header h4::before {
    content: "";
    width: 6px;
    height: 24px;
    border-radius: 8px;
    background: linear-gradient(180deg, #ff9d4d 0%, #f26a00 100%);
}

.module-clientes .card-body {
    padding: 1.5rem;
}

.module-clientes .form-label {
    margin-bottom: 0.4rem;
}

.module-clientes .card-footer {
    padding: 1rem 1.5rem 1.2rem;
}

.module-clientes .card-footer .btn-primary {
    min-width: 220px;
    min-height: 3.1rem;
    font-size: 1.04rem;
}

.module-clientes select[multiple] {
    min-height: 4.8rem;
    background-color: #f8fafd;
}

.module-clientes .btn.btn-success {
    min-height: 2.95rem;
    padding-left: 1.4rem;
    padding-right: 1.4rem;
}

.btn-citar-cliente {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    line-height: 1;
    gap: 0.35rem;
}

.module-facturacion .card-header h5 {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
    font-weight: 800;
}

.module-facturacion .card-header h5 i {
    color: #ffcf9f;
}

.module-facturacion .card-body {
    padding: 1.35rem 1.4rem;
}

.module-facturacion .table tbody td .btn {
    min-width: 2.45rem;
}

.module-facturacion .card-footer {
    border-top: 1px solid #f0e6d5;
}

.module-facturacion .card-footer .btn {
    min-height: 2.8rem;
}

.pagination {
    gap: 0.3rem;
}

.pagination .page-link {
    border-radius: 10px;
    border-color: #e7dac7;
    color: var(--brand-plum-soft);
    font-weight: 700;
    min-width: 2.2rem;
    text-align: center;
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #ff7d2f 0%, #f26a00 100%);
    border-color: #f26a00;
    color: #fff;
}

.badge,
.pill,
.tag {
    border-radius: var(--radius-pill);
}

.pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid #eadfcf;
    color: #606b80;
    background: #fff8ec;
    font-size: 0.78rem;
    padding: 0.28rem 0.6rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
}

.tag-secondary {
    color: #fff;
    background: linear-gradient(140deg, #ff7a30 0%, #f26a00 100%);
}

.tag-secondary-dark {
    color: #fff;
    background: linear-gradient(140deg, #4a1f59 0%, #2b1036 100%);
}

.alert {
    border: 1px solid #ece1cf;
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(52, 36, 15, 0.08);
}

.alert-success {
    color: #0d5135;
    background: #e9fbf3;
    border-color: #bfead6;
}

.alert-danger,
.alert-error {
    color: #7c1931;
    background: #ffeef2;
    border-color: #f7c6d3;
}

.alert-warning {
    color: #6f4b06;
    background: #fff7e4;
    border-color: #f4dfb0;
}

.alert-info {
    color: #12426e;
    background: #e8f3ff;
    border-color: #bdd8fb;
}

.dropdown-menu {
    border: 1px solid #e9decb;
    box-shadow: var(--shadow-soft);
}

.modal-content {
    border: 1px solid #ecdcc1 !important;
    box-shadow: var(--shadow-card);
}

.modal-header .modal-title {
    color: var(--brand-plum);
    font-weight: 800;
}

.login-body {
    background: radial-gradient(circle at top right, rgba(242, 106, 0, 0.12), transparent 32%), radial-gradient(circle at bottom left, rgba(74, 31, 89, 0.14), transparent 35%), linear-gradient(135deg, #fffdf9 0%, #fff6e9 45%, #ffffff 100%);
}

.login-layout-shell {
    position: relative;
}

.login-hero-col {
    background: linear-gradient(165deg, rgba(255, 248, 233, 0.82) 0%, rgba(255, 255, 255, 0.56) 100%);
}

.login-form-col {
    position: relative;
}

.imgLogin {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.login-wrapper {
    background: transparent;
    transform: translateY(-30px);
}

.login-card {
    background: #fff;
    padding: 2rem;
    border: 1px solid #efe4d2;
    border-radius: 20px;
    box-shadow: 0 24px 46px rgba(51, 35, 12, 0.14);
    width: 100%;
    max-width: 390px;
}

.login-col {
    transform: translate(-24px, -26px);
}

.imgLogo {
    max-width: 390px;
}

.input-wrapper {
    position: relative;
}

.toggle-eye {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 1.15rem;
    color: #6e778a;
    transition: color 0.2s ease;
}

.toggle-eye:hover {
    color: #212a3c;
}

.tab-step {
    display: none;
}

.tab-step.active-step {
    display: block !important;
}

.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0;
    list-style: none;
}

.wizard-step {
    flex: 1;
    text-align: center;
    padding: 0.65rem;
    background: #f5f7fa;
    border-bottom: 3px solid #dde3ec;
    color: #6e7688;
    font-weight: 600;
}

.wizard-step.active {
    color: #f26a00;
    border-bottom-color: #f26a00;
}

.wizard-step.completed {
    color: var(--success);
    border-bottom-color: var(--success);
}

.tree-list,
.tree-child-list {
    list-style: none;
    padding-left: 20px;
}

.tree-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
    cursor: pointer;
}

.tree-toggler {
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s;
    display: inline-block;
    width: 15px;
}

.tree-toggler.open {
    transform: rotate(90deg);
}

.tree-container {
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.error-toast-wrapper {
    position: fixed;
    top: 22px;
    right: 22px;
    z-index: 10000;
    min-width: 320px;
    max-width: 460px;
    animation: slideIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.error-toast {
    background: #fff;
    border-left: 4px solid #d83454;
    border-radius: 10px;
    box-shadow: 0 14px 28px rgba(66, 22, 35, 0.2);
    padding: 15px;
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.error-toast i {
    font-size: 1.7rem;
    color: #d83454;
    margin-right: 12px;
}

.error-toast-content {
    flex: 1;
}

.error-toast-title {
    font-weight: 800;
    color: #222a3b;
    margin-bottom: 2px;
    display: block;
}

.error-toast-msg {
    color: #657086;
    font-size: 0.86rem;
    margin: 0;
}

.error-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, #f26a00 0%, #d83454 100%);
    z-index: 5;
}

@keyframes slideIn {
    from {
        transform: translateX(110%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

@media (max-width: 1199.98px) {
    .app-topbar h1 {
        font-size: 1.45rem !important;
    }
}

@media (max-width: 991.98px) {
    #sidebar {
        border-right: 0;
        box-shadow: 0 16px 30px rgba(40, 24, 10, 0.14);
    }

    .app-topbar {
        margin-bottom: 1rem !important;
        border-radius: 16px !important;
    }

    .login-col {
        transform: none;
        padding: 1.25rem;
    }

    .login-wrapper {
        transform: none;
        width: 100%;
        max-width: 420px;
    }

    .login-card {
        max-width: 100%;
    }

    .imgLogo {
        max-width: 220px;
    }

    main {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

@media (max-width: 768px) {
    .content {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-soft);
    }

    .navbar .container-fluid {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .error-toast-wrapper {
        left: 12px;
        right: 12px;
        min-width: 0;
        max-width: none;
    }

    .custom-book-tabs {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }
}
