:root {
    --bg: #f5f6fa;
    --card-bg: #ffffff;
    --primary: #2563eb;
    --primary-soft: #eff3ff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --danger: #b91c1c;
    --accent: #16a34a;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 30%),
        radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.1), transparent 34%),
        linear-gradient(180deg, #eef4ff 0%, #f7faff 48%, #f5f7fc 100%);
    color: var(--text-main);
}
header {
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 64, 175, 0.88)),
        linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0));
    color: white;
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
    border-bottom: 1px solid rgba(191, 219, 254, 0.16);
}

.customer-sync-banner {
    margin: 16px 32px 0;
    padding: 14px 18px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.98), rgba(219, 234, 254, 0.94));
    border: 1px solid rgba(147, 197, 253, 0.28);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.customer-sync-banner[hidden] {
    display: none;
}

.customer-sync-banner.is-success {
    background: linear-gradient(180deg, rgba(240, 253, 244, 0.98), rgba(220, 252, 231, 0.94));
    border-color: rgba(34, 197, 94, 0.22);
}

.customer-sync-banner.is-error {
    background: linear-gradient(180deg, rgba(254, 242, 242, 0.98), rgba(254, 226, 226, 0.94));
    border-color: rgba(248, 113, 113, 0.22);
}

.customer-sync-banner-title {
    font-size: 0.96rem;
    font-weight: 800;
    color: #111827;
}

.customer-sync-banner-copy {
    margin-top: 4px;
    font-size: 0.9rem;
    color: #475569;
}
.logo { font-weight: 600; font-size: 1.2rem; letter-spacing: 0.04em; }
.logo span { color: #93c5fd; }
.header-right { display: flex; align-items: center; gap: 12px; }
.user-info {
    font-size: 0.85rem;
    color: #dbeafe;
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    min-height: 32px;
    min-width: 112px;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: #1e293b;
    border: 1px solid rgba(191, 219, 254, 0.3);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
    font-weight: 700;
    text-decoration: none;
}
.header-logout::before {
    content: "↪";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: rgba(219, 234, 254, 0.9);
    color: #1d4ed8;
    font-size: 0.78rem;
    line-height: 1;
}
.header-logout:hover {
    background: #ffffff;
    color: #0f172a;
    transform: translateY(-1px);
}
.header-add-customer {
    text-decoration: none;
    min-height: 32px;
    min-width: 112px;
    justify-content: center;
}
.header-add-customer:hover,
.header-add-customer:focus,
.header-add-customer:visited {
    text-decoration: none;
}
main {
    padding: 28px 32px 40px;
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 24px;
}
@media (max-width: 900px) {
    main { grid-template-columns: 1fr; padding: 16px; }
    .crm-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .crm-chart-grid { grid-template-columns: 1fr; }
}
.card {
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248, 250, 255, 0.94));
    border-radius: 24px;
    padding: 20px 22px;
    box-shadow: 0 24px 60px rgba(15,23,42,0.10);
    border: 1px solid rgba(191, 219, 254, 0.45);
    backdrop-filter: blur(12px);
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title { font-weight: 800; font-size: 1.08rem; letter-spacing: -0.02em; }
.card-subtitle { font-size: 0.84rem; color: #64748b; }

.search-bar { display: flex; gap: 8px; margin-top: 8px; }
.search-bar input[type="text"]{
    flex: 1;
    padding: 11px 14px;
    border-radius: 14px;
    border: 1px solid rgba(191, 219, 254, 0.6);
    font-size: 0.9rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.94));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

/* Buttons */
.btn {
    border: none;
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: white;
    transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.08s ease;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}
.btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(37, 99, 235, 0.2);
}
.btn-secondary { background: linear-gradient(180deg, #eff6ff, #dbeafe); color: var(--primary); }
.btn-secondary:hover { background: #dbeafe; }
.btn-ghost { background: transparent; color: var(--text-muted); box-shadow: none; }
.btn-ghost:hover { background: #f3f4f6; color: var(--text-main); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #991b1b; }
.btn-accent { background: var(--accent); }
.btn-accent:hover { background: #15803d; }
.link-btn { text-decoration: none; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 0.85rem; }
th, td { padding: 10px 8px; border-bottom: 1px solid rgba(226, 232, 240, 0.9); text-align: left; vertical-align: middle; }
th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: rgba(248, 250, 252, 0.88);
}
tr:hover td { background: rgba(239, 246, 255, 0.62); }

.pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.98), rgba(219, 234, 254, 0.9));
    color: #1d4ed8;
    border: 1px solid rgba(191, 219, 254, 0.7);
}
.pill-inline { margin-right: 4px; margin-bottom: 4px; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.98), rgba(219, 234, 254, 0.9));
    color: var(--primary);
    border: 1px solid rgba(191, 219, 254, 0.72);
}

