:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --text: #1d2433;
    --muted: #6b7280;
    --line: #d5dbe5;
    --line-strong: #a9b4c4;
    --accent: #c8102e;
    --accent-dark: #9b0c23;
    --accent-soft: #fbe3e8;
    --radius-md: 12px;
    --radius-lg: 18px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text);
    background: var(--bg);
}

body.theme-claro {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --text: #2b1116;
    --muted: #7f4a53;
    --line: #e9b2be;
    --line-strong: #cf4d67;
    --accent: #c8102e;
    --accent-dark: #9b0c23;
    --accent-soft: #fbe3e8;
}

body.theme-win {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --text: #2f1f12;
    --muted: #7b5a3d;
    --line: #ebb983;
    --line-strong: #d9801d;
    --accent: #f57c00;
    --accent-dark: #c55e00;
    --accent-soft: #ffe7cc;
}

body.theme-zaaz {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --text: #2c1f46;
    --muted: #6f5a95;
    --line: #d8c6f2;
    --line-strong: #9a76d8;
    --accent: #7e57c2;
    --accent-dark: #5e35b1;
    --accent-soft: #efe7fb;
}

body.theme-admin {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --text: #10233d;
    --muted: #4f6890;
    --line: #a9c8ef;
    --line-strong: #3f81cf;
    --accent: #1565d8;
    --accent-dark: #0f4ca8;
    --accent-soft: #dcebff;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

h1,
h2,
h3,
th,
.form-block legend {
    font-family: 'Space Grotesk', sans-serif;
}

.eyebrow,
.brand-kicker,
.section-heading p,
.stat-card span,
.page-footer small,
.topbar-subtitle {
    color: var(--muted);
}

/* Login */
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.login-card {
    width: min(540px, 100%);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.brand-logo {
    width: 52px;
    height: 52px;
}

.login-card h1 {
    margin: 0.2rem 0;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
}

.login-error {
    margin: 0.8rem 0;
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    background: var(--accent-soft);
    border: 1px solid var(--line-strong);
    color: var(--accent-dark);
}

.field-message {
    display: inline-block;
    margin-top: 6px;
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
    font-size: 0.85rem;
    opacity: 0;
    transform: translateY(-4px);
    animation: field-message-enter 0.28s ease forwards;
}

@keyframes field-message-enter {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.field-message.is-error {
    background: #fdecea;
    border: 1px solid #f5c2c0;
    color: #b3261e;
}

.field-message.is-warning {
    background: #fff4e0;
    border: 1px solid #f0d090;
    color: #8a5a00;
}

.field-message.is-success {
    background: #e6f6ea;
    border: 1px solid #a8ddb5;
    color: #1e7e34;
}

.field-message-compact-button {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.32rem 0.65rem;
    font-size: 0.8rem;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid var(--line-strong);
    color: var(--accent-dark);
    cursor: pointer;
    font-weight: 600;
    opacity: 0;
    transform: scale(0.92);
    animation: field-message-enter 0.28s ease forwards;
}

.field-message-compact-button:hover {
    background: var(--accent-soft);
}

input[readonly].is-locked,
input:disabled.is-locked,
select:disabled.is-locked {
    background: #f1f2f4;
    color: #7c828a;
    border-color: #d8dade;
    cursor: not-allowed;
}

.form-actions button:disabled {
    background: #c7cad0;
    border-color: #c7cad0;
    color: #ffffff;
    cursor: not-allowed;
    opacity: 0.85;
}

.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    color: var(--accent-dark);
    cursor: pointer;
    user-select: none;
}

.toggle-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    background: #d8dade;
    border-radius: 999px;
    transition: background 0.2s ease;
}

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-track {
    background: var(--accent);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-track .toggle-thumb {
    transform: translateX(18px);
}

.toggle-label {
    font-weight: 600;
}

.sale-success-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 300;
    animation: sale-toast-enter 0.35s ease;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.sale-success-toast.is-hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.sale-success-card {
    min-width: 260px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid var(--line-strong);
    box-shadow: 0 18px 40px rgba(17, 24, 39, 0.16);
}

.sale-success-ring {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    border-top-color: transparent;
    animation: sale-ring-spin 0.7s linear 1;
}

.sale-success-check {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-weight: 800;
}

@keyframes sale-toast-enter {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes sale-ring-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes form-hint-pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.04);
    }
    100% {
        transform: scale(1);
    }
}

