:root {
    --ink: #16212b;
    --muted: #607284;
    --line: rgba(22, 33, 43, 0.12);
    --panel: rgba(255, 252, 247, 0.92);
    --navy: #15324a;
    --blue: #2f6c8f;
    --mist: #d9e9f2;
    --apricot: #d98b52;
    --shadow: 0 24px 60px rgba(17, 31, 41, 0.16);
    --radius-xl: 28px;
    --radius-lg: 18px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Aptos, "Segoe UI Variable", Bahnschrift, "Trebuchet MS", sans-serif;
    color: var(--ink);
    margin: 14px 14px 10px;
        radial-gradient(circle at top left, rgba(217, 233, 242, 0.95), transparent 30%),
        radial-gradient(circle at top right, rgba(219, 231, 211, 0.9), transparent 26%),
        linear-gradient(180deg, #f8f3ec 0%, #efe5d8 100%);
}

    left: 14px;
    padding: 24px;
}

.page {
    max-width: 1500px;
    margin: 0 auto;
}

.canvas {
    background: rgba(255, 255, 255, 0.48);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: var(--shadow);
    border-radius: var(--radius-xl);
    overflow: hidden;
    position: relative;
}

.topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px;
    padding: 9px 14px;
    background: linear-gradient(135deg, var(--navy), #244e70);
    color: white;
    align-items: center;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-icon-btn,
.topbar-logout-btn {
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.08);
    color: #f6fbff;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
}

.topbar-icon-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    display: grid;
    place-items: center;
    font-size: 1rem;
}

.topbar-logout-btn {
    height: 34px;
    padding: 0 14px;
    font-size: 0.86rem;
}

.settings-modal-backdrop {
    position: fixed;
    inset: 0;
    border: 0;
    background: rgba(8, 19, 30, 0.28);
    z-index: 90;
}

.settings-modal {
    position: fixed;
    top: 74px;
    right: 22px;
    width: min(560px, calc(100vw - 32px));
    border-radius: 20px;
    border: 1px solid rgba(47, 108, 143, 0.24);
    background: linear-gradient(180deg, rgba(248, 252, 255, 0.98), rgba(236, 244, 252, 0.98));
    box-shadow: 0 24px 60px rgba(17, 31, 41, 0.22);
    z-index: 91;
    overflow: hidden;
}

.settings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid rgba(47, 108, 143, 0.12);
    color: #203c56;
}

.settings-modal-close {
    border: 0;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.74);
    color: #365879;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
}

.settings-modal-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 18px 0;
}

.settings-tab {
    border: 1px solid rgba(47, 108, 143, 0.18);
    border-radius: 999px;
    padding: 8px 14px;
    font: inherit;
    font-size: 0.84rem;
    color: #48627f;
    background: rgba(255, 255, 255, 0.76);
    cursor: pointer;
}

.settings-tab.is-active {
    background: rgba(208, 228, 248, 0.96);
    border-color: rgba(47, 108, 143, 0.4);
    color: #21425f;
    font-weight: 700;
}

.settings-modal-body {
    padding: 16px 18px 18px;
}

.settings-db-panel {
    border: 1px solid rgba(47, 108, 143, 0.16);
    border-radius: 34px;
    background: rgba(255, 255, 255, 0.66);
    padding: 28px 34px 24px;
}

.settings-db-form {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr) 138px;
    align-items: center;
    gap: 18px 22px;
}

.settings-db-label {
    color: #203c56;
    font-size: 0.88rem;
}

.settings-db-check-label {
    align-self: center;
}

.settings-db-input {
    width: 100%;
    height: 38px;
    border: 1px solid rgba(21, 50, 74, 0.18);
    background: #fff;
    border-radius: 4px;
    padding: 0 12px;
    font: inherit;
    color: #233b50;
}

.settings-db-check {
    justify-self: start;
    width: 22px;
    height: 22px;
    accent-color: #1e73be;
}

.settings-db-btn {
    height: 36px;
    border: 1px solid rgba(21, 50, 74, 0.18);
    border-radius: 8px;
    background: #fff;
    color: #23415c;
    font: inherit;
    cursor: pointer;
}

.settings-db-status {
    margin-top: 16px;
    color: #45627f;
    font-size: 0.82rem;
    white-space: pre-line;
}

.settings-mic-panel {
    padding: 22px 30px 20px;
}

.settings-mic-layout {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr) 154px;
    align-items: start;
    gap: 16px 18px;
}

.settings-mic-field-label {
    padding-top: 8px;
}

.settings-mic-select {
    appearance: auto;
}

.settings-mic-action-btn {
    width: 100%;
}

.settings-mic-volume-block {
    display: grid;
    gap: 8px;
    align-items: center;
    padding-top: 2px;
}

.settings-mic-test-wrap {
    display: grid;
    gap: 5px;
}

.settings-mic-test-label {
    color: #27435e;
    font-size: 0.8rem;
}

.settings-mic-test-track {
    height: 10px;
    border-radius: 999px;
    background: #d9e8f5;
    overflow: hidden;
    border: 1px solid rgba(23, 74, 120, 0.18);
}

.settings-mic-test-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #44b26f 0%, #5bcf83 45%, #d4d63f 75%, #f39e45 100%);
    transition: width 90ms linear;
}

.settings-mic-summary {
    color: #27435e;
    font-size: 0.85rem;
}

.settings-mic-slider {
    width: 100%;
    accent-color: #1980d8;
}

