:root {
    --brand-primary: #24264c;
    --brand-secondary: #1f203f;
    --brand-accent: #2a59dd;
    --brand-accent-strong: #1f4fcf;
    --surface-main: #101224;
    --surface-card: rgba(31, 32, 63, 0.84);
    --surface-card-border: rgba(255, 255, 255, 0.12);
    --surface-muted: rgba(255, 255, 255, 0.06);
    --text-primary: #f5f7ff;
    --text-secondary: rgba(245, 247, 255, 0.76);
    --text-muted: rgba(245, 247, 255, 0.62);
    --success: #24b47e;
    --danger: #f05252;
    --warning: #f5a524;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-card: 0 18px 40px rgba(0, 0, 0, 0.28);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Poppins", "Inter", "Segoe UI", Arial, sans-serif;
    color: var(--text-primary);
    background:
        radial-gradient(1000px 420px at 0% -15%, rgba(42, 89, 221, 0.28), transparent 62%),
        linear-gradient(180deg, #13162d 0%, var(--surface-main) 58%);
    line-height: 1.5;
    padding: 24px;
}

a {
    color: inherit;
}

.page-shell {
    width: min(980px, 100%);
    margin: 0 auto;
}

.app-card {
    background: linear-gradient(165deg, rgba(36, 38, 76, 0.95), rgba(18, 21, 46, 0.96));
    border: 1px solid var(--surface-card-border);
    border-radius: 20px;
    box-shadow: var(--shadow-card);
    min-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
}

.app-card__body {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    flex: 1;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: auto;
    height: 34px;
    max-width: 180px;
    object-fit: contain;
}

.brand-fallback {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    background: linear-gradient(135deg, var(--brand-accent), #4f74df);
}

.app-title {
    margin: 0;
    font-size: clamp(1.1rem, 1rem + 0.5vw, 1.4rem);
    line-height: 1.25;
    font-weight: 600;
}

.app-tagline {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.status-pill {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 999px;
    padding: 6px 12px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.status-pill.connected {
    background: rgba(36, 180, 126, 0.16);
    color: #7bf2c3;
    border-color: rgba(36, 180, 126, 0.5);
}

.status-pill.disconnected {
    background: rgba(240, 82, 82, 0.16);
    color: #ffb0b0;
    border-color: rgba(240, 82, 82, 0.5);
}

.status-pill.pending {
    background: rgba(245, 165, 36, 0.16);
    color: #ffd28b;
    border-color: rgba(245, 165, 36, 0.45);
}

.description {
    border: 1px solid var(--surface-card-border);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
    padding: 20px;
}

.description h2,
.connection-panel h2 {
    margin: 0 0 12px;
    font-size: 1.02rem;
    font-weight: 600;
}

.description p {
    margin: 0;
    color: var(--text-secondary);
    max-width: 72ch;
}

.connection-panel {
    border: 1px solid var(--surface-card-border);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
    padding: 20px;
    display: grid;
    gap: 16px;
}

.connection-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
}

.meta-item {
    min-width: 180px;
}

.meta-label {
    display: block;
    font-size: 0.76rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}

.meta-value {
    font-size: 0.94rem;
    color: var(--text-primary);
}

.action-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    appearance: none;
    border: 0;
    border-radius: 10px;
    padding: 10px 16px;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 120ms ease, opacity 120ms ease, background-color 120ms ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.btn:focus-visible,
.text-link:focus-visible {
    outline: 2px solid #8eadff;
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-accent) 0%, var(--brand-accent-strong) 100%);
    color: #ffffff;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.btn-danger {
    background: rgba(240, 82, 82, 0.14);
    color: #ffc7c7;
    border: 1px solid rgba(240, 82, 82, 0.42);
}

.text-link {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
}

.text-link:hover {
    color: var(--text-secondary);
    text-decoration: underline;
}

.hint-text {
    margin: 0;
    font-size: 0.86rem;
    color: var(--text-muted);
}

.feedback {
    margin: 0;
    font-size: 0.88rem;
}

.feedback.success {
    color: #98f7d3;
}

.feedback.error {
    color: #ffb3b3;
}

.legal-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 16px;
    display: flex;
    gap: 14px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 8, 18, 0.72);
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 50;
}

.modal {
    width: min(460px, 100%);
    background: linear-gradient(165deg, rgba(37, 40, 78, 0.98), rgba(19, 22, 47, 0.98));
    border: 1px solid var(--surface-card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 20px;
}

.modal h3 {
    margin: 0 0 8px;
    font-size: 1.04rem;
}

.modal p {
    margin: 0 0 18px;
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 768px) {
    body {
        padding: 14px;
    }

    .app-card {
        min-height: calc(100vh - 28px);
    }

    .app-card__body {
        padding: 18px;
        gap: 16px;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .connection-meta {
        gap: 12px;
    }
}

.description {
    line-height: 1.6;
}

.description h2 {
    margin-bottom: 12px;
}

.description h3 {
    margin-top: 16px;
    margin-bottom: 8px;
}

.description p {
    margin-bottom: 10px;
    color: #ffffff;
}

.description ul {
    margin-left: 20px;
    margin-bottom: 12px;
}

.description li {
    margin-bottom: 6px;
}