@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@600;700&display=swap');

:root {
    color-scheme: light;
    --ink: #0f172a;
    --ink-light: #334155;
    --muted: #64748b;
    --line: #e2e8f0;
    --line-subtle: #f1f5f9;
    --paper: #f8fafc;
    --surface: #ffffff;

    --brand-dark: #071913;
    --brand-darker: #04100c;
    --emerald: #059669;
    --emerald-dark: #047857;
    --emerald-light: #ecfdf5;
    --emerald-border: #a7f3d0;
    --emerald-glow: rgba(5, 150, 105, 0.15);

    --amber: #d97706;
    --rose: #e11d48;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 45px -10px rgba(7, 25, 19, 0.18);
}

* {
    box-sizing: border-box;
}

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

body {
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

/* LOGIN VIEW */
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 10% 20%, rgba(5, 150, 105, 0.14), transparent 35%),
        radial-gradient(circle at 90% 80%, rgba(217, 119, 6, 0.08), transparent 35%),
        #071913;
}

.login-card {
    width: min(100%, 440px);
    padding: 44px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(20px);
    color: white;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.brand-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.brand-mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: white;
    background: linear-gradient(135deg, #10b981, #047857);
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: 26px;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
}

.brand-mark.small {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 19px;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
    font-size: 12px;
    font-weight: 600;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 10px #34d399;
}

.eyebrow {
    margin: 0 0 6px;
    color: #34d399;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.8px;
}

h1,
h2,
h3 {
    font-family: "Space Grotesk", sans-serif;
    letter-spacing: -0.5px;
}

.login-card h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
}

.login-copy {
    margin: 10px 0 28px;
    color: #94a3b8;
    font-size: 14px;
    line-height: 1.6;
}

form label {
    display: block;
    margin: 18px 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
}

form input {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    color: white;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.2s ease;
}

form input:focus {
    border-color: #10b981;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

form button {
    width: 100%;
    margin-top: 24px;
    padding: 15px;
    border: 0;
    border-radius: 12px;
    color: white;
    background: linear-gradient(135deg, #10b981, #059669);
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 18px rgba(16, 185, 129, 0.35);
    transition: all 0.2s ease;
}

form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.45);
}

.form-error {
    min-height: 20px;
    margin: 10px 0 0;
    color: #f87171;
    font-size: 13px;
    font-weight: 500;
}

.secure-note {
    margin: 24px 0 0;
    text-align: center;
    color: #64748b;
    font-size: 12px;
}

/* PORTAL VIEW */
.portal {
    min-height: 100vh;
    background: #f8fafc;
}