/* Layout */
.app-shell {
    min-height: 100vh;
    position: relative;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 78px;
    background: var(--accent);
    border-right: 1px solid rgba(255, 255, 255, 0.22);
    padding: 6px 10px;
    height: 100vh;
    z-index: 100;
    transition: all 0.5s ease;
}

.sidebar.open {
    width: 250px;
}

.agent-spotlight {
    margin: 6px 0 10px;
    padding: 0;
    border-radius: 12px;
    background: transparent;
    border: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.sidebar.open .agent-spotlight {
    margin: 2px 6px 10px;
    padding: 10px 8px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.24);
}

.agent-spotlight-photo {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.sidebar.open .agent-spotlight-photo {
    width: 120px;
    height: 120px;
}

.agent-spotlight-photo-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
    border: 2px solid rgba(255, 255, 255, 0.9);
}

.sidebar.open .agent-spotlight-photo-fallback {
    font-size: 34px;
}

.agent-spotlight-name {
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sidebar.open .agent-spotlight-name {
    opacity: 1;
    max-height: 22px;
}

.agent-spotlight-meta {
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sidebar.open .agent-spotlight-meta {
    opacity: 1;
    max-height: 22px;
}

.logo_details {
    height: 66px;
    display: flex;
    align-items: center;
}

.logo_details i {
    font-size: 28px;
    color: #ffffff;
    min-width: 50px;
    text-align: center;
}

.logo-image {
    width: 36px;
    height: 36px;
    object-fit: contain;
    margin: 0 8px 0 6px;
    filter: brightness(0) invert(1);
}

.logo_details .logo_name {
    color: #ffffff;
    font-size: 21px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.sidebar.open .logo_details .logo_name {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-links {
    margin: 0;
    padding: 0;
    height: calc(100% - 66px);
    list-style: none;
    position: relative;
}

.sidebar-links li a {
    position: relative;
    height: 50px;
    margin: 8px 0;
    margin-right: -10px;
    list-style: none;
    display: flex;
    align-items: center;
    border-radius: 30px 0 0 30px;
    color: #ffffff;
    text-decoration: none;
    transition: all 0.4s ease;
}

.sidebar-links li a:hover,
.sidebar-links li a.active {
    background: #ffffff;
    color: var(--accent-dark);
}

.sidebar-links li a:hover i,
.sidebar-links li a:hover .links_name,
.sidebar-links li a.active i,
.sidebar-links li a.active .links_name {
    color: var(--accent-dark);
}

.sidebar-links li a i {
    min-width: 50px;
    text-align: center;
    font-size: 24px;
}

.sidebar-links li a .links_name {
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s ease;
}

.sidebar.open .sidebar-links li a .links_name {
    opacity: 1;
    pointer-events: auto;
}

.toggle {
    display: flex;
    align-items: center;
}

.toggle #btn {
    font-size: 30px;
    cursor: pointer;
    color: var(--text);
    line-height: 1;
}

.app-main {
    background: #ffffff;
    margin-left: 78px;
    padding: 1rem 1.2rem 1.2rem;
    transition: all 0.5s ease;
}

.sidebar.open ~ .app-main {
    margin-left: 250px;
}

@media (max-width: 960px) {
    .app-main {
        margin-left: 0;
        padding: 0.8rem 0.9rem 1rem;
    }
}

.page-topbar {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    position: relative;
    z-index: 1200;
}

.page-title {
    margin: 0;
    font-size: 1.12rem;
    color: var(--text);
}

.topbar-left,
.topbar-subtitle {
    display: none;
}

.search-wrapper {
    display: none;
}

.search-icon {
    display: none;
}

.search-wrapper input {
    display: none;
}

.topbar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
}

.page-campaign {
    background: var(--accent-soft);
    color: var(--accent-dark);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
    font-weight: 600;
    font-size: 0.88rem;
    transition: transform 0.35s ease, opacity 0.35s ease;
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #ffffff;
    border: 1px solid var(--accent-dark);
    font-weight: 700;
}

.topbar-avatar-image {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    object-fit: cover;
}

.topbar-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    border: 2px solid var(--line-strong);
}

.profile-menu-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-menu-toggle {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
}

.profile-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 170px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: #ffffff;
    box-shadow: 0 14px 30px rgba(12, 21, 36, 0.15);
    padding: 6px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: all 0.2s ease;
    z-index: 3000;
}

