:root {
    --bg-primary: #0f172a;
    --bg-card:    #1e293b;
    --bg-input:   #0b1224;
    --text-primary:   #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;
    --border:    #334155;
    --accent:    #3b82f6;
    --accent-good: #22c55e;
    --accent-warn: #eab308;
    --accent-err:  #ef4444;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-primary);
    color:      var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* ---------------------------------------------------------------- */
/*  Topbar                                                          */
/* ---------------------------------------------------------------- */
.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.brand {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-decoration: none;
}
.brand-mark { color: var(--accent-warn); margin-right: 4px; }
.topbar nav {
    display: flex;
    gap: 14px;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.inline-form { display: inline; }
.btn-link {
    background: transparent;
    color: var(--accent);
    border: none;
    cursor: pointer;
    font: inherit;
    padding: 0;
}
.btn-link:hover { text-decoration: underline; }
.who { color: var(--text-muted); }

/* ---------------------------------------------------------------- */
/*  Main + cards                                                    */
/* ---------------------------------------------------------------- */
.main {
    flex: 1;
    max-width: 1100px;
    width: 100%;
    margin: 32px auto;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 24px;
}

.auth-card {
    max-width: 380px;
    margin: 48px auto;
}
.auth-card h1 {
    font-size: 1.4rem;
    margin-bottom: 18px;
}
.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.auth-card label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.95rem;
    font-family: inherit;
}
.auth-card input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.err {
    color: var(--accent-err);
    font-size: 0.78rem;
    font-style: normal;
    margin-top: 2px;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 11px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    margin-top: 4px;
}
.btn-primary:hover { background: #2563eb; }

.muted { color: var(--text-muted); font-size: 0.85rem; margin-top: 10px; }

/* ---------------------------------------------------------------- */
/*  Flash messages                                                  */
/* ---------------------------------------------------------------- */
.flash-stack { display: flex; flex-direction: column; gap: 8px; }
.flash {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.9rem;
    background: var(--bg-card);
}
.flash-info  { border-color: rgba(59, 130, 246, 0.4);  color: #93c5fd; }
.flash-error { border-color: rgba(239, 68, 68, 0.4);   color: #fca5a5; }

/* ---------------------------------------------------------------- */
/*  Portal — systems grid                                           */
/* ---------------------------------------------------------------- */
.hero {
    padding: 8px 4px 4px;
}
.hero h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.system-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--text-primary);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: transform 0.12s ease, border-color 0.12s ease;
}
.system-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    text-decoration: none;
}
.system-accent {
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--accent, var(--accent));
}
.system-card h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent);
    color: var(--accent, var(--accent));
}
.system-card[style*="--accent"] h2 { color: var(--accent); }
.system-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.system-cta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ---------------------------------------------------------------- */
/*  Footer                                                          */
/* ---------------------------------------------------------------- */
.footer {
    text-align: center;
    padding: 18px;
    color: var(--text-muted);
    font-size: 0.78rem;
    border-top: 1px solid var(--border);
    margin-top: 30px;
}
