/* ==========================================
   DEALER ASSISTANT - AK PROMPT STUDIO STYLE
   Ported from AK Prompt Studio v3.0
   ========================================== */

:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #121214;
    --bg-card: #1a1a1e;
    --bg-input: #0d0d0f;
    --bg-hover: #222228;
    --border-subtle: #2a2a30;
    --border-active: #4a4a55;
    --text-primary: #e8e8eb;
    --text-secondary: #9a9aa5;
    --text-muted: #6a6a75;
    --accent-primary: #3f9d3a;
    --accent-primary-dim: #2f7d2a;
    --accent-primary-glow: rgba(63, 157, 58, 0.15);
    --accent-primary-bright: #4fad4a;
    --success: #4a9a6a;
    --error: #c45c5c;
}

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

body {
    font-family: 'Source Sans 3', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ==========================================
   HEADER
   ========================================== */

.header {
    background: var(--bg-primary);
    padding: 1rem 0;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo-img {
    height: 38px;
    width: auto;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.6rem;
    letter-spacing: 4px;
    line-height: 1;
}

.logo-subtitle {
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 2px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.user-tokens {
    font-size: 0.75rem;
    color: var(--accent-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.user-tokens::before {
    content: '🪙';
    font-size: 0.85rem;
}

.account-link {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
    margin-right: 0.5rem;
}

.account-link:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.logout-link {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.logout-link:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

/* ==========================================
   APP CONTAINER
   ========================================== */

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.5rem 2rem 2rem;
}

.main-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0 1rem;
    }
    .app-container {
        padding: 0.5rem 1rem 2rem;
    }
}

/* ==========================================
   CONTROL PANEL (LEFT SIDEBAR)
   ========================================== */

.control-panel {
    display: flex;
    flex-direction: column;
}

.notes-display {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    min-height: 60px;
}

.notes-display-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.notes-display-text .note-title {
    color: var(--accent-primary);
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
}

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1.25rem;
}

.panel-section {
    margin-bottom: 1.1rem;
}

.panel-section:last-child {
    margin-bottom: 0;
}

.section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.section-label::before {
    content: '—';
    color: var(--accent-primary);
}

.info-icon {
    width: 14px;
    height: 14px;
    background: var(--border-subtle);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    color: var(--text-muted);
    cursor: help;
    position: relative;
}

.info-icon:hover {
    background: var(--accent-primary);
    color: white;
}

.info-icon[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: normal;
    max-width: 250px;
    text-transform: none;
    letter-spacing: normal;
    font-weight: normal;
    z-index: 100;
    margin-bottom: 5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* ==========================================
   FORM CONTROLS
   ========================================== */

.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.65rem;
}

select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    transition: border-color 0.2s;
}

select:hover {
    border-color: var(--border-active);
}

/* Tone Options */
.tone-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.tone-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: var(--bg-input);
    border: 2px solid var(--border-subtle);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.tone-option:hover {
    border-color: var(--border-active);
    background: var(--bg-hover);
}

.tone-option.active {
    border-color: var(--accent-primary);
    background: rgba(63, 157, 58, 0.1);
}

.tone-icon {
    font-size: 1.5rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.tone-option.active .tone-icon {
    color: var(--accent-primary);
}

.tone-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.2;
}

.tone-option.active .tone-label {
    color: var(--text-primary);
}

select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

select option {
    background: var(--bg-secondary);
}

textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s;
}

textarea:hover {
    border-color: var(--border-active);
}

textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

textarea::placeholder {
    color: var(--text-muted);
}

/* ==========================================
   LOCKED/DISABLED STATE
   ========================================== */

.form-sections-locked {
    position: relative;
}

.form-sections-locked.locked {
    pointer-events: none;
}

.form-sections-locked.locked::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 11, 0.6);
    border-radius: 8px;
    z-index: 10;
}

.task-locked-sections {
    position: relative;
}

.task-locked-sections.locked {
    pointer-events: none;
    opacity: 0.4;
}

.output-locked-sections {
    position: relative;
}

.output-locked-sections.locked {
    pointer-events: none;
    opacity: 0.4;
}

