:root {
    --newton-orange: #FF6223;
    --newton-orange-dark-1: #C93B02;
    --newton-orange-dark-2: #A83200;
    --newton-slate: #282D37;
    --newton-slate-light-1: #3B424F;
    --newton-slate-light-2: #595F6B;

    /* Light mode surfaces */
    --bg-main:        #FFFFFF;
    --bg-panel:       #F7F7F8;
    --bg-elevated:    #FFFFFF;
    --bg-subtle:      rgba(40,45,55,0.04);
    --bg-hover:       rgba(40,45,55,0.07);
    --border-subtle:  rgba(40,45,55,0.08);
    --border-medium:  rgba(40,45,55,0.15);
    --border-strong:  rgba(40,45,55,0.22);
    --text-primary:   #282D37;
    --text-secondary: rgba(40,45,55,0.75);
    --text-muted:     rgba(40,45,55,0.55);
    --text-faint:     rgba(40,45,55,0.40);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }

html {
    background: var(--bg-main);
}

body {
    font-family: 'Aptos', 'ES Klarheit Grotesk', system-ui, -apple-system, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    display: grid;
    grid-template-columns: 400px 1fr;
    height: 100vh;
    max-width: 1400px;
}

/* ── Generic hidden utility ── */
.hidden { display: none !important; }

/* ── Loading overlay ── */
#page-loading {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-main);
    z-index: 200;
}
#page-loading span {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-family: inherit;
    letter-spacing: 0.04em;
}

/* ── Left panel ── */
.left-panel {
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 36px 28px 28px;
    gap: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--border-subtle);
    min-width: 0;
}
.left-panel::-webkit-scrollbar { width: 4px; }
.left-panel::-webkit-scrollbar-track { background: transparent; }
.left-panel::-webkit-scrollbar-thumb { background: rgba(40,45,55,0.15); border-radius: 2px; }
.left-panel::-webkit-scrollbar-thumb:hover { background: rgba(40,45,55,0.25); }

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    flex-shrink: 0;
}
.logo img {
    height: 24px;
    opacity: 0.9;
    display: block;
}
.logo a:focus-visible { outline: 2px solid rgba(40,45,55,0.4); outline-offset: 3px; border-radius: 3px; }

/* ── Form section (pre-call) ── */
.form-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.form-intro {
    text-align: center;
    padding-bottom: 4px;
}

.form-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.form-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.5;
}

/* ── Field groups ── */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.field-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.field-label .optional-tag {
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    color: var(--newton-orange);
    margin-left: 6px;
}

.field-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field-input::placeholder { color: var(--text-faint); }
.field-input:focus {
    border-color: var(--newton-orange);
    box-shadow: 0 0 0 3px rgba(255,98,35,0.12);
}

.field-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.55;
}

/* ── Orb section (during call) ── */
.orb-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    flex: 1;
    justify-content: center;
}

/* ── Call timer ── */
.call-timer {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    font-family: 'Aptos Mono', 'Courier New', monospace;
}

/* ── Orb ── */
.orb-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 4px 0;
}

.orb-ring {
    position: absolute;
    border-radius: 50%;
    background: var(--newton-orange);
    will-change: transform, opacity;
}
.orb-ring-3 { width: 200px; height: 200px; opacity: 0.08; }
.orb-ring-2 { width: 160px; height: 160px; opacity: 0.14; }
.orb-ring-1 { width: 128px; height: 128px; opacity: 0.24; }

.orb-core {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 34%, #FF8A50, var(--newton-orange-dark-2));
    position: relative;
    z-index: 4;
    will-change: transform;
    box-shadow: 0 0 32px rgba(255,98,35,0.30);
    transition: box-shadow 0.4s ease;
}

/* ── Waveform canvas ── */
#waveform-canvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    border-radius: 50%;
}

/* ── Ripple on connect ── */
.orb-ripple {
    position: absolute;
    width: 90px; height: 90px;
    border-radius: 50%;
    border: 2px solid rgba(255,98,35,0.7);
    pointer-events: none;
    z-index: 2;
    animation: ripple-out 0.9s ease-out forwards;
}
.orb-ripple:nth-child(2) { animation-delay: 0.18s; }
.orb-ripple:nth-child(3) { animation-delay: 0.36s; }
@keyframes ripple-out {
    0%   { transform: scale(1);   opacity: 0.7; }
    100% { transform: scale(2.6); opacity: 0;   }
}

