* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: #10151d;
    background: #f5f7fa;
}

.console-body {
    display: grid;
    grid-template-columns: 250px 1fr;
}

.mobile-nav-toggle {
    display: none;
    position: fixed;
    z-index: 30;
    top: 10px;
    right: 10px;
}

.sidebar {
    min-height: 100vh;
    padding: 24px 16px;
    background: linear-gradient(180deg, #06183a 0%, #15256f 48%, #3a003f 100%);
    color: #ffffff;
    position: sticky;
    top: 0;
}

.brand {
    margin: 0 0 28px;
    font-size: 20px;
    font-weight: 700;
}

.nav-item {
    display: block;
    padding: 14px 16px;
    margin-bottom: 8px;
    border-radius: 6px;
    color: #ffffff;
    text-decoration: none;
}

.nav-item.active,
.nav-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-badge {
    display: inline-flex;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 999px;
    color: #ffffff;
    background: #dc3650;
    font-size: 11px;
    font-weight: 700;
}

.console {
    padding: 28px 32px 40px;
}

.console-top,
.topbar,
.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.eyebrow {
    margin: 0 0 6px;
    color: #326c7f;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
}

h1 {
    font-size: 34px;
}

h2 {
    font-size: 18px;
    font-weight: 500;
}

.top-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.top-stats select {
    width: min(360px, 100%);
}

.top-stats span,
.badge,
.tag {
    border-radius: 6px;
    font-weight: 700;
}

.top-stats span {
    padding: 8px 10px;
    background: #ffffff;
    border: 1px solid #d8e0e7;
}

.client-browser {
    margin: 0 0 22px;
    padding: 12px;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #ffffff;
}

.client-browser-head,
.client-row {
    display: grid;
    align-items: center;
    gap: 10px;
}

.client-browser-head {
    grid-template-columns: 1fr auto;
    margin-bottom: 10px;
}

.client-browser-head h2 {
    font-weight: 700;
}

.running-toggle {
    display: inline-flex;
    grid-template-columns: none;
    align-items: center;
    gap: 8px;
    color: #34404a;
    white-space: nowrap;
}

.running-toggle input {
    width: auto;
    min-height: auto;
}

.client-search {
    margin-bottom: 10px;
}

.client-list {
    display: grid;
    gap: 6px;
    max-height: min(52vh, 560px);
    overflow: auto;
    padding-right: 4px;
}

.client-row {
    min-height: 36px;
    grid-template-columns: 12px minmax(0, 1fr) minmax(74px, 96px);
    justify-content: stretch;
    padding: 7px 10px;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #ffffff;
    color: #10151d;
    text-align: left;
}

.client-row strong,
.client-row span,
.client-row small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-row span,
.client-row small {
    color: #66717d;
    font-size: 13px;
}

.client-row.selected {
    border-color: #256f84;
    box-shadow: inset 0 0 0 1px #256f84;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.status-dot.online {
    background: #16a34a;
}

.status-dot.offline {
    background: #858d96;
}

.command-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #ffffff;
}

.fleet-panel {
    margin-top: 22px;
}

.fleet-toolbar {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto auto;
    gap: 12px;
    align-items: center;
}

.fleet-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.fleet-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 12px 0;
    color: #34404a;
    font-weight: 700;
}

.fleet-table {
    display: grid;
    gap: 6px;
    max-height: calc(100vh - 230px);
    overflow: auto;
}

.fleet-row {
    min-height: 42px;
    display: grid;
    grid-template-columns: 18px 14px minmax(220px, 1.3fr) minmax(110px, 0.7fr) minmax(120px, 0.7fr) minmax(160px, 0.8fr);
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    color: #10151d;
    background: #ffffff;
    text-decoration: none;
}

.fleet-row a {
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-select-box {
    width: 16px;
    min-height: 16px;
}

.fleet-row strong,
.fleet-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fleet-row span {
    color: #66717d;
    font-size: 13px;
}

.fleet-row:hover,
.fleet-row.selected {
    border-color: #256f84;
    box-shadow: inset 0 0 0 1px #256f84;
}

.profile-grid {
    display: grid;
    grid-template-columns: minmax(340px, 0.9fr) minmax(360px, 1fr);
    gap: 16px;
    margin-top: 22px;
    align-items: start;
}

.profile-facts {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.profile-facts div {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #dfe5ea;
}

.profile-facts span {
    color: #005dff;
    overflow-wrap: anywhere;
}

.profile-form {
    margin-top: 18px;
}

.subscription-panel {
    grid-column: 1 / -1;
}

.subscription-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.subscription-options div {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #f9fbfd;
}

.subscription-options span {
    color: #66717d;
}

button:disabled {
    cursor: not-allowed;
    background: #858d96;
}

.command-bar strong,
.command-bar span {
    display: block;
}

.command-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.monitor-grid {
    display: grid;
    grid-template-columns: minmax(520px, 1.1fr) minmax(420px, 1fr);
    gap: 28px;
    align-items: start;
}

.left-column,
.right-column {
    display: grid;
    gap: 12px;
}

.sub-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
}

.panel {
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #ffffff;
    padding: 20px;
}

.muted {
    color: #66717d;
}

.map-panel {
    padding: 14px;
}

.map-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.map-zoom-controls {
    display: inline-flex;
    overflow: hidden;
    border: 1px solid #c7d0d8;
    border-radius: 6px;
}

.map-zoom-controls button {
    min-width: 34px;
    height: 30px;
    padding: 0 9px;
    border: 0;
    border-right: 1px solid #c7d0d8;
    background: #ffffff;
    color: #111827;
    font-weight: 800;
}

.map-zoom-controls button:last-child {
    border-right: 0;
}

.map-zoom-controls button:hover {
    background: #edf6fb;
}

#mapCanvas {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    margin-top: 14px;
    border: 1px solid #c7d0d8;
    background: #f9fbfd;
    cursor: crosshair;
}

