/* GCP Core - public site, sign-in and account styles (the admin panel uses Bootstrap 5 + admin.css). */
:root {
    color-scheme: light;
    --bg: #f7f7fb;
    --bg-soft: #eef0f8;
    --fg: #111827;
    --muted: #5b6474;
    --card: #ffffff;
    --border: #e4e6ef;
    --accent: #5b5bf0;
    --accent-2: #a855f7;
    --accent-fg: #ffffff;
    --accent-soft: rgba(91, 91, 240, .1);
    --ring: rgba(91, 91, 240, .35);
    --danger: #dc2626;
    --shadow-sm: 0 1px 2px rgba(17, 24, 39, .05);
    --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 8px 24px -8px rgba(17, 24, 39, .12);
    --shadow-lg: 0 2px 4px rgba(17, 24, 39, .04), 0 24px 48px -16px rgba(55, 48, 163, .25);
    --radius: .75rem;
    --radius-sm: .5rem;
    --ok-bg: #ecfdf3; --ok-border: #a6e9c3; --ok-edge: #16a34a; --ok-fg: #14532d;
    --warn-bg: #fffaeb; --warn-border: #fde68a; --warn-edge: #d97706; --warn-fg: #713f12; --warn-text: #b45309;
    --bad-bg: #fef2f2; --bad-border: #fecaca; --bad-edge: #dc2626; --bad-fg: #7f1d1d;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* Dark tokens: chosen explicitly (theme.js sets data-theme) or following the OS when no choice was made. */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b0d14;
    --bg-soft: #121522;
    --fg: #e7e9f0;
    --muted: #9aa1b2;
    --card: #141826;
    --border: #262b3d;
    --accent: #8b8cff;
    --accent-2: #c084fc;
    --accent-fg: #0b0d14;
    --accent-soft: rgba(139, 140, 255, .12);
    --ring: rgba(139, 140, 255, .45);
    --danger: #f87171;
    --ok-bg: #0b2117; --ok-border: #14532d; --ok-edge: #22c55e; --ok-fg: #86efac;
    --warn-bg: #261b06; --warn-border: #713f12; --warn-edge: #f59e0b; --warn-fg: #fcd34d; --warn-text: #fcd34d;
    --bad-bg: #2a0f12; --bad-border: #7f1d1d; --bad-edge: #ef4444; --bad-fg: #fca5a5;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 48px -16px rgba(0, 0, 0, .6);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        color-scheme: dark;
        --bg: #0b0d14;
        --bg-soft: #121522;
        --fg: #e7e9f0;
        --muted: #9aa1b2;
        --card: #141826;
        --border: #262b3d;
        --accent: #8b8cff;
        --accent-2: #c084fc;
        --accent-fg: #0b0d14;
        --accent-soft: rgba(139, 140, 255, .12);
        --ring: rgba(139, 140, 255, .45);
        --danger: #f87171;
        --ok-bg: #0b2117; --ok-border: #14532d; --ok-edge: #22c55e; --ok-fg: #86efac;
        --warn-bg: #261b06; --warn-border: #713f12; --warn-edge: #f59e0b; --warn-fg: #fcd34d; --warn-text: #fcd34d;
        --bad-bg: #2a0f12; --bad-border: #7f1d1d; --bad-edge: #ef4444; --bad-fg: #fca5a5;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
        --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 48px -16px rgba(0, 0, 0, .6);
    }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--fg);
    font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; }
