:root {
    --bg: #1a1a1a;
    --primary: #ffffff;
    --accent: #7BAACC;
    --border: #333333;
    --text-light: #bbbbbb;
    --header-bg: #000000;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: sans-serif;
    color: var(--primary);
    background-color: var(--bg);
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(123, 170, 204, 0.015) 2px,
            rgba(123, 170, 204, 0.015) 3px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(123, 170, 204, 0.015) 2px,
            rgba(123, 170, 204, 0.015) 3px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 7px,
            rgba(255, 255, 255, 0.008) 7px,
            rgba(255, 255, 255, 0.008) 8px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 11px,
            rgba(255, 255, 255, 0.008) 11px,
            rgba(255, 255, 255, 0.008) 12px
        );
    width: 100%;
    height: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

#app-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 10px 12px 10px;
    height: auto;
    /* Tight spotlight: dark behind logo, gone within ~40px of logo edge */
    background: radial-gradient(
        ellipse 120px 100% at center,
        rgba(0, 0, 0, 0.75) 0%,
        rgba(0, 0, 0, 0.6) 35%,
        rgba(0, 0, 0, 0) 100%
    );
    box-shadow: none;
    z-index: 10;
    flex-shrink: 0;
    flex-basis: auto;
}

.header-logo-container {
    position: relative;
}

#logo {
    height: 90px;
    cursor: pointer;
    transition: transform 0.2s;
}

@media (max-width: 768px) {
    #logo {
        height: 70px;
    }

    header {
        padding: 14px 10px 10px 10px;
        background: radial-gradient(
            ellipse 100px 100% at center,
            rgba(0, 0, 0, 0.75) 0%,
            rgba(0, 0, 0, 0.6) 35%,
            rgba(0, 0, 0, 0) 100%
        );
    }

    /* Prevent iOS auto-zoom on input focus - 16px is the threshold */
    input,
    textarea,
    select {
        font-size: 16px;
    }
}

#logo:hover {
    transform: scale(1.05);
}

.logo-wrapper {
    position: relative;
    display: inline-block;
}

.version-badge {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #000;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: bold;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.logo-menu {
    position: fixed;
    bottom: 64px;
    left: 16px;
    background: #222;
    border: 1px solid #444;
    border-radius: 8px;
    z-index: 1000;
    min-width: 150px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    max-height: 60vh;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .logo-menu {
        bottom: 50px;
        left: 8px;
        min-width: 140px;
        font-size: 0.9rem;
    }
}

.logo-menu.hidden {
    display: none;
}

.menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: #fff;
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.menu-item:first-child {
    border-radius: 8px 8px 0 0;
}

.menu-item:last-child {
    border-radius: 0 0 8px 8px;
}

.menu-item:hover {
    background: rgba(123, 170, 204, 0.2);
}

.menu-item:active {
    background: rgba(123, 170, 204, 0.3);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    min-height: 0; /* Ensures it can shrink if needed within flex context */
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px 12px;
    min-height: 0; /* Allows it to shrink if necessary without pushing input area */
    /* Prevent scrolling lag on iOS */
    -webkit-overflow-scrolling: touch;
    /* Optimize scrolling performance */
    will-change: auto;
}

@media (max-width: 768px) {
    #chat-messages {
        gap: 6px;
        padding: 10px 10px;
    }
}

.assistant-message, .user-message {
    padding: 8px 12px;
    border-radius: 18px;
    width: fit-content;
    max-width: 80%;
}

.assistant-message {
    background: #333;
    align-self: flex-start;
    line-height: 1.6;
}

/* Markdown-rendered content inside assistant bubbles */
.assistant-message p {
    margin: 0 0 8px 0;
    line-height: 1.6;
}
.assistant-message p:last-child {
    margin-bottom: 0;
}
.assistant-message ul,
.assistant-message ol {
    margin: 4px 0 8px 0;
    padding-left: 22px;
}
.assistant-message ul:last-child,
.assistant-message ol:last-child {
    margin-bottom: 0;
}
.assistant-message li {
    margin-bottom: 5px;
    line-height: 1.6;
}
.assistant-message h2 {
    font-size: 1em;
    font-weight: 700;
    margin: 10px 0 5px 0;
    color: var(--primary);
    letter-spacing: 0.01em;
}
.assistant-message h3 {
    font-size: 0.96em;
    font-weight: 700;
    margin: 8px 0 4px 0;
    color: var(--primary);
}
.assistant-message strong {
    font-weight: 700;
    color: #fff;
}
.assistant-message em {
    font-style: italic;
    opacity: 0.9;
}
.assistant-message code {
    background: rgba(255,255,255,0.12);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.88em;
    font-family: 'Courier New', monospace;
}
.assistant-message .msg-spacer {
    height: 6px;
}

.user-message {
    background: var(--accent);
    color: #000;
    align-self: flex-end;
}

/* Typing indicator bubble */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    min-height: 20px;
}

.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #888;
    animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

#modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

#modal-backdrop.active {
    display: block;
    opacity: 1;
}

.modal, #memories-panel {
    position: fixed;
    background: #2a2a2a;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 10001;
    display: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

#memories-panel {
    top: 0;
    right: 0;
    height: 100%;
    width: 85%;
    max-width: 400px;
    transform: translateX(100%);
    padding: 20px;
    border-left: 1px solid var(--border);
}

#memories-panel.active, .modal.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.modal {
    top: 50%;
    left: 50%;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    transform: translate(-50%, -50%) scale(0.9);
}

/* Ensure add-agent-modal appears on top */
#add-agent-modal {
    z-index: 10000 !important;
}

.modal.active {
    transform: translate(-50%, -50%) scale(1);
}

/* Settings modal — tabbed layout */
#settings-modal {
    padding: 0 !important;
    height: 85vh;
    max-height: 85vh;
    overflow: hidden !important;
}

#settings-modal.active {
    display: flex !important;
    flex-direction: column;
    overflow: hidden !important;
}

.settings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.settings-modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
}

.settings-modal-header .close-modal {
    position: static;
    flex-shrink: 0;
}

.settings-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.settings-tabs::-webkit-scrollbar { display: none; }

