:root {
    /* Royal Borough of Greenwich palette — royalgreenwich.gov.uk
       (the 'greenwich' theme overrides the LocalGov defaults in its own
       body block: accent red #dc3338, accent-2 navy #004483) */
    --gw-teal: #DC3338;          /* primary: branding block, buttons, accents */
    --gw-teal-dark-1: #CD2118;
    --gw-teal-dark-2: #A51B00;
    --gw-teal-light-1: #FCF4F2;
    --gw-teal-light-2: #F9C9BF;
    --gw-navy: #DC3338;          /* legacy alias — primary red */
    --gw-purple: #A51B00;        /* deep red: orb gradient, glow */
    --gw-light-blue: #F28C8F;    /* decorative only */
    --gw-charcoal: #0B0C0C;      /* body copy (grey-darkest) */
    --gw-grey: #383636;
    --gw-grey-light: #575252;
    --gw-border: #CFCBCB;
    --gw-bg: #FAF9F9;
    --gw-white: #FFFFFF;
    --gw-link: #004483;          /* accent-2 navy: links */
    --gw-link-light: #D9E9F8;
    --gw-focus: #FFD53F;         /* RBG focus yellow */
}

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

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

body {
    font-family: Arial, system-ui, -apple-system, sans-serif;
    font-size: 16px;
    background: var(--gw-bg);
    color: var(--gw-navy);
    display: grid;
    grid-template-columns: 400px 1fr;
    height: 100vh;
    transition: grid-template-columns 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 1400px;
}

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

/* ── Left panel ── */
.left-panel {
    background: var(--gw-white);
    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(--gw-border);
    min-width: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* ── Focus mode: collapse left panel ── */
body.focus-mode { grid-template-columns: 0px 1fr; }
body.focus-mode .left-panel { opacity: 0; visibility: hidden; pointer-events: none; }

.panel-header {
    width: 100%;
    padding-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Logos ── */
.logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    min-width: 0;
}
.council-logo {
    height: 56px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
    display: block;
}
.campaign-badge {
    height: 72px;
    width: 72px;
    object-fit: contain;
    display: block;
    border-radius: 50%;
    box-shadow: 0 6px 20px rgba(220,51,56,0.12);
    flex-shrink: 0;
}

/* ── Call timer ── */
.call-timer-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
    padding: 10px 14px;
    border: 1px solid var(--gw-border);
    border-left: 4px solid var(--gw-teal);
    border-radius: 3px;
    background: var(--gw-teal-light-1);
}
.call-timer-row.hidden { display: none; }
.call-timer-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gw-charcoal);
}
.call-timer {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--gw-charcoal);
    letter-spacing: 0.04em;
}

/* ── 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(--gw-navy);
    will-change: transform, opacity;
}
.orb-ring-3 { width: 200px; height: 200px; opacity: 0.05; }
.orb-ring-2 { width: 160px; height: 160px; opacity: 0.09; }
.orb-ring-1 { width: 128px; height: 128px; opacity: 0.16; }

.orb-core {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%,
        var(--gw-light-blue) 0%,
        rgba(242,140,143,0.85) 35%,
        var(--gw-purple) 100%);
    position: relative;
    z-index: 4;
    will-change: transform;
    box-shadow: 0 0 32px rgba(165,27,0,0.25);
    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(220,51,56,0.50);
    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: soft steady pulse ── */
.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: three-beat uneven pulse ── */
.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: energetic fast pulse ── */
.orb-wrapper.speaking .orb-core   { animation: speak 0.65s ease-in-out infinite; box-shadow: 0 0 48px rgba(165,27,0,0.40); }
.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, disable CSS ── */
.orb-wrapper.mic-active .orb-core,
.orb-wrapper.mic-active .orb-ring { animation: none; }

