* {
    box-sizing: border-box;
}
body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: #e8eaed;
    background: #121417;
}
.wrap {
    max-width: 42rem;
    margin: 0 auto;
    padding: 1.5rem 1rem 2.5rem;
}
.head h1 {
    margin: 0 0 0.25rem;
    font-size: 1.35rem;
    font-weight: 600;
}
.muted {
    color: #8b9098;
    font-size: 0.9rem;
    margin: 0.25rem 0;
}
.muted.sm {
    margin: 0.5rem 0 0.25rem;
    font-size: 0.85rem;
}
.req-last {
    font-family: ui-monospace, 'Cascadia Mono', monospace;
    font-size: 0.88rem;
    word-break: break-word;
    color: #c4c7ce;
}
code {
    background: #1e2127;
    padding: 0.1em 0.35em;
    border-radius: 3px;
    font-size: 0.9em;
}
.card {
    background: #1a1d24;
    border: 1px solid #2a2f3a;
    border-radius: 8px;
    padding: 1rem 1.1rem;
    margin-top: 1rem;
}
.card h2 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: #c4c7ce;
}
.row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin: 0.5rem 0;
}
.status-pill {
    display: inline-block;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #2a2f3a;
}
.status-pill.on {
    background: #1e3a2f;
    color: #6ee7a0;
}
.status-pill.off {
    background: #3a2a2a;
    color: #f0a8a8;
}
.status-pill.stub {
    background: #2f2f1e;
    color: #e5d28a;
}
.btn {
    font: inherit;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    border: 1px solid #3d4451;
    background: #252a33;
    color: #e8eaed;
    cursor: pointer;
}
.btn:hover {
    background: #2f3640;
}
.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.btn.primary {
    background: #2b4a7a;
    border-color: #3d6bb3;
}
.btn.primary:hover {
    background: #345b94;
}
.btn.danger {
    background: #3a2528;
    border-color: #6b3d44;
    color: #f0b4b4;
}
.btn.danger:hover {
    background: #4a3035;
    border-color: #854850;
}
.btn.sm {
    min-width: 2.2rem;
    padding: 0.35rem 0.5rem;
}
.toggle-row {
    margin-top: 0.25rem;
}
.label {
    min-width: 8rem;
    color: #9aa0a8;
}
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #3d4451;
    border-radius: 26px;
    transition: 0.2s;
}
.slider:before {
    position: absolute;
    content: '';
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #e8eaed;
    border-radius: 50%;
    transition: 0.2s;
}
input:checked + .slider {
    background: #1e4d3a;
}
input:checked + .slider:before {
    transform: translateX(22px);
}
input:disabled + .slider {
    opacity: 0.45;
    cursor: not-allowed;
}
.field-group {
    margin: 0.75rem 0;
}
.field-name {
    display: block;
    font-size: 0.8rem;
    color: #8b9098;
    margin-bottom: 0.35rem;
}
.numfield {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    max-width: 16rem;
}
.num-input {
    flex: 1;
    min-width: 0;
    font: inherit;
    padding: 0.45rem 0.5rem;
    border-radius: 6px;
    border: 1px solid #3d4451;
    background: #12141a;
    color: #e8eaed;
    text-align: center;
}
.num-input:focus {
    outline: none;
    border-color: #5a6b8a;
}
.err {
    color: #f59b9b;
    font-size: 0.9rem;
    margin: 0.5rem 0 0;
}
.ok {
    color: #6ee7a0;
    font-size: 0.9rem;
}
.log-pre {
    margin: 0.5rem 0 0;
    max-height: 20rem;
    overflow: auto;
    padding: 0.75rem;
    background: #12141a;
    border: 1px solid #2a2f3a;
    border-radius: 6px;
    font-size: 0.8rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

body.modal-open {
    overflow: hidden;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(8, 10, 14, 0.72);
    backdrop-filter: blur(4px);
}

.modal-overlay[hidden] {
    display: none;
}

.modal-dialog {
    width: 100%;
    max-width: 22rem;
    background: #1a1d24;
    border: 1px solid #2a2f3a;
    border-radius: 8px;
    padding: 1.1rem 1.15rem 1rem;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.modal-title {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: #c4c7ce;
}

.modal-text {
    margin: 0 0 1rem;
    line-height: 1.45;
}

.modal-actions {
    justify-content: flex-end;
    margin-top: 0.25rem;
}
