:root {
    --bg: #090b0f;
    --bg-raised: #101318;
    --panel: #15191f;
    --panel-strong: #1a1f27;
    --line: #2a3039;
    --line-soft: #20252c;
    --text: #f4f6f8;
    --muted: #929ba7;
    --muted-strong: #bbc2ca;
    --red: #d93b49;
    --red-bright: #f05462;
    --cyan: #40b8c4;
    --green: #38b77a;
    --amber: #e0a348;
    --danger: #e65d68;
    --shadow: 0 18px 55px rgba(0, 0, 0, .34);
    --sidebar-width: 232px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body.prototype {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}

button,
input,
select,
textarea {
    font: inherit;
    letter-spacing: 0;
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

button,
a {
    color: inherit;
}

button {
    cursor: pointer;
}

.prototype-view[hidden] {
    display: none !important;
}

.prototype-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
    text-decoration: none;
}

.prototype-brand.horizontal {
    min-width: 210px;
}

.prototype-brand > span:last-child,
.operator-block > div,
.environment-status > div {
    display: grid;
    gap: 1px;
}

.prototype-brand strong {
    font-size: 15px;
    line-height: 1.1;
}

.prototype-brand small,
.operator-block small,
.environment-status small {
    color: var(--muted);
    font-size: 11px;
}

.brand-mark,
.operator-avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(240, 84, 98, .44);
    border-radius: 6px;
    background: #33151b;
    color: #fff;
    font-weight: 800;
}

.operator-avatar {
    width: 34px;
    height: 34px;
    border-color: var(--line);
    background: #242a32;
    font-size: 11px;
}

.prototype-nav-button,
.icon-button,
.primary-button,
.secondary-button,
.danger-button,
.text-button,
.inspector-tab,
.stepper button {
    border: 0;
}

.prototype-nav-button {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 6px;
    background: transparent;
    color: var(--muted-strong);
    text-align: left;
    transition: color 150ms ease, background 150ms ease;
}

.prototype-nav-button i {
    width: 19px;
    font-size: 17px;
    text-align: center;
}

.prototype-nav-button:hover {
    background: #1b2027;
    color: var(--text);
}

.prototype-nav-button.is-active {
    background: #2a151a;
    color: #ff8791;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: #1a1f26;
    color: var(--muted-strong);
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease;
}

.icon-button:hover {
    background: #252b34;
    color: var(--text);
}

.utility-menu {
    position: relative;
}

.utility-menu > summary {
    list-style: none;
}

.utility-menu > summary::-webkit-details-marker {
    display: none;
}

.utility-menu[open] > summary {
    background: #252b34;
    color: var(--text);
}

.utility-menu nav {
    position: absolute;
    z-index: 150;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    width: 210px;
    padding: 6px;
    border: 1px solid #39414c;
    border-radius: 7px;
    background: #15191f;
    box-shadow: var(--shadow);
}

.utility-menu nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 0 10px;
    border-radius: 5px;
    color: var(--muted-strong);
    text-decoration: none;
}

.utility-menu nav a:hover {
    background: #222831;
    color: var(--text);
}

.utility-menu nav i {
    width: 18px;
    color: var(--red-bright);
    text-align: center;
}

.primary-button,
.secondary-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 6px;
    font-weight: 700;
    white-space: nowrap;
}

.primary-button {
    background: var(--red);
    color: white;
}

.primary-button:hover {
    background: var(--red-bright);
}

.secondary-button {
    border: 1px solid var(--line);
    background: #171b21;
    color: var(--muted-strong);
}

.secondary-button:hover {
    border-color: #444c58;
    color: var(--text);
}

.danger-button {
    border: 1px solid #69323a;
    background: #2a171b;
    color: #f18a93;
}

.danger-button:hover {
    border-color: #a44751;
    background: #3a1b21;
    color: #fff;
}

body.is-busy,
body.is-busy button {
    cursor: progress;
}

body.is-busy button {
    opacity: .72;
}

.surface {
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: var(--panel);
}