/* ── Status text ── */
.status-label {
    font-size: 15px;
    color: var(--gw-grey-light);
    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: 14px;
    color: var(--gw-grey);
    line-height: 1.7;
    border-top: 1px solid var(--gw-border);
    padding-top: 12px;
    margin-top: 4px;
}
.disclaimer.hidden { display: none; }
.disclaimer-intro { margin-bottom: 6px; }
.disclaimer ul {
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.error-message {
    background: rgba(220,51,56,0.08);
    color: var(--gw-charcoal);
    padding: 10px 14px;
    border-radius: 8px;
    border-left: 3px solid var(--gw-teal);
    font-size: 14px;
    line-height: 1.5;
}

.error-message .error-main {
    font-weight: 600;
}

.error-guidance {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.55;
    color: var(--gw-charcoal);
    opacity: 0.88;
}

.error-details {
    margin-top: 10px;
    font-size: 11px;
}
.error-details summary {
    cursor: pointer;
    color: var(--gw-teal);
    font-weight: 600;
    user-select: none;
    list-style: none;
    padding: 2px 0;
}
.error-details summary::-webkit-details-marker { display: none; }
.error-details summary::before {
    content: '▸';
    display: inline-block;
    width: 14px;
    transition: transform 0.15s;
}
.error-details[open] summary::before { content: '▾'; }

.error-details pre {
    margin-top: 8px;
    padding: 10px 12px;
    background: rgba(0,0,0,0.04);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--gw-charcoal);
}

.error-copy-btn {
    margin-top: 8px;
    padding: 6px 12px;
    background: transparent;
    color: var(--gw-teal);
    border: 1px solid rgba(220,51,56,0.30);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.error-copy-btn:hover {
    background: rgba(220,51,56,0.06);
    border-color: rgba(220,51,56,0.50);
}

.btn-start {
    width: 100%;
    padding: 16px;
    background: var(--gw-navy);
    color: var(--gw-white);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(220,51,56,0.20);
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.btn-start:hover:not(:disabled) {
    background: #CD2118;
    box-shadow: 0 4px 14px rgba(220,51,56,0.30);
    transform: translateY(-1px);
}
.btn-start:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.btn-start:focus-visible { outline: 2px solid var(--gw-navy); outline-offset: 3px; border-radius: 8px; }
.btn-start:disabled { background: rgba(220,51,56,0.20); color: rgba(255,255,255,0.55); cursor: not-allowed; box-shadow: none; }

.btn-end {
    width: 100%;
    padding: 14px;
    background: transparent;
    color: var(--gw-navy);
    border: 1.5px solid var(--gw-navy);
    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;
    display: none;
}
.btn-end:hover { background: rgba(220,51,56,0.05); }
.btn-end:active { transform: scale(0.98); }
.btn-end:focus-visible { outline: 2px solid var(--gw-navy); outline-offset: 3px; border-radius: 8px; }
.btn-end.confirming {
    background: rgba(255,180,0,0.10);
    color: rgba(160,110,0,0.9);
    border-color: rgba(200,140,0,0.35);
}

/* ── Chat-only secondary start button ── */
.btn-start-chat {
    width: 100%;
    padding: 14px;
    background: var(--gw-white);
    color: var(--gw-navy);
    border: 1.5px solid var(--gw-navy);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    margin-top: 4px;
}
.btn-start-chat:hover:not(:disabled) { background: rgba(220,51,56,0.05); }
.btn-start-chat:active:not(:disabled) { transform: scale(0.98); }
.btn-start-chat:focus-visible { outline: 2px solid var(--gw-navy); outline-offset: 3px; border-radius: 8px; }
.btn-start-chat:disabled { background: var(--gw-bg); color: rgba(220,51,56,0.30); border-color: rgba(220,51,56,0.15); cursor: not-allowed; }
.btn-start-chat.hidden { display: none; }

/* ── Cascading searchable dropdowns ── */
.dept-selects {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid var(--gw-border);
    padding-top: 16px;
}
.dept-selects.hidden { display: none; }

.dept-selects-heading {
    font-size: 16px;
    color: var(--gw-navy);
    line-height: 1.5;
}

.combobox-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
}

.combobox-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gw-navy);
}

.combobox { position: relative; width: 100%; }

