/* Palette tokens come from theme.css() (inline <style>). Fallbacks only for pages
   that never call theme — do not reload this file after theme.css() or dark breaks. */
:root {
    --theme-bg: #f5f7fa;
    --theme-surface: #ffffff;
    --theme-ink: #1a2332;
    --theme-muted: #6b7c8f;
    --theme-accent: #1b4f9c;
    --theme-accent-ink: #ffffff;
    --theme-line: #d8dee6;
    --theme-radius: 8px;
    --theme-space: 12px;
    --theme-pattern-opacity: 0.08;
    --brand-cyan: var(--theme-accent);
    --brand-cobalt: var(--theme-accent);
    --brand-steel: var(--theme-ink);
    --glass-bg: var(--theme-surface);
    --glass-border: var(--theme-line);
    --field-bg: var(--theme-surface);
    --muted: var(--theme-muted);
    --page-top: var(--theme-bg);
    --page-mid: var(--theme-bg);
    --page-bot: var(--theme-surface);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    color: var(--theme-ink);
    background: var(--theme-bg);
    font-family: Candara, "Segoe UI", "Trebuchet MS", sans-serif;
    line-height: 1.45;
}

.theme-pattern {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.theme-pattern-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.page {
    position: relative;
    z-index: 1;
    max-width: 72ch;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 2rem;
}

.page:has(.login-shell) {
    max-width: none;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

a {
    color: var(--theme-accent);
}

/* —— Login (single column) —— */

.login-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.login-panel {
    width: 100%;
    max-width: 22rem;
    padding: 2rem 1.5rem 2.25rem;
    border: 1px solid var(--theme-line);
    border-radius: calc(var(--theme-radius) + 8px);
    background: var(--theme-surface);
    box-shadow: 0 16px 40px rgba(26, 35, 50, 0.08);
}

.login-brand {
    display: block;
    width: auto;
    height: 80px;
    /* was 40px — 2× brand mark */
    max-width: 100%;
    margin: 0 auto 1.5rem;
    object-fit: contain;
}

.login-panel>h1 {
    margin: 0 0 0.4rem;
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--theme-ink);
}

a.login-lead,
.login-lead,
a.login-back {
    display: block;
    margin: 0 0 1.25rem;
    text-align: center;
    font-size: 0.95rem;
    color: var(--theme-accent);
    text-decoration: none;
    font-weight: 600;
}

p.login-lead {
    color: var(--theme-muted);
    font-weight: 400;
}

a.login-lead:hover,
a.login-back:hover {
    text-decoration: underline;
}

.md-form.login-form {
    max-width: none;
    margin: 0;
}

.md-form.login-form .form-title {
    margin: 0 0 0.85rem;
    color: #b33;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
}

.md-form.login-form .md-field {
    margin: 0.85rem 0;
}

.md-form.login-form .md-field>label {
    display: none;
}

.md-form.login-form .md-field input:not([type=hidden]) {
    width: 100%;
    padding: 0.9rem 2.6rem 0.9rem 1rem;
    border: 1px solid var(--theme-line);
    border-radius: var(--theme-radius);
    background-color: var(--theme-bg);
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 1.15rem 1.15rem;
    color: var(--theme-ink);
    font: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.md-form.login-form .md-field input:focus {
    border-color: var(--theme-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-accent) 22%, transparent);
}

.md-form.login-form .md-field input.field-user {
    background-image: url("/svg/user.svg");
}

.md-form.login-form .md-field input.field-lock {
    background-image: url("/svg/lock.svg");
}

.md-form.login-form .login-forgot-wrap {
    margin: 0.15rem 0 0.85rem;
    text-align: right;
}

.md-form.login-form .login-forgot {
    font-size: 0.9rem;
    color: var(--theme-muted);
    text-decoration: none;
}

.md-form.login-form .login-forgot:hover {
    color: var(--theme-accent);
}

.md-form.login-form button[type=submit] {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.95rem 1rem;
    border: none;
    border-radius: var(--theme-radius);
    background: var(--theme-accent);
    color: var(--theme-accent-ink);
    font: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease;
}

.md-form.login-form button[type=submit]:hover {
    filter: brightness(1.06);
}

.md-form.login-form button[type=submit]:active {
    transform: translateY(1px);
}

.login-social {
    margin: 1.5rem 0 0;
    text-align: center;
}

.login-social-label {
    margin: 0 0 0.9rem;
    color: var(--theme-muted);
    font-size: 0.9rem;
}

.login-social-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.1rem;
    height: 3.1rem;
    border-radius: 50%;
    border: 1px solid var(--theme-line);
    background: var(--theme-bg);
    text-decoration: none;
    transition: transform 0.15s ease;
}

