/* ==================== BASE ==================== */
:root {
    --orange: #f97316; --orange-dark: #ea580c; --orange-light: #fdba74;
    --slate-50: #f8fafc; --slate-100: #f1f5f9; --slate-200: #e2e8f0; --slate-300: #cbd5e1;
    --slate-400: #94a3b8; --slate-500: #64748b; --slate-600: #475569; --slate-700: #334155;
    --slate-800: #1e293b; --slate-900: #0f172a; --slate-950: #020617;
    --green: #10b981; --red: #ef4444; --amber: #f59e0b; --blue: #3b82f6; --purple: #8b5cf6; --cyan: #06b6d4;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--slate-950), var(--slate-900), #1a1f2e);
    color: var(--slate-100);
    min-height: 100vh;
    line-height: 1.6;
}

/* x-cloak versteckt Content bis Alpine lädt */
[x-cloak] { display: none !important; }
/* Fallback falls Alpine nicht lädt */
body:not(.alpine-loaded) [x-cloak] { display: block !important; opacity: 0.5; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--slate-800); }
::-webkit-scrollbar-thumb { background: var(--slate-600); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-500); }

.bg-pattern {
    background-image: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(249,115,22,0.12), transparent 50%),
        linear-gradient(rgba(249,115,22,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(249,115,22,0.02) 1px, transparent 1px);
    background-size: 100%, 50px 50px, 50px 50px;
}

/* ==================== ANIMATIONS ==================== */
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.7); transform: scale(1); }
    50% { box-shadow: 0 0 0 12px rgba(239,68,68,0); transform: scale(1.02); }
}
@keyframes wave {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.fade-in { animation: fadeIn 0.3s ease-out; }
.slide-up { animation: slideUp 0.4s ease-out; }

.soundwave { display: flex; align-items: center; gap: 3px; height: 20px; }
.soundwave span {
    width: 4px; background: linear-gradient(to top, var(--orange), var(--amber)); border-radius: 4px;
}
.soundwave span:nth-child(1) { animation: wave 0.5s infinite; animation-delay: 0s; height: 8px; }
.soundwave span:nth-child(2) { animation: wave 0.5s infinite; animation-delay: 0.1s; height: 16px; }
.soundwave span:nth-child(3) { animation: wave 0.5s infinite; animation-delay: 0.2s; height: 12px; }
.soundwave span:nth-child(4) { animation: wave 0.5s infinite; animation-delay: 0.3s; height: 20px; }
.soundwave span:nth-child(5) { animation: wave 0.5s infinite; animation-delay: 0.4s; height: 10px; }

.loader {
    width: 20px; height: 20px;
    border: 3px solid var(--slate-600); border-top-color: var(--orange);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}

/* ==================== LAYOUT ==================== */
.container { max-width: 1400px; margin: 0 auto; padding: 0 1rem; }
.min-h-screen { min-height: 100vh; }
.main-content { padding: 1.5rem 0 3rem; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.text-center { text-align: center; }

/* ==================== HEADER ==================== */
.app-header {
    background: rgba(15,23,42,0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--slate-800);
    position: sticky; top: 0; z-index: 100;
}
.header-content {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.875rem 0;
}
.logo-section { display: flex; align-items: center; gap: 0.75rem; }
.logo-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--orange), var(--amber));
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 15px rgba(249,115,22,0.3);
}
.logo-icon i { color: white; font-size: 1.25rem; }
.logo-text h1 { font-size: 1.25rem; font-weight: 800; line-height: 1.2; }
.logo-text h1 .text-orange { color: var(--orange); }
.logo-text h1 .pro-badge { font-size: 0.65rem; color: var(--amber); font-weight: 600; margin-left: 0.25rem; vertical-align: super; }
.logo-text .tagline { font-size: 0.7rem; color: var(--slate-500); }
.header-actions { display: flex; align-items: center; gap: 0.75rem; }
.connection-status {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 1rem; background: var(--slate-800);
    border-radius: 8px; font-size: 0.8rem; font-weight: 500;
}
.connection-status .status-dot {
    width: 8px; height: 8px; border-radius: 50%;
}
.connection-status.online .status-dot { background: var(--green); box-shadow: 0 0 6px var(--green); }
.connection-status.offline .status-dot { background: var(--red); }