.combobox-field {
    display: flex;
    align-items: center;
    border: 1.5px solid rgba(220,51,56,0.18);
    border-radius: 8px;
    background: var(--gw-white);
    transition: border-color 0.15s, box-shadow 0.15s;
    overflow: hidden;
}
.combobox-field:hover { border-color: rgba(220,51,56,0.35); }
.combobox.open .combobox-field,
.combobox-field:focus-within {
    border-color: var(--gw-navy);
    box-shadow: 0 0 0 3px rgba(220,51,56,0.10);
}
.combobox.disabled .combobox-field { background: var(--gw-bg); border-color: rgba(220,51,56,0.10); }

.combobox-input {
    flex: 1;
    padding: 10px 12px;
    border: none;
    outline: none;
    font-size: 16px;
    font-family: inherit;
    color: var(--gw-charcoal);
    background: transparent;
    cursor: pointer;
    min-width: 0;
}
.combobox-input:disabled { color: rgba(0,0,0,0.3); cursor: not-allowed; }
.combobox-input::placeholder { color: var(--gw-grey-light); }

.combobox-caret {
    flex-shrink: 0;
    padding: 0 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--gw-grey-light);
    display: flex;
    align-items: center;
    align-self: stretch;
    transition: color 0.15s, transform 0.2s;
}
.combobox-caret:hover:not(:disabled) { color: var(--gw-navy); }
.combobox-caret:disabled { cursor: not-allowed; }
.combobox.open .combobox-caret { transform: rotate(180deg); color: var(--gw-navy); }

.combobox-list {
    position: fixed;
    background: var(--gw-white);
    border: 1px solid var(--gw-border);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.10);
    max-height: 220px;
    overflow-y: auto;
    z-index: 500;
    display: none;
    padding: 4px 0;
    list-style: none;
}
.combobox.open .combobox-list { display: block; }
.combobox-list::-webkit-scrollbar { width: 4px; }
.combobox-list::-webkit-scrollbar-track { background: transparent; }
.combobox-list::-webkit-scrollbar-thumb { background: var(--gw-teal-light-2); border-radius: 2px; }

.combobox-option {
    padding: 10px 12px;
    font-size: 16px;
    color: var(--gw-navy);
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
}
.combobox-option:hover,
.combobox-option.highlighted {
    background: rgba(220,51,56,0.06);
    color: var(--gw-navy);
}
.combobox-option.selected { font-weight: 700; color: var(--gw-navy); background: rgba(220,51,56,0.10); }

.combobox-no-results {
    padding: 10px 12px;
    font-size: 16px;
    color: var(--gw-grey-light);
    font-style: italic;
}

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