.settings-tab {
    flex: 1;
    min-width: 0;
    padding: 10px 4px 8px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.68rem;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.settings-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.settings-tab-icon {
    font-size: 1rem;
    line-height: 1;
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 24px;
    -webkit-overflow-scrolling: touch;
}

.settings-panel {
    display: none;
}

.settings-panel.active {
    display: block;
}

/* Consistent vertical spacing between buttons inside a panel */
.settings-panel-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

/* Separator + spacing before Sign Out in Profile tab */
.settings-panel-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Voice coming-soon block — visually disabled */
.voice-coming-soon {
    margin-top: 8px;
    padding: 14px;
    border-radius: 8px;
    border: 1px dashed var(--border);
    opacity: 0.5;
    pointer-events: none;
    user-select: none;
}

.coming-soon-note {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-light);
    font-style: italic;
    margin: 6px 0 0;
}

/* Center-align headings and content in all panels */
.settings-panel h3.settings-heading {
    text-align: center;
    margin-bottom: 4px;
}

.close-panel, .close-modal {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary);
}

#memories-list {
    max-height: 80vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.memory-card {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #333;
}

input, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    background: #333;
    color: var(--primary);
}

button {
    padding: 12px;
    border: none;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-size: 1rem;
}

button:hover {
    opacity: 0.9;
}

.delete-memory {
    background: #e74c3c;
}

#onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--header-bg);
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(123, 170, 204, 0.02) 2px,
            rgba(123, 170, 204, 0.02) 3px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(123, 170, 204, 0.02) 2px,
            rgba(123, 170, 204, 0.02) 3px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 7px,
            rgba(255, 255, 255, 0.01) 7px,
            rgba(255, 255, 255, 0.01) 8px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 11px,
            rgba(255, 255, 255, 0.01) 11px,
            rgba(255, 255, 255, 0.01) 12px
        );
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px 20px 40px 20px;
    overflow: hidden;
    min-height: 100vh;
}

#onboarding-wizard #step-1.active {
    justify-content: center;
    min-height: 100vh;
}

#onboarding-wizard .step:not(#step-1).active {
    align-items: center;
    padding-top: 40px;
    text-align: center;
}

#onboarding-wizard {
    width: 100%;
    max-width: 500px;
    position: relative;
    max-height: 90vh;
    overflow: hidden;
}

@media (max-width: 480px) {
    #onboarding-wizard {
        max-height: 95vh;
    }
}

.close-onboarding {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 8px 12px;
    transition: all 0.2s;
    z-index: 1001;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-onboarding:hover {
    opacity: 0.8;
}

#onboarding-wizard .step {
    display: none;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    position: relative;
    width: 100%;
}

#onboarding-wizard .step.active {
    display: flex;
}

@media (max-width: 480px) {
    #onboarding-wizard .step {
        gap: 15px;
        padding: 30px 0 20px 0;
    }

    #onboarding-overlay {
        padding: 15px 15px 60px 15px;
    }
}

.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 1rem;
    cursor: pointer;
    padding: 8px 12px;
    transition: all 0.2s;
    text-align: center;
}

.back-btn:hover {
    opacity: 0.8;
    transform: translateX(-2px);
}

#onboarding-wizard h1, #onboarding-wizard h2 {
    color: var(--accent);
    text-align: center;
}

#onboarding-wizard p, #onboarding-wizard li {
    color: var(--text-light);
}

#onboarding-wizard ol {
    text-align: left;
    margin: 0 auto;
    max-width: 300px;
}

.onboarding-logo {
    height: 150px;
}

@media (max-width: 480px) {
    .onboarding-logo {
        height: 100px;
    }
}

.instructions {
    display: none;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    text-align: left;
}

#step-3.active {
    align-items: center;
    width: 100%;
}

#step-3.active .close-onboarding {
    position: absolute;
    top: 15px;
    right: 15px;
}

#step-3.active h2,
#step-3.active > p {
    width: 100%;
    text-align: center;
}
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}
.step-indicator .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #555;
}
.step-indicator .dot.active {
    background: var(--accent);
}
.device-selector, .onboarding-nav {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: center;
    width: 100%;
}

/* AI Provider Grid Styles */
.ai-provider-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
    width: 100%;
}

@media (max-width: 768px) {
    .ai-provider-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin: 15px 0;
    }
}

@media (max-width: 480px) {
    .ai-provider-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin: 15px 0;
    }
}

.ai-provider-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-provider-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    background: #2a2a2a;
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-height: 120px;
}

@media (max-width: 480px) {
    .ai-provider-btn {
        padding: 15px;
        min-height: auto;
        gap: 6px;
    }
}

.get-api-key-btn {
    display: inline-block;
    padding: 8px 12px;
    background: var(--accent);
    color: #000;
    text-align: center;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: bold;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 480px) {
    .get-api-key-btn {
        font-size: 0.8rem;
        padding: 10px 12px;
        min-height: 44px;
    }
}

.get-api-key-btn:hover {
    background: #95BDD8;
    transform: translateY(-1px);
}

.ai-provider-btn:hover {
    border-color: var(--accent);
    background: #333;
    transform: translateY(-2px);
}

.ai-provider-btn.selected {
    border-color: var(--accent);
    background: rgba(123, 170, 204, 0.1);
    box-shadow: 0 0 15px rgba(123, 170, 204, 0.3);
}

.provider-icon {
    font-size: 2.5rem;
}

@media (max-width: 768px) {
    .provider-icon {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .provider-icon {
        font-size: 1.5rem;
    }
}

.provider-name {
    font-weight: bold;
    font-size: 1.1rem;
}

.provider-info {
    font-size: 0.75rem;
    color: var(--text-light);
}

@media (max-width: 480px) {
    .provider-name {
        font-size: 0.95rem;
    }

    .provider-info {
        font-size: 0.65rem;
    }
}

/* Onboarding Token Info */
.onboarding-tokens-info {
    text-align: center;
    margin: 24px 0;
}

.onboarding-token-grant {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.onboarding-token-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent);
}

.onboarding-token-text {
    font-size: 1.1rem;
    color: var(--text-light);
}

.onboarding-token-detail {
    font-size: 0.85rem;
    color: var(--text-light);
    opacity: 0.8;
}

.onboarding-continue-btn {
    display: block;
    width: 100%;
    max-width: 200px;
    margin: 20px auto 0;
    padding: 12px 24px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
}

.onboarding-continue-btn:hover {
    opacity: 0.85;
}

#provider-setup {
    margin-top: 20px;
    padding: 15px;
    background: #222;
    border-radius: 8px;
    display: none;
    width: 100%;
    max-height: 50vh;
    overflow-y: auto;
}

#provider-setup.active {
    display: block;
}

#provider-setup ol {
    margin-left: 20px;
    margin-top: 10px;
}

#provider-setup li {
    margin: 8px 0;
}

