﻿* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: #172033;
    background: #f4f7fb;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}

a,
button {
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

a:hover,
a:focus {
    text-decoration: none;
}

input,
select,
textarea {
    max-width: none;
}

.btn {
    border-radius: 8px;
    font-weight: 600;
    min-height: 38px;
}

.btn .glyphicon {
    margin-right: 6px;
}

.btn-sm .glyphicon,
.icon-button .glyphicon {
    margin-right: 0;
}

.btn-primary {
    background: #0f8f86;
    border-color: #0f8f86;
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
    background: #0b766f;
    border-color: #0b766f;
}

.btn-default {
    background: #fff;
    border-color: #d9e2ef;
    color: #21304a;
}

.btn-default:hover,
.btn-default:focus {
    background: #f3f7fb;
    border-color: #b9c7d9;
}

.btn-danger {
    background: #d94747;
    border-color: #d94747;
}

.btn[disabled],
button[disabled] {
    cursor: not-allowed;
    opacity: .48;
}

.form-control {
    border-color: #d9e2ef;
    border-radius: 8px;
    box-shadow: none;
    min-height: 40px;
}

.form-control:focus {
    border-color: #0f8f86;
    box-shadow: 0 0 0 3px rgba(15, 143, 134, .12);
}

.auth-body {
    background: linear-gradient(135deg, #f7fafc 0%, #edf3f8 52%, #f8fbff 100%);
}

.auth-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-panel {
    background: #fff;
    border: 1px solid #dde6f2;
    border-radius: 8px;
    box-shadow: 0 22px 55px rgba(26, 41, 61, .12);
    max-width: 430px;
    padding: 28px;
    width: 100%;
}

.login-brand {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
    text-align: center;
}

.login-brand img {
    display: block;
    height: auto;
    max-width: 320px;
    width: 100%;
}

.login-brand span {
    color: #21304a;
    font-size: 18px;
    font-weight: 700;
}

.login-form .btn {
    margin-top: 8px;
}

.app-shell {
    min-height: 100vh;
}

.app-sidebar {
    background: #182132;
    bottom: 0;
    color: #e8eef8;
    left: 0;
    overflow-y: auto;
    padding: 18px 14px;
    position: fixed;
    top: 0;
    width: 272px;
    z-index: 1040;
}

.brand-block {
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    margin-bottom: 16px;
    padding-bottom: 16px;
}

.brand-logo {
    background: #fff;
    border-radius: 8px;
    display: block;
    height: auto;
    max-height: 84px;
    object-fit: contain;
    padding: 8px;
    width: 100%;
}

.brand-copy {
    display: block;
    margin-top: 12px;
}

.brand-copy strong,
.brand-copy small {
    display: block;
}

.brand-copy strong {
    color: #fff;
    font-size: 15px;
}

.brand-copy small {
    color: #9eb1c9;
    font-size: 12px;
    margin-top: 2px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link {
    align-items: center;
    border-radius: 8px;
    color: #c5d2e5;
    display: flex;
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
}

.nav-link:hover,
.nav-link:focus,
.nav-link.active {
    background: rgba(20, 184, 166, .14);
    color: #fff;
}

.nav-link .glyphicon:first-child {
    color: #14b8a6;
    width: 18px;
}

.nav-parent {
    position: relative;
}

.nav-chevron {
    margin-left: auto;
    opacity: .62;
}

.nav-children {
    margin: 2px 0 8px 14px;
}

.nav-child {
    font-size: 13px;
    min-height: 38px;
    padding-left: 14px;
}

.app-main {
    margin-left: 272px;
    min-height: 100vh;
}

.topbar {
    align-items: center;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid #dde6f2;
    display: flex;
    gap: 14px;
    min-height: 66px;
    padding: 0 26px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.icon-button {
    align-items: center;
    background: #fff;
    border: 1px solid #d9e2ef;
    display: none;
    height: 40px;
    justify-content: center;
    padding: 0;
    width: 42px;
}

.topbar-heading {
    color: #172033;
    font-size: 17px;
    font-weight: 700;
    margin-right: auto;
}

.topbar-user {
    align-items: center;
    color: #53627a;
    display: flex;
    gap: 8px;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dot {
    background: #14b8a6;
    border-radius: 50%;
    display: inline-block;
    height: 8px;
    width: 8px;
}

.logout-form {
    margin: 0;
}

.logout-link {
    color: #d94747;
    min-height: auto;
    padding: 8px 0;
}

.app-content {
    padding: 26px;
}

.app-alert {
    border-radius: 8px;
    margin-bottom: 18px;
}

.page-heading {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-heading h1 {
    color: #172033;
    font-size: 26px;
    font-weight: 750;
    line-height: 1.2;
    margin: 0;
}

.page-heading p {
    color: #65758f;
    margin: 6px 0 0;
}

.eyebrow {
    color: #0f8f86;
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.metric-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 20px;
}

.metric-card,
.work-surface,
.form-panel,
.mobile-card,
.empty-state {
    background: #fff;
    border: 1px solid #dde6f2;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(26, 41, 61, .06);
}

.metric-card {
    min-height: 128px;
    padding: 18px;
    position: relative;
}

.metric-card strong {
    color: #172033;
    display: block;
    font-size: 30px;
    line-height: 1;
    margin: 16px 0 7px;
}

.metric-card span:last-child {
    color: #65758f;
}

.metric-icon {
    align-items: center;
    border-radius: 8px;
    display: flex;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.accent-teal .metric-icon { background: rgba(20, 184, 166, .14); color: #0f8f86; }
.accent-indigo .metric-icon { background: rgba(79, 70, 229, .12); color: #4f46e5; }
.accent-red .metric-icon { background: rgba(217, 71, 71, .12); color: #d94747; }
.accent-amber .metric-icon { background: rgba(217, 119, 6, .13); color: #b45309; }

.work-surface,
.form-panel {
    padding: 20px;
}

.surface-title {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.surface-title h2 {
    color: #172033;
    font-size: 18px;
    font-weight: 750;
    margin: 0;
}

.surface-title span {
    color: #65758f;
    font-size: 13px;
}

.quick-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quick-link {
    border: 1px solid #dde6f2;
    border-radius: 8px;
    color: #172033;
    display: block;
    min-height: 126px;
    padding: 16px;
}

.quick-link:hover,
.quick-link:focus {
    border-color: #14b8a6;
    color: #0f8f86;
    transform: translateY(-1px);
}

.quick-link .glyphicon {
    color: #0f8f86;
    display: block;
    font-size: 20px;
    margin-bottom: 12px;
}

.quick-link strong,
.quick-link small {
    display: block;
}

.quick-link small {
    color: #65758f;
    margin-top: 4px;
}

.list-toolbar {
    align-items: center;
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.list-toolbar .input-group {
    max-width: 420px;
    width: 100%;
}

.date-toolbar {
    align-items: flex-end;
    flex-wrap: wrap;
}

.date-toolbar .form-group {
    margin-bottom: 0;
    min-width: 190px;
}

.app-table {
    background: #fff;
    border: 1px solid #dde6f2;
    border-radius: 8px;
    margin: 0;
    overflow: hidden;
}

.app-table > thead > tr > th {
    background: #f7fafc;
    border-bottom: 1px solid #dde6f2;
    color: #53627a;
    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
}

.app-table > tbody > tr > td {
    border-top: 1px solid #edf2f7;
    color: #344054;
    vertical-align: middle;
}

.action-cell {
    white-space: nowrap;
}

.inline-form {
    display: inline-block;
    margin: 0 0 0 4px;
}

.form-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .span-2 {
    grid-column: span 2;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
}

.detail-panel {
    border-top: 1px solid #edf2f7;
    margin-top: 8px;
    padding-top: 18px;
}

.check-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-check {
    align-items: flex-start;
    border: 1px solid #dde6f2;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: 10px;
    margin: 0;
    min-height: 76px;
    padding: 12px;
}

.detail-check.compact {
    min-height: 58px;
}

.detail-check:hover {
    border-color: #14b8a6;
}

.detail-check input {
    margin-top: 3px;
}

.detail-check strong,
.detail-check small {
    display: block;
}

.detail-check small {
    color: #65758f;
    margin-top: 3px;
}

.mobile-card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-card {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 14px;
}

.mobile-card strong,
.mobile-card span,
.mobile-card small {
    display: block;
}

.mobile-card span,
.mobile-card small {
    color: #65758f;
    margin-top: 3px;
}

.mobile-actions {
    display: flex;
    flex-shrink: 0;
    gap: 6px;
}

.empty-state {
    margin: 24px auto 0;
    max-width: 520px;
    padding: 28px;
    text-align: center;
}

.empty-state.small {
    padding: 20px;
}

.empty-state h1 {
    font-size: 22px;
    font-weight: 750;
    margin: 10px 0 6px;
}

.empty-state p {
    color: #65758f;
}

.empty-icon {
    color: #0f8f86;
    font-size: 28px;
}

.app-overlay {
    background: rgba(9, 17, 31, .45);
    border: 0;
    bottom: 0;
    display: none;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 1030;
}

@media (max-width: 1199px) {
    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991px) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform .22s ease;
    }

    .sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .sidebar-open .app-overlay {
        display: block;
    }

    .app-main {
        margin-left: 0;
    }

    .icon-button {
        display: inline-flex;
    }

    .topbar {
        padding: 0 16px;
    }

    .app-content {
        padding: 18px;
    }

    .quick-grid,
    .check-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .auth-shell {
        padding: 16px;
    }

    .login-panel {
        padding: 22px;
    }

    .topbar-heading {
        font-size: 15px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-heading h1 {
        font-size: 23px;
    }

    .metric-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid .span-2 {
        grid-column: span 1;
    }

    .list-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .list-toolbar .input-group,
    .list-toolbar .btn {
        width: 100%;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }

    .mobile-card {
        flex-direction: column;
    }

    .mobile-actions {
        width: 100%;
    }
}

.disabled-link,
.disabled-link:hover,
.disabled-link:focus {
    color: #8a97aa;
    cursor: not-allowed;
    opacity: .55;
    transform: none;
}

/* Login split screen */
.auth-body {
    background: #ffffff;
}

.auth-shell {
    align-items: stretch;
    display: block;
    justify-content: normal;
    min-height: 100vh;
    padding: 0;
}

.login-split {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(360px, 1fr);
    min-height: 100vh;
    width: 100%;
}

.login-visual {
    background: #9b1221;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

.login-visual-image {
    height: 100%;
    inset: 0;
    object-fit: cover;
    position: absolute;
    width: 100%;
}

.login-visual-overlay {
    background: linear-gradient(115deg, rgba(120, 10, 26, .92) 0%, rgba(168, 24, 39, .84) 48%, rgba(213, 43, 58, .88) 100%);
    inset: 0;
    position: absolute;
}

.login-visual::before,
.login-visual::after {
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 8px;
    content: "";
    position: absolute;
}

.login-visual::before {
    bottom: 11%;
    left: 7%;
    right: 12%;
    top: 13%;
}

.login-visual::after {
    background: rgba(255, 255, 255, .04);
    bottom: 6%;
    left: 5%;
    right: 9%;
    top: 36%;
}

.login-visual-frame {
    border: 14px solid rgba(255, 255, 255, .035);
    border-radius: 50%;
    height: 270px;
    left: 38%;
    position: absolute;
    top: 42%;
    transform: translate(-50%, -50%);
    width: 270px;
}

.login-logo-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 26px 60px rgba(57, 9, 16, .24);
    max-width: 310px;
    padding: 18px;
    position: absolute;
    right: 6%;
    top: 7%;
    width: 24%;
    z-index: 2;
}

.login-logo-card img {
    display: block;
    height: auto;
    width: 100%;
}

.login-visual-copy {
    bottom: 8%;
    color: #fff;
    left: 6%;
    max-width: 650px;
    position: absolute;
    z-index: 2;
}

.login-visual-copy span,
.login-visual-copy strong,
.login-visual-copy small {
    display: block;
}

.login-visual-copy span {
    color: rgba(255, 255, 255, .72);
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 12px;
}

.login-visual-copy strong {
    font-size: 66px;
    font-weight: 800;
    line-height: .98;
}

.login-visual-copy small {
    color: rgba(255, 255, 255, .88);
    font-size: 21px;
    margin-top: 20px;
}

.login-side {
    align-items: center;
    background: #fff;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 42px;
}

.login-side .login-panel {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    max-width: 430px;
    padding: 0;
}

.login-side .login-brand {
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 30px;
    text-align: left;
}

.login-side .login-brand img {
    max-width: 270px;
}

.login-side .login-brand span {
    color: #5b5160;
    font-size: 16px;
    font-weight: 800;
}

.login-form label {
    color: #625766;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.login-side .form-control {
    border-color: #ead2d6;
    border-radius: 8px;
    height: 52px;
}

.login-side .form-control:focus {
    border-color: #d93648;
    box-shadow: 0 0 0 3px rgba(217, 54, 72, .12);
}

.login-side .btn-primary {
    background: #d93648;
    border-color: #d93648;
    border-radius: 8px;
    font-size: 16px;
    height: 50px;
    margin-top: 18px;
}

.login-side .btn-primary:hover,
.login-side .btn-primary:focus {
    background: #bd2637;
    border-color: #bd2637;
}

.login-form .validation-summary-errors {
    background: #fff3f4;
    border: 1px solid #f2c2c9;
    border-radius: 8px;
    color: #a51d2d;
    margin-bottom: 16px;
    padding: 10px 12px;
}

@media (max-width: 1100px) {
    .login-split {
        grid-template-columns: minmax(0, 2fr) minmax(340px, 1fr);
    }

    .login-visual-copy strong {
        font-size: 52px;
    }

    .login-logo-card {
        width: 30%;
    }
}

@media (max-width: 850px) {
    .login-split {
        grid-template-columns: 1fr;
    }

    .login-visual {
        min-height: 320px;
    }

    .login-logo-card {
        max-width: 240px;
        right: 20px;
        top: 22px;
        width: 38%;
    }

    .login-visual-copy {
        bottom: 30px;
        left: 24px;
        right: 24px;
    }

    .login-visual-copy strong {
        font-size: 38px;
    }

    .login-visual-copy small {
        font-size: 17px;
        margin-top: 10px;
    }

    .login-side {
        min-height: auto;
        padding: 30px 22px;
    }

    .login-side .login-panel {
        max-width: 520px;
        width: 100%;
    }
}

@media (max-width: 520px) {
    .login-visual {
        min-height: 260px;
    }

    .login-logo-card {
        padding: 10px;
        width: 48%;
    }

    .login-visual-copy strong {
        font-size: 32px;
    }

    .login-visual-copy span {
        font-size: 11px;
    }

    .login-side .login-brand img {
        max-width: 235px;
    }
}

/* CRM360 */
.client-summary {
    background: #fff;
    border: 1px solid #dde6f2;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(26, 41, 61, .06);
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
    padding: 16px;
}

.client-summary span,
.client-summary strong {
    display: block;
}

.client-summary span {
    color: #65758f;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.client-summary strong {
    color: #172033;
    font-size: 15px;
    margin-top: 4px;
}

.crm-tabs {
    border-bottom: 1px solid #d9e2ef;
    margin-bottom: 0;
}

.crm-tabs > li > a {
    border-radius: 8px 8px 0 0;
    color: #53627a;
    font-weight: 700;
}

.crm-tabs > li.tab-ok > a {
    background: #eefaf5;
    color: #0f7a55;
}

.crm-tabs > li.tab-warn > a {
    background: #fff8df;
    color: #9a6b04;
}

.crm-tabs > li.active > a,
.crm-tabs > li.active > a:hover,
.crm-tabs > li.active > a:focus {
    background: #fff;
    border-color: #d9e2ef #d9e2ef #fff;
    color: #172033;
}

.crm-tab-content {
    background: #fff;
    border: 1px solid #d9e2ef;
    border-top: 0;
    border-radius: 0 0 8px 8px;
    padding: 18px;
}

.client-code-pill {
    background: #edf8ff;
    border: 1px solid #c9e8ff;
    border-radius: 8px;
    color: #0b5f8f;
    display: inline-block;
    font-weight: 800;
    margin-bottom: 14px;
    padding: 8px 12px;
}

.checkbox-row {
    align-items: center;
    display: flex;
    gap: 18px;
    min-height: 40px;
}

.checkbox-row label {
    color: #344054;
    font-weight: 700;
    margin: 0;
}

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

@media (max-width: 767px) {
    .client-summary {
        grid-template-columns: 1fr;
    }

    .crm-tabs > li {
        float: none;
    }

    .crm-tabs > li > a {
        border-radius: 8px;
    }

    .crm-tab-content {
        border-top: 1px solid #d9e2ef;
        border-radius: 8px;
    }
}

/* Planes y Servicios */
.plan-total,
.assignment-panel,
.detail-section {
    background: #fff;
    border: 1px solid #dde6f2;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(26, 41, 61, .05);
}

.plan-total {
    display: inline-flex;
    flex-direction: column;
    margin-bottom: 14px;
    padding: 10px 14px;
}

.plan-total span,
.readonly-grid span {
    color: #65758f;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.plan-total strong {
    color: #0b5f8f;
    font-size: 22px;
}

.detail-section,
.assignment-panel {
    margin-top: 18px;
    padding: 18px;
}

.section-title-row {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-title-row h2 {
    color: #172033;
    font-size: 20px;
    font-weight: 800;
    margin: 2px 0 0;
}

.status-pill {
    border-radius: 999px;
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    padding: 5px 10px;
}

.status-pill.ok {
    background: #eaf8f2;
    color: #117956;
}

.status-pill.warn {
    background: #fff5d6;
    color: #98650a;
}

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

.readonly-grid strong {
    color: #172033;
    display: block;
    margin-top: 4px;
}

.detail-preview {
    background: #f8fbff;
    border: 1px dashed #c9d8eb;
    border-radius: 8px;
    color: #5f7087;
    margin-top: 10px;
    padding: 14px;
}

.preview-list {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.preview-list article {
    background: #fff;
    border: 1px solid #e2eaf5;
    border-radius: 8px;
    padding: 12px;
}

.preview-list strong,
.preview-list span,
.preview-list small,
.preview-list b {
    display: block;
}

.preview-list span,
.preview-list small {
    color: #63758d;
}

.preview-list b,
.preview-total strong {
    color: #0b5f8f;
}

.preview-total {
    border-top: 1px solid #dce7f3;
    margin-top: 12px;
    padding-top: 12px;
    text-align: right;
}

@media (max-width: 767px) {
    .section-title-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .readonly-grid,
    .preview-list {
        grid-template-columns: 1fr;
    }
}

/* CRM direccion helpers */
.searchable-select .select-filter-input {
    background: #f8fbff;
    margin-bottom: 8px;
}

.gps-pair {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gps-pair .sub-label {
    color: #65758f;
    display: block;
    font-size: 12px;
    margin-bottom: 6px;
}

@media (max-width: 520px) {
    .gps-pair {
        grid-template-columns: 1fr;
    }
}

.heading-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

@media (max-width: 767px) {
    .heading-actions {
        justify-content: flex-start;
        width: 100%;
    }
}