.section-heading,
.surface-heading,
.filter-bar,
.topbar-actions,
.c-header-actions,
.operator-block {
    display: flex;
    align-items: center;
}

.section-heading {
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.section-heading p {
    margin: 0 0 4px;
    color: var(--red-bright);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.section-heading h1 {
    margin: 0;
    font-size: 23px;
    line-height: 1.2;
}

.surface-heading {
    justify-content: space-between;
    gap: 12px;
    padding: 16px 17px 12px;
}

.surface-heading h2 {
    margin: 0;
    font-size: 14px;
}

.surface-heading span {
    color: var(--muted);
    font-size: 11px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.metric {
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 78px;
    gap: 12px;
    padding: 13px 15px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: var(--panel);
}

.metric > i {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: #2c171c;
    color: #f36f7b;
    font-size: 17px;
}

.metric.positive > i {
    background: #10271f;
    color: var(--green);
}

.metric.cyan > i {
    background: #10252a;
    color: var(--cyan);
}

.metric.warning > i {
    background: #2b2214;
    color: var(--amber);
}

.metric > div {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.metric span {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metric strong {
    font-size: 20px;
    line-height: 1;
}

.filter-bar {
    min-height: 48px;
    gap: 9px;
    margin-bottom: 12px;
}

.filter-bar select,
.search-field,
.inspector-field input,
.inspector-field textarea,
.mac-add input {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #101319;
    color: var(--text);
    outline: 0;
}

.filter-bar select {
    height: 38px;
    padding: 0 30px 0 10px;
}

.search-field {
    display: flex;
    align-items: center;
    min-width: 230px;
    max-width: 410px;
    height: 38px;
    padding: 0 11px;
}

.search-field:focus-within,
.inspector-field input:focus,
.inspector-field textarea:focus,
.mac-add input:focus {
    border-color: rgba(240, 84, 98, .72);
    box-shadow: 0 0 0 3px rgba(217, 59, 73, .12);
}

.search-field i {
    color: var(--muted);
}

.search-field input {
    width: 100%;
    height: 100%;
    padding: 0 0 0 9px;
    border: 0;
    background: transparent;
    color: var(--text);
    outline: 0;
}

.result-count {
    margin-left: auto;
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

.user-table-wrap {
    min-height: 360px;
    overflow: auto;
}

.user-table {
    width: 100%;
    min-width: 840px;
    border-collapse: collapse;
}

.user-table th {
    position: sticky;
    z-index: 2;
    top: 0;
    height: 42px;
    padding: 0 13px;
    border-bottom: 1px solid var(--line);
    background: #12161b;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-align: left;
    text-transform: uppercase;
}

.user-table td {
    height: 53px;
    padding: 7px 13px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--muted-strong);
    white-space: nowrap;
}

.user-table tr:last-child td {
    border-bottom: 0;
}

.user-table tbody tr {
    transition: background 120ms ease;
}

.user-table tbody tr:hover,
.user-table tbody tr.is-selected {
    background: #1d1b20;
}

.user-table .note-cell {
    width: 38%;
    max-width: 350px;
    overflow: hidden;
    color: var(--text);
    text-overflow: ellipsis;
}

.user-open-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-weight: 800;
}

.user-open-button:hover {
    color: #ff8791;
}

.status-badge,
.level-badge,
.count-badge,
.server-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 23px;
    padding: 0 7px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

.status-badge::before {
    width: 6px;
    height: 6px;
    margin-right: 5px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.status-badge.active {
    background: #10271f;
    color: #52cf91;
}

.status-badge.inactive {
    background: #2c191c;
    color: #e5747d;
}

.level-badge.admin {
    background: #292117;
    color: #e6b75f;
}

.level-badge.user,
.count-badge {
    background: #20252c;
    color: #c5ccd4;
}

.row-action {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
}

.row-action:hover {
    background: #272c34;
    color: var(--text);
}

.overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr);
    gap: 12px;
}

.activity-list,
.server-pulse,
.log-stream {
    display: grid;
}

.activity-item,
.pulse-item,
.log-item {
    display: grid;
    align-items: center;
    border-top: 1px solid var(--line-soft);
}

.activity-item {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 58px;
    padding: 8px 16px;
}

.activity-icon,
.log-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: #20262d;
    color: var(--cyan);
}

.activity-item strong,
.pulse-item strong,
.log-item strong {
    display: block;
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-item p,
.pulse-item p,
.log-item p {
    margin: 3px 0 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-item time,
.log-item time {
    color: var(--muted);
    font-size: 10px;
    white-space: nowrap;
}

.pulse-item {
    grid-template-columns: 9px minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 58px;
    padding: 8px 16px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 10px rgba(56, 183, 122, .45);
}

.pulse-item code {
    color: var(--muted-strong);
    font-size: 10px;
}

.server-list.table {
    overflow: hidden;
}

.server-row {
    display: grid;
    grid-template-columns: 62px minmax(180px, 1fr) minmax(180px, .8fr) 80px 90px 36px;
    align-items: center;
    min-height: 52px;
    padding: 7px 13px;
    border-bottom: 1px solid var(--line-soft);
}

.server-row:last-child {
    border-bottom: 0;
}

.server-row strong,
.server-card strong {
    color: var(--text);
}

.server-row code,
.server-card code {
    color: var(--cyan);
    font-size: 11px;
}

.server-row span,
.server-card span {
    color: var(--muted);
    font-size: 11px;
}

.server-list.grid,
.server-list.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
}

.server-card {
    display: grid;
    min-height: 112px;
    gap: 8px;
    padding: 15px;
    border-right: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    background: var(--panel);
}

.server-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.server-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.server-flag {
    background: #20252c;
    color: var(--muted-strong) !important;
}

.log-item {
    grid-template-columns: 36px 86px minmax(0, 1fr) 140px;
    gap: 10px;
    min-height: 62px;
    padding: 8px 15px;
}

.log-action {
    color: #f1848d;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.empty-state {
    display: grid;
    min-height: 220px;
    place-items: center;
    color: var(--muted);
    text-align: center;
}

.empty-state i {
    display: block;
    margin-bottom: 8px;
    font-size: 27px;
}

/* Variant A: fixed navigation and dense data table. */
.a-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

.a-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 22px 14px 16px;
    border-right: 1px solid var(--line-soft);
    background: #0c0f13;
}

.a-sidebar .prototype-brand {
    padding: 0 6px 24px;
}

.prototype-nav {
    display: grid;
    gap: 5px;
}

.environment-status {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: auto;
    padding: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 7px;
    background: #11151a;
}

.environment-status > span,
.environment-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 10px rgba(56, 183, 122, .4);
}

.environment-status strong {
    font-size: 11px;
}

.a-main {
    min-width: 0;
}

.a-topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 24px;
    border-bottom: 1px solid var(--line-soft);
    background: rgba(9, 11, 15, .94);
    backdrop-filter: blur(12px);
}