.route-list {
    height: 360px;
    margin-top: 18px;
    overflow: auto;
    border: 1px solid #d8e0e7;
    background: #ffffff;
}

.route-list div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid #dfe5ea;
    font-size: 13px;
}

.inventory-list,
.action-list {
    list-style: none;
    margin: 18px 0 0;
    padding: 0;
}

.inventory-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin-top: 18px;
}

.inventory-strip span {
    display: flex;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    padding: 6px 9px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    text-align: center;
}

.inventory-found {
    color: #0f5a2d;
    background: #c9f5d8;
}

.inventory-missing {
    color: #8d1b2d;
    background: #ffd6dc;
}

.inventory-unknown {
    color: #34404a;
    background: #edf1f5;
}

.inventory-list li,
.action-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #dfe5ea;
}

.visual-log-list,
.command-status-list {
    max-height: 330px;
    overflow: auto;
    border: 1px solid #d8e0e7;
    padding: 0 10px;
}

.visual-log-row {
    align-items: flex-start;
}

.log-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.log-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.log-chip em {
    margin-left: 5px;
    font-style: normal;
    opacity: 0.72;
}

.log-chip.skill {
    color: #5f4200;
    background: #ffe08a;
}

.log-chip.target {
    color: #8d1b2d;
    background: #ffd6dc;
}

.log-chip.state {
    color: #0f5a2d;
    background: #c9f5d8;
}

.log-chip.scan {
    color: #135a8a;
    background: #d7ecff;
}

.log-chip.party {
    color: #114c63;
    background: #c9f4ff;
}

.log-chip.resurrection {
    color: #633b00;
    background: #ffe0a8;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid #d8e0e7;
    margin-top: 18px;
}

.stat-grid div {
    min-height: 88px;
    padding: 14px;
    border-right: 1px solid #d8e0e7;
    border-bottom: 1px solid #d8e0e7;
}

.stat-grid .wide {
    grid-column: span 2;
}

.stat-grid strong {
    display: block;
    margin-bottom: 12px;
}

.stat-grid span {
    color: #005dff;
}

.command-row {
    display: grid;
    grid-template-columns: 1fr 1fr minmax(120px, 1fr) auto;
    gap: 8px;
    margin: 18px 0 14px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    padding: 9px 10px;
    border: 1px solid #c7d0d8;
    border-radius: 6px;
    font: inherit;
    color: #10151d;
    background: #ffffff;
}

button,
.button-link {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border: 0;
    border-radius: 6px;
    background: #1568b7;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

button.danger {
    background: #dc3650;
}

.admin-list {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

.admin-account {
    display: grid;
    gap: 14px;
}

.admin-facts {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.admin-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 10px;
}

.admin-actions form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.admin-client-list {
    display: grid;
    gap: 6px;
}

.admin-client-row {
    display: grid;
    grid-template-columns: 12px minmax(220px, 1fr) minmax(100px, 160px) auto auto;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #f9fbfd;
}

.admin-client-row strong,
.admin-client-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge,
.tag {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 3px 7px;
    color: #ffffff;
    font-size: 12px;
}

.green {
    background: #16a34a;
}

.red {
    background: #dc3650;
}

.blue {
    background: #1568b7;
}

.muted-tag {
    background: #858d96;
}

.alert,
.notice {
    padding: 10px 12px;
    border-radius: 6px;
}

.alert {
    border: 1px solid #e3a3a3;
    color: #8b1f1f;
    background: #fff1f1;
}

.notice {
    border: 1px solid #8fc79f;
    color: #22683a;
    background: #eefaf1;
}

.auth-shell {
    width: min(440px, calc(100% - 32px));
    margin: 0 auto;
    min-height: 100vh;
    display: grid;
    align-items: center;
    padding: 32px 0;
}

.auth-panel h1 {
    font-size: 30px;
    margin-bottom: 24px;
}

.form-stack {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 8px;
    color: #34404a;
    font-weight: 700;
}

@media (max-width: 1100px) {
    .console-body {
        grid-template-columns: 1fr;
    }

    .mobile-nav-toggle {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        z-index: 25;
        inset: 0 auto 0 0;
        width: min(280px, 82vw);
        min-height: 100vh;
        transform: translateX(-100%);
        transition: transform 160ms ease;
    }

    .nav-open .sidebar {
        transform: translateX(0);
    }

    .monitor-grid,
    .sub-grid,
    .profile-grid,
    .subscription-options,
    .admin-facts,
    .admin-actions,
    .admin-client-row {
        grid-template-columns: 1fr;
    }

    .inventory-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .admin-actions form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .console {
        padding: 20px 16px;
    }

    .console-top,
    .command-bar,
    .panel-head {
        align-items: flex-start;
        flex-direction: column;
    }

    h1 {
        font-size: 26px;
    }

    .stat-grid,
    .command-row,
    .client-row,
    .client-browser-head,
    .fleet-toolbar,
    .fleet-row {
        grid-template-columns: 1fr;
    }

    .inventory-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .client-row,
    .fleet-row {
        gap: 4px;
    }

    .fleet-row {
        grid-template-columns: 18px 14px minmax(0, 1fr);
    }

    .fleet-row > span:nth-of-type(n+2) {
        grid-column: 3;
    }

    .command-buttons,
    .fleet-actions,
    .top-stats {
        width: 100%;
    }

    .command-buttons button,
    .fleet-actions button,
    .top-stats select {
        width: 100%;
    }

    .fleet-meta {
        flex-direction: column;
    }

    .profile-facts div {
        grid-template-columns: 1fr;
    }

    .stat-grid .wide {
        grid-column: auto;
    }
}