/* ==================== TABS ==================== */
.tabs {
    display: flex; gap: 0.25rem;
    background: var(--slate-800); padding: 0.375rem; border-radius: 12px;
    margin-bottom: 1.5rem; overflow-x: auto;
}
.tab {
    flex: 1; min-width: max-content;
    padding: 0.75rem 1.25rem; border: none; background: transparent;
    color: var(--slate-400); font-weight: 500; font-size: 0.875rem;
    border-radius: 8px; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.tab:hover { color: var(--slate-200); background: rgba(255,255,255,0.05); }
.tab.active { background: var(--slate-700); color: white; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.tab-badge {
    background: var(--orange); color: white;
    padding: 0.125rem 0.5rem; border-radius: 100px;
    font-size: 0.65rem; font-weight: 700;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.75rem 1.5rem; border-radius: 10px;
    font-weight: 600; font-size: 0.875rem; border: none;
    cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus { outline: 2px solid var(--orange); outline-offset: 2px; }
.btn-primary {
    background: linear-gradient(135deg, var(--orange), var(--orange-dark));
    color: white; box-shadow: 0 4px 15px rgba(249,115,22,0.35);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(249,115,22,0.45); }
.btn-secondary { background: var(--slate-800); color: var(--slate-200); border: 1px solid var(--slate-700); }
.btn-secondary:hover:not(:disabled) { background: var(--slate-700); border-color: var(--slate-600); }
.btn-ghost { background: transparent; color: var(--slate-400); }
.btn-ghost:hover:not(:disabled) { background: var(--slate-800); color: var(--slate-200); }
.btn-danger { background: linear-gradient(135deg, var(--red), #dc2626); color: white; }
.btn-danger:hover:not(:disabled) { box-shadow: 0 4px 15px rgba(239,68,68,0.35); }
.btn-success { background: linear-gradient(135deg, var(--green), #059669); color: white; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; border-radius: 8px; }
.btn-lg { padding: 1rem 2rem; font-size: 1rem; }
.btn-icon { width: 40px; height: 40px; padding: 0; }
.btn-icon-sm { width: 32px; height: 32px; padding: 0; font-size: 0.8rem; }
.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ==================== CARDS ==================== */
.card {
    background: rgba(30,41,59,0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(71,85,105,0.5);
    border-radius: 16px; overflow: hidden;
}
.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(71,85,105,0.5);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 1rem;
}
.card-body { padding: 1.5rem; }
.header-title { display: flex; align-items: center; gap: 0.75rem; }
.header-title h2 { font-size: 1.125rem; font-weight: 700; }
.header-title .subtitle { font-size: 0.75rem; color: var(--slate-500); }
.icon-box {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white;
}
.icon-box.orange { background: linear-gradient(135deg, var(--orange), var(--amber)); }
.icon-box.green { background: linear-gradient(135deg, var(--green), #059669); }
.icon-box.blue { background: linear-gradient(135deg, var(--blue), #1d4ed8); }
.icon-box.purple { background: linear-gradient(135deg, var(--purple), #6d28d9); }

/* ==================== INPUTS ==================== */
.input, .textarea, .select {
    width: 100%; background: var(--slate-800);
    border: 2px solid var(--slate-700); border-radius: 10px;
    padding: 0.875rem 1rem; color: var(--slate-100);
    font-size: 0.9375rem; font-family: inherit; transition: all 0.2s;
}
.input:focus, .textarea:focus, .select:focus {
    outline: none; border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,0.15);
}
.input::placeholder, .textarea::placeholder { color: var(--slate-500); }
.textarea { resize: vertical; min-height: 160px; line-height: 1.7; }
.select { cursor: pointer; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 600; color: var(--slate-300); margin-bottom: 0.5rem; }
.form-group .hint { font-size: 0.75rem; color: var(--slate-500); margin-top: 0.25rem; }
.form-group .hint a { color: var(--orange); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.input-row { display: flex; gap: 0.5rem; }
.color-input { height: 48px; padding: 4px; }
.filter-bar { display: flex; gap: 1rem; margin-bottom: 1rem; }
.filter-bar .input { flex: 1; }
.filter-bar .select { max-width: 200px; }

/* ==================== BADGES ==================== */
.badge {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.375rem 0.75rem; border-radius: 100px;
    font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
}
.badge-success { background: rgba(16,185,129,0.15); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--amber); border: 1px solid rgba(245,158,11,0.3); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--blue); border: 1px solid rgba(59,130,246,0.3); }
.badge-neutral { background: rgba(100,116,139,0.15); color: var(--slate-400); border: 1px solid rgba(100,116,139,0.3); }
.badge-primary { background: rgba(249,115,22,0.15); color: var(--orange); border: 1px solid rgba(249,115,22,0.3); }
.badge-ollama { background: rgba(6,182,212,0.15); color: var(--cyan); border: 1px solid rgba(6,182,212,0.3); }
.badge-openrouter { background: rgba(249,115,22,0.15); color: var(--orange); border: 1px solid rgba(249,115,22,0.3); }
.badge-groq { background: rgba(245,158,11,0.15); color: var(--amber); border: 1px solid rgba(245,158,11,0.3); }

/* ==================== INPUT SECTION ==================== */
.input-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.5rem; }
.input-card { position: relative; }
.input-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--orange), var(--amber), var(--orange));
}
.input-wrapper { position: relative; }
.input-wrapper .textarea { padding-right: 5rem; }
.mic-btn {
    position: absolute; bottom: 1rem; right: 1rem;
    width: 52px; height: 52px; border-radius: 14px;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s; background: var(--slate-700); color: var(--slate-300);
}
.mic-btn:hover:not(:disabled) { background: var(--slate-600); transform: scale(1.05); }
.mic-btn.recording { background: var(--red); color: white; animation: pulse-glow 1.5s infinite; }
.mic-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mic-btn i { font-size: 1.25rem; }
.input-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; }
.char-count { font-size: 0.75rem; color: var(--slate-500); }
.text-warning { color: var(--amber); font-size: 0.75rem; }

.categories-section { margin-top: 1.25rem; }
.categories-section label { display: block; font-size: 0.875rem; font-weight: 600; color: var(--slate-300); margin-bottom: 0.75rem; }
.categories-section label .hint { font-weight: 400; color: var(--slate-500); }
.category-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cat-tag {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.5rem 0.875rem; border-radius: 8px;
    font-size: 0.8rem; font-weight: 500; cursor: pointer;
    transition: all 0.2s; border: 1px solid var(--slate-700);
    background: var(--slate-800); color: var(--slate-400);
}
.cat-tag:hover { transform: translateY(-1px); }
.cat-tag.selected { box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.cat-tag.add-cat { border-style: dashed; color: var(--slate-500); }

.action-bar { display: flex; gap: 0.75rem; margin-top: 1.5rem; }

/* ==================== ALERTS ==================== */
.alert {
    padding: 1rem 1.25rem; border-radius: 12px;
    display: flex; align-items: flex-start; gap: 0.875rem;
    margin-top: 1rem;
}
.alert.warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); }
.alert.warning i { color: var(--amber); }
.alert.error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); }
.alert.error i { color: var(--red); }
.alert strong { display: block; margin-bottom: 0.25rem; }
.alert p { font-size: 0.875rem; color: var(--slate-300); margin: 0; }
.alert .btn { margin-top: 0.75rem; }

/* ==================== SIDEBAR ==================== */
.sidebar { display: flex; flex-direction: column; gap: 1rem; }
.stat-card {
    padding: 1.25rem; background: rgba(30,41,59,0.6);
    backdrop-filter: blur(20px); border: 1px solid rgba(71,85,105,0.5);
    border-radius: 12px;
}
.stat-card .stat-label { font-size: 0.7rem; text-transform: uppercase; color: var(--slate-500); font-weight: 600; letter-spacing: 0.05em; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 800; margin-top: 0.25rem; }
.stat-card .stat-sub { font-size: 0.8rem; color: var(--slate-400); margin-top: 0.25rem; }
.stat-card.large { text-align: center; padding: 1.5rem; }
.stat-card.large .stat-value { font-size: 2.5rem; }
.tip-card {
    padding: 1.25rem; border-radius: 12px;
    background: linear-gradient(135deg, rgba(249,115,22,0.1), rgba(245,158,11,0.05));
    border: 1px solid rgba(249,115,22,0.2);
}
.tip-header { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; font-weight: 600; color: var(--amber); margin-bottom: 0.75rem; }
.tip-card p { font-size: 0.875rem; color: var(--slate-300); }
.tip-card .btn { margin-top: 0.75rem; }

/* ==================== RESULT ==================== */
.result-card { margin-top: 1.5rem; }
.result-tabs {
    display: flex; gap: 0.25rem; background: var(--slate-900);
    padding: 0.25rem; border-radius: 8px; margin-bottom: 1.25rem;
}
.result-tabs button {
    flex: 1; padding: 0.625rem 1rem; border: none; background: transparent;
    color: var(--slate-400); font-weight: 500; font-size: 0.8rem;
    border-radius: 6px; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.result-tabs button:hover { color: var(--slate-200); }
.result-tabs button.active { background: var(--slate-700); color: white; }

.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; margin-bottom: 1.5rem; }
.mini-stat {
    text-align: center; padding: 1rem;
    background: var(--slate-900); border-radius: 10px; border: 1px solid var(--slate-700);
}
.mini-stat .val { display: block; font-size: 1.5rem; font-weight: 800; color: var(--orange); }
.mini-stat .lbl { font-size: 0.7rem; text-transform: uppercase; color: var(--slate-500); }

.result-section { margin-bottom: 1.5rem; }
.result-section h3 { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; font-weight: 700; margin-bottom: 0.75rem; }
.data-table { background: var(--slate-900); border-radius: 10px; border: 1px solid var(--slate-700); overflow: hidden; }
.data-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.875rem 1rem; border-bottom: 1px solid var(--slate-700);
}
.data-row:last-child { border-bottom: none; }
.data-row .name { font-weight: 600; }
.data-row .meta { color: var(--slate-400); font-size: 0.875rem; }
.data-row .value { font-family: monospace; color: var(--slate-300); }

.message-card {
    background: var(--slate-900); border: 1px solid var(--slate-700);
    border-radius: 12px; padding: 1rem; margin-bottom: 0.75rem;
}
.msg-header { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.msg-text { font-size: 0.9rem; color: var(--slate-300); line-height: 1.7; margin-bottom: 0.75rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.result-json { background: var(--slate-900); border: 1px solid var(--slate-700); border-radius: 10px; padding: 1rem; overflow-x: auto; }
.result-json pre { margin: 0; font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; white-space: pre-wrap; word-break: break-word; color: var(--slate-300); }

/* ==================== REPORTS LIST ==================== */
.report-list { display: flex; flex-direction: column; gap: 0.5rem; }
.report-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem; background: rgba(15,23,42,0.3); border-radius: 10px;
    transition: background 0.2s;
}
.report-item:hover { background: rgba(15,23,42,0.5); }
.report-info { display: flex; align-items: center; gap: 0.75rem; }
.report-icon {
    width: 40px; height: 40px; background: var(--slate-800);
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    color: var(--orange);
}
.report-title { font-weight: 600; }
.report-meta { font-size: 0.75rem; color: var(--slate-500); }
.report-actions { display: flex; gap: 0.25rem; }

/* ==================== PROJECTS ==================== */
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.project-card {
    background: var(--slate-900); border: 1px solid var(--slate-700);
    border-radius: 12px; padding: 1.25rem;
}
.project-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.project-card h3 { font-size: 1.125rem; font-weight: 700; margin-bottom: 0.25rem; }
.project-address { font-size: 0.875rem; color: var(--slate-400); margin-bottom: 0.5rem; }
.project-meta { font-size: 0.75rem; color: var(--slate-500); }

/* ==================== STATISTICS ==================== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stats-details { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.ranking-list { display: flex; flex-direction: column; gap: 0.5rem; }
.ranking-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1rem; background: rgba(15,23,42,0.3); border-radius: 8px;
}
.ranking-item .rank { font-size: 1rem; font-weight: 700; color: var(--slate-500); width: 30px; }
.ranking-item .name { flex: 1; font-weight: 500; }
.empty-mini { text-align: center; padding: 2rem; color: var(--slate-500); font-size: 0.875rem; }

/* ==================== EMPTY STATE ==================== */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--slate-500); }
.empty-state i { font-size: 3rem; opacity: 0.4; margin-bottom: 1rem; display: block; }
.empty-state h3 { font-size: 1.125rem; font-weight: 600; color: var(--slate-300); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.875rem; margin-bottom: 1rem; }

/* ==================== MODAL ==================== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px); display: flex;
    align-items: center; justify-content: center;
    z-index: 1000; padding: 1rem; animation: fadeIn 0.2s;
}
.modal {
    background: var(--slate-800); border: 1px solid var(--slate-700);
    border-radius: 16px; max-width: 640px; width: 100%;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5); animation: slideUp 0.3s;
}
.modal.modal-sm { max-width: 480px; }
.modal-header {
    padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--slate-700);
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; background: var(--slate-800); z-index: 10;
}
.modal-header h2 { font-size: 1.125rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem; border-top: 1px solid var(--slate-700);
    display: flex; gap: 0.75rem; justify-content: flex-end;
}

/* ==================== SETTINGS ==================== */
.settings-tabs {
    display: flex; gap: 0.25rem; background: var(--slate-900);
    padding: 0.25rem; border-radius: 8px; margin-bottom: 1.5rem;
}
.settings-tabs button {
    flex: 1; padding: 0.625rem 1rem; border: none; background: transparent;
    color: var(--slate-400); font-weight: 500; font-size: 0.8rem;
    border-radius: 6px; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.settings-tabs button:hover { color: var(--slate-200); }
.settings-tabs button.active { background: var(--slate-700); color: white; }

.settings-section hr { border: none; height: 1px; background: var(--slate-700); margin: 1.5rem 0; }

.toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem; background: var(--slate-900); border: 1px solid var(--slate-700);
    border-radius: 10px; margin-bottom: 1rem;
}
.toggle-row strong { display: block; }
.toggle-row p { font-size: 0.8rem; color: var(--slate-500); margin: 0; }

.toggle { position: relative; display: inline-block; width: 48px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--slate-600); border-radius: 26px; transition: 0.3s;
}
.toggle .slider::before {
    content: ''; position: absolute; height: 20px; width: 20px;
    left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s;
}
.toggle input:checked + .slider { background: var(--orange); }
.toggle input:checked + .slider::before { transform: translateX(22px); }

