:root {
    color-scheme: light;
    --ink: #151d30;
    --muted: #55617a;
    --navy: #111a31;
    --accent: #273eae;
    --accent-hover: #1e3089;
    --line: #d9e0ed;
    --surface: #fff;
    --page: #f3f5fa;
    --radius: 18px;
    font: 16px/1.55 "Segoe UI", system-ui, sans-serif;
    color: var(--ink);
    background: var(--page);
}

*, *::before, *::after { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; display: flex; flex-direction: column; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
h1, h2, p, dl, dd { margin: 0; }
h1, h2 { letter-spacing: -.035em; line-height: 1.15; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { font-size: 1.38rem; }
:focus-visible { outline: 3px solid #4664ee; outline-offset: 3px; }
.skip { position: fixed; left: 1rem; top: -5rem; z-index: 1; padding: .6rem 1rem; background: white; }
.skip:focus { top: 1rem; }

.topbar { background: var(--navy); color: white; }
.topbar-inner, .shell, .footer { width: min(1200px, calc(100% - 64px)); margin-inline: auto; }
.topbar-inner { min-height: 80px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .75rem; }
.brand { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .85rem; font-weight: 750; font-size: 1.32rem; letter-spacing: -.035em; color: white; text-decoration: none; }
.brand span { border-left: 1px solid #526384; color: #c6d2ed; padding-left: .85rem; font-weight: 500; font-size: .83rem; letter-spacing: 0; }
.top-link { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 42px; border: 1px solid #526384; background: transparent; border-radius: 8px; color: white; font-size: .85rem; white-space: nowrap; padding: .45rem .75rem; text-decoration: none; cursor: pointer; }
.top-link:hover { background: #253350; }
.identity { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.identity > div { text-align: right; min-width: 0; }
.identity strong, .identity span { display: block; overflow-wrap: anywhere; }
.identity strong { font-size: .9rem; }
.identity span { color: #c6d2ed; font-size: .8rem; }
.shell { flex: 1; padding-block: 2.25rem 3.25rem; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .45rem 1rem; border-top: 1px solid var(--line); padding-block: 1.15rem 1.4rem; font-size: .85rem; }
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

.guest .shell { max-width: 1080px; display: grid; align-content: center; }
.guest-layout { display: grid; grid-template-columns: .95fr 1.05fr; gap: 1.25rem; }
.welcome, .application { padding: clamp(1.4rem, 3.4vw, 2.7rem); }
.welcome { display: flex; flex-direction: column; justify-content: space-between; gap: 2.8rem; border-radius: var(--radius); background: radial-gradient(ellipse at 100% 0%, #3249a4 0, transparent 60%), linear-gradient(160deg, #202f65, #121c39 70%); color: white; }
.welcome h1 { max-width: 12ch; font-size: clamp(2.5rem, 5vw, 4.2rem); line-height: 1.02; }
.welcome p { max-width: 29ch; margin-top: 1.15rem; color: #d7e0fa; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 14px #172d5710; min-width: 0; }
.section-heading { margin-bottom: 1.5rem; }
.section-heading h2 { font-size: clamp(1.65rem, 3vw, 2.3rem); }
.section-heading p, .page-heading p { color: var(--muted); margin-top: .55rem; }
.form { display: grid; gap: .88rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .88rem; }
label { display: grid; gap: .3rem; align-content: start; min-width: 0; font-weight: 650; font-size: .88rem; }
input:not([type="hidden"]), select, textarea { width: 100%; min-width: 0; min-height: 45px; border: 1px solid #bac5da; border-radius: 8px; padding: .55rem .68rem; background: #fff; color: var(--ink); font-weight: 400; font-size: 1rem; }
input::placeholder { color: #68758e; }
textarea { resize: vertical; }
.welcome input:not([type="hidden"]) { border-color: #7182ad; background: #ffffff12; color: white; }
.welcome input:focus-visible, .topbar :focus-visible { outline-color: #b7c8ff; }
small, .form-note { color: var(--muted); font-weight: 400; font-size: .79rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .65rem; min-height: 45px; border: 1px solid transparent; border-radius: 8px; padding: .6rem 1rem; font-weight: 700; font-size: .9rem; text-decoration: none; cursor: pointer; }
.button[aria-disabled="true"] { cursor: progress; opacity: .75; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: var(--accent-hover); }
.light { background: #f6f8ff; color: #192d83; }
.light:hover { background: #dfe7ff; }
.application .button, .login-form .button { justify-content: space-between; }
.alert { border: 1px solid; border-radius: 10px; padding: .8rem 1rem; margin-bottom: 1rem; overflow-wrap: anywhere; }
.error { background: #fff0f1; color: #8a222d; border-color: #efbec6; }
.success { background: #eaf8ef; color: #145031; border-color: #b2dfc3; }

.tabs { display: flex; flex-wrap: wrap; gap: .35rem; padding-bottom: .9rem; margin-bottom: 1.65rem; border-bottom: 1px solid var(--line); }
.tabs a { color: var(--muted); padding: .5rem .9rem; border-radius: 8px; font-weight: 650; text-decoration: none; }
.tabs a:hover, .tabs a[aria-current] { color: #20378c; background: #e7ecff; }
.page-heading { margin-bottom: 1.4rem; }
.catalog-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.filters { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) auto auto; align-items: end; gap: .85rem; padding: .9rem 1rem; margin-bottom: 1.25rem; }
.filters .text-link { align-self: center; }
.badge, .count { display: inline-flex; align-items: center; justify-content: center; color: #263b91; background: #e8edff; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; padding: .23rem .66rem; }
.tier { padding: .38rem .85rem; }
.inactive { color: #4f5b6e; background: #edf0f5; }
.catalog { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.product { display: flex; flex-direction: column; padding: 1.15rem; overflow-wrap: anywhere; }
.product-info { flex: 1; }
.category { color: var(--accent); font-size: .78rem; font-weight: 700; }
.product h2 { margin-top: .35rem; }
.product p { color: var(--muted); margin-top: .65rem; font-size: .91rem; white-space: pre-line; }
.prices { display: flex; flex-wrap: wrap; gap: .65rem 1.15rem; margin-top: 1.15rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.prices > div { flex: 1; min-width: max-content; }
.prices dt { color: var(--muted); font-size: .8rem; }
.prices dd { font-size: 1.11rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.prices .personal-price dd { color: var(--accent); }
.prices .annual-prices { flex: 1.2 0 min(100%, 8.5rem); min-width: 0; }
.prices .annual-prices dd { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0 .45rem; font-size: .88rem; }
.annual-prices .price-period { color: var(--muted); font-size: .78rem; font-weight: 500; }
.product-editor-form:has([name="annual"] option[value="0"]:checked) .annual-price-field { display: none; }
.price-tax { color: var(--muted); font-size: .78em; font-weight: 650; white-space: nowrap; }
.catalog-payment-note { margin-top: 1.25rem; padding-top: .8rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.product-link { display: inline-flex; gap: .5rem; justify-content: space-between; margin-top: .9rem; padding-top: .65rem; border-top: 1px solid var(--line); font-size: .88rem; font-weight: 650; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.empty { padding: 1.1rem; color: var(--muted); }

.management { display: grid; grid-template-columns: minmax(0, 1.14fr) minmax(0, 1fr); align-items: start; gap: 1.15rem; }
.card-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; border-bottom: 1px solid var(--line); padding: 1rem 1.15rem; }
.card-heading h2 { display: flex; gap: .55rem; align-items: center; }
.text-link { color: var(--accent); font-size: .85rem; font-weight: 700; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.records { list-style: none; margin: 0; padding: 0 1.15rem; }
.records li { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .85rem 0; }
.records li + li { border-top: 1px solid var(--line); }
.record-details { display: grid; min-width: 0; overflow-wrap: anywhere; }
.record-details span { font-size: .83rem; color: var(--muted); }
.management-stack { display: grid; gap: 1rem; min-width: 0; }
.record-actions { display: flex; align-items: center; justify-content: flex-end; flex: 0 0 auto; gap: .24rem; white-space: nowrap; }
.record-action { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; min-height: 34px; padding: .2rem .35rem; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--accent); font-size: .77rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.record-action:hover:not(:disabled) { background: #e7ecff; }
.record-action:disabled { color: #8792a5; background: #f3f5fa; cursor: default; }
.record-action.danger { color: #9b2632; }
.record-actions .badge { padding-inline: .45rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.editor { padding: 1.15rem; scroll-margin-top: 1rem; }
.editor > h2 { margin-bottom: 1rem; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem; }

@media (max-width: 960px) {
    .catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .topbar-inner, .shell, .footer { width: calc(100% - 32px); }
    .shell { padding-block: 1.25rem 2rem; }
    .guest-layout, .management { grid-template-columns: 1fr; }
    .welcome { gap: 1.5rem; }
    .welcome h1 { max-width: none; }
    .management:has(.editor:target) .editor { order: -1; }
    .filters { grid-template-columns: 1fr 1fr; }
    .filters .text-link { justify-self: start; }
}
@media (max-width: 480px) {
    .brand { font-size: 1.16rem; display: grid; }
    .brand span { border-left: 0; padding-left: 0; }
    .identity > div { display: none; }
    .catalog, .fields { grid-template-columns: 1fr; }
    .records .product-record { flex-wrap: wrap; }
    .product-record .record-details { flex-basis: 100%; }
    .catalog-heading { align-items: start; flex-direction: column; gap: .5rem; }
    .filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .filters label { grid-column: 1 / -1; }
}