.topbar-advisor-name {
    display: inline-block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    white-space: nowrap;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateX(14px);
    transition: max-width 0.35s ease, opacity 0.25s ease, transform 0.35s ease;
}

.sidebar:not(.open) ~ .app-main .topbar-advisor-name {
    max-width: 190px;
    opacity: 1;
    transform: translateX(0);
}

.sidebar:not(.open) ~ .app-main .page-campaign {
    transform: translateX(-10px);
}

.profile-menu-wrap.open .profile-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    padding: 8px 10px;
    color: var(--text);
    font-weight: 600;
}

.profile-menu-item:hover {
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.page-shell {
    margin: 0 auto;
    padding: 1rem 0 0;
    min-height: calc(100vh - 100px);
}

.card-boxes {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.kpi-box {
    border: 0;
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    background: #ffffff;
    padding: 1.1rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
    animation: cardSlideUp 0.45s ease both;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

.kpi-box:nth-child(2) {
    animation-delay: 0.05s;
}

.kpi-box:nth-child(3) {
    animation-delay: 0.1s;
}

.kpi-box:nth-child(4) {
    animation-delay: 0.15s;
}

.kpi-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--accent-dark);
}

.kpi-label {
    margin: 0.3rem 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #4f6890;
    color: #ffffff;
    border: 0;
    flex-shrink: 0;
}

.kpi-icon i {
    font-size: 1.5rem;
}

.details-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
}

.home-trio-grid {
    grid-template-columns: 1fr 1.15fr;
    align-items: stretch;
}

.home-trio-secondary {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.home-trio-secondary .chart-card,
.home-trio-secondary .productivity-card {
    flex: 1;
}

.productivity-card {
    max-width: 100%;
    min-width: 0;
}

.details-card {
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: #ffffff;
    padding: 1rem;
    animation: cardSlideUp 0.5s ease both;
}

.customers-card {
    animation-delay: 0.08s;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 220px);
}

.customer-list-scroll {
    overflow-y: auto;
    padding-right: 0.35rem;
    flex: 1;
}

.chart-card {
    animation-delay: 0.04s;
}

.productivity-chart {
    margin-top: 0.8rem;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 150px;
    padding: 0.6rem 0.6rem 0;
    background: linear-gradient(180deg, #ffffff 0%, #f3f4f6 100%);
}

.productivity-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 3px;
}

.bar-value {
    font-size: 10px;
    font-weight: 700;
    color: #1f2937;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.productivity-bar-wrap:hover .bar-value {
    opacity: 1;
}

.productivity-bar {
    width: 100%;
    max-width: 28px;
    min-height: 4px;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(180deg, #4f6890 0%, #374155 100%);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease, filter 0.2s ease;
    cursor: pointer;
}

.productivity-bar:hover {
    transform: translateY(-3px);
    filter: brightness(1.12);
}

.chart-labels {
    display: flex;
    gap: 6px;
    padding: 5px 0.6rem;
    background: var(--accent-soft);
    border-top: 1px solid var(--line-strong);
}

.chart-labels span {
    flex: 1;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-dark);
}

.mini-separator {
    height: 1px;
    background: var(--line-strong);
    margin: 1rem 0;
}

.subsection-title {
    margin: 0 0 0.7rem;
    font-size: 1.05rem;
}

.priority-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.22rem 0.58rem;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid var(--line-strong);
}

.priority-high {
    background: #ffe4e8;
    color: #b4233a;
}

.priority-medium {
    background: #fff0dc;
    color: #b45404;
}

.priority-low {
    background: #e8f8ef;
    color: #127a4a;
}

.avatar-group {
    display: flex;
    align-items: center;
}

