/* Blob portal - shared styling for all modules and for the allauth pages.

   Design tokens: the primary scale is the one of the Unfold admin (UNFOLD["COLORS"] in settings):
   600 = #2a4a80, 800 = #162a53. Light or dark follows the system setting unless the visitor picked one
   with the toggle (html[data-theme]). Inter comes from Unfold's static files, never from a CDN. */

:root {
    --navy: #162a53;
    --navy-deep: #0f1d3a;
    --navy-mid: #2a4a80;
    --bg: #f6f7fa;
    --panel: #ffffff;
    --ink: #1b2435;
    --ink-soft: #46506a;
    --muted: #6b7390;
    --line: #d7dce7;
    --hairline: #e6e9f1;
    --tint: #e8eefa;
    --link: #1f4e93;
    --link-hover: #14356a;
    --btn-bg: #2a4a80;
    --btn-bg-hover: #162a53;
    --btn-ink: #ffffff;
    --th-bg: #162a53;
    --th-ink: #f2f5fb;
    --nav-active-bg: #e8eefa;
    --nav-active-ink: #2a4a80;
    --amber: #8a5d0f;
    --amber-tint: #f9eed6;
    --danger: #9a2f26;
    --danger-tint: #f8e8e6;
    --success: #1a6b4d;
    --success-tint: #e3f2ec;
    --logo-ink: #162a53;
    --shadow: 0 18px 40px rgba(10, 20, 45, 0.28);
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --serif: var(--sans);
    --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
    --radius: 6px;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0d1424;
        --panel: #151e33;
        --ink: #e6ebf5;
        --ink-soft: #b2bdd5;
        --muted: #8f9bb8;
        --line: #2b3856;
        --hairline: #222d48;
        --tint: #1c2845;
        --link: #8fb0f0;
        --link-hover: #b4cbf7;
        --btn-bg: #3a5fa5;
        --btn-bg-hover: #4a72bd;
        --th-bg: #1c2845;
        --nav-active-bg: #1c2845;
        --nav-active-ink: #a9c3f5;
        --amber: #e3b866;
        --amber-tint: #3a2e14;
        --danger: #f0968c;
        --danger-tint: #3b1d1a;
        --success: #6fcaa4;
        --success-tint: #12332a;
        --logo-ink: #ffffff;
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0d1424;
    --panel: #151e33;
    --ink: #e6ebf5;
    --ink-soft: #b2bdd5;
    --muted: #8f9bb8;
    --line: #2b3856;
    --hairline: #222d48;
    --tint: #1c2845;
    --link: #8fb0f0;
    --link-hover: #b4cbf7;
    --btn-bg: #3a5fa5;
    --btn-bg-hover: #4a72bd;
    --th-bg: #1c2845;
    --nav-active-bg: #1c2845;
    --nav-active-ink: #a9c3f5;
    --amber: #e3b866;
    --amber-tint: #3a2e14;
    --danger: #f0968c;
    --danger-tint: #3b1d1a;
    --success: #6fcaa4;
    --success-tint: #12332a;
    --logo-ink: #ffffff;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: var(--sans);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
}
a { color: var(--link); }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.skip-link {
    position: absolute;
    left: 8px;
    top: -48px;
    z-index: 100;
    background: var(--btn-bg);
    color: var(--btn-ink);
    padding: 8px 14px;
    border-radius: var(--radius);
}
.skip-link:focus { top: 8px; color: var(--btn-ink); }

/* The logo is one white SVG used as a mask; --logo-ink gives it the colour of the theme.
   The -webkit- properties are for Safari. */
.blob-logo {
    display: block;
    background-color: var(--logo-ink);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: left center;
    mask-position: left center;
    -webkit-mask-size: contain;
    mask-size: contain;
}
.blob-logo-mark {
    aspect-ratio: 1185 / 372;
    -webkit-mask-image: url("../img/blob-logo-white-mark.31e0dbff76bc.svg");
    mask-image: url("../img/blob-logo-white-mark.31e0dbff76bc.svg");
}
.blob-logo-full {
    aspect-ratio: 1185 / 507;
    -webkit-mask-image: url("../img/blob-logo-white.411781475b9f.svg");
    mask-image: url("../img/blob-logo-white.411781475b9f.svg");
}

