* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #121212;
    color: #e0e0e0;
    padding: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

h1 {
    font-size: 24px;
    margin-bottom: 4px;
}

.subtitle {
    color: #b0b0b0;
}

.main-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.nav-link {
    padding: 8px 14px;
    border: 1px solid #444;
    border-radius: 6px;
    color: #b0b0b0;
    text-decoration: none;
    background: #1a1a1a;
}

.nav-link:hover {
    color: #e0e0e0;
    background: #252525;
}

.nav-link.active {
    color: #90caf9;
    border-color: #1565c0;
    background: #1e2a38;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.pagination-meta {
    color: #b0b0b0;
    font-size: 13px;
}

.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

.stats-box {
    min-width: 180px;
    max-width: 280px;
    padding: 12px 16px;
    border: 1px solid #444;
    border-radius: 8px;
    background: #1e1e1e;
    text-align: right;
}

.stats-label {
    color: #b0b0b0;
    font-size: 12px;
}

.stats-power {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
    color: #b0b0b0;
    font-size: 12px;
}

.select-small {
    padding: 2px 6px;
    font-size: 12px;
}

.stats-value {
    font-size: 24px;
    font-weight: 700;
    color: #7cfc90;
    margin: 4px 0;
}

.stats-value-muted {
    color: #ffb74d;
}

.stats-value-accent {
    color: #90caf9;
}

.stats-value-realized {
    color: #69f0ae;
}

.stats-meta {
    color: #b0b0b0;
    font-size: 12px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.select,
.filter-input {
    padding: 8px 12px;
    border: 1px solid #444;
    background: #1e1e1e;
    color: #e0e0e0;
    font-size: 14px;
    outline: none;
    border-radius: 4px;
}

.filter-input {
    min-width: 220px;
}

.filter-meta {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    color: #90caf9;
    font-size: 13px;
    white-space: nowrap;
}

.power-setting {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 8px;
    color: #b0b0b0;
}

.btn {
    padding: 8px 14px;
    border: 1px solid #444;
    background: #2a2a2a;
    color: #e0e0e0;
    cursor: pointer;
    border-radius: 4px;
}

.btn:hover {
    background: #333;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
    margin-right: 4px;
}

.btn-sold {
    border-color: #2e7d32;
    color: #7cfc90;
}

.btn-reorder {
    border-color: #1565c0;
    color: #90caf9;
}

.btn-relist {
    border-color: #8e24aa;
    color: #ce93d8;
}

.btn-listed {
    border-color: #00897b;
    color: #80cbc4;
}

.btn-delete {
    border-color: #c62828;
    color: #ff7a7a;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #444;
    border-radius: 8px;
    background: #1e1e1e;
}

.table-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 18px;
    margin-bottom: 10px;
    color: #e0e0e0;
}

.section-count {
    display: inline-block;
    min-width: 24px;
    padding: 2px 8px;
    margin-left: 8px;
    border-radius: 999px;
    background: #2a2a2a;
    color: #b0b0b0;
    font-size: 13px;
    text-align: center;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 10px 12px;
    border-bottom: 1px solid #333;
    text-align: left;
    vertical-align: top;
}

th {
    background: #181818;
    color: #b0b0b0;
    font-weight: 600;
    white-space: nowrap;
}

tbody tr:hover {
    background: #252525;
}

.empty {
    text-align: center;
    color: #888;
    padding: 24px;
}

.item-name {
    max-width: 320px;
    word-break: break-word;
    font-size: 16px;
    font-weight: 600;
}

.order-owner {
    margin-top: 2px;
    color: #8a8a8a;
    font-size: 11px;
    font-weight: 400;
}

.item-name.copyable {
    cursor: copy;
}

.item-name.copyable:hover {
    color: #90caf9;
}

.item-name.copied {
    color: #7cfc90;
    background: #1e3a27;
    box-shadow: inset 0 0 0 1px #315c3a;
}

.buy-price.copyable {
    cursor: copy;
    padding: 2px 5px;
    border-radius: 4px;
}

.buy-price.copyable:hover {
    color: #90caf9;
    background: #263746;
}