.lock-message {
    background: var(--bg-secondary);
    border: 1px dashed var(--border-subtle);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    margin-bottom: 1rem;
    display: none;
}

.lock-message.show {
    display: block;
}

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

/* ==========================================
   DYNAMIC FORM FIELDS PANEL
   ========================================== */

.specs-panel {
    display: none;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-secondary);
    overflow: hidden;
}

.specs-panel.visible {
    display: block;
}

.specs-panel .panel-section {
    margin-bottom: 0.75rem;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.form-field label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.form-field input,
.form-field select {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.8rem;
}

.form-field input::placeholder {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-field select {
    padding-right: 2rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236a6a75' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

/* ==========================================
   COLLAPSIBLE (STRATEGY LAYER)
   ========================================== */

.collapsible {
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    background: var(--bg-secondary);
}

.collapsible-header:hover {
    background: var(--bg-hover);
}

.collapsible-icon {
    font-size: 0.6rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.collapsible.open .collapsible-icon {
    transform: rotate(180deg);
}

.collapsible-content {
    display: none;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
}

.collapsible.open .collapsible-content {
    display: block;
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    gap: 0.5rem;
}

.toggle-icon {
    font-size: 1rem;
    color: var(--text-muted);
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

.toggle-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-grow: 1;
}

.toggle {
    position: relative;
    width: 36px;
    height: 20px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-hover);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    transition: 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: 0.2s;
}

.toggle input:checked + .toggle-slider {
    background: var(--accent-primary-dim);
    border-color: var(--accent-primary);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(16px);
    background: white;
}

/* ==========================================
   GENERATE BUTTON
   ========================================== */

.generate-btn {
    width: 100%;
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 1rem;
}

.generate-btn:hover:not(:disabled) {
    background: var(--accent-primary-bright);
    transform: translateY(-1px);
}

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

/* ==========================================
   OUTPUT PANEL (RIGHT SIDE)
   ========================================== */

.output-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

/* ── Channel selector bar — equal 3-way split ── */
.output-channel-bar {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
}

.output-channel-bar .output-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 13px 8px;
    background: transparent;
    border: none;
    border-right: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    position: relative;
}

.output-channel-bar .output-tab:last-child {
    border-right: none;
}

.output-channel-bar .output-tab i {
    font-size: 1.05rem;
}

.output-channel-bar .output-tab:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.03);
}

.output-channel-bar .output-tab.active {
    color: #ffffff;
    background: var(--accent-primary);
}
.output-channel-bar .output-tab.active i,
.output-channel-bar .output-tab.active span {
    color: #ffffff;
    opacity: 1;
}

/* Green underline on active tab */
.output-channel-bar .output-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 2px 2px 0 0;
}

/* ── Action toolbar ── */
.output-action-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    flex-wrap: wrap;
}

.action-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 5px 11px;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    white-space: nowrap;
}

.action-btn i {
    font-size: 0.78rem;
}

.action-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--accent-primary-dim);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.favorite-btn:hover {
    border-color: #f5a623;
    color: #f5a623;
    background: rgba(245,166,35,0.08);
}

.favorite-btn.active {
    color: #f5a623;
    border-color: #f5a623;
}

.favorite-btn.active i {
    font-weight: 900;
}

.output-body {
    flex: 1;
    overflow: auto;
}

.output-pane {
    display: none;
    padding: 1.25rem;
    height: 100%;
}

.output-pane.active {
    display: block;
}

.output-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-muted);
    text-align: center;
}

.output-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    color: var(--text-muted);
}

.output-empty-icon i {
    font-size: 3rem;
}

.output-empty h3 {
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.output-content {
    padding: 0;
}

.email-subject {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.email-subject strong {
    color: var(--text-muted);
    font-weight: 600;
    margin-right: 0.5rem;
}

.email-subject span {
    color: var(--text-primary);
}

.generated-prompt {
    background: var(--bg-input);
    border: none;
    border-radius: 0;
    padding: 1.5rem 1.25rem;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.9rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-primary);
    max-height: 500px;
    overflow-y: auto;
    margin: 0;
}

.generated-prompt.editable {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

/* ==========================================
   TOAST NOTIFICATION
   ========================================== */

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--success);
}