.analysis-section-title {
    font-size: 12px;
    color: var(--gw-grey-light);
    font-weight: 700;
}
.analysis-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gw-grey-light);
    font-size: 13px;
}
.analysis-loading-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--gw-teal);
    animation: pulse 1s infinite;
    flex-shrink: 0;
}
.analysis-error { font-size: 12px; color: var(--gw-grey-light); }
.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(--gw-teal-light-1);
    border-radius: 6px;
    border-left: 2px solid var(--gw-border);
}
.criterion-item.success { border-left-color: #16A34A; }
.criterion-item.failure { border-left-color: #DC2626; }

.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(--gw-charcoal); }
.criterion-badge {
    font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 4px; flex-shrink: 0;
}
.criterion-badge.success { background: rgba(22,163,74,0.15); color: #15803D; }
.criterion-badge.failure { background: rgba(220,38,38,0.12); color: #B91C1C; }
.criterion-badge.unknown { background: rgba(0,0,0,0.07); color: var(--gw-grey); }
.criterion-rationale { font-size: 12px; color: var(--gw-grey); line-height: 1.5; }

.datapoint-item {
    padding: 10px 12px;
    background: var(--gw-teal-light-1);
    border-radius: 6px;
    border-left: 2px solid var(--gw-border);
    display: flex; flex-direction: column; gap: 2px;
}
.datapoint-name {
    font-size: 12px;
    color: var(--gw-grey-light); font-weight: 600;
}
.datapoint-value {
    font-size: 13px; color: var(--gw-charcoal);
    font-family: 'Courier New', monospace;
}

/* ── Correction notice ── */
.correction-notice {
    width: 100%;
    font-size: 11px;
    color: var(--gw-grey-light);
    line-height: 1.6;
    padding-top: 12px;
    border-top: 1px solid var(--gw-border);
}
.correction-notice p + p { margin-top: 4px; }
.correction-link { color: var(--gw-teal); text-decoration: underline; }
.correction-link:hover { color: var(--gw-teal-dark-1); }

.btn-delete-conv {
    display: none;
    margin-top: 8px;
    background: none;
    border: 1px solid var(--gw-border);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 11px;
    font-family: inherit;
    color: var(--gw-grey-light);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-delete-conv:hover:not(:disabled) { border-color: #dc2626; color: #dc2626; }
.btn-delete-conv:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Conversation ID box ── */
.conv-id-box {
    background: var(--gw-teal-light-1);
    border: 1px solid var(--gw-teal-light-2);
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.conv-id-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gw-grey-light);
}
.conv-id-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.conv-id-value {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--gw-charcoal);
    font-weight: 700;
    word-break: break-all;
    flex: 1;
}
.conv-id-copy {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gw-grey-light);
    padding: 3px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
.conv-id-copy:hover { color: var(--gw-teal); }
.conv-id-copy:focus-visible { outline: 2px solid var(--gw-teal); outline-offset: 2px; }
.conv-id-note {
    font-size: 11px;
    color: var(--gw-grey-light);
    line-height: 1.5;
    margin: 0;
}

/* ── Cookie link ── */
.cookie-link {
    background: none; border: none;
    color: var(--gw-grey-light);
    font-size: 11px; font-family: inherit;
    cursor: pointer; padding: 0;
    text-decoration: underline;
    margin-top: auto;
    align-self: flex-start;
}
.cookie-link:hover { color: var(--gw-charcoal); }
.cookie-link:focus-visible { outline: 2px solid var(--gw-teal); outline-offset: 2px; border-radius: 2px; }

/* ── Right panel ── */
.right-panel {
    display: flex;
    flex-direction: column;
    background: var(--gw-bg);
    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(242,140,143,0.07) 0%, transparent 100%);
}
body.state-speaking #ambient-bg {
    opacity: 1;
    background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(220,51,56,0.09) 0%, transparent 100%);
}
body.state-thinking #ambient-bg {
    opacity: 1;
    background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(165,27,0,0.05) 0%, transparent 100%);
}

/* ── Focus toggle ── */
/* ── Test mode badge (?test=1) ── */
.test-mode-badge {
    position: fixed;
    top: 12px; right: 56px;
    z-index: 50;
    padding: 4px 10px;
    background: var(--gw-focus);
    color: var(--gw-charcoal);
    border-radius: 4px;
    font-size: 13px; font-weight: 700;
    pointer-events: none;
}
.test-mode-badge[hidden] { display: none; }

#focus-toggle {
    position: absolute;
    top: 14px; right: 14px;
    background: none; border: none;
    color: rgba(0,0,0,0.25);
    cursor: pointer; padding: 7px;
    border-radius: 6px; z-index: 10;
    font-size: 13px; line-height: 1;
    transition: color 0.15s, background 0.15s;
}
#focus-toggle:hover { color: rgba(0,0,0,0.6); background: rgba(0,0,0,0.05); }
#focus-toggle:focus-visible { outline: 2px solid var(--gw-teal); outline-offset: 2px; }
#focus-toggle .icon-collapse { display: inline; }
#focus-toggle .icon-expand   { display: none; }
body.focus-mode #focus-toggle .icon-collapse { display: none; }
body.focus-mode #focus-toggle .icon-expand   { display: inline; }