.buy-price.copyable.copied {
    color: #7cfc90;
    background: #1e3a27;
}

.status-open {
    color: #90caf9;
}

.status-sold {
    color: #7cfc90;
}

.profit-positive {
    color: #7cfc90;
    font-weight: 600;
}

.profit-negative {
    color: #ff7a7a;
    font-weight: 600;
}

.muted {
    color: #909090;
    font-size: 12px;
}

.account-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.character-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.character-slot {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

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

.credential-copy {
    padding: 4px 7px;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #e0e0e0;
    background: transparent;
    cursor: copy;
}

.credential-copy:hover {
    color: #90caf9;
    background: #263746;
}

.credential-copy.copied {
    color: #7cfc90;
    border-color: #315c3a;
    background: #1e3a27;
}

.num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.order-quality {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid #546e7a;
    border-radius: 999px;
    color: #b0bec5;
    white-space: nowrap;
}

.order-quality-2 {
    border-color: #546e7a;
    color: #cfd8dc;
}

.order-quality-3 {
    border-color: #f9a825;
    color: #ffe082;
}

.order-quality-4 {
    border-color: #8e24aa;
    color: #ce93d8;
}

.order-quality-5 {
    border-color: #fb8c00;
    color: #ffcc80;
}

.order-slot,
.order-slot-empty {
    width: 34%;
    min-width: 320px;
}

.order-slot-empty {
    color: #666;
    text-align: center;
    vertical-align: middle;
}

.order-slot-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.order-slot-meta {
    color: #b0b0b0;
    font-size: 12px;
    white-space: nowrap;
}

.order-slot-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.order-slot-actions {
    white-space: nowrap;
}

.item-upload-card .section-title {
    margin-top: 0;
}

.item-upload-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.upload-hint,
.upload-status {
    margin-top: 10px;
    color: #b0b0b0;
}

.upload-status {
    color: #90caf9;
}

.api-layout {
    display: grid;
    grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.2fr);
    gap: 16px;
    margin-bottom: 16px;
}

.api-card {
    padding: 16px;
    border: 1px solid #444;
    border-radius: 8px;
    background: #1e1e1e;
}

.api-card h2 {
    margin-bottom: 12px;
    font-size: 17px;
}

.endpoint-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.endpoint-preset {
    padding: 9px 12px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #181818;
    color: #90caf9;
    text-align: left;
    cursor: pointer;
}

.endpoint-preset:hover {
    background: #252525;
}

.api-form,
.api-request-row {
    display: flex;
    gap: 10px;
}

.api-form {
    flex-direction: column;
}

.api-url {
    flex: 1;
}

.api-body,
.api-response {
    width: 100%;
    padding: 12px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #121212;
    color: #e0e0e0;
    font-family: Consolas, monospace;
}

.api-response {
    min-height: 220px;
    overflow: auto;
    white-space: pre-wrap;
}

.api-response-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

#api-status {
    color: #90caf9;
}

.desktops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 16px;
}

.desktop-card {
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    background: #161616;
}

.desktop-card-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
}

.desktop-card-head span {
    display: block;
    color: #9aa0a6;
    font-size: 13px;
}

.session-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.session-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 12px;
    min-height: calc(100vh - 190px);
}

.session-vnc-wrap {
    position: relative;
    min-height: 640px;
}

.session-frame,
.session-console {
    width: 100%;
    height: 100%;
    min-height: 640px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #000;
}

html.novnc-live,
.novnc-live {
    margin: 0;
    height: 100%;
    background: #000;
    overflow: hidden;
}

.novnc-live-frame {
    width: 100vw;
    height: 100vh;
    border: 0;
    background: #000;
}

.novnc-lock {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font: 16px/1.4 sans-serif;
    cursor: pointer;
    user-select: none;
}

.novnc-live .novnc-lock {
    position: fixed;
}

.novnc-lock span {
    padding: 12px 18px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.75);
}

.novnc-lock[hidden] {
    display: none;
}

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

.desktop-frame {
    width: 100%;
    height: 520px;
    border: 0;
    background: #000;
}

@media (max-width: 900px) {
    .api-layout {
        grid-template-columns: 1fr;
    }
}
