:root {
    --bg: #0f1115;
    --panel: #171a21;
    --border: #2a2e38;
    --text: #e5e7eb;
    --muted: #9099a8;
    --accent: #4f8cff;
    --accent-hover: #6ea0ff;
    --success: #3ec97c;
    --danger: #e05c5c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, Segoe UI, Roboto, sans-serif;
    font-size: 14px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.container { max-width: 1000px; margin: 0 auto; padding: 24px 16px; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 24px; }
.brand { font-weight: 700; color: var(--text); }
.topbar nav a { margin-right: 16px; color: var(--muted); }
.topbar nav a:hover { color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; color: var(--muted); }

.link-button {
    background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0;
}
.link-button:hover { color: var(--text); }

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; }
tr:hover td { background: rgba(255,255,255,0.02); }

.badge {
    display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
    background: var(--border); color: var(--muted);
}
.badge.channel-email { background: #2a3f5f; color: #a9c6ff; }
.badge.channel-instagram_dm, .badge.channel-instagram_comment { background: #5f2a54; color: #ffb0e6; }
.badge.channel-manual { background: #4f4a2a; color: #ffe9a0; }
.badge.status-new { background: #2a5f3f; color: #a9ffca; }
.badge.status-replied { background: #2a3f5f; color: #a9c6ff; }
.badge.status-closed { background: var(--border); color: var(--muted); }

.filters { display: flex; gap: 8px; margin-bottom: 16px; }

.message {
    padding: 12px; border-radius: 8px; margin-bottom: 10px; max-width: 80%;
    white-space: pre-wrap; word-wrap: break-word;
}
.message.in { background: var(--panel); border: 1px solid var(--border); }
.message.out { background: #1e3a5f; margin-left: auto; }
.message-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

form.stacked { display: flex; flex-direction: column; gap: 10px; }
label { color: var(--muted); font-size: 13px; }
input, select, textarea {
    background: #10131a; border: 1px solid var(--border); color: var(--text);
    padding: 8px 10px; border-radius: 6px; font-size: 14px; width: 100%;
}
textarea { min-height: 100px; resize: vertical; }

button, .btn {
    background: var(--accent); color: white; border: none; padding: 8px 16px;
    border-radius: 6px; cursor: pointer; font-size: 14px;
}
button:hover, .btn:hover { background: var(--accent-hover); }
button.secondary { background: var(--border); color: var(--text); }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.alert.success { background: rgba(62,201,124,0.15); color: var(--success); }
.alert.error { background: rgba(224,92,92,0.15); color: var(--danger); }

.login-box { max-width: 360px; margin: 80px auto; }

.inline-form { display: inline-block; margin-right: 8px; }