@media (max-width: 480px) {
    #provider-setup {
        padding: 12px;
        margin-top: 15px;
        font-size: 0.95rem;
    }

    #provider-setup ol {
        margin-left: 18px;
    }

    #provider-setup li {
        margin: 6px 0;
        font-size: 0.9rem;
    }

    #provider-setup input {
        font-size: 16px !important;
    }
}

/* Provider Badges in Pitch Modal */
.provider-badges {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0.8rem 0 1rem 0;
}

.badge {
    background: #2a2a2a;
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--primary);
}

.button {
    text-decoration: none;
    color: #fff;
}
.error-message {
    color: #e74c3c;
    margin-top: 10px;
}
hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 10px 0;
}
#version-info {
    text-align: center;
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: 15px;
}
/* Password confirmation modal */
.password-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    padding: 20px;
}

.password-confirm-box {
    background: #1a1a1a;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 24px;
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.password-confirm-box h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #e74c3c;
}

.password-confirm-desc {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 0;
    line-height: 1.5;
}

.password-confirm-error {
    font-size: 0.85rem;
    color: #e74c3c;
    margin: 0;
    min-height: 18px;
}

.password-confirm-btns {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.password-confirm-btns .settings-btn {
    flex: 1;
}

/* Settings modal sections */
.settings-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-of-type {
    border-bottom: none;
}

.settings-heading {
    text-align: center;
    color: var(--accent);
    font-size: 1rem;
    margin: 0;
}

#agents-list {
    max-height: 200px;
    overflow-y: auto;
}

/* Settings buttons */
.settings-btn {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.settings-btn:hover {
    opacity: 0.9;
}

.settings-btn:active {
    transform: scale(0.98);
}

.settings-btn-primary {
    background: var(--accent);
    color: var(--bg);
}

.settings-btn-hard-refresh {
    background: #6A99BB;
    color: var(--bg);
}

.settings-btn-hard-refresh:hover {
    background: #5A8AAB;
}

.settings-btn-secondary {
    background: #444;
    color: var(--primary);
}

.settings-btn-danger {
    background: transparent;
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.settings-btn-danger:hover {
    background: #e74c3c;
    color: #fff;
}

.settings-btn-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.settings-btn-grid .settings-btn {
    width: 100%;
    font-size: 0.85rem;
    padding: 12px 8px;
}

/* Side-by-side button row */
.settings-btn-row {
    display: flex;
    gap: 10px;
}

.settings-btn-half {
    flex: 1;
}

/* Account bar at top of profile section */
.settings-account-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #2a2a2a;
    border-radius: 10px;
    margin-bottom: 4px;
}

.settings-account-icon {
    font-size: 1.2rem;
}

.settings-account-bar .account-email {
    font-size: 0.9rem;
    color: var(--text-light);
    word-break: break-all;
}

/* Voice toggle row */
.voice-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #2a2a2a;
    border-radius: 10px;
}

.voice-toggle-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.voice-toggle-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
}

.voice-toggle-desc {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    width: 44px;
    height: 24px;
    background: #444;
    border-radius: 12px;
    transition: background 0.25s;
    display: flex;
    align-items: center;
    padding: 2px;
}

.toggle-thumb {
    width: 20px;
    height: 20px;
    background: #888;
    border-radius: 50%;
    transition: transform 0.25s, background 0.25s;
}

.toggle-switch input:checked + .toggle-track {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
    transform: translateX(20px);
    background: #fff;
}

/* Feedback tabs */
.feedback-tabs {
    display: flex;
    gap: 0;
    background: #2a2a2a;
    border-radius: 8px;
    padding: 3px;
}

.feedback-tab {
    flex: 1;
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-light);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.feedback-tab.active {
    background: var(--accent);
    color: #000;
    font-weight: 600;
}

.feedback-panel {
    display: none;
}

.feedback-panel.active {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Contact & Suggestions forms */
#contact-form,
#suggestions-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#contact-form textarea,
#suggestions-form textarea {
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
    min-height: 80px;
}

.settings-status {
    text-align: center;
    font-size: 0.85rem;
    min-height: 1.2em;
    margin: 0;
}

.settings-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#pitch-modal, #trial-limit-modal {
    max-width: 480px;
    padding: 0;
    text-align: center;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

#pitch-modal.pitch-accordion {
    padding: 1.5rem 1.5rem 0 1.5rem;
}

#pitch-modal.pitch-accordion > h2 {
    flex-shrink: 0;
    margin-bottom: 0.5rem;
}

#pitch-modal.pitch-accordion > p {
    flex-shrink: 0;
    margin-bottom: 1.5rem;
}

#pitch-modal.pitch-accordion .pitch-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

#pitch-modal.pitch-accordion .pitch-buttons {
    flex-shrink: 0;
    margin-top: 1.5rem;
    padding: 0 0 1.5rem 0;
}

#pitch-modal.pitch-accordion .accordion-item {
    flex-shrink: 0;
}

.pitch-description {
    color: #ddd;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.2rem;
}

.pitch-section {
    margin: 1.2rem 0;
}

.pitch-section h3 {
    color: var(--primary);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
}

.pitch-features {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.pitch-features li {
    padding: 0.4rem 0;
    color: #ccc;
    font-size: 0.9rem;
}

#pitch-modal h2, #trial-limit-modal h2 {
    margin-bottom: 0.8rem;
    font-size: 1.6rem;
}

#pitch-modal p, #trial-limit-modal p {
    margin-bottom: 1rem;
    color: #ddd;
    line-height: 1.5;
    font-size: 0.95rem;
}

#pitch-modal ul {
    list-style: none;
    padding: 0;
    margin-bottom: 1.5rem;
    text-align: left;
}

#pitch-modal li {
    padding: 0.3rem 0;
    color: #bbb;
    font-size: 0.95rem;
}

/* Accordion Styles */
.accordion-item {
    border-bottom: 1px solid #333;
    margin-bottom: 0;
}

.accordion-header {
    width: 100%;
    padding: 1rem;
    background: #2a2a2a;
    border: none;
    color: var(--primary);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    font-weight: 600;
    text-align: left;
}

.accordion-header:hover {
    background: #333;
}

.accordion-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 0.8rem;
    margin-left: 1rem;
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #1f1f1f;
    padding: 0;
}

.accordion-item.active .accordion-content {
    max-height: 3500px;
    padding: 1rem 1rem 1.5rem 1rem;
}

.accordion-content p {
    margin: 0.5rem 0;
    color: #ddd;
    font-size: 0.9rem;
    line-height: 1.5;
    text-align: left;
}