.settings-mic-status {
    margin-top: 14px;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand strong {
    font-size: 0.98rem;
    letter-spacing: 0.02em;
}

.brand span {
    font-size: 0.72rem;
    opacity: 0.86;
}

.layout {
    padding: 18px;
    display: grid;
    gap: 18px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.panel-left {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    height: 100%;
}

.agent-panel {
    min-height: 640px;
    gap: 12px;
}

.mcp-conn-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 999px;
    width: fit-content;
    border: 1px solid transparent;
}

.mcp-conn-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mcp-conn-checking {
    background: rgba(200, 200, 200, 0.25);
    color: #7a8a9a;
    border-color: rgba(120,130,150,0.2);
}
.mcp-conn-checking .mcp-conn-dot {
    background: #aab0bb;
    animation: mcp-pulse 1.2s ease-in-out infinite;
}

.mcp-conn-ok {
    background: rgba(40, 167, 100, 0.1);
    color: #1e7a4a;
    border-color: rgba(40,167,100,0.22);
}
.mcp-conn-ok .mcp-conn-dot { background: #28a764; }

.mcp-conn-error {
    background: rgba(200, 50, 50, 0.08);
    color: #9b2c2c;
    border-color: rgba(200,50,50,0.18);
}
.mcp-conn-error .mcp-conn-dot { background: #c83232; }

@keyframes mcp-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.agent-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.button {
    border: 0;
    border-radius: 999px;
    padding: 11px 16px;
    font: inherit;
    color: var(--ink);
    background: white;
    border: 1px solid rgba(21, 50, 74, 0.08);
}

.patient-id {
    width: auto;
    align-self: flex-start;
    text-align: left;
    font-size: 0.82rem;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(88, 110, 138, 0.28);
    background: linear-gradient(180deg, #edf3fb, #e3edf9);
    font-weight: 600;
}

.patient-id-input {
    width: 100%;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(88, 110, 138, 0.28);
    background: linear-gradient(180deg, #edf3fb, #e3edf9);
    padding: 0 46px 0 14px;
    font: inherit;
    font-size: 0.92rem;
    color: #24384d;
    font-weight: 600;
    transition: transform 0.2s ease, height 0.2s ease, font-size 0.2s ease, box-shadow 0.2s ease;
}

.patient-name-display {
    width: 100%;
    height: 42px;
    display: flex;
    align-items: center;
    padding: 0 46px 0 14px;
    border-radius: 999px;
    background: linear-gradient(180deg, #d6ecff, #c8e3f8);
    border: 1px solid rgba(47, 108, 143, 0.3);
    font-size: 0.92rem;
    color: #1a3347;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cpr-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.patient-id-shell {
    position: relative;
    flex: 1;
    min-width: 0;
    transition: width 0.24s ease;
}

.cpr-activate-btn,
.journal-ask-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #1a2f45;
    display: grid;
    place-items: center;
    padding: 0;
    cursor: pointer;
}

.cpr-inside-btn {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
}

.cpr-row.is-compact {
    width: auto;
}

.cpr-row.is-compact .patient-id-shell {
    flex: 0 0 auto;
    width: 172px;
}

.cpr-row.is-compact .patient-id-input {
    height: 36px;
    font-size: 0.82rem;
    padding-left: 12px;
}

.cpr-row.is-compact.is-expanded .patient-id-shell {
    width: 236px;
}

.cpr-row.is-compact.is-expanded .patient-id-input {
    height: 40px;
    font-size: 0.9rem;
}

.cpr-activate-btn:disabled,
.journal-ask-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.upload-icon {
    display: block;
    width: 16px;
    height: 16px;
    background-color: white;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5m-7 7 7-7 7 7'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5m-7 7 7-7 7 7'/%3E%3C/svg%3E");
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-position: center;
    -webkit-mask-position: center;
}

.patient-id-input:focus,
.search-line input:focus {
    outline: none;
    border-color: rgba(47, 108, 143, 0.45);
    box-shadow: 0 0 0 3px rgba(47, 108, 143, 0.12);
}

.patient-id-input:focus {
    transform: scale(1.03);
}

.left-bottom-stack {
    margin-top: auto;
    display: grid;
    gap: 8px;
}

.search-line input {
    width: 100%;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(21, 50, 74, 0.14);
    background: #f9fcff;
    padding: 0 44px 0 14px;
    color: #66778d;
    font-size: 0.96rem;
}

.search-line {
    position: relative;
}

.agent-search-line {
    position: relative;
    width: 100%;
}

.agent-search-input {
    width: 100%;
    min-width: 100%;
    height: 46px;
    border-radius: 999px;
    border: 1px solid rgba(21, 50, 74, 0.14);
    background: #f9fcff;
    padding: 0 42px;
    font: inherit;
    color: #66778d;
    font-size: 0.96rem;
}

.journal-mic {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(21, 50, 74, 0.14);
    border-radius: 50%;
    background: linear-gradient(180deg, #f8fcff, #eef5ff);
    color: #4f6689;
    display: grid;
    place-items: center;
    padding: 0;
    flex-shrink: 0;
}

.journal-mic:disabled {
    opacity: 0.55;
    cursor: default;
}

.journal-mic.is-recording {
    border-color: rgba(51, 138, 79, 0.45);
    color: #2a7a48;
    animation: fp-recording-ring 1.6s ease-out infinite;
}

.journal-field-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.journal-field-btn-left {
    left: 6px;
}

.journal-field-btn-right {
    right: 6px;
}

.agent-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.agent-button-primary {
    background: linear-gradient(135deg, #dcecff, #cfe5ff);
    color: #204766;
    font-weight: 600;
}

.agent-button-secondary {
    background: rgba(255, 255, 255, 0.7);
    color: #4f647b;
}

.agent-status {
    min-height: 36px;
    border-radius: 12px;
    padding: 9px 11px;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(21, 50, 74, 0.08);
    color: #5c6f84;
    font-size: 0.84rem;
    line-height: 1.35;
}

.agent-status.ready {
    color: #245373;
    background: rgba(223, 239, 255, 0.78);
}

.agent-answer-buttons {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

.agent-answer-button {
    border: 1px solid rgba(47, 108, 143, 0.2);
    border-radius: 12px;
    padding: 9px 11px;
    text-align: left;
    font: inherit;
    font-size: 0.84rem;
    color: #2a4d6c;
    background: rgba(236, 245, 255, 0.78);
    cursor: pointer;
}

.agent-answer-button:hover {
    background: rgba(222, 237, 252, 0.88);
}

.agent-answer-button.is-active {
    background: rgba(204, 227, 252, 0.94);
    border-color: rgba(47, 108, 143, 0.35);
    color: #1f405d;
}

.journal-answer-modal-backdrop {
    position: fixed;
    inset: 0;
    border: 0;
    background: rgba(8, 19, 30, 0.28);
    z-index: 80;
}

.journal-answer-modal {
    position: fixed;
    z-index: 81;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(760px, calc(100vw - 32px));
    max-height: min(82vh, 860px);
    border-radius: 18px;
    border: 1px solid rgba(47, 108, 143, 0.22);
    background: linear-gradient(180deg, rgba(246, 251, 255, 0.98), rgba(235, 245, 255, 0.98));
    box-shadow: 0 22px 46px rgba(21, 50, 74, 0.24);
    display: grid;
    grid-template-rows: auto 1fr;
}

.journal-answer-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(47, 108, 143, 0.14);
    color: #1e3c58;
}

.journal-answer-modal-close {
    border: 0;
    border-radius: 10px;
    width: 30px;
    height: 30px;
    font-size: 1.1rem;
    line-height: 1;
    background: rgba(255, 255, 255, 0.7);
    color: #355879;
    cursor: pointer;
}

.journal-answer-modal-body {
    overflow: auto;
    padding: 14px 16px 16px;
    display: grid;
    gap: 10px;
}

.journal-result-section-title {
    margin-top: 4px;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #5a6f85;
    font-weight: 700;
}

.journal-result-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.journal-result-tab {
    border: 1px solid rgba(47, 108, 143, 0.2);
    border-radius: 999px;
    padding: 6px 11px;
    font: inherit;
    font-size: 0.78rem;
    color: #2a4d6c;
    background: rgba(255, 255, 255, 0.78);
    cursor: pointer;
}

.journal-result-tab.is-active {
    background: rgba(206, 226, 247, 0.95);
    border-color: rgba(47, 108, 143, 0.36);
    color: #1f405d;
}

.journal-result-list {
    display: grid;
    gap: 7px;
    max-height: 220px;
    overflow: auto;
    padding-right: 2px;
}

.journal-result-button {
    border: 1px solid rgba(47, 108, 143, 0.22);
    border-radius: 12px;
    padding: 9px 11px;
    font: inherit;
    font-size: 0.82rem;
    color: #264c6c;
    background: rgba(255, 255, 255, 0.86);
    cursor: pointer;
    text-align: left;
}

.journal-result-button:hover {
    background: rgba(237, 246, 255, 0.94);
}

.journal-result-button.is-active {
    background: rgba(208, 228, 248, 0.95);
    border-color: rgba(47, 108, 143, 0.38);
    color: #1f405d;
}

.journal-result-button-header {
    font-weight: 600;
    margin-bottom: 3px;
}

.journal-result-excerpt {
    font-size: 0.78rem;
    color: #4a6580;
    margin-top: 3px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.journal-show-more-btn {
    border: 1px dashed rgba(47, 108, 143, 0.35);
    border-radius: 10px;
    padding: 7px 12px;
    font: inherit;
    font-size: 0.81rem;
    color: #2e6a9e;
    background: rgba(237, 246, 255, 0.7);
    cursor: pointer;
    text-align: center;
    width: 100%;
    margin-top: 2px;
}

.journal-show-more-btn:hover {
    background: rgba(208, 228, 248, 0.9);
}

.note-detail-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 28, 50, 0.55);
    z-index: 90;
    border: none;
    appearance: none;
    cursor: default;
}

.note-detail-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 91;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 12px 48px rgba(10, 28, 50, 0.28);
    width: min(780px, 95vw);
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.note-detail-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(47, 108, 143, 0.15);
    gap: 12px;
}

.note-detail-modal-title {
    font-size: 0.97rem;
    font-weight: 700;
    color: #1a3c5a;
}

.note-detail-modal-meta {
    font-size: 0.8rem;
    color: #5c7a94;
    margin-top: 3px;
}

.note-detail-modal-body {
    padding: 16px 20px 20px;
    overflow-y: auto;
}

.note-detail-text {
    font-family: inherit;
    font-size: 0.86rem;
    line-height: 1.6;
    color: #1e3a52;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.journal-result-selected-card {
    margin-top: 2px;
}

.journal-result-empty {
    border: 1px dashed rgba(47, 108, 143, 0.22);
    border-radius: 12px;
    padding: 10px 12px;
    color: #5c6f84;
    font-size: 0.84rem;
    background: rgba(255, 255, 255, 0.58);
}

.journal-debug-panel {
    border: 1px solid rgba(47, 108, 143, 0.16);
    border-radius: 12px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.6);
}

.journal-debug-panel > summary {
    cursor: pointer;
    color: #315b7c;
    font-size: 0.82rem;
    font-weight: 700;
}

.journal-debug-grid {
    display: grid;
    gap: 4px;
    margin-top: 8px;
    font-size: 0.8rem;
    color: #3f5d79;
}

.journal-debug-diagnostics {
    margin: 8px 0 0;
    padding-left: 16px;
    color: #5e6f82;
    font-size: 0.79rem;
}

.journal-debug-json {
    margin-top: 8px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(47, 108, 143, 0.14);
    background: rgba(241, 248, 255, 0.76);
    color: #2b4d6d;
    font-size: 0.73rem;
    line-height: 1.35;
    max-height: 220px;
    overflow: auto;
    white-space: pre-wrap;
}

.agent-answer-card {
    display: grid;
    gap: 8px;
    border-radius: 16px;
    padding: 14px;
    background: linear-gradient(180deg, rgba(242, 248, 255, 0.95), rgba(232, 242, 252, 0.92));
    border: 1px solid rgba(47, 108, 143, 0.12);
}

.agent-answer-title {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #5a6f85;
    font-weight: 700;
}

.agent-answer-text {
    color: #203448;
    font-size: 0.92rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.agent-tool-chip {
    width: fit-content;
    border-radius: 999px;
    padding: 5px 10px;
    background: rgba(47, 108, 143, 0.12);
    color: #315b7c;
    font-size: 0.76rem;
    font-weight: 600;
}

.agent-results-list {
    display: grid;
    gap: 8px;
    overflow: auto;
    padding-right: 3px;
}

.agent-result-card {
    display: grid;
    gap: 5px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.54);
    border: 1px solid rgba(21, 50, 74, 0.08);
}

.agent-result-meta {
    color: #71839a;
    font-size: 0.74rem;
}

.agent-result-title {
    color: #1f3346;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.3;
}

.agent-result-text {
    color: #4a5f74;
    font-size: 0.82rem;
    line-height: 1.45;
    white-space: pre-wrap;
}

.left-divider {
    height: 1px;
    width: 100%;
    background: linear-gradient(90deg, rgba(21, 50, 74, 0.08), rgba(21, 50, 74, 0.24), rgba(21, 50, 74, 0.08));
    margin-top: 0;
    margin-bottom: 10px;
}

.left-menu-btn {
    border: 0;
    background: transparent;
    color: #5f7189;
    font: inherit;
    font-size: 1rem;
    text-align: left;
    padding: 6px 4px;
}

.divider-left {
    position: relative;
}

.divider-left::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(21, 50, 74, 0.06), rgba(47, 108, 143, 0.45), rgba(21, 50, 74, 0.06));
}

.focus-main-panel {
    min-height: 640px;
    display: flex;
    flex-direction: column;
    border: 0;
    background: transparent;
    border-radius: 0;
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0;
}

.editor {
    min-height: 320px;
    border-radius: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.focus-editor {
    min-height: 0;
    height: 100%;
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    padding-top: 16px;
    padding-bottom: 84px;
}

.focus-main-panel {
    position: relative;
    padding-top: 0;
}

.focus-main-panel.is-prompt-adjusting {
    padding-top: 0;
}

.mainframe-flip {
    position: relative;
    flex: 1;
    min-height: 0;
    perspective: 1300px;
    transform-style: preserve-3d;
}

.mainframe-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    transition: transform 380ms ease, opacity 260ms ease;
}

.mainframe-face-front {
    transform: rotateY(0deg);
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.mainframe-face-back {
    transform: rotateY(180deg);
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
    overflow: hidden;
}

.mainframe-flip.is-flipped .mainframe-face-front {
    transform: rotateY(-180deg);
    opacity: 0;
    pointer-events: none;
}

.mainframe-flip:not(.is-flipped) .mainframe-face-back {
    pointer-events: none;
}

.mainframe-flip.is-flipped .mainframe-face-back {
    transform: rotateY(0deg);
}

.prompt-adjustment-shell {
    display: block;
    height: 100%;
    min-height: 0;
}

.prompt-sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 2px;
}

.prompt-mode-cpr-label {
    flex: 1;
    min-width: 0;
    height: 42px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 999px;
    background: linear-gradient(180deg, #edf3fb, #e3edf9);
    border: 1px solid rgba(88, 110, 138, 0.28);
    font-size: 0.92rem;
    color: #24384d;
    font-weight: 600;
}

.prompt-sidebar-helper {
    margin-top: 18px;
    color: #5a6f88;
    font-size: 0.83rem;
    line-height: 1.45;
    padding: 0 4px;
}

.prompt-adjustment-nav-btn {
    border: 1px solid rgba(21, 50, 74, 0.14);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
    color: #4e637d;
    font: inherit;
    font-size: 0.86rem;
    text-align: left;
    padding: 8px 10px;
    cursor: pointer;
}

.prompt-adjustment-nav-btn.is-active {
    border-color: rgba(47, 108, 143, 0.34);
    background: linear-gradient(180deg, #e8f3ff, #dfedff);
    color: #264d6e;
    font-weight: 600;
}

.prompt-adjustment-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    min-height: 0;
    overflow: auto;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(95, 116, 143, 0.3) transparent;
}

.prompt-adjustment-right::-webkit-scrollbar {
    width: 6px;
}

.prompt-adjustment-right::-webkit-scrollbar-track {
    background: transparent;
}

.prompt-adjustment-right::-webkit-scrollbar-thumb {
    background: rgba(95, 116, 143, 0.3);
    border-radius: 999px;
}

.prompt-adjustment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(21, 50, 74, 0.14);
}

.prompt-adjustment-header strong {
    font-size: 0.94rem;
    color: #1f374f;
}

.prompt-adjustment-close {
    border: 1px solid rgba(21, 50, 74, 0.2);
    border-radius: 999px;
    background: linear-gradient(180deg, #fcfeff, #eef4ff);
    color: #3f5873;
    font: inherit;
    font-size: 0.82rem;
    padding: 6px 12px;
    cursor: pointer;
}

.prompt-adjustment-sliders {
    display: grid;
    gap: 14px;
    max-width: 520px;
}

.prompt-adjustment-slider-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #4a6079;
    font-size: 0.86rem;
    font-weight: 600;
}

.prompt-adjustment-sliders input[type="range"] {
    width: 100%;
    accent-color: #2f6c8f;
}

.prompt-adjustment-example {
    margin-top: -6px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(21, 50, 74, 0.12);
    background: rgba(239, 246, 255, 0.65);
    color: #4d6179;
    font-size: 0.82rem;
    line-height: 1.45;
}

.prompt-adjustment-sql-title {
    margin-top: -6px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #3f5770;
}

.prompt-adjustment-sql-text {
    margin-top: -8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(47, 108, 143, 0.24);
    background: rgba(227, 240, 255, 0.7);
    color: #3f5570;
    font-size: 0.82rem;
    line-height: 1.45;
    white-space: pre-wrap;
}

.prompt-adjustment-save-status {
    margin-top: 2px;
    font-size: 0.78rem;
    color: #4d6179;
}

.prompt-adjustment-save-status.is-saving {
    color: #2f6c8f;
}

.prompt-record-meta {
    font-size: 0.82rem;
    color: #5c6f86;
    margin-top: -4px;
}

.prompt-record-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.prompt-record-field {
    border: 1px solid rgba(21, 50, 74, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.78);
    padding: 10px;
    min-height: 74px;
}

.prompt-record-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #405670;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.prompt-record-value {
    font-size: 0.81rem;
    color: #51667e;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

.prompt-adjustment-placeholder {
    border: 1px dashed rgba(21, 50, 74, 0.2);
    border-radius: 12px;
    padding: 16px;
    color: #62758d;
    font-size: 0.86rem;
}

.mainframe-top-divider {
    height: 1px;
    width: auto;
    background: linear-gradient(90deg, rgba(21, 50, 74, 0.08), rgba(21, 50, 74, 0.24), rgba(21, 50, 74, 0.08));
    margin: 0 14px 10px;
}

.mainframe-top-controls {
    position: relative;
    margin: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    z-index: 3;
}

.ny-session-inside {
    position: static;
    z-index: 2;
    font-size: 0.82rem;
    padding: 7px 11px;
}

.consultation-mic {
    position: absolute;
    overflow: hidden;
    z-index: 3;
    border: 1px solid rgba(88, 110, 138, 0.28);
    background: linear-gradient(180deg, #edf3fb, #e3edf9);
    color: #2f4b65;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0;
    font-size: 0.82rem;
    padding: 7px 12px;
    transition: top 260ms ease, left 260ms ease, transform 260ms ease, box-shadow 260ms ease;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.consultation-mic.docked {
    position: static;
    transform: translate(0, 0);
}

.consultation-mic::before {
    content: "";
    position: absolute;
    inset: 0;
    width: var(--mic-fill, 0%);
    background: linear-gradient(90deg, rgba(67, 170, 98, 0.8), rgba(67, 170, 98, 0.55));
    transition: width 80ms linear;
}

.consultation-mic.is-recording {
    border-color: rgba(51, 138, 79, 0.45);
}

.consultation-mic,
.consultation-mic::before {
    border-radius: 999px;
}

.consultation-mic {
    isolation: isolate;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.consultation-mic span {
    position: relative;
    z-index: 1;
}

.transcript-inline {
    border: 1px solid rgba(21, 50, 74, 0.08);
    background: rgba(255, 255, 255, 0.32);
    border-radius: 12px;
    padding: 8px 12px;
    margin-bottom: 14px;
    color: #4f6078;
    font-size: 0.93rem;
}

.transcript-inline.is-text-mode {
    border-color: rgba(21, 50, 74, 0.06);
    background: rgba(255, 255, 255, 0.2);
}

.transcript-inline.narrow {
    width: 66.666%;
    position: absolute;
    top: 62px;
    left: 14px;
    margin: 0;
}

.transcript-indicator-wrap {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    min-height: 40px;
}

.transcript-toprow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.transcript-status {
    font-size: 0.8rem;
    color: #5e728a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transcript-mode-toggle {
    border: 1px solid rgba(21, 50, 74, 0.14);
    background: linear-gradient(180deg, #fcfeff, #f0f6ff);
    color: #486180;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.78rem;
    line-height: 1.1;
    cursor: pointer;
}

.transcript-text {
    border: 1px solid rgba(21, 50, 74, 0.08);
    background: rgba(255, 255, 255, 0.28);
    border-radius: 10px;
    padding: 8px 10px;
    color: #3f5268;
    font-size: 0.85rem;
    line-height: 1.35;
    min-height: 32px;
    max-height: 96px;
    overflow: auto;
    scrollbar-width: thin;
}

.transcript-borderless {
    border: none;
    background: transparent;
    padding: 12px 14px;
    margin-bottom: 16px;
    margin-top: -8px;
}

.transcript-live-wrap {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    width: 33.333%;
    margin-right: auto;
}

.transcript-toggle-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    color: rgba(63, 82, 104, 0.3);
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 3px;
    margin-top: 1px;
    border-radius: 4px;
    transition: color 0.15s, transform 0.2s;
    transform: rotate(0deg);
}

.transcript-toggle-btn.is-collapsed {
    transform: rotate(180deg);
}

.transcript-toggle-btn:hover {
    color: rgba(63, 82, 104, 0.7);
}

.transcript-collapsed {
    display: none;
}

/* Conveyor belt: text grows right, JS scrolls to end, left edge fades once full */
.transcript-conveyor {
    overflow-x: scroll;
    white-space: nowrap;
    max-width: 100%;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.transcript-conveyor.is-overflowing {
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 22%);
    mask-image: linear-gradient(to right, transparent 0%, black 22%);
}

.transcript-conveyor::-webkit-scrollbar {
    display: none;
}

.transcript-conveyor-inner {
    display: inline;
}

.transcript-borderless .transcript-text {
    border: none;
    background: transparent;
    padding: 0;
    color: #3f5268;
    font-size: 0.95rem;
    line-height: 1.6;
    min-height: auto;
    max-height: none;
    flex: 1;
    min-width: 0;
}

.rtf-output {
    padding: 12px 14px;
    color: #16212b;
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.rtf-output strong {
    font-weight: 600;
}

.rtf-output em {
    font-style: italic;
}

.rtf-output u {
    text-decoration: underline;
}

.transcript-indicator {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 20px;
}

.transcript-indicator .wave {
    width: 4px;
    height: 8px;
    border-radius: 999px;
    background: rgba(47, 108, 143, 0.6);
}

.transcript-indicator.active .w1 {
    animation: wave 0.9s ease-in-out infinite;
}

.transcript-indicator.active .w2 {
    animation: wave 0.9s ease-in-out 0.1s infinite;
}

.transcript-indicator.active .w3 {
    animation: wave 0.9s ease-in-out 0.2s infinite;
}

.transcript-indicator.active .w4 {
    animation: wave 0.9s ease-in-out 0.3s infinite;
}

.transcript-indicator.active .w5 {
    animation: wave 0.9s ease-in-out 0.4s infinite;
}

.transcript-indicator.paused .wave {
    height: 6px;
    background: rgba(95, 116, 143, 0.35);
}

@keyframes wave {
    0%,
    100% {
        height: 6px;
        opacity: 0.45;
    }

    50% {
        height: 18px;
        opacity: 1;
    }
}

.editor .ghost-line {
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(21, 50, 74, 0.16), rgba(21, 50, 74, 0.04));
    margin-bottom: 12px;
}

.editor .ghost-line.short {
    width: 42%;
}

.editor .ghost-line.mid {
    width: 67%;
}

.editor .ghost-line.long {
    width: 88%;
}

.editor-output {
    margin-top: 8px;
    flex: 1;
    min-height: 0;
}

.editor-output textarea {
    width: 100%;
    height: 100%;
    min-height: 100%;
    border: 0;
    resize: vertical;
    background: transparent;
    color: var(--ink);
    font: inherit;
}

.editor-output textarea:focus {
    outline: none;
}

.editor-output .rtf-output {
    width: 100%;
    min-height: 100px;
    background: transparent;
}

.editor-controls-inline {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 16px;
    z-index: 20;
}

.editor-controls-inline.half-width {
    width: 67%;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
}

.plus-left-docked {
    position: absolute;
    left: 14px;
    bottom: 14px;
    z-index: 50;
}

.plus-outside {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(21, 50, 74, 0.12);
    border-radius: 50%;
    background: linear-gradient(180deg, #fbfdff, #f4f9ff);
    color: #4f6689;
    font-size: 1.3rem;
    line-height: 1;
}

.editor-search-inline {
    height: 46px;
    border-radius: 999px;
    border: 1px solid rgba(21, 50, 74, 0.12);
    background: #fbfdff;
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 8px;
    padding: 4px;
    justify-self: center;
    width: 100%;
}

.editor-search-inline-with-generate {
    position: relative;
    padding-right: 166px;
}

.mic-inside {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    display: grid;
    place-items: center;
    padding: 0;
}

.mic-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    background-color: currentColor;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M256 40c-57 0-103 46-103 103v133c0 57 46 103 103 103s103-46 103-103V143C359 86 313 40 256 40Z'/%3E%3Cpath d='M123 237c0-14-11-25-25-25s-25 11-25 25c0 93 69 170 158 183v34h-58c-14 0-25 11-25 25s11 25 25 25h166c14 0 25-11 25-25s-11-25-25-25h-58v-34c89-13 158-90 158-183 0-14-11-25-25-25s-25 11-25 25c0 89-72 161-161 161s-161-72-161-161Z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M256 40c-57 0-103 46-103 103v133c0 57 46 103 103 103s103-46 103-103V143C359 86 313 40 256 40Z'/%3E%3Cpath d='M123 237c0-14-11-25-25-25s-25 11-25 25c0 93 69 170 158 183v34h-58c-14 0-25 11-25 25s11 25 25 25h166c14 0 25-11 25-25s-11-25-25-25h-58v-34c89-13 158-90 158-183 0-14-11-25-25-25s-25 11-25 25c0 89-72 161-161 161s-161-72-161-161Z'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

.mic-icon::before {
    content: none;
}

.mic-icon::after {
    content: none;
}

.mic-icon-sm {
    width: 15px;
    height: 15px;
}

.editor-search-inline input {
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: #67798f;
    font-size: 0.95rem;
    padding-left: 14px;
    padding-right: 10px;
}

.generate-split {
    height: 36px;
    width: 154px;
    min-width: 154px;
    border: 1px solid rgba(21, 50, 74, 0.16);
    border-radius: 999px;
    background: linear-gradient(135deg, #edf5ff, #deebff);
    color: #3f5772;
    display: grid;
    grid-template-columns: 3fr 1fr;
    align-items: center;
    overflow: hidden;
    padding: 0;
}

.generate-split.has-selected {
    border-color: rgba(47, 108, 143, 0.42);
    box-shadow: 0 0 0 2px rgba(47, 108, 143, 0.14);
}

.generate-wrap {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 80;
    overflow: visible;
}

.generate-split .label {
    height: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: center;
    font-weight: 600;
    font: inherit;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, font-weight 150ms ease;
}

.generate-split.is-placeholder .label {
    color: #9aafbf;
    font-weight: 400;
}

.generate-split.has-selected .label {
    background: linear-gradient(180deg, #e8f3ff, #dfefff);
    color: #2f5373;
    font-weight: 600;
    font-size: 0.84rem;
}

.generate-split .chevron {
    height: 100%;
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
    display: grid;
    place-items: center;
    border-left: 1px solid rgba(21, 50, 74, 0.14);
    color: #6c7f9a;
    font-size: 0.95rem;
}

.popup-card {
    position: absolute;
    z-index: 60;
    border: 1px solid rgba(21, 50, 74, 0.14);
    border-radius: 14px;
    background: rgba(255, 252, 247, 0.96);
    box-shadow: 0 20px 46px rgba(17, 31, 41, 0.14);
    backdrop-filter: blur(10px);
    padding: 8px;
    pointer-events: auto;
}

.popup-backdrop {
    position: absolute;
    inset: 0;
    z-index: 10;
    border: 0;
    background: transparent;
    padding: 0;
    pointer-events: auto;
}

.popup-plus {
    left: 16px;
    bottom: 78px;
    width: 275px;
    padding: 6px;
}

.popup-prompts {
    right: 0;
    bottom: 44px;
    width: 152px;
    max-height: 400px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(95, 116, 143, 0.22) transparent;
}

.popup-prompts-inline {
    bottom: 0;
    right: 0;
    width: 228px;
    max-height: min(400px, 55vh);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(95, 116, 143, 0.22) transparent;
    padding: 8px;
}

.popup-prompts::-webkit-scrollbar,
.popup-prompts-inline::-webkit-scrollbar {
    width: 4px;
}

.popup-prompts::-webkit-scrollbar-track,
.popup-prompts-inline::-webkit-scrollbar-track {
    background: transparent;
}

.popup-prompts::-webkit-scrollbar-thumb,
.popup-prompts-inline::-webkit-scrollbar-thumb {
    background: rgba(95, 116, 143, 0.22);
    border-radius: 999px;
}

.popup-title {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8096b0;
    margin-bottom: 4px;
    padding: 2px 4px 6px;
    border-bottom: 1px solid rgba(21, 50, 74, 0.1);
}

.popup-item {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: #4a6280;
    font: inherit;
    text-align: center;
    padding: 6px 12px;
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    font-size: 0.86rem;
    transition: background 100ms ease, border-color 100ms ease;
}

.popup-item:last-child {
    margin-bottom: 0;
}

.popup-item:hover {
    background: rgba(47, 108, 180, 0.07);
    border-color: rgba(47, 108, 143, 0.14);
    color: #2f5070;
}

.popup-icon {
    color: #486180;
    font-size: 0.8rem;
}

.prompt-chip {
    width: 100%;
    border: 1px solid rgba(21, 50, 74, 0.12);
    border-radius: 999px;
    background: rgba(255,255,255,0.7);
    color: #4a6280;
    font: inherit;
    font-size: 0.86rem;
    text-align: center;
    padding: 6px 10px;
    margin-bottom: 7px;
    cursor: pointer;
    font-size: 0.86rem;
    transition: background 100ms ease, border-color 100ms ease;
}

.prompt-chip-row {
    position: relative;
}

.prompt-chip-row .prompt-chip {
    margin-bottom: 1px;
    padding-right: 36px;
}

.prompt-chip-settings {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(calc(-50% - 3px));
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #4f657f;
    font: inherit;
    font-size: 0.78rem;
    display: grid;
    place-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease, background-color 120ms ease;
}

.prompt-chip-row:hover .prompt-chip-settings,
.prompt-chip-row:focus-within .prompt-chip-settings {
    opacity: 1;
    pointer-events: auto;
}

.prompt-chip-settings:hover {
    background: rgba(95, 116, 143, 0.12);
}

/* Group header button */
.prompt-chip-group {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    background: rgba(21, 50, 74, 0.05) !important;
    border-color: rgba(21, 50, 74, 0.15) !important;
}

.prompt-group-arrow {
    font-size: 1rem;
    line-height: 1;
    display: inline-block;
    transition: transform 150ms ease;
    transform: rotate(90deg);
    color: #6a89a8;
}

.prompt-group-arrow.expanded {
    transform: rotate(-90deg);
}

/* Grouped child rows — indented */
.prompt-chip-row-grouped .prompt-chip {
    padding-left: 20px;
    font-size: 0.82rem;
    opacity: 0.9;
}

/* "Ny prompt" chip — always visible, muted style */
.prompt-chip-new {
    padding-right: 10px !important;
    border: 1px dashed rgba(79, 115, 151, 0.35) !important;
    color: #5a7fa0;
    margin-top: 6px;
    font-size: 0.83rem;
}

.prompt-chip-new:hover {
    background: rgba(79, 115, 151, 0.07) !important;
    border-color: rgba(79, 115, 151, 0.5) !important;
}

/* Editable name input in editor header */
.prompt-adjustment-name-input {
    flex: 1;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    color: #1a2e44;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(47, 108, 143, 0.3);
    border-radius: 8px;
    padding: 4px 10px;
    outline: none;
    min-width: 0;
}

.prompt-adjustment-name-input:focus {
    border-color: rgba(47, 108, 143, 0.65);
    background: #fff;
}

/* Editable textarea in Prompt tab (new-prompt mode) */
.prompt-record-textarea {
    width: 100%;
    font: inherit;
    font-size: 0.82rem;
    color: #1a2e44;
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(47,108,143,0.2);
    border-radius: 8px;
    padding: 6px 8px;
    resize: vertical;
    box-sizing: border-box;
}

.prompt-record-textarea:focus {
    outline: none;
    border-color: rgba(47,108,143,0.5);
    background: #fff;
}

/* Row of actions below the editable fields */
.prompt-new-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 0 4px;
}

.prompt-new-save-btn {
    width: 100%;
    padding: 9px 16px;
    background: linear-gradient(180deg, #3b7fcb, #2f6aad);
    color: #fff;
    border: none;
    border-radius: 10px;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 120ms ease;
}

.prompt-new-save-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.prompt-chip.is-selected {
    background: rgba(47, 108, 180, 0.1);
    border-color: rgba(47, 108, 143, 0.28);
    color: #2a4f72;
    font-weight: 600;
}

.popup-note {
    font-size: 0.82rem;
    color: #5f7088;
    padding: 8px 4px;
    line-height: 1.35;
}

.popup-note.error {
    color: #8c4b43;
}

.popup-retry {
    width: 100%;
    border: 1px solid rgba(21, 50, 74, 0.14);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.88);
    color: #4f657f;
    font: inherit;
    font-size: 0.82rem;
    padding: 7px 8px;
    cursor: pointer;
    margin-top: 4px;
}

.prompt-chip:hover {
    background: rgba(47, 108, 180, 0.07);
    border-color: rgba(47, 108, 143, 0.14);
    color: #2f5070;
}

.prompt-chip:last-child {
    margin-bottom: 0;
}

@media (max-width: 1000px) {
    body {
        padding: 12px;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .divider-left::before {
        display: none;
    }

    .focus-main-panel {
        min-height: 520px;
    }

    .prompt-adjustment-shell {
        display: block;
    }

    .prompt-record-grid {
        grid-template-columns: 1fr;
    }

    .prompt-sidebar-menu {
        flex-direction: row;
    }

    .transcript-inline.narrow,
    .editor-search-inline.half-width {
        width: 100%;
    }

    .settings-modal {
        top: 16px;
        right: 16px;
        left: 16px;
        width: auto;
    }

    .settings-db-form {
        grid-template-columns: 1fr;
    }

    .settings-mic-layout {
        grid-template-columns: 1fr;
    }
}

.topbar-user-pill {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.1);
    color: #f6fbff;
    font-size: 0.82rem;
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    cursor: pointer;
    transition: background 140ms ease, transform 120ms ease;
}

.topbar-user-pill:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* ── Login overlay (unauthenticated state) ─────────────────────────────── */
.auth-login-overlay {
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(4px);
}

.auth-login-box {
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(21, 50, 74, 0.12);
    box-shadow: 0 12px 40px rgba(21, 50, 74, 0.14);
    padding: 40px 44px;
    max-width: 420px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.auth-login-box strong {
    display: block;
    font-size: 1.1rem;
    color: #15324a;
}

.auth-login-box span {
    display: block;
    font-size: 0.875rem;
    color: #33495d;
    line-height: 1.5;
}

.auth-login-mitid-btn {
    margin-top: 12px;
    background: #15324a;
    color: #fff;
    border: none;
    border-radius: 999px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 11px 32px;
    cursor: pointer;
    transition: background 160ms ease, transform 120ms ease;
}

.auth-login-mitid-btn:hover {
    background: #1e4668;
    transform: translateY(-1px);
}

.auth-login-mitid-btn:active {
    transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Keyframes ─────────────────────────────────────────────────────────── */

@keyframes fp-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fp-popup-in {
    from { opacity: 0; transform: scale(0.94) translateY(6px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fp-slide-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fp-slide-in-left {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes fp-shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}

@keyframes fp-recording-ring {
    0%   { box-shadow: 0 0 0 0 rgba(51, 138, 79, 0.45); }
    60%  { box-shadow: 0 0 0 8px rgba(51, 138, 79, 0); }
    100% { box-shadow: 0 0 0 0 rgba(51, 138, 79, 0); }
}

@keyframes fp-badge-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.12); }
    100% { transform: scale(1); }
}

/* ── Popup card ────────────────────────────────────────────────────────── */
.popup-card {
    animation: fp-popup-in 180ms cubic-bezier(.22,.68,0,1.2) both;
    transform-origin: bottom center;
}

.popup-plus {
    transform-origin: bottom left;
}

/* ── Prompt chips hover lift ───────────────────────────────────────────── */
.prompt-chip {
    transition: background 100ms ease, border-color 100ms ease,
                transform 120ms ease, box-shadow 120ms ease;
}
.prompt-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(17, 40, 68, 0.10);
}
.prompt-chip:active { transform: translateY(0); box-shadow: none; }

/* ── Prompt chip-group chevron transition already set — also add the group header hover lift ── */
.prompt-chip.prompt-chip-group:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(17, 40, 68, 0.08);
}

/* ── Agent answer buttons: slide-in stagger ────────────────────────────── */
.agent-answer-button {
    animation: fp-slide-in-left 220ms ease both;
    transition: background 130ms ease, border-color 130ms ease,
                transform 120ms ease, box-shadow 120ms ease;
}
.agent-answer-button:nth-child(1)  { animation-delay:  20ms; }
.agent-answer-button:nth-child(2)  { animation-delay:  55ms; }
.agent-answer-button:nth-child(3)  { animation-delay:  90ms; }
.agent-answer-button:nth-child(4)  { animation-delay: 125ms; }
.agent-answer-button:nth-child(5)  { animation-delay: 160ms; }
.agent-answer-button:nth-child(n+6){ animation-delay: 190ms; }

.agent-answer-button:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 7px rgba(17, 50, 80, 0.10);
}

/* ── Consultation mic — pulse ring while recording ─────────────────────── */
.consultation-mic.is-recording {
    animation: fp-recording-ring 1.6s ease-out infinite;
}

/* ── Topbar buttons ────────────────────────────────────────────────────── */
.topbar-icon-btn,
.topbar-logout-btn {
    transition: background 140ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.topbar-icon-btn.topbar-pip-active {
    background: rgba(67, 170, 98, 0.22);
    border-color: rgba(67, 170, 98, 0.55);
    color: #5bc47a;
}
.topbar-icon-btn:hover,
.topbar-logout-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}
.topbar-icon-btn:active,
.topbar-logout-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ── Tour button pulse ─────────────────────────────────────────────────── */
.topbar-tour-btn {
    animation: fp-tour-pulse 2.6s ease-in-out infinite;
}

@keyframes fp-tour-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.45); }
    50%       { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); }
}

/* ── Plus (+) button ───────────────────────────────────────────────────── */
.plus-outside {
    transition: background 130ms ease, transform 160ms cubic-bezier(.34,1.56,.64,1),
                box-shadow 130ms ease;
}
.plus-outside:hover {
    transform: rotate(45deg) scale(1.08);
    box-shadow: 0 4px 12px rgba(20, 50, 90, 0.14);
}
.plus-outside:active {
    transform: rotate(45deg) scale(0.96);
}

/* ── Generate split button ─────────────────────────────────────────────── */
.generate-split {
    transition: box-shadow 140ms ease, transform 120ms ease;
}
.generate-split:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(20, 50, 90, 0.12);
}
.generate-split:active { transform: translateY(0); }

/* ── CPR activate / journal-ask buttons ────────────────────────────────── */
.cpr-activate-btn,
.journal-ask-btn {
    transition: background 140ms ease, transform 120ms ease, box-shadow 120ms ease;
}
.cpr-activate-btn:hover:not(:disabled),
.journal-ask-btn:hover:not(:disabled) {
    background: #243f5a;
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 2px 5px rgba(10, 25, 45, 0.11);
}
.cpr-activate-btn:active:not(:disabled),
.journal-ask-btn:active:not(:disabled) {
    transform: translateY(-50%) scale(0.97);
    box-shadow: none;
}

/* ── Settings modal entry ──────────────────────────────────────────────── */
.settings-modal {
    animation: fp-slide-up 200ms cubic-bezier(.22,.68,0,1.1) both;
}

.settings-modal-backdrop {
    animation: fp-fade-in 160ms ease both;
}

/* ── Settings tab hover ────────────────────────────────────────────────── */
.settings-tab {
    transition: background 130ms ease, border-color 130ms ease, color 130ms ease;
}
.settings-tab:hover:not(.is-active) {
    background: rgba(208, 228, 248, 0.6);
    border-color: rgba(47, 108, 143, 0.28);
    color: #21425f;
}

/* ── Settings DB/mic buttons ────────────────────────────────────────────── */
.settings-db-btn {
    transition: background 130ms ease, transform 110ms ease;
}
.settings-db-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #f0f6ff, #e5f0ff);
    transform: translateY(-1px);
}

