:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --border: #e2e5ea;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-bg: #fef2f2;
    --code-bg: #f1f3f5;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.45;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: var(--code-bg);
    padding: 0.1em 0.35em;
    border-radius: 3px;
}
pre {
    padding: 12px 14px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.muted { color: var(--muted); }

/* ---------- topbar ---------- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

/* ---------- layout ---------- */
.container {
    max-width: 980px;
    margin: 32px auto;
    padding: 0 24px;
}
.card {
    max-width: 380px;
    margin: 80px auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.card h1 { margin-top: 0; }
.card-danger {
    max-width: none;
    margin: 24px 0;
    background: var(--danger-bg);
    border-color: #fecaca;
}
.card-danger h2 { margin-top: 0; color: var(--danger); }

/* ---------- forms ---------- */
form label {
    display: block;
    margin-top: 16px;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 14px;
}
form input[type="password"],
form input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--surface);
}
form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

/* ---------- buttons ---------- */
.btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
    margin-top: 20px;
    width: 100%;
}
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: var(--danger-hover); color: #fff; text-decoration: none; }

.btn-ghost { border-color: var(--border); }
.btn-ghost:hover { background: var(--surface); text-decoration: none; }

.btn-large {
    font-size: 16px;
    padding: 12px 22px;
    margin-right: 8px;
}

/* ---------- alerts ---------- */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    margin: 18px 0 0;
}
.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fecaca;
}

/* ---------- trial table ---------- */
.trials {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 24px;
}
.trials th, .trials td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.trials tr:last-child td { border-bottom: 0; }
.trials th {
    background: #fafbfc;
    font-weight: 600;
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.trials .right { text-align: right; }

/* ---------- log block ---------- */
.log {
    margin-top: 36px;
}
.log h2 {
    font-size: 14px;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.04em;
}
.log pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 14px 16px;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.5;
}

.page-login { background: var(--bg); }