.table-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    margin-left: -8px;
}

.table-avatar:first-child {
    margin-left: 0;
}

.customer-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.customer-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 0.55rem;
    transition: transform 0.2s ease, border-color 0.2s ease;
    background: #ffffff;
}

.customer-item:hover {
    transform: translateY(-1px);
    border-color: var(--customer-accent, var(--accent));
    box-shadow: 0 8px 20px color-mix(in srgb, var(--customer-accent, var(--accent)) 18%, transparent);
}

.customer-meta {
    flex: 1;
    min-width: 0;
}

.customer-meta strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-meta small {
    color: var(--muted);
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.customer-item .status-badge {
    font-size: 0.7rem;
    padding: 0.18rem 0.5rem;
    flex-shrink: 0;
}

.customer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--customer-accent, var(--accent));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--customer-accent, var(--accent)) 18%, #ffffff);
}

.customer-item strong {
    display: block;
}

.customer-item small {
    color: var(--muted);
}

.home-summary-heading {
    margin-bottom: 1.55rem;
}

.home-summary-heading h2 {
    margin: 0;
}

.home-summary-heading p {
    margin-top: 0.35rem;
}

.hero-panel,
.content-grid,
.stats-grid {
    display: grid;
    gap: 1rem;
}

.hero-panel {
    grid-template-columns: 2fr 1fr;
}

.hero-copy,
.hero-card,
.stat-card,
.form-panel,
.coverage-card,
.script-card,
.table-panel {
    background: linear-gradient(180deg, #ffffff 0%, var(--accent-soft) 100%);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    box-shadow: 0 14px 34px color-mix(in srgb, var(--accent) 12%, transparent);
}

.page-shell > section,
.page-shell > aside {
    animation: cardSlideUp 0.45s ease both;
}

.page-shell > section:nth-child(2),
.page-shell > aside:nth-child(2) {
    animation-delay: 0.06s;
}

.page-shell > section:nth-child(3),
.page-shell > aside:nth-child(3) {
    animation-delay: 0.12s;
}

.hero-copy,
.form-panel,
.table-panel,
.coverage-card,
.script-card,
.hero-card,
.stat-card {
    padding: 1rem;
}

.hero-copy h1 {
    margin: 0.5rem 0 0.8rem;
    font-size: clamp(1.6rem, 3vw, 2.35rem);
    line-height: 1.1;
    max-width: 14ch;
}

.hero-actions,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 1rem;
}

.form-completion-hint {
    display: none;
    align-items: center;
    padding: 0.66rem 0.9rem;
    border-radius: 10px;
    background: var(--accent-soft);
    border: 1px solid var(--line-strong);
    color: var(--accent-dark);
    font-weight: 600;
}

.form-completion-hint.is-visible {
    display: inline-flex;
}

.form-completion-hint.is-pulsing {
    animation: form-hint-pulse 0.55s ease;
}

.primary-action,
.secondary-action,
.form-actions button,
.search-bar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    padding: 0.66rem 1rem;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
}

.primary-action,
.form-actions button,
.search-bar button {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent-dark);
}

.primary-action:hover,
.form-actions button:hover,
.search-bar button:hover {
    background: var(--accent-dark);
}