/* ── Idle: slow gentle breathe ── */
.orb-wrapper.idle .orb-core    { animation: breathe 4s ease-in-out infinite; }
.orb-wrapper.idle .orb-ring-1  { animation: breathe 4s ease-in-out infinite 0.15s; }
.orb-wrapper.idle .orb-ring-2  { animation: breathe 4s ease-in-out infinite 0.3s; }
.orb-wrapper.idle .orb-ring-3  { animation: breathe 4s ease-in-out infinite 0.45s; }
@keyframes breathe {
    0%,100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

/* ── Connecting: quicker pulse ── */
.orb-wrapper.connecting .orb-core   { animation: breathe 1.4s ease-in-out infinite; }
.orb-wrapper.connecting .orb-ring-1 { animation: breathe 1.4s ease-in-out infinite 0.15s; }
.orb-wrapper.connecting .orb-ring-2 { animation: breathe 1.4s ease-in-out infinite 0.3s; }
.orb-wrapper.connecting .orb-ring-3 { animation: breathe 1.4s ease-in-out infinite 0.45s; }

/* ── Listening ── */
.orb-wrapper.listening .orb-core   { animation: listen 2.8s ease-in-out infinite; }
.orb-wrapper.listening .orb-ring-1 { animation: listen 2.8s ease-in-out infinite 0.12s; }
.orb-wrapper.listening .orb-ring-2 { animation: listen 2.8s ease-in-out infinite 0.24s; }
.orb-wrapper.listening .orb-ring-3 { animation: listen 2.8s ease-in-out infinite 0.36s; }
@keyframes listen {
    0%,100% { transform: scale(1); }
    50%      { transform: scale(1.07); }
}

/* ── Thinking ── */
.orb-wrapper.thinking .orb-core   { animation: think 1.1s ease-in-out infinite; }
.orb-wrapper.thinking .orb-ring-1 { animation: think 1.1s ease-in-out infinite 0.18s; }
.orb-wrapper.thinking .orb-ring-2 { animation: think 1.1s ease-in-out infinite 0.36s; }
.orb-wrapper.thinking .orb-ring-3 { animation: think 1.1s ease-in-out infinite 0.54s; }
@keyframes think {
    0%,100% { transform: scale(1); }
    35%      { transform: scale(1.06); }
    65%      { transform: scale(0.97); }
}

/* ── Speaking ── */
.orb-wrapper.speaking .orb-core   { animation: speak 0.65s ease-in-out infinite; box-shadow: 0 0 48px rgba(255,98,35,0.55); }
.orb-wrapper.speaking .orb-ring-1 { animation: speak 0.65s ease-in-out infinite 0.1s; }
.orb-wrapper.speaking .orb-ring-2 { animation: speak 0.65s ease-in-out infinite 0.2s; }
.orb-wrapper.speaking .orb-ring-3 { animation: speak 0.65s ease-in-out infinite 0.3s; }
@keyframes speak {
    0%,100% { transform: scale(1); }
    50%      { transform: scale(1.12); }
}

/* ── Mic-active: JS drives animation ── */
.orb-wrapper.mic-active .orb-core,
.orb-wrapper.mic-active .orb-ring { animation: none; }

/* ── Status text ── */
.status-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
    letter-spacing: 0.02em;
    min-height: 18px;
    transition: opacity 0.4s ease;
}

/* ── Controls ── */
.controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── Disclaimer ── */
.disclaimer {
    width: 100%;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.55;
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
    margin-top: 4px;
}
.disclaimer-intro {
    margin-bottom: 6px;
}
.disclaimer ul {
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.error-message {
    background: rgba(255,98,35,0.08);
    color: var(--newton-orange-dark-2);
    padding: 10px 14px;
    border-radius: 8px;
    border-left: 3px solid var(--newton-orange);
    font-size: 12px;
    line-height: 1.5;
}

.btn-start {
    width: 100%;
    padding: 14px;
    background: var(--newton-orange);
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.btn-start:hover:not(:disabled) { background: var(--newton-orange-dark-1); }
.btn-start:active:not(:disabled) { transform: scale(0.98); }
.btn-start:focus-visible { outline: 2px solid rgba(255,98,35,0.5); outline-offset: 2px; border-radius: 8px; }
.btn-start:disabled { background: rgba(40,45,55,0.08); color: rgba(40,45,55,0.30); cursor: not-allowed; }

/* ── Start options: voice or chat ── */
.start-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.btn-start-secondary {
    background: transparent;
    color: var(--newton-orange-dark-1);
    border: 1px solid var(--newton-orange);
}
.btn-start-secondary:hover:not(:disabled) {
    background: rgba(255,98,35,0.07);
    color: var(--newton-orange-dark-1);
}
.btn-start-secondary:disabled {
    background: transparent;
    border-color: var(--border-medium);
    color: rgba(40,45,55,0.30);
}

.start-options-hint {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    text-align: center;
}

.btn-end {
    width: 100%;
    padding: 14px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn-end:hover { background: var(--bg-subtle); border-color: var(--border-strong); }
.btn-end:active { transform: scale(0.98); }
.btn-end:focus-visible { outline: 2px solid rgba(40,45,55,0.4); outline-offset: 2px; border-radius: 8px; }

/* ── Analysis panel ── */
.analysis-panel {
    width: 100%;
    display: none;
    flex-direction: column;
    gap: 12px;
}
.analysis-panel.visible { display: flex; }

.analysis-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    font-weight: 700;
}
.analysis-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
}
.analysis-loading-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: pulse 1s infinite;
    flex-shrink: 0;
}
.analysis-error { font-size: 12px; color: var(--text-secondary); }
.analysis-group { display: flex; flex-direction: column; gap: 6px; }