.toast.success #toastIcon {
    color: var(--success);
}

/* ==========================================
   ERROR MESSAGE
   ========================================== */

.error-message {
    margin: 2rem 0;
    padding: 1rem 1.25rem;
    background: rgba(196, 92, 92, 0.1);
    border: 1px solid var(--error);
    border-radius: 8px;
    color: var(--error);
    font-size: 0.9rem;
}

/* ==========================================
   RESPONSIVE ADJUSTMENTS
   ========================================== */

@media (max-width: 1024px) {
    .output-panel {
        margin-top: 1.5rem;
    }
}

@media (max-width: 480px) {
    .output-channel-bar .output-tab {
        font-size: 0.65rem;
        padding: 10px 4px;
    }

    .output-action-bar {
        gap: 4px;
        padding: 6px 8px;
    }
}

/* ==========================================
   MOCK MODE — PLAN COUNTER STATE
   ========================================== */

/* Amber border + tint when mock is active */
.plan-counter.mock-mode {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.04);
}

.plan-counter.mock-mode .plan-counter-label {
    color: #f59e0b;
}

.plan-counter.mock-mode .plan-counter-value {
    color: #f59e0b;
}

/* Amber fill bar in mock mode */
.plan-counter-fill.mock {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

/* Small inline ⚡ MOCK tag shown only when .mock-mode is active */
.mock-mode-tag {
    display: none;
    align-items: center;
    gap: 3px;
    font-size: 0.62rem;
    font-weight: 700;
    color: #f59e0b;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 4px;
    padding: 1px 5px;
    line-height: 1.5;
}

.plan-counter.mock-mode .mock-mode-tag {
    display: inline-flex;
}

/* ==========================================
   SIDEBAR USER CARD
   ========================================== */

/* Single-line horizontal strip: [avatar name role] ──── [Acct] [Admin] [Logout] */
.sidebar-user {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 9px 12px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.sidebar-user-avatar {
    font-size: 1.15rem;
    color: var(--accent-primary);
    flex-shrink: 0;
    line-height: 1;
}

.sidebar-user-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.sidebar-user-role {
    font-size: 0.58rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    line-height: 1.2;
}

.sidebar-user-links {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* Icon-only compact buttons */
.sidebar-user-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 26px;
    border-radius: 6px;
    font-size: 0.75rem;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.sidebar-user-link:hover {
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.15);
}

.sidebar-user-link.admin {
    color: var(--accent-primary);
    border-color: rgba(63,157,58,0.3);
}

.sidebar-user-link.admin:hover {
    background: var(--accent-primary-dim);
}

.sidebar-user-link.logout {
    color: var(--error);
    border-color: rgba(224,96,96,0.25);
}

.sidebar-user-link.logout:hover {
    background: rgba(224,96,96,0.08);
    border-color: rgba(224,96,96,0.4);
}

.sidebar-user-link.login {
    color: #f59e0b;
    border-color: rgba(245,158,11,0.3);
}

.sidebar-user-link.login:hover {
    background: rgba(245,158,11,0.08);
    border-color: rgba(245,158,11,0.5);
}

/* Notes display inside form-card — strip card chrome, keep accent */
.form-card .notes-display {
    background: transparent;
    border: none;
    border-left: 3px solid var(--accent-primary-dim);
    border-radius: 0;
    padding: 0.4rem 0 0.4rem 0.875rem;
    margin-bottom: 1.1rem;
}

/* ==========================================
   USER ROLE BADGE
   ========================================== */

.user-role {
    font-size: 0.65rem;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ==========================================
   PLAN / TOKEN COUNTER
   ========================================== */

.plan-counter {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
}

.plan-counter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.plan-counter-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.plan-counter-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.plan-counter-detail {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.plan-counter-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-primary);
    font-family: 'JetBrains Mono', monospace;
}

.plan-counter-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.plan-counter-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), #4fad4a);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.plan-counter-fill.low {
    background: linear-gradient(90deg, #e8a93a, #d89520);
}

.plan-counter-fill.critical {
    background: linear-gradient(90deg, #c45c5c, #a83232);
}

.plan-upgrade-link {
    display: block;
    text-align: right;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-primary);
    text-decoration: none;
    margin-top: 5px;
    opacity: 0.8;
    transition: opacity 0.15s;
}
.plan-upgrade-link:hover { opacity: 1; }

/* ==========================================
   SEQUENCE STEPS (Multi-Step Output)
   ========================================== */

.sequence-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
}