.muted { color: var(--text-muted); font-size: 0.8rem; }
.no-results { padding: 16px; text-align: center; font-size: 0.9rem; color: var(--text-muted); }
.table-actions { display: flex; align-items: center; gap: 6px; }
.scroll-table { max-height: 420px; overflow: auto; border-radius: 18px; border: 1px solid rgba(191, 219, 254, 0.45); background: rgba(255,255,255,0.72); }
.footer-note { margin-top: 10px; font-size: 0.75rem; color: var(--text-muted); }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }

.crm-analytics {
    margin-top: 22px;
    padding: 20px;
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, rgba(147, 197, 253, 0.14), transparent 26%),
        linear-gradient(180deg, rgba(241, 245, 255, 0.98), rgba(231, 240, 255, 0.92));
    color: #0f172a;
    border: 1px solid rgba(191, 219, 254, 0.56);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.crm-analytics-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.crm-analytics-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.crm-analytics-subtitle {
    margin-top: 6px;
    color: #64748b;
    font-size: 0.86rem;
    line-height: 1.55;
}

.crm-analytics-chip {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(191, 219, 254, 0.58);
    color: #2563eb;
    font-size: 0.73rem;
    font-weight: 700;
}

.crm-kpi-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.crm-kpi-card {
    padding: 16px 16px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(191, 219, 254, 0.42);
    backdrop-filter: blur(10px);
}

.crm-kpi-label {
    color: #64748b;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
}

.crm-kpi-value {
    margin-top: 10px;
    font-size: 1.75rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    color: #0f172a;
}

.crm-kpi-trend {
    margin-top: 8px;
    color: #475569;
    font-size: 0.8rem;
}

.crm-kpi-trend.is-up {
    color: #86efac;
}

.crm-chart-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: 1.2fr 0.9fr;
    gap: 14px;
}

.crm-chart-card {
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(191, 219, 254, 0.42);
    min-height: 260px;
}

.crm-chart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.crm-chart-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
}

.crm-chart-copy {
    margin-top: 6px;
    color: #64748b;
    font-size: 0.82rem;
    line-height: 1.5;
}

.crm-chart-badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(220, 252, 231, 0.88);
    color: #15803d;
    border: 1px solid rgba(34, 197, 94, 0.22);
    font-size: 0.74rem;
    font-weight: 800;
}

.crm-chart-badge.is-soft {
    background: rgba(239, 246, 255, 0.9);
    border-color: rgba(191, 219, 254, 0.48);
    color: #2563eb;
}

.crm-line-chart {
    position: relative;
    margin-top: 20px;
    height: 160px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(235, 243, 255, 0.96), rgba(223, 234, 251, 0.86));
    overflow: hidden;
    border: 1px solid rgba(191, 219, 254, 0.4);
}

.crm-line-grid {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, rgba(148, 163, 184, 0.18) 1px, transparent 1px) 0 0 / 100% 25%,
        linear-gradient(to right, rgba(148, 163, 184, 0.12) 1px, transparent 1px) 0 0 / 20% 100%;
}

.crm-line-path {
    position: absolute;
    inset: 0;
}

.crm-line-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.crm-line-svg polyline {
    fill: none;
    stroke: #60a5fa;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 6px 10px rgba(96, 165, 250, 0.18));
}

.crm-line-path span {
    position: absolute;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    margin-bottom: -7px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff, #7dd3fc);
    box-shadow: 0 0 0 5px rgba(125, 211, 252, 0.16);
}

.crm-chart-axis {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    color: #64748b;
    font-size: 0.76rem;
}

.crm-bar-chart {
    margin-top: 22px;
    height: 186px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    align-items: end;
    padding: 0 6px 6px;
}