/* ── Info panel ── */
.info-panel {
    position: absolute;
    inset: 0;
    background: var(--gw-white);
    z-index: 20;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.info-panel.hidden { display: none; }
.info-panel-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
}
.info-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    border-bottom: 1px solid var(--gw-border);
    flex-shrink: 0;
}
.info-panel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gw-charcoal);
}
.info-panel-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gw-grey-light);
    font-size: 16px;
    padding: 4px 8px;
    font-family: inherit;
    border-radius: 4px;
}
.info-panel-close:hover { color: var(--gw-charcoal); }
.info-panel-close:focus-visible { outline: 2px solid var(--gw-teal); outline-offset: 2px; }
.info-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
}
.info-panel-body::-webkit-scrollbar { width: 4px; }
.info-panel-body::-webkit-scrollbar-track { background: transparent; }
.info-panel-body::-webkit-scrollbar-thumb { background: var(--gw-teal-light-2); border-radius: 2px; }
.info-panel-body h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gw-purple);
    margin: 0 0 12px;
}
.info-panel-body h3 {
    font-size: 14px;
    color: var(--gw-purple);
    margin: 24px 0 8px;
    font-weight: 700;
}
.info-panel-body p,
.info-panel-body li {
    font-size: 14px;
    color: var(--gw-grey);
    line-height: 1.7;
}
.info-panel-body p { margin: 0 0 10px; }
.info-panel-body ul,
.info-panel-body ol {
    padding-left: 1.25rem;
    margin: 0 0 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.info-panel-body strong { color: var(--gw-charcoal); font-weight: 600; }
.info-panel-body a { color: var(--gw-teal); text-decoration: underline; }
.info-panel-body a:hover { color: var(--gw-teal-dark-1); }
.info-panel-body hr {
    border: none;
    border-top: 1px solid var(--gw-border);
    margin: 24px 0;
}
.info-panel-body em { font-style: italic; }

/* ── Info sheet link (footer) ── */
.info-sheet-link {
    background: none;
    border: none;
    color: var(--gw-grey-light);
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}
.info-sheet-link:hover { color: var(--gw-charcoal); }
.info-sheet-link:focus-visible { outline: 2px solid var(--gw-teal); outline-offset: 2px; border-radius: 2px; }

/* ── 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: var(--gw-teal-light-2); border-radius: 2px; }

.transcript-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gw-grey-light);
    font-size: 14px;
    text-align: center;
    padding: 48px;
    line-height: 1.7;
}

/* ── Scroll-to-latest ── */
#scroll-to-latest {
    position: absolute;
    bottom: 76px; right: 28px;
    background: var(--gw-white);
    color: var(--gw-grey);
    border: 1px solid var(--gw-border);
    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(0,0,0,0.08);
}
#scroll-to-latest.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
#scroll-to-latest:hover { background: var(--gw-teal-light-1); color: var(--gw-teal-dark-1); }
#scroll-to-latest:focus-visible { outline: 2px solid var(--gw-teal); 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: 12px; font-weight: 600;
    color: var(--gw-grey-light);
}
.message-time {
    font-size: 11px;
    color: var(--gw-grey-light);
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.65;
    word-break: break-word;
    white-space: pre-wrap;
    transition: background 1.4s ease, border-color 1.4s ease;
    border: 1px solid transparent;
}
.message.agent .message-bubble {
    background: var(--gw-white);
    color: var(--gw-charcoal);
    border-color: var(--gw-border);
    border-bottom-left-radius: 4px;
}
.message.user .message-bubble {
    background: var(--gw-teal);
    color: var(--gw-white);
    border-bottom-right-radius: 4px;
}

/* ── First agent message spotlight ── */
.message.first-agent .message-bubble {
    background: var(--gw-teal-light-1);
    border-color: var(--gw-teal-light-2);
}

