/* ══════════════════════════════════════════════════
   apps/signals.css — chat panel, preview, dashboard, notifications
   Styles specific to the Signals app
   ══════════════════════════════════════════════════ */

/* ── Dashboard overlay ──────────────────────────── */
.dashboard-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.dashboard-dialog {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 900px;
    width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 12px;
}
.dashboard-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}
.dashboard-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
}
.dashboard-close:hover { background: var(--bg-surface); color: var(--text-primary); }
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    padding: 12px 24px 24px;
    overflow-y: auto;
}
.signal-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    background: var(--bg-surface);
}
.signal-card:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(0,180,234,0.18), 0 2px 6px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}
.signal-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0,180,234,0.3);
}
.signal-card-preview {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--bg-surface);
    position: relative;
    container-type: inline-size;
}
/* Images rendered directly into the preview (e.g. presentation slide) fill the container */
.signal-card-preview > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.signal-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 1280px;
    height: 800px;
    transform-origin: top left;
    /* Scale set via JS ResizeObserver (inline style) — avoids cqw-in-transform warnings */
    pointer-events: none;
    border: none;
}
.signal-card-info {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.signal-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.signal-card-date {
    font-size: 11px;
    color: var(--text-secondary);
}
.create-card {
    border-style: dashed;
    border-color: var(--border);
    background: transparent;
}
.create-card:hover {
    border-color: var(--accent);
    background: rgba(0,180,234,0.04);
    box-shadow: 0 8px 24px rgba(0,180,234,0.1), 0 2px 6px rgba(0,0,0,0.2);
}
.create-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    flex-direction: column;
    gap: 8px;
}
.create-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1.5px dashed var(--text-muted);
    color: var(--text-muted);
    font-size: 26px;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.create-card:hover .create-icon {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(0,180,234,0.08);
}

/* ── Main content area (inside app-frame) ────────── */
.main-content {
    flex: 1; display: flex;
    min-width: 0;
    height: 100%;
}

/* ── Chat panel (LEFT) ───────────────────────────── */
.chat-panel {
    width: 400px;
    min-width: 300px;
    max-width: 50vw;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
}
.chat-panel-header {
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    gap: 8px;
}
.chat-panel-header-icon {
    font-size: 15px;
}
.reset-chat-btn {
    margin-left: auto;
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 15px;
    padding: 2px 6px;
    line-height: 1;
    transition: color .15s, border-color .15s;
}
.reset-chat-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── Chat messages ───────────────────────────────── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.chat-messages::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.chat-bubble {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}
.chat-bubble.user {
    align-self: flex-end;
    background: var(--user-bubble);
    color: #dbeafe;
    border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
    align-self: flex-start;
    background: var(--bg-surface);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    white-space: normal;
}
.chat-bubble.assistant p { margin: 0 0 8px 0; }
.chat-bubble.assistant p:last-child { margin-bottom: 0; }
.chat-bubble.assistant strong { color: #fff; }
.chat-bubble.assistant em { color: var(--text-secondary); font-style: italic; }
.chat-bubble.assistant code {
    background: rgba(255,255,255,0.08);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'SF Mono','Consolas','Monaco',monospace;
    font-size: 0.9em;
}
.chat-bubble.assistant pre {
    background: #181818;
    padding: 10px 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 13px;
}
.chat-bubble.assistant pre code {
    background: none;
    padding: 0;
}
.chat-bubble.assistant table {
    width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px;
}
.chat-bubble.assistant th, .chat-bubble.assistant td {
    border: 1px solid var(--border); padding: 6px 10px; text-align: left;
}
.chat-bubble.assistant th {
    background: rgba(255,255,255,0.05); font-weight: 600;
}
.chat-bubble.assistant ul, .chat-bubble.assistant ol {
    margin: 6px 0;
    padding-left: 20px;
}
.chat-bubble.assistant li { margin: 2px 0; }
.chat-bubble.assistant a {
    color: var(--link);
    text-decoration: none;
}
.chat-bubble.assistant h1, .chat-bubble.assistant h2, .chat-bubble.assistant h3 {
    margin: 10px 0 6px 0;
    color: #fff;
}
.chat-bubble.assistant h1 { font-size: 1.3em; }
.chat-bubble.assistant h2 { font-size: 1.15em; }
.chat-bubble.assistant h3 { font-size: 1.05em; }
.chat-bubble.assistant hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 10px 0;
}