.topbar-context {
    display: grid;
    gap: 2px;
}

.topbar-context span {
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
}

.topbar-context strong {
    font-size: 14px;
}

.topbar-actions,
.c-header-actions {
    gap: 9px;
}

.a-content {
    width: min(1540px, 100%);
    margin: 0 auto;
    padding: 24px 26px 100px;
}

/* Variant B: master/detail operations workspace. */
.variant-b {
    background: #0c0f12;
}

.b-shell {
    min-height: 100vh;
}

.b-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: grid;
    grid-template-columns: 235px minmax(0, 1fr) 230px;
    align-items: center;
    min-height: 64px;
    padding: 0 22px;
    border-bottom: 1px solid var(--line);
    background: #101318;
}

.b-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.b-nav .prototype-nav-button {
    min-height: 36px;
}

.operator-block {
    justify-content: flex-end;
    gap: 10px;
}

.operator-block .environment-dot {
    margin-right: 2px;
}

.operator-block strong {
    font-size: 11px;
}

.b-command-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-bottom: 1px solid var(--line-soft);
    background: #0d1014;
}

.b-command-strip .metric {
    min-height: 58px;
    border: 0;
    border-right: 1px solid var(--line-soft);
    border-radius: 0;
    background: transparent;
}

.b-command-strip .metric > i {
    width: 30px;
    height: 30px;
}