/* ── 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(--gw-white);
    border: 1px solid var(--gw-border);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}
.thinking-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--gw-teal);
    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(--gw-border);
    flex-shrink: 0;
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
    background: var(--gw-white);
}

.btn-download, .btn-copy {
    flex: 1;
    padding: 11px;
    background: transparent;
    color: var(--gw-grey);
    border: 1px solid var(--gw-border);
    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(--gw-teal-light-1); color: var(--gw-teal-dark-1); border-color: var(--gw-teal); }
.btn-download:active, .btn-copy:active { transform: scale(0.98); }
.btn-download:focus-visible, .btn-copy:focus-visible { outline: 2px solid var(--gw-teal); outline-offset: 2px; }

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

.cookie-modal {
    background: var(--gw-white);
    border-radius: 12px;
    padding: 28px;
    max-width: 460px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
.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(--gw-charcoal); }
.cookie-modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--gw-grey-light); font-size: 16px; padding: 4px 8px;
    font-family: inherit; border-radius: 4px;
}
.cookie-modal-close:hover { color: var(--gw-charcoal); }
.cookie-modal-close:focus-visible { outline: 2px solid var(--gw-teal); outline-offset: 2px; }
.cookie-modal-intro { font-size: 13px; color: var(--gw-grey); line-height: 1.6; margin-bottom: 14px; }
.cookie-item {
    background: var(--gw-teal-light-1);
    border-radius: 8px; padding: 14px;
    border-left: 3px solid var(--gw-teal);
    margin-bottom: 14px;
}
.cookie-name {
    font-family: 'Courier New', monospace;
    font-size: 12px; font-weight: 700; color: var(--gw-charcoal); margin-bottom: 5px;
}
.cookie-desc { font-size: 12px; color: var(--gw-grey); line-height: 1.5; }
.cookie-note { font-size: 11px; color: var(--gw-grey-light); line-height: 1.5; }
.cookie-policy-link { color: var(--gw-teal); text-decoration: underline; }
.cookie-policy-link:hover { color: var(--gw-teal-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(--gw-grey-light);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.privacy-link:hover { color: var(--gw-grey); }
.privacy-link:focus-visible { outline: 2px solid var(--gw-teal); outline-offset: 2px; border-radius: 2px; }

.report-issue-link {
    color: var(--gw-grey-light);
    font-size: 12px;
    font-family: inherit;
    text-decoration: underline;
}
.report-issue-link:hover { color: var(--gw-grey); }
.report-issue-link:focus-visible { outline: 2px solid var(--gw-teal); 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(--gw-border);
}

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

.privacy-section h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--gw-purple);
    margin: 0 0 8px;
}

.privacy-section p,
.privacy-section ul {
    font-size: 13px;
    color: var(--gw-grey);
    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(--gw-charcoal); font-weight: 600; }

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

/* ── Toast notification ── */
.toast {
    position: fixed;
    bottom: 24px; right: 24px;
    background: var(--gw-charcoal);
    color: rgba(255,255,255,0.9);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    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); }

/* ── Conversation text input (shown during active call) ── */
.right-panel.has-input .transcript-footer { padding: 0; min-height: 0; }

.conv-input-area {
    width: 100%;
    display: flex;
    align-items: flex-end;
    padding: 14px 24px;
    gap: 12px;
    background: var(--gw-bg);
}
.conv-input-area.hidden { display: none; }

.text-msg-input {
    flex: 1;
    min-height: 76px;
    max-height: 200px;
    padding: 12px 16px;
    border: 1px solid var(--gw-border);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--gw-charcoal);
    background: var(--gw-white);
    resize: none;
    outline: none;
    line-height: 1.55;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    overflow-y: auto;
}
.text-msg-input:focus {
    border-color: var(--gw-teal);
    background: var(--gw-white);
    box-shadow: 0 0 0 3px rgba(220,51,56,0.08);
}
.text-msg-input::placeholder { color: var(--gw-grey-light); }