/* ── Thinking accordion ─────────────────────────── */
.thinking-accordion {
    align-self: flex-start;
    max-width: 88%;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    font-size: 13px;
    margin: 2px 0;
}
.thinking-accordion-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    font-size: 13px;
}
.thinking-accordion-header:hover { color: var(--text-primary); }
.thinking-accordion-chevron {
    font-size: 10px;
    transition: transform 0.15s;
}
.thinking-accordion.expanded .thinking-accordion-chevron {
    transform: rotate(90deg);
}
.thinking-accordion-label { font-style: italic; }
.thinking-accordion-preview {
    color: var(--text-muted);
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
    opacity: 0.6;
    font-size: 12px;
}
.thinking-accordion-body {
    display: none;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    font-style: italic;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.6;
}
.thinking-accordion.expanded .thinking-accordion-body { display: block; }
.thinking-accordion.done { opacity: 0.5; }
.thinking-accordion.done .thinking-accordion-header { cursor: pointer; }
@keyframes pulse-dot {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}
.thinking-accordion-dot {
    width: 6px; height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse-dot 1.2s ease-in-out infinite;
}
.thinking-accordion.done .thinking-accordion-dot { display: none; }
.chat-bubble.system {
    align-self: center;
    background: none;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 4px 0;
}

/* ── Action chips (de-emphasized tool calls) ──── */
.action-group {
    align-self: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 2px 0;
    max-width: 88%;
}
.action-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
    opacity: 0.85;
}
.action-chip .action-icon { font-size: 11px; color: var(--accent); }
.action-chip .action-name { color: var(--text-primary); }
.action-chip .action-target {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Status spinner ─────────────────────────────── */
.status-spinner {
    display: none;
    align-self: flex-start;
    padding: 8px 16px;
    background: var(--bg-surface);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    gap: 8px;
    align-items: center;
    max-width: 88%;
}
.status-spinner.visible { display: flex; }
.status-spinner-dot {
    width: 8px;
    height: 8px;
    border: 2px solid var(--accent);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin-dot 0.8s linear infinite;
    flex-shrink: 0;
}
@keyframes spin-dot { to { transform: rotate(360deg); } }
.status-spinner-text {
    font-size: 13px;
    color: var(--text-secondary);
    animation: fade-word 3s ease-in-out infinite;
    white-space: nowrap;
}
@keyframes fade-word {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ── Suggestion chips ────────────────────────────── */
.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 10px;
}
.suggestion-chip {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.suggestion-chip:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}
.suggestion-chips.hidden { display: none; }

/* ── Chat input area ─────────────────────────────── */
.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: flex-end;
    position: relative;
    overflow: visible;
}
.chat-input-area textarea {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: none;
    outline: none;
    line-height: 1.4;
    min-height: 40px;
    max-height: 120px;
}
.chat-input-area textarea::placeholder { color: var(--text-muted); }
.chat-input-area textarea:focus { border-color: var(--accent); }
.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    border: none;
    background: var(--accent);
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.chat-send-btn:hover { background: var(--accent-hover); }
.chat-send-btn:disabled { background: var(--bg-surface); color: var(--text-muted); cursor: not-allowed; }
.chat-send-btn svg { width: 16px; height: 16px; }

/* ── Drag handle ─────────────────────────────────── */
.drag-handle {
    width: 5px;
    cursor: col-resize;
    background: var(--bg-primary);
    flex-shrink: 0;
    position: relative;
    transition: background 0.15s;
}
.drag-handle:hover, .drag-handle.active {
    background: var(--accent);
}

