:root
{
    color-scheme: light dark;
    --page: light-dark(#f4f6f4,#141c18);
    --surface: light-dark(#fff,#1c2721);
    --text: light-dark(#20332d,#e1ebe6);
    --muted: light-dark(#5b6e63,#afbeb4);
    --line: light-dark(#dce4de,#35483c);
    --brand: light-dark(#18543d,#b0e5c5);
    --brand-text: light-dark(#fff,#132b20);
}

*
{
    box-sizing: border-box;
}

body
{
    margin: 0;
    background: var(--page);
    color: var(--text);
    font: 14px/1.5 system-ui,sans-serif;
}

a
{
    color: var(--brand);
    text-underline-offset: 3px;
}

button,input,select
{
    font: inherit;
}

button,.button
{
    display: inline-block;
    background: var(--brand);
    color: var(--brand-text);
    padding: 9px 14px;
    border: 1px solid var(--brand);
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
}

.secondary
{
    background: var(--surface);
    color: var(--text);
    border-color: var(--line);
}

.topbar
{
    background: var(--surface);
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px 28px;
    border-bottom: 1px solid var(--line);
}

.brand
{
    font-size: 19px;
    font-weight: 650;
    flex: 1;
    text-decoration: none;
}

.brand span
{
    font-size: 14px;
    font-weight: 400;
    color: var(--muted);
}

nav
{
    display: flex;
    gap: 24px;
    padding: 0 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

nav a
{
    padding: 14px 0;
    text-decoration: none;
    color: var(--muted);
}

nav a.active
{
    color: var(--brand);
    border-bottom: 2px solid var(--brand);
}

main
{
    max-width: 1500px;
    margin: auto;
    padding: 28px;
}

h1
{
    font-size: 25px;
    font-weight: 600;
    letter-spacing: -.5px;
    margin: 0 0 8px;
}

h2
{
    font-size: 18px;
    margin: 24px 0 12px;
}

h3
{
    font-size: 14px;
    text-transform: capitalize;
    margin: 0 0 12px;
}

p
{
    margin: 8px 0 18px;
}

small
{
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.page-heading
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.page-heading p
{
    margin: 0;
    color: var(--muted);
}

.summary
{
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.summary section,.panel
{
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.summary section
{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.summary strong
{
    font-size: 28px;
    font-weight: 550;
}

.table-wrap
{
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

table
{
    border-collapse: collapse;
    width: 100%;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

th
{
    background: var(--page);
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}

th,td
{
    padding: 13px 15px;
    border-bottom: 1px solid var(--line);
}

tbody tr:last-child td
{
    border-bottom: 0;
}

.client-name
{
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
}

.client-name img
{
    width: 96px;
    height: 48px;
    flex-shrink: 0;
    object-fit: contain;
    border-radius: 4px;
}

.client-name a
{
    font-weight: 550;
    text-decoration: none;
}

.badge
{
    display: inline-block;
    font-size: 12px;
    padding: 3px 7px;
    border-radius: 4px;
    white-space: nowrap;
}

.success
{
    background: light-dark(#eaf5ed,#193c2a);
    color: light-dark(#176c44,#8bdeb1);
}

.danger
{
    background: light-dark(#fbeeed,#452624);
    color: light-dark(#a53732,#ffb1a9);
}

.warning
{
    background: light-dark(#fbf3e4,#3b3221);
    color: light-dark(#8a591b,#efca86);
}

.neutral
{
    background: var(--page);
    color: var(--muted);
}

.import-badges
{
    display: flex;
    gap: 4px;
}

.muted,.rules
{
    color: var(--muted);
    font-size: 12px;
}

.rules
{
    margin-top: 28px;
    border-top: 1px solid var(--line);
    padding-top: 16px;
}

.facts
{
    display: flex;
    gap: 20px 32px;
    flex-wrap: wrap;
}

.family-grid
{
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 16px;
}

.metric
{
    display: block;
    font-size: 25px;
    font-weight: 550;
    margin-bottom: 10px;
}

.windows
{
    display: flex;
    gap: 12px 28px;
    flex-wrap: wrap;
    padding-left: 18px;
}

.notice
{
    padding: 14px;
    border-left: 3px solid light-dark(#8a591b,#efca86);
    background: var(--surface);
}

.auth-panel
{
    max-width: 460px;
    margin: 40px auto;
    background: var(--surface);
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

form
{
    max-width: 760px;
}

input:not([type=checkbox]),select
{
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
}

.form-floating
{
    position: relative;
    margin: 16px 0;
}

.form-floating input
{
    padding: 26px 12px 9px;
    min-height: 59px;
}

.form-floating label
{
    position: absolute;
    top: 7px;
    left: 12px;
    font-size: 12px;
    color: var(--muted);
    pointer-events: none;
}

.check
{
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 12px 0;
}

.check input
{
    width: 18px;
    height: 18px;
}

fieldset
{
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 18px 0;
    padding: 14px;
}

legend
{
    font-weight: 550;
    padding: 0 6px;
}

.window-row
{
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.window-row>.check
{
    width: 140px;
}

.window-row>label:not(.check)
{
    width: 160px;
}

.error,.validation-message,.validation-errors
{
    color: light-dark(#a53732,#ffb1a9);
}

.enrollment-secret
{
    font-family: monospace;
    overflow-wrap: anywhere;
    padding: 12px;
    background: var(--page);
    user-select: all;
}

.enrollment-qr
{
    margin: 24px 0;
    text-align: center;
}

.enrollment-qr img
{
    display: block;
    width: 240px;
    height: auto;
    max-width: 100%;
    margin: 0 auto 16px;
}

:focus-visible
{
    outline: 3px solid var(--brand);
    outline-offset: 3px;
}

@media(max-width:720px)
{
    main
    {
        padding: 16px;
    }

    .topbar
    {
        padding: 14px 16px;
        gap: 12px;
    }

    .brand span
    {
        display: none;
    }

    nav
    {
        padding: 0 16px;
        gap: 18px;
    }

    .summary
    {
        gap: 8px;
    }

    .summary section
    {
        padding: 12px;
        align-items: flex-start;
        flex-direction: column;
    }

    .family-grid
    {
        grid-template-columns: repeat(2,1fr);
    }

    .summary strong
    {
        font-size: 24px;
    }

    th,td
    {
        padding: 10px;
    }

    .auth-panel
    {
        padding: 20px;
    }

    .window-row>label:not(.check)
    {
        width: 120px;
    }

}

@media(max-width:400px)
{
    .family-grid
    {
        grid-template-columns: 1fr;
    }

    .topbar
    {
        flex-wrap: wrap;
    }

    .brand
    {
        min-width: 100%;
    }

}