.btn-send-msg {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: var(--gw-teal);
    color: var(--gw-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
    transition: background 0.15s, transform 0.1s;
}
.btn-send-msg:hover:not(:disabled) { background: var(--gw-teal-dark-1); }
.btn-send-msg:active:not(:disabled) { transform: scale(0.95); }
.btn-send-msg:disabled { background: rgba(0,0,0,0.08); color: rgba(0,0,0,0.25); cursor: not-allowed; }
.btn-send-msg:focus-visible { outline: 2px solid var(--gw-teal); outline-offset: 2px; border-radius: 12px; }

/* Adjust scroll-to-latest when text input is visible */
.right-panel.has-input #scroll-to-latest { bottom: 120px; }

/* ── 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;
        transition: none;
    }
    .left-panel {
        height: auto; overflow: visible;
        border-right: none;
        border-bottom: 1px solid var(--gw-border);
    }
    .right-panel { min-height: 60vh; }
    .transcript { overflow-y: auto; min-height: 200px; }
    .transcript-footer { padding: 12px 16px; }
    #focus-toggle { display: none; }
    .test-mode-badge { right: 12px; }
    #scroll-to-latest { bottom: 68px; right: 16px; }
    .toast { bottom: 16px; right: 16px; left: 16px; white-space: normal; text-align: center; }
    .conv-input-area { padding: 10px 16px; }
    .right-panel.has-input #scroll-to-latest { bottom: 112px; }
}

/* ── 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: var(--gw-teal-light-1);
        border-color: var(--gw-teal-light-2);
        transition: none;
    }
}

/* ══════════════════════════════════════════════════════════════════
   Royal Greenwich layout — purple branding block, 4px radii,
   GDS-style yellow focus, navy links. Taken from the live theme.
   ══════════════════════════════════════════════════════════════════ */

body { font-family: 'Kantumruy Pro', roboto, oxygen, ubuntu, cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; }

.left-panel { padding: 0 0 24px; gap: 18px; }

/* ── Branding: white logo on the RBG purple block ── */
.panel-header {
    width: 100%;
    padding: 0;
    display: block;
    border-top: 6px solid var(--gw-teal-dark-1);
}
.logos {
    display: block;
    background: var(--gw-teal);
    padding: 18px 28px;
    width: 100%;
}
.council-logo {
    height: 54px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
    display: block;
}

/* Everything below the branding block keeps the panel's own gutter */
.dept-selects,
.controls,
.disclaimer,
.analysis-panel,
.status-label,
.footer-links { padding-inline: 28px; }
.orb-wrapper { align-self: center; }

/* ── Controls ── */
.btn-start,
.btn-start-chat,
.btn-end {
    border-radius: 3px;
    font-size: 16px;
}
.btn-start {
    background: var(--gw-teal);
    border: 2px solid var(--gw-teal);
    box-shadow: none;
}
.btn-start:hover:not(:disabled) {
    background: var(--gw-teal-dark-1);
    border-color: var(--gw-teal-dark-1);
    box-shadow: none;
    transform: none;
}
.btn-start:disabled {
    background: #E5E1E1;
    border-color: #C8C3C3;
    color: #6A6565;
}
.btn-start-chat,
.btn-end {
    background: var(--gw-white);
    color: var(--gw-teal);
    border: 2px solid var(--gw-teal);
}
.btn-start-chat:hover:not(:disabled),
.btn-end:hover { background: var(--gw-teal-light-1); }
.btn-start-chat:disabled {
    background: var(--gw-white);
    color: #6A6565;
    border-color: #C8C3C3;
}

/* GDS-style focus: yellow block with a black underline */
.btn-start:focus-visible,
.btn-start-chat:focus-visible,
.btn-end:focus-visible,
.combobox-input:focus,
.info-panel-close:focus-visible,
.info-sheet-link:focus-visible,
.cookie-link:focus-visible,
.privacy-link:focus-visible,
.report-issue-link:focus-visible,
.btn-send-msg:focus-visible {
    outline: 3px solid var(--gw-focus);
    outline-offset: 0;
    box-shadow: 0 2px 0 2px var(--gw-charcoal);
}

/* ── Dropdowns ── */
.dept-selects {
    border-top: 1px solid var(--gw-border);
    padding-top: 18px;
}
.dept-selects-heading { color: var(--gw-charcoal); font-weight: 700; }
.combobox-label { color: var(--gw-charcoal); font-weight: 600; }
.combobox-field { border-radius: 3px; border-width: 2px; }
.combobox-list { border-radius: 3px; }
.select-hint {
    font-size: 13px;
    line-height: 1.5;
    color: var(--gw-grey);
    margin-top: 2px;
}

/* ── Error message ── */
.error-message.hidden { display: none; }
.error-message { border-radius: 3px; }

/* ── Welcome block in the transcript ── */
.transcript-empty.welcome { display: block; align-items: initial; text-align: left; padding: 40px 8px; }
.welcome-block {
    max-width: 560px;
    margin: 0 auto;
}
.welcome-heading {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--gw-charcoal);
    margin: 0 0 18px;
    padding-bottom: 14px;
    border-bottom: 6px solid var(--gw-teal);
}
.welcome-block p {
    font-size: 16px;
    line-height: 1.6;
    color: var(--gw-charcoal);
    margin: 0 0 14px;
    text-align: left;
}
.welcome-block a { color: var(--gw-link); font-weight: 600; }