/* ── Preview content ─────────────────────────────── */
.preview-content {
    flex: 1;
    position: relative;
    background: var(--bg-primary);
}
.preview-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}
.preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 14px;
    background: var(--bg-panel);
}

/* ── Notification charm & panel ──────────────────── */
.notif-charm {
    position: relative;
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; padding: 4px 6px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
}
.notif-charm:hover { color: var(--text-primary); background: var(--bg-hover); }
.notif-charm.has-active svg {
    animation: notif-ring 2.5s ease-in-out infinite;
    transform-origin: 50% 2px;
}
@keyframes notif-ring {
    0%   { transform: rotate(0deg); }
    5%   { transform: rotate(14deg); }
    10%  { transform: rotate(-12deg); }
    15%  { transform: rotate(10deg); }
    20%  { transform: rotate(-6deg); }
    25%  { transform: rotate(3deg); }
    30%  { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}
.notif-badge {
    position: absolute; top: -2px; right: -2px;
    background: var(--accent, #3b82f6); color: #fff;
    font-size: 10px; font-weight: 700; line-height: 1;
    min-width: 16px; height: 16px;
    border-radius: 8px; padding: 2px 4px;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s ease;
}
.notif-charm.badge-enter .notif-badge {
    animation: notif-badge-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes notif-badge-pop {
    0%   { transform: scale(0); }
    60%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.notif-panel {
    position: fixed; top: 44px; right: 12px;
    width: 360px; max-height: 480px;
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    z-index: 99998; overflow: hidden;
    opacity: 0; transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.notif-panel.open { opacity: 1; transform: translateY(0); }

.notif-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    font-size: 13px; font-weight: 600; color: var(--text-primary);
}
.notif-close-btn {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px;
}
.notif-close-btn:hover { color: var(--text-primary); }

.notif-list { overflow-y: auto; max-height: 420px; }
.notif-empty { padding: 32px; text-align: center; color: var(--text-muted); font-size: 13px; }

.notif-item {
    display: flex; gap: 10px; padding: 10px 14px;
    border-bottom: 1px solid var(--border); transition: background 0.15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-hover); }

.notif-item-icon {
    flex-shrink: 0; width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; margin-top: 1px;
}
.notif-success .notif-item-icon { color: #22c55e; }
.notif-error .notif-item-icon { color: #ef4444; }
.notif-progress .notif-item-icon { color: var(--accent, #3b82f6); }

.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.notif-item-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.notif-item-age { flex-shrink: 0; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.notif-progress-bar {
    height: 4px; background: var(--bg-hover); border-radius: 2px;
    margin-top: 6px; overflow: hidden;
}
.notif-progress-fill {
    height: 100%; background: var(--accent, #3b82f6); border-radius: 2px;
    transition: width 0.3s ease;
}
.notif-progress-status { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.notif-steps { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.notif-step {
    display: flex; align-items: center; gap: 4px;
    font-size: 11px; color: var(--text-muted);
    padding: 2px 6px; border-radius: 4px;
    background: var(--bg-surface); border: 1px solid var(--border);
}
.notif-step-done { border-color: #22c55e40; }
.notif-step-active { border-color: var(--accent); }
.notif-step-thumb {
    width: 32px; height: 18px; object-fit: cover;
    border-radius: 2px; opacity: 0.4;
}
.notif-step-done .notif-step-thumb { opacity: 1; }
.notif-step-active .notif-step-thumb { opacity: 0.8; }
.notif-step-icon { font-size: 10px; }
.notif-step-done .notif-step-icon { color: #22c55e; }
.notif-step-active .notif-step-icon { color: var(--accent); }

.notif-spinner {
    display: inline-block; width: 12px; height: 12px;
    border: 2px solid var(--border); border-top-color: var(--accent, #3b82f6);
    border-radius: 50%; animation: notif-spin 0.8s linear infinite;
}
@keyframes notif-spin { to { transform: rotate(360deg); } }

.notif-item-actions { display: flex; gap: 6px; margin-top: 6px; }
.notif-action-btn {
    padding: 4px 10px; font-size: 12px;
    background: var(--accent, #3b82f6); color: #fff;
    border: none; border-radius: 4px; cursor: pointer;
}
.notif-action-btn:hover { filter: brightness(1.15); }

/* ── Slash command palette ─────────────────────── */
.cmd-palette {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 4px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    z-index: 100;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.4);
    max-height: 260px;
    overflow-y: auto;
}
.cmd-palette.hidden { display: none; }
.cmd-palette-item {
    padding: 8px 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.cmd-palette-item:hover, .cmd-palette-item.active {
    background: var(--bg-hover);
}
.cmd-palette-item-cmd {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'SF Mono','Consolas','Monaco',monospace;
}
.cmd-palette-item-desc {
    font-size: 11px;
    color: var(--text-secondary);
}
.cmd-palette-empty {
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ── API key setup (dark) ────────────────────────── */
.setup-panel {
    text-align: center;
    max-width: 380px;
    padding: 0 24px;
}
.setup-panel h2 {
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 18px;
}
.setup-panel p {
    margin-bottom: 18px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}
.setup-panel input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 14px;
    background: var(--bg-surface);
    color: var(--text-primary);
    outline: none;
}
.setup-panel input::placeholder { color: var(--text-muted); }
.setup-panel input:focus { border-color: var(--accent); }
.setup-panel button {
    padding: 10px 28px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s;
}
.setup-panel button:hover { background: var(--accent-hover); }

/* ── Expanded preview ─────────────────────────────── */
.preview-expanded .chat-panel,
.preview-expanded .drag-handle { display: none; }

/* ── Response model badge (per-message) ─────────── */
.response-model-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 1px 7px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 10px;
    font-family: 'SF Mono','Consolas','Monaco',monospace;
}

/* ── Signal type badge ───────────────────────────── */
.signal-type-badge {
    display:inline-block; padding:2px 6px; border-radius:3px; font-size:10px;
    background:var(--accent); color:white; margin-left:6px;
}

/* ── Slide Settings Panel ─────────────────────────── */
.slide-settings-panel {
    font-size: 13px;
    color: var(--text-secondary);
}
#he-settings-content .slide-settings-panel {
    padding: 0;
}
#slide-prompt-area .slide-settings-panel {
    overflow-y: auto;
    max-height: 300px;
    padding: 12px;
}
.settings-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 10px;
}
.settings-section-header {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.settings-checkbox, .settings-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 3px 0;
}
.settings-checkbox input, .settings-radio input {
    accent-color: var(--accent);
}
.settings-radio-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.settings-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.settings-select {
    width: 100%;
    padding: 5px 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
}
.settings-hint {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 4px;
}
.settings-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}
.additional-image-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}
.additional-image-card {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.additional-image-thumb {
    position: relative;
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.additional-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.additional-image-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    line-height: 16px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}
.additional-image-remove:hover { background: #e74c3c; }
.additional-image-desc {
    flex: 1;
    padding: 6px 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    min-height: 52px;
}
.image-upload-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 52px;
    border: 2px dashed var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    margin-top: 8px;
    transition: border-color 0.2s, background 0.2s;
}
.image-upload-zone:hover, .image-upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(255,255,255,0.03);
}

/* ── Hidden utility (app-level) ────────────────── */
.chat-panel.hidden,
.drag-handle.hidden { display: none; }

/* ── Signal home: category header ───────────────── */
.signal-home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px 16px;
    flex-shrink: 0;
}
.signal-home-category-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}
.signal-home-create-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.signal-home-create-btn:hover { opacity: 0.85; }

/* ── Signal home: empty state ────────────────────── */
.signal-home-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 24px;
    text-align: center;
}
.signal-home-empty.hidden { display: none; }
.signal-home-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.signal-home-empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.signal-home-empty-desc {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 300px;
    line-height: 1.5;
}
.signal-home-empty-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 8px 20px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
}
.signal-home-empty-btn:hover { opacity: 0.85; }

/* ── Signal card: browser chrome frame ── */
.signal-card-browser-chrome {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-surface);
    overflow: hidden;
}
.signal-card-chrome-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    background: rgba(0,0,0,0.35);
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(4px);
}
.signal-card-chrome-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.signal-card-chrome-url,
.signal-card-chrome-label {
    flex: 1;
    font-size: 9px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    padding: 2px 8px;
    margin-left: 4px;
}
.signal-card-chrome-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: var(--bg-primary);
    container-type: inline-size;
}
/* Website iframe content gets white background; presentation keeps dark */
.signal-card--website .signal-card-chrome-content:has(.signal-thumbnail) {
    background: #fff;
}
.signal-card-no-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 28px;
    opacity: 0.4;
}

/* ── Signal card: info row + three-dot menu ─────── */
.signal-card-info-row {
    display: flex;
    align-items: center;
    gap: 4px;
}
.signal-card-info-row .signal-card-name {
    flex: 1;
    min-width: 0;
}
.signal-card-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: var(--bg-hover);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}
.signal-card:hover .signal-card-menu-btn { display: flex; }
.signal-card-menu-btn:hover { background: var(--border); color: var(--text-primary); }