/* The Blob icon is shown as a square with rounded corners. */
.app-icon { width: 36px; height: 36px; border-radius: 22%; display: block; }

/* --- Application shell: sidebar plus content pane ---------------------
   The content comes first in the markup; on a wide screen the sidebar is moved to the left with
   `order`. On a narrow screen the sidebar slides in behind the menu button (only when scripts run;
   without them it simply follows the content). */

body.app-shell { display: flex; min-height: 100vh; }

.topbar { display: none; }

.sidebar {
    order: -1;
    width: 264px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--panel);
    color: var(--ink-soft);
    border-right: 1px solid var(--line);
    padding: 28px 20px;
}
.sidebar .blob-logo { width: 160px; margin: 0 0 28px; }
.sidebar .module-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--ink);
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--hairline);
}
.sidebar nav a {
    display: block;
    padding: 9px 10px;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--ink-soft);
    font-size: 0.88rem;
}
.sidebar nav a:hover { background: var(--tint); color: var(--ink); }
.sidebar nav a.active { background: var(--nav-active-bg); color: var(--nav-active-ink); font-weight: 600; }
.sidebar .sidebar-foot {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--hairline);
    font-size: 0.8rem;
    color: var(--muted);
}
.sidebar .sidebar-foot a { color: var(--link); }

.theme-toggle {
    display: block;
    margin-top: 12px;
    background: none;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink-soft);
    font: inherit;
    font-size: 0.8rem;
    padding: 6px 10px;
    cursor: pointer;
}
.theme-toggle:hover { background: var(--tint); }
.no-js .theme-toggle { display: none; }
.entrance-foot .theme-toggle { margin-top: 8px; }

main.main-pane { flex: 1; min-width: 0; padding: 44px 56px 72px; max-width: 1180px; }

.scrim { display: none; }

/* --- Entrance pages: login, passkey prompts --------------------------- */

body.entrance {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
}
.entrance-card {
    width: 100%;
    max-width: 420px;
    background: var(--panel);
    border-radius: 6px;
    padding: 36px 36px 32px;
    box-shadow: var(--shadow);
}
.entrance-card .blob-logo { width: 190px; margin: 0 0 14px; }
.entrance-foot {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--hairline);
    font-size: 0.82rem;
    color: var(--muted);
}

/* --- Typography ------------------------------------------------------- */

.eyebrow {
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--link);
    margin-bottom: 6px;
}
h1, h1.page-title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 1.9rem;
    margin: 0 0 8px;
}
.entrance-card h1 { font-size: 1.5rem; margin-bottom: 16px; }
h2 { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; }
.status-line { font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 26px; }

/* --- Notices ---------------------------------------------------------- */

.notice {
    font-size: 0.86rem;
    line-height: 1.5;
    padding: 12px 16px;
    border-left: 2px solid var(--link);
    background: var(--tint);
    color: var(--ink-soft);
    margin-bottom: 20px;
}
.notice.warn, .notice.warning {
    border-left-color: var(--amber);
    background: var(--amber-tint);
    color: var(--amber);
}
.notice.error {
    border-left-color: var(--danger);
    background: var(--danger-tint);
    color: var(--danger);
}
.notice.success {
    border-left-color: var(--success);
    background: var(--success-tint);
    color: var(--success);
}

/* --- Tables ----------------------------------------------------------- */

table.data {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--line);
    font-size: 0.9rem;
}
table.data th {
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--th-ink);
    background: var(--th-bg);
    padding: 10px 14px;
}
table.data td { padding: 11px 14px; border-top: 1px solid var(--hairline); vertical-align: top; }
table.data tbody tr:hover { background: var(--tint); }

