* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

code {
    font-family: var(--font-mono);
    font-size: 0.92em;
}

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

.shell-app {
    display: flex;
    flex-direction: column;
    width: min(100%, 1600px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 0 24px;
}

.shell-header {
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 64px;
    border-bottom: 1px solid var(--border-subtle);
}

.shell-brand {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

.shell-logo {
    width: 104px;
    height: auto;
}

.shell-context {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 1px;
}

.shell-context-name {
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shell-context-host {
    overflow: hidden;
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shell-header-meta {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-left: auto;
    color: var(--text-faint);
    font-size: 12px;
    white-space: nowrap;
}

.shell-header-label {
    color: var(--text-muted);
}

.shell-header-link {
    color: var(--text-faint);
    text-decoration: underline;
    text-decoration-color: var(--border-default);
    text-underline-offset: 3px;
}

.shell-header-link:hover {
    color: var(--text-secondary);
}

.shell-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: auto;
    padding: 16px 0 20px;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-faint);
    font-size: 11px;
    line-height: 1.5;
}

.shell-footer a {
    color: var(--text-muted);
}

.shell-footer a:hover {
    color: var(--text-secondary);
}

.shell-gate {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    align-items: center;
    flex: 1;
    width: min(100%, 960px);
    margin: 0 auto;
    padding: 56px 0;
}

.shell-gate-copy {
    min-width: 0;
    padding-right: 56px;
}

.shell-gate-copy h1 {
    margin: 0 0 12px;
    font-size: 38px;
    font-weight: 300;
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.shell-gate-copy h1 span {
    color: var(--text-muted);
}

.shell-gate-copy p {
    max-width: 48ch;
    margin: 0 0 24px;
    color: var(--text-tertiary);
    font-size: 15px;
    line-height: 1.65;
}

.shell-facts {
    max-width: 520px;
    margin: 0;
}

.shell-fact {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 24px;
    padding: 9px 0;
    border-top: 1px solid var(--border-subtle);
}

.shell-fact:last-child {
    border-bottom: 1px solid var(--border-subtle);
}

.shell-fact dt {
    color: var(--text-faint);
    font-size: 12px;
}

.shell-fact dd {
    max-width: 62%;
    margin: 0;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 13px;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shell-fact dd.mono {
    font-family: var(--font-mono);
    font-size: 12px;
}

.shell-gate-access {
    min-width: 0;
    padding-left: 56px;
    border-left: 1px solid var(--border-subtle);
}

.shell-gate-access h2 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.3;
}

.shell-gate-access > p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
}

.shell-form {
    margin-top: 24px;
}

.shell-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 14px;
}

.shell-field label {
    color: var(--text-tertiary);
    font-size: 12px;
}

.shell-input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border-default);
    border-radius: 2px;
    outline: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 15px;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.shell-input:hover {
    border-color: var(--border-strong);
}

.shell-input:focus {
    border-color: var(--text-muted);
    background: var(--bg-primary);
}

.shell-input::placeholder {
    color: var(--text-faint);
}

.shell-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--accent-primary);
    border-radius: 2px;
    background: var(--accent-primary);
    color: var(--bg-primary);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.shell-form .shell-button {
    width: 100%;
    height: 42px;
}

.shell-button:hover {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
}

.shell-button:focus-visible {
    outline: 2px solid var(--text-muted);
    outline-offset: 2px;
}

.shell-button-secondary {
    border-color: var(--border-default);
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
}

.shell-button-secondary:hover {
    border-color: var(--border-strong);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.shell-alert {
    margin: 16px 0 0;
    padding: 10px 12px;
    border: 1px solid #7f1d1d;
    border-left: 2px solid var(--status-error);
    border-radius: 2px;
    background: #1a0d0d;
    color: #fca5a5;
    font-size: 13px;
    line-height: 1.5;
}

.shell-note {
    margin: 16px 0 0;
    color: var(--text-faint);
    font-size: 12px;
    line-height: 1.6;
}

.shell-admin {
    flex: 1;
    width: min(100%, 1220px);
    margin: 0 auto;
    padding: 40px 0 52px;
}

.shell-admin-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 28px;
}

.shell-admin-title {
    min-width: 0;
}

.shell-eyebrow {
    margin: 0 0 8px;
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    line-height: 1.3;
    text-transform: uppercase;
}

.shell-admin-title h1 {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 38px;
    font-weight: 300;
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.shell-admin-host {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0 0;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 12px;
}

.shell-admin-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 20px;
}

.shell-action-form {
    display: inline-flex;
    margin: 0;
}

.shell-notice {
    margin: 0 0 20px;
    padding: 11px 14px;
    border: 1px solid var(--border-default);
    border-left: 2px solid var(--status-success);
    border-radius: 2px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.shell-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 21px;
    padding: 1px 7px;
    border: 1px solid var(--border-default);
    border-radius: 2px;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.3;
    text-transform: lowercase;
    white-space: nowrap;
}

.shell-badge::before {
    width: 5px;
    height: 5px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--text-faint);
    content: "";
}

.shell-badge-ok {
    border-color: #14532d;
    color: #86efac;
}

.shell-badge-ok::before {
    background: var(--status-success);
}

.shell-badge-warn {
    border-color: #713f12;
    color: #fde047;
}

.shell-badge-warn::before {
    background: var(--status-warning);
}

.shell-badge-bad {
    border-color: #7f1d1d;
    color: #fca5a5;
}

