:root {
    color-scheme: dark;
    --background: #181818;
    --sidebar: #202020;
    --surface: #252525;
    --surface-strong: #2d2d2d;
    --border: #323232;
    --text: #ffffff;
    --muted: #b7b7b7;
    --quiet: #777777;
    --success: #3fb950;
    --warning: #d29922;
    --danger: #f85149;
    --info: #58a6ff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 1000px;
    min-height: 650px;
    background: var(--background);
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 220px;
    display: flex;
    flex-direction: column;
    background: var(--sidebar);
    border-right: 1px solid #1b1b1b;
}

.brand {
    height: 176px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 18px;
}

.brand img {
    width: 168px;
    max-width: 100%;
    height: 168px;
    max-height: 100%;
    object-fit: contain;
}

.nav {
    display: grid;
    gap: 6px;
    padding: 0 16px;
}

.nav-item {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    text-align: left;
    cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.profile {
    margin-top: auto;
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 18px 22px;
}

.avatar {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #3a3a3a;
    color: var(--text);
    font-weight: 700;
}

.profile-name {
    font-weight: 700;
}

.profile-project {
    margin-top: 2px;
    color: var(--quiet);
    font-size: 13px;
}

.shell {
    margin-left: 220px;
    min-height: 100vh;
    padding: 28px 32px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 30px;
    font-weight: 750;
}

h2 {
    font-size: 18px;
    font-weight: 700;
}

.topbar p {
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
}

.status {
    min-width: 148px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--muted);
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--warning);
}

.status-dot.online {
    background: var(--success);
}

.status-dot.offline {
    background: var(--danger);
}

.view {
    display: none;
}