.provider-config {
    padding: 1.25rem; background: var(--slate-900);
    border: 1px solid var(--slate-700); border-radius: 10px; margin-top: 1rem;
}
.provider-config h4 { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; margin-bottom: 1rem; }

.status-line { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; margin-top: 0.75rem; }
.status-line .status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-line.online .status-dot { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-line.offline .status-dot { background: var(--red); }

/* ==================== REPORT DETAIL ==================== */
.report-detail-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.report-detail-stats > div {
    text-align: center; padding: 1rem;
    background: var(--slate-900); border-radius: 10px; border: 1px solid var(--slate-700);
}
.report-detail-stats .lbl { display: block; font-size: 0.7rem; text-transform: uppercase; color: var(--slate-500); margin-bottom: 0.25rem; }

.detail-section { margin-bottom: 1.5rem; }
.detail-section h4 { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; margin-bottom: 0.75rem; }
.detail-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 1rem; background: rgba(15,23,42,0.3); border-radius: 8px;
    margin-bottom: 0.5rem;
}
.original-text { font-style: italic; color: var(--slate-400); font-size: 0.9rem; line-height: 1.7; }

/* ==================== TOAST ==================== */
.toast-container {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 2000;
    display: flex; flex-direction: column; gap: 0.75rem;
    max-width: calc(100vw - 3rem);
}
.toast {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 1rem 1.25rem; background: var(--slate-800);
    border: 1px solid var(--slate-700); border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4); animation: slideUp 0.3s;
    min-width: 280px;
}
.toast-success { border-left: 4px solid var(--green); }
.toast-success i { color: var(--green); }
.toast-error { border-left: 4px solid var(--red); }
.toast-error i { color: var(--red); }
.toast-warning { border-left: 4px solid var(--amber); }
.toast-warning i { color: var(--amber); }
.toast-info { border-left: 4px solid var(--blue); }
.toast-info i { color: var(--blue); }
.toast i { font-size: 1.25rem; flex-shrink: 0; }
.toast-msg { font-weight: 500; }
.toast-detail { font-size: 0.8rem; color: var(--slate-400); margin-top: 0.25rem; }

