/* KAIonAI Admin - schlicht, gute Lesbarkeit vor Optik */
:root {
    --dark: #1a1a1a;
    --accent: #e3402f;
    --bg: #f4f4f5;
    --card: #ffffff;
    --border: #e2e2e4;
    --text: #222;
    --muted: #888;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--accent); }

/* Topbar */
.topbar { background: var(--dark); color: #fff; }
.topbar-inner {
    max-width: 1100px; margin: 0 auto; padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between;
}
.brand { color: #fff; font-weight: 700; font-size: 18px; letter-spacing: 0.04em; text-decoration: none; }
.brand span { color: var(--accent); }
.topnav a { color: #ccc; text-decoration: none; margin-left: 18px; font-size: 14px; }
.topnav a:hover { color: #fff; }

/* Content */
.content { max-width: 1100px; margin: 0 auto; padding: 24px; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 16px; flex-wrap: wrap; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }

/* Flash messages */
.flashes { margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: 5px; margin-bottom: 8px; font-size: 14px; }
.flash-success { background: #e6f4ea; color: #1e6b34; border: 1px solid #bce3c8; }
.flash-error { background: #fdecea; color: #a1281c; border: 1px solid #f3c3bd; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.table th { text-align: left; background: #ececed; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: #555; padding: 10px 12px; }
.table td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: top; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #fafafa; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.strong, .table .strong { font-weight: 600; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #fff; }
.badge-grey { background: #9096a0; }
.badge-blue { background: #2f7ae3; }
.badge-green { background: #2fa84f; }
.badge-orange { background: #e08a2f; }
.badge-darkgreen { background: #1e6b34; }
.badge-purple { background: #8250c0; }

/* Cards / grid */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 18px 20px; }
.span-2 { grid-column: 1 / -1; }

/* Fields */
.fields { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0 0 12px; }
.fields dt { color: var(--muted); font-size: 13px; }
.fields dd { margin: 0; }
.field-block { margin-top: 12px; }
.field-label { font-size: 13px; color: #555; font-weight: 600; margin-bottom: 6px; }
.field-label.mt { margin-top: 18px; }
.freetext { background: #fafafa; border: 1px solid var(--border); border-radius: 5px; padding: 12px; white-space: pre-wrap; word-wrap: break-word; font-family: inherit; font-size: 14px; margin: 0; }
.status-row { margin-top: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

label { display: block; font-size: 13px; font-weight: 600; color: #555; margin: 12px 0 5px; }
textarea, input[type=text], input[type=password] {
    width: 100%; padding: 9px 11px; border: 1px solid #ccc; border-radius: 5px;
    font-size: 14px; font-family: inherit; background: #fff;
}
textarea.mono, textarea.mono { font-family: 'SF Mono', Consolas, 'Courier New', monospace; font-size: 13px; }
textarea { resize: vertical; }

/* Buttons */
.btn { display: inline-block; border: 1px solid #ccc; background: #f2f2f2; color: #333; border-radius: 5px; padding: 8px 16px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: #e8e8e8; }
.btn-primary { background: var(--dark); color: #fff; border-color: var(--dark); margin-top: 12px; }
.btn-primary:hover { background: #000; }
.btn-ghost { background: transparent; border-color: transparent; color: #555; }
.btn-small { padding: 5px 11px; font-size: 13px; margin: 0; }
.btn-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-danger { background: #fbeae8; color: #a1281c; border-color: #f0c4be; }
.btn-danger:hover { background: #f7d9d5; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-group form { margin: 0; }

/* Downloads */
.download-list { list-style: none; padding: 0; margin: 0 0 16px; }
.download-list li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.download-list li a { font-weight: 600; }
.download-list form { margin: 0 0 0 auto; }
.upload-form { margin-top: 8px; }
.upload-form input[type=file] { display: block; margin: 6px 0; font-size: 14px; }

/* Login */
.login-card { max-width: 360px; margin: 60px auto; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 28px 26px; }
.login-card h1 { margin-bottom: 16px; }

/* Filter */
.filter-form { display: flex; align-items: center; gap: 10px; }
.checkbox { font-weight: 400; font-size: 14px; color: #444; display: flex; align-items: center; gap: 6px; margin: 0; }
.checkbox input { width: auto; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

/* KI-Entwurf */
.ki-entwurf { margin-top: 16px; border: 1px solid var(--border); border-left: 3px solid #8250c0; border-radius: 6px; padding: 14px 16px; background: #faf8fd; }
.ki-entwurf-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ki-entwurf .btn-primary { margin-top: 14px; }
.js-generate-btn[disabled] { opacity: 0.6; cursor: default; }

.btn-group.mt { margin-top: 12px; }

/* --- Songtext-Chat (mobile-first) --- */
.chat-briefing {
    display: flex; flex-wrap: wrap; gap: 8px 18px;
    background: var(--card); border: 1px solid var(--border);
    border-radius: 8px; padding: 12px 16px; margin-bottom: 16px;
    font-size: 13px; color: #555;
}
.chat-briefing strong { color: #333; font-weight: 600; }

.chat-thread {
    display: flex; flex-direction: column; gap: 14px;
    margin-bottom: 18px;
}
.chat-empty {
    background: var(--card); border: 1px dashed var(--border);
    border-radius: 8px; padding: 20px; text-align: center; color: #555;
}
.chat-empty p { margin: 0 0 14px; }

.chat-msg { display: flex; }
.chat-msg-user { justify-content: flex-end; }
.chat-msg-ai { justify-content: flex-start; }

.chat-bubble {
    max-width: 88%; border-radius: 12px; padding: 12px 14px;
    border: 1px solid var(--border);
}
.chat-bubble-user {
    background: var(--dark); color: #fff; border-color: var(--dark);
    border-bottom-right-radius: 4px;
}
.chat-bubble-ai {
    background: #faf8fd; border-left: 3px solid #8250c0;
    border-bottom-left-radius: 4px;
}
.chat-text {
    margin: 0; white-space: pre-wrap; word-wrap: break-word;
    overflow-wrap: anywhere; font-family: inherit; font-size: 14px;
    line-height: 1.55;
}
.chat-bubble-user .chat-text { color: #fff; }
.chat-songtext { font-size: 15px; }
.chat-sub { margin-top: 12px; border-top: 1px solid #e6dff2; padding-top: 8px; }
.chat-sub-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
    color: #8250c0; font-weight: 700; margin-bottom: 4px;
}
.chat-sub-text { font-size: 13px; color: #444; }

/* Eingabebereich */
.chat-input-form {
    background: var(--card); border: 1px solid var(--border);
    border-radius: 10px; padding: 14px; margin-bottom: 16px;
}
.chat-textarea {
    width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 8px;
    font-size: 16px; font-family: inherit; line-height: 1.5; resize: vertical;
    min-height: 72px;
}
.chat-input-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-top: 10px; flex-wrap: wrap;
}
.chat-provider { display: flex; gap: 14px; flex-wrap: wrap; }
.chat-radio {
    display: inline-flex; align-items: center; gap: 6px; margin: 0;
    font-weight: 600; font-size: 14px; color: #444; cursor: pointer;
    min-height: 44px;
}
.chat-radio input { width: auto; }
.chat-send {
    margin-top: 0; min-height: 44px; min-width: 96px; padding: 10px 22px;
    font-size: 15px;
}

.chat-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.chat-actions form { margin: 0; }
.chat-action-btn { margin-top: 0; min-height: 44px; }

@media (max-width: 720px) {
    .grid { grid-template-columns: 1fr; }
    .chat-bubble { max-width: 92%; }
    .chat-input-row { flex-direction: column; align-items: stretch; }
    .chat-send { width: 100%; }
    .chat-actions .chat-action-btn { width: 100%; }
}