.crm-bar-group {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.crm-bar {
    width: 100%;
    max-width: 44px;
    border-radius: 16px 16px 10px 10px;
    background: linear-gradient(180deg, #93c5fd, #3b82f6);
    box-shadow: 0 10px 18px rgba(59, 130, 246, 0.18);
}

.crm-bar-group label {
    color: #64748b;
    font-size: 0.76rem;
}

/* Detail panel */
.detail-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.detail-value { font-size: 0.9rem; margin-bottom: 10px; word-break: break-word; }
.detail-section { margin-bottom: 10px; }

/* Add customer form */
.customer-form { margin-top: 4px; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; }
.form-group {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}
.form-group-small { max-width: 140px; }
.form-group label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.form-group input, .form-group textarea, .form-group select {
    padding: 7px 9px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    background: white;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}
.form-actions { margin-top: 8px; display: flex; gap: 8px; align-items: center; }
.req { color: #ef4444; margin-left: 2px; font-size: 0.8rem; }

/* Error banner */
.error-banner {
    margin-bottom: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    font-size: 0.85rem;
}

/* Login */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 34%),
        radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.16), transparent 36%),
        linear-gradient(135deg, #0f172a 0%, #13233f 38%, #eef4ff 100%);
}

.login-shell {
    width: min(1180px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 420px);
    gap: 28px;
    align-items: center;
}

.login-hero {
    position: relative;
    overflow: hidden;
    padding: 38px 40px;
    border-radius: 30px;
    color: #eff6ff;
    background:
        linear-gradient(160deg, rgba(15, 23, 42, 0.9), rgba(30, 64, 175, 0.76)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(191, 219, 254, 0.2);
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

.login-hero::before,
.login-hero::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}

.login-hero::before {
    width: 280px;
    height: 280px;
    right: -90px;
    top: -60px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.28), transparent 70%);
}

.login-hero::after {
    width: 220px;
    height: 220px;
    left: -70px;
    bottom: -90px;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.2), transparent 72%);
}

.login-hero-topline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(191, 219, 254, 0.12);
    border: 1px solid rgba(191, 219, 254, 0.18);
    color: #cfe5ff;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.login-hero-brand {
    margin-top: 22px;
    justify-content: flex-start;
}

.login-hero-brand-text {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.login-title-with-logo { display:flex; align-items:center; justify-content:center; gap:12px; }
.login-logo-chip {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(191, 219, 254, 0.18), rgba(147, 197, 253, 0.14));
    display:inline-flex;
    align-items:center;
    justify-content:center;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
}
.login-logo-image { width:28px; height:28px; border-radius:10px; display:block; }

.login-hero-title {
    margin: 22px 0 0;
    max-width: 16ch;
    font-size: clamp(2.4rem, 4vw, 4.25rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
    font-weight: 900;
}

.login-hero-copy {
    margin: 20px 0 0;
    max-width: 620px;
    color: rgba(226, 232, 240, 0.92);
    font-size: 1.02rem;
    line-height: 1.7;
}

.login-hero-grid {
    margin-top: 28px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.login-hero-stat {
    padding: 18px 18px 16px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(191, 219, 254, 0.16);
    backdrop-filter: blur(8px);
}

.login-hero-stat-value {
    font-size: 1.55rem;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: -0.03em;
}

.login-hero-stat-label {
    margin-top: 6px;
    color: rgba(226, 232, 240, 0.84);
    font-size: 0.83rem;
    line-height: 1.45;
}

.login-hero-panels {
    margin-top: 18px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}

.login-hero-panel {
    padding: 20px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(191, 219, 254, 0.14);
    backdrop-filter: blur(10px);
}

.login-hero-panel-title {
    font-size: 0.84rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #dbeafe;
}

.login-feature-list {
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 10px;
}

.login-feature-list li {
    position: relative;
    padding-left: 18px;
    color: rgba(239, 246, 255, 0.92);
    font-size: 0.94rem;
    line-height: 1.45;
}

.login-feature-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(180deg, #67e8f9, #60a5fa);
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.12);
}

.login-card {
    width: 100%;
    padding: 30px 28px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(191, 219, 254, 0.34);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-self: center;
    min-height: 0;
}

.login-panel-badge {
    display: inline-flex;
    width: fit-content;
    padding: 7px 11px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(219, 234, 254, 0.96), rgba(191, 219, 254, 0.8));
    color: #1d4ed8;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-title {
    margin: 18px 0 0;
    text-align: left;
    font-size: 2rem;
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.login-panel-copy {
    margin: 10px 0 0;
    color: #64748b;
    font-size: 0.96rem;
    line-height: 1.65;
}

.login-error-banner {
    margin: 18px 0 4px;
}

.login-input {
    width: 100%;
    min-height: 46px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.login-submit {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    margin-top: 12px;
    font-size: 0.96rem;
    font-weight: 800;
}

@media (max-width: 980px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-hero-title {
        max-width: 100%;
    }
}

@media (max-width: 720px) {
    header {
        padding: 14px 16px;
        align-items: flex-start;
        gap: 12px;
        flex-direction: column;
    }

    .header-right,
    .user-info,
    .search-bar,
    .table-toolbar {
        flex-wrap: wrap;
    }

    .crm-analytics {
        padding: 16px;
    }

    .crm-analytics-header {
        flex-direction: column;
    }

    .crm-kpi-grid {
        grid-template-columns: 1fr;
    }

    .login-wrap {
        padding: 14px;
    }

    .login-hero,
    .login-card {
        padding: 24px 20px;
        border-radius: 24px;
    }

    .login-hero-grid,
    .login-hero-panels {
        grid-template-columns: 1fr;
    }

    .login-title {
        font-size: 1.7rem;
    }
}

.customer-agent-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 80;
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.24);
    font-weight: 700;
}

