/* Listening Synthesiser - Dashboard Styles */

/* ------------------------------------------------------------------
 * Tokens
 * ----------------------------------------------------------------*/
:root {
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-surface-alt: #f1f5f9;
    --color-border: #e2e8f0;
    --color-border-strong: #cbd5e1;
    --color-text: #0f172a;
    --color-text-muted: #64748b;
    --color-text-soft: #94a3b8;
    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-primary-soft: #eef2ff;
    --color-success-bg: #ecfdf5;
    --color-success-fg: #047857;
    --color-warning-bg: #fef3c7;
    --color-warning-fg: #92400e;
    --color-error-bg: #fee2e2;
    --color-error-fg: #991b1b;
    --color-positive: #16a34a;
    --color-neutral: #64748b;
    --color-negative: #dc2626;
    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --shadow-md: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
}

:root[data-theme="dark"] {
    --color-bg: #0b1120;
    --color-surface: #111a2e;
    --color-surface-alt: #1a2438;
    --color-border: #223047;
    --color-border-strong: #34445f;
    --color-text: #e2e8f0;
    --color-text-muted: #94a3b8;
    --color-text-soft: #64748b;
    --color-primary: #6d68f0;
    --color-primary-hover: #8783f4;
    --color-primary-soft: #1e1c45;
    --color-success-bg: #0a3d2e;
    --color-success-fg: #5eead4;
    --color-warning-bg: #452c0a;
    --color-warning-fg: #fcd34d;
    --color-error-bg: #4a1414;
    --color-error-fg: #fca5a5;
    --color-positive: #4ade80;
    --color-neutral: #94a3b8;
    --color-negative: #f87171;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ------------------------------------------------------------------
 * Base
 * ----------------------------------------------------------------*/
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    color: var(--color-text);
    background: var(--color-bg);
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 2rem 4rem;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    color: var(--color-text);
    letter-spacing: -0.01em;
    margin: 0;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1rem;
    font-weight: 600;
}