/* ── Signal card: dropdown menu ─────────────────── */
.signal-card-dropdown {
    position: fixed;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    min-width: 140px;
    z-index: 4000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.signal-card-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    border-radius: 7px;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
}
.signal-card-dropdown-item:hover { background: var(--bg-hover); }
.signal-card-dropdown-item--danger { color: #e05252; }
.signal-card-dropdown-item--danger:hover { background: rgba(224,82,82,0.1); }

/* ── Signal home: grid padding tweak ────────────── */
.signal-home .dashboard-grid {
    padding-top: 0;
    padding-left: 28px;
    padding-right: 28px;
}

/* Signal detail: preview panel is full-width (no chat panel next to it) */
.main-content .preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ── Signal home: view toggle (grid / list) ─────── */
.signal-home-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.signal-view-toggle {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}
.signal-view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.signal-view-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.signal-view-btn.active { background: var(--bg-primary); color: var(--text-primary); }

/* ── Signal home: sort dropdown ─────────────────── */
.signal-sort-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 5px 28px 5px 10px;
    background: var(--bg-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 8px center;
    background-size: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    height: 32px;
    min-width: 120px;
    outline: none;
    transition: border-color 0.12s;
}
.signal-sort-select:hover,
.signal-sort-select:focus { border-color: var(--text-muted); color: var(--text-primary); }

/* ── Signal home: list view mode ─────────────────── */
.signal-home-grid--list {
    display: flex !important;
    flex-direction: column;
    gap: 4px;
}
.signal-home-grid--list .signal-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 52px;
    border-radius: 8px;
}
.signal-home-grid--list .signal-card-preview {
    width: 72px;
    height: 52px;
    min-width: 72px;
    border-radius: 8px 0 0 8px;
    overflow: hidden;
}
.signal-home-grid--list .signal-card-info {
    flex: 1;
    min-width: 0;
    padding: 0 14px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}