/* ── Staggered analysis reveal ── */
.criterion-item, .datapoint-item {
    opacity: 0;
    transform: translateY(6px);
    animation: item-enter 0.35s ease forwards;
}
@keyframes item-enter {
    to { opacity: 1; transform: translateY(0); }
}

.criterion-item {
    padding: 10px 12px;
    background: var(--bg-subtle);
    border-radius: 6px;
    border-left: 2px solid var(--border-medium);
}
.criterion-item.success { border-left-color: #16A34A; }
.criterion-item.failure { border-left-color: var(--newton-orange); }

.criterion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}
.criterion-name { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.criterion-badge {
    font-size: 9px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
}
.criterion-badge.success { background: rgba(22,163,74,0.15); color: #15803D; }
.criterion-badge.failure { background: rgba(255,98,35,0.15); color: var(--newton-orange-dark-1); }
.criterion-badge.unknown { background: rgba(40,45,55,0.08); color: var(--text-secondary); }
.criterion-rationale { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

.datapoint-item {
    padding: 10px 12px;
    background: var(--bg-subtle);
    border-radius: 6px;
    border-left: 2px solid var(--border-medium);
    display: flex; flex-direction: column; gap: 2px;
}
.datapoint-name {
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em;
    color: var(--text-muted); font-weight: 700;
}
.datapoint-value {
    font-size: 13px; color: var(--text-secondary);
    font-family: 'Aptos Mono', 'Courier New', monospace;
}

/* ── Delete conversation ── */
.delete-section {
    width: 100%;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.delete-hint {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}
.btn-delete-conv {
    width: 100%;
    padding: 11px;
    background: transparent;
    color: #B91C1C;
    border: 1px solid rgba(185,28,28,0.30);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.btn-delete-conv:hover:not(:disabled) {
    background: rgba(185,28,28,0.06);
    border-color: rgba(185,28,28,0.50);
}
.btn-delete-conv:active:not(:disabled) { transform: scale(0.98); }
.btn-delete-conv:focus-visible { outline: 2px solid rgba(185,28,28,0.45); outline-offset: 2px; }
.btn-delete-conv:disabled { opacity: 0.6; cursor: wait; }
.btn-delete-conv.confirming {
    background: #B91C1C;
    color: #FFFFFF;
    border-color: #B91C1C;
}

/* ── Cookie link ── */
.cookie-link {
    background: none; border: none;
    color: var(--text-muted);
    font-size: 12px; font-family: inherit;
    cursor: pointer; padding: 0;
    text-decoration: underline;
    margin-top: auto;
    align-self: flex-start;
    flex-shrink: 0;
}
.cookie-link:hover { color: var(--text-primary); }
.cookie-link:focus-visible { outline: 2px solid rgba(40,45,55,0.4); outline-offset: 2px; border-radius: 2px; }

/* ── Right panel ── */
.right-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    position: relative;
    overflow: hidden;
}

/* ── Ambient background glow ── */
#ambient-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.7s ease, background 0.7s ease;
}
body.state-listening #ambient-bg {
    opacity: 1;
    background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(96,165,250,0.06) 0%, transparent 100%);
}
body.state-speaking #ambient-bg {
    opacity: 1;
    background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(255,98,35,0.08) 0%, transparent 100%);
}
body.state-thinking #ambient-bg {
    opacity: 1;
    background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(168,85,247,0.05) 0%, transparent 100%);
}

/* ── Transcript ── */
.transcript {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
    position: relative;
    z-index: 1;
}

.transcript::-webkit-scrollbar { width: 4px; }
.transcript::-webkit-scrollbar-track { background: transparent; }
.transcript::-webkit-scrollbar-thumb { background: rgba(40,45,55,0.15); border-radius: 2px; }

