:root {
    --bg-body: #050816;
    --bg-card: #111827;
    --bg-card-alt: #020617;
    --border-subtle: rgba(148, 163, 184, 0.3);
    --accent: #38bdf8;
    --accent-soft: rgba(56, 189, 248, 0.16);
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --danger: #f97373;
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.7);
    --radius-lg: 18px;
    --radius-xl: 22px;
    --radius-pill: 999px;

    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background: radial-gradient(circle at top, #0b1120 0, #020617 45%, #000 100%);
    color: var(--text-main);
    min-height: 100vh;
}

/* Layout */

.page-wrapper {
    min-height: 100vh;
    max-width: 1120px;
    margin: 0 auto;
    padding: 1.25rem 1rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.4rem;
    letter-spacing: 0.03em;
}

.page-main {
    flex: 1;
}

.page-footer {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* Cards & Grid */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.card {
    background: linear-gradient(140deg, var(--bg-card) 0%, var(--bg-card-alt) 100%);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
    padding: 1.1rem 1.2rem;
}

.card h2 {
    margin: 0 0 0.75rem;
    font-size: 1.08rem;
}

.card-login {
    max-width: 420px;
    margin: 4vh auto 0;
}

.card-log {
    margin-top: 1rem;
}

/* Text */

.muted {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.status-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.4rem;
}

.status-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.status-list span {
    color: var(--text-muted);
}

.status-list strong {
    font-weight: 600;
}

/* Forms */

.form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.form-inline {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
    min-width: 220px;
}

.form-field span {
    color: var(--text-muted);
}

input[type="text"],
input[type="password"],
select {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-main);
    padding: 0.55rem 0.75rem;
    font: inherit;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-soft);
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: var(--radius-pill);
    padding: 0.55rem 1.1rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, background 0.08s ease-out, border-color 0.08s ease-out;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #0ea5e9 100%);
    color: #0b1120;
    box-shadow: 0 12px 30px rgba(56, 189, 248, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 40px rgba(56, 189, 248, 0.50);
}

.btn-secondary {
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-main);
    border-color: var(--border-subtle);
}

.btn-secondary:hover {
    border-color: var(--accent);
}

button.btn {
    border-width: 1px;
}

/* Alerts */

.alert {
    border-radius: var(--radius-lg);
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
    margin: 0.6rem 0;
}

.alert-error {
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.5);
    color: #fecaca;
}

/* Header actions */

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.theme-toggle {
    border-radius: var(--radius-pill);
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-subtle);
    background: rgba(15, 23, 42, 0.85);
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
}

/* Logs */

.log-output {
    max-height: 420px;
    overflow: auto;
    background: #020617;
    padding: 0.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.8rem;
    color: #e5e7eb;
}

/* Responsive */

@media (max-width: 720px) {
    .page-wrapper {
        padding-inline: 0.75rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-login {
        margin-top: 2vh;
    }
}
