:root {
    --bg: #0a0a0c;
    --bg-soft: #101013;
    --panel: #141417;
    --panel-2: #18181c;
    --panel-hover: #1d1d22;
    --line: #26262c;
    --line-soft: #1c1c21;
    --text: #ececf0;
    --text-dim: #8d8d97;
    --text-faint: #5c5c66;
    --gold: #e3b341;
    --gold-soft: #c79a35;
    --gold-dim: rgba(227, 179, 65, .14);
    --gold-line: rgba(227, 179, 65, .4);
    --green: #57b97a;
    --green-dim: rgba(87, 185, 122, .14);
    --red: #e5575b;
    --red-dim: rgba(229, 87, 91, .14);
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 18px 50px rgba(0, 0, 0, .45);
}

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

html, body { height: 100%; }

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background: radial-gradient(1200px 600px at 80% -10%, #16130c 0%, var(--bg) 55%);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

svg { flex-shrink: 0; vertical-align: middle; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; position: relative; overflow: hidden; }
.login-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.login-bg .orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; }
.orb-1 { width: 460px; height: 460px; top: -140px; left: -120px; background: radial-gradient(circle at 30% 30%, #e3b341, transparent 70%); animation: float1 16s ease-in-out infinite; }
.orb-2 { width: 520px; height: 520px; bottom: -180px; right: -140px; background: radial-gradient(circle at 70% 70%, #8a6a1f, transparent 70%); animation: float2 20s ease-in-out infinite; }
.orb-3 { width: 320px; height: 320px; top: 40%; left: 55%; background: radial-gradient(circle at 50% 50%, #c79a35, transparent 70%); opacity: .3; animation: float3 24s ease-in-out infinite; }
.grid-overlay {
    position: absolute; inset: 0;
    background-image: linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(circle at 50% 50%, #000 0%, transparent 75%);
    -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0%, transparent 75%);
    opacity: .5;
}
@keyframes float1 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(40px, 50px); } }
@keyframes float2 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-50px, -40px); } }
@keyframes float3 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-30px, 30px) scale(1.1); } }
.login-box {
    position: relative; z-index: 1;
    background: linear-gradient(180deg, rgba(24, 24, 28, .92), rgba(20, 20, 23, .92));
    border: 1px solid var(--line);
    padding: 38px 36px 30px;
    border-radius: 22px;
    width: 400px;
    box-shadow: var(--shadow), 0 0 0 1px rgba(227, 179, 65, .05), inset 0 1px 0 rgba(255, 255, 255, .04);
    backdrop-filter: blur(14px);
    animation: card-in .5s cubic-bezier(.2, .8, .2, 1) both;
}
.login-box::before {
    content: ''; position: absolute; inset: 0; border-radius: 22px; padding: 1px;
    background: linear-gradient(140deg, var(--gold-line), transparent 40%, transparent 60%, rgba(227, 179, 65, .2));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    pointer-events: none;
}
@keyframes card-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.login-brand { display: flex; align-items: center; gap: 14px; padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line-soft); }
.login-greeting { margin-bottom: 24px; }
.login-greeting h1 { font-size: 22px; font-weight: 700; letter-spacing: -.2px; }
.login-greeting p { font-size: 13px; color: var(--text-dim); margin-top: 5px; }
.login-foot { text-align: center; font-size: 12px; color: var(--text-faint); margin-top: 20px; }
.brand-mark {
    width: 46px; height: 46px;
    display: grid; place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--gold), var(--gold-soft));
    color: #1a1408;
    font-weight: 800;
    letter-spacing: .5px;
    font-size: 17px;
    box-shadow: 0 6px 18px rgba(227, 179, 65, .25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; font-weight: 700; }
.brand-text span { font-size: 12px; color: var(--text-dim); }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 7px; }
.field input {
    width: 100%; padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    color: var(--text);
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus { outline: none; border-color: var(--gold-line); box-shadow: 0 0 0 3px var(--gold-dim); }
.login-box button[type=submit] {
    width: 100%; padding: 13px;
    border: none; border-radius: var(--radius-sm);
    margin-top: 6px;
    background: linear-gradient(135deg, var(--gold), var(--gold-soft));
    color: #1a1408;
    font-size: 14px; font-weight: 700;
    cursor: pointer;
    transition: filter .15s, transform .05s;
}
.login-box button[type=submit]:hover { filter: brightness(1.08); }
.login-box button[type=submit]:active { transform: translateY(1px); }

.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
    width: 250px; min-width: 250px;
    background: var(--bg-soft);
    border-right: 1px solid var(--line-soft);
    display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px; border-bottom: 1px solid var(--line-soft); }