.b-command-strip .metric strong {
    font-size: 16px;
}

.b-main {
    width: min(1680px, 100%);
    margin: 0 auto;
    padding: 22px 24px 100px;
}

.split-workspace {
    display: grid;
    grid-template-columns: minmax(300px, 38%) minmax(440px, 62%);
    min-height: calc(100vh - 250px);
    gap: 12px;
}

.user-rail {
    min-width: 0;
    max-height: calc(100vh - 250px);
    overflow: auto;
}

.user-rail-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    min-height: 68px;
    gap: 10px;
    padding: 9px 13px;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    background: transparent;
    color: inherit;
    text-align: left;
}

.user-rail-item:hover,
.user-rail-item.is-selected {
    background: #20191d;
}

.user-rail-id {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 6px;
    background: #22272f;
    color: var(--text);
    font-weight: 800;
}

.user-rail-copy {
    min-width: 0;
}

.user-rail-copy strong,
.user-rail-copy span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-rail-copy strong {
    font-size: 12px;
}

.user-rail-copy span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
}

/* Variant C: mobile-first command console. */
.variant-c {
    background: #0c0f13;
}

.c-shell {
    width: min(1040px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    border-right: 1px solid var(--line-soft);
    border-left: 1px solid var(--line-soft);
    background: #0e1116;
}

.c-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 62px;
    padding: 0 18px;
    border-bottom: 1px solid var(--line-soft);
    background: rgba(14, 17, 22, .95);
    backdrop-filter: blur(12px);
}

.c-main {
    padding: 16px 16px 150px;
}

.c-metric-scroll {
    display: grid;
    grid-template-columns: repeat(4, minmax(155px, 1fr));
    gap: 8px;
    margin-bottom: 18px;
    overflow-x: auto;
    scrollbar-width: none;
}

.c-metric-scroll::-webkit-scrollbar {
    display: none;
}

.c-metric-scroll .metric {
    min-height: 68px;
}

.c-bottom-nav {
    position: fixed;
    z-index: 35;
    right: 50%;
    bottom: 12px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    width: min(520px, calc(100% - 24px));
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #15191f;
    box-shadow: var(--shadow);
    transform: translateX(50%);
}

.c-bottom-nav .prototype-nav-button {
    display: grid;
    justify-items: center;
    min-height: 47px;
    gap: 2px;
    padding: 4px;
    font-size: 9px;
    text-align: center;
}

.c-bottom-nav .prototype-nav-button i {
    font-size: 16px;
}

.user-card-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.user-card {
    display: grid;
    min-width: 0;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: var(--panel);
}

.user-card header,
.user-card footer,
.user-card-badges {
    display: flex;
    align-items: center;
}

.user-card header,
.user-card footer {
    justify-content: space-between;
    gap: 8px;
}

.user-card-id {
    font-size: 16px;
    font-weight: 800;
}

.user-card-note {
    min-height: 36px;
    margin: 0;
    overflow: hidden;
    color: var(--muted-strong);
    font-size: 12px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.user-card-badges {
    flex-wrap: wrap;
    gap: 5px;
}

.user-card footer span {
    color: var(--muted);
    font-size: 10px;
}

/* Shared inspector, rendered as drawer, embedded pane, or bottom sheet. */
.prototype-inspector {
    z-index: 70;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #12161b;
    color: var(--text);
}

.drawer-inspector {
    position: fixed;
    top: 0;
    right: 0;
    width: min(470px, 100%);
    height: 100vh;
    box-shadow: -20px 0 60px rgba(0, 0, 0, .4);
    transform: translateX(102%);
    transition: transform 190ms ease;
}

.drawer-inspector.is-open {
    transform: translateX(0);
}

.embedded-inspector {
    position: relative;
    min-width: 0;
    height: calc(100vh - 250px);
    border-radius: 8px;
}

.sheet-inspector {
    position: fixed;
    right: 50%;
    bottom: 0;
    width: min(680px, 100%);
    max-height: min(88vh, 820px);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, .46);
    transform: translate(50%, 103%);
    transition: transform 190ms ease;
}

