:root {
    color-scheme: dark;
    --bg: #101115;
    --panel: #191a20;
    --panel-hover: #22232a;
    --border: #303039;
    --red: #b21d2b;
    --red-light: #e13a45;
    --text: #e8e6e8;
    --muted: #92919b;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
}
a { color: inherit; text-decoration: none; }
.app { min-height: 100vh; display: flex; }
.sidebar {
    width: 245px;
    min-width: 245px;
    background: #17181d;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 12px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 5px 8px 25px;
    border-bottom: 1px solid var(--border);
}
.brand-logo {
    width: 39px; height: 39px;
    border-radius: 50%;
    background: #99121d;
    border: 2px solid #d72c37;
    display: grid; place-items: center;
    font-size: 25px;
}
.brand strong { font-size: 13px; letter-spacing: .5px; }
.brand small, .sidebar-footer small {
    display: block; color: var(--muted); margin-top: 4px;
}
.nav-label {
    color: #777782;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1.2px;
    margin: 24px 8px 9px;
}
.nav-item {
    min-height: 39px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 5px;
    color: #c5c3ca;
    margin-bottom: 4px;
}
.nav-item:hover, .nav-item.active {
    background: #272027;
    border-color: #54252c;
    color: white;
}
.nav-item.active { box-shadow: inset 3px 0 var(--red-light); }
.nav-item small {
    margin-left: auto;
    color: #777782;
    font-size: 10px;
}
.sidebar-footer {
    margin-top: auto;
    padding: 18px 8px 0;
    border-top: 1px solid var(--border);
    color: #a5a3ac;
    font-size: 10px;
    letter-spacing: 1px;
}
.main { flex: 1; min-width: 0; }
.topbar {
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    background: #1d1015;
    border-bottom: 1px solid #54232c;
}
.breadcrumb { color: var(--muted); }
.breadcrumb strong { color: var(--text); }
.user {
    border: 1px solid var(--border);
    background: var(--panel);
    padding: 7px 12px;
    border-radius: 4px;
    font-size: 11px;
}
.content { max-width: 1500px; margin: auto; padding: 32px; }
.page-heading {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 35px;
}
.eyebrow { color: var(--red-light); font-size: 10px; letter-spacing: 1.8px; font-weight: bold; }
h1 { font-size: 27px; margin: 9px 0; }
.page-heading p { color: var(--muted); margin: 0; }
.version { color: var(--muted); font-size: 11px; }
.section { margin-bottom: 35px; }
.section h2 {
    color: #b6b2ba;
    font-size: 11px;
    letter-spacing: 1.4px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 15px;
}
.service-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 13px;
}
.service-card, .tool-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.service-card { padding: 19px; min-height: 155px; }
.card-icon, .tool-icon { color: var(--red-light); font-size: 23px; margin-bottom: 15px; }
.card-title { font-weight: bold; }
.card-description { color: var(--muted); font-size: 12px; margin-top: 5px; }
.card-status { color: #aaa7b0; font-size: 11px; margin-top: 19px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.offline { background: #a17d48; }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.tool-card {
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: background .15s, border-color .15s;
}
.tool-card:hover:not(.disabled) { background: var(--panel-hover); border-color: #85303a; }
.tool-icon { margin: 0; font-size: 25px; }
.tool-card span:nth-child(2) { flex: 1; }
.tool-card strong, .tool-card small { display: block; }
.tool-card small { color: var(--muted); font-size: 11px; margin-top: 5px; }
.tool-card b { color: var(--muted); }
.disabled { opacity: .55; cursor: default; }
footer { border-top: 1px solid var(--border); padding-top: 18px; color: #777782; font-size: 9px; letter-spacing: 1.4px; }
footer span { color: var(--red-light); margin: 0 5px; }
@media(max-width: 1050px) {
    .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tool-grid { grid-template-columns: 1fr; }
}
@media(max-width: 650px) {
    .sidebar { width: 64px; min-width: 64px; padding: 12px 7px; }
    .brand { padding: 5px 0 18px; justify-content: center; }
    .brand > div:last-child, .nav-label, .nav-item span, .nav-item small, .sidebar-footer { display: none; }
    .nav-item { justify-content: center; padding: 0; font-size: 18px; }
    .content { padding: 22px 14px; }
    .topbar { padding: 0 14px; }
    .service-grid { grid-template-columns: 1fr; }
    h1 { font-size: 22px; }
}

/* Map file explorer */
.map-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    margin-bottom: 15px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 5px;
}
.map-breadcrumbs a { color: #d6d2da; }
.map-breadcrumbs a:hover { color: var(--red-light); }
.map-breadcrumbs span { color: #686772; }

.map-explorer {
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 5px;
}
.map-explorer-header,
.map-entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px 165px;
    align-items: center;
    gap: 15px;
    padding: 12px 16px;
}
.map-explorer-header {
    color: var(--muted);
    background: #202127;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}
.map-entry {
    min-height: 43px;
    border-bottom: 1px solid #292a31;
}
.map-entry:last-child { border-bottom: 0; }
.map-entry:hover { background: var(--panel-hover); }
.map-entry-name { overflow-wrap: anywhere; }
.map-entry-name a:hover { color: var(--red-light); }
.map-entry-meta {
    color: var(--muted);
    font-size: 12px;
}
.map-empty, .map-error {
    padding: 20px;
    color: var(--muted);
}
.map-error { color: #e17b7b; }
.map-preview {
    margin-bottom: 15px;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 5px;
}
.map-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.map-preview-header > div {
    display: flex;
    gap: 8px;
}
.map-action {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: #d8d5dc;
    font-size: 12px;
}
.map-action:hover {
    border-color: var(--red);
    color: white;
}
.map-preview pre {
    max-height: 650px;
    overflow: auto;
    margin: 0;
    padding: 16px;
    color: #d0cdd5;
    font: 12px/1.5 Consolas, monospace;
    white-space: pre;
}
@media(max-width: 700px) {
    .map-explorer-header,
    .map-entry {
        grid-template-columns: minmax(0, 1fr) 75px;
    }
    .map-explorer-header > :last-child,
    .map-entry > :last-child {
        display: none;
    }
    .map-preview-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* RedStar branding */
.brand-logo {
    background: url('/images/redstar-logo.png') center / contain no-repeat;
    font-size: 0;
}

/* Replace old circular brand badge with wiki logo */
.brand-logo {
    background: url('/images/redstar-logo.png') center / contain no-repeat !important;
    background-color: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.brand-logo::before,
.brand-logo::after {
    content: none !important;
}