.sequence-step {
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    background: var(--bg-card);
    border-bottom: 1px solid transparent;
    transition: background 0.2s;
}

.step-header:hover {
    background: var(--bg-hover);
}

.sequence-step.open .step-header {
    border-bottom-color: var(--border-subtle);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.step-title {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.step-toggle {
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.sequence-step.open .step-toggle {
    transform: rotate(180deg);
}

.step-content {
    display: none;
    padding: 16px;
}

.sequence-step.open .step-content {
    display: block;
}

.step-prompt {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    background: transparent;
}

/* ==========================================
   VISUAL HIERARCHY (Phase 10)
   ========================================== */

/* Notes display — green left accent */
.notes-display {
    border-left: 3px solid var(--accent-primary-dim);
}

/* Section labels — stronger weight + brightness */
.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 1.6px;
}

/* Info section card grouping — make specs-panel transparent,
   each panel-section becomes its own card */
.specs-panel {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    gap: 0;
}

.specs-panel .panel-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--accent-primary-dim);
    border-radius: 8px;
    padding: 0.875rem 1rem;
    margin-bottom: 0.625rem;
}

.specs-panel .panel-section:last-child {
    margin-bottom: 0;
}

/* Section labels inside info cards — accent color */
.specs-panel .section-label {
    color: var(--accent-primary);
    font-size: 0.68rem;
    margin-bottom: 0.625rem;
}

/* Form field labels — legible contrast */
.form-field label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

/* Generated content — framed card within the output pane */
.output-content {
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
    margin: 0;
}

.output-content .generated-prompt {
    background: var(--bg-secondary);
    border: none;
    border-radius: 0;
    padding: 1.25rem;
    max-height: 460px;
}

.output-content .email-subject {
    border-radius: 0;
    background: var(--bg-card);
}

/* Output pane — give room around the framed content */
.output-pane {
    padding: 1rem;
}

/* Active channel tab — subtle glow */
.output-channel-bar .output-tab.active {
    box-shadow: inset 0 -2px 8px rgba(0, 0, 0, 0.15);
}

/* Chat panel — stronger visual separator from output */
.chat-panel {
    border-top: 2px solid rgba(63, 157, 58, 0.25);
    background: var(--bg-secondary);
}

/* Collapsible header (Strategy Layer) — slightly more prominent */
.collapsible-header .section-label {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

/* Communication Tone — tighter section label */
.tone-options {
    margin-top: 0.25rem;
}

/* Plan counter label — slightly bigger */
.plan-counter-label {
    font-size: 0.78rem;
}

/* Action buttons — refined sizing */
.action-btn {
    font-size: 0.78rem;
    padding: 0.55rem 0.875rem;
}

/* ==========================================
   HISTORY & FAVORITES PAGES (Phase 3B)
   ========================================== */

.browse-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

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

.browse-header h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.8rem;
    letter-spacing: 3px;
    color: var(--text-primary);
}

.browse-header .item-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0;
    font-family: 'Source Sans 3', sans-serif;
}

.browse-nav {
    display: flex;
    gap: 0.5rem;
}

