/* ─── Reset & Variables ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f5f6fa;
    --bg2: #ffffff;
    --bg3: #f0f2f8;
    --border: #e2e6f0;
    --text: #1a1f36;
    --muted: #6b7280;
    --accent: #0066cc;        /* Unilever blue */
    --accent2: #e8001d;       /* Unilever red accent */
    --accent-light: #e8f0fb;
    --danger: #dc2626;
    --warn: #d97706;
    --success: #16a34a;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 24px rgba(0,0,0,0.10);
}

html, body { height: 100%; font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }

a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.8; }

/* ─── Auth Pages ─────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    background-image: radial-gradient(circle at 10% 20%, rgba(0,102,204,0.05) 0%, transparent 50%),
                      radial-gradient(circle at 90% 80%, rgba(232,0,29,0.04) 0%, transparent 50%);
    padding: 24px;
}

.auth-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-md);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.auth-brand img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.brand-name { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }

.auth-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.auth-desc { color: var(--muted); margin-bottom: 24px; font-size: 13px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text); text-transform: uppercase; letter-spacing: 0.05em; }
.form-group input, .form-group select {
    background: var(--bg3);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}
.form-group select { cursor: pointer; }
.form-hint { font-size: 11px; color: var(--muted); }
.optional { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

.auth-footer { text-align: center; margin-top: 20px; color: var(--muted); font-size: 13px; }

.demo-creds {
    margin-top: 24px;
    padding: 14px;
    background: var(--bg3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.demo-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; font-weight: 600; }
.demo-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.demo-row:last-child { margin-bottom: 0; }
code { background: #fff; border: 1px solid var(--border); padding: 2px 6px; border-radius: 4px; font-family: 'DM Mono', monospace; font-size: 12px; color: var(--accent); }

/* ─── Badges ─────────────────────────────────────────────────── */
.badge { font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.badge-manager { background: rgba(0,102,204,0.1); color: var(--accent); }
.badge-sales { background: rgba(22,163,74,0.1); color: var(--success); }

/* ─── Alerts ─────────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.alert-error { background: rgba(220,38,38,0.08); border: 1px solid rgba(220,38,38,0.25); color: var(--danger); }
.alert-success { background: rgba(22,163,74,0.08); border: 1px solid rgba(22,163,74,0.25); color: var(--success); }

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.15s;
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #0052a3; }
.btn-ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: #c0c8d8; background: var(--bg3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-full { width: 100%; justify-content: center; }
.btn-large { padding: 13px 24px; font-size: 15px; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ─── App Layout ─────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 230px;
    min-height: 100vh;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 0;
    position: sticky;
    top: 0;
    flex-shrink: 0;
    box-shadow: 2px 0 8px rgba(0,0,0,0.04);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.sidebar-brand img {
    height: 34px;
    width: auto;
    object-fit: contain;
}

.sidebar-brand-text { display: flex; flex-direction: column; }
.sidebar-app-name { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.sidebar-app-sub { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    text-decoration: none;
}
.nav-item:hover { background: var(--bg3); color: var(--text); transform: none; box-shadow: none; }
.nav-item.active { background: var(--accent-light); color: var(--accent); }
.nav-item.active svg { color: var(--accent); }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg3);
}

.user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    border: 2px solid rgba(0,102,204,0.15);
}
.manager-avatar { background: rgba(232,0,29,0.08); color: var(--accent2); border-color: rgba(232,0,29,0.15); }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.user-role { font-size: 11px; color: var(--muted); }

.logout-btn {
    color: var(--muted);
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
    flex-shrink: 0;
}
.logout-btn:hover { color: var(--danger); background: rgba(220,38,38,0.06); }

/* ─── Main Content ───────────────────────────────────────────── */
.main-content {
    flex: 1;
    padding: 32px 36px;
    max-width: 920px;
    overflow-x: hidden;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.page-subtitle { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ─── Stats Grid ─────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; font-weight: 600; }
.stat-value { font-size: 32px; font-weight: 700; font-family: 'DM Mono', monospace; line-height: 1; margin-bottom: 4px; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--muted); }

/* ─── Score Colors ───────────────────────────────────────────── */
.score-high { color: var(--success) !important; }
.score-mid  { color: var(--warn) !important; }
.score-low  { color: var(--danger) !important; }

/* ─── Section ────────────────────────────────────────────────── */
.section { margin-bottom: 28px; }
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 14px; }

/* ─── Sessions List ──────────────────────────────────────────── */
.sessions-list {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.session-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.session-row:last-child { border-bottom: none; }
.session-row:hover { background: var(--bg3); }

.session-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.session-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-completed { background: var(--success); }
.status-recording { background: var(--danger); animation: pulse 1.5s infinite; }
.status-processing { background: var(--warn); }
.status-failed { background: var(--muted); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.session-customer { font-size: 14px; font-weight: 600; color: var(--text); }
.session-meta { font-size: 12px; color: var(--muted); }
.session-actions { display: flex; align-items: center; gap: 10px; }

.score-pill {
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--bg3);
}

.status-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--bg3);
    color: var(--muted);
    font-weight: 500;
}

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

/* ─── Recording Page ─────────────────────────────────────────── */
.record-container { max-width: 560px; }

.record-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.record-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 18px; color: var(--text); }