.sheet-inspector.is-open {
    transform: translate(50%, 0);
}

.inspector-scrim {
    position: fixed;
    z-index: 60;
    inset: 0;
    visibility: hidden;
    background: rgba(0, 0, 0, .56);
    opacity: 0;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.inspector-scrim.is-open {
    visibility: visible;
    opacity: 1;
}

.variant-b .inspector-scrim {
    display: none;
}

.inspector-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-height: 72px;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line-soft);
}

.inspector-identity {
    display: grid;
    min-width: 0;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 11px;
}

.inspector-user-id {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 7px;
    background: #2d171c;
    color: #ff7b87;
    font-size: 13px;
    font-weight: 900;
}

.inspector-identity strong,
.inspector-identity span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inspector-identity strong {
    font-size: 14px;
}

.inspector-identity span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
}

.inspector-close {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 6px;
    background: #1c2128;
    color: var(--muted-strong);
}

.embedded-inspector .inspector-close {
    display: none;
}

.inspector-tabs {
    display: flex;
    min-height: 46px;
    padding: 0 10px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line-soft);
    scrollbar-width: none;
}

.inspector-tabs::-webkit-scrollbar {
    display: none;
}

.inspector-tab {
    flex: 0 0 auto;
    padding: 0 10px;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.inspector-tab:hover,
.inspector-tab.is-active {
    color: var(--text);
}

.inspector-tab.is-active {
    border-bottom-color: var(--red-bright);
}

.inspector-body {
    flex: 1;
    min-height: 0;
    padding: 16px;
    overflow: auto;
}

.inspector-section {
    display: grid;
    gap: 15px;
}

.inspector-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.inspector-section-heading h3 {
    margin: 0;
    font-size: 13px;
}

.inspector-section-heading span {
    color: var(--muted);
    font-size: 10px;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
}

.inspector-field {
    display: grid;
    gap: 7px;
}

.inspector-field.full {
    grid-column: 1 / -1;
}

.inspector-field > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.inspector-field input,
.inspector-field textarea {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    resize: vertical;
}

.inspector-field textarea {
    min-height: 88px;
    line-height: 1.45;
}

.segmented-control {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #0e1116;
}

.segmented-control button {
    min-height: 30px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
}

.segmented-control button.is-active {
    background: #2a171c;
    color: #ff8791;
}

.stepper {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    min-height: 38px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #0e1116;
}

.stepper button {
    background: #1d2229;
    color: var(--muted-strong);
}

.stepper output {
    display: grid;
    place-items: center;
    font-weight: 800;
}

.permission-list,
.menu-permission-grid,
.mac-list,
.history-list {
    display: grid;
    gap: 7px;
}

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

.permission-item,
.menu-permission-item,
.mac-item,
.history-item {
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 43px;
    gap: 9px;
    padding: 8px 10px;
    border: 1px solid var(--line-soft);
    border-radius: 6px;
    background: #171b21;
}

.permission-item input,
.menu-permission-item input {
    width: 16px;
    height: 16px;
    accent-color: var(--red);
}

.permission-copy,
.mac-copy,
.history-copy {
    min-width: 0;
    flex: 1;
}

.permission-copy strong,
.permission-copy span,
.mac-copy strong,
.mac-copy span,
.history-copy strong,
.history-copy span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.permission-copy strong,
.mac-copy strong,
.history-copy strong {
    font-size: 11px;
}

.permission-copy span,
.mac-copy span,
.history-copy span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

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

.menu-permission-item {
    min-height: 38px;
    font-size: 10px;
}

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

.mac-add input {
    min-width: 0;
    min-height: 38px;
    padding: 8px 10px;
}

.mac-item button {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 5px;
    background: #2a171b;
    color: #e87882;
}

.history-item {
    align-items: flex-start;
}

.history-marker {
    width: 8px;
    height: 8px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--cyan);
}

