/* Two Souls RP – Panel: gleiche Design-Tokens wie das Support-Overlay (nur Dark Mode) */
:root {
    --page: #0B0C0E;
    --bg: #15161A;
    --bg-alt: #1D1E22;
    --bg2: #111215;
    --field: #1D1E22;
    --line: #2A2B30;
    --line2: #36373D;
    --line3: #4A4C53;
    --hover: #222328;
    --row-hover: #1E1F24;

    --tx: #ECECEE;
    --tx2: #D4D5D9;
    --tx3: #B4B6BC;
    --tx4: #9A9CA3;
    --text: var(--tx);
    --muted: var(--tx4);
    --border: var(--line);

    --accent: #3562DB;
    --accent-tx: #8FB0FF;

    --ok-bg: #15291F;   --ok-line: #1F3D2C;   --ok-tx: #6FD3A0;
    --err-bg: #2E1715;  --err-line: #4A221E;  --err-tx: #FF8A7A;
    --warn-bg: #3A2A14; --warn-tx: #F2C27A;
    --open-bg: #1C2A4D; --open-tx: #A9C1FF;
    --claim-bg: #2B2148; --claim-tx: #C9B6FF;
    --closed-bg: #26272C; --closed-tx: #A7A9AF;

    --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-head: 'Schibsted Grotesk', 'Geist', ui-sans-serif, system-ui, sans-serif;
    --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    color-scheme: dark;
}

* { box-sizing: border-box; }

body {
    background: var(--page);
    color: var(--tx);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.45;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 2px solid var(--accent-tx); outline-offset: 2px; }
::placeholder { color: #7E8087; }

a { color: var(--accent-tx); }
a:hover { color: #B9CCFF; }

code, pre { font-family: var(--mono); }
code { font-size: 13px; }

/* ------------------------------------------------------------ Layout: Sidebar + Inhalt */
.shell { display: flex; align-items: stretch; min-height: 100vh; }

.sidebar {
    width: 248px;
    flex-shrink: 0;
    background: var(--bg2);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid var(--line); }
.brand-icon { font-size: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-family: var(--font-head); font-size: 15px; color: var(--tx); }
.brand-text span { font-size: 12px; color: var(--tx4); }

.sidebar nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--tx4); padding: 6px 12px 4px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--tx3);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.nav-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

.nav-item:hover { background: var(--hover); color: var(--tx); }
.nav-item[aria-current="page"] { background: var(--hover); color: var(--tx); font-weight: 600; }
.nav-item.nav-cta { background: var(--accent); color: #fff; }
.nav-item.nav-cta:hover, .nav-item.nav-cta[aria-current="page"] { background: var(--accent); filter: brightness(1.1); color: #fff; }

.sidebar-footer { border-top: 1px solid var(--line); padding: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-footer .nav-user { color: var(--tx2); font-size: 13px; font-weight: 500; }
.btn-ghost { height: 34px; padding: 0 10px; background: transparent; border: 1px solid var(--line2); color: var(--tx3); font-size: 13px; font-weight: 500; }
.btn-ghost:hover { background: var(--hover); color: var(--tx); filter: none; }

.inline { display: inline; margin: 0; }

main {
    flex: 1;
    min-width: 0;
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 24px 72px;
}

h1, h2, h3 { font-family: var(--font-head); letter-spacing: -0.01em; }
h1 { color: var(--tx); font-size: 28px; font-weight: 700; margin: 0 0 20px; }
h2 { font-size: 18px; font-weight: 600; margin: 36px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }

.muted { color: var(--tx4); font-size: 13px; }
.error { color: var(--err-tx); }

/* ------------------------------------------------------------ Tabellen */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 12px 0;
    table-layout: fixed;
}

th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8E9097;
    border-bottom: 1px solid var(--line);
}

td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

td, th { word-break: break-word; overflow-wrap: break-word; }
tbody tr:hover td { background: var(--row-hover); }
tbody tr:hover td:first-child { border-top-left-radius: 10px; border-bottom-left-radius: 10px; }
tbody tr:hover td:last-child { border-top-right-radius: 10px; border-bottom-right-radius: 10px; }

.nowrap-cell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------ Karten / Statistik */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}