.customer-agent-launcher-badge {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    background: linear-gradient(180deg, #38bdf8, #2563eb);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.customer-agent-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.customer-agent-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 90;
    width: min(500px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 32px));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 22px;
    box-shadow: 0 28px 64px rgba(15, 23, 42, 0.24);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.customer-agent-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    padding: 18px 18px 14px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.88), rgba(219, 234, 254, 0.74));
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(191, 219, 254, 0.72);
}

.customer-agent-header-main {
    min-width: 0;
    flex: 1;
}

.customer-agent-heading {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 0 12px;
    align-items: center;
}

.customer-agent-title-badge {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(56, 189, 248, 0.18), rgba(37, 99, 235, 0.18));
    color: #1d4ed8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    grid-row: span 2;
}

.customer-agent-title {
    font-size: 1rem;
    font-weight: 700;
}

.customer-agent-subtitle {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.customer-agent-minimize {
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(248, 250, 252, 0.92);
    color: var(--text-main);
    border-radius: 999px;
    padding: 8px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}

.customer-agent-minimize-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    font-size: 0.92rem;
    line-height: 1;
    transform: translateY(-1px);
}

.customer-agent-route-row {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: nowrap;
    padding-top: 12px;
    border-top: 1px solid rgba(191, 219, 254, 0.72);
    overflow: hidden;
}

.customer-agent-route-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid transparent;
    white-space: nowrap;
}

.customer-agent-route-status::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7);
}

.customer-agent-route-status.is-gateway {
    color: #166534;
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.2);
}

.customer-agent-route-status.is-direct {
    color: #1d4ed8;
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.2);
}

.customer-agent-route-status.is-offline {
    color: #b91c1c;
    background: rgba(254, 226, 226, 0.92);
    border-color: rgba(248, 113, 113, 0.26);
}

.customer-agent-route-status.is-checking {
    color: #475569;
    background: rgba(226, 232, 240, 0.78);
    border-color: rgba(148, 163, 184, 0.24);
}

.customer-agent-route-toggle-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(147, 197, 253, 0.36);
    white-space: nowrap;
    flex-shrink: 0;
}

.customer-agent-route-option {
    font-size: 0.74rem;
    color: var(--text-muted);
    font-weight: 700;
    transition: color 0.2s ease, opacity 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    padding: 4px 8px;
    border-radius: 999px;
}

.customer-agent-route-option.is-active.customer-agent-route-option-left {
    color: #15803d;
    font-weight: 700;
    background: rgba(34, 197, 94, 0.15);
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.18);
}

.customer-agent-route-option.is-inactive {
    opacity: 0.6;
}

.customer-agent-switch {
    position: relative;
    display: inline-flex;
    width: 44px;
    height: 26px;
}

.customer-agent-switch input {
    position: absolute;
    inset: 0;
    opacity: 0;
}

.customer-agent-switch-track {
    width: 100%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
    position: relative;
    transition: background 0.2s ease;
}

.customer-agent-switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
    transition: transform 0.2s ease;
}