.signal-home-grid--list .signal-card-date {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: auto;
}

/* ── Create Signal Dialog ─────────────────────────── */
.csd-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(2px);
}
.csd-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 32px 24px;
    width: 400px;
    max-width: calc(100vw - 32px);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.45);
}
.csd-panel--wide {
    width: 560px;
}
.csd-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s;
}
.csd-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.csd-identity {
    display: flex;
    align-items: center;
    gap: 14px;
}
.csd-type-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}
.csd-identity-text { display: flex; flex-direction: column; gap: 3px; }
.csd-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}
.csd-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}
.csd-name-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
}
.csd-name-input::placeholder { color: var(--text-muted); }
.csd-name-input:focus { border-color: var(--text-muted); }
.csd-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}
.csd-btn-primary {
    padding: 9px 22px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
}
.csd-btn-primary:hover { opacity: 0.85; }
.csd-btn-back {
    padding: 9px 16px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.csd-btn-back:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── Type selection step ─────────────────────────── */
.csd-choose-header { display: flex; flex-direction: column; gap: 4px; }
.csd-type-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.csd-type-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-surface);
    transition: border-color 0.12s, background 0.12s;
}
.csd-type-card:hover { border-color: var(--text-muted); }
.csd-type-card.selected { border-color: var(--text-primary); background: var(--bg-hover); }
.csd-type-card-preview {
    height: 72px;
    background: var(--bg-primary);
    overflow: hidden;
    border-radius: 2px 2px 0 0;
}
.csd-type-card-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px 4px;
}
.csd-type-card-icon { font-size: 16px; }
.csd-type-card-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.csd-type-card-desc {
    font-size: 11px;
    color: var(--text-muted);
    padding: 0 10px 8px;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ── Mobile sidebar backdrop ─────────────────────── */
.signal-mobile-backdrop {
    display: none;
    position: fixed; inset: 0; bottom: 56px;
    background: rgba(0,0,0,0.4);
    z-index: 399;
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — Signal App Mobile & Tablet
   ══════════════════════════════════════════════════════ */

/* ── Signal type icon pills ──────────────────────────
   Replaces inline styles on signal-type badge icons.
   Each .sig-icon--<type> span renders a 20×20 gradient pill
   with a centered white SVG. Used in sidebar category rows,
   signal card thumbnails, and the create-signal dialog.
   ─────────────────────────────────────────────────── */
.sig-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    flex-shrink: 0;
}
.sig-icon--all          { background: linear-gradient(135deg, #374151, #6b7280); }
.sig-icon--website      { background: linear-gradient(135deg, #0ea5e9, #38bdf8); }
.sig-icon--presentation { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.sig-icon--assist       { background: linear-gradient(135deg, #f59e0b, #fb923c); }
.sig-icon--meeting      { background: linear-gradient(135deg, #f43f5e, #fb7185); }
.sig-icon--docs         { background: linear-gradient(135deg, #14b8a6, #06b6d4); }
.sig-icon--communications { background: linear-gradient(135deg, #10b981, #34d399); }

/* ── Signal type thumbnail backgrounds ───────────────
   Used by renderThumbnail() and renderCardPreview() in
   plugin files. Each .sig-thumb--<type> fills the full
   preview container with a dark-tinted gradient matching
   the type's color identity.
   ─────────────────────────────────────────────────── */
.sig-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.sig-thumb__glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 42%, var(--sig-glow-color) 0%, transparent 68%);
}
.sig-thumb__icon {
    position: relative;
}
.sig-thumb--website {
    background: linear-gradient(135deg, #0c4a6e 0%, #075985 55%, #0ea5e9 100%);
    --sig-glow-color: rgba(56, 189, 248, 0.18);
}
.sig-thumb--website .sig-thumb__icon { filter: drop-shadow(0 0 8px rgba(14,165,233,0.5)); color: #38bdf8; }
.sig-thumb--presentation {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 55%, #6366f1 100%);
    --sig-glow-color: rgba(139, 92, 246, 0.18);
}
.sig-thumb--presentation .sig-thumb__icon { filter: drop-shadow(0 0 8px rgba(99,102,241,0.5)); color: #a78bfa; }
.sig-thumb--assist {
    background: linear-gradient(135deg, #451a03 0%, #78350f 55%, #f59e0b 100%);
    --sig-glow-color: rgba(245, 158, 11, 0.18);
}
.sig-thumb--assist .sig-thumb__icon { filter: drop-shadow(0 0 8px rgba(245,158,11,0.5)); color: #fbbf24; }
.sig-thumb--meeting {
    background: linear-gradient(135deg, #4c0519 0%, #881337 55%, #f43f5e 100%);
    --sig-glow-color: rgba(244, 63, 94, 0.18);
}
.sig-thumb--meeting .sig-thumb__icon { filter: drop-shadow(0 0 8px rgba(244,63,94,0.5)); color: #fb7185; }
.sig-thumb--docs {
    background: linear-gradient(135deg, #042f2e 0%, #134e4a 55%, #14b8a6 100%);
    --sig-glow-color: rgba(20, 184, 166, 0.18);
}
.sig-thumb--docs .sig-thumb__icon { filter: drop-shadow(0 0 8px rgba(20,184,166,0.5)); color: #2dd4bf; }
.sig-thumb--communications {
    background: linear-gradient(135deg, #052e16 0%, #14532d 55%, #10b981 100%);
    --sig-glow-color: rgba(16, 185, 129, 0.18);
}
.sig-thumb--communications .sig-thumb__icon { filter: drop-shadow(0 0 8px rgba(16,185,129,0.5)); color: #34d399; }

/* ── Mobile: < 768px ──────────────────────────────── */
@media (max-width: 767px) {
    /* Sidebar: hidden by default, slide-over on toggle */
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 56px;
        width: 280px !important;
        min-width: 0 !important;
        z-index: 400;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        background: var(--sidebar-bg, var(--bg-panel));
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .sidebar.collapsed {
        width: 280px !important;
        min-width: 0 !important;
    }

    /* Show backdrop when sidebar is open */
    .sidebar.mobile-open ~ .signal-mobile-backdrop { display: block; }

    /* Content: full width */
    .signal-home, .main-content { width: 100%; }

    /* Signal home header: wrap on narrow screens */
    .signal-home-header {
        flex-wrap: wrap;
        padding: 12px 16px 10px;
        gap: 8px;
    }
    .signal-home-header-right { flex-wrap: wrap; gap: 6px; }
    .signal-home-create-btn { font-size: 12px; padding: 6px 12px; }

    /* Dashboard grid: fewer/smaller columns */
    .signal-home .dashboard-grid {
        padding-left: 16px;
        padding-right: 16px;
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    /* Chat panel: full width inside slide-over */
    .chat-panel {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        border-right: none;
    }
    .drag-handle { display: none; }

    /* Preview panel: full width */
    .preview-panel { min-width: 0; }

    /* Expand button: always visible as hamburger trigger */
    .signal-sidebar-expand {
        display: flex !important;
        position: fixed;
        top: 44px;
        left: 8px;
        z-index: 350;
    }
    .signal-sidebar-expand.hidden { display: flex !important; }

    /* Dialogs: full-width bottom sheets */
    .wizard-overlay, .csd-overlay { align-items: flex-end; padding: 0; }
    .wizard-panel, .csd-panel {
        width: 100% !important; max-width: none !important;
        border-radius: 16px 16px 0 0;
        max-height: 90vh; overflow-y: auto;
    }
    .dashboard-dialog {
        width: 100% !important; max-width: none !important;
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
    }

    /* Signal card dropdown: reposition for mobile */
    .signal-card-dropdown {
        position: fixed !important;
        left: 16px !important; right: 16px !important;
        bottom: 64px !important; top: auto !important;
        width: auto; min-width: 0;
        border-radius: 12px;
    }
}

/* ── Tablet: 768-1023px ──────────────────────────── */
@media (max-width: 1023px) and (min-width: 768px) {
    .sidebar { width: 200px; min-width: 200px; }
    .signal-home .dashboard-grid {
        padding-left: 20px; padding-right: 20px;
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    .chat-panel { width: 300px; min-width: 240px; }
}