/* ── Journal answer modal entry ─────────────────────────────────────────── */
.journal-answer-modal {
    animation: fp-slide-up 220ms cubic-bezier(.22,.68,0,1.1) both;
}
.journal-answer-modal-backdrop {
    animation: fp-fade-in 180ms ease both;
}

/* ── Note detail modal entry ─────────────────────────────────────────────── */
.note-detail-modal {
    animation: fp-slide-up 220ms cubic-bezier(.22,.68,0,1.1) both;
}
.note-detail-backdrop {
    animation: fp-fade-in 180ms ease both;
}

/* ── Ghost lines shimmer ────────────────────────────────────────────────── */
.editor .ghost-line {
    background: linear-gradient(
        90deg,
        rgba(21, 50, 74, 0.10) 0%,
        rgba(21, 50, 74, 0.04) 40%,
        rgba(21, 50, 74, 0.14) 60%,
        rgba(21, 50, 74, 0.04) 100%
    );
    background-size: 1200px 100%;
    animation: fp-shimmer 1.6s linear infinite;
}

/* ── MCP connection badge pop when status changes ───────────────────────── */
.mcp-conn-badge {
    transition: background 300ms ease, color 300ms ease, border-color 300ms ease;
}

/* ── Prompt adjustment nav buttons hover ────────────────────────────────── */
.prompt-adjustment-nav-btn {
    transition: background 130ms ease, border-color 130ms ease, color 130ms ease,
                transform 110ms ease;
}
.prompt-adjustment-nav-btn:hover:not(.is-active) {
    transform: translateX(2px);
    background: rgba(255, 255, 255, 0.9);
}

/* ── Prompt adjustment close button ────────────────────────────────────── */
.prompt-adjustment-close {
    transition: background 130ms ease, transform 110ms ease;
}
.prompt-adjustment-close:hover {
    background: linear-gradient(180deg, #e8f2ff, #dcebff);
    transform: translateY(-1px);
}

/* ── Agent answer card entry ────────────────────────────────────────────── */
.agent-answer-card {
    animation: fp-slide-up 200ms ease both;
}

/* ── Journal result buttons ─────────────────────────────────────────────── */
.journal-result-button {
    transition: background 120ms ease, border-color 120ms ease, transform 110ms ease;
}
.journal-result-button:hover {
    transform: translateX(2px);
}

/* ── Source / result show-more button ──────────────────────────────────── */
.journal-show-more-btn {
    transition: background 120ms ease, border-color 120ms ease;
}

/* ── Prompt chip "Ny prompt" ────────────────────────────────────────────── */
.prompt-chip-new {
    transition: background 120ms ease, border-color 120ms ease,
                transform 120ms ease !important;
}
.prompt-chip-new:hover {
    transform: translateY(-1px) !important;
}