.info-box {
    display: flex;
    gap: 10px;
    background: var(--accent-light);
    border: 1px solid rgba(0,102,204,0.15);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 20px;
    color: var(--muted);
    font-size: 13px;
    align-items: flex-start;
}
.info-box svg { color: var(--accent); flex-shrink: 0; margin-top: 2px; }

.hidden { display: none !important; }

/* Recording state */
.recording-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}
.rec-pulse {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(220,38,38,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 1.2s ease-in-out infinite;
}
.rec-dot { width: 12px; height: 12px; background: var(--danger); border-radius: 50%; }
.rec-label { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; color: var(--danger); }

.waveform { margin-bottom: 20px; background: var(--bg3); border-radius: var(--radius-sm); padding: 8px; border: 1px solid var(--border); }
#waveform-canvas { display: block; width: 100%; height: 70px; }

.timer {
    font-family: 'DM Mono', monospace;
    font-size: 36px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 12px;
    color: var(--text);
}
.record-hint { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }

/* Processing */
.processing-anim {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}
.spinner-ring {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.processing-steps {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.proc-step {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    opacity: 0.4;
    transition: opacity 0.3s;
}
.proc-step.active { opacity: 1; color: var(--text); }
.proc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    transition: background 0.3s;
}
.proc-dot.done { background: var(--accent); }

.input-field {
    background: var(--bg3);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    width: 100%;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 16px;
}
.input-field:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(0,102,204,0.1); }

/* ─── Score Hero ─────────────────────────────────────────────── */
.score-hero {
    display: flex;
    align-items: center;
    gap: 28px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 28px;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--accent);
}

.score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid currentColor;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #fff;
}
.score-number { font-family: 'DM Mono', monospace; font-size: 30px; font-weight: 700; line-height: 1; }
.score-label { font-size: 11px; opacity: 0.6; }

.score-info h2 { font-size: 17px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.score-info p { color: var(--muted); font-size: 13px; line-height: 1.6; margin-bottom: 12px; }

.sentiment-tag {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.sentiment-positive { background: rgba(22,163,74,0.1); color: var(--success); }
.sentiment-neutral  { background: rgba(217,119,6,0.1); color: var(--warn); }
.sentiment-negative { background: rgba(220,38,38,0.1); color: var(--danger); }

/* ─── Scores Breakdown ───────────────────────────────────────── */
.scores-breakdown { display: flex; flex-direction: column; gap: 12px; }

.score-bar-row {
    display: grid;
    grid-template-columns: 160px 1fr 40px;
    align-items: center;
    gap: 14px;
}
.score-bar-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.score-bar-track {
    background: var(--bg3);
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.score-bar-fill {
    height: 100%;
    border-radius: 20px;
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fill-high { background: var(--success); }
.fill-mid  { background: var(--warn); }
.fill-low  { background: var(--danger); }
.score-bar-val { font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 700; text-align: right; color: var(--text); }

/* Mini bar for leaderboard */
.score-bar-mini {
    width: 120px;
    height: 6px;
    background: var(--bg3);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
}

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.card-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 14px; color: var(--text); }
.card-green { color: var(--success); }
.card-amber { color: var(--warn); }
.card-red   { color: var(--danger); }
.card-warning { border-color: rgba(220,38,38,0.25); background: rgba(220,38,38,0.02); border-top: 3px solid var(--danger); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

.insight-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.insight-list li {
    font-size: 13px;
    color: var(--muted);
    padding-left: 16px;
    position: relative;
    line-height: 1.5;
}
.insight-list li::before {
    content: '·';
    position: absolute;
    left: 4px;
    color: var(--accent);
    font-weight: 700;
}

.keyword-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid rgba(0,102,204,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* ─── Transcript ─────────────────────────────────────────────── */
.transcript-box {
    background: var(--bg3);
    border-radius: var(--radius-sm);
    padding: 16px;
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--border);
}
.transcript-box pre {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    color: var(--muted);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
}

/* ─── Leaderboard ────────────────────────────────────────────── */
.leaderboard {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.lb-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s;
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: var(--bg3); }

.lb-rank { font-size: 16px; width: 24px; text-align: center; flex-shrink: 0; }
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-size: 14px; font-weight: 600; color: var(--text); }
.lb-meta { font-size: 12px; color: var(--muted); }

.lb-scores {
    display: flex;
    align-items: center;
    gap: 12px;
}
.lb-score {
    font-family: 'DM Mono', monospace;
    font-size: 15px;
    font-weight: 700;
    min-width: 36px;
    text-align: right;
}

/* ─── Page Actions ───────────────────────────────────────────── */
.page-actions { display: flex; gap: 12px; margin-top: 24px; }

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #c0c8d8; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { width: 64px; }
    .sidebar-brand img, .sidebar-brand-text, .nav-item span, .user-name, .user-role { display: none; }
    .sidebar-brand { padding: 16px; justify-content: center; }
    .nav-item { justify-content: center; padding: 10px; }
    .sidebar-footer { padding: 12px; justify-content: center; }
    .user-info { justify-content: center; }
    .main-content { padding: 20px 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .two-col { grid-template-columns: 1fr; }
    .score-hero { flex-direction: column; text-align: center; }
    .score-bar-row { grid-template-columns: 100px 1fr 36px; }
    .page-header { flex-direction: column; }
}