/* Cognis Håndværker Agent — fælles styles (udtrukket fra index.html) */
/* Temaer: lys (default) + dark via [data-theme="dark"] på <html> */

        :root {
            --bg: #ffffff;
            --surface: #f8f9fb;
            --surface2: #f1f3f6;
            --surface3: #e8eaf0;
            --accent: #4f46e5;
            --accent2: #4338ca;
            --accent-soft: rgba(79,70,229,0.10);
            --text: #111827;
            --text-dim: #4b5563;
            --text-faint: #6b7280;
            --border: #e2e5ea;
            --border-light: #cbd0d9;
            --success: #16a34a;
            --success-soft: rgba(22,163,74,0.10);
            --warning: #d97706;
            --warning-soft: rgba(217,119,6,0.12);
            --error: #dc2626;
            --error-soft: rgba(220,38,38,0.10);
            --info: #2563eb;
            --info-soft: rgba(37,99,235,0.10);
            --shadow: 0 8px 24px rgba(15,23,42,0.10);
            --muted-soft: rgba(100,116,139,0.10);
            --sidebar-w: 240px;
        }
        :root[data-theme="dark"] {
            --bg: #0a0a0f;
            --surface: #131320;
            --surface2: #1a1a2e;
            --surface3: #222238;
            --accent: #818cf8;
            --accent2: #6366f1;
            --accent-soft: rgba(129,140,248,0.14);
            --text: #e2e8f0;
            --text-dim: #94a3b8;
            --text-faint: #64748b;
            --border: #2a2a3e;
            --border-light: #363650;
            --success: #22c55e;
            --success-soft: rgba(34,197,94,0.12);
            --warning: #f59e0b;
            --warning-soft: rgba(245,158,11,0.12);
            --error: #ef4444;
            --error-soft: rgba(239,68,68,0.12);
            --info: #3b82f6;
            --info-soft: rgba(59,130,246,0.12);
            --shadow: 0 8px 24px rgba(0,0,0,0.4);
            --muted-soft: rgba(100,116,139,0.15);
        }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        html, body { height: 100%; overflow: hidden; }
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            background: var(--bg);
            color: var(--text);
            display: flex;
        }

        /* ── Sidebar ── */
        .sidebar {
            width: var(--sidebar-w);
            min-width: var(--sidebar-w);
            background: var(--surface);
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            z-index: 20;
        }
        .sidebar-header {
            padding: 16px 16px 12px;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .sidebar-header .logo { font-size: 22px; }
        .sidebar-header .title { font-size: 15px; font-weight: 700; line-height: 1.3; }
        .sidebar-header .title span { color: var(--text-dim); font-weight: 400; font-size: 11px; display: block; }
        .sidebar-nav { flex: 1; overflow-y: auto; padding: 8px; }
        .sidebar-nav::-webkit-scrollbar { width: 4px; }
        .sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
        .nav-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 9px 12px;
            border-radius: 8px;
            cursor: pointer;
            color: var(--text-dim);
            font-size: 13px;
            transition: all 0.15s;
            margin-bottom: 2px;
            user-select: none;
        }
        .nav-item:hover { background: var(--surface2); color: var(--text); }
        .nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
        .star svg { width: 16px; height: 16px; display: block; }
        .star.active polygon { fill: currentColor; }
        .star:hover svg { transform: scale(1.15); }
        .quick-prompt { display: inline-flex; align-items: center; gap: 6px; }
        .nav-item .icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
        .nav-item .icon svg { width: 16px; height: 16px; }
        .nav-item .badge-count {
            margin-left: auto;
            background: var(--accent);
            color: white;
            font-size: 10px;
            font-weight: 700;
            padding: 1px 6px;
            border-radius: 10px;
            min-width: 18px;
            text-align: center;
        }
        .nav-item .badge-count.warn { background: var(--warning); }
        .nav-item .badge-count.err { background: var(--error); }
        .sidebar-footer {
            padding: 12px 16px;
            border-top: 1px solid var(--border);
            font-size: 11px;
            color: var(--text-faint);
        }
        .sidebar-footer a { color: var(--accent); text-decoration: none; }
        .sidebar-footer .tenant-info {
            margin-bottom: 8px;
            padding: 8px 10px;
            background: var(--surface2);
            border-radius: 6px;
            font-size: 11px;
            color: var(--text-dim);
        }
        .sidebar-footer .tenant-info strong { color: var(--text); display: block; font-size: 12px; }

        /* ── Mobile sidebar toggle ── */
        .sidebar-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.5);
            z-index: 15;
        }
        .mobile-toggle {
            display: none;
            position: fixed;
            top: 10px;
            left: 10px;
            z-index: 30;
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 8px;
            width: 36px;
            height: 36px;
            color: var(--text);
            font-size: 18px;
            cursor: pointer;
            align-items: center;
            justify-content: center;
        }

        /* ── Main content ── */
        .main {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-width: 0;
            height: 100vh;
        }
        .topbar {
            background: var(--surface);
            border-bottom: 1px solid var(--border);
            padding: 10px 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            min-height: 50px;
        }
        .topbar .page-title { font-size: 15px; font-weight: 600; }
        .topbar .page-title span { color: var(--text-dim); font-weight: 400; }
        .topbar-actions { display: flex; gap: 8px; align-items: center; }
        .search-box {
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 6px 12px;
            color: var(--text);
            font-size: 13px;
            width: 220px;
            transition: border-color 0.2s;
            outline: none;
        }
        .search-box:focus { border-color: var(--accent); }
        .search-box::placeholder { color: var(--text-faint); }
        .btn {
            background: var(--surface2);
            border: 1px solid var(--border);
            color: var(--text);
            padding: 6px 14px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 13px;
            transition: all 0.15s;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            white-space: nowrap;
        }
        .btn:hover { border-color: var(--accent); color: var(--text); }
        .btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
        .btn.primary:hover { background: var(--accent2); border-color: var(--accent2); }
        .btn.success { background: var(--success); border-color: var(--success); color: white; }
        .btn.danger { background: var(--error); border-color: var(--error); color: white; }
        .btn.sm { padding: 4px 10px; font-size: 12px; }
        .btn-icon {
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 6px;
            width: 28px;
            height: 28px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: var(--text-dim);
            font-size: 14px;
            transition: all 0.15s;
        }
        .btn-icon:hover { color: var(--text); border-color: var(--accent); }

        /* ── Content area ── */
        .content {
            flex: 1;
            overflow-y: auto;
            padding: 20px;
        }
        .content::-webkit-scrollbar { width: 6px; }
        .content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
        .view { display: none; }
        .view.active { display: block; }
        .view.active.chat-view { display: flex; flex-direction: column; height: calc(100vh - 50px); }

        /* ── Cards / sections ── */
        .card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 12px;
            overflow: hidden;
        }
        .card-header {
            padding: 14px 18px;
            border-bottom: 1px solid var(--border);
            font-size: 13px;
            font-weight: 600;
            color: var(--text-dim);
            text-transform: uppercase;
            letter-spacing: 0.04em;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .card-body { padding: 18px; }

        /* ── Stat cards ── */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
            gap: 14px;
            margin-bottom: 24px;
        }
        .stat-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 16px;
        }
        .stat-card .label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
        .stat-card .value { font-size: 24px; font-weight: 700; }
        .stat-card .sub { font-size: 12px; color: var(--text-faint); margin-top: 3px; }
        .stat-card.accent .value { color: var(--accent); }
        .stat-card.success .value { color: var(--success); }
        .stat-card.warning .value { color: var(--warning); }

        /* ── Table ── */
        table { width: 100%; border-collapse: collapse; font-size: 13px; }
        th { text-align: left; padding: 10px 14px; color: var(--text-dim); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); }
        td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
        tr:last-child td { border-bottom: none; }
        tr:hover td { background: var(--surface2); }
        .table-wrap { overflow-x: auto; }

        /* ── Badges ── */
        .badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 500; }
        .badge.lead { background: var(--surface3); color: var(--text-dim); }
        .badge.prospect { background: var(--warning-soft); color: var(--warning); }
        .badge.customer { background: var(--error-soft); color: var(--error); }
        .badge.lead { background: var(--surface3); color: var(--text-dim); }
        .badge.contacted { background: var(--info-soft); color: var(--info); }
        .badge.responsive { background: var(--accent-soft); color: var(--accent); }
        .badge.active { background: var(--success-soft); color: var(--success); }
        .badge.dormant { background: var(--surface3); color: var(--text-faint); }
        .badge.potential { background: var(--surface3); color: var(--text-dim); }
        .badge.pitched { background: var(--info-soft); color: var(--info); }
        .badge.negotiating { background: var(--warning-soft); color: var(--warning); }
        .badge.confirmed { background: var(--success-soft); color: var(--success); }
        .badge.completed { background: var(--muted-soft); color: var(--text-dim); }
        .badge.cancelled { background: var(--error-soft); color: var(--error); }
        .badge.pending_review { background: var(--warning-soft); color: var(--warning); }
        .badge.approved { background: var(--info-soft); color: var(--info); }
        .badge.sent { background: var(--success-soft); color: var(--success); }
        .badge.replied { background: var(--accent-soft); color: var(--accent); }
        .badge.failed { background: var(--error-soft); color: var(--error); }
        .badge.ok { background: var(--success-soft); color: var(--success); }
        .badge.warning { background: var(--warning-soft); color: var(--warning); }
        .badge.err { background: var(--error-soft); color: var(--error); }
        .badge.rejected { background: var(--error-soft); color: var(--error); }
        .badge.drafted { background: var(--surface3); color: var(--text-dim); }

        /* ── Filters bar ── */
        .filters {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
            margin-bottom: 16px;
            align-items: center;
        }
        .filter-input {
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 7px 12px;
            color: var(--text);
            font-size: 13px;
            outline: none;
            transition: border-color 0.2s;
        }
        .filter-input:focus { border-color: var(--accent); }
        .filter-select {
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 7px 28px 7px 12px;
            color: var(--text);
            font-size: 13px;
            cursor: pointer;
            outline: none;
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 8px center;
        }

        /* ── Kanban ── */
        .kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; min-height: 400px; }
        .kanban-col { min-width: 220px; flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; display: flex; flex-direction: column; }
        .kanban-col-header { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; display: flex; align-items: center; justify-content: space-between; }
        .kanban-col-header .count { background: var(--surface3); padding: 1px 7px; border-radius: 8px; font-size: 11px; color: var(--text-dim); }
        .kanban-col-body { padding: 8px; flex: 1; overflow-y: auto; min-height: 100px; }
        .kanban-card {
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 10px 12px;
            margin-bottom: 8px;
            cursor: pointer;
            transition: border-color 0.15s;
        }
        .kanban-card:hover { border-color: var(--accent); }
        .kanban-card .title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
        .kanban-card .meta { font-size: 11px; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 6px; }
        .kanban-card .fee { color: var(--success); font-weight: 600; }

        /* ── Calendar ── */
        .calendar { }
        .calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
        .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
        .calendar-day-header { background: var(--surface2); padding: 8px; text-align: center; font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; }
        .calendar-day { background: var(--surface); min-height: 80px; padding: 6px; position: relative; }
        .calendar-day.other-month { background: var(--bg); opacity: 0.5; }
        .calendar-day.today .day-num { background: var(--accent); color: white; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
        .calendar-day .day-num { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
        .cal-event {
            background: var(--accent-soft);
            border-left: 2px solid var(--accent);
            padding: 3px 6px;
            border-radius: 4px;
            font-size: 10px;
            margin-bottom: 2px;
            cursor: pointer;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        .cal-event.confirmed { background: var(--success-soft); border-left-color: var(--success); }
        .cal-event.negotiating { background: var(--warning-soft); border-left-color: var(--warning); }
        .cal-event.completed { background: var(--muted-soft); border-left-color: var(--text-faint); }

        /* ── Chat view ── */
        .chat-container {
            flex: 1; overflow-y: auto; padding: 20px;
            display: flex; flex-direction: column; gap: 12px;
        }
        .chat-container::-webkit-scrollbar { width: 6px; }
        .chat-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
        .message { max-width: 80%; padding: 10px 14px; border-radius: 14px; line-height: 1.6; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
        .message.user { align-self: flex-end; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: white; border-bottom-right-radius: 4px; }
        .message.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
        .message.assistant strong { color: var(--accent2); }
        .message.assistant code { background: var(--surface2); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
        .message.tool-call { align-self: center; background: var(--surface2); border: 1px dashed var(--border); font-size: 12px; color: var(--text-dim); padding: 6px 12px; max-width: 90%; }
        .typing-indicator { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); padding: 12px 16px; border-radius: 14px; border-bottom-left-radius: 4px; display: flex; gap: 4px; }
        .typing-indicator span { width: 8px; height: 8px; background: var(--text-dim); border-radius: 50%; animation: bounce 1.4s infinite; }
        .typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
        .typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
        @keyframes bounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-8px); } }
        .input-area { background: var(--surface); border-top: 1px solid var(--border); padding: 12px 20px; display: flex; gap: 10px; align-items: flex-end; }
        .input-area textarea { flex: 1; background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 10px 14px; border-radius: 10px; font-size: 14px; font-family: inherit; resize: none; min-height: 40px; max-height: 120px; outline: none; transition: border-color 0.2s; }
        .input-area textarea:focus { border-color: var(--accent); }
        .help-input { width: 100%; background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 10px 14px; border-radius: 10px; font-size: 14px; font-family: inherit; outline: none; transition: border-color 0.2s; }
        .help-input:focus { border-color: var(--accent); }
        .help-input::placeholder { color: var(--text-faint); }
        .send-btn { background: linear-gradient(135deg, var(--accent), var(--accent2)); border: none; color: white; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 18px; transition: opacity 0.2s, transform 0.1s; }
        .send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
        .send-btn:not(:disabled):active { transform: scale(0.95); }
        .chat-welcome { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-dim); }
        .chat-welcome .logo-big { font-size: 40px; }
        .chat-welcome h2 { color: var(--text); font-size: 18px; }
        .chat-welcome p { font-size: 13px; max-width: 360px; text-align: center; }
        .agent-tabs { display: flex; gap: 6px; margin-bottom: 4px; }
        .agent-tab { background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim); padding: 5px 12px; border-radius: 7px; cursor: pointer; font-size: 12px; transition: all 0.2s; }
        .agent-tab.active { background: var(--accent); color: white; border-color: var(--accent); }
        /* ── Subtle hover feedback (per-message) ── */
        .message.assistant { position: relative; }
        .msg-feedback {
            position: absolute; top: 6px; right: 8px;
            display: flex; gap: 4px; opacity: 0;
            transition: opacity 0.2s; pointer-events: none;
        }
        .message.assistant:hover .msg-feedback { opacity: 0.4; pointer-events: auto; }
        .msg-feedback button {
            background: none; border: none; cursor: pointer;
            font-size: 12px; color: var(--text-faint);
            padding: 2px 4px; border-radius: 4px; transition: all 0.15s;
        }
        .msg-feedback button:hover { opacity: 1; color: var(--text-dim); }
        .msg-feedback button.selected.up { color: var(--success); opacity: 1; }
        .msg-feedback button.selected.down { color: var(--error); opacity: 1; }
        /* ── Session rating bar ── */
        .session-rate-bar {
            display: none; align-items: center; gap: 10px;
            padding: 10px 16px; background: var(--surface2);
            border-top: 1px solid var(--border);
            font-size: 12px; color: var(--text-dim);
        }
        .session-rate-bar.visible { display: flex; }
        .session-rate-bar .rate-label { flex: 1; }
        .session-rate-bar .stars { display: flex; gap: 4px; }
        .session-rate-bar .star {
            background: none; border: none; cursor: pointer;
            font-size: 18px; color: var(--border-light);
            transition: color 0.15s, transform 0.1s; padding: 2px;
        }
        .session-rate-bar .star:hover { color: var(--warning); transform: scale(1.15); }
        .session-rate-bar .star.selected { color: var(--warning); }
        .session-rate-bar .rate-dismiss {
            background: none; border: none; color: var(--text-faint);
            cursor: pointer; font-size: 14px; padding: 2px 6px;
        }
        .session-rate-bar .rate-dismiss:hover { color: var(--text-dim); }

        /* ── Session list ── */
        .session-list { display: flex; flex-direction: column; gap: 8px; }
        .session-item {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 12px 14px;
            cursor: pointer;
            transition: border-color 0.15s;
            display: flex;
            align-items: center;
            gap: 12px;
        }
        .session-item:hover { border-color: var(--accent); }
        .session-item .session-icon { font-size: 20px; }
        .session-item .session-info { flex: 1; min-width: 0; }
        .session-item .session-preview { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .session-item .session-meta { font-size: 11px; color: var(--text-dim); margin-top: 2px; display: flex; gap: 8px; }
        .session-item .session-msgs { font-size: 11px; color: var(--text-faint); background: var(--surface2); padding: 2px 8px; border-radius: 6px; }

        /* ── Modal ── */
        .modal-overlay {
            display: none;
            position: fixed; inset: 0;
            background: rgba(0,0,0,0.6);
            z-index: 100;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }
        .modal-overlay.active { display: flex; }
        .modal {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 12px;
            width: 100%;
            max-width: 560px;
            max-height: 85vh;
            overflow-y: auto;
        }
        .modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: 15px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
        .modal-body { padding: 20px; }
        .modal-close { background: none; border: none; color: var(--text-dim); font-size: 20px; cursor: pointer; padding: 4px; }
        .modal-close:hover { color: var(--text); }
        .detail-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
        .detail-row:last-child { border-bottom: none; }
        .detail-row .key { color: var(--text-dim); }
        .detail-row .val { color: var(--text); text-align: right; max-width: 60%; word-break: break-word; }
        .email-preview { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin: 12px 0; white-space: pre-wrap; font-size: 13px; line-height: 1.6; }

        /* ── Empty state ── */
        .empty-state { text-align: center; padding: 48px 20px; color: var(--text-dim); }
        .empty-state .icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
        .empty-state .icon svg { width: 36px; height: 36px; }
        /* SVG-ikoner i dynamisk indhold (ico()) */
        .ico { width: 1em; height: 1em; vertical-align: -0.12em; flex-shrink: 0; }
        .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
        .dot.red { background: var(--error); }
        .dot.yellow { background: var(--warning); }
        .dot.gray { background: var(--border-light); }
        .dot.ok { background: var(--success); }
        .empty-state .title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
        .empty-state .desc { font-size: 13px; max-width: 320px; margin: 0 auto; }

        /* ── Loading ── */
        .loading { text-align: center; padding: 40px; color: var(--text-dim); font-size: 14px; }
        .spinner { display: inline-block; width: 24px; height: 24px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
        @keyframes spin { to { transform: rotate(360deg); } }

        /* ── Theme toggle ── */
        .logo svg, .logo-big svg, .card-header svg, .quick-prompt svg,
        .session-icon svg, .empty-state .icon svg {
            width: 1.1em; height: 1.1em; vertical-align: -0.15em;
        }
        .logo-big svg { width: 36px; height: 36px; }
        .sidebar-header .logo { font-size: 22px; display: flex; }
        .sidebar-header .logo svg { width: 22px; height: 22px; color: var(--accent); }
        .chat-welcome .logo-big svg { width: 44px; height: 44px; color: var(--accent); }
        .login-card .logo-big svg { width: 36px; height: 36px; color: var(--accent); }
        .quick-prompt svg { width: 14px; height: 14px; vertical-align: -0.1em; }
        .empty-state .icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
        .theme-toggle {
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 8px;
            width: 32px;
            height: 32px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: var(--text-dim);
            transition: all 0.15s;
            flex-shrink: 0;
        }
        .theme-toggle:hover { color: var(--text); border-color: var(--accent); }
        .theme-toggle svg { width: 16px; height: 16px; }
        .theme-toggle .icon-sun { display: none; }
        .theme-toggle .icon-moon { display: block; }
        :root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
        :root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

        /* ── Search results dropdown ── */
        .search-results {
            position: absolute;
            top: 100%;
            right: 0;
            width: 400px;
            max-height: 400px;
            overflow-y: auto;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            box-shadow: var(--shadow);
            z-index: 50;
            display: none;
        }
        .search-results.active { display: block; }
        .search-section { padding: 8px 0; border-bottom: 1px solid var(--border); }
        .search-section:last-child { border-bottom: none; }
        .search-section-title { padding: 4px 14px; font-size: 10px; text-transform: uppercase; color: var(--text-faint); letter-spacing: 0.05em; }
        .search-result-item { padding: 8px 14px; cursor: pointer; font-size: 13px; transition: background 0.1s; }
        .search-result-item:hover { background: var(--surface2); }

        /* ── Login screen ── */
        .login-overlay {
            position: fixed; inset: 0; background: var(--bg);
            display: flex; align-items: center; justify-content: center;
            z-index: 200;
        }
        .login-overlay.hidden { display: none; }
        .login-card {
            background: var(--surface); border: 1px solid var(--border);
            border-radius: 16px; padding: 32px; width: 100%; max-width: 380px;
        }
        .login-card h2 { font-size: 20px; margin-bottom: 4px; }
        .login-card p { font-size: 13px; color: var(--text-dim); margin-bottom: 24px; }
        .login-card input {
            width: 100%; background: var(--surface2); border: 1px solid var(--border);
            border-radius: 8px; padding: 10px 14px; color: var(--text);
            font-size: 14px; margin-bottom: 12px; outline: none; transition: border-color 0.2s;
        }
        .login-card input:focus { border-color: var(--accent); }
        .login-card .btn { width: 100%; justify-content: center; padding: 10px; font-size: 14px; }
        .login-error { color: var(--error); font-size: 12px; margin-top: 8px; display: none; }
        .login-error.show { display: block; }
        .login-card .logo-big { font-size: 36px; text-align: center; margin-bottom: 8px; }
        .logout-btn {
            background: var(--surface2); border: 1px solid var(--border);
            border-radius: 6px; padding: 4px 10px; color: var(--text-dim);
            font-size: 12px; cursor: pointer; transition: all 0.15s;
        }
        .logout-btn:hover { color: var(--error); border-color: var(--error); }

        /* ── Toast ── */
        .toast-container {
            position: fixed; bottom: 20px; right: 20px; z-index: 150;
            display: flex; flex-direction: column; gap: 8px;
        }
        .toast {
            background: var(--surface); border: 1px solid var(--border);
            border-radius: 10px; padding: 12px 16px; font-size: 13px;
            max-width: 360px; animation: slideIn 0.2s ease;
            box-shadow: var(--shadow);
        }
        .toast.success { border-color: var(--success); }
        .toast.error { border-color: var(--error); }
        .toast.info { border-color: var(--info); }
        @keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

        /* ── Confirm dialog ── */
        .confirm-dialog {
            position: fixed; inset: 0; background: rgba(0,0,0,0.6);
            z-index: 120; display: none; align-items: center; justify-content: center;
        }
        .confirm-dialog.active { display: flex; }
        .confirm-box {
            background: var(--surface); border: 1px solid var(--border);
            border-radius: 12px; padding: 24px; width: 100%; max-width: 400px;
        }
        .confirm-box h3 { font-size: 16px; margin-bottom: 8px; }
        .confirm-box p { font-size: 14px; color: var(--text-dim); margin-bottom: 20px; line-height: 1.5; }
        .confirm-box .actions { display: flex; gap: 8px; justify-content: flex-end; }

        /* ── Responsive ── */
        @media (max-width: 768px) {
            .sidebar {
                position: fixed;
                left: -100%;
                top: 0;
                bottom: 0;
                transition: left 0.25s;
            }
            .sidebar.open { left: 0; }
            .sidebar-overlay.active { display: block; }
            .mobile-toggle { display: flex; }
            .content { padding: 14px; }
            .search-box { width: 140px; }
            .kanban-col { min-width: 180px; }
            .calendar-day { min-height: 60px; }
        }

        /* Print: show only the quote/invoice modal when printing */
        @media print {
            body * { visibility: hidden; }
            .modal-overlay, .modal-overlay * { visibility: visible; }
            .modal-overlay { position: fixed; inset: 0; background: white; display: flex; }
            .modal-content { max-width: 100% !important; width: 100% !important; max-height: none !important; box-shadow: none; background: white; color: black; }
            #qiActionFooter, .modal-header button { display: none !important; }
            #qiPrintBody, #qiPrintBody * { color: black !important; }
            #qiPrintBody table { border-color: #ccc !important; }
        }