.secondary-action,
.ghost-button {
    background: #ffffff;
    border-color: var(--line-strong);
    color: var(--accent-dark);
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stats-grid.three-cols {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 1.5rem;
}

.stat-card strong {
    display: block;
    margin: 0.3rem 0;
    font-size: 1.35rem;
}

.content-grid {
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
}

.section-heading.inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.sales-form {
    display: grid;
    gap: 0.9rem;
}

.form-block {
    border: 1px solid var(--line-strong);
    background: linear-gradient(180deg, #ffffff 0%, color-mix(in srgb, var(--accent-soft) 76%, #ffffff) 100%);
    border-radius: 14px;
    padding: 0.9rem;
    margin: 0;
}

.form-block legend {
    color: var(--accent);
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    line-height: 1.65;
    border-bottom: 2px solid var(--accent);
    padding: 0 0.2rem 0.15rem;
}

.field-group {
    display: grid;
    gap: 0.8rem;
}

.field-group.single {
    grid-template-columns: 1fr;
}

.field-group.double {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-group.triple {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-group.quad {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field-hint {
    font-size: 0.8rem;
    color: var(--muted);
}

.nested-grid {
    align-items: end;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-weight: 500;
    line-height: 1.45;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: #fff;
    padding: 0.72rem 0.8rem;
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--accent-soft);
    border-color: var(--accent);
}

input[type="file"] {
    padding: 0.55rem 0.8rem;
    background: #fff;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    margin-right: 0.8rem;
    padding: 0.5rem 1rem;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

input[type="file"]::file-selector-button:hover {
    background: var(--accent-dark);
}

.search-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.6rem;
    margin-bottom: 0.9rem;
}

.history-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.25rem;
    align-items: center;
}

.history-controls .search-bar {
    flex: 1;
    margin-bottom: 0;
}

.backoffice-search-bar {
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.7fr) minmax(20px, 0.5fr) auto auto auto auto;
    /* align-items: start; */
}

.backoffice-search-bar > input,
.backoffice-search-bar > select,
.backoffice-search-bar .advisor-autocomplete input {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 0.78rem 0.9rem;
    background: #ffffff;
    color: var(--text);
}

.advisor-autocomplete {
    position: relative;
}

.advisor-autocomplete-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    box-shadow: 0 18px 35px rgba(17, 24, 39, 0.16);
    overflow: hidden;
    z-index: 20;
}

.advisor-autocomplete-list.open {
    display: flex;
}

.advisor-suggestion-item {
    border: 0;
    border-bottom: 1px solid #edf0f5;
    background: #ffffff;
    text-align: left;
    padding: 0.8rem 0.9rem;
    cursor: pointer;
    color: var(--text);
}

.advisor-suggestion-item:last-child {
    border-bottom: 0;
}

.advisor-suggestion-item:hover {
    background: var(--accent-soft);
}

.history-controls .filter-toggle,
.history-controls .clear-filters {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0.66rem 1rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.history-controls .filter-toggle {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent-dark);
}

.history-controls .filter-toggle:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

.history-controls .clear-filters {
    background: var(--surface);
    color: var(--accent-dark);
    border-color: var(--line-strong);
}

.history-controls .clear-filters:hover {
    background: #f4f7fb;
    color: var(--accent-dark);
}

.filter-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    display: grid;
    place-items: start center;
    padding-top: 2.5rem;
    opacity: 0;
    pointer-events: none;
    z-index: 2000;
    transition: opacity 0.3s ease;
}

.filter-panel.open {
    opacity: 1;
    pointer-events: auto;
}

.filter-modal {
    background: linear-gradient(180deg, #ffffff 0%, var(--accent-soft) 100%);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 95%;
    max-width: 480px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 0;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    flex-shrink: 0;
}

.filter-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.filter-close {
    background: rgba(255, 255, 255, 0.18);
    border: 2px solid rgba(255, 255, 255, 0.45);
    font-size: 1.5rem;
    color: #ffffff;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    font-weight: bold;
    line-height: 1;
}

.filter-close:hover {
    background: rgba(255, 255, 255, 0.32);
    color: #ffffff;
    transform: rotate(90deg);
}

.filter-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.3rem 1.5rem;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

.filter-group input[type="date"],
.filter-group select {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--surface-2);
    transition: border-color 0.2s ease;
}

.filter-group input[type="date"]:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-group input[type="date"]:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.filter-date-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    align-items: end;
}

.filter-date-section input[type="date"] {
    margin: 0;
    grid-column: span 1;
}

.filter-date-section .filter-date-range {
    grid-column: 1 / -1;
    margin: 0.3rem 0;
}

.filter-date-range {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
}

.filter-date-range input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

.filter-date-range label {
    margin: 0;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}

.filter-footer {
    padding: 1.2rem 1.5rem;
    border-top: 1px solid var(--line-strong);
    background: transparent;
    flex-shrink: 0;
}

.filter-apply {
    width: 100%;
    background: var(--accent);
    color: #ffffff;
    border: 2px solid var(--accent-dark);
    border-radius: 8px;
    padding: 0.75rem 1.2rem;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}