/* ==================== COLORS ==================== */
.text-orange { color: var(--orange) !important; }
.text-green { color: var(--green) !important; }
.text-blue { color: var(--blue) !important; }
.text-purple { color: var(--purple) !important; }
.text-warning { color: var(--amber) !important; }
.text-danger { color: var(--red) !important; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .input-layout { grid-template-columns: 1fr; }
    .sidebar { display: grid; grid-template-columns: repeat(2, 1fr); }
    .project-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-details { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .container { padding: 0 1rem; }
    .header-content { flex-wrap: wrap; }
    .logo-text .tagline { display: none; }
    .connection-status { display: none; }
    .result-stats { grid-template-columns: repeat(2, 1fr); }
    .project-grid { grid-template-columns: 1fr; }
    .sidebar { grid-template-columns: 1fr; }
    .card-header { flex-direction: column; align-items: flex-start; }
    .btn-group { width: 100%; }
    .form-row { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; }
    .filter-bar .select { max-width: none; }
}
@media (max-width: 480px) {
    .tabs { flex-wrap: nowrap; }
    .tab { padding: 0.625rem 0.75rem; font-size: 0.75rem; }
    .tab span:not(.tab-badge) { display: none; }
    .btn { padding: 0.625rem 1rem; font-size: 0.8rem; }
    .action-bar { flex-wrap: wrap; }
    .action-bar .btn { flex: 1; min-width: calc(50% - 0.375rem); }
}

/* ==================== MODEL BROWSER ==================== */
.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
}
.model-card {
    background: var(--slate-900);
    border: 2px solid var(--slate-700);
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}
.model-card:hover {
    border-color: var(--orange);
    transform: translateY(-2px);
}
.model-card.selected {
    border-color: var(--orange);
    background: rgba(249, 115, 22, 0.1);
}
.model-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}
.model-name {
    font-weight: 600;
    font-size: 0.9rem;
    flex: 1;
}
.model-badges {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}
.model-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--slate-400);
}