.stat-card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px 20px;
    text-align: left;
}

.stat-value { display: block; font-family: var(--font-head); font-size: 30px; font-weight: 700; color: var(--tx); }
.stat-label { color: var(--tx4); font-size: 13px; }

/* ------------------------------------------------------------ Badges */
.badge {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    margin-right: 4px;
}

.badge-open { background: var(--open-bg); color: var(--open-tx); }
.badge-closed { background: var(--closed-bg); color: var(--closed-tx); }
.badge-claimed { background: var(--claim-bg); color: var(--claim-tx); }
.badge-pinned { background: var(--warn-bg); color: var(--warn-tx); }
.badge-app { background: var(--claim-bg); color: var(--claim-tx); height: 20px; padding: 0 7px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; }

/* ------------------------------------------------------------ Formularelemente */
input, select, textarea {
    background: var(--field);
    color: var(--tx);
    border: 1px solid var(--line2);
    border-radius: 10px;
    padding: 0 12px;
    font: inherit;
    font-size: 15px;
}

input:not([type="checkbox"]):not([type="radio"]), select:not([multiple]) { height: 44px; }
input:focus, select:focus, textarea:focus { border-color: #5A5C63; outline: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-tx); outline-offset: 1px; }
textarea { padding: 10px 12px; line-height: 1.45; resize: vertical; min-height: 88px; }
select[multiple] { padding: 6px; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); padding: 0; }

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

button:hover { filter: brightness(1.1); }
button:disabled { cursor: not-allowed; opacity: 0.5; }

button.btn-red { background: var(--err-bg); border-color: var(--err-line); color: var(--err-tx); }
button.btn-green { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-tx); }
button.btn-red:hover, button.btn-green:hover { filter: brightness(1.25); }

.filter-bar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-bar input[type="text"] { min-width: 240px; }

.action-bar { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }

.action-form { display: flex; gap: 10px; align-items: flex-end; margin: 14px 0; flex-wrap: wrap; }
.action-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: var(--tx3); flex: 1; min-width: 200px; }
.action-form textarea { width: 100%; }

/* Buttons in Tabellenzeilen: klein und zurückhaltend */
.row-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.row-actions form { margin: 0; }
.row-actions button {
    height: 32px;
    padding: 0 10px;
    font-size: 13px;
    background: var(--field);
    border-color: var(--line3);
    color: var(--tx2);
    font-weight: 500;
}
.row-actions button.btn-red { background: var(--err-bg); border-color: var(--err-line); color: var(--err-tx); }
.row-actions .row-actions-line { display: flex; gap: 6px; align-items: center; }

/* ------------------------------------------------------------ Formulare (Optionen / Fragen) */
.option-form { display: flex; flex-direction: column; gap: 16px; max-width: 560px; }
.option-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: var(--tx3); }
.option-form fieldset {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    margin: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.option-form legend { color: var(--tx); font-size: 14px; font-weight: 600; padding: 0 6px; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 400 !important; }

/* ------------------------------------------------------------ Hinweise */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; }
.flash-error { background: var(--err-bg); border: 1px solid var(--err-line); color: var(--err-tx); }
.flash-success { background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok-tx); }

/* ------------------------------------------------------------ Login */
.login-wrap { max-width: 420px; margin: 48px auto 0; }
.login-banner { display: block; width: 100%; border-radius: 16px 16px 0 0; }