.transcript-empty {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 126px 48px 48px;
}

.welcome-block {
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}
.welcome-block p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.75;
}
.welcome-block strong {
    color: var(--text-primary);
    font-weight: 600;
}
.welcome-heading {
    font-size: 18px !important;
    font-weight: 600;
    color: var(--text-primary) !important;
    letter-spacing: -0.01em;
}
.welcome-tips {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 16px 18px;
}
.welcome-tips li {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.65;
    padding-left: 18px;
    position: relative;
}
.welcome-tips li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--newton-orange);
    font-size: 13px;
}
.welcome-tips em {
    font-style: italic;
    color: var(--text-primary);
}

.welcome-start-hint {
    font-size: 13px !important;
    color: var(--text-muted) !important;
    padding-top: 4px;
    border-top: 1px solid var(--border-subtle);
}

/* ── Scroll-to-latest ── */
#scroll-to-latest {
    position: absolute;
    bottom: 76px; right: 28px;
    background: #FFFFFF;
    color: var(--text-secondary);
    border: 1px solid var(--border-medium);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px; font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    opacity: 0; pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(40,45,55,0.08);
}
#scroll-to-latest.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
#scroll-to-latest:hover { background: var(--bg-panel); color: var(--text-primary); }
#scroll-to-latest:focus-visible { outline: 2px solid rgba(40,45,55,0.4); outline-offset: 2px; }

/* ── Message bubbles ── */
.message {
    display: flex;
    flex-direction: column;
    max-width: 78%;
    gap: 5px;
    opacity: 0;
    transform: translateY(10px);
    animation: msg-enter 0.3s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes msg-enter {
    to { opacity: 1; transform: translateY(0); }
}
.message.agent { align-self: flex-start; }
.message.user  { align-self: flex-end; align-items: flex-end; }

.message-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 4px;
}
.message-label {
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.07em;
    color: var(--text-secondary);
}
.message-time {
    font-size: 10px;
    color: var(--text-muted);
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.65;
    word-break: break-word;
    transition: background 1.4s ease, border-color 1.4s ease;
    border: 1px solid transparent;
}
.message.agent .message-bubble {
    background: var(--bg-subtle);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}
.message.user .message-bubble {
    background: var(--newton-orange);
    color: #FFFFFF;
    border-bottom-right-radius: 4px;
}

/* ── First agent message spotlight ── */
.message.first-agent .message-bubble {
    background: rgba(255,98,35,0.10);
    border-color: rgba(255,98,35,0.25);
}

/* ── Thinking bubble ── */
.thinking-msg {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-self: flex-start;
    opacity: 0;
    transform: translateY(10px);
    animation: msg-enter 0.3s cubic-bezier(0.22,1,0.36,1) forwards;
}
.thinking-bubble {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 13px 18px;
    background: var(--bg-subtle);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}
.thinking-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(40,45,55,0.45);
    animation: dot-bounce 1.3s ease-in-out infinite;
}
.thinking-dot:nth-child(2) { animation-delay: 0.18s; }
.thinking-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes dot-bounce {
    0%,80%,100% { transform: translateY(0); }
    40%          { transform: translateY(-5px); }
}

/* ── Transcript bottom bar ── */
.transcript-footer {
    padding: 16px 32px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
    background: var(--bg-main);
}

.btn-download, .btn-copy {
    flex: 1;
    padding: 11px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s, transform 0.1s;
}
.btn-download:hover, .btn-copy:hover { background: var(--bg-subtle); color: var(--text-primary); border-color: var(--border-strong); }
.btn-download:active, .btn-copy:active { transform: scale(0.98); }
.btn-download:focus-visible, .btn-copy:focus-visible { outline: 2px solid rgba(40,45,55,0.4); outline-offset: 2px; }

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ── Chat composer (chat mode only) ── */
.chat-composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 14px 32px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-main);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}
.chat-composer.hidden { display: none !important; }

.chat-input {
    flex: 1;
    resize: none;
    padding: 11px 14px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    /* 6 lines: (14px x 1.5) x 6 = 126, + 22 padding + 2 border. Grows to
       roughly 13 lines before scrolling, so long answers still fit. */
    min-height: 150px;
    max-height: 300px;
    outline: none;
    transition: border-color 0.15s;
}
.chat-input::placeholder { color: var(--text-faint); }
.chat-input:focus { border-color: var(--border-strong); }
.chat-input:focus-visible { outline: 2px solid rgba(255,98,35,0.4); outline-offset: 1px; }
.chat-input:disabled { background: var(--bg-subtle); cursor: not-allowed; }

