:root {
  color-scheme: dark;
  --page: #080f1c;
  --sidebar: #0b1525;
  --panel: #101c2e;
  --panel-soft: #17253a;
  --line: #263650;
  --text: #f4f3ee;
  --muted: #9ba9bd;
  --accent: #e8bd62;
  --accent-soft: #26344a;
  --green: #63d6a1;
  --red: #ff7d8c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 360px; min-height: 100vh; background: var(--page); color: var(--text); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
.hidden { display: none !important; }
.muted, .fine-print { color: var(--muted); }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 25px; letter-spacing: -.035em; }
h2 { margin-bottom: 6px; font-size: 17px; }
h3 { margin-bottom: 6px; font-size: 15px; }
small { display: block; color: var(--muted); font-size: 11px; }

.login-screen { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 14%, #243755 0, transparent 38%), radial-gradient(ellipse at 50% 100%, #382a1938, transparent 45%), var(--page); }
.login-card { width: min(460px, 100%); padding: 42px; border: 1px solid #d5ab5840; border-radius: 20px; background: linear-gradient(145deg, #14233a, #0d1728 72%); box-shadow: 0 28px 90px #0008; text-align: center; }
.login-card h1 { margin: 12px 0; font-size: 30px; }
.login-card .muted { margin: 0 0 26px; line-height: 1.65; }
.login-card .fine-print { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 20px 0 0; font-size: 11px; line-height: 1.5; text-align: center; }
.login-brand-image { display: block; width: 132px; height: 132px; margin: 0 auto 20px; border: 1px solid #e8bd6240; border-radius: 50%; background: #091426; object-fit: contain; box-shadow: 0 12px 42px #0007, 0 0 30px #e8bd6215; }
.app { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 2; display: flex; width: 245px; flex-direction: column; padding: 22px 15px 16px; border-right: 1px solid var(--line); background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 0 34px 3px; color: var(--text); text-decoration: none; }
.brand strong { display: block; font-size: 13px; }
.brand small { margin-top: 3px; font-size: 10px; }
.brand-avatar { position: relative; display: grid; width: 38px; height: 38px; flex: none; place-items: center; overflow: hidden; border: 1px solid #e8bd6255; border-radius: 12px; background: #091426; }
.brand-avatar img { width: 100%; height: 100%; object-fit: contain; }
.server-label { margin: 0 0 8px 5px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.sidebar select, .filters select, .filters input, .publish-controls select { width: 100%; }
.sidebar select { margin-bottom: 22px; }
.navigation { display: grid; gap: 5px; }
.nav-link { display: flex; min-height: 41px; align-items: center; gap: 11px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); text-align: left; }
.nav-link:hover, .nav-link.active { background: var(--accent-soft); color: white; }
.nav-icon { width: 18px; font-size: 16px; text-align: center; }
.nav-count { margin-left: auto; padding: 2px 7px; border-radius: 12px; background: #ffffff10; font-size: 10px; }
.sidebar-bottom { margin-top: auto; }
.security-note { display: flex; align-items: center; gap: 8px; padding: 12px 9px; color: var(--muted); font-size: 10px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px #63d6a177; }
.quiet-button { width: 100%; padding: 9px; border: 0; background: transparent; color: var(--muted); text-align: left; }
.quiet-button:hover { color: white; }

.workspace { max-width: 1720px; margin-left: 245px; padding: 0 34px 44px; }
.topbar { display: flex; min-height: 90px; align-items: center; justify-content: space-between; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.topbar .eyebrow { margin-bottom: 5px; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.topbar-user strong { display: block; margin-bottom: 3px; }
.avatar { display: grid; width: 42px; height: 42px; place-items: center; overflow: hidden; border: 1px solid #e8bd6266; border-radius: 50%; background: #091426; color: white; font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: contain; }
.view { animation: fade-in .16s ease-out; }
@keyframes fade-in { from { opacity: .5; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 17px; }
.metric-card { display: grid; grid-template-columns: 1fr auto; min-height: 91px; align-content: center; padding: 16px 19px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.metric-label { color: var(--muted); font-size: 11px; }
.metric-card strong { grid-row: span 2; align-self: center; font-size: 26px; }
.metric-foot { margin-top: 7px; color: #777987; font-size: 10px; }
.panel { border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.ticket-workspace { display: grid; min-height: min(700px, calc(100vh - 245px)); grid-template-columns: minmax(310px, 37%) 1fr; overflow: hidden; }
.ticket-list-pane { display: flex; min-height: 590px; flex-direction: column; border-right: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 13px; }
.section-heading p { margin-bottom: 0; font-size: 11px; }
.icon-button { width: 31px; height: 31px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); color: var(--muted); font-size: 19px; }
.icon-button:hover { color: white; }
.filters { display: grid; gap: 7px; padding: 0 13px 13px; }
.ticket-list { overflow: auto; flex: 1; border-top: 1px solid var(--line); }
.ticket-card { display: block; width: 100%; padding: 13px 15px; border: 0; border-bottom: 1px solid #2c2d3866; background: transparent; color: inherit; text-align: left; }
.ticket-card:hover, .ticket-card.selected { background: #252534; }
.ticket-card-top, .ticket-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ticket-card-title { overflow: hidden; font-size: 12px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.ticket-card-bottom { margin-top: 8px; color: var(--muted); font-size: 10px; }
.ticket-category { overflow: hidden; color: #e8bd62; text-overflow: ellipsis; white-space: nowrap; }
.status-pill { display: inline-flex; flex: none; align-items: center; padding: 4px 8px; border: 1px solid #ffffff0f; border-radius: 20px; background: #2d2e39; color: #c4c5d0; font-size: 9px; font-weight: 700; }
.status-open, .status-claimed { border-color: #63d6a12b; background: #63d6a115; color: var(--green); }
.status-waiting { border-color: #e6b95a33; background: #e6b95a17; color: #eac773; }
.status-closed, .status-deleted { color: #a7a8b2; }

.conversation-pane { position: relative; display: flex; min-width: 0; flex-direction: column; }
.empty-state { display: grid; max-width: 330px; align-content: center; justify-items: center; margin: auto; padding: 30px; color: var(--muted); text-align: center; }
.empty-state h2 { margin: 16px 0 7px; color: var(--text); }
.empty-state p { font-size: 12px; line-height: 1.6; }
.empty-icon { display: grid; width: 56px; height: 56px; place-items: center; border: 1px solid var(--line); border-radius: 17px; background: var(--panel-soft); color: var(--accent); font-size: 24px; }
.conversation { display: flex; min-height: 590px; flex: 1; flex-direction: column; }
.conversation-header { display: flex; min-height: 76px; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--line); }
.conversation-actions { display: flex; flex: none; align-items: center; gap: 8px; }
.conversation-header h2 { margin: 0 0 4px; overflow-wrap: anywhere; }
.conversation-header .eyebrow { margin-bottom: 4px; }
.conversation-header .muted { margin: 0; font-size: 10px; }
.message-list { display: flex; min-height: 180px; flex: 1; flex-direction: column; gap: 14px; overflow: auto; padding: 20px; }
.message { max-width: 88%; align-self: flex-start; }
.message.staff { align-self: flex-end; }
.message-header { display: flex; align-items: center; gap: 8px; margin: 0 0 5px; color: var(--muted); font-size: 10px; }
.message.staff .message-header { justify-content: flex-end; }
.message-header strong { color: var(--text); font-size: 11px; }
.message-avatar { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.message-body { overflow-wrap: anywhere; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px 12px 12px; background: var(--panel-soft); font-size: 12px; line-height: 1.55; white-space: pre-wrap; }
.message.staff .message-body { border-color: #e8bd6233; border-radius: 12px 4px 12px 12px; background: #1b2a40; }
.message-body a { color: #a5a2ff; overflow-wrap: anywhere; }
.message-file { display: block; margin-top: 7px; font-size: 10px; }
.reply-form { padding: 13px 18px 15px; border-top: 1px solid var(--line); background: #181920; }
.reply-form label { display: block; margin-bottom: 8px; font-size: 11px; font-weight: 700; }
.reply-form select { width: min(340px, 100%); margin-bottom: 8px; }
.reply-form textarea { width: 100%; min-height: 68px; resize: vertical; }
.reply-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; }
.reply-actions .muted { font-size: 10px; }

select, input:not([type="checkbox"]), textarea { min-height: 37px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: #13141a; color: var(--text); }
select:focus, input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px #e8bd6222; }
select[multiple] { min-height: 112px; }
input::placeholder, textarea::placeholder { color: #686a78; }
.button { display: inline-flex; min-height: 37px; align-items: center; justify-content: center; gap: 9px; padding: 0 14px; border: 1px solid transparent; border-radius: 8px; color: white; font-weight: 700; font-size: 11px; text-decoration: none; }
.button.primary { background: linear-gradient(135deg, #f0cc78, #d9a849); color: #111a28; }
.button.primary:hover { background: linear-gradient(135deg, #f7d991, #e8bd62); }
.button.secondary { border-color: var(--line); background: var(--panel-soft); color: var(--text); }
.button.secondary:hover { border-color: #5b5c69; background: #2a2b36; }
.button.wide { width: 100%; min-height: 43px; }
.button:disabled { cursor: not-allowed; opacity: .55; }

.settings-intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 5px 0 18px; }
.settings-intro h2 { margin: 0 0 6px; font-size: 22px; }
.settings-intro p { margin-bottom: 0; font-size: 11px; }
.admin-badge { padding: 8px 11px; border: 1px solid #e6b95a33; border-radius: 20px; background: #e6b95a12; color: #eac773; font-size: 10px; white-space: nowrap; }
.settings-form { display: grid; gap: 14px; }
.settings-section { padding: 18px; }
.settings-section .section-heading { padding: 0 0 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid label, .category-form label { display: grid; align-content: start; gap: 6px; color: #d3d3dc; font-size: 10px; font-weight: 700; }
.form-grid label small { font-size: 9px; font-weight: 400; }
.span-2 { grid-column: span 2; }
.form-grid textarea { resize: vertical; }
.check-row { display: flex !important; min-height: 38px; align-items: center; gap: 9px !important; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #13141a; }
.check-row input { accent-color: var(--accent); }
.category-heading { padding-bottom: 15px !important; }
.category-editor-layout { display: grid; grid-template-columns: minmax(150px, 25%) 1fr; gap: 17px; }
.category-list { display: flex; flex-direction: column; gap: 6px; }
.category-select { display: flex; min-height: 38px; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #13141a; color: var(--muted); text-align: left; font-size: 11px; }
.category-select:hover, .category-select.active { border-color: #e8bd6277; background: var(--accent-soft); color: white; }
.category-select span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #17181f; }
.category-form .span-2 { grid-column: span 2; }
.category-form .empty-hint { grid-column: span 2; margin: 8px; color: var(--muted); font-size: 11px; }
.category-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.category-options .check-row { font-size: 10px; }
.category-action-row { display: flex; grid-column: span 2; justify-content: flex-end; gap: 8px; }
.button.danger { border: 1px solid #ff7d8c33; background: #ff7d8c12; color: var(--red); }
.publish-section { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.publish-section p { margin-bottom: 0; font-size: 10px; }
.publish-controls { display: flex; width: min(430px, 50%); gap: 8px; }
.publish-controls select { min-width: 0; }
.save-bar { position: sticky; bottom: 10px; display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: #1b1c25ed; box-shadow: 0 8px 30px #0004; backdrop-filter: blur(12px); }
.save-bar .muted { margin-right: auto; font-size: 10px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 5; max-width: min(420px, calc(100vw - 48px)); padding: 12px 16px; transform: translateY(20px); border: 1px solid var(--line); border-radius: 10px; background: #252631; box-shadow: 0 12px 30px #0005; color: var(--text); font-size: 11px; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { transform: none; opacity: 1; }
.toast.error { border-color: #ff7d8c55; color: #ffb1b8; }
.list-empty { padding: 24px 15px; color: var(--muted); font-size: 11px; text-align: center; }

.page-intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 5px 0 18px; padding: 20px 22px; border: 1px solid #e8bd6233; border-radius: 14px; background: radial-gradient(ellipse at 95% 0, #e8bd6215, transparent 55%), var(--panel); }
.page-intro h2 { margin: 0 0 6px; font-size: 22px; }
.page-intro p:last-child { max-width: 700px; margin-bottom: 0; font-size: 11px; line-height: 1.6; }
.moderation-layout, .absence-layout { display: grid; grid-template-columns: minmax(280px, .75fr) minmax(0, 1.25fr); gap: 14px; align-items: start; }
.moderation-layout .settings-section, .absence-layout .settings-section { min-width: 0; }
.stack-form { display: grid; gap: 12px; }
.stack-form label { display: grid; gap: 6px; color: #d3d3dc; font-size: 10px; font-weight: 700; }
.stack-form textarea { resize: vertical; }
.stack-form .fine-print { margin: 0; font-size: 9px; line-height: 1.5; }
.log-panel { min-width: 0; overflow: hidden; }
.log-panel .section-heading { padding-bottom: 13px; }
.log-panel .section-heading select { width: auto; min-width: 155px; }
.record-list { display: grid; gap: 9px; padding: 0 14px 14px; }
.record-card { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #17181f; }
.record-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.record-title { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 750; }
.record-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 7px; color: var(--muted); font-size: 9px; }
.record-reason { margin: 10px 0 0; color: #d3d3dc; font-size: 10px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.record-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.record-actions .button { min-height: 31px; padding: 0 10px; font-size: 10px; }
.record-actions input { min-width: 180px; flex: 1; }
.record-pill { display: inline-flex; flex: none; padding: 4px 8px; border: 1px solid #ffffff12; border-radius: 20px; background: #ffffff08; color: var(--muted); font-size: 9px; font-weight: 750; }
.record-pill.pending, .record-pill.reminded { border-color: #e6b95a33; background: #e6b95a12; color: #eac773; }
.record-pill.approved, .record-pill.logged { border-color: #63d6a133; background: #63d6a112; color: var(--green); }
.record-pill.rejected { border-color: #ff7d8c33; background: #ff7d8c12; color: var(--red); }
.banlog-panel { margin-top: 14px; }
.absence-layout { grid-template-columns: minmax(250px, .65fr) minmax(0, 1.35fr); }
.absence-range { color: #e8bd62; font-size: 10px; font-weight: 700; }
.tool-library-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.tool-library-toolbar input { width: min(520px, 100%); }
.tool-library-toolbar .muted { font-size: 10px; }
.tool-groups { display: grid; gap: 14px; }
.tool-group { overflow: hidden; }
.tool-group .section-heading { padding-bottom: 12px; }
.tool-group .section-heading h3 { margin: 0; }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 0 14px 14px; }
.tool-card { display: grid; align-content: start; gap: 9px; min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #0c1727; }
.tool-card h3 { margin: 0; font-size: 12px; }
.tool-command { width: fit-content; padding: 3px 7px; border: 1px solid #e8bd6233; border-radius: 5px; background: #e8bd620e; color: var(--accent); font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.tool-card code { display: block; min-height: 32px; overflow-wrap: anywhere; color: #d7dfeb; font-size: 10px; }
.tool-card small { font-size: 9px; }
.tool-card .button { justify-self: start; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

@media (max-width: 1050px) {
  .sidebar { width: 205px; }
  .workspace { margin-left: 205px; padding-right: 20px; padding-left: 20px; }
  .ticket-workspace { grid-template-columns: minmax(270px, 40%) 1fr; }
  .moderation-layout, .absence-layout { grid-template-columns: minmax(240px, .8fr) minmax(0, 1.2fr); }
  .form-grid { gap: 11px; }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: 100%; height: auto; padding: 12px 15px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin: 0 0 12px; }
  .server-label, .sidebar-bottom { display: none; }
  .sidebar select { margin: 0 0 10px; }
  .navigation { grid-template-columns: repeat(2, 1fr); }
  .nav-count { display: none; }
  .workspace { margin-left: 0; padding: 0 12px 28px; }
  .topbar { min-height: 76px; }
  .topbar h1 { font-size: 21px; }
  .metrics { gap: 7px; }
  .metric-card { min-height: 77px; padding: 11px; }
  .metric-card strong { font-size: 20px; }
  .metric-label { font-size: 9px; }
  .metric-foot { font-size: 8px; }
  .ticket-workspace { display: flex; min-height: 0; flex-direction: column; }
  .ticket-list-pane { min-height: 280px; max-height: 42vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .conversation { min-height: 55vh; }
  .empty-state { min-height: 220px; }
  .settings-intro { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .category-editor-layout { grid-template-columns: 1fr; }
  .category-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-form { grid-template-columns: 1fr; }
  .category-form .span-2, .category-form .empty-hint, .category-action-row { grid-column: auto; }
  .category-options { grid-template-columns: 1fr; }
  .publish-section { align-items: stretch; flex-direction: column; }
  .publish-controls { width: 100%; }
  .reply-actions .muted { max-width: 50%; line-height: 1.4; }
  .page-intro { align-items: flex-start; flex-direction: column; padding: 16px; }
  .moderation-layout, .absence-layout { grid-template-columns: 1fr; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .log-panel .section-heading { align-items: flex-start; }
  .log-panel .section-heading select { min-width: 120px; }
  .record-top { align-items: flex-start; }
}
@media (max-width: 480px) {
  .tool-grid { grid-template-columns: 1fr; }
}

.workspace { background: radial-gradient(ellipse at 95% 0, #1a2c431c, transparent 42%); }
.brand strong { letter-spacing: .08em; }
.brand small { color: #c4a767; letter-spacing: .08em; }
.eyebrow { color: #e8bd62; }
.panel, .metric-card { box-shadow: 0 10px 28px #02071125; }
.button.secondary:hover { border-color: #e8bd6255; }
