:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --border: #e6e8ec;
    --text: #0f172a;
    --text-muted: #64748b;
    --accent: #4f46e5;
    --accent-strong: #4338ca;
    --danger: #dc2626;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 24px rgba(15, 23, 42, 0.06);
}

html, body {
    font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

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

h1:focus { outline: none; }

/* ---- buttons ---- */
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-primary:active { transform: translateY(1px); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger:active { transform: translateY(1px); }

/* ---- confirmation modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: grid;
    place-items: center;
    z-index: 100;
    animation: modal-fade 0.12s ease;
}

.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 1.8rem;
    width: 90%;
    max-width: 400px;
    animation: modal-pop 0.14s ease;
}

.modal-card h3 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.modal-card p { color: var(--text-muted); margin: 0 0 1.5rem; word-break: break-word; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; }

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---- generic centered notice (access denied / not authorized) ---- */
.centered-notice {
    max-width: 480px;
    margin: 12vh auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 2.5rem;
    text-align: center;
}

.centered-notice h1 { margin-top: 0; font-size: 1.4rem; }
.centered-notice p { color: var(--text-muted); }

/* ---- home ---- */
.home {
    max-width: 880px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.home-hero {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 2.5rem;
}

.home-hero h1 { margin: 0 0 0.5rem; font-size: 1.9rem; letter-spacing: -0.02em; }
.home-hero p { color: var(--text-muted); font-size: 1.05rem; margin-bottom: 1.5rem; }

.home-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.home-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.3rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.12s ease, transform 0.08s ease;
}

.home-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.home-card h3 { margin: 0.2rem 0 0.4rem; }
.home-card p { color: var(--text-muted); margin: 0; font-size: 0.92rem; }
.home-card-icon { font-size: 1.5rem; }

/* ---- login ---- */
.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 2.5rem;
    text-align: center;
}

.login-mark {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 1rem;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: #fff;
    font-size: 1.5rem;
}

.login-card h1 { font-size: 1.35rem; margin: 0 0 0.35rem; }
.login-card .sub { color: var(--text-muted); margin: 0 0 1.8rem; font-size: 0.95rem; }

.sso-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 0.8rem;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.sso-btn:hover { background: var(--surface-2); border-color: var(--text-muted); }
.sso-btn img, .sso-btn svg { width: 20px; height: 20px; }

.login-foot { margin-top: 1.2rem; font-size: 0.82rem; color: var(--text-muted); }

/* ---- users admin table ---- */
.users-page { max-width: 1000px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.users-page h1 { font-size: 1.6rem; margin-top: 0; }
.users-page .muted { color: var(--text-muted); }

.users-invite {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: end;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.2rem;
    margin: 1.2rem 0 1.8rem;
    box-shadow: var(--shadow);
}

.users-invite label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.users-invite input, .users-invite select {
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 0.92rem;
    min-width: 220px;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.user-table th, .user-table td {
    text-align: left;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.user-table th { background: var(--surface-2); color: var(--text-muted); font-weight: 600; }
.user-table tr:last-child td { border-bottom: none; }

/* ---- data source column editor + inline edit ---- */
.ds-columns { display: flex; flex-direction: column; gap: 0.4rem; }
.ds-column { display: flex; align-items: center; gap: 0.6rem; }
.ds-column-name {
    min-width: 160px;
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-all;
}
.ds-column input {
    flex: 1;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 0.9rem;
}

.ds-edit-row td { background: var(--surface-2); }
.ds-edit { display: flex; flex-direction: column; gap: 0.8rem; padding: 0.6rem 0.2rem; }
.ds-edit-field label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.ds-edit-field input, .ds-edit-field textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    font: inherit;
    font-size: 0.92rem;
}

.pill {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.pill-admin { background: #ede9fe; color: #6d28d9; }
.pill-user { background: #e2e8f0; color: #475569; }
.pill-active { background: #dcfce7; color: #15803d; }
.pill-disabled { background: #fee2e2; color: #b91c1c; }

.row-actions { display: flex; gap: 0.4rem; }
.row-actions button {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    font-size: 0.82rem;
    cursor: pointer;
}
.row-actions button:hover { background: var(--surface-2); }

/* Suppress Blazor's default "An unhandled error has occurred" banner. Uncaught errors are reported to
   the server (→ Loggly) by js/ui.js instead. Overrides the inline display:block Blazor sets on error. */
#blazor-error-ui {
    display: none !important;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 1rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }
