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

:root {
    --accent:     #e04050;
    --accent-dim: rgba(224, 64, 80, 0.12);
    --bg:         #0d0d0d;
    --surface:    #161622;
    --surface2:   #1e1e30;
    --border:     #252538;
    --text:       #e0e0e0;
    --text-dim:   #888;
}

/* Light Mode */
body.light-mode {
    --accent:     #e04050;
    --accent-dim: rgba(224, 64, 80, 0.12);
    --bg:         #f5f5f5;
    --surface:    #ffffff;
    --surface2:   #f9f9f9;
    --border:     #e0e0e0;
    --text:       #1a1a1a;
    --text-dim:   #666666;
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.logo {
    padding: 1.4rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.5px;
}

nav {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 0;
    flex: 1;
}

nav a {
    color: var(--text-dim);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
}

nav a:hover,
nav a.active {
    color: var(--text);
    background: var(--accent-dim);
    border-left-color: var(--accent);
}

/* Content area */
.content {
    margin-left: 220px;
    flex: 1;
    padding: 2rem 2.5rem;
    max-width: 1100px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

h2 {
    color: var(--accent);
    margin-bottom: 1.25rem;
    font-size: 1.3rem;
}

h3 {
    color: var(--text-dim);
    font-size: 1rem;
    margin: 1rem 0 0.5rem;
}

/* Status Grid */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.status-card {
    background: var(--surface);
    border-radius: 10px;
    padding: 1.25rem;
    border-left: 4px solid var(--border);
}

.status-card.online  { border-left-color: #00e676; }
.status-card.offline { border-left-color: var(--accent); }

.status-card h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    letter-spacing: 0.5px;
}

.status-card.online  .badge { background: #00e676; color: #000; }
.status-card.offline .badge { background: var(--accent); color: #fff; }

/* Forms */
form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

input, textarea {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    flex: 1;
    min-width: 150px;
}

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

textarea {
    width: 100%;
    resize: vertical;
    flex: none;
}

button {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.6rem 1.4rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

button:hover { opacity: 0.85; }

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
}

td button {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 500;
}

td button:hover { background: var(--accent-dim); opacity: 1; }

/* Response Box */
.response-box {
    background: rgba(224, 64, 80, 0.05);
    border-radius: 10px;
    padding: 1.25rem;
    margin: 1.5rem 0 1rem 0;
    min-height: 70px;
    white-space: pre-wrap;
    border: 1px solid rgba(224, 64, 80, 0.15);
    border-left: 4px solid var(--accent);
    font-size: 0.95rem;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

#sendPrompt { margin-top: 0.5rem; }

/* Prompt History */
#promptHistory li {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--surface2);
    list-style: none;
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* ── Widget Grid ── */
.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.btn-sm {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 0.35rem 0.9rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-sm:hover { border-color: var(--accent); color: var(--accent); opacity: 1; }
.btn-sm.active { border-color: var(--accent); color: var(--accent); }

.widget-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    grid-auto-rows: auto;
}

.widget {
    background: var(--surface);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.2s;
    cursor: default;
    display: flex;
    flex-direction: column;
    position: relative;
    /* Standard: 2 Spalten (normal) */
    grid-column: span 2;
    min-height: 200px;
}

/* Widget Groessen */
.widget[data-size="small"] { 
    grid-column: span 1;
    min-height: 150px;
}

.widget[data-size="normal"] { 
    grid-column: span 2;
    min-height: 200px;
}

.widget[data-size="wide"] { 
    grid-column: span 4;
    min-height: 250px;
}

.widget[data-size="full"] { 
    grid-column: span 4;
    min-height: 500px;
}

.widget.drag-over { border-color: var(--accent); }
.widget.dragging  { opacity: 0.4; }

.widget-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
    flex-shrink: 0;
    justify-content: space-between;
}

.widget-head-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.drag-handle {
    cursor: grab;
    font-size: 1rem;
    opacity: 0.4;
    user-select: none;
    flex-shrink: 0;
}

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

.edit-mode .drag-handle { opacity: 1; color: var(--accent); }

.widget-size-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.edit-mode .widget-size-btn {
    opacity: 1;
    pointer-events: auto;
}

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

.widget-body {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Resize Handle */
.widget::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, transparent 50%, var(--accent) 50%);
    cursor: nwse-resize;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 0 0 10px 0;
}

.widget:hover::after {
    opacity: 0.3;
}

/* Weather */
.weather-main {
    text-align: center;
    margin-bottom: 1rem;
}

.weather-temp {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.weather-desc {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin: 0.4rem 0;
}

.weather-feels {
    font-size: 0.9rem;
    color: var(--text-dim);
}

.weather-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.weather-item {
    background: var(--surface2);
    padding: 0.7rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.weather-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.weather-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.weather-footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
    padding-top: 0.8rem;
    margin-top: 0.8rem;
}

/* Pi Stats */
.stats-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stat-label { 
    min-width: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.stat-bar {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.stat-value { 
    min-width: 50px;
    text-align: right;
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}

.stat-detail {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-left: 50px;
    margin-top: -0.75rem;
}

.stat-host {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
    padding-top: 0.8rem;
    margin-top: 0.8rem;
}

/* Services */
.services-header {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.services-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.svc-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem;
    border-radius: 6px;
    border-left: 3px solid transparent;
    font-size: 0.9rem;
}

.svc-row.online {
    background: rgba(0, 230, 118, 0.08);
    border-left-color: #00e676;
}

.svc-row.offline {
    background: var(--accent-dim);
    border-left-color: var(--accent);
}

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

.svc-dot.online  { background: #00e676; box-shadow: 0 0 8px #00e676; }
.svc-dot.offline { background: var(--accent); }

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

.svc-status {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.svc-code {
    font-size: 0.75rem;
    color: var(--text-dim);
    background: var(--surface2);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

/* News */
.news-list {
    list-style: none;
}

.news-item {
    padding: 0.8rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.news-item:last-child { border-bottom: none; }

.news-title {
    font-size: 0.9rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.news-title:hover { color: var(--accent); }

.news-date { 
    font-size: 0.75rem;
    color: var(--text-dim);
}

.news-desc {
    font-size: 0.8rem;
    color: var(--text-dim);
    line-height: 1.4;
}

/* LLM Mini Widget */
.mini-prompt {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 0.5rem;
    font-size: 0.85rem;
    resize: none;
    margin-bottom: 0.5rem;
}

.mini-prompt:focus { outline: none; border-color: var(--accent); }

.mini-response {
    font-size: 0.83rem;
    color: var(--text-dim);
    min-height: 40px;
    white-space: pre-wrap;
    margin-top: 0.5rem;
}

/* Widget error */
.widget-error { color: var(--text-dim); font-size: 0.85rem; }

/* Todo Widget */
.todo-input-row {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}
.todo-input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
}
.todo-input:focus { outline: none; border-color: var(--accent); }
.todo-add-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}
.todo-add-btn:hover { opacity: 0.85; }
.todo-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 180px;
    overflow-y: auto;
}
.todo-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    background: var(--surface2);
    transition: background 0.15s;
}
.todo-item:hover { background: var(--border); }
.todo-item input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.todo-title { flex: 1; font-size: 0.85rem; word-break: break-word; }
.todo-item.done .todo-title { text-decoration: line-through; color: var(--text-dim); }
.todo-del {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0 0.2rem;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}
.todo-item:hover .todo-del { opacity: 1; }
.todo-del:hover { color: var(--accent); }
.todo-empty { color: var(--text-dim); font-size: 0.85rem; text-align: center; padding: 0.75rem 0; }

.todo-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    gap: 0.25rem;
}
.todo-compact-count {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}
.todo-compact-label { font-size: 0.78rem; color: var(--text-dim); }
.todo-more { font-size: 0.78rem; color: var(--text-dim); text-align: center; padding: 0.3rem 0; }
.todo-date { font-size: 0.72rem; color: var(--text-dim); margin-left: auto; flex-shrink: 0; white-space: nowrap; }
.todo-list-full { max-height: none !important; }

/* ── Time Tracking Widget ── */
.time-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    gap: 0.4rem;
}
.time-compact-status { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--text-dim); }
.time-compact-clock  { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }

.time-status-row { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.4rem; font-size: 0.85rem; }
.time-status-label { color: var(--text-dim); }

.time-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-working {
    background: #00e676;
    box-shadow: 0 0 6px rgba(0,230,118,0.7);
    animation: pulse-dot 1.5s infinite;
}
.dot-break {
    background: #ffb74d;
    box-shadow: 0 0 6px rgba(255,183,77,0.7);
    animation: pulse-dot 2s infinite;
}
.dot-off { background: var(--text-dim); }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

.time-clock {
    font-size: 2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    margin: 0.2rem 0 0.6rem;
    letter-spacing: 1px;
}
.time-buttons { display: flex; gap: 0.5rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.time-btn {
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.85rem;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.time-btn:hover   { opacity: 0.82; }
.time-btn-in      { background: #00e676; color: #0d0d0d; }
.time-btn-out     { background: var(--accent); color: #fff; }
.time-btn-break   { background: #ffb74d; color: #0d0d0d; }
.time-btn-resume  { background: #4fc3f7; color: #0d0d0d; }

.time-summary { display: flex; gap: 1rem; font-size: 0.82rem; color: var(--text-dim); }

.time-report { margin-top: 0.75rem; border-top: 1px solid var(--border); padding-top: 0.6rem; }
.time-report-title {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.4rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.time-report-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.time-report-table th { text-align: left; color: var(--text-dim); padding: 0.2rem 0.4rem; font-weight: 600; }
.time-report-table td { padding: 0.25rem 0.4rem; border-bottom: 1px solid var(--border); }
.time-report-table td:first-child { display: flex; align-items: center; gap: 0.4rem; }
.time-report-empty { color: var(--text-dim); font-size: 0.82rem; text-align: center; padding: 0.5rem; }

/* Settings page */
.settings-group {
    background: var(--surface);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.settings-group h3 {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: var(--text);
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.setting-row label { color: var(--text-dim); }

.setting-row input {
    width: 200px;
    flex: none;
}

/* Toggle switch */
.toggle {
    position: relative;
    width: 40px;
    height: 22px;
}

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

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 22px;
    cursor: pointer;
    transition: 0.2s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* User page */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-dim);
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
}

/* ── Debug Panel ── */
.debug-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.debug-controls button {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.debug-controls button:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.debug-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-dim);
}

.debug-controls select {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.debug-logs {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    max-height: 600px;
    overflow-y: auto;
    font-family: "Courier New", monospace;
    font-size: 0.85rem;
}

.debug-log-entry {
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.3rem;
    border-radius: 4px;
    border-left: 3px solid;
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
}

.debug-log-entry.info {
    border-left-color: #2196f3;
    background: rgba(33, 150, 243, 0.08);
    color: #64b5f6;
}

.debug-log-entry.error {
    border-left-color: var(--accent);
    background: var(--accent-dim);
    color: #ff7a7a;
}

.debug-log-entry.warn {
    border-left-color: #ffb74d;
    background: rgba(255, 183, 77, 0.08);
    color: #ffe082;
}

.debug-log-entry.success {
    border-left-color: #00e676;
    background: rgba(0, 230, 118, 0.08);
    color: #69f0ae;
}

.debug-log-time {
    color: var(--text-dim);
    white-space: nowrap;
    font-weight: 600;
    min-width: 80px;
}

.debug-log-type {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    min-width: 55px;
}

.debug-log-message {
    flex: 1;
    word-break: break-word;
}

/* ── Loading Spinner ── */
.loading-spinner-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    min-height: 120px;
    animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.loading-spinner {
    display: inline-block;
    position: relative;
    width: 60px;
    height: 60px;
}

.spinner-ring {
    box-sizing: border-box;
    display: block;
    position: absolute;
    width: 60px;
    height: 60px;
    margin: 0;
    border: 3px solid transparent;
    border-radius: 50%;
    border-top-color: var(--accent);
    border-right-color: var(--accent);
    border-top-right-radius: 50%;
    animation: spinner-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
    animation-delay: -0.45s;
    opacity: 0.8;
}

.spinner-ring:nth-child(2) {
    animation-delay: -0.3s;
    opacity: 0.6;
}

.spinner-ring:nth-child(3) {
    animation-delay: -0.15s;
    opacity: 0.4;
}

.spinner-ring:nth-child(4) {
    animation-delay: 0s;
    opacity: 0.2;
}

@keyframes spinner-ring {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading-message {
    font-size: 0.92rem;
    color: var(--text-dim);
    text-align: center;
    font-weight: 500;
    animation: fade-in-out 3s ease-in-out infinite;
    min-height: 1.4em;
}

@keyframes fade-in-out {
    0%, 10%, 90%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* ── Toast Notification System ── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    min-width: 280px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slide-in 0.3s ease-out;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: var(--text);
}

.toast.success {
    border-left-color: #00e676;
}

.toast.error {
    border-left-color: var(--accent);
}

.toast.info {
    border-left-color: #2196f3;
}

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
}

@keyframes slide-in {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slide-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.removing {
    animation: slide-out 0.3s ease-out forwards;
}

/* ═══ Global Utility ════════════════════════════════════════════════════════ */
.hidden { display: none !important; }

/* ═══ Login Overlay ══════════════════════════════════════════════════════════ */
.login-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-overlay.hidden { display: none !important; }

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0;
    width: 100%;
    max-width: 400px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.login-logo {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    letter-spacing: 0.5px;
    padding: 2rem 2rem 0;
}

/* ── Tabs ────────────────────────────────────────────────────────────── */
.login-tabs {
    display: flex;
    margin: 1.25rem 1.5rem 0;
    background: var(--surface2);
    border-radius: 8px;
    padding: 3px;
    gap: 3px;
}

.login-tab {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 0.55rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s;
}

.login-tab:hover { color: var(--text); opacity: 1; }

.login-tab.active {
    background: var(--accent);
    color: #fff;
    opacity: 1;
}

/* ── Forms ───────────────────────────────────────────────────────────── */
#loginView,
#registerView {
    padding: 1.5rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

#loginForm,
#registerForm {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.login-field label {
    font-size: 0.82rem;
    color: var(--text-dim);
    font-weight: 500;
}

.login-field input {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

.login-field input::placeholder { color: var(--text-dim); opacity: 0.5; }

.login-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(224,64,80,0.12);
}

.login-error {
    color: #ff6b6b;
    font-size: 0.83rem;
    min-height: 1.1em;
    text-align: center;
}

.login-success {
    color: #00e676;
    font-size: 0.83rem;
    text-align: center;
    padding: 0.4rem 0.6rem;
    background: rgba(0,230,118,0.08);
    border-radius: 6px;
    border: 1px solid rgba(0,230,118,0.2);
}

#loginSubmit,
#registerSubmit {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.8rem;
    font-size: 0.97rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    width: 100%;
    margin-top: 0.5rem;
    letter-spacing: 0.2px;
}

#loginSubmit:hover:not(:disabled),
#registerSubmit:hover:not(:disabled) { opacity: 0.88; }

#loginSubmit:active:not(:disabled),
#registerSubmit:active:not(:disabled) { transform: scale(0.99); }

#loginSubmit:disabled,
#registerSubmit:disabled { opacity: 0.5; cursor: not-allowed; }

.login-hint {
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 400;
}

.login-notice {
    font-size: 0.78rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: 1rem;
    line-height: 1.5;
}

/* Freigabe-Button in der Benutzertabelle */
.btn-approved {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-approved:hover { border-color: #00e676; color: #00e676; opacity: 1; }

.btn-approved.active {
    background: rgba(0, 230, 118, 0.12);
    border-color: #00e676;
    color: #00e676;
}

.btn-approved.active:hover {
    background: rgba(224, 64, 80, 0.12);
    border-color: var(--accent);
    color: var(--accent);
}

/* ═══ Sidebar Footer ════════════════════════════════════════════════════════ */
.sidebar-footer {
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.2rem 0;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.85rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.71rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.sidebar-logout {
    width: 100%;
    padding: 0.45rem 0.75rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    font-size: 0.84rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.sidebar-logout:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── AILA STYLES ── */

/* Chat and Training Sections */
.aila-chat-section,
.aila-training-section {
    background: var(--surface);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.aila-chat-section h3,
.aila-training-section h3 {
    color: var(--accent);
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
}

.aila-training-section > p {
    margin-bottom: 1rem;
}

/* Input Group with Autocomplete */
.input-group {
    position: relative;
    margin-bottom: 0.5rem;
}

#promptInput {
    width: 100%;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    color: var(--text);
    padding: 0.9rem 1.1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 90px;
    transition: all 0.2s;
}

#promptInput:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(224, 64, 80, 0.12);
    background: var(--surface);
}

/* Autocomplete Menu */
.autocomplete-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--accent);
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.autocomplete-item {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
    transition: all 0.15s;
    display: flex;
    justify-content: space-between;
}

.autocomplete-item:hover {
    background: var(--accent-dim);
    color: var(--accent);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

/* Buttons */
.btn-primary,
.btn-success {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.75rem 1.8rem;
    border-radius: 7px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.96rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover,
.btn-success:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(224, 64, 80, 0.35);
}

.btn-primary:active,
.btn-success:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(224, 64, 80, 0.25);
}

.btn-success {
    background: #00e676;
    color: #0d0d0d;
}

/* Training Form */
.training-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.7rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(224, 64, 80, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group small {
    color: var(--text-dim);
    font-size: 0.8rem;
    display: block;
    margin-top: 0.2rem;
}

/* Response Content */
.response-content {
    color: var(--text);
    line-height: 1.6;
}

.response-content strong {
    color: var(--accent);
}

.response-answer {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text);
    line-height: 1.7;
    letter-spacing: 0.3px;
}

.response-meta {
    font-size: 0.72rem;
    color: var(--text-dim);
    opacity: 0.6;
    border-top: 1px solid rgba(128, 128, 128, 0.2);
    padding-top: 0.6rem;
    margin-top: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Success and Error Messages */
.success-message {
    background: rgba(0, 230, 118, 0.1);
    border: 1px solid #00e676;
    border-radius: 6px;
    padding: 0.8rem 1rem;
    color: #00e676;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.error-message {
    background: rgba(224, 64, 80, 0.1);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 0.8rem 1rem;
    color: var(--accent);
    font-size: 0.9rem;
}

/* History List */
.history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 300px;
    overflow-y: auto;
}

.history-list li {
    background: rgba(224, 64, 80, 0.05);
    padding: 0.7rem 1rem;
    border-radius: 7px;
    border-left: 3px solid var(--accent);
    color: var(--text);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.history-list li:hover {
    background: rgba(224, 64, 80, 0.1);
    transform: translateX(2px);
}

.history-list li strong {
    color: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
    .aila-chat-section,
    .aila-training-section {
        padding: 1rem;
    }
    
    .form-group {
        gap: 0.3rem;
    }
    
    .btn-primary,
    .btn-success {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
}
