/* Rust Server Dashboard – Fluent-ähnliches Design, dunkel und hell */
:root {
  --accent: #e8603c;
  --accent-hover: #f0714e;
  --accent-text: #fff;
  --bg: #1c1c1c;
  --bg-2: #202020;
  --card: #2b2b2b;
  --card-2: #323232;
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-2: rgba(255, 255, 255, 0.14);
  --text: #f3f3f3;
  --text-2: #b4b4b4;
  --text-3: #8a8a8a;
  --ok: #6ccb5f;
  --warn: #fcb046;
  --err: #ff6b5b;
  --info: #60a5fa;
  --input: #2f2f2f;
  --console: #141414;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --radius: 8px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f3f3; --bg-2: #ebebeb; --card: #fbfbfb; --card-2: #f5f5f5;
    --stroke: rgba(0, 0, 0, 0.08); --stroke-2: rgba(0, 0, 0, 0.14);
    --text: #1b1b1b; --text-2: #5d5d5d; --text-3: #8a8a8a; --input: #fff; --console: #1e1e1e;
    --ok: #0f7b0f; --warn: #9d5d00; --err: #c42b1c; --info: #005fb8;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.12); color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f3f3f3; --bg-2: #ebebeb; --card: #fbfbfb; --card-2: #f5f5f5;
  --stroke: rgba(0, 0, 0, 0.08); --stroke-2: rgba(0, 0, 0, 0.14);
  --text: #1b1b1b; --text-2: #5d5d5d; --text-3: #8a8a8a; --input: #fff; --console: #1e1e1e;
  --ok: #0f7b0f; --warn: #9d5d00; --err: #c42b1c; --info: #005fb8;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.12); color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
code, .mono { font-family: "Cascadia Code", "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace; font-size: 12.5px; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 16px; }
hr { border: 0; border-top: 1px solid var(--stroke); margin: 16px 0; }

/* ---------------------------------------------------------------- Rahmen */
.shell { display: flex; height: 100vh; }
.sidebar {
  width: 248px; flex: none; background: var(--bg-2); border-right: 1px solid var(--stroke);
  display: flex; flex-direction: column; padding: 14px 10px; gap: 8px; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.brand-title { font-weight: 600; }
.brand-sub { font-size: 12px; color: var(--text-2); max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 6px; color: var(--text);
  text-decoration: none; position: relative; cursor: pointer; user-select: none;
}
.nav-item:hover { background: var(--stroke); }
.nav-item.active { background: var(--stroke-2); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--accent);
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.sidebar-foot { border-top: 1px solid var(--stroke); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--card-2); flex: none; object-fit: cover;
  display: grid; place-items: center; font-weight: 600; color: var(--text-2); }
.me-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.me-role { font-size: 12px; color: var(--text-2); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 18px 32px 10px; }
.topbar h1 { font-size: 26px; font-weight: 600; flex: 1; }
.topbar .menu-btn { display: none; }
.content { flex: 1; overflow-y: auto; padding: 8px 32px 40px; }
.backdrop { display: none; }

/* ---------------------------------------------------------------- Bausteine */
.card { background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 18px 20px; }
.card + .card, .card + .grid, .grid + .card, .grid + .grid, .section + .card { margin-top: 12px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { flex: 1; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.section { font-weight: 600; margin: 22px 2px 8px; color: var(--text); }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.row-flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 32px; padding: 0 14px;
  border-radius: 6px; border: 1px solid var(--stroke-2); background: var(--card-2); color: var(--text);
  font: inherit; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .1s;
}
.btn:hover:not(:disabled) { background: var(--stroke-2); }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.btn-accent { background: var(--accent); border-color: transparent; color: var(--accent-text); }
.btn-accent:hover:not(:disabled) { background: var(--accent-hover); }
.btn-danger { color: var(--err); }
.btn-danger-solid { background: var(--err); border-color: transparent; color: #fff; }
.btn-subtle { background: transparent; border-color: transparent; }
.btn-subtle:hover:not(:disabled) { background: var(--stroke); }
.btn-icon { width: 32px; padding: 0; }
.btn-block { width: 100%; }
.btn-discord { background: #5865f2; border-color: transparent; color: #fff; height: 42px; padding: 0 20px; font-weight: 600; }
.btn-discord:hover { background: #4752c4 !important; }

input[type=text], input[type=number], input[type=password], input[type=time], select, textarea {
  background: var(--input); color: var(--text); border: 1px solid var(--stroke-2); border-bottom-color: var(--text-3);
  border-radius: 6px; padding: 6px 10px; font: inherit; min-height: 32px; outline: none; width: 100%;
}
textarea { resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { border-bottom: 2px solid var(--accent); padding-bottom: 5px; }
input.invalid, textarea.invalid { border-color: var(--err) !important; }
select { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px; background-size: 5px 5px; background-repeat: no-repeat; }
label.field { display: flex; flex-direction: column; gap: 6px; }
label.field > span { font-size: 12.5px; color: var(--text-2); }

/* Einstellungszeile wie in Windows 11 */
.setting {
  display: flex; align-items: center; gap: 16px; padding: 12px 16px; background: var(--card); border: 1px solid var(--stroke);
  border-radius: var(--radius); margin-bottom: 4px;
}
.setting .label { flex: 1; min-width: 0; }
.setting .label .t { font-weight: 500; }
.setting .label .d { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.setting .ctl { flex: none; display: flex; align-items: center; gap: 8px; }
.setting .ctl input[type=text], .setting .ctl input[type=number], .setting .ctl select { width: 260px; }
.setting .ctl input.w-s { width: 120px; }
.setting .ctl textarea { width: 380px; }
.err-text { color: var(--err); font-size: 12px; margin-top: 4px; }

/* Schalter */
.switch { position: relative; display: inline-block; width: 40px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 20px; border: 1px solid var(--text-2); cursor: pointer; transition: .15s; }
.switch span::after { content: ""; position: absolute; width: 12px; height: 12px; left: 3px; top: 3px; border-radius: 50%; background: var(--text-2); transition: .15s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { left: 23px; background: #fff; }
.switch input:disabled + span { opacity: .5; cursor: default; }

/* Status */
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 99px; background: var(--card); border: 1px solid var(--stroke); font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); }
.st-online .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.st-starting .dot, .st-stopping .dot, .st-busy .dot { background: var(--warn); animation: pulse 1.2s infinite; }
.st-stopped .dot { background: var(--text-3); }
@keyframes pulse { 50% { opacity: .35; } }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--stroke-2); color: var(--text-2); }
.badge-admin { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.badge-mod { background: color-mix(in srgb, var(--info) 22%, transparent); color: var(--info); }
.badge-ok { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.badge-off { background: var(--stroke); color: var(--text-3); }

.hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.hero-icon { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: var(--card-2); flex: none; }
.hero-icon svg { width: 28px; height: 28px; }
.st-online .hero-icon { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.st-starting .hero-icon, .st-stopping .hero-icon, .st-busy .hero-icon { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.hero-text { flex: 1; min-width: 220px; }
.hero-title { font-size: 20px; font-weight: 600; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stat { background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.stat .k { font-size: 12px; color: var(--text-2); }
.stat .v { font-size: 20px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .s { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.bar { height: 4px; border-radius: 4px; background: var(--stroke-2); overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s; }
.bar.indeterminate > i { width: 30% !important; animation: indet 1.2s infinite ease-in-out; }
@keyframes indet { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }
.connect { display: inline-flex; align-items: center; gap: 6px; background: var(--card-2); border: 1px solid var(--stroke); border-radius: 6px; padding: 3px 4px 3px 10px; margin-top: 6px; }

/* Konsole */
.console {
  background: var(--console); color: #d6d6d6; border-radius: var(--radius); border: 1px solid var(--stroke);
  font-family: "Cascadia Code", "Cascadia Mono", Consolas, Menlo, monospace; font-size: 12.5px; line-height: 1.5;
  padding: 10px 12px; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
}
.console .l-error { color: #ff7b72; }
.console .l-warn { color: #e3b341; }
.console .l-manager { color: #79c0ff; }
.console .l-chat { color: #7ee787; }
.console .l-cmd { color: #f0883e; }
.console .l-reply { color: #c9d1d9; }
.console .l-steam { color: #a5a5a5; }
.console .ts { color: #6e7681; margin-right: 8px; user-select: none; }
.console-page { display: flex; flex-direction: column; height: calc(100vh - 110px); gap: 10px; }
.console-page .console { flex: 1; min-height: 200px; }

/* Tabellen & Listen */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-weight: 500; font-size: 12px; color: var(--text-2); padding: 8px 10px; border-bottom: 1px solid var(--stroke); }
table.list td { padding: 9px 10px; border-bottom: 1px solid var(--stroke); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr:hover td { background: color-mix(in srgb, var(--stroke) 50%, transparent); }
.actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.empty { text-align: center; color: var(--text-2); padding: 28px 10px; }
.plugin { display: flex; gap: 14px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--stroke); }
.plugin:last-child { border-bottom: 0; }
.plugin.off .plugin-main { opacity: .55; }
.plugin-main { flex: 1; min-width: 0; }
.plugin-title { font-weight: 600; }
.plugin-desc { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.plugin-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.dropzone { border: 2px dashed var(--stroke-2); border-radius: var(--radius); padding: 16px; text-align: center; color: var(--text-2); }
.dropzone.drag { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--stroke); margin-bottom: 14px; }
.tab { padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--text-2); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* Editor */
.ed-section { margin: 20px 2px 8px; }
.ed-section .t { font-weight: 600; }
.ed-section .d { font-size: 12px; color: var(--text-2); }
.ed-card { background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius); margin-bottom: 6px; }
.ed-card-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; }
.ed-card-head .name { flex: 1; font-weight: 600; cursor: pointer; padding: 4px 6px; user-select: none; }
.ed-card-head .name::before { content: "›"; display: inline-block; width: 14px; transition: transform .15s; }
.ed-card.open .ed-card-head .name::before { transform: rotate(90deg); }
.ed-card-body { padding: 4px 12px 10px; display: none; }
.ed-card.open .ed-card-body { display: block; }
.ed-item { display: flex; gap: 10px; background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 6px; }
.ed-item-fields { flex: 1; display: flex; flex-wrap: wrap; gap: 10px 14px; }
.ed-item-fields label.field { min-width: 120px; }
.ed-item-fields label.field input[type=text] { width: 190px; }
.ed-item-fields label.field input.num { width: 110px; }
/* Item- und Skin-Auswahl */
.pick-field { display: inline-flex; align-items: center; gap: 10px; min-width: 260px; max-width: 100%; height: 40px; padding: 4px 12px 4px 4px;
  border-radius: 6px; border: 1px solid var(--stroke-2); background: var(--input); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.pick-field:hover { border-color: var(--accent); }
.pick-field.compact { height: 36px; min-width: 220px; }
.pick-img { width: 32px; height: 32px; display: grid; place-items: center; background: var(--card-2); border-radius: 4px; flex: none; overflow: hidden; }
.pick-field.compact .pick-img { width: 28px; height: 28px; }
.pick-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-img { object-fit: contain; display: block; }
label.field.field-wide { min-width: 240px; }
.modal.modal-wide { width: min(980px, 100%); }
.modal-wide .modal-body { max-height: 75vh; display: flex; flex-direction: column; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; overflow-y: auto; padding: 2px; margin-top: 8px; min-height: 200px; }
.pick-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 8px; border-radius: 8px; border: 1px solid var(--stroke);
  background: var(--card-2); color: var(--text); font: inherit; cursor: pointer; text-align: center; min-width: 0; }
.pick-tile:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card-2)); }
.pick-tile.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.pick-name { font-size: 12.5px; font-weight: 600; line-height: 1.25; max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pick-sub { font-size: 11px; color: var(--text-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px 12px; }
.ed-num { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 10px; border-radius: 6px;
  background: var(--card-2); border: 1px solid var(--stroke); }
.ed-num span { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-num input { width: 64px !important; text-align: right; flex: none; }
.ed-num.ed-num-on { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.ed-num.ed-num-on span { color: var(--text); font-weight: 600; }
.ed-bar { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 4px 0 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ed-msg { text-align: center; padding: 36px 20px; }

/* Toasts & Dialoge */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(380px, calc(100vw - 40px)); }
.toast { background: var(--card); border: 1px solid var(--stroke-2); border-left: 4px solid var(--info); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px; animation: slidein .2s ease-out; }
.toast-success { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--err); }
.toast-warning { border-left-color: var(--warn); }
.toast .t { font-weight: 600; }
.toast .d { font-size: 13px; color: var(--text-2); margin-top: 2px; word-break: break-word; }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } }
.modal-wrap[hidden] { display: none; }
.modal-wrap { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: grid; place-items: center; z-index: 90; padding: 16px; }
.modal { background: var(--card); border: 1px solid var(--stroke-2); border-radius: 10px; box-shadow: var(--shadow); width: min(460px, 100%); }
.modal-body { padding: 22px 24px 18px; }
.modal-body h3 { font-size: 18px; margin-bottom: 8px; }
.modal-body p { margin: 0 0 8px; color: var(--text-2); white-space: pre-line; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 24px; background: var(--card-2); border-top: 1px solid var(--stroke); border-radius: 0 0 10px 10px; }
.modal-foot .btn { min-width: 110px; }

/* Anmeldung */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 16px;
  background: radial-gradient(circle at 20% 10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 45%), var(--bg); }
.login-card { background: var(--card); border: 1px solid var(--stroke); border-radius: 14px; box-shadow: var(--shadow); padding: 36px 32px; width: min(420px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.login-card h1 { font-size: 22px; }
.login-card p { color: var(--text-2); margin: 0; }
.login-logo-img { width: 64px; height: 64px; }
.login-logo { width: 64px; height: 64px; border-radius: 16px; background: var(--err); color: #fff; font-size: 34px; font-weight: 700; display: grid; place-items: center; }

/* ---------------------------------------------------------------- Mobil */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 15; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px 6px; }
  .topbar h1 { font-size: 20px; }
  .content { padding: 6px 16px 32px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .setting { flex-direction: column; align-items: stretch; }
  .setting .ctl { width: 100%; }
  .setting .ctl input[type=text], .setting .ctl input[type=number], .setting .ctl select, .setting .ctl textarea { width: 100%; }
  table.list .hide-m { display: none; }
  .console-page { height: calc(100vh - 90px); }
}
@media (max-width: 480px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stat .v { font-size: 17px; }
  .hero-actions .btn { flex: 1; }
}