.view.active {
    display: grid;
    gap: 18px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.summary-grid,
.split-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.panel {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.metric {
    min-height: 112px;
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 18px;
}

.metric span {
    color: var(--muted);
    font-size: 13px;
}

.metric strong {
    font-size: 34px;
    line-height: 1;
}

.panel-header {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.actions {
    display: flex;
    gap: 10px;
}

.button {
    height: 36px;
    min-width: 92px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}

.button.primary {
    background: var(--text);
    color: #101010;
    border-color: var(--text);
    font-weight: 700;
}

.button.secondary {
    background: var(--surface-strong);
    color: var(--text);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th,
td {
    padding: 13px 18px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

td {
    color: #eeeeee;
    font-size: 14px;
}

.compact th,
.compact td {
    padding: 10px 12px;
}

tr:last-child td {
    border-bottom: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-width: 76px;
    height: 24px;
    justify-content: center;
    border-radius: 6px;
    background: #333333;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.link-button {
    min-width: 58px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-strong);
    color: var(--text);
    cursor: pointer;
}

.link-button:hover {
    border-color: var(--muted);
}

.badge.success {
    color: var(--success);
}

.badge.warning {
    color: var(--warning);
}

.badge.danger {
    color: var(--danger);
}

.kv-list {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 18px;
}

.kv-list div {
    display: grid;
    grid-template-columns: 136px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.kv-list dt {
    color: var(--muted);
    font-size: 13px;
}

.kv-list dd {
    margin: 0;
    min-width: 0;
    color: var(--text);
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    padding: 18px;
}

label {
    display: grid;
    gap: 8px;
}

label span {
    color: var(--muted);
    font-size: 13px;
}

input {
    width: 100%;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #1d1d1d;
    color: var(--text);
    padding: 0 12px;
}

.module-list {
    display: grid;
    gap: 10px;
    padding: 0 18px 18px;
}

.module-row {
    min-height: 54px;
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #202020;
}

.detail-panel[hidden] {
    display: none;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 18px;
}

.report-summary {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding-bottom: 14px;
}

.detail-item {
    min-width: 0;
    min-height: 68px;
    display: grid;
    align-content: center;
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #202020;
}

.detail-item span {
    color: var(--muted);
    font-size: 12px;
}

.detail-item strong {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.split-grid {
    padding: 0 18px 18px;
}

.split-grid h3 {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

.split-grid > div {
    min-width: 0;
}

.report-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 18px 16px;
    border-bottom: 1px solid var(--border);
}

.report-tab {
    min-width: 116px;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-strong);
    color: var(--muted);
    cursor: pointer;
}

.report-tab:hover,
.report-tab.active {
    border-color: var(--text);
    color: var(--text);
}

.report-tab.active {
    background: var(--text);
    color: #101010;
    font-weight: 700;
}

.report-tab-panel {
    display: none;
    padding: 18px;
    min-width: 0;
}

.report-tab-panel.active {
    display: block;
}

.tab-panel-heading h3 {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

.report-tab-panel .table-wrap {
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.report-metric {
    align-content: stretch;
    gap: 10px;
}

.metric-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.metric-toggle {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--info);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.metric-toggle:hover {
    color: var(--text);
}

.report-count-metric[hidden],
.report-chart-metric[hidden] {
    display: none;
}

.report-count-metric {
    display: grid;
    align-content: center;
    min-height: 58px;
}

.report-chart-metric {
    display: grid;
    gap: 7px;
}

.scan-chart-controls {
    display: flex;
    gap: 4px;
}

.scan-chart-period {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px 7px;
    background: #202020;
    color: var(--muted);
    font-size: 11px;
    cursor: pointer;
}

.scan-chart-period.active,
.scan-chart-period:hover {
    border-color: var(--info);
    color: var(--text);
}

.scan-chart-summary {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.scan-chart-summary strong {
    font-size: 22px;
}

.scan-chart-summary span {
    font-size: 12px;
}

.scan-chart-curve {
    display: grid;
    gap: 3px;
}

.scan-chart-svg {
    width: 100%;
    height: 64px;
    display: block;
    overflow: visible;
}

.scan-chart-grid {
    fill: none;
    stroke: #333333;
    stroke-width: 1;
    stroke-dasharray: 3 5;
    opacity: 0.75;
}

.scan-chart-area {
    fill: rgba(88, 166, 255, 0.16);
    stroke: none;
}

.scan-chart-line {
    fill: none;
    stroke: var(--info);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 7px rgba(88, 166, 255, 0.28));
}

.scan-chart-point-group {
    cursor: pointer;
    outline: none;
}

.scan-chart-point {
    fill: var(--surface);
    stroke: var(--info);
    stroke-width: 2;
    transition: fill 0.16s ease, r 0.16s ease;
}

.scan-chart-value {
    opacity: 0;
    fill: var(--text);
    stroke: var(--background);
    stroke-width: 3px;
    paint-order: stroke;
    pointer-events: none;
    font-size: 10px;
    font-weight: 800;
    transition: opacity 0.16s ease;
}

.scan-chart-point-group:hover .scan-chart-point,
.scan-chart-point-group:focus .scan-chart-point {
    fill: var(--info);
}

.scan-chart-point-group:hover .scan-chart-value,
.scan-chart-point-group:focus .scan-chart-value {
    opacity: 1;
}

.scan-chart-labels {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 4px;
}

.scan-chart-labels small {
    overflow: hidden;
    color: var(--quiet);
    font-size: 10px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}.process-search-panel {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #202020;
}

.process-search-row,
.process-search-add,
.process-search-list-header {
    display: flex;
    align-items: end;
    gap: 10px;
}

.process-search-field {
    flex: 1;
}

.process-search-list {
    display: grid;
    gap: 10px;
}

.process-search-list-header {
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
}

.process-search-status {
    color: var(--quiet);
}

.process-search-add input {
    flex: 1;
}

.process-search-names {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 30px;
}

.process-search-chip {
    display: inline-flex;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-strong);
}

.process-search-chip-name,
.process-search-chip-remove {
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.process-search-chip-name {
    max-width: 220px;
    padding: 6px 10px 6px 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.process-search-chip-remove {
    width: 28px;
    height: 28px;
    border-left: 1px solid var(--border);
    color: var(--muted);
    font-size: 16px;
}

.process-search-chip-name:hover,
.process-search-chip-remove:hover {
    color: var(--info);
}

.process-search-empty {
    color: var(--quiet);
    font-size: 13px;
}

.process-inventory table {
    min-width: 920px;
}

.process-inventory th:nth-child(1),
.process-inventory td:nth-child(1),
.process-inventory th:nth-child(2),
.process-inventory td:nth-child(2) {
    width: 84px;
}

.process-inventory th:nth-child(4),
.process-inventory td:nth-child(4) {
    width: 72px;
}

.path-cell {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.log-message-cell {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.module-title {
    font-weight: 700;
}

.module-subtitle {
    margin-top: 2px;
    color: var(--quiet);
    font-size: 13px;
}

.toggle {
    width: 48px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #3a3a3a;
    position: relative;
    cursor: pointer;
}

.toggle::after {
    content: "";
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--muted);
    position: absolute;
    top: 3px;
    left: 4px;
    transition: transform 160ms ease, background 160ms ease;
}

.toggle.enabled::after {
    transform: translateX(18px);
    background: var(--success);
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    min-width: 240px;
    max-width: 420px;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #101010;
    color: var(--text);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1100px) {
    .stats-grid,
    .summary-grid,
    .split-grid,
    .detail-grid,
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