p {
    margin: 0 0 1rem;
    color: var(--color-text-muted);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

/* ------------------------------------------------------------------
 * Nav
 * ----------------------------------------------------------------*/
nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 0 1.25rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 2rem;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.nav-user {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.logout-form {
    margin: 0;
    display: inline-flex;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    background: none;
    border: 1px solid var(--color-border-strong);
    color: var(--color-text-muted);
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 400;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-btn:hover {
    color: var(--color-text);
    border-color: var(--color-text-muted);
    text-decoration: none;
}

.site-footer {
    margin-top: 3rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-soft);
}

.site-footer a {
    color: var(--color-text-muted);
}

.site-footer a:hover {
    color: var(--color-primary);
}

.login-back {
    display: inline-block;
    margin-top: 1.25rem;
    font-size: 0.88rem;
    color: var(--color-text-muted);
}

.login-back:hover {
    color: var(--color-text);
}

.logout-btn {
    background: none;
    border: 1px solid var(--color-negative);
    color: var(--color-negative);
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.logout-btn:hover {
    background: var(--color-error-bg);
}

/* Theme switch: pill track with a sliding knob; knob icon follows the theme */
.theme-switch {
    position: relative;
    width: 3.6rem;
    height: 1.95rem;
    flex-shrink: 0;
    border-radius: 999px;
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface-alt);
    padding: 0;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.theme-switch:hover {
    border-color: var(--color-text-muted);
}

.theme-switch .knob {
    position: absolute;
    top: 50%;
    left: 0.2rem;
    transform: translateY(-50%);
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: left 0.2s ease;
}

.theme-switch .knob::before {
    content: "☀️";
    display: block;
    font-size: 0.95rem;
    line-height: 1.55rem;
    text-align: center;
}

:root[data-theme="dark"] .theme-switch .knob {
    left: calc(100% - 1.75rem);
}

:root[data-theme="dark"] .theme-switch .knob::before {
    content: "🌙";
}

nav a {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

nav a:hover {
    color: var(--color-primary);
    text-decoration: none;
}

/* ------------------------------------------------------------------
 * Sections (cards)
 * ----------------------------------------------------------------*/
section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2 {
    margin-bottom: 0;
}

.section-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
}

/* ------------------------------------------------------------------
 * Data provenance line
 * ----------------------------------------------------------------*/
.data-provenance {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    color: var(--color-text-muted);
}

.data-provenance strong {
    color: var(--color-text);
    font-weight: 600;
}

.data-provenance-warning {
    color: var(--color-negative);
}

/* ------------------------------------------------------------------
 * Stats bar
 * ----------------------------------------------------------------*/
.stats {
    display: flex;
    gap: 2rem;
    padding: 1.25rem 1.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.stats p {
    margin: 0;
    color: var(--color-text);
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.1;
}

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

/* ------------------------------------------------------------------
 * Tables
 * ----------------------------------------------------------------*/
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

th, td {
    padding: 0.7rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

th {
    background: var(--color-surface-alt);
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tbody tr {
    transition: background 0.12s ease;
}

tbody tr:hover {
    background: var(--color-surface-alt);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ------------------------------------------------------------------
 * Filters
 * ----------------------------------------------------------------*/
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-row > div {
    flex: 1 1 140px;
    min-width: 140px;
}

.filter-row label {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

.filter-row select,
.filter-row input[type="date"] {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: 0.9rem;
    color: var(--color-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filter-row select:focus,
.filter-row input[type="date"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* ------------------------------------------------------------------
 * Snapshot selector
 * ----------------------------------------------------------------*/
.snapshot-selector {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.9rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

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

.snapshot-selector select {
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: 0.9rem;
    color: var(--color-text);
}

/* ------------------------------------------------------------------
 * Theme expansion / sub-themes
 * ----------------------------------------------------------------*/
.expand-btn {
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    padding: 0.15rem 0.5rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--color-primary);
    transition: all 0.15s ease;
}

.expand-btn:hover {
    background: var(--color-primary-soft);
    border-color: var(--color-primary);
}

.subtheme-container > td {
    padding: 0;
    border-bottom: none;
    background: var(--color-bg);
}

.subtheme-container .sub-theme-table {
    margin: 0.25rem 0.75rem 0.75rem 2.5rem;
    width: calc(100% - 3.25rem);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.sub-theme-table th {
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-size: 0.7rem;
}

.sub-theme-table td {
    font-size: 0.88rem;
    padding: 0.55rem 0.85rem;
}

.theme-row td {
    border-bottom: 1px solid var(--color-border);
}

/* ------------------------------------------------------------------
 * Buttons
 * ----------------------------------------------------------------*/
.download-btn,
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--color-primary);
    color: white;
    height: 2.5rem;
    box-sizing: border-box;
    padding: 0 1rem;
    border: none;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
    box-shadow: var(--shadow-sm);
}

.section-actions form {
    margin: 0;
    display: inline-flex;
}

.download-btn:hover,
.btn-primary:hover {
    background: var(--color-primary-hover);
    color: white;
    text-decoration: none;
}

.download-btn:active,
.btn-primary:active {
    transform: translateY(1px);
}

/* ------------------------------------------------------------------
 * Help tooltips
 * ----------------------------------------------------------------*/
.help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    width: 0.95rem;
    height: 0.95rem;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--color-border);
    border: 1px solid var(--color-border-strong);
    color: var(--color-text-muted);
    font-weight: 600;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    cursor: help;
    position: relative;
    user-select: none;
}

/* Geometric centering: any heading or label that carries a help icon becomes
   a flex row, so the icon is centred against the text regardless of the
   text's size or case. Baseline alignment cannot do this consistently. */
h2:has(> .help-tip),
.stat-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
}

label:has(> .help-tip) {
    display: flex;
    align-items: center;
    gap: 0.35em;
}

.help-tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 0.5rem 0.7rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
    line-height: 1.4;
    width: max-content;
    max-width: 280px;
    white-space: normal;
    text-align: left;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.help-tip:hover::after,
.help-tip:focus::after {
    opacity: 1;
}

.view-tabs-help {
    align-self: center;
    margin-left: 0.5rem;
}

/* ------------------------------------------------------------------
 * Add-more-data panel (bottom of dashboard)
 * ----------------------------------------------------------------*/
.upload-panel {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.upload-fold summary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    list-style: none;
}

.upload-fold summary::-webkit-details-marker {
    display: none;
}

.upload-fold summary::before {
    content: "▸";
    color: var(--color-text-muted);
    font-size: 0.9rem;
    transition: transform 0.15s ease;
}

.upload-fold[open] summary::before {
    transform: rotate(90deg);
}

.upload-fold summary h2 {
    margin-bottom: 0;
}

.upload-fold .fold-hint {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.upload-fold[open] summary {
    margin-bottom: 1.25rem;
}

.upload-panel-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, 1fr);
    gap: 2.5rem;
    align-items: start;
}

@media (max-width: 860px) {
    .upload-panel-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

.upload-intro {
    color: var(--color-text-muted);
}

.upload-help {
    margin: 0.75rem 0 0;
}

.upload-help summary {
    cursor: pointer;
    font-weight: 500;
}

.upload-help ol {
    margin: 0.6rem 0 0.4rem 1.3rem;
    display: grid;
    gap: 0.4rem;
}

.upload-form {
    display: grid;
    gap: 1rem;
    align-content: start;
}

.upload-form label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.upload-form input[type="text"],
.upload-form input[type="file"] {
    width: 100%;
    box-sizing: border-box;
}

/* ------------------------------------------------------------------
 * Loading indicators
 * ----------------------------------------------------------------*/
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-left: 0.5rem;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: -0.15em;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.htmx-indicator {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    opacity: 1;
}

.trend-hint {
    margin: 0.75rem 0;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* ------------------------------------------------------------------
 * Login page
 * ----------------------------------------------------------------*/
.login-wrap {
    display: flex;
    justify-content: center;
    padding-top: 7vh;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.25rem 2rem;
    text-align: center;
}

.login-mark {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.login-card h1 {
    font-size: 1.35rem;
    margin-bottom: 0.4rem;
}

.login-sub {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

.login-error {
    background: var(--color-error-bg);
    color: var(--color-error-fg);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.9rem;
    font-size: 0.88rem;
    margin-bottom: 1rem;
}

.login-form {
    display: grid;
    gap: 1rem;
    text-align: left;
}

.login-form label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.login-form input[type="text"],
.login-form input[type="password"],
.login-form input[type="email"] {
    width: 100%;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-form input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.login-btn {
    width: 100%;
    justify-content: center;
    margin-top: 0.25rem;
}

/* ------------------------------------------------------------------
 * Toasts
 * ----------------------------------------------------------------*/
.toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    display: grid;
    gap: 0.5rem;
    z-index: 100;
    max-width: min(360px, calc(100vw - 2.5rem));
}

.toast {
    background: #1e293b;
    color: #fff;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--color-primary);
    font-size: 0.9rem;
    line-height: 1.4;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    animation: toast-in 0.2s ease;
}

.toast-success { border-left-color: #22c55e; }
.toast-error   { border-left-color: #ef4444; }
.toast-warning { border-left-color: #f59e0b; }

.toast-out {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------------
 * Onboarding
 * ----------------------------------------------------------------*/
.onboarding {
    max-width: 640px;
}

.onboarding p {
    margin-bottom: 1.5rem;
}

.onboarding form > div {
    margin-bottom: 1.1rem;
}

.onboarding label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    color: var(--color-text);
    font-size: 0.92rem;
}

.onboarding input[type="file"],
.onboarding input[type="text"] {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: 0.92rem;
}

.onboarding input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.onboarding button {
    background: var(--color-primary);
    color: white;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.92rem;
}

.onboarding button:hover {
    background: var(--color-primary-hover);
}

details > summary {
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    background: var(--color-surface-alt);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

details > summary:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

/* ------------------------------------------------------------------
 * Trend chart
 * ----------------------------------------------------------------*/
#trend-section canvas {
    max-height: 320px;
}

#trend-theme-select {
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: 0.92rem;
    min-width: 280px;
    margin-bottom: 1rem;
}

/* ------------------------------------------------------------------
 * Messages
 * ----------------------------------------------------------------*/
.messages {
    margin-bottom: 1.5rem;
}

.message {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.message.success {
    background: var(--color-success-bg);
    color: var(--color-success-fg);
    border-color: rgba(4, 120, 87, 0.2);
}

.message.warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-fg);
    border-color: rgba(146, 64, 14, 0.2);
}

.message.error {
    background: var(--color-error-bg);
    color: var(--color-error-fg);
    border-color: rgba(153, 27, 27, 0.2);
}

/* ------------------------------------------------------------------
 * Sentiment chips (theme detail)
 * ----------------------------------------------------------------*/
.sentiment-chip {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: capitalize;
}

.sentiment-positive {
    background: #dcfce7;
    color: var(--color-positive);
}

.sentiment-neutral {
    background: #f1f5f9;
    color: var(--color-neutral);
}

.sentiment-negative {
    background: #fee2e2;
    color: var(--color-negative);
}

/* ------------------------------------------------------------------
 * View tabs (Marketing | Operational | All)
 * ----------------------------------------------------------------*/
nav.view-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
    padding: 0;
}

nav.view-tabs a {
    font-size: 0.92rem;
    font-weight: 500;
}

.view-tab {
    padding: 0.65rem 1.1rem;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.view-tab:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.view-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* ------------------------------------------------------------------
 * Operational banner
 * ----------------------------------------------------------------*/
.operational-banner {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
    padding: 0.85rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* ------------------------------------------------------------------
 * Theme category badges
 * ----------------------------------------------------------------*/
.theme-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 0.5rem;
    vertical-align: middle;
    letter-spacing: 0.01em;
}

.theme-badge.buying_trigger { background: #fed7aa; color: #9a3412; }
.theme-badge.business_pain { background: #fecaca; color: #991b1b; }
.theme-badge.objection { background: #fde68a; color: #92400e; }
.theme-badge.competitive_insight { background: #e9d5ff; color: #6b21a8; }
.theme-badge.outcome_realised { background: #bbf7d0; color: #166534; }
.theme-badge.validation { background: #bfdbfe; color: #1e40af; }
.theme-badge.operational { background: #e2e8f0; color: #475569; }
.theme-badge.mixed { background: #cbd5e1; color: #334155; }

/* ------------------------------------------------------------------
 * Marketing-value chips
 * ----------------------------------------------------------------*/
.mv-chip {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
}

.mv-high {
    background: #dcfce7;
    color: var(--color-positive);
}

.mv-medium {
    background: #e2e8f0;
    color: #334155;
}

.mv-low {
    background: #f1f5f9;
    color: var(--color-text-muted);
}

/* ------------------------------------------------------------------
 * Empty state
 * ----------------------------------------------------------------*/
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--color-text-muted);
}

/* ------------------------------------------------------------------
 * Responsive
 * ----------------------------------------------------------------*/
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    .stats {
        flex-direction: column;
        gap: 1rem;
    }
    .filter-row > div {
        min-width: 120px;
    }
    table {
        font-size: 0.85rem;
    }
    th, td {
        padding: 0.5rem 0.6rem;
    }
}

/* ------------------------------------------------------------------
 * Dark-theme overrides for fixed pastel accents
 * ----------------------------------------------------------------*/
:root[data-theme="dark"] .sentiment-positive { background: #0a3d2e; }
:root[data-theme="dark"] .sentiment-neutral { background: var(--color-surface-alt); }
:root[data-theme="dark"] .sentiment-negative { background: #4a1414; }

:root[data-theme="dark"] .operational-banner {
    background: #452c0a;
    border-color: #78350f;
    color: #fcd34d;
}

:root[data-theme="dark"] .theme-badge.buying_trigger { background: #4a2510; color: #fdba74; }
:root[data-theme="dark"] .theme-badge.business_pain { background: #4a1414; color: #fca5a5; }
:root[data-theme="dark"] .theme-badge.objection { background: #453306; color: #fde68a; }
:root[data-theme="dark"] .theme-badge.competitive_insight { background: #3b1d5e; color: #d8b4fe; }
:root[data-theme="dark"] .theme-badge.outcome_realised { background: #0a3d2e; color: #86efac; }
:root[data-theme="dark"] .theme-badge.validation { background: #172a54; color: #93c5fd; }
:root[data-theme="dark"] .theme-badge.operational { background: var(--color-surface-alt); color: var(--color-text-muted); }
:root[data-theme="dark"] .theme-badge.mixed { background: var(--color-border-strong); color: var(--color-text); }

:root[data-theme="dark"] .mv-high { background: #0a3d2e; }
:root[data-theme="dark"] .mv-medium { background: var(--color-surface-alt); color: var(--color-text); }
:root[data-theme="dark"] .mv-low { background: var(--color-surface-alt); }

:root[data-theme="dark"] .help-tip::after { background: #334155; }

:root[data-theme="dark"] .toast {
    border: 1px solid var(--color-border-strong);
    border-left-width: 4px;
}

.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 3rem 1.5rem;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.loading-state .loading-spinner {
    opacity: 1;
    margin-left: 0;
    width: 1.15rem;
    height: 1.15rem;
}