/* ── Info panel ── */
.info-panel-body h2 { color: var(--gw-charcoal); font-size: 19px; }
.info-panel-body h3 { color: var(--gw-charcoal); font-size: 16px; }
.info-panel-body p,
.info-panel-body li { color: var(--gw-charcoal); font-size: 15px; }
.info-panel-body a { color: var(--gw-link); }

/* ── Footer links: one size, baseline aligned ── */
.footer-links {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: start;
    justify-items: start;
    column-gap: 10px;
    width: 100%;
}
.footer-links .info-sheet-link,
.footer-links .cookie-link,
.footer-links .privacy-link,
.footer-links .report-issue-link {
    font-size: 12px;
    line-height: 1.35;
    text-align: left;
    color: var(--gw-grey);
    font-family: inherit;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    align-self: auto;
    text-decoration: underline;
    cursor: pointer;
}
.footer-links .info-sheet-link:hover,
.footer-links .cookie-link:hover,
.footer-links .privacy-link:hover,
.footer-links .report-issue-link:hover { color: var(--gw-charcoal); }

/* Screen-reader-only text */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Participant info now lives in a modal, so the card supplies the padding */
.privacy-modal-body.info-panel-body { padding: 0; }
.privacy-modal-body.info-panel-body > h2:first-child { margin-top: 0; }

/* ── Confirmation step ── */
.confirm-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    margin-bottom: 10px;
    background: var(--gw-teal-light-1);
    border: 1px solid var(--gw-border);
    border-radius: 3px;
}
.confirm-check input[type="checkbox"] {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin: 0;
    accent-color: var(--gw-teal);
    cursor: pointer;
}
.confirm-check input[type="checkbox"]:focus-visible {
    outline: 3px solid var(--gw-focus);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--gw-charcoal);
}
.confirm-check label {
    font-size: 15px;
    line-height: 1.5;
    color: var(--gw-charcoal);
    cursor: pointer;
}
.confirm-privacy-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--gw-link);
    text-decoration: underline;
    cursor: pointer;
}
.confirm-privacy-link:hover { color: var(--gw-teal-dark-1); }
.confirm-privacy-link:focus-visible {
    outline: 3px solid var(--gw-focus);
    outline-offset: 0;
    box-shadow: 0 2px 0 2px var(--gw-charcoal);
}

.confirm-error {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--gw-teal-dark-2);
    padding: 10px 14px;
    margin-bottom: 10px;
    border-left: 4px solid var(--gw-teal);
    background: var(--gw-teal-light-1);
    border-radius: 0 3px 3px 0;
}
.confirm-error.hidden { display: none; }

.confirm-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}
.confirm-actions .btn-start,
.confirm-actions .btn-start-chat { margin-top: 0; }

.placeholder-contact {
    font-style: italic;
    color: var(--gw-grey);
}

/* Gated buttons keep aria-disabled rather than the disabled attribute so
   they stay focusable — they still have to look inert. */
.btn-start[aria-disabled="true"],
.btn-start[aria-disabled="true"]:hover {
    background: #E5E1E1;
    border-color: #C8C3C3;
    color: #6A6565;
    cursor: not-allowed;
    transform: none;
}
.btn-start-chat[aria-disabled="true"],
.btn-start-chat[aria-disabled="true"]:hover {
    background: var(--gw-white);
    color: #6A6565;
    border-color: #C8C3C3;
    cursor: not-allowed;
    transform: none;
}