.nav { padding: 14px 12px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: var(--radius-sm);
    color: var(--text-dim); font-weight: 600; font-size: 14px;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--gold-dim); color: var(--gold); }
.nav-item.active svg { color: var(--gold); }

.sidebar-footer { padding: 14px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; }
.admin-card { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }
.admin-avatar, .topbar-avatar {
    width: 38px; height: 38px; flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--panel-2);
    border: 1px solid var(--line);
    color: var(--gold);
}
.admin-info { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.admin-info strong { font-size: 13px; }
.admin-info span { font-size: 12px; color: var(--text-faint); }
.logout-btn {
    width: 38px; height: 38px; flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: var(--radius-sm);
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--text-dim);
    transition: all .15s;
}
.logout-btn:hover { color: var(--red); border-color: var(--red-dim); background: var(--red-dim); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 64px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--line-soft);
    background: rgba(16, 16, 19, .6);
    backdrop-filter: blur(8px);
}
.topbar-title { font-size: 14px; color: var(--text-dim); font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.icon-btn {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel);
    color: var(--text-dim);
    cursor: pointer;
    transition: all .15s;
}
.icon-btn:hover { color: var(--gold); border-color: var(--gold-line); }

.content { flex: 1; overflow-y: auto; padding: 28px; }

.list-view { max-width: 920px; margin: 0 auto; }
.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-title { display: flex; align-items: center; gap: 11px; font-size: 24px; font-weight: 700; }
.page-title svg { color: var(--gold); }

.filter-pills { display: flex; gap: 8px; margin-bottom: 22px; }
.pill {
    padding: 8px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--text-dim);
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}
.pill:hover { color: var(--text); border-color: var(--line); background: var(--panel-hover); }
.pill.active { background: var(--gold-dim); border-color: var(--gold-line); color: var(--gold); }

.ticket-list { display: flex; flex-direction: column; gap: 10px; }
.ticket-card {
    display: flex; align-items: center; gap: 16px;
    width: 100%; text-align: left;
    padding: 16px 18px;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .08s;
}
.ticket-card:hover { border-color: var(--gold-line); background: var(--panel-2); transform: translateY(-1px); }
.tc-icon {
    width: 44px; height: 44px; flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: 11px;
    background: var(--gold-dim);
    color: var(--gold);
}
.ticket-card.is-closed .tc-icon { background: var(--line-soft); color: var(--text-faint); }
.tc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tc-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-title svg { color: var(--text-faint); }
.tc-sub { font-size: 12.5px; color: var(--text-faint); }
.tc-badges { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tc-chevron { color: var(--text-faint); flex-shrink: 0; transition: transform .15s, color .15s; }
.ticket-card:hover .tc-chevron { color: var(--gold); transform: translateX(3px); }

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px;
    border-radius: 7px;
    font-size: 11px; font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    border: 1px solid transparent;
    white-space: nowrap;
}
.badge-open { color: var(--gold); border-color: var(--gold-line); background: var(--gold-dim); }
.badge-closed { color: var(--text-faint); border-color: var(--line); background: var(--panel-2); }

.dialog { max-width: 920px; margin: 0 auto; display: flex; flex-direction: column; height: 100%; }
.back-link {
    display: inline-flex; align-items: center; gap: 7px;
    color: var(--text-dim); font-size: 13px; font-weight: 600;
    margin-bottom: 16px;
    transition: color .15s;
    align-self: flex-start;
}
.back-link:hover { color: var(--gold); }

.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.dialog-title { display: flex; align-items: center; gap: 11px; font-size: 23px; font-weight: 700; }
.dialog-title svg { color: var(--gold); }
.dialog-sub { font-size: 12.5px; color: var(--text-faint); margin-top: 6px; padding-left: 2px; }
.dialog-badges { display: flex; gap: 8px; flex-shrink: 0; padding-top: 4px; }

.dialog-toolbar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 12px 14px;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; }
.btn-ban { margin-left: auto; }