.filter-apply:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(200, 16, 46, 0.2);
}

.applied-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    min-height: 24px;
}

.applied-filters:empty {
    display: none;
}

.applied-filters .filter-tag {
    background: #e5e7eb;
    color: #1f2937;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.history-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: calc(100vh - 140px);
    padding: 1rem;
    margin: 0;
    gap: 0.6rem;
}

.history-panel > .section-heading {
    margin-bottom: 0.4rem;
}

.history-panel,
.history-panel.table-panel,
.productivity-card.table-panel {
    background: #ffffff;
    box-shadow: none;
}

.history-view-button {
    min-width: 82px;
}

.history-detail-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    place-items: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 2100;
}

.history-detail-modal.open {
    display: grid;
    opacity: 1;
    pointer-events: auto;
}

body.history-detail-open {
    overflow: hidden;
}

.history-detail-card {
    width: min(860px, 100%);
    max-height: 88vh;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, var(--accent-soft) 100%);
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(17, 24, 39, 0.28);
    animation: cardSlideUp 0.22s ease;
}

.backoffice-detail-card {
    width: min(1180px, 100%);
}

.history-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.15rem;
    border-bottom: 0;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
}

.history-detail-header h3 {
    margin: 0;
    color: #ffffff;
}

.history-detail-close {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
}

.history-detail-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
    padding: 1rem 1.15rem 1.15rem;
    max-height: calc(88vh - 66px);
    overflow-y: auto;
}

.history-detail-form-body {
    display: block;
    max-height: calc(88vh - 66px);
    overflow-y: auto;
}

.backoffice-save-error {
    margin: 1rem 1.15rem 0;
}

.backoffice-form-actions {
    padding: 0 1rem 1rem;
}

.history-detail-item {
    display: grid;
    gap: 0.3rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
}

.history-detail-item strong {
    font-size: 0.82rem;
    color: var(--muted);
    text-transform: uppercase;
}

.history-detail-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 0.85rem 1.15rem 0;
}

.pdf-viewer-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    place-items: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 2200;
}

.pdf-viewer-modal.open {
    display: grid;
    opacity: 1;
    pointer-events: auto;
}

.pdf-viewer-card {
    width: min(900px, 100%);
    height: min(90vh, 900px);
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(17, 24, 39, 0.28);
}

.pdf-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.15rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
}

.pdf-viewer-header h3 {
    margin: 0;
    color: #ffffff;
}

.pdf-viewer-frame {
    flex: 1;
    border: 0;
    width: 100%;
}

.profile-card {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.6rem;
}

.profile-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    margin-top: 1.2rem;
    align-items: start;
}

.profile-photo-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #ffffff 0%, var(--accent-soft) 100%);
}

.profile-photo-frame {
    width: 168px;
    height: 168px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--accent);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--accent) 24%, transparent);
    background: #ffffff;
    flex-shrink: 0;
}

.profile-photo-large {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-photo-fallback {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    color: #ffffff;
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
}

.profile-photo-form {
    width: 100%;
}

.profile-photo-label {
    cursor: pointer;
    width: 100%;
    justify-content: center;
    gap: 0.4rem;
}

.profile-info-block {
    display: grid;
    gap: 0.85rem;
    align-content: start;
}

.profile-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.95);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.profile-field:hover {
    border-color: var(--accent);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 12%, transparent);
}

.profile-field-label {
    font-size: 0.78rem;
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.profile-field strong {
    font-size: 1.02rem;
}

.profile-password-trigger {
    justify-self: start;
    margin-top: 0.4rem;
    gap: 0.4rem;
}

.profile-updated-at {
    margin: 0.4rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
    font-style: italic;
}

.profile-alert {
    margin: 0.8rem 0;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    font-weight: 600;
}

.profile-alert-success {
    background: #e8f8ef;
    color: #127a4a;
    border: 1px solid #b7e9cd;
}

.profile-alert-error {
    background: #ffe4e8;
    color: #b4233a;
    border: 1px solid #f5b7c1;
}

.password-modal-card {
    width: min(440px, 100%);
}

.password-modal-card .history-detail-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
}