.accordion-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.accordion-content li {
    padding: 0.4rem 0;
    color: #ccc;
    font-size: 0.9rem;
}

/* About Modal Styles */
#about-modal {
    max-width: 550px;
    padding: 0;
    text-align: left;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

#about-modal.about-accordion {
    padding: 1.5rem;
    max-height: 90vh;
}

.about-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
}

.about-header h2 {
    margin: 0;
    color: var(--accent);
    font-size: 1.6rem;
}

.version-display {
    /* Styling moved to inline styles in footer */
}

.about-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.about-content .accordion-item {
    border-bottom: 1px solid #333;
}

.accordion-preview {
    color: #aaa;
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.5;
    font-style: italic;
}

.about-footer {
    flex-shrink: 0;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #333;
    text-align: center;
    font-size: 0.85rem;
    color: #888;
}

.about-footer a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s;
}

.about-footer a:hover {
    opacity: 0.8;
}

.button-primary {
    background: #4a9eff;
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    margin: 0.5rem auto;
    font-weight: 600;
    transition: background 0.3s;
}

.button-primary:hover {
    background: #357abd;
}

.button-secondary {
    background: transparent;
    color: #4a9eff;
    padding: 0.8rem 1.5rem;
    border: 2px solid #4a9eff;
    border-radius: 0.5rem;
    cursor: pointer;
    margin: 0.5rem auto;
    font-weight: 600;
    transition: all 0.3s;
}

.button-secondary:hover {
    background: #4a9eff;
    color: white;
}

.button-danger {
    background: #ff4444;
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    margin: 0.5rem auto;
    font-weight: 600;
    transition: background 0.3s;
}

.button-danger:hover {
    background: #cc0000;
}

#pitch-modal h2, #trial-limit-modal h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #fff;
}

#pitch-modal p, #trial-limit-modal p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    color: #ddd;
}

#pitch-modal h3 {
    font-size: 1.1rem;
    margin-bottom: 0.7rem;
    margin-top: 0.8rem;
    color: #fff;
}

#pitch-modal ul {
    list-style: none;
    padding: 0;
    margin-bottom: 2rem;
    text-align: left;
}

#pitch-modal li {
    padding: 0.5rem 0;
    color: #bbb;
}

.pitch-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1.2rem;
}

/* Voice Lightbox Modal */
.voice-lightbox {
    max-width: 400px;
    width: 85%;
    padding: 2rem;
    text-align: center;
    gap: 1.5rem;
}

.voice-lightbox h2 {
    margin-bottom: 0;
}

.lightbox-voice-display {
    font-size: 1.2rem;
    padding: 16px 20px;
    margin: 16px 0;
    width: 100%;
    text-align: center;
    background: rgba(74, 158, 255, 0.1);
    border-radius: 12px;
    border: 2px solid #4a9eff;
    animation: pulse 1.5s ease-in-out infinite;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    white-space: nowrap;
}

#lightbox-stop-btn {
    margin: 0 auto;
    display: block;
}

/* Ensure voice modal buttons are clickable */
#lightbox-stop-btn {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Crisis Modal */
.crisis-modal {
    max-width: 600px;
    padding: 2rem;
    border: 2px solid #ff6b6b;
    max-height: 90vh;
    overflow-y: auto;
}

.crisis-resources {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
}

.resource {
    background: rgba(255, 107, 107, 0.1);
    padding: 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid #ff6b6b;
}

.resource h3 {
    color: #ff6b6b;
    margin-bottom: 0.5rem;
}

.resource p {
    color: #ddd;
    margin: 0.5rem 0;
}

.resource a {
    color: #4a9eff;
    text-decoration: none;
}

.resource a:hover {
    text-decoration: underline;
}

/* Chat Input Area with Buttons */
#chat-input-area {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    background-color: var(--header-bg);
    border-top: 1px solid var(--border);
    gap: 6px;
    align-items: stretch;
    justify-content: center;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    flex-shrink: 0;
    flex-basis: auto;
    margin: 0;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    #chat-input-area {
        padding: 8px 10px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        gap: 4px;
    }
}

#chat-input-area.expanded {
    padding: 0;
    align-items: stretch;
    justify-content: flex-start;
}

/* Default row: hamburger + input */
.input-default-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    justify-content: flex-start;
}

/* All buttons in input area - unified sizing */
.hamburger-menu-btn,
.input-btn-icon,
.send-message-btn {
    height: auto;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Hamburger menu button */
.hamburger-menu-btn {
    width: 40px;
    min-width: 40px;
    padding: 0;
    background: transparent;
    border: 1px solid #444;
    border-radius: 6px;
    color: var(--primary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s;
}

.hamburger-menu-btn:hover {
    background: #2a2a2a;
}

.hamburger-menu-btn:active {
    background: rgba(123, 170, 204, 0.2);
}

@media (max-width: 768px) {
    .hamburger-menu-btn {
        width: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .hamburger-menu-btn {
        width: 40px;
        min-width: 40px;
        min-height: 40px;
    }
}

#chat-input-area #chat-input {
    flex: 1;
    resize: none;
    background: #333;
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    font-size: 16px; /* Minimum 16px prevents iOS auto-zoom on focus */
    font-family: inherit;
    min-height: 40px;
    max-height: 80px;
    overflow-y: auto;
    /* Remove all webkit styling to disable accessory bar */
    -webkit-appearance: none;
    -webkit-user-select: text;
    -webkit-user-callout: none;
    -webkit-touch-callout: none;
    appearance: none;
    /* Attach to keyboard - no gaps */
    margin: 0;
    margin-bottom: 0;
    line-height: 1.4;
}

@media (max-width: 768px) {
    #chat-input-area #chat-input {
        padding: 8px;
        min-height: 36px;
        max-height: 60px;
        font-size: 16px; /* Keep at 16px minimum to prevent iOS auto-zoom */
    }
}

@media (max-width: 480px) {
    #chat-input-area #chat-input {
        padding: 10px;
        min-height: 40px;
        max-height: 80px;
        font-size: 16px;
    }
}

/* Default button state */
.input-buttons {
    display: flex;
    gap: 1rem;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    justify-content: space-between;
}

.input-btn {
    flex: 1;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 18px 30px;
    transition: all 0.2s;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    min-width: 140px;
    color: #000;
    font-weight: 600;
    letter-spacing: 0.5px;
}

#chat-type {
    background: var(--accent);
}

#chat-type:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

#chat-type:active {
    transform: translateY(0);
}

#chat-talk {
    background: #4a9eff;
}

#chat-talk:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