.browse-nav a {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.browse-nav a:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Filter Bar */
.filter-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input[type="text"] {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    transition: border-color 0.2s;
}

.filter-bar select:focus,
.filter-bar input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.filter-bar input[type="text"] {
    flex: 1;
    min-width: 150px;
}

.filter-bar input[type="text"]::placeholder {
    color: var(--text-muted);
}

.filter-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.filter-btn:hover {
    background: var(--accent-primary-bright);
}

.filter-reset {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-reset:hover {
    color: var(--text-primary);
    border-color: var(--border-active);
}

/* Bulk Actions Bar */
.bulk-bar {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.bulk-bar label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

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

.bulk-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.bulk-btn:hover {
    border-color: var(--error);
    color: var(--error);
}

.bulk-btn.danger {
    color: var(--error);
    border-color: rgba(196, 92, 92, 0.3);
}

.bulk-btn.danger:hover {
    background: rgba(196, 92, 92, 0.1);
    border-color: var(--error);
}

.bulk-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* History/Favorites Item Cards */
.item-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.item-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.item-card:hover {
    border-color: var(--border-active);
}

.item-card.selected {
    border-color: var(--accent-primary);
    background: rgba(63, 157, 58, 0.03);
}

.item-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid transparent;
}

.item-card.expanded .item-card-header {
    border-bottom-color: var(--border-subtle);
}

.item-card-header input[type="checkbox"] {
    accent-color: var(--accent-primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.item-type-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    flex-shrink: 0;
}

.item-type-badge.phone {
    background: rgba(88, 166, 255, 0.15);
    color: #58a6ff;
}

.item-type-badge.email {
    background: rgba(216, 149, 32, 0.15);
    color: #d89520;
}

.item-type-badge.text {
    background: rgba(63, 157, 58, 0.15);
    color: #4fad4a;
}

.item-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.item-meta-top {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta-bottom {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.item-meta-bottom span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.item-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.item-action-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.item-action-btn:hover {
    border-color: var(--border-active);
    color: var(--text-primary);
    background: var(--bg-hover);
}

.item-action-btn.delete:hover {
    border-color: var(--error);
    color: var(--error);
}

.item-action-btn.reuse:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.item-action-btn.reuse-labeled {
    width: auto;
    padding: 0 12px;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
}

/* Expiry chip (History — auto-delete countdown) */
.expiry-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.3px;
    background: rgba(74,154,106,0.12);
    color: var(--success);
    border: 1px solid rgba(74,154,106,0.2);
}
.expiry-chip.warn {
    background: rgba(212,160,23,0.13);
    color: #d4a017;
    border-color: rgba(212,160,23,0.28);
}
.expiry-chip.expired {
    background: rgba(196,92,92,0.12);
    color: var(--error);
    border-color: rgba(196,92,92,0.25);
}

/* Perm chip (Favorites — never expires) */
.perm-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(212,160,23,0.12);
    color: #d4a017;
    border: 1px solid rgba(212,160,23,0.22);
}

/* ── Favorites Page — Amber / Gold theme overrides ────────── */
body.fav-page .page-nav-link.active { color: #d4a017; background: rgba(212,160,23,0.13); }
body.fav-page .browse-header h1 { color: #d4a017; }
body.fav-page .browse-header h1 i { color: #d4a017; }
body.fav-page .item-card.selected { border-color: #d4a017; background: rgba(212,160,23,0.03); }
body.fav-page .item-card-header input[type="checkbox"] { accent-color: #d4a017; }
body.fav-page .item-action-btn.reuse:hover { border-color: #d4a017; color: #d4a017; }
body.fav-page .empty-state i { color: #d4a017; }
body.fav-page .filter-bar select:focus,
body.fav-page .filter-bar input[type="text"]:focus { border-color: #d4a017; }
body.fav-page .filter-btn { background: rgba(212,160,23,0.12); border-color: rgba(212,160,23,0.28); color: #d4a017; }
body.fav-page .filter-btn:hover { background: #d4a017; color: #0a0a0b; }
body.fav-page .page-logo .pg-title { color: #d4a017; }
body.fav-page .bulk-bar input[type="checkbox"] { accent-color: #d4a017; }

/* Expanded Content */
.item-card-body {
    display: none;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
}

.item-card.expanded .item-card-body {
    display: block;
}

.item-content-text {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s;
}

.pagination a {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.pagination a:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.pagination .current-page {
    background: var(--accent-primary);
    color: white;
    font-weight: 600;
}

.pagination .page-info {
    color: var(--text-muted);
    font-size: 0.85rem;
}

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

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state h3 {
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 2px;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.9rem;
}

/* Confirm Modal */
.confirm-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.confirm-modal.show {
    display: flex;
}

.confirm-modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.confirm-modal-box h3 {
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 2px;
    margin-bottom: 0.75rem;
}

.confirm-modal-box p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.confirm-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.confirm-modal-actions button {
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.confirm-cancel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.confirm-cancel:hover {
    border-color: var(--border-active);
    color: var(--text-primary);
}

.confirm-delete {
    background: var(--error);
    border: 1px solid var(--error);
    color: white;
}

.confirm-delete:hover {
    background: #a83232;
}

/* Header Nav Links for History/Favorites */
.nav-link {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
    margin-right: 0.5rem;
}

.nav-link:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* ==========================================
   SIDEBAR IMPROVEMENTS (Phase 8)
   ========================================== */

/* Category Buttons */
.category-btn-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 2px;
}

.category-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.83rem;
    font-weight: 600;
    text-align: left;
    width: 100%;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1.2;
}

.category-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-primary);
}

.category-btn.active {
    background: rgba(63, 157, 58, 0.1);
    border-color: rgba(63, 157, 58, 0.5);
    color: var(--accent-primary);
}

.category-btn i {
    font-size: 0.85rem;
    width: 15px;
    text-align: center;
    flex-shrink: 0;
}

/* Tone Options — slim segmented strip (overrides base grid layout) */
.tone-options {
    display: flex;
    gap: 0;
    margin-top: 6px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
}

.tone-option {
    flex: 1;
    flex-direction: row;
    gap: 7px;
    padding: 9px 6px;
    border: none;
    border-right: 1px solid var(--border-subtle);
    border-radius: 0;
    background: var(--bg-secondary);
    justify-content: center;
    align-items: center;
}

.tone-option:last-child {
    border-right: none;
}

.tone-option:hover {
    border-color: var(--border-subtle);
    background: var(--bg-hover);
}

.tone-option.active {
    background: rgba(63, 157, 58, 0.12);
    border-right-color: var(--border-subtle);
}

.tone-icon {
    font-size: 0.88rem;
}

.tone-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* ----------------------------------------
   Contextual Info Tooltips (Phase 8)
   ---------------------------------------- */

.tip-icon {
    display: inline-block;
    font-size: 0.6rem;
    color: var(--text-muted);
    cursor: help;
    position: relative;
    margin-left: 5px;
    vertical-align: middle;
    opacity: 0.65;
    flex-shrink: 0;
    transition: color 0.15s, opacity 0.15s;
}

.tip-icon:hover {
    color: var(--accent-primary);
    opacity: 1;
}

/* Tooltip bubble */
.tip-icon::after {
    content: attr(data-tip);
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    background: #1c1c22;
    border: 1px solid var(--border-subtle);
    border-radius: 7px;
    padding: 8px 11px;
    font-size: 0.72rem;
    font-weight: 400;
    font-family: 'Source Sans 3', sans-serif;
    color: var(--text-secondary);
    white-space: normal;
    width: 215px;
    line-height: 1.5;
    letter-spacing: 0;
    text-transform: none;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 300;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.tip-icon:hover::after {
    opacity: 1;
}

/* .collapsible has overflow:hidden which clips tooltips — override it.
   Move border-radius to children to preserve rounded corners. */
.collapsible {
    overflow: visible;
}

.collapsible-header {
    border-radius: 6px;                 /* all corners when collapsed */
}

.collapsible.open .collapsible-header {
    border-radius: 6px 6px 0 0;        /* top only when open */
}

.collapsible-content {
    border-radius: 0 0 6px 6px;        /* bottom corners */
}

/* Tip icon inside toggle rows — tooltip opens ABOVE, aligned to right edge */
.toggle-row .tip-icon {
    font-size: 0.55rem;
    margin-left: 3px;
    margin-right: 6px;
}

.toggle-row .tip-icon::after {
    left: auto;
    right: 0;
}

/* Expand / Collapse All Controls */
.section-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
    padding-bottom: 6px;
}

.section-ctrl-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 500;
    cursor: pointer;
    padding: 2px 3px;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s;
}

.section-ctrl-btn:hover {
    color: var(--accent-primary);
}

.section-ctrl-sep {
    color: var(--text-muted);
    font-size: 0.7rem;
    pointer-events: none;
}

/* Collapsible Info Sections */
.section-toggle {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.section-toggle::before {
    content: none;
}

/* Info section toggle — remove bottom margin (section-content provides spacing) */
.specs-panel .section-label.section-toggle {
    margin-bottom: 0;
}

.section-toggle:hover {
    opacity: 0.8;
}

.section-collapse-icon {
    font-size: 0.5rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 4px;
}

.info-section.collapsed .section-collapse-icon {
    transform: rotate(-90deg);
}

.info-section.collapsed .section-content {
    display: none;
}

.section-content {
    margin-top: 8px;
}

/* Vehicle Year/Make/Model */
.vehicle-ymm {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 4px;
}

.vehicle-ymm select {
    width: 100%;
    background: var(--bg-input, #0d0d0f);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.85rem;
    padding: 8px 10px;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.15s;
}

.vehicle-ymm select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.vehicle-brand-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0 6px;
}

.vehicle-brand-logo img {
    height: 22px;
    width: auto;
    max-width: 60px;
    object-fit: contain;
    border-radius: 3px;
    background: white;
    padding: 2px;
}

.vehicle-brand-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.vehicle-ymm input[type="text"] {
    width: 100%;
    background: var(--bg-input, #0d0d0f);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.85rem;
    padding: 8px 10px;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.vehicle-ymm input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* ==========================================
   MOBILE PANEL TOGGLE (Phase 8)
   ========================================== */

/* Hidden on desktop — shown on mobile only */
.mobile-panel-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.mobile-panel-toggle:hover,
.mobile-panel-toggle:active {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.mobile-panel-toggle i.fa-sliders {
    font-size: 0.8rem;
}

/* Bottom toggle sits below generate button — border flips to top */
.mobile-panel-toggle.toggle-bottom {
    border-bottom: none;
    border-top: 1px solid var(--border-subtle);
}

/* Chevron — smooth rotation in sync with collapse */
.mobile-panel-chevron {
    margin-left: 4px;
    font-size: 0.6rem;
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
    /* Show both toggle bars on mobile */
    .mobile-panel-toggle {
        display: flex;
    }

    /* Grid-based collapse on the body div — animates to exact content height */
    .control-panel-body {
        display: grid;
        grid-template-rows: 1fr;
        transition: grid-template-rows 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Inner div required: min-height:0 allows grid row to shrink to zero */
    .control-panel-body-inner {
        min-height: 0;
        overflow: hidden;
    }

    /* Collapsed state: body folds to zero height */
    .control-panel.mobile-collapsed .control-panel-body {
        grid-template-rows: 0fr;
    }

    /* Top toggle: bleed to form-card edges, match top border-radius */
    .form-card .toggle-top {
        margin: -1.25rem -1.25rem 1.25rem -1.25rem;
        border-radius: 11px 11px 0 0;
    }

    /* Bottom toggle: bleed to form-card edges, match bottom border-radius */
    /* No negative bottom margin — overflow:hidden on body-inner would clip it */
    .form-card .toggle-bottom {
        margin: 1.25rem -1.25rem 0 -1.25rem;
        border-radius: 0 0 11px 11px;
    }

    /* Remove form-card bottom padding so toggle sits flush at the card edge */
    .form-card {
        padding-bottom: 0;
    }
}

/* Responsive for browse pages */
@media (max-width: 768px) {
    .browse-container {
        padding: 0 1rem 2rem;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-bar select,
    .filter-bar input[type="text"] {
        width: 100%;
    }

    .item-card-header {
        flex-wrap: wrap;
    }

    .item-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }

    .bulk-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .bulk-count {
        margin-left: 0;
    }
}

/* ── AI Provider Selector (Phase B) ──────────────────────────────────────── */
.ai-selector-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.ai-selector-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}
.ai-provider-select,
.ai-model-select {
    flex: 1;
    background: var(--bg-card, #1a1a1e);
    color: var(--text-primary, #fff);
    border: 1px solid var(--border-subtle, #2a2a2e);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s;
}
.ai-provider-select:hover,
.ai-model-select:hover {
    border-color: var(--border-active, #444);
}
.ai-provider-select:focus,
.ai-model-select:focus {
    outline: none;
    border-color: var(--accent-primary, #3f9d3a);
}