a { color: var(--accent); text-underline-offset: .2em; }
code { font-family: var(--mono); font-size: .9em; padding: .1em .35em; border-radius: .3rem; background: var(--accent-soft); }
.muted { color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------------------------------------------------------------- header / footer */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem max(1rem, calc((100% - 1120px) / 2));
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(1.6) blur(12px);
    -webkit-backdrop-filter: saturate(1.6) blur(12px);
    border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.05rem; text-decoration: none; color: var(--fg); letter-spacing: -.01em; min-width: 0; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcp-logo { flex: none; display: block; }
.site-nav { display: flex; align-items: center; gap: .25rem; }
.site-nav a:not(.button) { padding: .4rem .75rem; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
.site-nav a:not(.button):hover, .site-nav a[aria-current="page"] { color: var(--fg); background: var(--accent-soft); }

.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .5rem 1rem;
    padding: 1.5rem max(1rem, calc((100% - 1120px) / 2));
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: .875rem;
}
.site-footer a { color: inherit; }

.container { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 2rem 1rem 4rem; }

/* ---------------------------------------------------------------- language */
:lang(ne) body, body:lang(ne) { font-family: "Noto Sans Devanagari", "Nirmala UI", "Mangal", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.locale-switch { display: inline-flex; margin: 0; }
.locale-button {
    display: inline-flex; align-items: center; gap: .4rem; height: 2.25rem; padding: 0 .7rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); color: var(--muted);
    font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-sm);
}
.locale-button:lang(ne) { font-family: "Noto Sans Devanagari", "Nirmala UI", "Mangal", sans-serif; }
.locale-button:hover { color: var(--fg); background: var(--bg-soft); }
.locale-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.auth-tools { position: fixed; top: 1rem; right: 1rem; display: flex; gap: .5rem; }
.auth-tools .auth-theme { position: static; }
.today { color: var(--muted); font-size: .85rem; }

/* ---------------------------------------------------------------- theme toggle */
.theme-toggle {
    display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: 0;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); color: var(--muted);
    cursor: pointer; box-shadow: var(--shadow-sm); transition: color .15s ease, background .15s ease;
}
.theme-toggle:hover { color: var(--fg); background: var(--bg-soft); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-icon { display: none; }
:root:not([data-theme-pref]) .theme-icon-system,
[data-theme-pref="system"] .theme-icon-system,
[data-theme-pref="light"] .theme-icon-light,
[data-theme-pref="dark"] .theme-icon-dark { display: block; }
.auth-theme { position: fixed; top: 1rem; right: 1rem; }

/* ---------------------------------------------------------------- buttons */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .6rem 1.15rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--accent-fg);
    font: inherit;
    font-weight: 600;
    font-size: .95rem;
    line-height: 1.3;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(17, 24, 39, .1), inset 0 1px 0 rgba(255, 255, 255, .15);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.button:hover { filter: brightness(1.06); box-shadow: 0 6px 16px -6px var(--ring); transform: translateY(-1px); }
.button:active { transform: none; }
button.button { appearance: none; }
.button-secondary { background: var(--card); color: var(--fg); border-color: var(--border) !important; box-shadow: var(--shadow-sm); }
.button-secondary:hover { background: var(--bg-soft); box-shadow: var(--shadow-sm); filter: none; }
.button-lg { padding: .8rem 1.5rem; font-size: 1rem; }
.button-small { padding: .3rem .75rem; font-size: .85rem; }
.button-block { display: flex; width: 100%; }
.button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.inline-form { display: flex; align-items: center; gap: .75rem; margin: 0; flex-wrap: wrap; }

/* ---------------------------------------------------------------- landing page */
.hero { position: relative; text-align: center; padding: clamp(2.5rem, 8vw, 5.5rem) 0 clamp(2rem, 5vw, 3.5rem); isolation: isolate; }
.hero::before {
    content: "";
    position: absolute;
    inset: -2rem -50vw auto;
    height: 120%;
    z-index: -1;
    background:
        radial-gradient(40rem 20rem at 50% 0%, var(--accent-soft), transparent 70%),
        radial-gradient(24rem 14rem at 70% 20%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 70%);
    pointer-events: none;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1.25rem;
    padding: .3rem .8rem .3rem .4rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    color: var(--muted);
    font-size: .85rem;
    box-shadow: var(--shadow-sm);
}
.hero-badge strong { padding: .1rem .55rem; border-radius: 999px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-fg); font-size: .75rem; }
.hero h1 { font-size: clamp(2.1rem, 6vw, 3.75rem); font-weight: 800; letter-spacing: -.035em; margin: 0 auto .75rem; max-width: 18ch; overflow-wrap: anywhere; }
.gradient-text { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: clamp(1.05rem, 2.2vw, 1.25rem); color: var(--muted); max-width: 38rem; margin: 0 auto 2rem; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; }