#chat-talk:active {
    transform: translateY(0);
}

/* Input mode (text or voice) */
.input-mode {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    flex: 1;
    padding: 16px;
}

#chat-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Icon buttons (image, voice) */
.input-btn-icon {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    background: transparent;
    border: 1px solid #444;
    border-radius: 6px;
    color: var(--primary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.input-btn-icon:hover {
    background: #2a2a2a;
}

.input-btn-icon:active {
    background: rgba(123, 170, 204, 0.2);
}

/* Voice button active state - red (hot mic) */
.input-btn-icon.voice-active {
    background-color: rgba(255, 0, 0, 0.3) !important;
    border-color: rgba(255, 0, 0, 0.8);
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.4);
}

/* Voice button ready state - green */
.input-btn-icon#voice-btn:not(.voice-active) {
    background-color: rgba(0, 255, 0, 0.1);
}

@media (max-width: 768px) {
    .input-btn-icon {
        width: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .input-btn-icon {
        width: 40px;
        min-width: 40px;
        min-height: 40px;
        font-size: 1.2rem;
    }
}

.input-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mode-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    background: #444;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--primary);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.mode-btn:hover {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.send-btn,
.send-message-btn {
    flex: 0 0 auto;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 40px;
}

.send-message-btn {
    width: 40px;
    min-width: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: bold;
}

@media (max-width: 768px) {
    .send-message-btn {
        width: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .send-message-btn {
        width: 40px;
        min-width: 40px;
        min-height: 40px;
        font-size: 0.85rem;
    }
}

.send-btn:hover,
.send-message-btn:hover {
    opacity: 0.9;
}

.send-btn:active,
.send-message-btn:active {
    transform: scale(0.98);
}

.voice-status-display {
    padding: 12px;
    background: #333;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--primary);
    text-align: center;
    font-size: 0.95rem;
    animation: pulse 1.5s ease-in-out infinite;
}


/* Mood Options Grid */
.mood-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.mood-btn {
    padding: 1rem;
    background: #1e1e1e;
    border: 2px solid #333;
    color: white;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 2rem;
    transition: all 0.3s;
}

.mood-btn:hover {
    background: #4a9eff;
    border-color: #4a9eff;
}
/* Memory Modal Styles */
.memory-modal {
    max-width: 600px;
    width: 90%;
    height: 80vh;
    max-height: 80vh;
    overflow: hidden !important; /* override base .modal overflow-y: auto */
    display: flex !important;    /* override base .modal display:none / .modal.active display:flex */
    flex-direction: column;
    padding: 0 !important;       /* header/content/footer manage their own padding */
}

.memory-modal-content {
    padding: 12px 20px 20px;
    overflow-y: auto;
    flex: 1;
}

/* Header sits outside the scroll container — always locked to top of modal */
.memory-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.memory-modal-header h2 {
    margin: 0;
    font-size: 1rem;
    color: var(--primary);
    flex: 1;
    text-align: left;
    padding-right: 8px;
}

.memory-modal-header .close-modal {
    position: static;
    flex-shrink: 0;
}

.memory-modal-content h2 {
    color: var(--primary);
    margin-bottom: 10px;
    text-align: center;
}

.memory-modal-date {
    color: var(--text-light);
    font-size: 0.9em;
    text-align: center;
    margin-bottom: 20px;
}

.memory-messages-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background-color: #222;
}

.memory-messages-container .user-message {
    background: var(--accent);
    color: #000;
    align-self: flex-end;
    border-radius: 18px;
    padding: 8px 12px;
    max-width: 80%;
    word-wrap: break-word;
}

.memory-messages-container .assistant-message {
    background: #333;
    color: var(--primary);
    align-self: flex-start;
    border-radius: 18px;
    padding: 8px 12px;
    max-width: 80%;
    word-wrap: break-word;
}

/* Enhancements for memory cards */
.memory-card {
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    position: relative; /* For positioning action buttons */
    padding-bottom: 40px; /* Make space for action buttons */
}

.memory-card:hover {
    background-color: #3a3a3a;
}

.memory-card-title {
    font-size: 1.1em;
    color: var(--accent);
    margin-bottom: 5px;
}

.memory-card-preview {
    font-size: 0.9em;
    color: var(--text-light);
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Show up to 2 lines */
    -webkit-box-orient: vertical;
}

.memory-card-actions {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
}

.memory-card-actions button {
    padding: 0 10px;
    height: 28px;
    font-size: 0.8rem;
    border-radius: 4px;
    box-sizing: border-box;
}

.edit-memory {
    background-color: #3498db; /* Blue for edit */
    color: white;
}

.delete-memory {
    background-color: #e74c3c; /* Red for delete */
    color: white;
}

/* Button styles */
.btn {
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--accent);
    color: #000;
}

.btn-primary:hover {
    background-color: #95BDD8;
    opacity: 0.9;
}

.btn-secondary {
    background-color: #555;
    color: white;
}

.btn-secondary:hover {
    background-color: #666;
    opacity: 0.9;
}

/* Memory modal actions */
.memory-modal-footer {
    flex-shrink: 0;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}

.memory-modal-footer button {
    width: 100%;
}

/* Voice input styles */
#voice-btn {
    background-color: rgba(0, 255, 0, 0.1);
    border: 1px solid rgba(0, 255, 0, 0.5);
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

#voice-btn:hover {
    border-color: rgba(0, 255, 0, 0.8);
    background-color: rgba(0, 255, 0, 0.15);
}

#voice-btn.voice-active {
    background-color: rgba(255, 0, 0, 0.3);
    border-color: rgba(255, 0, 0, 0.8);
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.4);
}

#voice-status {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff6b6b;
    color: white;
    padding: 12px 24px;
    border-radius: 20px;
    font-weight: bold;
    z-index: 100;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translateX(-50%) scale(1.05);
    }
}

/* Permission Modal */
.permission-modal {
    max-width: 400px;
    padding: 2rem;
    text-align: center;
}

.permission-modal h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.permission-modal p {
    color: var(--text-light);
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 1.5rem;
    flex-direction: column;
}

/* Agent Management Styles */
.form-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.3rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group select {
    background: #333;
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.9rem;
}

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.form-group label[for*="agent-primary"] {
    flex-direction: row;
    align-items: center;
    margin: 0;
}

.agent-card {
    background: #2a2a2a;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.agent-info {
    flex: 1;
}

.agent-name {
    font-weight: bold;
    color: var(--accent);
    font-size: 0.95rem;
}

.agent-type {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.3rem;
}