.tag {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
    white-space: nowrap;
}
.tag-sub { background: var(--tint); color: var(--link); }
.tag-hidden { background: var(--amber-tint); color: var(--amber); }

.empty {
    background: var(--panel);
    border: 1px solid var(--line);
    padding: 32px;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

/* --- Forms and buttons ------------------------------------------------ */

label { display: block; font-size: 0.86rem; font-weight: 500; margin-bottom: 5px; }
input[type=text],
input[type=email],
input[type=password],
input[type=number],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-family: var(--sans);
    font-size: 0.92rem;
    background: var(--panel);
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--link);
    box-shadow: 0 0 0 3px var(--tint);
}
input[type=checkbox] { width: auto; margin-right: 6px; }
form p { margin: 0 0 16px; }
form p label { margin-bottom: 5px; }
.helptext { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
ul.errorlist {
    list-style: none;
    padding: 0;
    margin: 0 0 8px;
    font-size: 0.82rem;
    color: var(--danger);
}

.btn,
button[type=submit],
button.primaryAction {
    border: none;
    border-radius: 4px;
    padding: 10px 18px;
    font-family: var(--sans);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--btn-bg);
    color: var(--btn-ink);
}
.btn:hover,
button[type=submit]:hover { background: var(--btn-bg-hover); }
.btn-secondary {
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--line);
}
.btn-secondary:hover { background: var(--tint); border-color: var(--link); }
.btn-clear {
    background: none;
    color: var(--link);
    font-size: 0.84rem;
    text-decoration: none;
    padding: 10px 4px;
}

/* --- Account management pages (MFA, passkeys) ------------------------- */

.account-nav {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 0.84rem;
    margin-bottom: 26px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--hairline);
}
.account-body { max-width: 640px; }
.account-body ul { padding-left: 20px; }
.account-body li { margin-bottom: 6px; }

@media (max-width: 820px) {
    body.app-shell { display: block; }
    .topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        position: sticky;
        top: 0;
        z-index: 30;
        padding: 10px 16px;
        background: var(--panel);
        border-bottom: 1px solid var(--line);
    }
    .topbar .brand { font-weight: 600; color: var(--ink); }
    .menu-button {
        background: none;
        border: 0;
        padding: 0;
        cursor: pointer;
        line-height: 0;
        border-radius: 22%;
    }
    .no-js .menu-button { display: none; }
    main.main-pane { padding: 24px 16px 56px; }
    .sidebar { width: 100%; height: auto; position: static; border-right: 0; border-top: 1px solid var(--line); }
    .js .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 50;
        width: min(300px, 85vw);
        height: auto;
        border-top: 0;
        border-right: 1px solid var(--line);
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        visibility: hidden;
    }
    .js body.nav-open .sidebar { transform: none; visibility: visible; }
    .js body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(8, 14, 30, 0.55); }
    .js body.nav-open { overflow: hidden; }
    table.data { font-size: 0.84rem; }
    .entrance-card { padding: 28px 24px; }
}
@media (prefers-reduced-motion: reduce) {
    .js .sidebar { transition: none; }
}

/* --- Start page tiles ------------------------------------------------- */

/* Card look follows Unfold's dashboard cards: panel background, 1px border, radius and a faint shadow. */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.tile {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    padding: 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    color: var(--ink);
    text-decoration: none;
}
.tile:hover { border-color: var(--navy-mid); background: var(--tint); color: var(--ink); }
.tile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--nav-active-bg);
    color: var(--nav-active-ink);
}
.tile-title { font-weight: 600; font-size: 1rem; }
.tile-description { font-size: 0.86rem; color: var(--ink-soft); }
.material-symbols-outlined {
    font-family: "Material Symbols Outlined";
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    font-feature-settings: "liga";
    -webkit-font-feature-settings: "liga";
    -webkit-font-smoothing: antialiased;
}
