:root {
    --brand-purple: #4d148c;
    --brand-purple-dark: #35105f;
    --brand-orange: #ff6200;
    --brand-blue: #007ab7;
    --ink: #1e1c24;
    --muted: #6e6975;
    --line: #dedde0;
    --canvas: #f2f2f2;
    --white: #ffffff;
    --success: #147d64;
    --sidebar-width: 272px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; max-width: 100vw; overflow-x: hidden; overflow-x: clip; }
body { margin: 0; color: var(--ink); font-family: "DM Sans", sans-serif; background: var(--canvas); }
button, input { font: inherit; }
h1, h2, h3, .brand-name { font-family: "Manrope", sans-serif; }
a { color: inherit; }

.btn { border-radius: 6px; font-weight: 700; }
.btn-brand { display: inline-flex; align-items: center; justify-content: center; gap: .65rem; min-height: 46px; padding: .7rem 1.2rem; color: #fff; border-color: var(--brand-orange); background: var(--brand-orange); }
.btn-brand:hover, .btn-brand:focus { color: #fff; border-color: #dd5500; background: #dd5500; }
.btn-brand:disabled { border-color: #c7c3ca; background: #c7c3ca; }
.btn-outline-brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--brand-purple); border: 1px solid #d3c5df; background: #fff; }
.btn-outline-brand:hover { color: #fff; border-color: var(--brand-purple); background: var(--brand-purple); }
.btn-icon { display: inline-grid; width: 40px; height: 40px; padding: 0; place-items: center; color: var(--ink); border: 0; background: transparent; }
.eyebrow { display: block; color: var(--brand-purple); font-size: .72rem; font-weight: 800; letter-spacing: .12em; }
.brand-lockup { display: inline-flex; flex-direction: column; text-decoration: none; line-height: 1; }
.brand-name { color: var(--brand-purple); font-size: 1.45rem; font-weight: 800; letter-spacing: 0; }
.brand-name::after { content: "·"; color: var(--brand-orange); }
.brand-caption { margin-top: .35rem; color: var(--muted); font-size: .68rem; font-weight: 600; }
.public-logo-crop { position: relative; display: block; width: 145px; height: 43px; overflow: hidden; }
.public-logo { position: absolute; top: -25px; left: -17px; display: block; width: 180px; height: auto; }

.login-page { display: grid; min-height: 100vh; min-height: 100dvh; grid-template-columns: minmax(0, 1.08fr) minmax(480px, .92fr); background: #fff; }
.login-visual { position: relative; min-width: 0; overflow: hidden; background: #302c37 url("../images/login-delivery.jpg") center/cover no-repeat; }
.visual-shade { position: absolute; inset: 0; background: rgba(26, 18, 34, .52); }
.visual-caption { position: absolute; right: clamp(2rem, 7vw, 6rem); bottom: clamp(2.5rem, 8vh, 5rem); left: clamp(2rem, 7vw, 6rem); max-width: 580px; color: #fff; }
.visual-caption .eyebrow { color: #ffc39d; }
.visual-caption h2 { margin: .75rem 0 .5rem; font-size: clamp(2rem, 3.5vw, 3.4rem); font-weight: 800; line-height: 1.08; }
.visual-caption p { margin: 0; color: rgba(255,255,255,.82); font-size: 1.05rem; }
.login-panel { display: grid; min-width: 0; padding: clamp(1.5rem, 5vw, 5rem); place-items: center; background: #fff; }
.login-card { width: min(100%, 430px); }
.login-brand { margin-bottom: clamp(3rem, 8vh, 5rem); }
.login-heading { margin-bottom: 2.25rem; }
.login-heading h1 { margin: .65rem 0 .6rem; color: var(--ink); font-size: 2rem; font-weight: 800; }
.login-heading p { margin: 0; color: var(--muted); }
.form-label { margin-bottom: .45rem; color: #3b3740; font-size: .82rem; font-weight: 700; }
.input-group-auth { border: 1px solid #d6d2d9; border-radius: 6px; background: #fff; transition: border-color .2s, box-shadow .2s; }
.input-group-auth:focus-within { border-color: var(--brand-purple); box-shadow: 0 0 0 3px rgba(77,20,140,.1); }
.input-group-auth:has(.is-invalid) { border-color: #dc3545; }
.input-group-auth:has(.is-invalid):focus-within { box-shadow: 0 0 0 3px rgba(220,53,69,.1); }
.input-group-auth:has(.is-invalid) + .form-text + .invalid-feedback,
.input-group-auth:has(.is-invalid) + .invalid-feedback { display: block; }
.input-group-auth .input-group-text, .input-group-auth .form-control, .password-toggle { min-height: 50px; border: 0; background: transparent; }
.input-group-auth .input-group-text { padding-left: 1rem; color: #77717e; }
.input-group-auth .form-control { padding-left: .3rem; box-shadow: none; font-size: 16px; }
.password-toggle { color: #77717e; }
.auth-link { color: var(--brand-purple); font-size: .78rem; font-weight: 700; text-decoration: none; }
.auth-link:hover { color: var(--brand-purple-dark); text-decoration: underline; }
.form-check-label { color: #4c4751; font-size: .85rem; }
.form-check-input:checked { border-color: var(--brand-purple); background-color: var(--brand-purple); }
.login-support { display: flex; justify-content: center; gap: .3rem; margin: 2rem 0; color: var(--muted); font-size: .82rem; }
.customer-entry { display: flex; align-items: center; gap: .8rem; padding: 1rem; color: #433d48; border: 1px solid var(--line); border-radius: 6px; background: #faf9fb; text-decoration: none; }
.customer-entry:hover { color: var(--brand-purple); border-color: #d5c5e2; }
.customer-entry span { font-size: .78rem; }
.customer-entry i:first-child { color: var(--brand-orange); font-size: 1.25rem; }

.global-loading { position: fixed; z-index: 2000; inset: 0 0 auto; height: 0; opacity: 0; pointer-events: none; transition: opacity .16s ease; }
.global-loading.is-visible { opacity: 1; }
.global-loading-bar { position: absolute; top: 0; left: 0; width: 38%; height: 3px; background: var(--brand-orange); box-shadow: 0 0 8px rgba(255,98,0,.32); animation: global-loading-progress 1.25s ease-in-out infinite; }
.global-loading-status { position: absolute; top: 14px; left: 50%; display: flex; min-height: 38px; padding: .55rem .8rem; align-items: center; gap: .65rem; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.98); box-shadow: 0 8px 24px rgba(31,22,38,.14); transform: translate(-50%, -8px); transition: transform .16s ease; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.global-loading.is-visible .global-loading-status { transform: translate(-50%, 0); }
.global-loading-spinner { width: 16px; height: 16px; flex: 0 0 auto; border: 2px solid #ded5e6; border-top-color: var(--brand-purple); border-radius: 50%; animation: global-loading-spin .72s linear infinite; }
@keyframes global-loading-progress { 0% { left: -42%; } 55% { width: 52%; } 100% { left: 104%; width: 24%; } }
@keyframes global-loading-spin { to { transform: rotate(360deg); } }

.app-body { overflow: hidden; }
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.app-sidebar { position: fixed; z-index: 1030; inset: 0 auto 0 0; display: flex; width: var(--sidebar-width); flex-direction: column; border-right: 0; background: var(--brand-purple); box-shadow: 8px 0 28px rgba(33, 13, 54, .12); }
.sidebar-brand { display: flex; min-height: 106px; padding: .8rem 1.5rem; align-items: center; justify-content: space-between; border-bottom: 1px solid #e4e1e7; background: #fff; }
.sidebar-brand .brand-lockup { min-width: 0; }
.sidebar-logo-crop { position: relative; display: block; width: 145px; height: 43px; overflow: hidden; }
.sidebar-logo { position: absolute; top: -25px; left: -17px; display: block; width: 180px; height: auto; }
.sidebar-brand-caption { color: #65606a; font-size: .62rem; font-weight: 700; line-height: 1.2; }
.sidebar-brand .btn-icon { color: var(--brand-purple); }
.sidebar-nav { flex: 1; padding: 1.5rem 1rem; overflow-y: auto; }
.nav-section-label { margin: 0 0 .6rem .75rem; color: #d6c4e6; font-size: .65rem; font-weight: 800; letter-spacing: .12em; }
.nav-item { position: relative; display: flex; width: 100%; min-height: 44px; margin-bottom: .3rem; padding: .65rem .8rem; align-items: center; gap: .8rem; color: #eee7f4; border: 0; border-radius: 6px; background: transparent; font-weight: 600; text-align: left; text-decoration: none; }
.nav-item i { width: 22px; color: #d8c9e4; font-size: 1.05rem; text-align: center; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.1); }
.nav-item:hover i { color: #fff; }
.nav-item.active { color: var(--brand-purple); background: #fff; }
.nav-item.active::before { position: absolute; width: 3px; inset: 8px auto 8px 0; border-radius: 0 2px 2px 0; background: var(--brand-orange); content: ""; }
.nav-item.active i { color: var(--brand-purple); }
.sidebar-footer { display: flex; min-width: 0; padding: 1rem; align-items: center; gap: .7rem; border-top: 1px solid rgba(255,255,255,.16); }
.user-avatar { display: grid; width: 38px; height: 38px; flex: 0 0 auto; color: #fff; border-radius: 50%; background: var(--brand-orange); place-items: center; font-weight: 800; }
.user-copy { display: flex; min-width: 0; flex-direction: column; }
.user-copy strong, .user-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { color: #fff; font-size: .78rem; }
.user-copy span { color: #d9cce4; font-size: .67rem; }
.sidebar-footer .btn-icon { color: #fff; }
.sidebar-footer .btn-icon:hover { background: rgba(255,255,255,.1); }
.app-main { width: calc(100% - var(--sidebar-width)); min-width: 0; min-height: 100dvh; margin-left: var(--sidebar-width); overflow-y: auto; }
.app-topbar { position: sticky; z-index: 1010; top: 0; display: flex; height: 72px; padding: 0 clamp(1rem, 3vw, 2.5rem); align-items: center; gap: .8rem; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.topbar-kicker, .topbar-title { display: block; }
.topbar-kicker { color: var(--brand-blue); font-size: .68rem; font-weight: 700; }
.topbar-title { font-size: .88rem; }

.app-content { min-height: calc(100dvh - 72px); padding: clamp(1.25rem, 3vw, 2.5rem); transition: opacity .18s; }
.app-content.is-loading { opacity: .58; pointer-events: none; user-select: none; }
.page-section { max-width: 1440px; margin: 0 auto; }
.page-heading { display: flex; margin-bottom: 2rem; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.page-heading h1 { margin: .45rem 0 .35rem; font-size: clamp(1.7rem, 3vw, 2.25rem); font-weight: 800; }
.page-heading p { margin: 0; color: var(--muted); }
.metric-grid { display: grid; margin-bottom: 1.25rem; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.metric-card, .content-panel { border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.metric-card { position: relative; display: flex; min-width: 0; padding: 1.25rem; flex-direction: column; }
.metric-icon { display: grid; width: 38px; height: 38px; margin-bottom: 1.35rem; border-radius: 6px; place-items: center; }
.icon-purple { color: var(--brand-purple); background: #f0e8f6; }
.icon-orange { color: #b94a00; background: #fff0e7; }
.icon-green { color: var(--success); background: #e5f5f0; }
.icon-blue { color: var(--brand-blue); background: #e3f3fa; }
.metric-label { color: var(--muted); font-size: .76rem; font-weight: 700; }
.metric-value { margin: .35rem 0 .65rem; font-family: "Manrope", sans-serif; font-size: 1.75rem; }
.metric-foot { color: #928c97; font-size: .68rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 1rem; }
.content-panel { min-height: 360px; padding: 1.25rem; }
.panel-heading { display: flex; margin-bottom: 1rem; align-items: center; justify-content: space-between; gap: 1rem; }
.panel-heading h2 { margin: .3rem 0 0; font-size: 1.05rem; font-weight: 800; }
.empty-state { display: grid; min-height: 245px; color: var(--muted); text-align: center; place-content: center; }
.empty-icon { display: grid; width: 52px; height: 52px; margin: 0 auto 1rem; color: var(--brand-purple); border-radius: 50%; background: #f1eaf7; place-items: center; font-size: 1.25rem; }
.empty-state h3 { margin-bottom: .4rem; color: var(--ink); font-size: .95rem; font-weight: 800; }
.empty-state p { margin: 0; font-size: .78rem; }
.quick-panel { min-height: 360px; }
.quick-action { display: flex; width: 100%; padding: .9rem .25rem; align-items: center; gap: .85rem; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; text-decoration: none; }
.quick-action:hover { color: var(--brand-purple); }
.quick-action > i:first-child { display: grid; width: 36px; height: 36px; flex: 0 0 auto; border-radius: 6px; background: #f4f1f6; place-items: center; }
.quick-action span { display: flex; min-width: 0; flex-direction: column; }
.quick-action strong { font-size: .8rem; }
.quick-action small { color: var(--muted); font-size: .7rem; }
.sidebar-backdrop { display: none; }
.sidebar-toggle { display: none; }

.client-filters { display: grid; margin-bottom: 1rem; padding: 1rem; grid-template-columns: minmax(240px, 1fr) repeat(3, minmax(150px, .42fr)) auto auto; align-items: center; gap: .65rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.client-search { display: flex; min-width: 0; height: 42px; align-items: center; gap: .65rem; padding: 0 .85rem; border: 1px solid #d6d2d9; border-radius: 6px; background: #fff; }
.client-search:focus-within { border-color: var(--brand-purple); box-shadow: 0 0 0 3px rgba(77,20,140,.08); }
.client-search i { color: #77717e; }
.client-search input { width: 100%; min-width: 0; border: 0; outline: 0; font-size: 16px; }
.client-filters .form-select { min-height: 42px; border-color: #d6d2d9; border-radius: 6px; font-size: .78rem; }
.btn-filter { display: inline-flex; min-height: 42px; align-items: center; gap: .5rem; color: #fff; border-color: var(--brand-purple); background: var(--brand-purple); }
.btn-filter:hover { color: #fff; background: var(--brand-purple-dark); }
.clients-panel { min-height: 420px; padding: 0; overflow: hidden; }
.clients-summary { display: flex; min-height: 58px; padding: 0 1.25rem; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.clients-summary strong { font-size: .82rem; }
.clients-summary span { color: var(--muted); font-size: .72rem; }
.clients-empty { min-height: 350px; }
.clients-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.clients-table { width: 100%; min-width: 960px; border-collapse: collapse; }
.clients-table th { padding: .8rem 1rem; color: #817b86; border-bottom: 1px solid var(--line); background: #fafafa; font-size: .64rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.clients-table td { padding: .9rem 1rem; color: #39343e; border-bottom: 1px solid #eceaed; font-size: .76rem; vertical-align: middle; }
.clients-table tbody tr:hover { background: #faf8fc; }
.clients-table td strong, .clients-table td span, .clients-table td small { display: block; }
.clients-table td strong { color: var(--ink); font-size: .8rem; }
.clients-table td small { margin-top: .2rem; color: var(--muted); font-size: .68rem; }
.client-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: .1rem; }
.assign-client-executive { color: var(--brand-purple); }
.assign-client-executive:hover, .assign-client-executive:focus { color: var(--brand-purple-dark); background: #f1eaf7; }
.document-copy { color: var(--brand-blue); font-weight: 800; }
.status-badge { display: inline-flex !important; padding: .3rem .55rem; border-radius: 999px; font-size: .66rem; font-weight: 800; }
.status-badge.is-active { color: #0c6b54; background: #e5f5f0; }
.status-badge.is-inactive { color: #716a77; background: #eceaec; }
.clients-pagination { display: flex; min-height: 60px; padding: .65rem 1rem; align-items: center; justify-content: flex-end; gap: .8rem; border-top: 1px solid var(--line); }
.clients-pagination span { color: var(--muted); font-size: .72rem; }
.detail-toolbar { display: flex; margin-bottom: 1.5rem; align-items: center; gap: 1rem; }
.detail-toolbar h1 { margin: .25rem 0 0; font-size: 1.75rem; font-weight: 800; }
.client-form { display: grid; gap: 1rem; }
.form-section { display: grid; padding: 1.35rem; grid-template-columns: minmax(180px, .38fr) minmax(0, 1fr); gap: 2rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.form-section-heading { display: flex; gap: .8rem; }
.form-section-heading > span { display: grid; width: 32px; height: 32px; flex: 0 0 auto; color: #fff; border-radius: 6px; background: var(--brand-purple); place-items: center; font-size: .68rem; font-weight: 800; }
.form-section-heading h2 { margin: .15rem 0 .3rem; font-size: .95rem; font-weight: 800; }
.form-section-heading p { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.field-group { min-width: 0; }
.form-span-2 { grid-column: 1 / -1; }
.client-form .form-control, .client-form .form-select { min-height: 44px; border-color: #d6d2d9; border-radius: 6px; font-size: 16px; }
.client-form textarea.form-control { min-height: 90px; }
.client-form .form-control:focus, .client-form .form-select:focus { border-color: var(--brand-purple); box-shadow: 0 0 0 3px rgba(77,20,140,.08); }
.form-actions { position: sticky; z-index: 10; bottom: 0; display: flex; padding: 1rem 0; justify-content: flex-end; gap: .75rem; background: var(--canvas); }
.client-profile-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .65fr); gap: 1rem; }
.profile-main { min-height: 460px; padding: 1.5rem; }
.profile-header { display: flex; padding-bottom: 1.5rem; align-items: center; gap: 1rem; border-bottom: 1px solid var(--line); }
.profile-avatar { display: grid; width: 58px; height: 58px; color: #fff; border-radius: 7px; background: var(--brand-purple); place-items: center; font-family: "Manrope", sans-serif; font-size: 1.4rem; font-weight: 800; }
.profile-header p { margin: .45rem 0 0; color: var(--muted); font-size: .75rem; }
.profile-data { display: grid; margin: 0; padding-top: 1.5rem; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.profile-data div { min-width: 0; }
.profile-data dt { margin-bottom: .35rem; color: var(--muted); font-size: .66rem; font-weight: 700; }
.profile-data dd { margin: 0; overflow-wrap: anywhere; font-size: .82rem; font-weight: 600; }
.profile-side { display: grid; align-content: start; gap: 1rem; }
.profile-module { position: relative; min-height: 210px; padding: 1.25rem; }
.profile-module h2 { margin: .3rem 0 0; font-size: 1rem; font-weight: 800; }
.profile-module p { margin: 1.5rem 0; color: var(--muted); font-size: .72rem; }
.profile-count { position: absolute; top: 1.1rem; right: 1.25rem; color: var(--brand-purple); font-family: "Manrope", sans-serif; font-size: 1.6rem; font-weight: 800; }
.client-related-section { margin-top: 1rem; padding: 1.25rem; }
.client-related-section .section-title h2 { margin: .3rem 0 0; font-size: 1rem; font-weight: 800; }
.related-empty { margin: 1rem 0 0; padding: 1rem; color: var(--muted); border: 1px dashed #d5cedd; border-radius: 6px; font-size: .75rem; text-align: center; }
.related-list { display: grid; margin-top: 1rem; gap: .5rem; }
.related-item { display: grid; padding: .8rem; align-items: center; grid-template-columns: 38px minmax(0, 1fr) auto auto; gap: .8rem; border: 1px solid var(--line); border-radius: 6px; }
.related-icon { display: grid; width: 38px; height: 38px; color: var(--brand-purple); border-radius: 6px; background: rgba(77,20,140,.08); place-items: center; }
.related-item strong, .related-item span, .related-item small { display: block; }
.related-item strong { font-size: .76rem; }
.related-item span { margin-top: .15rem; color: var(--ink-soft); font-size: .69rem; }
.related-item small { margin-top: .15rem; color: var(--muted); font-size: .63rem; }
.related-actions { display: flex; align-items: center; gap: .25rem; }
.related-actions form { margin: 0; }
.modal-content { border: 0; border-radius: 7px; box-shadow: 0 18px 50px rgba(30,20,38,.18); }
.modal-header, .modal-footer { border-color: var(--line); }
.modal-title { margin: .25rem 0 0; font-size: 1.05rem; font-weight: 800; }
.modal-body .form-control, .modal-body .form-select { min-height: 42px; border-radius: 6px; font-size: 16px; }
.assignment-modal { overflow: visible; }
.assignment-modal .modal-body { display: grid; min-width: 0; padding: 1.25rem; gap: 1.25rem; }
.assignment-client-summary { display: flex; width: 100%; min-width: 0; max-width: 100%; padding: .9rem; overflow: hidden; align-items: center; gap: .8rem; border-left: 3px solid var(--brand-blue); background: #f4f9fc; }
.assignment-client-icon { display: grid; width: 40px; height: 40px; flex: 0 0 40px; color: var(--brand-blue); border-radius: 6px; background: #e3f3fa; place-items: center; }
.assignment-client-summary div:last-child { min-width: 0; }
.assignment-client-summary strong, .assignment-client-summary span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assignment-client-summary strong { font-size: .82rem; }
.assignment-client-summary span { margin-top: .2rem; color: var(--muted); font-size: .68rem; }
.assignment-field { width: 100%; min-width: 0; max-width: 100%; }
.assignment-field label { display: block; margin-bottom: .45rem; color: #3b3740; font-size: .75rem; font-weight: 700; }
.assignment-field > small { display: block; margin-top: .45rem; color: var(--muted); font-size: .65rem; line-height: 1.45; }
.assignment-modal .select2-container { width: 100% !important; min-width: 0; max-width: 100%; }
.assignment-modal .select2-container--bootstrap-5 .select2-selection { min-height: 44px; border-color: #d6d2d9; border-radius: 6px; font-size: 16px; }
.assignment-modal .select2-container--bootstrap-5 .select2-selection--single { position: relative; display: flex; min-width: 0; padding-right: 4.25rem; align-items: center; overflow: hidden; }
.assignment-modal .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered { position: static; display: block; width: 100%; min-width: 0; padding-right: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assignment-modal .select2-container--bootstrap-5 .select2-selection--single .select2-selection__clear { position: absolute; z-index: 2; top: 50%; right: 2.35rem; margin: 0; transform: translateY(-50%); }
.assignment-modal .select2-container--bootstrap-5.select2-container--focus .select2-selection { border-color: var(--brand-purple); box-shadow: 0 0 0 3px rgba(77,20,140,.08); }
.contact-switches { display: flex; align-items: end; flex-wrap: wrap; gap: 1rem; }
.contact-switches label { color: var(--ink-soft); font-size: .72rem; }
.form-hint { display: block; margin-top: .35rem; color: var(--muted); font-size: .64rem; }

.portal-body { display: flex; min-height: 100vh; min-height: 100dvh; flex-direction: column; background-color: var(--canvas); }
.portal-header { display: flex; width: min(1180px, calc(100% - 3rem)); min-height: 86px; margin: 0 auto; align-items: center; justify-content: space-between; }
.tracking-main { display: grid; width: 100%; flex: 1; padding: 4rem 1.5rem; place-items: center; }
.tracking-hero { width: min(100%, 890px); text-align: center; }
.tracking-hero h1 { margin: .8rem 0 1rem; color: var(--ink); font-size: clamp(2.2rem, 6vw, 4.4rem); font-weight: 800; line-height: 1.04; }
.tracking-hero > p { max-width: 600px; margin: 0 auto 2.25rem; color: var(--muted); font-size: 1.05rem; }
.tracking-form { display: flex; max-width: 760px; min-height: 68px; margin: 0 auto; padding: .55rem; align-items: center; gap: .6rem; border: 1px solid #d9d4dd; border-radius: 7px; background: #fff; box-shadow: 0 18px 50px rgba(48,35,58,.1); }
.tracking-form > i { margin-left: .8rem; color: var(--brand-purple); font-size: 1.35rem; }
.tracking-form input { min-width: 0; flex: 1; padding: .6rem; border: 0; outline: 0; font-size: 16px; }
.portal-services { display: grid; max-width: 760px; margin: 3.5rem auto 0; grid-template-columns: repeat(3, 1fr); gap: 1rem; text-align: left; }
.portal-services > div { display: flex; padding: 1rem; align-items: center; gap: .75rem; }
.portal-services i { color: var(--brand-orange); font-size: 1.35rem; }
.portal-services span { display: flex; flex-direction: column; }
.portal-services strong { font-size: .78rem; }
.portal-services small { color: var(--muted); font-size: .68rem; }
.portal-footer { display: flex; width: min(1180px, calc(100% - 3rem)); margin: 0 auto; padding: 1.5rem 0; justify-content: space-between; color: var(--muted); border-top: 1px solid var(--line); font-size: .72rem; }
.error-page { display: grid; min-height: 100dvh; padding: 2rem; text-align: center; place-content: center; }
.error-code { color: var(--brand-orange); font-family: "Manrope", sans-serif; font-size: 5rem; font-weight: 800; }
.error-page h1 { font-weight: 800; }
.error-page p { margin-bottom: 1.5rem; color: var(--muted); }

@media (max-width: 1399.98px) {
    .app-sidebar { transform: translateX(-100%); transition: transform .25s ease; }
    .sidebar-open .app-sidebar { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; z-index: 1020; inset: 0; background: rgba(25,20,29,.48); }
    .sidebar-open .sidebar-backdrop { display: block; }
    .sidebar-toggle { display: inline-grid; }
    .app-main { width: 100%; margin-left: 0; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .client-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .client-search { grid-column: 1 / -1; }
}

@media (max-width: 991.98px) {
    .login-page { grid-template-columns: 42% minmax(0, 58%); }
    .visual-caption { right: 1.5rem; left: 1.5rem; }
    .visual-caption h2 { font-size: 2rem; }
}

@media (max-width: 767.98px) {
    .login-page { display: block; background: #fff; }
    .login-visual { height: 210px; }
    .visual-caption { bottom: 1.5rem; }
    .visual-caption h2 { margin-bottom: 0; font-size: 1.6rem; }
    .visual-caption p { display: none; }
    .login-panel { display: block; padding: 1.6rem 1.25rem 2.5rem; }
    .login-card { margin: 0 auto; }
    .login-brand { margin-bottom: 2.25rem; }
    .login-heading { margin-bottom: 1.5rem; }
    .login-heading h1 { font-size: 1.65rem; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .client-profile-grid { grid-template-columns: 1fr; }
    .form-section { grid-template-columns: 1fr; gap: 1.25rem; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .page-heading .btn { width: 100%; }
    .tracking-main { padding: 2.5rem 1rem; }
    .tracking-form { align-items: stretch; flex-wrap: wrap; }
    .tracking-form input { width: calc(100% - 3.5rem); flex: none; }
    .tracking-form .btn { width: 100%; }
    .portal-services { grid-template-columns: 1fr; gap: 0; }
    .portal-footer { align-items: center; flex-direction: column; gap: .35rem; }
    .client-filters { grid-template-columns: 1fr; }
    .client-search { grid-column: auto; }
    .client-filters .btn-filter { justify-content: center; }
    .form-grid, .profile-data { grid-template-columns: 1fr; }
    .related-item { grid-template-columns: 38px minmax(0, 1fr) auto; }
    .related-item .status-badge { display: none; }
    .form-span-2 { grid-column: auto; }
    .detail-toolbar { align-items: flex-start; flex-wrap: wrap; }
}

@media (max-width: 575.98px) {
    .global-loading-status { top: 10px; max-width: calc(100vw - 2rem); }
    .metric-grid { grid-template-columns: 1fr; }
    .app-content { padding: 1rem; }
    .app-topbar { padding: 0 .75rem; }
    .portal-header { width: calc(100% - 2rem); }
    .portal-header .brand-caption { max-width: 190px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
    .global-loading-bar { width: 100%; animation: none; }
}

/* Atención al cliente */
.atc-heading { align-items: center; }
.atc-heading-count { display: flex; min-width: 112px; min-height: 64px; padding: .7rem 1rem; align-items: baseline; justify-content: center; gap: .4rem; border-left: 3px solid var(--brand-orange); background: #fff; }
.atc-heading-count strong { color: var(--brand-purple); font-family: "Manrope", sans-serif; font-size: 1.65rem; }
.atc-heading-count span { color: var(--muted); font-size: .72rem; font-weight: 700; }
.import-center { display: grid; min-height: 76px; margin-bottom: 1rem; padding: .75rem 1rem; grid-template-columns: 42px minmax(0, 1fr) auto auto; align-items: center; gap: .85rem; border: 1px solid var(--line); border-left: 3px solid var(--brand-blue); border-radius: 7px; background: #fff; }
.import-center-icon { display: grid; width: 38px; height: 38px; color: var(--brand-blue); border-radius: 6px; background: #eaf6fb; place-items: center; font-size: 1rem; }
.import-center-copy { min-width: 0; }
.import-center-copy .eyebrow { margin-bottom: .18rem; font-size: .58rem; }
.import-center-copy strong, .import-center-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-center-copy strong { font-size: .76rem; }
.import-center-copy small { margin-top: .15rem; color: var(--muted); font-size: .64rem; }
.import-center-status { display: inline-flex; min-height: 30px; padding: .35rem .55rem; align-items: center; gap: .35rem; border-radius: 5px; font-size: .65rem; font-weight: 700; white-space: nowrap; }
.import-center-status.is-success { color: #0c624e; border: 1px solid #b9dfd3; background: #edf8f4; }
.import-center-status.has-errors { color: #8b3d0c; border: 1px solid #f2c6a9; background: #fff4ed; }
.import-center-actions { display: flex; align-items: center; gap: .45rem; }
.import-center-actions .btn-import-action { width: 128px; min-height: 40px; padding: .55rem .7rem; justify-content: center; gap: .45rem; font-size: .7rem; white-space: nowrap; }
.btn-observations { display: inline-flex; align-items: center; color: #8b3d0c; border: 1px solid #f2c6a9; background: #fff4ed; }
.btn-observations:hover, .btn-observations:focus { color: #713109; border-color: #e7a77d; background: #ffe9da; }
.import-modal-body { padding: 0; }
.import-type-tabs { display: grid; padding: .8rem 1.25rem 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; border-bottom: 1px solid var(--line); background: #f7f6f8; }
.import-type-tabs button { display: flex; min-height: 46px; padding: .65rem .8rem; align-items: center; justify-content: center; gap: .5rem; color: var(--muted); border: 0; border-bottom: 3px solid transparent; background: transparent; font-size: .75rem; font-weight: 700; }
.import-type-tabs button.active { color: var(--brand-purple); border-bottom-color: var(--brand-orange); background: #fff; }
.import-tab-content { padding: 1.25rem; }
.import-modal-form { display: grid; gap: 1.2rem; }
.import-file-heading { display: flex; align-items: center; gap: .8rem; }
.import-file-heading > i { display: grid; width: 42px; height: 42px; flex: 0 0 42px; color: var(--brand-purple); border-radius: 6px; background: rgba(77,20,140,.08); place-items: center; font-size: 1.1rem; }
.import-file-heading strong, .import-file-heading span { display: block; }
.import-file-heading strong { font-size: .82rem; }
.import-file-heading span { margin-top: .2rem; color: var(--muted); font-size: .68rem; }
.import-modal-form .fgc-file-control { min-height: 64px; padding: .7rem; border: 1px dashed #cfc8d5; border-radius: 6px; background: #faf9fb; }
.import-modal-actions { display: flex; padding-top: 1rem; justify-content: flex-end; gap: .5rem; border-top: 1px solid var(--line); }
.import-history-body { padding: 1.25rem; }
.prealert-results-table { min-width: 760px; }
.prealert-results-table td strong, .prealert-results-table td small { display: block; }
.prealert-results-table td small { margin-top: .15rem; color: var(--muted); font-size: .64rem; }
.import-type-label { display: inline-flex; align-items: center; gap: .4rem; color: var(--brand-purple); font-size: .68rem; font-weight: 700; white-space: nowrap; }
.prealert-error-summary { margin-top: 1rem; padding: .8rem 1rem; border-left: 3px solid var(--brand-orange); background: #fff7f2; }
.prealert-error-summary > strong { font-size: .73rem; }
.prealert-error-summary ul { display: grid; margin: .55rem 0 0; padding: 0; gap: .35rem; list-style: none; }
.prealert-error-summary li { color: #655961; font-size: .68rem; }
.prealert-error-summary li span { margin-right: .45rem; color: #8b3d0c; font-weight: 700; }
.fgc-file-control { position: relative; display: flex; min-width: 0; align-items: center; gap: .7rem; }
.fgc-file-control input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.fgc-file-name { min-width: 0; overflow: hidden; color: var(--muted); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.fgc-file-control .invalid-feedback { position: absolute; top: 100%; left: 0; }
.atc-filters { grid-template-columns: minmax(230px, 1fr) repeat(3, minmax(125px, .42fr)) minmax(270px, auto) auto; }
.atc-date-range { display: grid; grid-template-columns: repeat(2, minmax(125px, 1fr)); gap: .5rem; }
.atc-date-range label { position: relative; min-width: 0; margin: 0; }
.atc-date-range label span { position: absolute; z-index: 1; top: .27rem; left: .7rem; color: var(--muted); font-size: .55rem; font-weight: 700; pointer-events: none; }
.atc-date-range .form-control { min-height: 42px; padding: 1rem .6rem .15rem; border-color: #d6d2d9; border-radius: 6px; font-size: 16px; }
.atc-filter-actions { display: flex; align-items: center; justify-content: flex-end; gap: .35rem; }
.atc-panel { min-height: 420px; padding: 0; overflow: hidden; }
.atc-empty { min-height: 350px; }
.atc-table { min-width: 1040px; }
.awb-copy { color: var(--brand-purple) !important; }
.workflow-badge { display: inline-flex !important; min-height: 34px; padding: .35rem .55rem; align-items: center; gap: .45rem; color: #4a424f; border: 1px solid #ded8e2; border-radius: 6px; background: #f8f6f9; font-size: .67rem; font-weight: 700; }
.workflow-badge b { display: grid; min-width: 25px; height: 23px; padding: 0 .25rem; color: #fff; border-radius: 4px; background: var(--brand-purple); place-items: center; font-size: .62rem; }
.workflow-badge.state-4a { color: #0c624e; border-color: #b9dfd3; background: #edf8f4; }
.workflow-badge.state-4a b { background: var(--success); }
.workflow-badge.state-4b { color: #8b3d0c; border-color: #f2c6a9; background: #fff4ed; }
.workflow-badge.state-4b b { background: #b54d0b; }
.charge-badge { display: inline-grid !important; width: 38px; height: 30px; color: #075f8b; border: 1px solid #b8dced; border-radius: 5px; background: #eaf6fb; place-items: center; font-size: .68rem; font-weight: 800; }
.detail-back-row { display: flex; margin-bottom: 1rem; align-items: center; gap: 1rem; }
.detail-back { display: inline-flex; align-items: center; gap: .55rem; color: var(--brand-purple); font-size: .76rem; font-weight: 800; text-decoration: none; }
.shipment-header { display: flex; margin-bottom: 1rem; padding: 1.25rem 0; align-items: center; justify-content: space-between; gap: 1.5rem; border-bottom: 1px solid var(--line); }
.shipment-header h1 { margin: .35rem 0 .25rem; font-size: 2rem; font-weight: 800; }
.shipment-header p { margin: 0; color: var(--muted); }
.shipment-state-block { display: flex; align-items: center; gap: .65rem; }
.shipment-facts { display: grid; margin-bottom: 1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.shipment-facts > div { min-width: 0; padding: 1rem 1.15rem; border-right: 1px solid var(--line); }
.shipment-facts > div:last-child { border-right: 0; }
.shipment-facts span, .shipment-facts strong { display: block; overflow-wrap: anywhere; }
.shipment-facts span { margin-bottom: .3rem; color: var(--muted); font-size: .66rem; font-weight: 700; }
.shipment-facts strong { font-size: .82rem; }
.atc-notice { display: flex; margin-bottom: 1rem; padding: 1rem 1.15rem; align-items: flex-start; gap: .85rem; color: #075f8b; border-left: 3px solid var(--brand-blue); background: #eaf6fb; }
.atc-notice div { display: flex; flex-direction: column; gap: .2rem; }
.atc-notice strong { font-size: .82rem; }
.atc-notice span { color: #42687b; font-size: .72rem; line-height: 1.5; }
.atc-notice.is-terminal { color: #8b3d0c; border-color: var(--brand-orange); background: #fff3eb; }
.shipment-workspace { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .72fr); gap: 1rem; align-items: start; }
.shipment-main-column, .shipment-side-column { display: grid; min-width: 0; gap: 1rem; }
.shipment-action-panel, .shipment-log-panel, .shipment-client-panel, .shipment-history-panel { min-height: 0; }
.panel-heading-row { display: flex; margin-bottom: 1.1rem; align-items: center; justify-content: space-between; gap: 1rem; }
.panel-heading-row h2 { margin: .25rem 0 0; font-size: 1rem; font-weight: 800; }
.panel-heading-row > i { color: var(--brand-purple); font-size: 1.15rem; }
.panel-count { display: grid; min-width: 30px; height: 30px; padding: 0 .4rem; color: #fff; border-radius: 5px; background: var(--brand-purple); place-items: center; font-size: .68rem; font-weight: 800; }
.shipment-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.form-field { min-width: 0; }
.form-field.span-full { grid-column: 1 / -1; }
.form-field label { display: block; margin-bottom: .4rem; color: #3b3740; font-size: .72rem; font-weight: 700; }
.shipment-action-panel .form-control, .shipment-action-panel .form-select { min-height: 44px; border-color: #d6d2d9; border-radius: 6px; font-size: 16px; }
.shipment-action-panel textarea.form-control { min-height: 88px; resize: vertical; }
.shipment-action-panel .form-control:focus, .shipment-action-panel .form-select:focus { border-color: var(--brand-purple); box-shadow: 0 0 0 3px rgba(77,20,140,.08); }
.shipment-action-panel .form-actions { position: static; padding: 1rem 0 0; background: transparent; }
.shipment-client-association { border-top: 3px solid var(--brand-blue); }
.source-client-data { display: grid; margin-bottom: .85rem; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.source-client-data div { min-width: 0; padding: .7rem .8rem; border-left: 2px solid #b8dced; background: #f5fafc; }
.source-client-data span, .source-client-data strong { display: block; overflow-wrap: anywhere; }
.source-client-data span { margin-bottom: .2rem; color: var(--muted); font-size: .63rem; }
.source-client-data strong { font-size: .73rem; }
.shipment-client-search { display: grid; margin-bottom: .8rem; grid-template-columns: minmax(0, 1fr) auto auto; gap: .55rem; }
.shipment-client-search .client-search { min-height: 40px; }
.client-candidate-list { display: grid; max-height: 260px; overflow-y: auto; border-top: 1px solid var(--line); }
.associate-shipment-client { display: grid; min-width: 0; padding: .75rem 0; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .7rem; border-bottom: 1px solid var(--line); }
.associate-shipment-client strong, .associate-shipment-client small { display: block; overflow-wrap: anywhere; }
.associate-shipment-client strong { font-size: .74rem; }
.associate-shipment-client small { margin-top: .2rem; color: var(--muted); font-size: .64rem; }
.match-badge { display: inline-flex; padding: .3rem .45rem; align-items: center; gap: .3rem; color: #0c624e; border: 1px solid #b9dfd3; border-radius: 5px; background: #edf8f4; font-size: .62rem; font-weight: 700; }
.client-association-empty { display: flex; min-height: 80px; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .72rem; }
.authorization-panel { border-top: 3px solid var(--brand-orange); }
.authorization-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.authorization-choice label { min-width: 0; cursor: pointer; }
.authorization-choice input { position: absolute; opacity: 0; pointer-events: none; }
.authorization-choice span { display: grid; min-height: 96px; padding: .85rem; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .65rem; color: #49424e; border: 1px solid #d7d2da; border-radius: 6px; background: #fff; }
.authorization-choice i { grid-row: 1 / 3; color: var(--brand-purple); font-size: 1.15rem; }
.authorization-choice b { font-size: .76rem; }
.authorization-choice small { margin-top: .15rem; color: var(--muted); font-size: .67rem; line-height: 1.4; }
.authorization-choice input:checked + span { color: var(--brand-purple); border-color: var(--brand-purple); box-shadow: 0 0 0 2px rgba(77,20,140,.1); background: #faf7fc; }
.compact-empty { display: flex; min-height: 100px; align-items: center; justify-content: center; gap: .6rem; color: var(--muted); font-size: .74rem; }
.interaction-list article { display: grid; padding: 1rem 0; grid-template-columns: 34px minmax(0, 1fr); gap: .75rem; border-top: 1px solid #eceaed; }
.interaction-list article:first-child { padding-top: 0; border-top: 0; }
.interaction-marker { display: grid; width: 32px; height: 32px; color: var(--brand-blue); border-radius: 5px; background: #eaf6fb; place-items: center; }
.interaction-meta { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.interaction-meta strong { font-size: .73rem; }
.interaction-meta time, .interaction-list small { color: var(--muted); font-size: .66rem; }
.interaction-list p { margin: .35rem 0; color: #49434d; font-size: .76rem; line-height: 1.5; }
.shipment-data-list { margin: 0; }
.shipment-data-list div { padding: .7rem 0; border-top: 1px solid #eceaed; }
.shipment-data-list div:first-child { padding-top: 0; border-top: 0; }
.shipment-data-list dt { margin-bottom: .2rem; color: var(--muted); font-size: .64rem; }
.shipment-data-list dd { margin: 0; overflow-wrap: anywhere; font-size: .76rem; font-weight: 700; }
.state-timeline { position: relative; display: grid; margin: 0; padding: 0; list-style: none; }
.state-timeline::before { position: absolute; top: 12px; bottom: 12px; left: 14px; width: 1px; background: #d8d3dc; content: ""; }
.state-timeline li { position: relative; display: grid; padding-bottom: 1rem; grid-template-columns: 30px minmax(0, 1fr); gap: .7rem; }
.state-timeline li > span { z-index: 1; display: grid; width: 29px; height: 29px; color: #fff; border: 3px solid #fff; border-radius: 50%; background: var(--brand-purple); place-items: center; font-size: .55rem; font-weight: 800; }
.state-timeline strong, .state-timeline time, .state-timeline small { display: block; }
.state-timeline strong { font-size: .72rem; }
.state-timeline time, .state-timeline small { margin-top: .15rem; color: var(--muted); font-size: .63rem; }
.state-timeline p { margin: .35rem 0 0; color: #5d5661; font-size: .68rem; line-height: 1.4; }

@media (max-width: 1180px) {
    .atc-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .atc-filters .client-search { grid-column: span 2; }
    .atc-date-range { grid-column: span 2; }
    .shipment-workspace { grid-template-columns: minmax(0, 1.3fr) minmax(270px, .7fr); }
    .shipment-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .shipment-facts > div:nth-child(2) { border-right: 0; }
    .shipment-facts > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 900px) {
    .import-center { grid-template-columns: 42px minmax(0, 1fr) auto; }
    .import-center-status { grid-column: 2; justify-self: start; }
    .import-center-actions { grid-column: 3; grid-row: 1 / 3; }
    .atc-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .atc-filters .client-search { grid-column: 1 / -1; }
    .atc-date-range { grid-column: 1 / -1; }
    .shipment-workspace { grid-template-columns: 1fr; }
    .shipment-side-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .atc-heading { align-items: flex-end; }
    .atc-heading-count { min-width: 84px; min-height: 54px; padding: .55rem .7rem; }
    .atc-heading-count strong { font-size: 1.3rem; }
    .import-center { grid-template-columns: 36px minmax(0, 1fr); }
    .import-center-icon { width: 34px; height: 34px; }
    .import-center-status { grid-column: 1 / -1; }
    .import-center-actions { grid-column: 1 / -1; grid-row: auto; width: 100%; }
    .import-center-actions .btn-import-action { width: auto; min-width: 0; flex: 1; }
    .import-type-tabs { padding-right: .75rem; padding-left: .75rem; }
    .import-tab-content { padding: 1rem; }
    .fgc-file-control { align-items: flex-start; flex-direction: column; }
    .fgc-file-control .invalid-feedback { position: static; }
    .import-modal-actions { flex-direction: column-reverse; }
    .import-modal-actions .btn { width: 100%; }
    .atc-filters { grid-template-columns: 1fr; }
    .atc-filters .client-search { grid-column: auto; }
    .atc-date-range { grid-column: auto; }
    .atc-filter-actions .btn-filter { flex: 1; }
    .shipment-header { align-items: flex-start; flex-direction: column; }
    .shipment-state-block { width: 100%; justify-content: space-between; }
    .shipment-header h1 { font-size: 1.55rem; }
    .shipment-facts, .shipment-form-grid, .authorization-choice, .shipment-side-column { grid-template-columns: 1fr; }
    .source-client-data, .shipment-client-search { grid-template-columns: 1fr; }
    .associate-shipment-client { grid-template-columns: minmax(0, 1fr) auto; }
    .associate-shipment-client .match-badge { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
    .shipment-facts > div { border-right: 0; border-bottom: 1px solid var(--line); }
    .shipment-facts > div:last-child { border-bottom: 0; }
    .form-field.span-full { grid-column: auto; }
    .interaction-meta { align-items: flex-start; flex-direction: column; gap: .15rem; }
}