:root {
    --module-bg: #050505;
    --module-panel: rgba(10, 10, 10, 0.94);
    --module-border: #2f343d;
    --module-cyan: #00ffff;
    --module-orange: #ff9900;
    --module-green: #00ff88;
    --module-red: #ff3333;
    --module-text: #ffffff;
    --module-muted: #a6adbb;
}

* {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    background: var(--module-bg);
    color: var(--module-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.module-app-shell {
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    padding: 18px;
    box-sizing: border-box;
    overflow-x: hidden;
}

.module-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    border: 1px solid var(--module-border);
    background: var(--module-panel);
    padding: 18px;
    border-radius: 10px;
    margin-bottom: 18px;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.module-kicker {
    color: var(--module-cyan);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.08em;
}

.module-header h1 {
    margin: 6px 0;
    font-size: clamp(24px, 5vw, 24px);
    color: var(--module-text);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.module-header p {
    margin: 0;
    color: var(--module-muted);
    max-width: 850px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.topo-header-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 100%;
}

.module-link {
    color: var(--module-cyan);
    border: 1px solid var(--module-cyan);
    padding: 10px 12px;
    text-decoration: none;
    border-radius: 8px;
    white-space: normal;
    text-align: center;
    max-width: 100%;
}

.module-main {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 18px;
    max-width: 100%;
}

.module-panel {
    border: 1px solid var(--module-border);
    background: var(--module-panel);
    border-radius: 10px;
    padding: 16px;
    max-height: calc(100vh - 150px);
    overflow: auto;
    min-width: 0;
}

.module-panel h2 {
    font-size: 14px;
    margin: 8px 0 12px;
    color: var(--module-cyan);
    border-bottom: 1px solid var(--module-border);
    padding-bottom: 6px;
}

.module-panel label {
    display: block;
    color: var(--module-muted);
    font-size: 11px;
    margin: 10px 0 4px;
}

.module-panel input,
.module-panel select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: #080808;
    color: var(--module-text);
    border: 1px solid var(--module-border);
    border-radius: 6px;
    padding: 9px;
    font-family: inherit;
}

.module-button-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 14px 0;
}

.btn {
    border: 1px solid var(--module-cyan);
    background: rgba(0, 255, 255, 0.1);
    color: var(--module-cyan);
    padding: 10px 12px;
    border-radius: 7px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    text-transform: uppercase;
    width: 100%;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.btn.secondary {
    border-color: var(--module-orange);
    color: var(--module-orange);
    background: rgba(255, 153, 0, 0.1);
}

.btn.danger {
    border-color: var(--module-red);
    color: var(--module-red);
    background: rgba(255, 51, 51, 0.1);
}

.btn.small {
    padding: 8px 10px;
    font-size: 11px;
}

.module-stat {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 8px 0;
    font-size: 12px;
}

.module-stat span {
    color: var(--module-muted);
}

.module-stat strong {
    color: var(--module-green);
    text-align: right;
}

.module-status {
    margin-top: 12px;
    color: var(--module-cyan);
    font-size: 11px;
    line-height: 1.4;
}

.module-note {
    margin-top: 14px;
    padding: 10px;
    border: 1px solid var(--module-border);
    border-radius: 8px;
    color: var(--module-muted);
    font-size: 11px;
    line-height: 1.5;
}

.module-map-card {
    position: relative;
    border: 1px solid var(--module-border);
    background: var(--module-panel);
    border-radius: 10px;
    overflow: hidden;
    min-height: calc(100vh - 150px);
    min-width: 0;
}

#module_map {
    width: 100%;
    height: calc(100vh - 150px);
    min-height: 620px;
}

.module-map-toolbar {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    display: flex;
    gap: 8px;
    max-width: calc(100% - 24px);
}

@media (max-width: 900px) {
    .module-app-shell {
        padding: 12px;
    }

    .module-header {
        flex-direction: column;
        padding: 14px;
        gap: 14px;
    }

    .module-header h1 {
        font-size: clamp(22px, 8vw, 34px);
    }

    .topo-header-links {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .module-link {
        width: 100%;
        display: block;
    }

    .module-main {
        grid-template-columns: 1fr;
    }

    .module-panel {
        max-height: none;
        padding: 14px;
    }

    #module_map,
    .module-map-card {
        min-height: 620px;
        height: 620px;
    }

    .module-map-toolbar {
        left: 12px;
        right: 12px;
        flex-direction: column;
    }
}