/* ==================== VOICE COMMAND ==================== */
.voice-mode-btn {
    background: var(--slate-800);
    border: 1px solid var(--slate-700);
    color: var(--slate-400);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.voice-mode-btn:hover {
    border-color: var(--orange);
    color: var(--orange);
}
.voice-mode-btn.active {
    background: var(--orange);
    border-color: var(--orange);
    color: white;
}

/* ==================== PWA INSTALL ==================== */
.install-btn {
    background: linear-gradient(135deg, var(--green), #059669);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: pulse-glow 2s infinite;
}
.install-btn:hover {
    transform: scale(1.05);
}

/* ==================== DRAG & DROP ==================== */
[draggable="true"] {
    cursor: grab;
}
[draggable="true"]:active {
    cursor: grabbing;
}
.dragging {
    opacity: 0.5;
    transform: scale(1.02);
}
.drag-over {
    border: 2px dashed var(--orange) !important;
    background: rgba(249, 115, 22, 0.1) !important;
}
.drag-placeholder {
    border: 2px dashed var(--slate-600);
    border-radius: 12px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--slate-500);
}

/* ==================== ONLINE STATUS ==================== */
.offline-banner {
    background: linear-gradient(135deg, var(--amber), #d97706);
    color: white;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ==================== EDITABLE REPORTS ==================== */
.editable-section {
    position: relative;
    transition: all 0.3s ease;
}

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

.section-header h3 {
    margin: 0;
}

/* Large Touch-Friendly Buttons (min 48px) */
.btn-add-large,
.btn-edit-large,
.btn-save-large,
.btn-copy-large {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
    min-width: 120px;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-add-large {
    background: linear-gradient(135deg, var(--green), #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-add-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-edit-large {
    background: linear-gradient(135deg, var(--blue), #1d4ed8);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-edit-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.btn-save-large {
    background: linear-gradient(135deg, var(--green), #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-copy-large {
    background: var(--slate-700);
    color: var(--slate-200);
    border: 1px solid var(--slate-600);
}

.btn-copy-large:hover {
    background: var(--slate-600);
}

/* Delete Button - Red, Clear */
.btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    min-width: 100px;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: linear-gradient(135deg, var(--red), #dc2626);
    color: white;
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.3);
}

.btn-delete:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(239, 68, 68, 0.4);
}

.btn-delete-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
}

.btn-delete-sm:hover {
    background: var(--red);
    color: white;
}

/* Editable Table Rows */
.editable-table {
    position: relative;
}

.editable-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--slate-700);
    transition: all 0.2s ease;
    min-height: 60px;
}

.editable-row:last-child {
    border-bottom: none;
}

.editable-row:hover {
    background: rgba(249, 115, 22, 0.05);
}

.editable-row.dragging {
    opacity: 0.6;
    background: rgba(249, 115, 22, 0.15);
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Drag Handle */
.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--slate-500);
    cursor: grab;
    transition: all 0.2s ease;
    border-radius: 6px;
}

.drag-handle:hover {
    color: var(--orange);
    background: rgba(249, 115, 22, 0.1);
}

.drag-handle:active {
    cursor: grabbing;
}

/* Inline Edit Fields */
.editable-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.editable-field.flex-grow {
    flex: 1;
    min-width: 120px;
}

.field-label {
    font-size: 0.8rem;
    color: var(--slate-400);
    white-space: nowrap;
}

.inline-edit {
    background: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: var(--slate-100);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s ease;
    min-height: 40px;
    width: 100%;
}

.inline-edit:hover {
    background: var(--slate-800);
    border-color: var(--slate-600);
}

.inline-edit:focus {
    background: var(--slate-800);
    border-color: var(--orange);
    outline: none;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.inline-edit-sm {
    max-width: 100px;
}

.inline-edit-xs {
    max-width: 60px;
    text-align: center;
}

/* Number Controls with +/- Buttons */
.number-control {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--slate-800);
    border-radius: 10px;
    padding: 0.25rem;
}

.btn-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.btn-minus {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
}

.btn-minus:hover {
    background: var(--red);
    color: white;
}

.btn-plus {
    background: rgba(16, 185, 129, 0.15);
    color: var(--green);
}

.btn-plus:hover {
    background: var(--green);
    color: white;
}

.number-value {
    min-width: 50px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--orange);
}