.profile-password-form {
    display: grid;
    gap: 1.1rem;
    padding: 1.3rem 1.4rem 1.4rem;
}

.profile-password-form label {
    gap: 0.5rem;
    font-size: 0.88rem;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.password-input-wrap {
    position: relative;
    display: flex;
}

.password-input-wrap input {
    width: 100%;
    padding-right: 2.6rem;
}

.password-eye-toggle {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem;
    border-radius: 8px;
}

.password-eye-toggle:hover {
    color: var(--accent-dark);
    background: var(--accent-soft);
}

.profile-password-form .form-actions {
    margin-top: 0.2rem;
}

@media (max-width: 650px) {
    .profile-layout {
        grid-template-columns: 1fr;
    }

    .profile-photo-block {
        max-width: 260px;
        margin: 0 auto;
    }
}

.history-detail-item span {
    word-break: break-word;
}

.history-panel .table-panel {
    flex: 1;
}

.table-wrap {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    margin-bottom: 0;
    min-height: 0;
    margin-top: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    text-align: left;
    border-bottom: 1px solid var(--line-strong);
    padding: 0.5rem 0.65rem;
    font-size: 0.9rem;
}

thead th {
    color: #ffffff;
    font-size: 0.9rem;
    background: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

thead th:first-child {
    border-top-left-radius: 10px;
}

thead th:last-child {
    border-top-right-radius: 10px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    background: var(--accent-soft);
    color: var(--accent-dark);
    border: 1px solid var(--line-strong);
    font-weight: 600;
}

.status-badge.status-validation {
    background: #fff4cc;
    color: #8a6a00;
    border-color: #e9cc63;
}

.status-badge.status-approved {
    background: #e6f7ec;
    color: #1f7a45;
    border-color: #a8ddb9;
}

.status-badge.status-rejected {
    background: #fde7ea;
    color: #b4233a;
    border-color: #f2b2bc;
}

.status-badge.status-progress {
    background: #e8f0ff;
    color: #215fc0;
    border-color: #b7cdf8;
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background: var(--accent-soft);
}

@keyframes cardSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-footer {
    margin-top: 0;
    padding: 0;
}

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

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats-grid.three-cols {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .page-topbar {
        grid-template-columns: auto 1fr;
    }

    .topbar-right {
        justify-content: flex-end;
    }
}

@media (max-width: 960px) {
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--accent-dark);
        transition: none;
    }

    .app-main {
        margin-left: 0;
    }

    .sidebar-links li a .links_name,
    .logo_details .logo_name {
        opacity: 1;
        pointer-events: auto;
    }

    .agent-spotlight-meta {
        opacity: 1;
        max-height: 22px;
    }

    .agent-spotlight-name {
        opacity: 1;
        max-height: 22px;
    }

    .hero-panel,
    .card-boxes,
    .details-grid,
    .home-trio-grid,
    .content-grid,
    .stats-grid,
    .stats-grid.three-cols {
        grid-template-columns: 1fr;
    }

    .customers-card {
        max-height: 480px;
    }

    .field-group.triple {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sidebar.open ~ .app-main {
        margin-left: 0;
    }
}

@media (max-width: 680px) {
    .app-main {
        padding: 0.8rem 0.7rem 0;
    }

    .section-heading.inline {
        flex-direction: column;
        align-items: flex-start;
    }

    .field-group.double,
    .field-group.triple,
    .search-bar {
        grid-template-columns: 1fr;
    }

    .form-block {
        padding: 0.75rem;
    }

    table {
        min-width: 620px;
    }

    .filter-modal {
        width: 92%;
        max-width: 95vw;
    }

    .filter-date-section {
        grid-template-columns: 1fr;
    }

    .filter-date-section .filter-date-range {
        grid-column: 1;
    }

    .history-controls {
        flex-direction: column;
        gap: 0.5rem;
    }

    .history-controls .search-bar {
        flex: 1;
    }

    .filter-toggle,
    .clear-filters {
        width: 100%;
        justify-content: center;
    }

    th,
    td {
        padding: 0.4rem 0.5rem;
        font-size: 0.85rem;
    }

    .status-badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
}
