/* ==================== */
/* Tools Grid & Tool Panels */
/* ==================== */
.tools-grid-view {
    padding: 8px 0;
}

.tools-grid-view.hidden {
    display: none;
}

.tools-grid-header {
    margin-bottom: 24px;
}

.tools-grid-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.tools-grid-subtitle {
    font-size: 14px;
    color: var(--color-text-muted);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    align-items: stretch;
}

.tool-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 20px 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-card);
    box-sizing: border-box;
}

.tool-card-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
}

.tool-card:hover {
    border-color: rgba(79, 70, 229, 0.2);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.1);
    transform: translateY(-2px);
}

.tool-card:active {
    transform: translateY(0);
}

/* Tool card pin button */
.tool-pin-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--color-text-faint, #ccc);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 2;
}

.tool-card:hover .tool-pin-btn {
    opacity: 1;
}

.tool-pin-btn:hover {
    background: rgba(79, 70, 229, 0.08);
    color: var(--color-primary, #6366f1);
}

.tool-pin-btn.pinned {
    opacity: 1;
    color: var(--color-primary, #6366f1);
}

.tool-pin-btn.pinned svg {
    fill: var(--color-primary, #6366f1);
}

.tool-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #4f46e5;
}

.tool-card-content {
    flex: 1;
    min-width: 0;
}

.tool-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
}

/* Agent assignment chip — shown below tool name on each card */
.tool-agent-chip {
    font-size: 11px;
    color: var(--color-text-faint, #a0a0b0);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.tool-card-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
    white-space: nowrap;
    letter-spacing: 0.02em;
    align-self: center;
}

.tool-card-badge[data-status="live"] {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.tool-card-badge[data-status="coming-soon"] {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid rgba(107, 114, 128, 0.2);
}

.tool-card-badge[data-status="exploring"] {
    background: #f0f9ff;
    color: #0284c7;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.tool-card-desc {
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.tool-card-arrow {
    font-size: 22px;
    color: var(--color-text-faint);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.tool-card:hover .tool-card-arrow {
    transform: translateX(3px);
    color: #4f46e5;
}

/* Placeholder Tool Cards */
.tool-card-placeholder {
    min-height: 92px;
    border-radius: 14px;
    background: linear-gradient(135deg, #f3f4f6 0%, #e9ecf0 40%, #f3f4f6 100%);
    border: 1px solid rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.tool-card-placeholder::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: placeholderShimmer 2.5s ease-in-out infinite;
}

@keyframes placeholderShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Tool Panel Header — Training Video Button */
.tool-video-btn {
    padding: 7px 16px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: white;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-video-btn.has-video {
    color: var(--color-text-muted);
}

.tool-video-btn.has-video:hover {
    background: var(--color-bg-muted);
    border-color: rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.tool-video-btn.no-video {
    color: #c0c4cc;
    border-color: rgba(0, 0, 0, 0.06);
    cursor: default;
}

.tool-video-btn.no-video svg {
    opacity: 0.5;
}

/* Tool Panel */
.tool-panel {
    animation: stepFadeIn 0.3s ease-out;
}

.tool-panel.hidden {
    display: none;
}

/* ============================== */
/* Hide front face — My Tools is now inline on the back face */
/* ============================== */
.tools-flip-front {
    display: none !important;
}

/* ============================== */
/* ============================== */
/* Tool Panel Full-Tab Takeover   */
/* ============================== */

/* Tool takeover: back face fills the container */
.tools-flip-container.tool-active-takeover .tools-flip-back {
    overflow: visible;
}

/* Takeover mode: remove padding, become flex column */
.tools-layout.tool-active {
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Hide ALL tool sections during takeover */
.tools-layout.tool-active > .tools-section {
    display: none !important;
}

/* Show ONLY the parent section of the active tool */
.tools-layout.tool-active > .tools-section.tool-parent-active {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    margin-bottom: 0;
    min-height: 0;
}

/* Hide grids within the active parent */
.tools-layout.tool-active .tool-parent-active .tools-grid-view {
    display: none !important;
}

/* The visible tool panel fills the parent section */
.tools-layout.tool-active .tool-panel:not(.hidden) {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 24px;
    min-height: 0;
}

/* Tool panel body scrolls and fills remaining space */
.tools-layout.tool-active .tool-panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.tool-panel-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 101;
}

/* Button bar: inline with header title */
.tool-panel-button-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

/* Action buttons in header bar */
.tool-panel-button-bar > * {
    width: auto;
    height: 30px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-sizing: border-box;
    font-size: 12px;
    white-space: nowrap;
}

.tool-back-btn {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-back-btn:hover {
    background: var(--color-bg-muted);
    border-color: var(--color-text-faint);
}

.tool-panel-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
}

/* Assigned agent label — shown inline after the tool title in the panel header */
.tool-panel-agent {
    font-size: 12px;
    font-weight: 400;
    color: var(--color-text-faint, #aaa);
    white-space: nowrap;
}

.tool-panel-badge {
    padding: 4px 12px;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border: 1px solid rgba(79, 70, 229, 0.15);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #4f46e5;
}

/* Tool Status Badges — match header button style */
.tool-status-badge {
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    position: relative;
    z-index: 5;
    transition: all 0.2s ease;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: var(--color-text-muted);
}

.tool-status-badge:hover {
    background: var(--color-bg-muted);
    border-color: rgba(0, 0, 0, 0.2);
}

/* Status Dropdown */
.status-dropdown {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 6px;
    z-index: 9999;
    min-width: 160px;
    animation: dropdownFade 0.12s ease;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.status-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s ease;
}

.status-dropdown-item:hover {
    background: #F3F4F6;
}

.status-dropdown-item.active {
    background: #EEF2FF;
    color: #4F46E5;
}

.status-dropdown-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dropdown-dot[data-status="live"] {
    background: #10B981;
}

.status-dropdown-dot[data-status="coming-soon"] {
    background: #9ca3af;
}

.status-dropdown-dot[data-status="in-development"] {
    background: var(--color-primary);
}

.status-dropdown-dot[data-status="exploring"] {
    background: #0EA5E9;
}

/* Tool Panel Overview — compact 2-line description */
.tool-panel-overview {
    margin-bottom: 12px;
    transition: opacity 0.25s ease, max-height 0.3s ease, margin 0.3s ease;
    overflow: hidden;
}

.tool-panel-overview.tool-active-hidden {
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
    pointer-events: none;
}

/* Show only the first section, hide the rest */
.tool-overview-section ~ .tool-overview-section {
    display: none;
}

.tool-overview-section {
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    text-align: left;
}

/* Hide the "What it does" label */
.tool-overview-label {
    display: none;
}

.tool-overview-section p {
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin: 0;
    max-width: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* ================================================ */
/* Unified Prompt Bar — matches Room chat input bar */
/* ================================================ */
.tool-prompt-bar {
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #f6f7f8 0%, #eff0f2 100%);
    border-radius: 24px;
    padding: 14px 18px 10px 18px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.04),
        0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 16px 12px;
}

.tool-prompt-bar:focus-within {
    border-color: rgba(79, 70, 229, 0.3);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.04),
        0 0 0 3px rgba(79, 70, 229, 0.1);
}

.tool-prompt-bar textarea,
.tool-prompt-bar input[type="text"] {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0 0 8px 0;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    color: var(--color-text);
    resize: none;
    max-height: 200px;
    line-height: 1.5;
}

.tool-prompt-bar textarea::placeholder,
.tool-prompt-bar input[type="text"]::placeholder {
    color: #6b6b6b;
}

.tool-prompt-bar textarea:focus,
.tool-prompt-bar input[type="text"]:focus {
    outline: none;
    border: none;
    box-shadow: none;
}

.tool-prompt-bar .prompt-send-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #1a1a1a;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    align-self: flex-end;
}

.tool-prompt-bar .prompt-send-btn:hover {
    background: #333333;
    transform: scale(1.05);
}

.tool-prompt-bar .prompt-send-btn:active {
    transform: scale(0.95);
}

.tool-prompt-bar .prompt-send-btn:disabled {
    cursor: not-allowed;
    background: #d1d5db;
}

/* Coming Soon Tool Body */
.tool-coming-soon-body {
    text-align: center;
    padding: 48px 24px 40px;
    background: linear-gradient(180deg, #fafbfc 0%, #f3f4f6 100%);
    border: 2px dashed #e5e7eb;
    border-radius: 16px;
}

.tool-coming-soon-avatar {
    width: 72px;
    height: 88px;
    border-radius: 14px;
    object-fit: cover;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border: 2px solid rgba(255, 255, 255, 0.85);
}

.tool-coming-soon-body p {
    font-size: 14px;
    color: var(--color-text-muted);
    margin: 0 0 20px;
    line-height: 1.6;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

.tool-coming-soon-body .build-in-studio-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.tool-coming-soon-body .build-in-studio-cta:hover {
    background: var(--color-bg-muted);
    border-color: rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

/* ==================== */
/* Video Library Tool   */
/* ==================== */

.vidlib-powered-by {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: var(--color-primary);
}


/* Filter Bar */
.vidlib-filter-bar {
    display: flex;
    gap: 8px;
    padding: 0 0 16px;
    flex-wrap: wrap;
}

.vidlib-filter-btn {
    padding: 6px 16px;
    border: 1px solid var(--color-border-strong);
    background: var(--color-bg);
    border-radius: var(--radius-2xl);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

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

.vidlib-filter-btn.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* Search */
.vidlib-search-row {
    margin-bottom: 16px;
}

.vidlib-search-input {
    width: 25%;
    padding: 10px 14px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-bg);
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.vidlib-search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

.vidlib-search-input::placeholder {
    color: var(--color-text-faint);
}

/* Video Grid */
.vidlib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.vidlib-grid.hidden { display: none; }

/* Video Card */
.vidlib-card {
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.vidlib-card:hover {
    border-color: var(--color-primary-border);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Thumbnail */
.vidlib-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.vidlib-thumb-placeholder {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
}

.vidlib-card:hover .vidlib-thumb-placeholder {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.vidlib-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Video Info */
.vidlib-info {
    padding: 14px 16px 16px;
}

.vidlib-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.vidlib-category-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
    letter-spacing: 0.02em;
}

.vidlib-category-tag[data-category="onboarding"] {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.vidlib-category-tag[data-category="updates"] {
    background: var(--color-primary-bg);
    color: var(--color-primary);
    border: 1px solid var(--color-primary-border);
}

.vidlib-category-tag[data-category="training"] {
    background: #f0f9ff;
    color: #0284c7;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.vidlib-category-tag[data-category="sales"] {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.vidlib-status {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.vidlib-status--outdated {
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.vidlib-status--interactive {
    background: rgba(79, 70, 229, 0.08);
    color: var(--color-primary);
    border: 1px solid rgba(79, 70, 229, 0.2);
}

.vidlib-thumbnail--interactive .vidlib-thumb-placeholder {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(79, 70, 229, 0.15));
}
.vidlib-thumbnail--interactive .vidlib-thumb-placeholder svg {
    stroke: var(--color-primary);
}

.vidlib-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 6px;
    line-height: 1.3;
}

.vidlib-desc {
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vidlib-tool-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    color: var(--color-primary);
    font-weight: 500;
    cursor: pointer;
}

.vidlib-tool-link:hover {
    text-decoration: underline;
}

/* Empty State */
.vidlib-empty {
    text-align: center;
    padding: 48px 24px;
}

.vidlib-empty.hidden { display: none; }

.vidlib-empty p {
    font-size: 14px;
    color: var(--color-text-muted);
    margin: 12px 0 0;
}

/* Footer */
.vidlib-footer {
    text-align: center;
    font-size: 12px;
    color: var(--color-text-faint);
    padding-top: 16px;
}

/* Notification -> Video Library Link */
.vidlib-notification-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px 14px;
    background: var(--color-primary-bg);
    border: 1px solid var(--color-primary-border);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.vidlib-notification-link:hover {
    background: var(--color-primary-bg-hover, var(--color-primary-bg));
    border-color: var(--color-primary);
    transform: translateX(2px);
}

/* Video Card Highlight (when navigated from notification) */
.vidlib-card--highlighted {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px var(--color-primary-ring), var(--shadow-md) !important;
    animation: vidlibHighlightPulse 0.6s ease-out;
}

@keyframes vidlibHighlightPulse {
    0% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* ==================== */
/* Owner Reports Tool   */
/* ==================== */

.or-state { width: 100%; }
.or-state.hidden { display: none; }

/* Upload State */
.or-upload-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    min-height: 340px;
    position: relative;
}

.or-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 40px;
    border: 2px dashed rgba(0, 0, 0, 0.15);
    border-radius: 16px;
    background: rgba(249, 250, 251, 0.6);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    width: 100%;
    max-width: 500px;
}

.or-dropzone:hover, .or-dropzone.dragover {
    border-color: var(--color-primary);
    background: rgba(238, 242, 255, 0.5);
}

.or-dropzone h3 {
    font-size: 17px;
    font-weight: 600;
    color: #1F2937;
    margin: 4px 0 0 0;
}

.or-dropzone p {
    font-size: 13px;
    color: #6B7280;
    line-height: 1.5;
    max-width: 360px;
    margin: 0;
}

.or-browse-btn {
    margin-top: 8px;
    padding: 8px 20px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.or-browse-btn:hover {
    background: #4F46E5;
}

/* Processing State */
.or-processing-state {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 340px;
}

.or-processing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
}

.or-processing-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
    margin: 0;
}

.or-processing-content p {
    font-size: 13px;
    color: #6B7280;
    margin: 0;
}

.or-spin {
    animation: or-spin 1.5s linear infinite;
}

@keyframes or-spin {
    100% { transform: rotate(360deg); }
}

.or-progress-bar {
    width: 280px;
    height: 6px;
    background: #E5E7EB;
    border-radius: 3px;
    overflow: hidden;
}

.or-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4f46e5, #818CF8);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.or-progress-label {
    font-size: 12px;
    color: #9CA3AF;
    font-weight: 500;
}

/* Owner Report QA — Action buttons in main Chat */
.or-chat-action-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    flex-wrap: wrap;
}

.or-chat-action-btn {
    padding: 6px 14px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.06);
    color: #4F46E5;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.or-chat-action-btn:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.5);
}

.or-chat-action-btn.primary {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: #fff;
    border-color: transparent;
}

.or-chat-action-btn.primary:hover {
    background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
}

/* Owner Report Error State */
.or-error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
    gap: 12px;
}

.or-error-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.or-error-content p {
    font-size: 13px;
    color: var(--color-text-secondary);
    max-width: 400px;
    line-height: 1.5;
    margin: 0;
}

/* ---- Owner Report Settings ---- */

/* "Report Settings" link below the dropzone */
.or-settings-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 0;
    border: none;
    background: transparent;
    font-size: 20px;
    font-weight: 500;
    color: var(--color-text-muted, #6b7280);
    cursor: pointer;
    transition: color 0.15s ease;
}

.or-settings-link:hover {
    color: var(--color-primary, #6366F1);
}

/* Centered overlay container — covers the upload state */
.or-settings-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 150;
    background: rgba(0, 0, 0, 0.08);
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.or-settings-overlay--open {
    display: flex;
}

/* Settings card — centered modal */
.or-settings-panel {
    width: 100%;
    max-width: 520px;
    max-height: 90%;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: orSettingsFadeIn 0.2s ease;
}

@keyframes orSettingsFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* Panel header */
.or-settings-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.or-settings-header span {
    font-size: 14px;
    font-weight: 600;
    color: #1F2937;
    flex: 1;
}

.or-settings-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.or-settings-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1F2937;
}

/* Settings body — scrollable */
.or-settings-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

/* Preset row */
.or-preset-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.or-preset-select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
    font-family: inherit;
    color: #1F2937;
    cursor: pointer;
    outline: none;
}

.or-preset-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.or-preset-actions {
    display: flex;
    gap: 4px;
}

.or-preset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    color: #6B7280;
    transition: all 0.15s ease;
    padding: 0;
}

.or-preset-btn:hover {
    background: #F3F4F6;
    color: #374151;
    border-color: rgba(0, 0, 0, 0.15);
}

.or-preset-btn--danger:hover {
    background: #FEF2F2;
    color: #DC2626;
    border-color: rgba(220, 38, 38, 0.3);
}

/* Pref groups */
.or-pref-group {
    margin-bottom: 14px;
}

.or-pref-group:last-child {
    margin-bottom: 0;
}

.or-pref-group-title {
    font-size: 11px;
    font-weight: 600;
    color: #9CA3AF;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* Toggle rows */
.or-pref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
}

.or-pref-label {
    font-size: 13px;
    color: #374151;
    flex: 1;
}

.or-pref-toggle {
    position: relative;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

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

.or-pref-toggle-track {
    position: absolute;
    inset: 0;
    background: #D1D5DB;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.or-pref-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.or-pref-toggle input:checked + .or-pref-toggle-track {
    background: var(--color-primary, #6366F1);
}

.or-pref-toggle input:checked + .or-pref-toggle-track::after {
    transform: translateX(16px);
}

/* Selector rows */
.or-pref-selector-row {
    padding: 8px 0;
}

.or-pref-selector-row .or-pref-label {
    margin-bottom: 6px;
}

.or-pref-selector-group {
    display: flex;
    gap: 0;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.or-pref-selector-btn {
    flex: 1;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 500;
    font-family: inherit;
    color: #6B7280;
    background: transparent;
    border: none;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    white-space: nowrap;
}

.or-pref-selector-btn:last-child {
    border-right: none;
}

.or-pref-selector-btn:hover {
    background: rgba(99, 102, 241, 0.06);
    color: #4F46E5;
}

.or-pref-selector-btn.active {
    background: var(--color-primary, #6366F1);
    color: #fff;
    font-weight: 600;
}

.or-pref-description {
    font-size: 11px;
    color: #9CA3AF;
    font-style: italic;
    margin-top: 4px;
    line-height: 1.4;
    min-height: 16px;
}

/* ==================== */
/* Compliance Guide     */
/* ==================== */

.cg-state { width: 100%; }
.cg-state.hidden { display: none; }

/* Library State */
.cg-overview { margin-bottom: 20px; }

.cg-doc-library {
    background: var(--color-bg-secondary, #FAFBFC);
    border: 1px solid var(--color-border, rgba(0, 0, 0, 0.06));
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.cg-doc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.cg-doc-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.cg-doc-count {
    font-size: 12px;
    color: var(--color-text-muted);
    background: rgba(0, 0, 0, 0.04);
    padding: 3px 10px;
    border-radius: 10px;
}

.cg-doc-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.cg-doc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border, rgba(0, 0, 0, 0.05));
    border-radius: 8px;
    font-size: 13px;
}

.cg-doc-icon {
    color: var(--color-primary);
    flex-shrink: 0;
}

.cg-doc-name {
    flex: 1;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.cg-doc-meta {
    font-size: 11px;
    color: var(--color-text-faint);
    white-space: nowrap;
}

.cg-doc-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success, #10B981);
    flex-shrink: 0;
}

.cg-doc-status.processing {
    background: var(--color-warning, #F59E0B);
    animation: pulse-status 1.5s ease-in-out infinite;
}

.cg-doc-status.error {
    background: var(--color-danger, #EF4444);
}

.cg-doc-empty {
    font-size: 13px;
    color: var(--color-text-faint);
    text-align: center;
    padding: 12px;
}

.cg-doc-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.cg-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: var(--color-bg);
    border: 1px solid var(--color-border-strong, rgba(0, 0, 0, 0.12));
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.cg-upload-btn:hover {
    background: var(--color-bg-secondary, #F9FAFB);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.cg-doc-source {
    font-size: 11px;
    color: var(--color-text-faint);
    font-style: italic;
}

/* Sessions */
/* Start Session */
.cg-start-area {
    display: flex;
    justify-content: center;
}

.cg-start-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.cg-start-btn:hover {
    background: #4F46E5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Chat State (split pane) */
.cg-chat-state {
    display: flex;
    gap: 0;
    height: calc(100vh - 200px);
    min-height: 480px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
}

.cg-chat-state.hidden { display: none; }

/* Chat Panel (left) */
.cg-chat-panel {
    width: 65%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    background: #FAFBFC;
}

.cg-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: #fff;
    gap: 10px;
}

.cg-end-session-btn {
    font-size: 12px;
    color: #6B7280;
    background: none;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.cg-end-session-btn:hover {
    background: #F9FAFB;
    color: var(--color-text-secondary);
}

.cg-chat-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    flex: 1;
    text-align: center;
}

.cg-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cg-chat-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.55;
    color: #1F2937;
}

.cg-chat-msg-assistant {
    align-self: flex-start;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 4px 12px 12px 12px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.cg-chat-msg-assistant .chat-assistant-avatar {
    width: 32px;
    height: 38px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    margin-top: 2px;
}

.cg-chat-msg-content {
    flex: 1;
    min-width: 0;
}

.cg-disclaimer {
    text-align: center;
    padding: 20px 28px;
    margin: 8px auto 12px;
    max-width: 520px;
    font-size: 14px;
    line-height: 1.6;
    color: #6B7280;
    background: #F9FAFB;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
}

.cg-disclaimer strong {
    color: var(--color-text-secondary);
}

.cg-chat-msg-user {
    align-self: flex-end;
    background: var(--color-primary);
    color: #fff;
    border-radius: 12px 4px 12px 12px;
}

.cg-chat-msg .cg-citation {
    display: inline-block;
    background: rgba(99, 102, 241, 0.08);
    color: #4F46E5;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    cursor: pointer;
    margin: 0 2px;
}

.cg-chat-msg .cg-citation:hover {
    background: rgba(99, 102, 241, 0.15);
}

/* CG chat input — now inherits from .tool-prompt-bar */
.cg-chat-input-area { /* layout overridden by .tool-prompt-bar */ }
.cg-chat-input { /* styling inherited from .tool-prompt-bar textarea */ }
.cg-chat-send { /* styling inherited from .tool-prompt-bar .prompt-send-btn */ }

/* Reference Panel (right) */
.cg-ref-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.cg-ref-header {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.cg-ref-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.cg-ref-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.cg-ref-empty {
    font-size: 13px;
    color: #9CA3AF;
    font-style: italic;
    text-align: center;
    margin-top: 60px;
}

.cg-ref-card {
    background: #FAFBFC;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-left: 3px solid #4f46e5;
    border-radius: 0 8px 8px 0;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.cg-ref-card-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.cg-ref-card-meta {
    font-size: 11px;
    color: #9CA3AF;
    margin-bottom: 6px;
}

.cg-ref-card-excerpt {
    font-size: 11px;
    color: #4f46e5;
    background: rgba(99, 102, 241, 0.06);
    padding: 5px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    line-height: 1.45;
    font-weight: 500;
    word-break: break-word;
}

.cg-ref-card-link {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #4f46e5;
    text-decoration: none;
    cursor: pointer;
}

.cg-ref-card-link:hover {
    text-decoration: underline;
}

.cg-ref-card-link-disabled {
    color: #9CA3AF;
    cursor: default;
    font-weight: 500;
}

.cg-ref-card-link-disabled:hover {
    text-decoration: none;
}

/* Typing indicator */
.cg-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    align-self: flex-start;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 4px 12px 12px 12px;
}

.cg-typing span {
    width: 6px;
    height: 6px;
    background: #9CA3AF;
    border-radius: 50%;
    animation: cg-bounce 1.4s infinite ease-in-out;
}

.cg-typing span:nth-child(2) { animation-delay: 0.2s; }
.cg-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cg-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* ==================== */
/* Tool Spec Sheet      */
/* ==================== */

/* Button in tool panel header to open spec */
.view-spec-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-bottom: 0;
}

.view-spec-btn:hover {
    background: var(--color-bg-muted);
    border-color: rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

/* Spec sheet full-page view */
.tool-spec-sheet {
    display: none;
    flex-direction: column;
    gap: 0;
    animation: stepFadeIn 0.3s ease-out;
}

.tool-spec-sheet.active {
    display: flex;
}

.spec-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 101;
}

.spec-back-btn {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.spec-back-btn:hover {
    background: var(--color-bg-muted);
    color: var(--color-text);
}

.spec-header h2 {
    flex: 1;
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.spec-header-actions {
    display: flex;
    gap: 8px;
}

.spec-save-btn,
.spec-submit-btn {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    border: none;
    transition: all 0.2s ease;
}

.spec-save-btn {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: var(--color-text-secondary);
}

.spec-save-btn:hover {
    background: var(--color-bg-muted);
}

.spec-submit-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.spec-submit-btn:hover {
    background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
    transform: translateY(-1px);
}

.spec-request-changes-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
    transition: all 0.2s ease;
}

.spec-request-changes-btn:hover {
    background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.spec-request-changes-btn svg {
    flex-shrink: 0;
}

/* Spec sections */
.spec-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    padding-right: 8px;
}

.spec-section {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    padding: 16px 20px;
    transition: border-color 0.2s ease;
}

.spec-section:hover {
    border-color: rgba(0, 0, 0, 0.1);
}

.spec-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.spec-section-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-faint);
    margin: 0;
}

.spec-edit-btn {
    background: none;
    border: none;
    color: var(--color-text-faint);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    line-height: 1;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-family: inherit;
}

.spec-edit-btn:hover {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.06);
}

.spec-section-content {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.spec-section-content p {
    margin: 0;
}

.spec-section-content.empty {
    color: #c4c4c4;
    font-style: italic;
}

/* Editing state */
.spec-section.editing {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.spec-section.editing .spec-edit-btn {
    display: none;
}

.spec-edit-area {
    display: none;
}

.spec-section.editing .spec-section-content {
    display: none;
}

.spec-section.editing .spec-edit-area {
    display: block;
}

.spec-edit-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--color-text);
    line-height: 1.6;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
}

.spec-edit-textarea:focus {
    border-color: var(--color-primary);
}

.spec-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
}

.spec-edit-save,
.spec-edit-cancel {
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    border: none;
    transition: all 0.15s ease;
}

.spec-edit-save {
    background: var(--color-primary);
    color: #fff;
}

.spec-edit-save:hover {
    background: var(--color-primary-hover);
}

.spec-edit-cancel {
    background: var(--color-bg-muted);
    color: var(--color-text-muted);
}

.spec-edit-cancel:hover {
    background: #e5e7eb;
}

/* Spec metadata footer */
.spec-meta {
    display: flex;
    gap: 20px;
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 12px;
    color: var(--color-text-faint);
    flex-wrap: wrap;
}

.spec-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Change log */
.spec-changelog-btn {
    background: none;
    border: none;
    color: #4f46e5;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    padding: 0;
}

.spec-changelog-btn:hover {
    text-decoration: underline;
}

.spec-changelog {
    display: none;
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--color-bg-subtle);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.spec-changelog.open {
    display: block;
}

.spec-changelog-entry {
    font-size: 12px;
    color: var(--color-text-muted);
    padding: 4px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.spec-changelog-entry:last-child {
    border-bottom: none;
}

/* Submit review modal */
.spec-submit-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 300;
    align-items: center;
    justify-content: center;
}

.spec-submit-overlay.active {
    display: flex;
}

.spec-submit-modal {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    max-width: 560px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.spec-submit-modal h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 8px;
}

.spec-submit-modal .spec-submit-intro {
    font-size: 14px;
    color: var(--color-text-muted);
    margin: 0 0 20px;
}

.spec-submit-changes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.spec-submit-change {
    padding: 10px 14px;
    background: var(--color-bg-subtle);
    border-radius: 8px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.spec-submit-change strong {
    color: var(--color-text);
}

.spec-submit-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.spec-submit-confirm,
.spec-submit-cancel {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    border: none;
    transition: all 0.2s ease;
}

.spec-submit-confirm {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: #fff;
}

.spec-submit-cancel {
    background: var(--color-bg-muted);
    color: var(--color-text-muted);
}

.open-in-studio-btn {
    padding: 7px 16px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: white;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-left: 8px;
}

.open-in-studio-btn:hover {
    background: var(--color-bg-muted);
    border-color: rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.tool-panel-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
}

.tool-instructions h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 12px;
}

.tool-instructions ol {
    padding-left: 20px;
    margin-bottom: 20px;
}

.tool-instructions ol li {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
}

.tool-instructions p {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
}

/* Inline variant: heading + steps on one line */
.tool-instructions-inline {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.tool-instructions-inline h3 {
    margin-bottom: 0;
}

.tool-instructions-inline p {
    margin: 0;
    color: var(--color-text-secondary, #6b7280);
}

.tool-tips {
    background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    padding: 16px 20px;
}

.tool-tips h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 10px;
}

.tool-tips ul {
    padding-left: 18px;
    margin: 0;
}

.tool-tips li {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 6px;
    line-height: 1.4;
}

/* Upload Dropzone */
.tool-upload-area {
    margin-top: 4px;
}

/* Photo Editor: center dropzone on page, narrower + taller */
#tool-nano-banana .tool-upload-area {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    margin-top: 0;
}

#tool-nano-banana .upload-dropzone {
    max-width: 475px;
    width: 100%;
    aspect-ratio: 5 / 4;
}

.upload-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    border: 2px dashed #d1d5db;
    border-radius: 16px;
    background: linear-gradient(180deg, #fafbfc 0%, #f3f4f6 100%);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    color: var(--color-text-faint);
}

.upload-dropzone:hover {
    border-color: var(--color-primary);
    background: linear-gradient(180deg, #f5f3ff 0%, #eef2ff 100%);
    color: #4f46e5;
}

.upload-dropzone.drag-over {
    border-color: var(--color-primary);
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
    color: #4f46e5;
    transform: scale(1.01);
}

.dropzone-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-top: 14px;
    margin-bottom: 4px;
}

.dropzone-subtext {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.dropzone-formats {
    font-size: 12px;
    color: var(--color-text-faint);
}

/* ============================== */
/* Tools Sidebar (Favorites + Recently Used) */
/* ============================== */

.tools-with-sidebar {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.tools-sidebar {
    width: 160px;
    min-width: 160px;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    padding: 16px 0;
    overflow-y: auto;
    flex-shrink: 0;
    background: transparent;
}

.tools-sb-section {
    margin-bottom: 20px;
}

.tools-sb-heading {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--color-text-muted);
    letter-spacing: 0.06em;
    padding: 0 14px;
    margin-bottom: 6px;
}

.tools-sb-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.tools-sb-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-radius: 0;
    text-decoration: none;
    color: inherit;
}

.tools-sb-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

.tools-sb-item.active {
    background: rgba(79, 70, 229, 0.06);
}

.tools-sb-item.active .tools-sb-name {
    color: var(--color-primary, #6366f1);
    font-weight: 600;
}

.tools-sb-item.active .tools-sb-icon {
    color: #4f46e5;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
}

.tools-sb-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-text-muted);
    transition: all 0.15s ease;
}

.tools-sb-icon svg {
    width: 15px;
    height: 15px;
}

.tools-sb-label {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.tools-sb-name {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--color-text-secondary, #555);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    line-height: 1.3;
}

.tools-sb-agent {
    font-size: 10.5px;
    color: var(--color-text-faint, #aaa);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.tools-sb-empty {
    font-size: 11px;
    color: var(--color-text-faint);
    padding: 4px 14px;
    font-style: italic;
}

/* Favorite items: show unpin pin on hover */
.tools-sb-fav-item {
    position: relative;
}

.tools-sb-fav-item .tools-sb-pin-btn.pinned {
    opacity: 0;
}

.tools-sb-fav-item:hover .tools-sb-pin-btn.pinned {
    opacity: 1;
}

.tools-sb-fav-item .tools-sb-pin-btn.pinned:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.tools-sb-fav-item .tools-sb-pin-btn.pinned:hover svg {
    fill: #ef4444;
    stroke: #ef4444;
}

/* Make tools-layout fill remaining space */
.tools-with-sidebar .tools-layout {
    flex: 1;
    min-width: 0;
}

/* ========================================== */
/* Sidebar Navigation — Primary Nav Mode      */
/* ========================================== */

/* Upgraded sidebar: wider, absolute overlay, z-indexed above content */
.tools-sidebar.tools-sidebar-nav {
    width: 220px;
    min-width: 220px;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 20;
    background: var(--color-card, #ffffff);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    transition: transform 0.25s ease;
    transform: translateX(0);
    overflow-y: auto;
    overflow-x: hidden;
}

.tools-sidebar.tools-sidebar-nav.tools-sidebar-collapsed {
    transform: translateX(-100%);
}

/* Overlay backdrop behind sidebar when it's open over a tool panel */
.tools-sb-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 19;
    background: rgba(0, 0, 0, 0.15);
}

.tools-sb-overlay.tools-sb-overlay-visible {
    display: block;
}

/* Hamburger button in tools toolbar */
.tools-sb-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--color-text-muted);
    opacity: 0.7;
    transition: opacity 0.15s ease, background 0.15s ease;
    position: absolute;
    left: 28px;
    z-index: 10;
    padding: 0;
}

.tools-sb-hamburger:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.04);
}

/* Make tools-with-sidebar relative so sidebar can overlay */
.tools-with-sidebar {
    position: relative;
}

/* ========================================== */
/* Sidebar Category Sections                   */
/* ========================================== */

.tools-sb-category {
    margin-bottom: 2px;
}

.tools-sb-cat-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px 6px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    user-select: none;
    transition: color 0.15s ease;
}

.tools-sb-cat-header:hover {
    color: var(--color-text);
}

.tools-sb-cat-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
    opacity: 0.5;
}

.tools-sb-cat-header.collapsed .tools-sb-cat-chevron {
    transform: rotate(-90deg);
}

.tools-sb-cat-items {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.25s ease;
}

.tools-sb-cat-items.collapsed {
    max-height: 0;
}

/* Sidebar tool items in categories */
.tools-sb-cat-tool {
    position: relative;
    padding: 6px 14px 6px 20px;
}

.tools-sb-cat-tool .tools-sb-name {
    font-size: 13px;
    font-weight: 400;
}

/* Status dot (hidden — status now shown via icon background color) */
.tools-sb-status-dot {
    display: none;
}

.tools-sb-dot-live {
    background: #22c55e;
}

.tools-sb-dot-exploring {
    background: #3b82f6;
}

/* Sidebar icon status colors */
.tools-sb-icon-live {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.tools-sb-icon-exploring {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.tools-sb-icon-coming-soon {
    background: rgba(156, 163, 175, 0.12);
    color: #9ca3af;
}

/* Sidebar pin button (shown on hover) */
.tools-sb-pin-btn {
    border: none;
    background: transparent;
    color: var(--color-text-faint, #ccc);
    cursor: pointer;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    margin-left: auto;
    opacity: 0;
    transition: all 0.15s ease;
    padding: 0;
}

.tools-sb-cat-tool:hover .tools-sb-pin-btn {
    opacity: 1;
}

.tools-sb-pin-btn:hover {
    background: rgba(79, 70, 229, 0.08);
    color: var(--color-primary, #6366f1);
}

.tools-sb-pin-btn.pinned {
    opacity: 1;
    color: var(--color-primary, #6366f1);
}

.tools-sb-pin-btn.pinned svg {
    fill: var(--color-primary, #6366f1);
}

/* ========================================== */
/* Welcome Dashboard                           */
/* ========================================== */

.tools-welcome-dashboard {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 5;
}

.tools-welcome-dashboard.tools-welcome-visible {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.tools-welcome-inner {
    max-width: 800px;
    width: 100%;
    padding: 48px 32px;
}

.tools-welcome-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.tools-welcome-subtitle {
    font-size: 15px;
    color: var(--color-text-muted);
    margin-bottom: 32px;
}

.tools-welcome-section {
    margin-bottom: 28px;
}

.tools-welcome-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-bottom: 12px;
}

.tools-welcome-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.tools-welcome-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--color-card, #ffffff);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.tools-welcome-card:hover {
    border-color: rgba(79, 70, 229, 0.2);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
    transform: translateY(-1px);
}

.tools-welcome-card-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.tools-welcome-card-icon svg {
    width: 18px;
    height: 18px;
}

.tools-welcome-card-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.tools-welcome-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-left: auto;
    cursor: default;
    position: relative;
}

.tools-welcome-dot::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    right: 50%;
    transform: translateX(50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 5px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 10;
}

.tools-welcome-dot:hover::after {
    opacity: 1;
}

.tools-sb-dot-coming-soon {
    background: #9ca3af;
}

.tools-welcome-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
}

.tools-welcome-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 6px;
}

.tools-welcome-empty-text {
    font-size: 14px;
    color: var(--color-text-muted);
    max-width: 320px;
    line-height: 1.5;
}

/* ========================================== */
/* Hide card grid when sidebar nav is active   */
/* ========================================== */

/* When sidebar nav is active and no tool is open, hide all grid views */
.tools-with-sidebar:has(.tools-sidebar-nav) .tools-layout:not(.tool-active) .tools-grid-view {
    display: none !important;
}

.tools-with-sidebar:has(.tools-sidebar-nav) .tools-layout:not(.tool-active) .tools-section .tools-grid-header {
    display: none !important;
}

/* When a tool IS open, the existing .tool-active CSS already handles hiding grids */

/* tools-layout needs left margin to make room for sidebar when sidebar is visible */
.tools-with-sidebar:has(.tools-sidebar-nav:not(.tools-sidebar-collapsed)) .tools-layout {
    margin-left: 220px;
}

/* When sidebar is collapsed, no margin needed */
.tools-with-sidebar:has(.tools-sidebar-nav.tools-sidebar-collapsed) .tools-layout {
    margin-left: 0;
}

/* When tool is active and sidebar collapsed, layout fills full width */
.tools-with-sidebar:has(.tools-sidebar-nav.tools-sidebar-collapsed) .tools-layout.tool-active {
    margin-left: 0;
}

/* Welcome dashboard adjusts when sidebar is collapsed */
.tools-with-sidebar:has(.tools-sidebar-nav.tools-sidebar-collapsed) .tools-welcome-dashboard {
    left: 0;
}

/* ==================== */
/* Demo Video Mode — Card Layout */
/* ==================== */

/* Hide sidebar and welcome dashboard */
.demo-video-mode .tools-sidebar {
    display: none !important;
}
.demo-video-mode .tools-welcome-dashboard {
    display: none !important;
}

/* Remove sidebar margin so tools fill full width */
.demo-video-mode .tools-layout {
    margin-left: 0 !important;
    padding: 24px 32px;
}

/* Hide section headers/subtitles for cleaner card-only look */
.demo-video-mode .tools-grid-header {
    display: none;
}

/* Larger card grid for video — 3 columns, bigger cards */
.demo-video-mode .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Bigger, more visual cards */
.demo-video-mode .tool-card {
    padding: 20px 24px 24px;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.demo-video-mode .tool-card .tool-card-icon {
    width: 56px;
    height: 56px;
}

/* Hide pin buttons and status badges in demo video */
.demo-video-mode .tool-pin-btn {
    display: none !important;
}
.demo-video-mode .tool-card-badge[data-status="coming-soon"] {
    display: none;
}

/* Hide sidebar toggle button */
.demo-video-mode .tools-sidebar-toggle {
    display: none !important;
}

/* Override sidebar rule that hides grids when sidebar nav exists */
.demo-video-mode .tools-with-sidebar:has(.tools-sidebar-nav) .tools-layout:not(.tool-active) .tools-grid-view {
    display: block !important;
}