.agent-primary-badge {
    background: var(--accent);
    color: var(--bg);
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-top: 0.3rem;
    width: fit-content;
}

.agent-actions {
    display: flex;
    gap: 0.5rem;
}

.agent-actions button {
    background: none;
    border: 1px solid var(--border);
    color: var(--primary);
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.agent-actions button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Agent status indicators */
.agent-status {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

.agent-status-valid {
    color: #4caf50;
}

.agent-status-invalid {
    color: #e74c3c;
}

.agent-status-rate-limited {
    color: #ff9800;
}

.agent-status-expired {
    color: #ff5722;
}

.agent-status-unknown {
    color: #888;
}

/* Masked key preview */
.agent-key-preview {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.2rem;
    font-family: monospace;
}

/* Auto-detected provider display */
.detected-provider {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #2a2a2a;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.detected-provider span:first-child {
    font-size: 1.3rem;
}

.detected-provider span:nth-child(2) {
    flex: 1;
    color: var(--accent);
    font-weight: 500;
    font-size: 0.9rem;
}

.change-provider-link {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.change-provider-link:hover {
    color: var(--accent);
}

/* Settings info text */
.settings-info {
    font-size: 0.85rem;
    color: var(--text-light);
    text-align: center;
    line-height: 1.4;
}

/* ========== CHANGE 2: Empty States ========== */
.empty-state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
    gap: 0.75rem;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.empty-state-title {
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: 600;
    margin: 0;
}

.empty-state-text {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
    max-width: 280px;
    margin: 0;
}

.empty-state-btn {
    margin-top: 0.5rem;
    padding: 10px 20px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.empty-state-btn:hover {
    opacity: 0.9;
}

.empty-state-benefits {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
    text-align: left;
}

.empty-state-benefits li {
    color: var(--text-light);
    font-size: 0.85rem;
    padding: 0.25rem 0;
}

/* ========== CHANGE 3: Color-coded Toast Notifications ========== */
#toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 8px;
    transition: bottom 0.4s ease-out;
    z-index: 2000;
    min-width: 280px;
    max-width: 90vw;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

#toast.show {
    bottom: 30px;
}

#toast .toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

#toast .toast-message {
    flex: 1;
    color: white;
}

#toast .close-toast {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.2s;
}

#toast .close-toast:hover {
    color: white;
}

#toast.toast-success {
    background: #2d5a2d;
}

#toast.toast-error {
    background: #5a2d2d;
}

#toast.toast-warning {
    background: #5a502d;
}

#toast.toast-info {
    background: #2d4a5a;
}

/* ========== CHANGE 4: Form Validation Styles ========== */
.form-help {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.3rem;
    line-height: 1.3;
}

.form-field-error {
    display: block;
    font-size: 0.8rem;
    color: #e74c3c;
    margin-top: 0.25rem;
    min-height: 0;
    line-height: 1.3;
}

.form-field-error:not(:empty) {
    min-height: 1em;
}

.form-group input.field-invalid,
.form-group select.field-invalid {
    border-color: #e74c3c;
}

#save-new-agent:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== CHANGE 5: Keyboard Accessibility ========== */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: #000;
    padding: 10px 16px;
    font-size: 1rem;
    font-weight: 600;
    z-index: 10000;
    border-radius: 0 0 6px 0;
    text-decoration: none;
}

.skip-link:focus {
    left: 0;
    outline: 3px solid #FFD700;
    outline-offset: 2px;
}

/* Golden focus outline for keyboard navigation only */
body.keyboard-nav button:focus,
body.keyboard-nav input:focus,
body.keyboard-nav textarea:focus,
body.keyboard-nav select:focus,
body.keyboard-nav a:focus,
body.keyboard-nav [tabindex]:focus {
    outline: 3px solid #FFD700;
    outline-offset: 2px;
}

/* ========== User Profile Form ========== */
.profile-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 0 0;
    max-height: none;
    overflow: visible;
}

.profile-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-form .form-group label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

.profile-form input,
.profile-form select {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #333;
    color: var(--primary);
    font-size: 0.95rem;
}

.profile-form select {
    appearance: auto;
}

.profile-dob-saved {
    color: #4caf50;
    font-size: 0.9rem;
    padding: 8px 0;
}

/* ========== Trust Badges ========== */
.trust-badges {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 8px 0;
}

.trust-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #222;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.trust-badge-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.trust-badge-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.trust-badge-text strong {
    font-size: 0.9rem;
    color: var(--primary);
}

.trust-badge-text span {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* ========== Privacy & Terms Modals ========== */
.privacy-terms-modal {
    max-width: 500px;
    padding: 24px;
}

.privacy-terms-modal h2 {
    color: var(--accent);
    margin-bottom: 1rem;
    font-size: 1.3rem;
    padding-right: 30px;
}

.privacy-terms-content {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 8px;
}

.privacy-terms-content h3 {
    color: var(--primary);
    font-size: 0.95rem;
    margin: 1.2rem 0 0.5rem 0;
    font-weight: 600;
}

.privacy-terms-content h3:first-child {
    margin-top: 0;
}

.privacy-terms-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.privacy-terms-content li {
    padding: 0.25rem 0;
    color: #ccc;
    font-size: 0.88rem;
    line-height: 1.5;
    padding-left: 1.2rem;
    position: relative;
}

.privacy-terms-content li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent);
}

.privacy-never-list li::before {
    content: '✕';
    color: #e74c3c;
}

.privacy-highlight {
    color: var(--accent);
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.privacy-date {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: 1.5rem;
    text-align: center;
}

.privacy-terms-law {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 1rem;
}

/* System message (birthday etc.) */
.system-message {
    background: linear-gradient(135deg, #2a3a2a, #333);
    border-left: 3px solid var(--accent);
    font-style: italic;
}

/* ========== Responsive adjustments ========== */
/* Utilities Modal */
#utilities-modal {
    max-width: 600px;
    width: 90%;
    display: flex;
    flex-direction: column;
    padding: 0;
    top: 105px !important;
    left: 50% !important;
    transform: translateX(-50%) scale(0.9) !important;
    max-height: calc(100vh - 110px);
    border-radius: 8px;
}

#utilities-modal.active {
    transform: translateX(-50%) scale(1) !important;
}

.utilities-header {
    padding: 1.5rem;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.utilities-header h2 {
    margin: 0 0 1rem 0;
    color: var(--accent);
    font-size: 1.6rem;
}

.utilities-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
}