.login-social-google:hover {
    transform: translateY(-1px);
}

.login-social-google img {
    width: 1.45rem;
    height: 1.45rem;
    display: block;
}

.login-theme-switch {
    margin: 1.25rem 0 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--theme-muted);
}

.login-theme-switch a,
.login-theme-switch span {
    display: inline;
    color: var(--theme-muted);
    text-decoration: none;
}

.login-theme-switch a:hover {
    color: var(--theme-accent);
}

.login-version {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 1rem;
    margin: 0;
    text-align: center;
    font-size: 0.75rem;
    color: var(--theme-muted);
    letter-spacing: 0.02em;
}

/* —— Hub / settings —— */

.hub-chrome {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    max-width: 56rem;
    margin: 0 auto;
}

.hub-avatar {
    display: block;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--theme-line);
    background: var(--theme-surface);
}

.hub-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hub-chrome-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--theme-muted);
    font-size: 0.95rem;
}

.hub-page {
    position: relative;
    z-index: 1;
    max-width: 56rem;
    margin: 0 auto;
    padding: 0.5rem 1.25rem 2.5rem;
}

.hub-title {
    margin: 0 0 1.25rem;
    font-size: 1.6rem;
    font-weight: 600;
}

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
    gap: 1rem;
}

.hub-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    text-decoration: none;
    color: var(--theme-ink);
    border-radius: var(--theme-radius);
    transition: background 0.15s ease, transform 0.15s ease;
}

.hub-tile:hover {
    background: var(--theme-surface);
    transform: translateY(-2px);
}

.hub-tile-icon {
    width: 3rem;
    height: 3rem;
    display: block;
}

.hub-tile-label {
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.25;
}

.settings-avatar-preview img {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--theme-line);
}

.settings-form,
.admin-create {
    max-width: 28rem;
}

.admin-users-json {
    overflow: auto;
    font-size: 0.8rem;
    background: var(--theme-surface);
    border: 1px solid var(--theme-line);
    padding: 0.75rem;
    border-radius: var(--theme-radius);
}

/* —— About —— */

.about-page .about-user {
    margin: 0 0 1.25rem;
    color: var(--theme-muted);
    font-size: 0.95rem;
}

.about-table {
    width: 100%;
    max-width: 40rem;
    border-collapse: collapse;
    margin: 0 0 1.5rem;
    background: var(--theme-surface);
    border: 1px solid var(--theme-line);
    border-radius: var(--theme-radius);
    overflow: hidden;
}

.about-table th,
.about-table td {
    padding: 0.65rem 0.9rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--theme-line);
}

.about-table tr:last-child th,
.about-table tr:last-child td {
    border-bottom: none;
}

.about-table th {
    width: 36%;
    color: var(--theme-muted);
    font-weight: 600;
    background: transparent;
}

.about-table td {
    font-family: Consolas, "Segoe UI Mono", monospace;
    font-size: 0.92rem;
    word-break: break-word;
}

.about-links {
    margin: 0;
    font-size: 0.95rem;
}

.about-links a {
    text-decoration: none;
}

.about-links a:hover {
    text-decoration: underline;
}