/* Status Select */
.status-select,
.kanal-select,
.dringlichkeit-select {
    background: var(--slate-800);
    border: 2px solid var(--slate-700);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: var(--slate-100);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
}

.status-select:hover,
.kanal-select:hover,
.dringlichkeit-select:hover {
    border-color: var(--slate-600);
}

.status-select:focus,
.kanal-select:focus,
.dringlichkeit-select:focus {
    border-color: var(--orange);
    outline: none;
}

/* Editable Message Card */
.editable-message {
    position: relative;
}

.message-card-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
}

.msg-text-edit {
    width: 100%;
    min-height: 80px;
    background: var(--slate-800);
    border: 2px solid var(--slate-700);
    border-radius: 10px;
    padding: 0.875rem;
    color: var(--slate-100);
    font-size: 0.9rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.2s ease;
    margin-bottom: 0.75rem;
}

.msg-text-edit:focus {
    border-color: var(--orange);
    outline: none;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

/* Vorfaelle Edit */
.editable-alert {
    cursor: pointer;
    transition: all 0.2s ease;
}

.editable-alert:hover {
    border-color: var(--orange);
}

.edit-textarea-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.edit-textarea {
    width: 100%;
    min-height: 120px;
    background: var(--slate-800);
    border: 2px solid var(--orange);
    border-radius: 12px;
    padding: 1rem;
    color: var(--slate-100);
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
}

.edit-textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

/* Empty Drop Zone */
.empty-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    border: 2px dashed var(--slate-600);
    border-radius: 12px;
    color: var(--slate-500);
    font-size: 0.9rem;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.empty-drop-zone i {
    font-size: 1.5rem;
}

.empty-drop-zone:hover,
.drag-over .empty-drop-zone {
    border-color: var(--orange);
    background: rgba(249, 115, 22, 0.05);
    color: var(--orange);
}

/* ==================== DRAG & DROP ENHANCED ==================== */
.drag-over {
    border: 2px dashed var(--orange) !important;
    background: rgba(249, 115, 22, 0.08) !important;
    border-radius: 12px;
}

.drag-feedback {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    padding: 0.75rem 1.25rem;
    background: var(--orange);
    color: white;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* ==================== BACKEND CONTROL ==================== */
.backend-control-section {
    margin-top: 1.5rem;
}

.backend-control-card {
    background: var(--slate-900);
    border: 1px solid var(--slate-700);
    border-radius: 16px;
    padding: 1.5rem;
}

.backend-status-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.backend-status-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.backend-status-icon.running {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.2));
    color: var(--green);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
    animation: pulse-green 2s infinite;
}