.shell-badge-bad::before {
    background: var(--status-error);
}

.shell-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.shell-stat {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 4px;
    padding: 17px 18px;
    border-left: 1px solid var(--border-subtle);
}

.shell-stat:first-child {
    border-left: 0;
}

.shell-stat-label {
    color: var(--text-faint);
    font-size: 11px;
    line-height: 1.3;
}

.shell-stat strong {
    overflow: hidden;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shell-stat span:last-child {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.4;
}

.shell-admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
    align-items: start;
    gap: 20px;
    margin-top: 20px;
}

.shell-admin-aside {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.shell-panel {
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.shell-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.shell-panel-head h2 {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.shell-panel-head p {
    margin: 3px 0 0;
    color: var(--text-faint);
    font-size: 11px;
    line-height: 1.45;
}

.shell-panel-link {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 11px;
    text-decoration: underline;
    text-decoration-color: var(--border-default);
    text-underline-offset: 3px;
}

.shell-panel-link:hover {
    color: var(--text-secondary);
}

.shell-table-wrap {
    overflow-x: auto;
}

.shell-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: left;
}

.shell-table th {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-faint);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.shell-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-tertiary);
    vertical-align: middle;
    white-space: nowrap;
}

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

.shell-table td.mono {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
}

.shell-table code {
    color: var(--text-secondary);
}

.shell-table-empty {
    padding: 28px 18px !important;
    color: var(--text-faint) !important;
    text-align: center;
    white-space: normal !important;
}

.shell-domain-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.shell-domain {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.shell-domain:last-child {
    border-bottom: 0;
}

.shell-domain-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.shell-domain-copy strong {
    overflow: hidden;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shell-domain-copy span {
    color: var(--text-faint);
    font-size: 10px;
}

.shell-env-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 14px 18px 18px;
}

.shell-env-key {
    max-width: 100%;
    overflow: hidden;
    padding: 3px 6px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shell-empty {
    margin: 0;
    padding: 16px 18px;
    color: var(--text-faint);
    font-size: 12px;
    line-height: 1.5;
    list-style: none;
}

.shell-empty-pad {
    padding: 22px 18px;
}

.shell-panel-log {
    margin-top: 20px;
}

.shell-log {
    max-height: 300px;
    margin: 0;
    padding: 14px 18px 18px;
    overflow: auto;
    background: #070708;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.6;
    tab-size: 4;
    white-space: pre;
    scrollbar-color: var(--border-default) transparent;
}

.shell-log::selection {
    background: var(--border-strong);
    color: var(--text-primary);
}

@media (max-width: 1040px) {
    .shell-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .shell-stat:nth-child(3) {
        border-top: 1px solid var(--border-subtle);
        border-left: 0;
    }

    .shell-stat:nth-child(4) {
        border-top: 1px solid var(--border-subtle);
    }
}

@media (max-width: 860px) {
    .shell-gate {
        grid-template-columns: 1fr;
        align-items: start;
        padding: 40px 0;
    }

    .shell-gate-copy {
        padding: 0 0 36px;
    }

    .shell-gate-copy h1 {
        font-size: 32px;
    }

    .shell-gate-access {
        padding: 28px 0 0;
        border-top: 1px solid var(--border-subtle);
        border-left: 0;
    }

    .shell-admin-head {
        flex-direction: column;
        gap: 12px;
    }

    .shell-admin-actions {
        width: 100%;
        padding-top: 0;
    }

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

@media (max-width: 600px) {
    .shell-app {
        padding: 0 14px;
    }

    .shell-header {
        gap: 12px;
        min-height: 56px;
    }

    .shell-logo {
        width: 92px;
    }

    .shell-context-name {
        font-size: 12px;
    }

    .shell-context-host {
        font-size: 10px;
    }

    .shell-header-meta {
        gap: 10px;
        font-size: 11px;
    }

    .shell-header-label {
        display: none;
    }

    .shell-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 12px 0 16px;
    }

    .shell-gate {
        padding: 28px 0;
    }

    .shell-gate-copy {
        padding-bottom: 28px;
    }

    .shell-gate-copy h1 {
        font-size: 28px;
    }

    .shell-gate-copy p {
        font-size: 14px;
    }

    .shell-fact {
        gap: 16px;
    }

    .shell-fact dd {
        max-width: 58%;
    }

    .shell-gate-access {
        padding-top: 24px;
    }

    .shell-admin {
        padding: 28px 0 36px;
    }

    .shell-admin-title h1 {
        font-size: 30px;
    }

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

    .shell-admin-actions .shell-action-form,
    .shell-admin-actions .shell-button {
        width: 100%;
    }

    .shell-admin-actions .shell-action-form .shell-button {
        width: 100%;
    }

    .shell-stats {
        grid-template-columns: 1fr;
    }

    .shell-stat,
    .shell-stat:nth-child(3),
    .shell-stat:nth-child(4) {
        border-top: 1px solid var(--border-subtle);
        border-left: 0;
    }

    .shell-stat:first-child {
        border-top: 0;
    }

    .shell-panel-head {
        padding: 14px;
    }

    .shell-table th,
    .shell-table td {
        padding: 9px 12px;
    }

    .shell-domain {
        padding: 11px 14px;
    }

    .shell-env-list {
        padding: 12px 14px 14px;
    }

    .shell-log {
        padding: 12px 14px 14px;
        font-size: 10px;
    }
}