.btn-send {
    padding: 11px 20px;
    background: var(--newton-orange);
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
}
.btn-send:hover:not(:disabled) { background: var(--newton-orange-dark-1); }
.btn-send:active:not(:disabled) { transform: scale(0.98); }
.btn-send:focus-visible { outline: 2px solid rgba(255,98,35,0.5); outline-offset: 2px; }
.btn-send:disabled { background: rgba(40,45,55,0.08); color: rgba(40,45,55,0.30); cursor: not-allowed; }

.chat-hint {
    font-size: 11px;
    color: var(--text-faint);
    padding: 0 32px 10px;
    background: var(--bg-main);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}
.chat-hint.hidden { display: none !important; }

/* ── Cookie modal ── */
.cookie-overlay {
    position: fixed; inset: 0;
    background: rgba(40,45,55,0.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 300;
}
.cookie-overlay.hidden { display: none !important; }

.cookie-modal {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 28px;
    max-width: 460px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 12px 32px rgba(40,45,55,0.20);
    border: 1px solid var(--border-subtle);
}
.cookie-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.cookie-modal-header h2 { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.cookie-modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 16px; padding: 4px 8px;
    font-family: inherit; border-radius: 4px;
}
.cookie-modal-close:hover { color: var(--text-primary); }
.cookie-modal-close:focus-visible { outline: 2px solid rgba(40,45,55,0.4); outline-offset: 2px; }
.cookie-modal-intro { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 14px; }
.cookie-item {
    background: var(--bg-subtle);
    border-radius: 8px; padding: 14px;
    border-left: 3px solid var(--newton-orange);
    margin-bottom: 14px;
}
.cookie-name {
    font-family: 'Aptos Mono', 'Courier New', monospace;
    font-size: 12px; font-weight: 700; color: var(--text-primary); margin-bottom: 5px;
}
.cookie-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.cookie-note { font-size: 11px; color: var(--text-secondary); line-height: 1.5; }
.cookie-policy-link { color: var(--newton-orange); text-decoration: underline; }
.cookie-policy-link:hover { color: var(--newton-orange-dark-1); }

/* ── Footer links + privacy notice ── */
.footer-links {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-top: auto;
    align-self: flex-start;
}

.footer-links .cookie-link { margin-top: 0; }

.privacy-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.privacy-link:hover { color: var(--text-primary); }
.privacy-link:focus-visible { outline: 2px solid rgba(40,45,55,0.4); outline-offset: 2px; border-radius: 2px; }

.privacy-modal {
    max-width: 640px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.privacy-modal-body {
    overflow-y: auto;
    flex: 1;
}

.privacy-section {
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.privacy-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.privacy-section h3 {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--newton-orange);
    margin: 0 0 8px;
}

.privacy-section p,
.privacy-section ul {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 6px;
}

.privacy-section ul { padding-left: 1.25rem; }
.privacy-section li { margin-bottom: 4px; }
.privacy-section strong { color: var(--text-primary); font-weight: 600; }

/* ── Toast notification ── */
.toast {
    position: fixed;
    bottom: 24px; right: 24px;
    background: var(--newton-slate);
    color: rgba(255,255,255,0.95);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid var(--newton-slate-light-1);
    box-shadow: 0 4px 16px rgba(40,45,55,0.20);
    transform: translateY(12px);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    z-index: 400;
    white-space: nowrap;
}
.toast.visible { opacity: 1; transform: translateY(0); }

/* ── Keyframes ── */
@keyframes pulse {
    0%,100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

/* ── Responsive ── */
@media (max-width: 768px) {
    html, body { overflow: auto; height: auto; }
    body {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto;
        height: auto; min-height: 100svh;
    }
    .left-panel {
        height: auto; overflow: visible;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }
    .orb-section { justify-content: flex-start; }
    .right-panel { min-height: 60vh; }
    .transcript { overflow-y: auto; min-height: 200px; }
    .transcript-footer { padding: 12px 16px; }
    .chat-composer { padding: 12px 16px; }
    .chat-hint { padding: 0 16px 8px; }
    #scroll-to-latest { bottom: 68px; right: 16px; }
    .toast { bottom: 16px; right: 16px; left: 16px; white-space: normal; text-align: center; }
}

/* ── prefers-reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .message, .thinking-msg { opacity: 1; transform: none; }
    .criterion-item, .datapoint-item { opacity: 1; transform: none; }
    #ambient-bg { display: none; }
    .orb-ripple { display: none; }
    #scroll-to-latest { transition: none; }
    .message.first-agent .message-bubble {
        background: rgba(255,98,35,0.10);
        border-color: rgba(255,98,35,0.25);
        transition: none;
    }
}