.login-box {
    max-width: 420px;
    margin: 0 auto 48px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 16px 16px;
    padding: 28px;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.login-box hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.login-box form { display: flex; flex-direction: column; gap: 12px; }
.login-box label { display: flex; flex-direction: column; gap: 6px; text-align: left; font-size: 14px; font-weight: 500; color: var(--tx3); }

.btn-discord {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    background: #5865F2;
    color: #fff;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
}
.btn-discord:hover { background: #4752C4; color: #fff; }

/* ------------------------------------------------------------ Ticket-Detail */
.answer { margin-bottom: 14px; }
.answer pre { white-space: pre-wrap; background: var(--field); border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px; margin: 6px 0 0; }

.message-list {
    max-height: 560px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
    padding: 6px 14px;
}

.message { padding: 12px 0; border-bottom: 1px solid var(--line); }
.message:last-child { border-bottom: 0; }
.message-author { font-weight: 600; color: var(--tx); margin-right: 8px; }
.message-time { color: var(--tx4); font-size: 12px; }
.message-content { white-space: pre-wrap; margin-top: 4px; color: var(--tx2); overflow-wrap: anywhere; }

.embed {
    border-left: 4px solid var(--tx4);
    background: var(--field);
    border-radius: 8px;
    padding: 10px 14px;
    margin-top: 8px;
    max-width: 640px;
}
.embed-author { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.embed-title { font-weight: 600; margin-bottom: 4px; }
.embed-description { white-space: pre-wrap; font-size: 14px; color: var(--tx2); }
.embed-field { margin-top: 8px; font-size: 13px; }
.embed-field div { white-space: pre-wrap; margin-top: 2px; color: var(--tx2); }
.embed-footer { color: var(--tx4); font-size: 12px; margin-top: 8px; }
.message-attachments { margin-top: 8px; font-size: 13px; }
.message-buttons { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--closed-bg); color: var(--tx3); border-radius: 8px; padding: 4px 10px; font-size: 12px; }

/* ------------------------------------------------------------ Mobil */
@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: sticky; flex-direction: row; align-items: center; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .brand { border-bottom: 0; border-right: 1px solid var(--line); flex-shrink: 0; }
    .brand-text { display: none; }
    .sidebar nav { flex-direction: row; padding: 8px; gap: 4px; overflow-x: auto; overflow-y: visible; }
    .nav-group { flex-direction: row; align-items: center; gap: 2px; }
    .nav-group-label { display: none; }
    .nav-item { flex-shrink: 0; }
    .sidebar-footer { flex-shrink: 0; border-top: 0; border-left: 1px solid var(--line); }
    .sidebar-footer .nav-user { display: none; }
    main { padding: 20px 14px 56px; }
    h1 { font-size: 24px; }
    .filter-bar input[type="text"] { min-width: 0; width: 100%; }
    .option-form { max-width: none; }
}

.archive-file { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
button.mini { height: 26px; width: 26px; padding: 0; font-size: 15px; line-height: 1; border-radius: 8px; }

.user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--field); flex-shrink: 0; display: inline-block; }

.stars-row { color: #E8A93A; letter-spacing: 2px; white-space: nowrap; }
.stars-row .off { color: var(--line3); }
.dist { display: flex; flex-direction: column; gap: 8px; max-width: 560px; }
.dist-row { display: grid; grid-template-columns: 44px 1fr 36px; gap: 12px; align-items: center; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: #E8A93A; border-radius: 4px; }
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pill-link { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--field); border: 1px solid var(--line2); color: var(--tx2); text-decoration: none; font-size: 14px; }
.pill-link:hover { border-color: #5A5C63; color: var(--tx); }
.pill-link[aria-current="true"] { background: var(--tx); color: #111215; border-color: var(--tx); }
.comment-cell { white-space: pre-wrap; }

.tag-form { display: grid; gap: 8px; max-width: 640px; margin-bottom: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.tag-actions { display: flex; gap: 8px; }

.link-fields { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 0; display: flex; flex-direction: column; gap: 8px; width: 100%; }
.link-fields legend { color: var(--tx3); font-size: 13px; font-weight: 600; padding: 0 6px; }
.link-row { display: flex; gap: 8px; flex-wrap: wrap; }
.link-row input { flex: 1; min-width: 160px; }
.action-form .link-fields, .action-form > label { width: 100%; }
.embed-field .muted { font-size: 13px; margin-top: 2px; }
.desc { color: var(--tx4); font-size: 13px; margin-top: 2px; }