.customer-agent-switch input:checked + .customer-agent-switch-track {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.customer-agent-switch input:checked + .customer-agent-switch-track::after {
    transform: translateX(18px);
}

.customer-agent-feed {
    flex: 1;
    overflow: auto;
    padding: 150px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.customer-agent-bubble {
    max-width: 86%;
    padding: 12px 14px;
    border-radius: 18px;
    font-size: 0.92rem;
    line-height: 1.5;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.customer-agent-bubble.is-user {
    align-self: flex-end;
    background: linear-gradient(180deg, #2563eb, #1d4ed8);
    color: white;
    border-bottom-right-radius: 6px;
}

.customer-agent-bubble.is-assistant {
    align-self: flex-start;
    background: #fff;
    color: var(--text-main);
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-bottom-left-radius: 6px;
}

.customer-agent-bubble.is-error {
    background: #fff1f2;
    color: #b42318;
    border-color: #fecdd3;
}

.customer-agent-form {
    border-top: 1px solid rgba(229, 231, 235, 0.9);
    padding: 14px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.customer-agent-form textarea {
    width: 100%;
    resize: none;
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 12px 14px;
    font: inherit;
    min-height: 88px;
}

.customer-agent-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.customer-agent-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.customer-delete-modal {
    position: fixed;
    inset: 0;
    z-index: 160;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.customer-delete-modal[hidden] {
    display: none;
}

.customer-delete-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(8px);
}

.customer-delete-modal-card {
    position: relative;
    width: min(460px, calc(100vw - 32px));
    padding: 22px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
    border: 1px solid rgba(248, 113, 113, 0.18);
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.28);
}

.customer-delete-modal-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #111827;
}

.customer-delete-modal-copy {
    margin-top: 10px;
    color: #475569;
    font-size: 0.98rem;
    line-height: 1.55;
}

.customer-delete-modal-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.customer-save-overlay {
    position: fixed;
    inset: 0;
    z-index: 170;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.34);
    backdrop-filter: blur(8px);
}

.customer-save-overlay[hidden] {
    display: none;
}

.customer-save-overlay-card {
    width: min(420px, calc(100vw - 32px));
    padding: 22px 24px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 255, 0.96));
    border: 1px solid rgba(147, 197, 253, 0.24);
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.24);
}

.customer-save-overlay-title {
    font-size: 1.08rem;
    font-weight: 800;
    color: #111827;
}

.customer-save-overlay-copy {
    margin-top: 8px;
    color: #475569;
    font-size: 0.98rem;
    line-height: 1.55;
}

.customer-save-steps {
    margin-top: 18px;
    display: grid;
    gap: 12px;
}

.customer-save-step {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #475569;
    font-size: 0.97rem;
    font-weight: 600;
}

.customer-save-step-box {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1.5px solid rgba(59, 130, 246, 0.38);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    flex: 0 0 auto;
    position: relative;
}

.customer-save-step.is-active .customer-save-step-box {
    border-color: rgba(37, 99, 235, 0.72);
    background: linear-gradient(180deg, rgba(219, 234, 254, 0.98), rgba(191, 219, 254, 0.9));
}

.customer-save-step.is-active .customer-save-step-box::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 999px;
    background: #2563eb;
    animation: customerSavePulse 1s ease-in-out infinite;
}

.customer-save-step.is-complete {
    color: #14532d;
}

.customer-save-step.is-complete .customer-save-step-box {
    border-color: rgba(34, 197, 94, 0.58);
    background: linear-gradient(180deg, rgba(220, 252, 231, 0.98), rgba(187, 247, 208, 0.94));
}

.customer-save-step.is-complete .customer-save-step-box::after {
    content: "✓";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -56%);
    color: #15803d;
    font-size: 0.88rem;
    font-weight: 900;
}

.customer-save-step.is-error {
    color: #991b1b;
}

.customer-save-step.is-error .customer-save-step-box {
    border-color: rgba(239, 68, 68, 0.5);
    background: linear-gradient(180deg, rgba(254, 242, 242, 0.98), rgba(254, 226, 226, 0.95));
}

.customer-save-step.is-error .customer-save-step-box::after {
    content: "!";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -53%);
    color: #dc2626;
    font-size: 0.84rem;
    font-weight: 900;
}

@keyframes customerSavePulse {
    0%, 100% { transform: scale(0.82); opacity: 0.42; }
    50% { transform: scale(1); opacity: 0.95; }
}

.customer-agent-form .btn {
    align-self: flex-end;
}

.customer-agent-dots {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.customer-agent-dots span {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #9dbaf8;
    animation: customerAgentPulse 1.1s infinite ease-in-out;
}

.customer-agent-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.customer-agent-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes customerAgentPulse {
    0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}

@media (max-width: 720px) {
    .customer-agent-launcher,
    .customer-agent-panel {
        right: 12px;
        bottom: 12px;
    }

    .customer-agent-panel {
        width: calc(100vw - 24px);
        height: min(70vh, 560px);
    }
}
