:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    background: #0a0b10;
    color: #f5f6fa;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, #27223b 0, transparent 34rem),
        #0a0b10;
}

button, input {
    font: inherit;
}

header {
    height: 86px;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #262832;
    background: rgba(10,11,16,.85);
}

h1, h2, p { margin: 0; }

h1 { font-size: 18px; }
h2 { font-size: 20px; }

.brand {
    color: #b49cff;
    font-size: 12px;
    letter-spacing: .3em;
    font-weight: 800;
    margin-bottom: 4px;
}

main {
    max-width: 1500px;
    margin: auto;
    padding: 24px;
}

.servers {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 18px;
}

.server-card {
    min-width: 220px;
    text-align: left;
    padding: 14px 16px;
    border: 1px solid #2a2d38;
    border-radius: 12px;
    background: #13151d;
    color: inherit;
    display: flex;
    gap: 12px;
    align-items: center;
    cursor: pointer;
}

.server-card.selected {
    border-color: #8873d6;
    background: #1a1826;
}

.server-card small {
    display: block;
    color: #8f95a7;
    margin-top: 3px;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #777;
}

.status-dot.online { background: #57d38c; }
.status-dot.offline { background: #e55d68; }

.panel {
    border: 1px solid #292c37;
    border-radius: 14px;
    overflow: hidden;
    background: #11131a;
}

.panel-head {
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #292c37;
}

.muted {
    color: #9298aa;
    font-size: 13px;
}

.controls {
    display: flex;
    gap: 8px;
}

button {
    background: #6656ad;
    color: white;
    border: 0;
    border-radius: 8px;
    padding: 9px 14px;
    cursor: pointer;
}

button.secondary {
    background: #242733;
}

button.danger {
    background: #803c46;
}

button:disabled {
    opacity: .5;
}

.console {
    height: min(65vh, 720px);
    overflow-y: auto;
    padding: 18px;
    background: #08090d;
    color: #d5d8e3;
    font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.console .system {
    color: #9c8de2;
}

.console .command-line {
    color: #79dca1;
}

.console .response {
    color: #8bc8ef;
}

.command {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border-top: 1px solid #292c37;
}

.command span {
    color: #8977d0;
    font-family: monospace;
}

.command input {
    flex: 1;
    background: #0c0e14;
    color: white;
    border: 1px solid #303441;
    border-radius: 8px;
    padding: 11px;
    outline: none;
}

.command input:focus {
    border-color: #8873d6;
}

.login-body {
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(420px, 100%);
    background: #11131a;
    border: 1px solid #292c37;
    border-radius: 16px;
    padding: 30px;
}

.login-card .muted {
    margin: 8px 0 24px;
}

.login-card label {
    display: block;
    margin: 14px 0 6px;
    color: #aeb3c1;
    font-size: 13px;
}

.login-card input {
    width: 100%;
    border: 1px solid #303441;
    background: #090b10;
    color: white;
    border-radius: 8px;
    padding: 11px;
}

.login-card button {
    width: 100%;
    margin-top: 20px;
    padding: 11px;
}

.error {
    background: #45242a;
    border: 1px solid #773a44;
    padding: 10px;
    border-radius: 8px;
    margin-top: 16px;
}

@media (max-width: 700px) {
    header { padding: 0 16px; }
    main { padding: 14px; }

    .panel-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .console {
        height: 60vh;
    }
}

/* === Miya Console Backup Management === */

.account {
    display: flex;
    align-items: center;
    gap: 14px;
}

.account form {
    margin: 0;
}

.backup-panel {
    margin-top: 18px;
    border: 1px solid #292c37;
    border-radius: 14px;
    background: #11131a;
    overflow: hidden;
}

.backup-head {
    padding: 18px;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #292c37;
}

.backup-head p {
    margin-top: 5px;
}

.backup-list {
    padding: 0 18px;
}

.backup-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 15px 0;
    border-bottom: 1px solid #252832;
}

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

.backup-info {
    min-width: 0;
}

.backup-info strong {
    display: block;
    overflow-wrap: anywhere;
    font-size: 14px;
}

.backup-info small {
    display: block;
    color: #9298aa;
    margin-top: 5px;
}

.backup-actions {
    display: flex;
    flex-shrink: 0;
    gap: 8px;
}

.button-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    background: #242733;
    color: white;
    border-radius: 8px;
    padding: 9px 14px;
}

.restore-button {
    background: #6c5430;
}

.backup-empty {
    padding: 24px 0;
    color: #9298aa;
}

.backup-message {
    white-space: pre-wrap;
    padding: 0 18px;
    margin-top: 14px;
    color: #9c8de2;
    font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.backup-message:empty {
    display: none;
}

.error-text {
    color: #ff7f89;
}

.empty-panel {
    padding: 30px;
    color: #9298aa;
}

[hidden] {
    display: none !important;
}

@media (max-width: 700px) {
    .backup-head,
    .backup-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .backup-actions {
        width: 100%;
    }

    .backup-actions > * {
        flex: 1;
        justify-content: center;
        text-align: center;
    }
}

/* === Account / Passwort === */

.secondary-link {
    background: #242733;
    font-size: 14px;
}

.password-card {
    width: min(440px, 100%);
}

.password-card .success {
    background: #1e402e;
    border: 1px solid #34734f;
    color: #8be0aa;
    padding: 10px;
    border-radius: 8px;
    margin-top: 16px;
}

.back-link {
    display: block;
    margin-top: 20px;
    text-align: center;
    color: #a898ea;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

@media (max-width: 700px) {
    .account {
        gap: 8px;
    }

    .account > .muted {
        display: none;
    }

    .secondary-link {
        padding: 8px 10px;
    }
}


/* === Miya Paper Management === */

.paper-panel {
    margin-top: 18px;
    border: 1px solid #292c37;
    border-radius: 14px;
    background: #11131a;
    overflow: hidden;
}

.paper-details {
    padding: 16px 18px 0;
    white-space: pre-wrap;
    color: #c8cbd5;
    font: 13px/1.6 ui-monospace,
          SFMono-Regular,
          Consolas,
          monospace;
}

.paper-details:empty {
    display: none;
}

.paper-actions {
    display: flex;
    gap: 8px;
    padding: 16px 18px 18px;
}

.backup-note {
    margin-top: 7px !important;
    color: #c4b7f4 !important;
    white-space: pre-wrap;
}

@media (max-width: 700px) {
    .paper-actions {
        flex-direction: column;
    }
}

/* === Backup Audit === */

.backup-audit {
    display: block;
    margin-top: 5px;
    color: #aaa3bd !important;
}