.topbar {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background: linear-gradient(135deg, #071913, #0f2d22);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: white;
    box-shadow: var(--shadow-md);
}

.brand {
    display: flex;
    gap: 14px;
    align-items: center;
    color: white;
    text-decoration: none;
}

.brand-text strong {
    display: block;
    font-family: "Space Grotesk", sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.brand-text small {
    display: block;
    margin-top: 1px;
    color: #a7f3d0;
    font-size: 11px;
    font-weight: 500;
}

/* TOPBAR STATS RIBBON */
.topbar-stats {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.stat-pill.highlight {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.4);
}

.stat-num {
    font-family: "Space Grotesk", sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #34d399;
}

.stat-label {
    font-size: 11.5px;
    font-weight: 600;
    color: #cbd5e1;
}

.admin-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
}

.user-avatar-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

/* WORKSPACE LAYOUT */
.workspace {
    height: calc(100vh - 72px);
    display: grid;
    grid-template-columns: minmax(350px, 420px) 1fr;
}

.sidebar {
    min-width: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: white;
}

.sidebar-heading {
    padding: 24px 24px 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.sidebar-heading .eyebrow {
    color: var(--emerald);
    margin: 0 0 4px;
}

.sidebar-heading h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
}

.icon-button {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    color: var(--muted);
    transition: all 0.2s ease;
}

.icon-button:hover {
    border-color: var(--emerald);
    color: var(--emerald);
    background: var(--emerald-light);
}

/* SEARCH & FILTER */
.search-wrap {
    margin: 0 24px 12px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    color: var(--muted);
    transition: all 0.2s ease;
}

.search-box input {
    width: 100%;
    border: 0;
    padding: 12px 0;
    font-size: 13.5px;
    background: transparent;
    color: var(--ink);
    outline: none;
}

.filter-tabs {
    display: flex;
    gap: 6px;
    margin: 0 24px 12px;
}

.filter-chip {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-chip:hover {
    border-color: #cbd5e1;
    color: var(--ink);
}

.filter-chip.active {
    background: var(--ink);
    border-color: var(--ink);
    color: white;
}

.list-meta {
    display: flex;
    justify-content: space-between;
    padding: 10px 24px 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--line-subtle);
}

.conversation-list {
    overflow-y: auto;
    padding: 8px 16px 24px;
}

/* CONVERSATION CARD */
.conversation-card {
    width: 100%;
    display: block;
    padding: 16px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
    color: inherit;
    text-align: left;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.conversation-card:hover {
    border-color: var(--emerald-border);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.conversation-card.active {
    border-color: var(--emerald);
    background: var(--emerald-light);
    box-shadow: 0 4px 20px rgba(5, 150, 105, 0.15);
}

.card-top,
.card-tags {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.caller-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    font-size: 14.5px;
    color: var(--ink);
}

.call-date {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 500;
}

.card-summary {
    margin: 8px 0 12px;
    color: var(--ink-light);
    font-size: 12.5px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tag {
    padding: 4px 9px;
    border-radius: 20px;
    background: #f1f5f9;
    color: #475569;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: capitalize;
}

.tag.lead-tag {
    background: #dbeafe;
    color: #1d4ed8;
}

.tag.success {
    color: #047857;
    background: #d1fae5;
}

.tag.unsuccessful {
    color: #b91c1c;
    background: #fee2e2;
}

.card-duration {
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
}

/* DETAIL PANEL */
.detail-panel {
    min-width: 0;
    overflow-y: auto;
    background: #f8fafc;
}

/* DASHBOARD OVERVIEW HUB */
.dashboard-overview {
    padding: 60px max(30px, 6vw);
    max-width: 1000px;
    margin: 0 auto;
}

.dash-welcome {
    margin-bottom: 40px;
}

.dash-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
    font-size: 12.5px;
    font-weight: 700;
    margin-bottom: 14px;
}

.pulse-emerald {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 10px #10b981;
}

.dash-welcome h2 {
    font-size: 32px;
    font-weight: 800;
    margin: 0 0 12px;
    color: var(--ink);
}

.dash-welcome p {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.65;
    margin: 0;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.overview-card {
    padding: 24px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: white;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.overview-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--emerald-border);
}

.overview-icon {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--emerald-light);
    font-size: 24px;
    flex-shrink: 0;
}

.overview-num {
    display: block;
    font-family: "Space Grotesk", sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--ink);
}

.overview-label {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.overview-banner {
    padding: 22px 28px;
    border-radius: 16px;
    background: white;
    border: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.system-status-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    color: var(--ink-light);
}

.status-indicator {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #cbd5e1;
}

.status-indicator.active {
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* DETAIL HEADER & LEAD CARD */
.detail-header {
    padding: 32px clamp(24px, 4vw, 56px) 28px;
    border-bottom: 1px solid var(--line);
    background: white;
    box-shadow: var(--shadow-sm);
}

.detail-title-row {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
}

.detail-header .eyebrow {
    margin: 0 0 6px;
    color: var(--emerald);
}

.detail-header h2 {
    margin: 0;
    font-size: clamp(24px, 2.5vw, 32px);
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.8px;
}

.detail-subtitle {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 500;
}

.action-bar {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: white;
    color: var(--ink-light);
    font-size: 12.5px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.action-btn:hover {
    border-color: var(--emerald);
    color: var(--emerald);
    background: var(--emerald-light);
}

.outcome {
    padding: 8px 14px;
    border-radius: 20px;
    background: var(--emerald-light);
    color: var(--emerald);
    border: 1px solid var(--emerald-border);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.outcome.unsuccessful {
    color: var(--rose);
    background: var(--rose-light);
    border-color: #fecdd3;
}

/* CONTACT / LEAD CARD GRID */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 24px;
}

.contact-item {
    position: relative;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
    transition: all 0.2s ease;
}

.contact-item.has-data {
    border-color: var(--emerald-border);
    background: linear-gradient(135deg, #ffffff, #f0fdf4);
}

.contact-item small {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.contact-item-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.contact-item span,
.contact-item a {
    overflow-wrap: anywhere;
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
}

.copy-mini-btn {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: white;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    transition: all 0.15s ease;
}

.copy-mini-btn:hover {
    border-color: var(--emerald);
    color: var(--emerald);
    background: var(--emerald-light);
}

/* TRANSCRIPT & SUMMARY */
.summary-block {
    max-width: 900px;
    margin: 28px auto 0;
    padding: 22px 24px;
    border-left: 4px solid var(--emerald);
    border-radius: 0 16px 16px 0;
    background: white;
    box-shadow: var(--shadow-sm);
    border-top: 1px solid var(--line);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.summary-block h3 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
}

.summary-block p {
    margin: 0;
    color: var(--ink-light);
    font-size: 14px;
    line-height: 1.7;
}

.transcript-wrap {
    padding: 32px clamp(24px, 4vw, 56px) 80px;
}

.transcript-heading {
    max-width: 900px;
    margin: 0 auto 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.transcript-heading h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.transcript-heading span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

/* MESSAGES CHAT */
.messages {
    max-width: 900px;
    margin: auto;
}

.message-row {
    display: flex;
    gap: 12px;
    margin: 0 0 20px;
}

.message-row.user {
    flex-direction: row-reverse;
}

.avatar-badge {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.avatar-badge.agent {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.avatar-badge.user {
    background: linear-gradient(135deg, #334155, #0f172a);
    color: white;
}

.message {
    max-width: min(78%, 700px);
}

.message-meta {
    display: flex;
    gap: 8px;
    margin: 0 4px 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.message-row.user .message-meta {
    justify-content: flex-end;
}

.bubble {
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: 6px 18px 18px 18px;
    background: white;
    color: var(--ink);
    font-size: 14.5px;
    line-height: 1.65;
    white-space: pre-wrap;
    box-shadow: var(--shadow-sm);
}

.message-row.user .bubble {
    border-color: var(--emerald);
    border-radius: 18px 6px 18px 18px;
    color: white;
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.2);
}

/* TOAST & UTILITIES */
.loading,
.list-empty {
    padding: 40px 20px;
    color: var(--muted);
    text-align: center;
    font-size: 14px;
}

.mobile-back {
    display: none;
    margin: 20px 24px 0;
}

.toast {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 99;
    padding: 12px 20px;
    border-radius: 12px;
    color: white;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    font-size: 13.5px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 900px) {
    .topbar-stats {
        display: none;
    }

    .overview-grid {
        grid-template-columns: 1fr;
    }

    .overview-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .workspace {
        height: calc(100vh - 72px);
        display: block;
    }

    .sidebar {
        height: 100%;
        border: 0;
    }

    .detail-panel {
        display: none;
        height: 100%;
    }

    .workspace.detail-open .sidebar {
        display: none;
    }

    .workspace.detail-open .detail-panel {
        display: block;
    }

    .mobile-back {
        display: inline-block;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .message {
        max-width: 88%;
    }
}