.chat-scroll {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-soft);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 22px;
    min-height: 280px;
}
.chat { display: flex; flex-direction: column; gap: 16px; }
.chat-empty { text-align: center; color: var(--text-faint); padding: 40px 0; }
.msg-row { display: flex; align-items: flex-end; gap: 10px; max-width: 78%; }
.msg-left { align-self: flex-start; }
.msg-right { align-self: flex-end; flex-direction: row; justify-content: flex-end; }
.msg-avatar {
    width: 34px; height: 34px; flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--panel-2);
    border: 1px solid var(--line);
    color: var(--text-dim);
}
.msg-col { display: flex; flex-direction: column; min-width: 0; }
.msg-right .msg-col { align-items: flex-end; }
.msg-meta { font-size: 11px; color: var(--text-faint); margin-bottom: 5px; padding: 0 4px; }
.msg-bubble {
    padding: 11px 15px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.msg-left .msg-bubble {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-bottom-left-radius: 4px;
}
.msg-right .msg-bubble {
    background: linear-gradient(135deg, var(--gold-dim), rgba(227, 179, 65, .07));
    border: 1px solid var(--gold-line);
    color: var(--text);
    border-bottom-right-radius: 4px;
}

.composer { margin-top: 16px; flex-shrink: 0; }
.composer-box { display: flex; gap: 12px; align-items: flex-end; }
.composer-input {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text);
    font-size: 14px; font-family: inherit;
    resize: none;
    max-height: 160px;
    line-height: 1.5;
    transition: border-color .15s, box-shadow .15s;
}
.composer-input:focus { outline: none; border-color: var(--gold-line); box-shadow: 0 0 0 3px var(--gold-dim); }
.composer-send { padding: 14px 22px; }
.composer-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 9px; padding-left: 4px; }
.composer-closed {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: 16px; padding: 14px;
    color: var(--green);
    background: var(--green-dim);
    border: 1px solid var(--green-dim);
    border-radius: var(--radius);
    font-weight: 600;
}

.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--gold), var(--gold-soft));
    color: #1a1408;
    font-size: 13px; font-weight: 700; font-family: inherit;
    cursor: pointer;
    transition: filter .15s, transform .05s, background .15s, border-color .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-ghost {
    background: var(--panel-2);
    border-color: var(--line);
    color: var(--text-dim);
    filter: none;
}
.btn-ghost:hover { color: var(--text); border-color: var(--gold-line); background: var(--panel-hover); filter: none; }
.btn-danger {
    background: var(--red-dim);
    border-color: var(--red-dim);
    color: var(--red);
    filter: none;
}
.btn-danger:hover { background: rgba(229, 87, 91, .22); filter: none; }

.rate-group { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim); }
.btn-rate {
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--text-faint);
    cursor: pointer;
    transition: all .15s;
}
.btn-rate:hover { background: var(--gold-dim); border-color: var(--gold-line); color: var(--gold); }
.rate-result { display: inline-flex; align-items: center; gap: 5px; color: var(--gold); font-weight: 600; font-size: 13px; }

.ban-overlay {
    position: fixed; inset: 0; z-index: 50;
    display: grid; place-items: center;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(3px);
}
.ban-modal {
    width: 380px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 26px;
    box-shadow: var(--shadow);
}
.ban-modal h3 { display: flex; align-items: center; gap: 9px; font-size: 16px; margin-bottom: 18px; color: var(--red); }
.ban-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

.empty {
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    text-align: center; color: var(--text-faint);
    padding: 70px 20px; font-size: 14px;
}
.empty svg { color: var(--line); }
.error, .error-flash {
    padding: 12px 16px; background: var(--red-dim); color: var(--red);
    border: 1px solid var(--red-dim); border-radius: var(--radius-sm);
    margin-bottom: 12px; font-weight: 500;
}
.success-flash {
    padding: 12px 16px; background: var(--green-dim); color: var(--green);
    border: 1px solid var(--green-dim); border-radius: var(--radius-sm);
    margin-bottom: 12px; font-weight: 500;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #34343b; }

@media (max-width: 760px) {
    .sidebar { width: 72px; min-width: 72px; }
    .brand-text, .admin-info, .nav-item span { display: none; }
    .brand, .nav-item { justify-content: center; }
    .sidebar-footer { flex-direction: column; }
    .content { padding: 16px; }
    .dialog-head { flex-direction: column; }
    .tc-badges { flex-direction: column; align-items: flex-end; gap: 5px; }
}