.inspector-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 60px;
    gap: 8px;
    padding: 10px 15px;
    border-top: 1px solid var(--line-soft);
    background: #101318;
}

.inspector-footer-spacer,
.dialog-spacer {
    flex: 1 1 auto;
}

.prototype-toast {
    position: fixed;
    z-index: 100;
    top: 18px;
    right: 18px;
    max-width: min(360px, calc(100% - 36px));
    padding: 11px 14px;
    border: 1px solid #315f4b;
    border-radius: 7px;
    background: #12251d;
    color: #8ee1b5;
    box-shadow: var(--shadow);
    font-size: 11px;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.prototype-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.prototype-toast.is-error {
    border-color: #743841;
    background: #2a171b;
    color: #ff9ca5;
}

.entity-dialog {
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 0;
    overflow: hidden;
    border: 1px solid #39414c;
    border-radius: 8px;
    background: var(--panel-strong);
    color: var(--text);
    box-shadow: 0 28px 90px rgba(0, 0, 0, .68);
}

.entity-dialog::backdrop {
    background: rgba(4, 6, 9, .78);
    backdrop-filter: blur(3px);
}

.entity-dialog > form {
    display: flex;
    max-height: calc(100vh - 34px);
    flex-direction: column;
}

.dialog-header,
.dialog-footer,
.confirm-dialog-content {
    display: flex;
    align-items: center;
}

.dialog-header {
    justify-content: space-between;
    gap: 16px;
    padding: 17px 18px;
    border-bottom: 1px solid var(--line-soft);
    background: #11151a;
}

.dialog-header p {
    margin: 0 0 3px;
    color: var(--red-bright);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.dialog-header h2,
.confirm-dialog-content h2 {
    margin: 0;
    font-size: 17px;
}

.dialog-body {
    padding: 18px;
    overflow: auto;
}

.server-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.dialog-footer {
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--line-soft);
    background: #11151a;
}

.confirm-dialog {
    width: min(440px, calc(100vw - 32px));
}

.confirm-dialog-content {
    align-items: flex-start;
    gap: 14px;
    padding: 22px 20px 18px;
}

.confirm-dialog-content p {
    margin: 7px 0 0;
    color: var(--muted-strong);
    line-height: 1.55;
}

.confirm-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 6px;
    background: #361a20;
    color: #f2808a;
    font-size: 17px;
}

@media (max-width: 1100px) {
    :root {
        --sidebar-width: 78px;
    }

    .a-sidebar .prototype-brand > span:last-child,
    .a-sidebar .prototype-nav-button span,
    .a-sidebar .environment-status > div {
        display: none;
    }

    .a-sidebar .prototype-brand {
        justify-content: center;
    }

    .a-sidebar .prototype-nav-button {
        justify-content: center;
        padding: 0;
    }

    .environment-status {
        justify-content: center;
    }

    .b-header {
        grid-template-columns: 200px minmax(0, 1fr) 56px;
    }

    .operator-block > div,
    .operator-block .environment-dot {
        display: none;
    }

    .server-list.grid,
    .server-list.cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .metric-grid,
    .b-command-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .overview-grid {
        grid-template-columns: 1fr;
    }

    .b-header {
        grid-template-columns: 1fr auto;
        padding: 0 14px;
    }

    .b-nav {
        position: fixed;
        z-index: 35;
        right: 50%;
        bottom: 12px;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        width: min(520px, calc(100% - 24px));
        padding: 6px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #15191f;
        box-shadow: var(--shadow);
        transform: translateX(50%);
    }

    .b-nav .prototype-nav-button {
        display: grid;
        min-height: 45px;
        justify-items: center;
        gap: 2px;
        padding: 3px;
        font-size: 9px;
    }

    .b-nav .prototype-nav-button i {
        font-size: 15px;
    }

    .split-workspace {
        grid-template-columns: 1fr;
    }

    .user-rail {
        max-height: none;
    }

    .embedded-inspector {
        position: fixed;
        z-index: 70;
        right: 50%;
        bottom: 0;
        width: min(680px, 100%);
        height: min(88vh, 820px);
        border-radius: 8px 8px 0 0;
        box-shadow: 0 -20px 60px rgba(0, 0, 0, .46);
        transform: translate(50%, 103%);
        transition: transform 190ms ease;
    }

    .embedded-inspector.is-open {
        transform: translate(50%, 0);
    }

    .embedded-inspector .inspector-close,
    .variant-b .inspector-scrim {
        display: inline-grid;
    }

    .filter-bar {
        flex-wrap: wrap;
    }

    .search-field {
        max-width: none;
        flex: 1 1 100%;
    }

    .result-count {
        margin-left: 0;
    }

    .log-item {
        grid-template-columns: 34px 76px minmax(0, 1fr);
    }

    .log-item time {
        display: none;
    }
}