.backend-status-icon.stopped {
    background: rgba(100, 116, 139, 0.2);
    color: var(--slate-400);
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 10px rgba(16, 185, 129, 0.3); }
    50% { box-shadow: 0 0 25px rgba(16, 185, 129, 0.5); }
}

.backend-status-text strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.backend-status-text p {
    font-size: 0.85rem;
    color: var(--slate-400);
    margin: 0;
}

/* Backend Action Button - Large Touch Target */
.btn-backend-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 56px;
    padding: 1rem 1.5rem;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    margin-bottom: 1.25rem;
}

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

.btn-backend-action.btn-start {
    background: linear-gradient(135deg, var(--green), #059669);
    color: white;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.btn-backend-action.btn-start:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.45);
}

.btn-backend-action.btn-stop {
    background: linear-gradient(135deg, var(--red), #dc2626);
    color: white;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
}

.btn-backend-action.btn-stop:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.45);
}

.loader-small {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Backend Help Box */
.backend-help-box {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
}

.help-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: rgba(59, 130, 246, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue);
    font-size: 1.1rem;
}

.help-content {
    flex: 1;
}

.help-content strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--slate-200);
}

.help-steps {
    margin: 0 0 0.75rem 1.25rem;
    padding: 0;
    font-size: 0.85rem;
    color: var(--slate-300);
}

