/* KCD Panel - a dark admin dashboard (txAdmin-like). System fonts only, works offline. */

:root {
  --bg: #18191c;
  --bg-2: #1d1e22;
  --card: #222327;
  --card-2: #2a2b30;
  --hover: #2f3036;
  --border: #303137;
  --border-2: #3b3c43;
  --text: #e4e5e9;
  --text-2: #b9bbc3;
  --muted: #8b8e98;
  --accent: #3fbf6f;
  --accent-2: #2fa45c;
  --accent-bg: rgba(63, 191, 111, .14);
  --danger: #e5534b;
  --danger-bg: rgba(229, 83, 75, .14);
  --warn: #e5b33d;
  --warn-bg: rgba(229, 179, 61, .14);
  --info: #4c9ef0;
  --info-bg: rgba(76, 158, 240, .14);
  --term: #101114;
  --radius: 10px;
  --radius-sm: 7px;
  --topbar: 56px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Cascadia Code", Consolas, "SFMono-Regular", Menlo, "Liberation Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
::selection { background: rgba(76, 158, 240, .35); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: #3a3b42 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #3a3b42; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

.icon { width: 18px; height: 18px; flex: none; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.txt-ok { color: var(--accent); }
.txt-bad { color: var(--danger); }
.txt-warn { color: var(--warn); }
.boot, .noscript { padding: 40px; text-align: center; color: var(--muted); }

/* ------------------------------------------------------------ buttons and inputs */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--card-2); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
a.btn { text-decoration: none; }
.btn:hover { background: var(--hover); border-color: #4a4b53; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #0d1a12; font-weight: 600; }
.btn-primary:hover { background: #4fcd7d; border-color: #4fcd7d; }
.btn-ok { color: var(--accent); border-color: rgba(63, 191, 111, .45); background: var(--accent-bg); }
.btn-ok:hover { background: rgba(63, 191, 111, .24); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn-danger:hover { background: #ef6a62; border-color: #ef6a62; }
.btn-warn { color: var(--warn); border-color: rgba(229, 179, 61, .45); background: var(--warn-bg); }
.btn-warn:hover { background: rgba(229, 179, 61, .24); }
.btn-danger-ghost { color: var(--danger); background: transparent; border-color: rgba(229, 83, 75, .4); }
.btn-danger-ghost:hover { background: var(--danger-bg); }
.btn-on { background: var(--info-bg); border-color: rgba(76, 158, 240, .5); color: var(--info); }
.btn-discord { background: #5865f2; border-color: #5865f2; color: #fff; height: 42px; font-weight: 600; font-size: 15px; }
.btn-discord:hover { background: #6d78f5; border-color: #6d78f5; text-decoration: none; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer;
}
.btn-icon:hover { background: var(--hover); color: var(--text); }
.link {
  background: none; border: 0; padding: 0; font: inherit; color: var(--info); cursor: pointer; text-align: left;
}
.link:hover { text-decoration: underline; }

.input, textarea, select {
  width: 100%; min-height: 34px; padding: 6px 10px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--bg-2); color: var(--text); font: inherit;
}
textarea { resize: vertical; min-height: 60px; line-height: 1.4; }
.input:focus, textarea:focus, select:focus { outline: none; border-color: var(--info); box-shadow: 0 0 0 3px rgba(76, 158, 240, .18); }
.input:disabled { opacity: .6; }
.input-sm { min-height: 28px; padding: 3px 8px; font-size: 13px; }
input[type="datetime-local"] { color-scheme: dark; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; flex: none; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field-label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; }
.field-hint { font-size: 12px; color: var(--muted); }
.form-error { color: var(--danger); font-size: 13px; min-height: 0; }
.form-error:empty { display: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }

.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; padding: 6px 8px; border-radius: var(--radius-sm); }
.check:hover { background: var(--hover); }
.check > span { display: flex; flex-direction: column; }
.check input { margin-top: 2px; }
.check-danger > span > span:first-child { color: #ff7b73; }
.perm-key { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.kbd {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; white-space: nowrap;
}

/* ------------------------------------------------------------ badges */

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; white-space: nowrap;
  background: var(--card-2); color: var(--text-2); border: 1px solid var(--border-2);
}
.badge-ok { background: var(--accent-bg); color: var(--accent); border-color: rgba(63, 191, 111, .4); }
.badge-bad { background: var(--danger-bg); color: #ff7b73; border-color: rgba(229, 83, 75, .4); }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(229, 179, 61, .4); }
.badge-off { background: rgba(139, 142, 152, .12); color: var(--muted); border-color: var(--border-2); }
.badge-ok::before, .badge-bad::before, .badge-warn::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; }
.dot-ok { background: var(--accent); box-shadow: 0 0 6px rgba(63, 191, 111, .7); }
.dot-off { background: #4a4c55; }

/* ------------------------------------------------------------ login */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(ellipse at top, #22252b 0%, var(--bg) 60%); }
.login-card {
  width: 100%; max-width: 380px; padding: 34px 30px 28px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
}
.login-card h1 { font-size: 24px; }
.login-card > p { margin: -8px 0 6px; }
.login-card-wide { max-width: 520px; }
.login-form { width: 100%; display: flex; flex-direction: column; gap: 12px; text-align: left; margin-top: 4px; }
.login-form .btn-block { margin-top: 4px; height: 38px; }
.login-or { width: 100%; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.login-or::before, .login-or::after { content: ""; flex: 1; border-top: 1px solid var(--border-2); }
.setup-info { width: 100%; text-align: left; font-size: 13.5px; color: var(--text-2); background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 14px; }
.setup-info p { margin: 10px 0; }
.setup-code { font-size: 20px; letter-spacing: .12em; text-align: center; height: 44px; }
.form-grid-tight { margin-bottom: 0; gap: 12px; }
code { font-family: var(--mono); font-size: .9em; background: var(--card-2); border: 1px solid var(--border-2); border-radius: 4px; padding: 0 4px; color: var(--text); }
.alert { width: 100%; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; text-align: left; }
.alert-bad { background: var(--danger-bg); color: #ff8f88; border: 1px solid rgba(229, 83, 75, .35); }
.alert-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid rgba(229, 179, 61, .35); }

.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #102016; flex: none; }
.logo .icon { width: 18px; height: 18px; stroke-width: 2.4; fill: rgba(16, 32, 22, .25); }
.logo-big { width: 60px; height: 60px; border-radius: 16px; }
.logo-big .icon { width: 32px; height: 32px; }

/* ------------------------------------------------------------ shell */

.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar); flex: none;
  display: flex; align-items: center; gap: 18px; padding: 0 16px;
  background: #1c1d21; border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; flex: none; }
.brand:hover { text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 15px; }
.brand-server { font-size: 12px; color: var(--muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabs { flex: 1; display: flex; justify-content: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  height: var(--topbar); display: inline-flex; align-items: center; padding: 0 14px;
  color: var(--text-2); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); text-decoration: none; background: rgba(255, 255, 255, .03); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.topbar-right { display: flex; align-items: center; gap: 14px; flex: none; }
.conn { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn-open { background: var(--accent); box-shadow: 0 0 6px rgba(63, 191, 111, .8); }
.conn-connecting, .conn-reconnecting { background: var(--warn); animation: blink 1s infinite; }
.conn-closed { background: var(--danger); }
@keyframes blink { 50% { opacity: .35; } }
.user { position: relative; padding-left: 14px; border-left: 1px solid var(--border); }
.user-btn {
  display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 4px; border: 1px solid transparent; border-radius: 999px;
  background: transparent; color: var(--text); font: inherit; cursor: pointer; text-align: left;
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--hover); border-color: var(--border-2); }
.user-chev { width: 14px; height: 14px; color: var(--muted); transform: rotate(90deg); }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 190px; padding: 6px;
  background: #2a2b31; border: 1px solid var(--border-2); border-radius: var(--radius-sm); box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  display: flex; flex-direction: column; gap: 2px;
}
.user-menu button {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.user-menu button:hover, .user-menu button:focus-visible { background: var(--hover); }
.user-menu button .icon { width: 16px; height: 16px; color: var(--muted); }
.user-menu .danger, .user-menu .danger .icon { color: #ff7b73; }
.user-text { display: flex; flex-direction: column; line-height: 1.15; }
.user-name { font-weight: 600; font-size: 13px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--muted); }

.avatar {
  position: relative; display: inline-grid; place-items: center; overflow: hidden; flex: none;
  width: 34px; height: 34px; border-radius: 50%; background: #3a3d6b; color: #dfe1ff; font-weight: 700; font-size: 13px;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }

/* three columns: each scrolls on its own on wide screens */
.cols {
  flex: none; display: grid; gap: 16px; padding: 16px;
  grid-template-columns: 300px minmax(0, 1fr) 360px;
  grid-template-rows: minmax(0, 1fr);
  height: calc(100vh - var(--topbar));
}
.cols.no-right { grid-template-columns: 300px minmax(0, 1fr); }
.col-left, .col-right, .col-main { min-height: 0; overflow-y: auto; }
.col-left, .col-right { display: flex; flex-direction: column; gap: 16px; }
.col-main { display: flex; flex-direction: column; gap: 16px; padding-right: 2px; outline: none; }
.col-right .players-card { flex: 1; min-height: 0; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px;
}
.card-flush { padding: 0; overflow: hidden; }
.card-title { font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head .card-title { margin-bottom: 0; }

/* left column */
.side-pages { padding: 0; overflow: hidden; }
.side-server { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); }
.side-server > .icon { width: 36px; height: 36px; padding: 8px; border-radius: 9px; background: var(--accent-bg); color: var(--accent); }
.side-server-name { font-weight: 700; font-size: 15px; word-break: break-word; }
.side-server-sub { font-size: 12px; color: var(--muted); }
.side-nav { display: flex; flex-direction: column; padding: 8px; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
}
.side-link:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.side-link.active { background: var(--accent-bg); color: var(--accent); }

.ctl-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.ctl-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-2); background: var(--card-2);
  color: var(--text-2); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.ctl-btn .icon { width: 20px; height: 20px; }
.ctl-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.ctl-btn:disabled { opacity: .35; cursor: not-allowed; }
.ctl-stop:not(:disabled) { color: #ff7b73; border-color: rgba(229, 83, 75, .4); }
.ctl-stop:not(:disabled):hover { background: var(--danger-bg); }
.ctl-restart:not(:disabled) { color: var(--warn); border-color: rgba(229, 179, 61, .4); }
.ctl-restart:not(:disabled):hover { background: var(--warn-bg); }
.ctl-start:not(:disabled) { color: var(--accent); border-color: rgba(63, 191, 111, .4); }
.ctl-start:not(:disabled):hover { background: var(--accent-bg); }
.btn-announce { margin-bottom: 14px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; align-items: center; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; text-align: right; font-weight: 500; min-width: 0; word-break: break-word; }
.kv-wide { grid-template-columns: 170px 1fr; }
.kv-wide dd { text-align: left; }

/* right column - online players */
.players-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.count-box { padding: 18px 16px 12px; text-align: center; border-bottom: 1px solid var(--border); }
.count-big { font-size: 46px; font-weight: 700; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.count-label { color: var(--muted); font-size: 13px; margin-top: 4px; text-transform: uppercase; letter-spacing: .06em; }
.search-box {
  display: flex; align-items: center; gap: 8px; margin: 12px; padding: 0 10px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--bg-2);
}
.search-box:focus-within { border-color: var(--info); box-shadow: 0 0 0 3px rgba(76, 158, 240, .18); }
.search-box > .icon { width: 16px; height: 16px; color: var(--muted); }
.search-box .input { border: 0; background: transparent; padding-left: 0; box-shadow: none; }
.search-inline { margin: 0; flex: 1; min-width: 280px; max-width: 420px; }
.plist { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; flex: 1; min-height: 0; }
.plist .empty { padding: 26px 10px; }
.prow {
  width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
.prow:hover { background: var(--hover); }
.prow-id { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 34px; }
.prow-names { display: flex; flex-direction: column; min-width: 0; }
.prow-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.prow-char { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-ping { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.admin-tag { font-size: 10px; font-weight: 800; color: var(--warn); border: 1px solid rgba(229, 179, 61, .5); border-radius: 4px; padding: 0 4px; line-height: 15px; }

.empty { color: var(--muted); text-align: center; padding: 22px 10px; }

/* ------------------------------------------------------------ pages */

.page-head h1 { font-size: 22px; }
.page-head p { margin: 4px 0 0; }
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar > .field { min-width: 180px; }
.toolbar-btns { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.f-grow { flex: 1; min-width: 200px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; border-top: 3px solid var(--border-2); }
.tile-head { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.tile-head .icon { width: 15px; height: 15px; }
.tile-val { font-size: 24px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-ok { border-top-color: var(--accent); } .tile-ok .tile-val { color: var(--accent); }
.tile-bad { border-top-color: var(--danger); } .tile-bad .tile-val { color: #ff7b73; }
.tile-warn { border-top-color: var(--warn); } .tile-warn .tile-val { color: var(--warn); }
.tile-off .tile-val { color: var(--muted); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -16px -16px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  font-weight: 700; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg-2); white-space: nowrap;
}
.table td { padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, .02); }
.table-click tbody tr { cursor: pointer; }
.table-click tbody tr:hover td { background: var(--hover); }
.table .actions { text-align: right; white-space: nowrap; }
.table .empty { padding: 30px 10px; }
.row-dim td { opacity: .55; }
.row-master td { background: rgba(63, 191, 111, .04); }
.row-btns { display: inline-flex; gap: 6px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 28px; }
.dlg .table-wrap { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }

.admin-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.admin-name .icon { width: 16px; height: 16px; color: var(--muted); }
.row-master .admin-name .icon { color: var(--accent); }
.perms { display: flex; flex-wrap: wrap; gap: 5px; }
.perm { font-size: 11.5px; padding: 2px 8px; border-radius: 5px; background: var(--card-2); border: 1px solid var(--border-2); color: var(--text-2); white-space: nowrap; }
.perm-danger { color: #ff8f88; border-color: rgba(229, 83, 75, .35); background: var(--danger-bg); }

/* ------------------------------------------------------------ logs */

.cat {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; white-space: nowrap;
  background: rgba(139, 142, 152, .14); color: var(--text-2); text-align: center; min-width: 74px;
  --c: 139, 142, 152;
  background: rgba(var(--c), .15); color: rgb(var(--c)); border: 1px solid rgba(var(--c), .3);
}
.cat-connect { --c: 76, 158, 240; }
.cat-chat { --c: 160, 170, 190; }
.cat-command { --c: 140, 150, 235; }
.cat-admin { --c: 229, 179, 61; }
.cat-death { --c: 235, 95, 85; }
.cat-money { --c: 220, 200, 80; }
.cat-item { --c: 80, 200, 190; }
.cat-property { --c: 200, 140, 90; }
.cat-faction { --c: 190, 120, 230; }
.cat-job { --c: 110, 190, 120; }
.cat-work { --c: 140, 200, 90; }
.cat-crime { --c: 240, 110, 160; }
.cat-system { --c: 150, 150, 160; }
.cat-panel { --c: 63, 191, 111; }

.log-list { display: flex; flex-direction: column; }
.log-row {
  display: grid; grid-template-columns: 140px 92px 170px minmax(0, 1fr); gap: 4px 12px; align-items: baseline;
  padding: 8px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.card:not(.card-flush) > .log-list .log-row { padding-left: 0; padding-right: 0; }
.log-row:last-child { border-bottom: 0; }
.log-row:hover { background: rgba(255, 255, 255, .02); }
.log-time { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.log-player { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.log-text { word-break: break-word; }
.log-data-btn {
  margin-left: 8px; font-family: var(--mono); font-size: 11px; padding: 0 6px; height: 18px; vertical-align: 1px;
  border: 1px solid var(--border-2); border-radius: 4px; background: var(--card-2); color: var(--muted); cursor: pointer;
}
.log-data-btn:hover, .log-data-btn.on { color: var(--info); border-color: rgba(76, 158, 240, .5); }
.log-data {
  grid-column: 1 / -1; margin: 4px 0 2px; padding: 10px 12px; background: var(--term); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font: 12px/1.45 var(--mono); color: #c9d1d9; overflow-x: auto; white-space: pre;
}
.log-compact { grid-template-columns: 74px 92px 150px minmax(0, 1fr); padding: 6px 0; }
.log-new { animation: flash 2s ease-out; }
@keyframes flash { from { background: rgba(63, 191, 111, .16); } to { background: transparent; } }
.pw-panel .log-row { grid-template-columns: 140px 92px minmax(0, 1fr); padding: 7px 0; }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; background: var(--bg-2); border-bottom: 1px solid var(--border); }
.log-head { flex: 1; display: grid; grid-template-columns: 140px 92px 170px minmax(0, 1fr); gap: 12px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.list-foot { padding: 12px 16px; }
.list-foot:has(> [hidden]:only-child) { display: none; }
.new-pill {
  position: sticky; top: 8px; z-index: 5; display: block; margin: 8px auto -36px; height: 28px; padding: 0 14px;
  border-radius: 999px; border: 0; background: var(--info); color: #08182b; font: inherit; font-weight: 700; font-size: 12.5px;
  cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
}

.filters { display: flex; flex-direction: column; gap: 14px; }
.filters-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filters-row > .field { width: 190px; }
.filters-row > .f-grow { flex: 1; min-width: 200px; }
.filters-btns { display: flex; gap: 8px; }
.cat-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.cat-chips .field-label { margin-right: 6px; }
.chip-btn {
  height: 26px; padding: 0 10px; border-radius: 999px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--text-2); border: 1px solid var(--border-2);
  --c: 139, 142, 152;
}
.chip-btn:hover { border-color: rgba(var(--c), .7); color: var(--text); }
.chip-btn.on { background: rgba(var(--c), .2); border-color: rgba(var(--c), .7); color: rgb(var(--c)); }
.chip-all.on { --c: 228, 229, 233; }

/* ------------------------------------------------------------ console */

.page-konzole { overflow: hidden; }
.term-box {
  flex: 1; min-height: 320px; display: flex; flex-direction: column;
  background: var(--term); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.term {
  flex: 1; min-height: 0; overflow-y: auto; padding: 10px 14px;
  font: 12.5px/1.55 var(--mono); color: #c9ccd3; white-space: pre-wrap; word-break: break-word;
}
.term:focus-visible { outline-offset: -2px; }
.cl { padding: 0 2px; border-radius: 3px; }
.cl:hover { background: rgba(255, 255, 255, .03); }
.cl-ts { color: #6b6f7a; }
.cl-src { color: #7a7f8c; }
.cl-lvl-info { color: #5fb7f5; }
.cl-lvl-debug, .cl-lvl-trace { color: #8a8f99; }
.cl-lvl-warn { color: var(--warn); font-weight: 600; }
.cl-lvl-error { color: #ff6b62; font-weight: 600; }
.cl-lua { color: #c792ea; font-weight: 600; }
.cl-is-lua .cl-msg { color: #e3d7f3; }
.cl-warn .cl-msg { color: #f2d48a; }
.cl-error { background: rgba(229, 83, 75, .08); }
.cl-error .cl-msg { color: #ff9a93; }
.cl-echo { color: var(--accent); }
.cl-panel { color: #7fd6a0; }
.cl-empty { color: var(--muted); font-style: italic; }
.term-search { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #17181c; border-bottom: 1px solid var(--border); }
.term-search .icon { width: 15px; height: 15px; color: var(--muted); }
.term-search .input { max-width: 340px; }
.term-cmd { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border-top: 1px solid var(--border); background: #15161a; }
.term-prompt { font-family: var(--mono); color: var(--accent); font-weight: 700; }
.term-input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: 13px var(--mono); padding: 6px 0; }
.term-input:focus { outline: none; }

/* ------------------------------------------------------------ dialogs */

.dlg {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  background: var(--card); color: var(--text); border: 1px solid var(--border-2); border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.dlg[open] { display: flex; flex-direction: column; animation: pop .14s ease-out; }
@keyframes pop { from { transform: translateY(6px) scale(.985); opacity: 0; } }
.dlg::backdrop { background: rgba(5, 6, 8, .66); backdrop-filter: blur(2px); }
.dlg-wide { width: min(880px, calc(100vw - 32px)); }
.dlg-small { width: min(420px, calc(100vw - 32px)); }
.dlg-admin { width: min(640px, calc(100vw - 32px)); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--border); }
.dlg-title { font-size: 16px; display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.dlg-body { padding: 18px 20px; overflow-y: auto; flex: 1; min-height: 0; }
.dlg-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg-2); }
.dlg-footer:empty { display: none; }
.confirm-text { margin: 0; font-size: 14.5px; line-height: 1.55; word-break: break-word; }
.dlg .field + .field, .dlg .field + .field-hint { margin-top: 12px; }
.dlg .form-grid .field + .field { margin-top: 0; }

.perm-set { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 10px 6px; margin: 0 0 8px; }
.perm-set legend { padding: 0 6px; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; }
.check-all { border-bottom: 1px solid var(--border); border-radius: var(--radius-sm) var(--radius-sm) 0 0; margin-bottom: 6px; padding-bottom: 10px; font-weight: 600; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.perm-set .field-hint { margin: 8px 6px 4px; }
.perm-set .alert { margin: 4px 0 8px; }
.perm-set-locked .check { cursor: default; opacity: .6; }
.perm-set-locked .check:hover { background: none; }
.note { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 12px 14px; border-radius: var(--radius); background: var(--info-bg); border: 1px solid rgba(76, 158, 240, .3); color: #b9d8fa; font-size: 13.5px; }
.note .icon { color: var(--info); margin-top: 1px; }

/* player window */
.dlg-player .dlg-body { padding-top: 0; }
.dlg-title .icon { color: var(--muted); }
.pw-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pw-sub { font-size: 13px; font-weight: 400; }
.pw-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 -20px 16px; padding: 0 14px; position: sticky; top: 0; background: var(--card); z-index: 2; }
.pw-tab {
  height: 42px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--text-2); font: inherit; font-weight: 600; cursor: pointer;
}
.pw-tab:hover { color: var(--text); }
.pw-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.pw-panel { min-height: 320px; }
.pw-panel .toolbar .field { flex: 1; }
.sub-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 10px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--border-2); font-size: 12.5px; }
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hp { display: inline-flex; align-items: center; gap: 8px; }
.hp-bar { width: 120px; height: 7px; border-radius: 9px; background: var(--card-2); overflow: hidden; }
.hp-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #d0453d, #3fbf6f); }

.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.act { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg-2); }
.act h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.act-danger { border-color: rgba(229, 83, 75, .35); }
.act-danger h4 { color: #ff7b73; }
.act-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.act .field + .field { margin-top: 0; }
.segs { display: flex; flex-wrap: wrap; gap: 4px; }
.seg {
  height: 28px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--border-2); background: var(--card-2);
  color: var(--text-2); font: inherit; font-size: 12.5px; cursor: pointer;
}
.seg:hover { color: var(--text); }
.seg.active { background: var(--danger-bg); border-color: rgba(229, 83, 75, .6); color: #ff8f88; font-weight: 600; }

/* ------------------------------------------------------------ toasts */

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: min(400px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 10px 11px 14px;
  background: #2a2b31; border: 1px solid var(--border-2); border-left: 4px solid var(--info); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: slide .18s ease-out; transition: opacity .3s, transform .3s;
}
.toast-text { flex: 1; word-break: break-word; }
.toast-success { border-left-color: var(--accent); }
.toast-error { border-left-color: var(--danger); }
.toast-warn { border-left-color: var(--warn); }
.toast-close { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; display: grid; }
.toast-close .icon { width: 15px; height: 15px; }
.toast-out { opacity: 0; transform: translateX(16px); }
@keyframes slide { from { transform: translateX(20px); opacity: 0; } }
/* the toasts are a manual popover (top layer, above modal dialogs) */
.toasts[popover] { inset: auto 16px 16px auto; margin: 0; padding: 0; border: 0; background: transparent; color: inherit; overflow: visible; }
.toasts:not(:popover-open) { display: flex; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1500px) {
  .cols { grid-template-columns: 260px minmax(0, 1fr) 320px; }
  .cols.no-right { grid-template-columns: 260px minmax(0, 1fr); }
  .log-row, .log-head { grid-template-columns: 130px 92px 140px minmax(0, 1fr); }
}

/* Medium: the players move below the page, the window scrolls as a whole. */
@media (max-width: 1200px) {
  .cols {
    flex: 1 0 auto; height: auto; grid-template-columns: 250px minmax(0, 1fr); grid-template-rows: auto;
    grid-template-areas: "left main" "left right";
    align-items: start;
  }
  .col-left { grid-area: left; position: sticky; top: calc(var(--topbar) + 16px); max-height: calc(100vh - var(--topbar) - 32px); }
  .col-main { grid-area: main; overflow: visible; }
  .col-right { grid-area: right; overflow: visible; }
  .col-right .players-card { flex: none; }
  .plist { max-height: 420px; }
  .page-konzole .term-box { height: calc(100vh - var(--topbar) - 150px); }
  .user-text { display: none; }
  .brand-server { display: none; }
}

/* Narrow: one column - the server card, the page, the players. */
@media (max-width: 900px) {
  .cols { grid-template-columns: minmax(0, 1fr); grid-template-areas: "left" "main" "right"; padding: 12px 12px; gap: 12px; }
  .col-left { position: static; max-height: none; overflow: visible; }
  .side-pages { display: none; }
  .control-card .kv { grid-template-columns: auto 1fr auto 1fr; }
  .control-card .kv dd { text-align: left; }
  .topbar { gap: 10px; padding: 0 12px; }
  .tabs { justify-content: flex-start; }
  .tab { padding: 0 10px; }
  .conn-text { display: none; }
  .user { padding-left: 10px; }
  .log-row { grid-template-columns: auto auto minmax(0, 1fr); }
  .log-row .log-text { grid-column: 1 / -1; }
  .log-compact { grid-template-columns: auto auto minmax(0, 1fr); }
  .log-head { display: none; }
  .pw-panel .log-row { grid-template-columns: auto minmax(0, 1fr); }
  .acts { grid-template-columns: 1fr; }
  .kv-wide { grid-template-columns: 130px 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .perm-grid { grid-template-columns: 1fr; }
  .filters-row > .field { width: calc(50% - 6px); }
  .search-inline { min-width: 0; }
  .page-konzole .term-box { height: 65vh; }
}

@media (max-width: 560px) {
  .brand-text { display: none; }
  .control-card .kv { grid-template-columns: auto 1fr; }
  .filters-row > .field { width: 100%; }
  .tiles { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------ language switch */

.lang-switch { display: inline-flex; border: 1px solid var(--border-2); border-radius: 7px; overflow: hidden; flex: none; }
.lang-btn {
  height: 26px; padding: 0 8px; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; cursor: pointer;
}
.lang-btn + .lang-btn { border-left: 1px solid var(--border-2); }
.lang-btn:hover { color: var(--text); background: var(--hover); }
.lang-btn.active { background: var(--accent-bg); color: var(--accent); }
.login-card { position: relative; }
.login-lang { position: absolute; top: 14px; right: 14px; }

.stack { display: flex; flex-direction: column; gap: 12px; }
label.field { cursor: default; }

/* ------------------------------------------------------------ game permissions and roles */

.badge-info { background: var(--info-bg); color: var(--info); border-color: rgba(76, 158, 240, .4); }
.role-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(0, 0, 0, .25); }
.role-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.role-chip { display: inline-flex; align-items: center; gap: 6px; }
.role-checks { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.role-check { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.perm-groups { display: flex; flex-direction: column; gap: 10px; }
.perm-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 8px 4px; background: var(--bg-2); }
.perm-group-head { font-size: 12px; font-weight: 700; color: var(--text-2); padding: 2px 6px 4px; }
.color-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.color-input { width: 40px; height: 32px; padding: 2px; border: 1px solid var(--border-2); border-radius: 6px; background: var(--bg-2); cursor: pointer; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--text); }
.add-perm { margin-top: 14px; padding-top: 6px; border-top: 1px solid var(--border); }
.add-perm .filters-row > .field { width: 220px; }
.add-perm .filters-row > .f-grow { width: auto; }
.pp-save { margin: 14px 0 4px; }
.pw-panel .note { margin-bottom: 12px; }

@media (max-width: 900px) {
  .add-perm .filters-row > .field { width: 100%; }
}
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.check > span.role-name { flex-direction: row; display: inline-flex; }
.dlg:focus { outline: none; }
.dlg .stack > .field + .field, .stack > .field + .field { margin-top: 0; }
