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

/* Outfit, self-hosted so no request leaves for a third-party CDN.
   Split by unicode-range exactly as Google serves it: the browser fetches
   only the subset a page actually needs. These are the variable files, so a
   single file per subset covers every weight from 400 to 700; no italic
   exists for this family, so italics are synthesised by the browser. */
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/outfit-latin-3BR0lLl.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/outfit-latin-ext-6bPR0nO.woff2") format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Palette ---------- */

/* The BAYWORX scheme, shared with psa.bayworx.com: blue for anything
   actionable, navy for the app chrome, green used sparingly as an accent. */
:root {
    --bs-body-font-family: 'Outfit', var(--bs-font-sans-serif);

    --pb-brand: #3271aa;
    --pb-brand-rgb: 50, 113, 170;
    --pb-brand-dark: #2a5f91;
    --pb-brand-active: #24507b;
    --pb-navy: #152940;
    --pb-navy-rgb: 21, 41, 64;
    --pb-accent: #9ccb41;
    --pb-accent-rgb: 156, 203, 65;

    /* Text that sits on top of a solid brand fill. */
    --pb-on-brand: #fff;

    --pb-sidebar-width: 248px;
    --pb-app-bg: #f7f7f9;

    /* Bootstrap reads these live, so retinting them here is enough to carry
       the blue into links, .bg-primary, .border-primary and friends.
       Components that bake their colours in at build time are overridden
       individually further down. */
    --bs-primary: var(--pb-brand);
    --bs-primary-rgb: 50, 113, 170;
    --bs-primary-text-emphasis: var(--pb-navy);
    --bs-primary-bg-subtle: #dce8f2;
    --bs-primary-border-subtle: #a9c5dd;

    --bs-link-color: var(--pb-brand);
    --bs-link-color-rgb: 50, 113, 170;
    --bs-link-hover-color: var(--pb-brand-dark);
    --bs-link-hover-color-rgb: 42, 95, 145;

    --bs-dark: var(--pb-navy);
    --bs-dark-rgb: 21, 41, 64;
    --bs-dropdown-link-active-bg: var(--pb-brand);
}

/* PSA is light-only. Dark mode keeps the same hues but lifts the blue off
   the dark background, where #3271aa alone would not carry enough contrast;
   hover/active therefore lighten here rather than darken. */
[data-bs-theme='dark'] {
    --pb-brand: #6ea9d8;
    --pb-brand-rgb: 110, 169, 216;
    --pb-brand-dark: #8abde4;
    --pb-brand-active: #a5cdec;
    --pb-on-brand: var(--pb-navy);

    --pb-app-bg: var(--bs-body-bg);

    --bs-primary-text-emphasis: #a5cdec;
    --bs-primary-bg-subtle: #10222f;
    --bs-primary-border-subtle: #24506e;

    --bs-link-color-rgb: 110, 169, 216;
    --bs-link-hover-color-rgb: 138, 189, 228;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

/* ---------- Brand helpers ---------- */

.text-brand {
    color: var(--pb-brand) !important;
}

.bg-brand {
    background-color: var(--pb-brand) !important;
}

.bg-brand-subtle {
    background-color: rgba(var(--pb-brand-rgb), 0.1) !important;
}

.btn-brand {
    --bs-btn-bg: var(--pb-brand);
    --bs-btn-border-color: var(--pb-brand);
    --bs-btn-color: var(--pb-on-brand);
    --bs-btn-hover-bg: var(--pb-brand-dark);
    --bs-btn-hover-border-color: var(--pb-brand-dark);
    --bs-btn-hover-color: var(--pb-on-brand);
    --bs-btn-active-bg: var(--pb-brand-active);
    --bs-btn-active-border-color: var(--pb-brand-active);
    --bs-btn-active-color: var(--pb-on-brand);
    --bs-btn-disabled-bg: var(--pb-brand);
    --bs-btn-disabled-border-color: var(--pb-brand);
    --bs-btn-disabled-color: var(--pb-on-brand);
    --bs-btn-focus-shadow-rgb: var(--pb-brand-rgb);
}

.btn-outline-brand {
    --bs-btn-color: var(--pb-brand);
    --bs-btn-border-color: var(--pb-brand);
    --bs-btn-hover-bg: var(--pb-brand);
    --bs-btn-hover-border-color: var(--pb-brand);
    --bs-btn-hover-color: var(--pb-on-brand);
    --bs-btn-active-bg: var(--pb-brand-active);
    --bs-btn-active-border-color: var(--pb-brand-active);
    --bs-btn-active-color: var(--pb-on-brand);
    --bs-btn-focus-shadow-rgb: var(--pb-brand-rgb);
}

/* Bootstrap's compiled CSS bakes the stock blue into .btn-primary's own
   --bs-btn-* variables at build time, so the :root override above does not
   reach them - retint each one explicitly. */
.btn-primary {
    --bs-btn-color: var(--pb-on-brand);
    --bs-btn-hover-color: var(--pb-on-brand);
    --bs-btn-active-color: var(--pb-on-brand);
    --bs-btn-disabled-color: var(--pb-on-brand);
    --bs-btn-bg: var(--pb-brand);
    --bs-btn-border-color: var(--pb-brand);
    --bs-btn-hover-bg: var(--pb-brand-dark);
    --bs-btn-hover-border-color: var(--pb-brand-dark);
    --bs-btn-active-bg: var(--pb-brand-active);
    --bs-btn-active-border-color: var(--pb-brand-active);
    --bs-btn-disabled-bg: var(--pb-brand);
    --bs-btn-disabled-border-color: var(--pb-brand);
    --bs-btn-focus-shadow-rgb: var(--pb-brand-rgb);
}

.btn-outline-primary {
    --bs-btn-color: var(--pb-brand);
    --bs-btn-border-color: var(--pb-brand);
    --bs-btn-hover-color: var(--pb-on-brand);
    --bs-btn-active-color: var(--pb-on-brand);
    --bs-btn-hover-bg: var(--pb-brand);
    --bs-btn-hover-border-color: var(--pb-brand);
    --bs-btn-active-bg: var(--pb-brand-active);
    --bs-btn-active-border-color: var(--pb-brand-active);
    --bs-btn-disabled-color: var(--pb-brand);
    --bs-btn-disabled-border-color: var(--pb-brand);
    --bs-btn-focus-shadow-rgb: var(--pb-brand-rgb);
}

.form-check-input:checked {
    background-color: var(--pb-brand);
    border-color: var(--pb-brand);
}

.bg-accent {
    background-color: var(--pb-accent) !important;
    color: var(--pb-navy) !important;
}

.text-accent {
    color: var(--pb-accent) !important;
}

.navbar-brand .bi {
    color: var(--pb-brand);
}

/* ---------- Layout ---------- */

.app-shell {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - 56px);
}