.help-steps li {
    margin-bottom: 0.5rem;
}

.help-steps code {
    background: var(--slate-800);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--orange);
}

.help-note {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--amber);
    margin: 0;
    padding: 0.75rem;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 8px;
}

.help-note i {
    margin-top: 0.1rem;
}

/* ==================== BEGINNER-FRIENDLY BUTTONS ==================== */
/* Ensure all interactive elements are at least 48px */
.btn,
.tab,
.cat-tag,
.mic-btn {
    min-height: 48px;
}

/* Larger touch targets for mobile */
@media (max-width: 768px) {
    .btn {
        min-height: 52px;
        font-size: 0.95rem;
    }

    .btn-add-large,
    .btn-edit-large,
    .btn-save-large,
    .btn-delete {
        min-height: 52px;
        font-size: 0.95rem;
    }

    .btn-number {
        width: 48px;
        height: 48px;
    }

    .inline-edit {
        min-height: 48px;
        font-size: 1rem;
    }

    .editable-row {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 1rem;
    }

    .editable-row .editable-field {
        flex: 1 1 100%;
    }

    .editable-row .number-control {
        flex: 1;
    }

    .editable-row .btn-delete {
        flex: 1;
    }
}

/* Color coding for button types */
.btn-action-ok {
    background: linear-gradient(135deg, var(--green), #059669) !important;
    color: white !important;
}

.btn-action-danger {
    background: linear-gradient(135deg, var(--red), #dc2626) !important;
    color: white !important;
}

.btn-action-edit {
    background: linear-gradient(135deg, var(--blue), #1d4ed8) !important;
    color: white !important;
}

/* Icon + Text clarity */
.btn i,
.btn-add-large i,
.btn-edit-large i,
.btn-delete i {
    font-size: 1rem;
}

/* Visual feedback on press */
.btn:active:not(:disabled),
.btn-add-large:active,
.btn-edit-large:active,
.btn-delete:active,
.btn-number:active {
    transform: scale(0.97);
}

/* ==================== RESPONSIVE EDITABLE COMPONENTS ==================== */
@media (max-width: 480px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-header .btn-add-large,
    .section-header .btn-edit-large {
        width: 100%;
    }

    .number-control {
        justify-content: center;
    }

    .message-card-actions {
        position: static;
        display: flex;
        justify-content: flex-end;
        margin-bottom: 0.5rem;
    }

    .msg-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .backend-status-display {
        flex-direction: column;
        text-align: center;
    }

    .backend-help-box {
        flex-direction: column;
    }

    .help-icon {
        align-self: center;
    }
}