.utilities-tab {
    background: #222;
    border: 1px solid #444;
    color: #aaa;
    padding: 0.6rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.utilities-tab:hover {
    background: #333;
    color: #fff;
}

.utilities-tab.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.utilities-tab-content {
    display: none;
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.utilities-tab-content.active {
    display: block;
}

.utility-section {
    margin-bottom: 2rem;
}

.utility-section h3 {
    color: var(--accent);
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
}

.utility-section h4 {
    color: #aaa;
    margin: 1rem 0 0.5rem 0;
    font-size: 0.9rem;
}

.alarm-setup,
.timer-setup,
.event-setup,
.reminder-setup {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.alarm-setup input,
.timer-setup input,
.event-setup input,
.event-setup textarea,
.reminder-setup input,
.reminder-setup select {
    background: #222;
    border: 1px solid #444;
    color: #fff;
    padding: 0.6rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
}

.timer-setup {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.6rem;
}

.timer-setup input {
    grid-column: span 1;
}

.timer-setup button {
    grid-column: 1 / -1;
}

.notes-actions,
.reminder-setup {
    display: flex;
    gap: 0.8rem;
}

.notes-actions button {
    flex: 1;
}

.active-utilities-list,
.notes-list,
.events-list,
.reminders-list {
    margin-top: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
}

#alarms-container,
#timers-container,
#notes-container,
#events-container,
#reminders-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.utility-item {
    background: #222;
    border: 1px solid #444;
    padding: 1rem;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.utility-item-info {
    flex: 1;
    color: #fff;
    font-size: 0.9rem;
}

.utility-item-time {
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.utility-item-label {
    color: #aaa;
    font-size: 0.85rem;
}

.utility-item-action {
    background: #ff4444;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.utility-item-action:hover {
    background: #cc0000;
}

.note-item {
    background: #222;
    border-left: 3px solid var(--accent);
    padding: 0.8rem;
    border-radius: 4px;
    margin-bottom: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.note-item:hover {
    background: #2a2a2a;
}

.note-item-preview {
    color: #fff;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    max-height: 2rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-item-date {
    color: #888;
    font-size: 0.8rem;
}

@media (max-width: 600px) {
    .utilities-tabs {
        grid-template-columns: 1fr 1fr;
        font-size: 0.8rem;
    }

    .utilities-tab {
        padding: 0.5rem;
    }

    .timer-setup {
        grid-template-columns: 1fr 1fr;
    }

    .timer-setup button {
        grid-column: 1 / -1;
    }
}

@media (max-width: 360px) {
    .input-default-row {
        gap: 6px;
    }
    .hamburger-menu-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 1.2rem;
    }
    .input-buttons {
        gap: 0.5rem;
    }
    .input-btn {
        min-width: 100px;
        min-height: 50px;
        padding: 14px 20px;
        font-size: 1rem;
    }
}

/* Token Badge (under logo) */
.token-badge-under-logo {
    position: absolute;
    top: 92px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    white-space: nowrap;
    z-index: 100;
}

@media (max-width: 768px) {
    .token-badge-under-logo {
        top: 72px;
    }
}

.token-badge-under-logo:hover {
    opacity: 0.8;
}

.token-icon {
    display: none;
}

.token-badge-count {
    font-size: 0.65rem;
    font-weight: bold;
    color: var(--accent);
}

.token-badge-count.token-empty {
    color: #ff6b6b;
}

.token-label {
    font-size: 0.65rem;
    font-weight: bold;
    color: var(--accent);
    letter-spacing: 0.3px;
}

/* Token Settings Section */
.token-settings-info {
    margin-bottom: 16px;
}

.token-settings-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #2a2a2a;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 6px;
}

.token-settings-label {
    color: var(--text-light);
    font-size: 0.9rem;
}

.token-settings-count {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
}

.token-settings-desc {
    color: var(--text-light);
    font-size: 0.75rem;
    opacity: 0.6;
}

.token-packs-settings {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.token-packs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.token-pack {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    background: #2a2a2a;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    cursor: default;
    transition: border-color 0.2s;
    position: relative;
}

.paypal-btn-container {
    flex-basis: 100%;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, margin-top 0.3s ease;
    margin-top: 0;
}

.token-pack.expanded .paypal-btn-container {
    max-height: 120px;
    margin-top: 12px;
}

.token-pack.expanded {
    border-color: var(--accent);
}

.token-pack:hover {
    border-color: var(--accent);
}

.token-pack.popular {
    border-color: var(--accent);
    background: rgba(123, 170, 204, 0.08);
}

.pack-badge {
    position: absolute;
    top: -8px;
    right: 12px;
    background: var(--accent);
    color: #000;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pack-name {
    font-weight: 600;
    color: var(--primary);
    min-width: 70px;
}

.pack-tokens {
    color: var(--text-light);
    font-size: 0.85rem;
    flex: 1;
    text-align: center;
}

.pack-price {
    font-weight: 700;
    color: var(--accent);
    font-size: 1rem;
}

.token-store-note {
    color: var(--text-light);
    font-size: 0.75rem;
    text-align: center;
    margin-bottom: 12px;
    opacity: 0.6;
}

.token-refill-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.token-refill-btn:hover {
    opacity: 0.9;
}

/* ========== Auth Forms (Onboarding) ========== */
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.2rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    width: 100%;
}

.auth-tab {
    flex: 1;
    padding: 10px 0;
    background: #222;
    border: none;
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--accent);
    color: #000;
}

.auth-tab:not(.active):hover {
    background: #333;
    color: var(--primary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    align-items: center;
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    background: #222;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--primary);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.auth-form input[type="email"]:focus,
.auth-form input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
}

.auth-form input::placeholder {
    color: #666;
}

.remember-me-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0 4px;
    font-size: 0.9rem;
}

.remember-me-container input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
}

.remember-me-container label {
    cursor: pointer;
    color: var(--text-light);
    user-select: none;
    flex: 1;
}

.remember-me-container label:hover {
    color: var(--primary);
}

.auth-submit-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 4px;
}

.auth-submit-btn:hover {
    opacity: 0.9;
}

.auth-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.auth-link-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 0;
    text-decoration: underline;
    transition: opacity 0.2s;
}

.auth-link-btn:hover {
    opacity: 0.7;
}

.auth-message {
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: 6px;
    text-align: center;
    display: none;
}