/* The sidebar is navy in both colour modes, as it is on PSA - it reads as
   app chrome rather than as part of the page, so it does not invert. Its
   contents therefore need light-on-dark colours of their own, overriding
   the body-coloured Bootstrap utilities the layouts use inside it. */
.app-sidebar {
    width: var(--pb-sidebar-width);
    flex: 0 0 var(--pb-sidebar-width);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    background-color: var(--pb-navy);
    color: #fff;
}

.app-sidebar .text-body-secondary {
    color: rgba(255, 255, 255, 0.6) !important;
}

.app-sidebar hr {
    border-top-color: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.app-sidebar .sidebar-caption {
    color: var(--pb-accent) !important;
}

.app-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.75);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.app-sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.app-sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.08);
    box-shadow: inset 3px 0 0 var(--pb-accent);
    color: #fff;
    font-weight: 600;
}

.app-sidebar .nav-link .bi {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
}

.app-content {
    flex: 1 1 auto;
    min-width: 0;
    background-color: var(--pb-app-bg);
}

@media (max-width: 991.98px) {
    .app-shell {
        display: block;
    }

    .app-sidebar {
        width: 100%;
        flex: none;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* ---------- Components ---------- */

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bs-secondary-color);
}

.license-key {
    font-family: var(--bs-font-monospace);
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    word-break: break-all;
}

.avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(var(--pb-brand-rgb), 0.15);
    color: var(--pb-brand);
    font-weight: 600;
    font-size: 0.8125rem;
    flex: none;
}

.plan-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.plan-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--bs-box-shadow);
}

.plan-card.featured {
    border-color: var(--pb-brand);
    border-width: 2px;
}

.hero {
    background:
        radial-gradient(1200px 400px at 50% -10%, rgba(var(--pb-brand-rgb), 0.14), transparent 70%),
        var(--bs-body-bg);
}

.code-block {
    font-family: var(--bs-font-monospace);
    font-size: 0.875rem;
    background-color: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 0.625rem 0.75rem;
    word-break: break-all;
}

.toast-stack {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1090;
    max-width: min(24rem, calc(100vw - 2rem));
}

.table-hover > tbody > tr {
    cursor: default;
}

.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--bs-secondary-color);
}

.empty-state .bi {
    font-size: 2.5rem;
    opacity: 0.5;
    display: block;
    margin-bottom: 0.75rem;
}

/* Bootstrap's form help text is a touch loud next to dense forms. */
.form-text {
    font-size: 0.8125rem;
}