@media (max-width: 620px) {
    .a-shell {
        display: block;
    }

    .a-sidebar {
        position: fixed;
        z-index: 35;
        top: auto;
        right: 12px;
        bottom: 12px;
        left: 12px;
        display: block;
        width: auto;
        height: auto;
        padding: 6px;
        border: 1px solid var(--line);
        border-radius: 8px;
        box-shadow: var(--shadow);
    }

    .a-sidebar .prototype-brand,
    .a-sidebar .environment-status {
        display: none;
    }

    .a-sidebar .prototype-nav {
        grid-template-columns: repeat(4, 1fr);
    }

    .a-sidebar .prototype-nav-button {
        display: grid;
        min-height: 47px;
        justify-items: center;
        gap: 2px;
        padding: 4px;
        font-size: 0;
    }

    .a-sidebar .prototype-nav-button i {
        font-size: 17px;
    }

    .a-topbar {
        height: 58px;
        padding: 0 13px;
    }

    .a-content,
    .b-main {
        padding: 16px 12px 155px;
    }

    .b-command-strip {
        overflow-x: auto;
        grid-template-columns: repeat(4, minmax(145px, 1fr));
    }

    .section-heading h1 {
        font-size: 19px;
    }

    .section-heading .primary-button span,
    .section-heading .secondary-button span {
        display: none;
    }

    .section-heading .primary-button,
    .section-heading .secondary-button {
        width: 38px;
        padding: 0;
    }

    .metric-grid {
        grid-template-columns: 1fr 1fr;
    }

    .metric {
        min-height: 66px;
        padding: 10px;
    }

    .metric > i {
        width: 30px;
        height: 30px;
    }

    .metric strong {
        font-size: 16px;
    }

    .filter-bar select {
        flex: 1 1 calc(50% - 5px);
        min-width: 0;
    }

    .user-card-list,
    .server-list.grid,
    .server-list.cards {
        grid-template-columns: 1fr;
    }

    .server-row {
        grid-template-columns: 44px minmax(140px, 1fr) 36px;
    }

    .server-row > :nth-child(3),
    .server-row > :nth-child(4),
    .server-row > :nth-child(5) {
        display: none;
    }

    .activity-item {
        grid-template-columns: 32px minmax(0, 1fr);
    }

    .activity-item time {
        display: none;
    }

    .field-grid,
    .permission-list,
    .menu-permission-grid,
    .server-form-grid {
        grid-template-columns: 1fr;
    }

    .dialog-footer {
        flex-wrap: wrap;
    }

    .dialog-footer .dialog-spacer {
        display: none;
    }

    .dialog-footer button {
        flex: 1 1 auto;
    }

    .inspector-body {
        padding: 13px;
    }

    .c-main {
        padding-right: 12px;
        padding-left: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