.auth-message.error {
    display: block;
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.auth-message.success {
    display: block;
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

/* Email verification screen */
.verify-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 8px;
}

.verify-text {
    text-align: center;
    color: var(--text-light);
    font-size: 0.95rem;
    margin: 0;
}

.verify-email {
    text-align: center;
    color: var(--accent);
    font-weight: 600;
    font-size: 1rem;
    margin: 4px 0 8px;
    word-break: break-all;
}

.verify-hint {
    text-align: center;
    color: #666;
    font-size: 0.8rem;
    margin: 0 0 12px;
}

/* Success message in onboarding */
.success-message {
    text-align: center;
    color: #4caf50;
    font-size: 0.85rem;
    min-height: 0;
    margin-top: 4px;
}

.success-message:empty {
    display: none;
}

/* Account section in settings */
.account-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #2a2a2a;
    border-radius: 8px;
    margin-bottom: 10px;
}

.account-email {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 500;
    word-break: break-all;
}

/* ========================================
   COMPREHENSIVE RESPONSIVE DESIGN
   Devices from 2020 onward + Future-proof
   ======================================== */

/* Small Phones (320px - 374px)
   Older compact models, emergency fallback */
@media (max-width: 374px) {
    .input-default-row {
        gap: 4px;
    }

    .hamburger-menu-btn,
    .input-btn-icon {
        width: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 1rem;
    }

    .send-message-btn {
        width: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    #chat-input-area #chat-input {
        padding: 8px;
        min-height: 36px;
        font-size: 15px;
    }

    header {
        padding: 8px 12px;
    }

    .logo {
        font-size: 1rem;
    }
}

/* Standard Small Phones (375px - 414px)
   iPhone 12/13/14/15/16 (non-Pro)
   iPhone SE (3rd gen)
   iPhone X/XS
   Pixel 4/5/6
   Samsung S20/S21/S22/S23
   OnePlus 8/9/10/11/12 */
@media (min-width: 375px) and (max-width: 414px) {
    .input-default-row {
        gap: 6px;
    }

    .hamburger-menu-btn,
    .input-btn-icon {
        width: 40px;
        min-width: 40px;
        min-height: 40px;
        font-size: 1.1rem;
    }

    .send-message-btn {
        width: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    #chat-input-area #chat-input {
        padding: 10px;
        min-height: 40px;
        font-size: 16px;
    }
}

/* Large Standard Phones (415px - 480px)
   iPhone 12 Pro / 13 Pro / 14 Pro / 15 Pro / 16 Pro
   Pixel 6 Pro / 7 Pro / 8 Pro / 9 Pro
   Samsung S20+ / S21+ / S22+ / S23+ / S24+
   OnePlus 9 Pro / 10 Pro / 11 Pro / 12 Pro */
@media (min-width: 415px) and (max-width: 480px) {
    .input-default-row {
        gap: 8px;
    }

    .hamburger-menu-btn,
    .input-btn-icon {
        width: 42px;
        min-width: 42px;
        min-height: 42px;
        font-size: 1.2rem;
    }

    .send-message-btn {
        width: 42px;
        min-width: 42px;
        min-height: 42px;
    }

    #chat-input-area #chat-input {
        padding: 11px;
        min-height: 42px;
        font-size: 16px;
    }
}

/* Plus/Max Phones (481px - 530px)
   iPhone 12 Pro Max / 13 Pro Max / 14 Pro Max / 15 Pro Max / 16 Pro Max / 17 Pro Max
   Pixel Fold / Samsung S20 Ultra / S21 Ultra / S22 Ultra / S23 Ultra / S24 Ultra
   Larger Android flagships */
@media (min-width: 481px) and (max-width: 530px) {
    .input-default-row {
        gap: 10px;
    }

    .hamburger-menu-btn,
    .input-btn-icon {
        width: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: 1.3rem;
    }

    .send-message-btn {
        width: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    #chat-input-area #chat-input {
        padding: 12px;
        min-height: 44px;
        font-size: 16px;
    }
}

/* Tablets and Larger Screens (531px+)
   iPad Mini / iPad / iPad Air (7.9" - 10.9")
   iPad Pro (11" - 12.9")
   Samsung Galaxy Tab S series
   Larger Android tablets */
@media (min-width: 531px) {
    .input-default-row {
        gap: 12px;
    }

    .hamburger-menu-btn,
    .input-btn-icon {
        width: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: 1.3rem;
    }

    .send-message-btn {
        width: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    #chat-input-area #chat-input {
        padding: 12px;
        min-height: 44px;
        font-size: 16px;
    }
}

/* Desktop / Large Tablets (1024px+) */
@media (min-width: 1024px) {
    .input-default-row {
        gap: 16px;
    }

    .hamburger-menu-btn,
    .input-btn-icon {
        width: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    #chat-input-area #chat-input {
        padding: 12px;
        min-height: 44px;
    }
}

/* Ultra-Wide Displays (1920px+) */
@media (min-width: 1920px) {
    .input-default-row {
        gap: 20px;
    }
}
/* ── Inline memory edit panel (Claude-style) ── */
#memory-inline-edit {
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    display: none;
}

.mem-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.mem-edit-back {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px 0;
    opacity: 0.8;
}
.mem-edit-back:hover { opacity: 1; }

.mem-edit-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

.mem-edit-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0 80px;
}

.mem-edit-section {
    padding: 14px 16px 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
}
.mem-edit-section:last-child { border-bottom: none; }

.mem-edit-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.mem-edit-hint {
    font-size: 0.8rem;
    color: var(--text-light);
    opacity: 0.7;
    margin-bottom: 6px;
    line-height: 1.4;
}

.mem-edit-input,
.mem-edit-textarea {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 0.95rem;
    padding: 4px 0 8px;
    outline: none;
    resize: none;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.mem-edit-input:focus,
.mem-edit-textarea:focus {
    border-bottom-color: var(--accent);
}
.mem-edit-textarea { min-height: 72px; }

/* Privacy toggle row */
.mem-edit-privacy .mem-edit-toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}
.mem-edit-toggle-text { display: flex; flex-direction: column; gap: 2px; }
.mem-edit-checkbox { display: none; }
.mem-edit-toggle-track {
    width: 40px;
    height: 22px;
    background: var(--border);
    border-radius: 11px;
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s;
}
.mem-edit-toggle-track::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.mem-edit-checkbox:checked + .mem-edit-toggle-track {
    background: var(--accent);
}
.mem-edit-checkbox:checked + .mem-edit-toggle-track::after {
    transform: translateX(18px);
}

.mem-edit-footer {
    position: sticky;
    bottom: 0;
    padding: 12px 16px;
    background: #2a2a2a;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.mem-edit-save {
    width: 100%;
    padding: 11px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.mem-edit-save:hover { opacity: 0.85; }