.code-window {
    max-width: 44rem;
    margin: 0 auto 4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #0f1220;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    text-align: left;
}
.code-window-bar { display: flex; align-items: center; gap: .4rem; padding: .7rem 1rem; border-bottom: 1px solid rgba(255, 255, 255, .07); color: #8a90a6; font-size: .8rem; }
.code-window-bar i { width: .7rem; height: .7rem; border-radius: 50%; background: #3a3f55; }
.code-window-bar i:nth-child(1) { background: #ff5f57; }
.code-window-bar i:nth-child(2) { background: #febc2e; }
.code-window-bar i:nth-child(3) { background: #28c840; }
.code-window-bar span { margin-left: .5rem; font-family: var(--mono); }
.code-window pre { margin: 0; padding: 1.25rem 1.25rem 1.4rem; overflow-x: auto; color: #d6d9e6; font: .875rem/1.7 var(--mono); }
.code-window .c { color: #6b7290; }
.code-window .k { color: #c792ea; }
.code-window .s { color: #a5e075; }
.code-window .f { color: #82aaff; }
.code-window .v { color: #f78c6c; }

.section-head { text-align: center; max-width: 36rem; margin: 0 auto 2rem; }
.section-head h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); margin: 0 0 .5rem; }
.section-head p { color: var(--muted); margin: 0; }

.feature-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 3.5rem; }
@media (min-width: 560px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .feature-grid { grid-template-columns: repeat(4, 1fr); } }
.feature {
    padding: 1.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.feature:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.feature-icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; margin-bottom: .9rem; border-radius: .6rem; background: var(--accent-soft); color: var(--accent); }
.feature h3 { font-size: 1.02rem; margin: 0 0 .35rem; }
.feature p { margin: 0; color: var(--muted); font-size: .925rem; line-height: 1.55; }

/* ---------------------------------------------------------------- cards, definition lists */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-sm); margin-bottom: 1.25rem; }
.card h2 { font-size: 1.1rem; margin: 0 0 1rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.card small { color: var(--muted); font-weight: normal; font-size: .8rem; }
.card-narrow { max-width: 44rem; margin-left: auto; margin-right: auto; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.5rem; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; font-family: var(--mono); font-size: .9rem; }
.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .75rem; font-weight: 600; }

/* ---------------------------------------------------------------- forms, alerts, tables */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .35rem; }
.field input, .field textarea {
    width: 100%;
    padding: .65rem .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--fg);
    font: inherit;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field input:hover, .field textarea:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); background: var(--card); }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--danger); }
.field textarea { min-height: 8rem; resize: vertical; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.field-hint { margin: .35rem 0 0; color: var(--muted); font-size: .85rem; }
.field-error { margin: .35rem 0 0; color: var(--danger); font-size: .85rem; font-weight: 500; }

.alert { padding: .8rem 1rem .8rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1.25rem; border: 1px solid; border-left-width: 4px; font-size: .95rem; }
.alert-success { background: var(--ok-bg); border-color: var(--ok-border); border-left-color: var(--ok-edge); color: var(--ok-fg); }
.alert-warning { background: var(--warn-bg); border-color: var(--warn-border); border-left-color: var(--warn-edge); color: var(--warn-fg); }
.alert-danger { background: var(--bad-bg); border-color: var(--bad-border); border-left-color: var(--bad-edge); color: var(--bad-fg); }

.badge { display: inline-block; margin-left: .5rem; padding: .1rem .55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .75rem; font-weight: 600; }

.table-wrap { overflow-x: auto; margin-bottom: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; font-size: .925rem; }
.table th, .table td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table thead th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; background: var(--bg-soft); }
.table tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
.table form { margin: 0; }

/* ---------------------------------------------------------------- sign-in pages */
.auth-body {
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(36rem 24rem at 15% 0%, var(--accent-soft), transparent 70%),
        radial-gradient(30rem 22rem at 100% 100%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 70%),
        var(--bg);
}
.auth-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--border); border-radius: 1rem; padding: 2.25rem 2rem; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 1.5rem; margin: 0 0 .35rem; text-align: center; }
.auth-card h1 + form, .auth-card h1 + p + form { margin-top: 1.5rem; }
.auth-card > p { text-align: center; color: var(--muted); }
.auth-brand { display: flex; justify-content: center; margin-bottom: 1.75rem; font-size: 1.15rem; }
.auth-card .button-block { margin-top: 1.5rem; padding: .75rem; }
.auth-foot { margin-top: 1.5rem; color: var(--muted); font-size: .8rem; text-align: center; }
/* Installer: wider card for the system check table */
.auth-card:has(.checks) { max-width: 680px; }
.auth-card .table-wrap { box-shadow: none; }
.checks caption { text-align: left; font-weight: 600; padding: .75rem 1rem; }
.check-ok strong { color: var(--ok-edge); }
.check-warning strong { color: var(--warn-text); }
.check-error strong { color: var(--danger); }
.auth-links { margin-top: 1.25rem; text-align: center; font-size: .925rem; }
.auth-links a { text-decoration: none; font-weight: 500; }
.auth-links a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- two-factor */
.auth-icon { display: grid; place-items: center; width: 3.25rem; height: 3.25rem; margin: 0 auto 1rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.code-input { font-family: var(--mono); font-size: 1.35rem !important; letter-spacing: .35em; text-align: center; }
input.code-input::placeholder { color: var(--muted); opacity: .45; }
.link-button { appearance: none; border: 0; padding: 0; background: none; color: var(--muted); font: inherit; font-size: .875rem; cursor: pointer; text-decoration: underline; text-underline-offset: .2em; }
.link-button:hover { color: var(--fg); }
.button-danger { background: var(--bad-edge); color: #fff; }
.card-danger { border-color: color-mix(in srgb, var(--bad-edge) 35%, var(--border)); }
.card-danger h2 { color: var(--bad-edge); }
.pill-ok { background: var(--ok-bg); color: var(--ok-edge); }
.pill-warn { background: var(--warn-bg); color: var(--warn-text); }
.tfa-status { display: flex; gap: 1rem; align-items: flex-start; }
.tfa-status h2 { margin-bottom: .25rem; }
.tfa-status p { margin: 0; }
.tfa-status-icon { flex: none; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: .8rem; background: var(--warn-bg); color: var(--warn-text); }
.tfa-status-icon.is-on { background: var(--ok-bg); color: var(--ok-edge); }
.tfa-setup { display: grid; grid-template-columns: auto 1fr; gap: 1.5rem; align-items: start; margin-bottom: 1.25rem; }
.tfa-qr { padding: .6rem; border-radius: var(--radius-sm); background: #fff; border: 1px solid var(--border); line-height: 0; }
.tfa-qr img { width: 180px; height: 180px; }
.tfa-steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .75rem; }
.tfa-secret { display: block; margin: .5rem 0; padding: .5rem .75rem; font-size: .95rem; letter-spacing: .08em; word-break: break-all; }
.tfa-confirm { max-width: 320px; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1.5rem; margin: 0 0 1rem; padding: 1rem 1rem 1rem 2.5rem; border-radius: var(--radius-sm); background: var(--bg-soft); }
.recovery-codes code { background: none; padding: 0; font-size: .95rem; }
.tfa-codes { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
@media (max-width: 560px) {
    .tfa-setup { grid-template-columns: 1fr; justify-items: center; }
    .recovery-codes { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- account pages */
.account-header .inline-form .muted { font-size: .9rem; }
.account-layout { display: grid; grid-template-columns: 210px 1fr; gap: 2.5rem; align-items: start; }
.account-nav { display: flex; flex-direction: column; gap: .2rem; position: sticky; top: 5rem; }
.account-nav-title { margin: 0 0 .5rem .75rem; color: var(--muted); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.account-nav a { padding: .55rem .8rem; border-radius: var(--radius-sm); text-decoration: none; color: var(--muted); font-weight: 500; transition: background .15s ease, color .15s ease; }
.account-nav a:hover { color: var(--fg); background: var(--bg-soft); }
.account-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.account-content { min-width: 0; }
.account-content h1 { margin: 0 0 1.25rem; font-size: 1.75rem; }
.account-content form { max-width: 520px; }
.account-content .table form { max-width: none; }
.account-content form.card { max-width: none; }
.account-content form.card .field { max-width: 440px; }
.account-content form.card .button { margin-top: .5rem; }

@media (max-width: 720px) {
    .account-layout { grid-template-columns: 1fr; gap: 1.25rem; }
    .account-nav { position: static; flex-direction: row; flex-wrap: wrap; }
    .account-nav-title { display: none; }
    .account-header .inline-form .muted { display: none; }
    .auth-card { padding: 1.75rem 1.25rem; }
}

@media (max-width: 520px) {
    .site-nav .nav-home { display: none; }
}


@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}
