:root {
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --page: #f4f6fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #0f172a;
    --ink-soft: #334155;
    --muted: #5b6b82;
    --line: #e2e8f0;
    --line-soft: #f1f5f9;
    --line-strong: #cbd5e1;
    --primary: #5857ff;
    --primary-strong: #4342e6;
    --primary-ink: #3b3ad6;
    --primary-tint: #eeefff;
    --primary-line: #d8d6ff;
    --success-tint: #dcfce7;
    --success-ink: #15803d;
    --danger: #b42318;
    --on-color: #ffffff;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 10px;
    --shadow-plate: 0 2px 10px rgba(15, 23, 42, .05);
    --shadow-plate-hover: 0 4px 14px rgba(88, 87, 255, .18);
    --ring: 0 0 0 3px rgba(88, 87, 255, .2);
    --overlay: rgba(15, 23, 42, .45);
    --school-bg: linear-gradient(135deg, #fffaea 0%, #fceecb 100%);
    --school-line: #f5e0a4;
    --school-line-hover: #eccd82;
    --school-ink: #8a6100;
    --school-dot: #efb52a;
    --school-shadow: 0 3px 12px rgba(239, 181, 42, .16);
    --school-shadow-hover: 0 8px 20px rgba(239, 181, 42, .3);
    --managers-bg: linear-gradient(135deg, #f4faec 0%, #e3f1d2 100%);
    --managers-line: #cfe6b4;
    --managers-line-hover: #bcdc9b;
    --managers-ink: #3d7719;
    --managers-dot: #6aa62f;
    --managers-shadow: 0 3px 12px rgba(106, 166, 47, .16);
    --managers-shadow-hover: 0 8px 20px rgba(106, 166, 47, .28);
    --api-pill-bg: linear-gradient(135deg, #fdf2f0 0%, #f9dcd8 100%);
    --api-pill-line: #f3c8c1;
    --api-pill-line-hover: #eebbb3;
    --api-pill-ink: #a8281f;
    --api-pill-dot: #d13a2f;
    --api-pill-shadow: 0 3px 12px rgba(209, 58, 47, .14);
    --api-pill-shadow-hover: 0 8px 20px rgba(209, 58, 47, .26);
    --rail-bg: linear-gradient(160deg, #f7f7ff 0%, #ededfb 100%);
    --rail-line: #d8d6ff;
    --toggle-bg: linear-gradient(135deg, #ffffff 0%, #eeefff 100%);
    --toggle-line: #c5c3ff;
    --toggle-ink: #4b48d9;
    --toggle-shadow: 0 4px 14px rgba(88, 87, 255, .22);
    --toggle-shadow-hover: 0 8px 22px rgba(88, 87, 255, .32);
    --badge-ink: #047857;
    --badge-bg: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    --badge-line: #a7f3d0;
    --badge-line-hover: #6ee7b7;
    --badge-dot: #10b981;
    --badge-active-bg: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --badge-active-line: #059669;
    --badge-shadow: 0 1px 2px rgba(16, 185, 129, .14);
    --badge-shadow-hover: 0 2px 6px rgba(16, 185, 129, .22);
    --badge-active-shadow: 0 2px 8px rgba(5, 150, 105, .32);
    --tile-shadow: 0 2px 8px rgba(0, 0, 0, .03);
    --tile-shadow-hover: 0 4px 16px rgba(88, 87, 255, .12);
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html,
body { overflow-x: clip; }

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

body {
    margin: 0;
    min-height: 100vh;
    padding: 28px 20px 40px;
    background: var(--page);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
}

p { text-wrap: pretty; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.top-wrap {
    display: flex;
    justify-content: flex-end;
    margin: -8px 0 12px;
}

.top-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    max-width: 380px;
}

.top-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.top-link::before {
    content: "";
    flex: none;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--top-dot);
}

.top-link:hover { transform: translateY(-1px); }

.top-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.top-link--school {
    background: var(--school-bg);
    border-color: var(--school-line);
    box-shadow: var(--school-shadow);
    color: var(--school-ink);
    --top-dot: var(--school-dot);
}

.top-link--school:hover {
    border-color: var(--school-line-hover);
    box-shadow: var(--school-shadow-hover);
}

.top-link--managers {
    background: var(--managers-bg);
    border-color: var(--managers-line);
    box-shadow: var(--managers-shadow);
    color: var(--managers-ink);
    --top-dot: var(--managers-dot);
}

.top-link--managers:hover {
    border-color: var(--managers-line-hover);
    box-shadow: var(--managers-shadow-hover);
}

.top-link--api {
    background: var(--api-pill-bg);
    border-color: var(--api-pill-line);
    box-shadow: var(--api-pill-shadow);
    color: var(--api-pill-ink);
    --top-dot: var(--api-pill-dot);
}

.top-link--api:hover {
    border-color: var(--api-pill-line-hover);
    box-shadow: var(--api-pill-shadow-hover);
}

.svc-rail {
    position: relative;
    margin-bottom: 28px;
    padding: 8px;
    border: 1px solid var(--rail-line);
    border-radius: 16px;
    background: var(--rail-bg);
}

.svc-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}


.svc-tile {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--tile-shadow);
    text-align: left;
    text-decoration: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.svc-tile:hover {
    border-color: var(--primary);
    box-shadow: var(--tile-shadow-hover);
}

.svc-tile:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.svc-icon {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--line-soft);
    color: var(--primary);
}

.svc-text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.svc-name {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 4px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--ink);
}

.svc-title { min-width: 0; }

.svc-api {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    margin-top: 1px;
    padding: 0 8px;
    border: 1px solid var(--badge-line);
    border-radius: 999px;
    background: var(--badge-bg);
    box-shadow: var(--badge-shadow);
    color: var(--badge-ink);
    font-size: 9px;
    font-weight: 700;
    line-height: 1.6;
    white-space: nowrap;
}

.svc-api::before {
    content: "";
    flex: none;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--badge-dot);
}

.svc-tile:hover .svc-api {
    border-color: var(--badge-line-hover);
    box-shadow: var(--badge-shadow-hover);
}

.svc-sub {
    font-size: 11.5px;
    line-height: 1.3;
    color: var(--muted);
}

.svc-tile.active {
    border-color: var(--primary);
    background: var(--primary-tint);
}

.svc-tile.active .svc-icon {
    background: var(--primary);
    color: var(--on-color);
}

.svc-tile.active .svc-name { color: var(--primary-ink); }

.svc-tile.active .svc-api {
    border-color: var(--badge-active-line);
    background: var(--badge-active-bg);
    box-shadow: var(--badge-active-shadow);
    color: var(--on-color);
}

.svc-tile.active .svc-api::before { background: var(--on-color); }

.hero { max-width: 100%; margin-bottom: 24px; }

.title-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 8px;
}

.title-row h1 { margin: 0; }

.title-api {
    font-size: 20px;
    font-weight: 600;
    color: var(--success-ink);
    text-decoration: none;
    white-space: nowrap;
    transition: color .15s ease;
}

.title-api:hover { text-decoration: underline; }

.title-api:focus-visible {
    outline: 2px solid var(--success-ink);
    outline-offset: 3px;
    border-radius: 6px;
}

h1 {
    margin: 0 0 8px;
    font-size: clamp(2rem, 4.4vw, 2.75rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -.03em;
    color: var(--ink);
    text-wrap: balance;
}

.subtitle {
    margin: 0;
    max-width: 64ch;
    font-size: 15.5px;
    line-height: 1.6;
    color: var(--muted);
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: start;
}

.layout-main,
.layout-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.layout + .card { margin-top: 20px; }

.card {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line-soft);
}

.card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
}

.card-body { padding: 20px; }

.status-badge {
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--primary-tint);
    color: var(--primary-ink);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.card-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
}

.card-meta {
    font-size: 12.5px;
    color: var(--muted);
}

.card-meta b {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-grid + .form-grid { margin-top: 12px; }

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.field label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-soft);
}

.field input,
.field select {
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-family: inherit;
    font-size: 15px;
}

.field select { padding-right: 32px; }

.field input:hover,
.field select:hover { border-color: var(--line-strong); }

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}

.hint {
    margin: 8px 0 0;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--muted);
}

.calc-hint { margin-top: 12px; }

.result {
    margin-top: 16px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: var(--primary-tint);
}

.result-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.result-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
}

.result-value {
    font-size: clamp(1.9rem, 4vw, 2.35rem);
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.1;
    color: var(--primary-ink);
    font-variant-numeric: tabular-nums;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 28px;
    margin: 16px 0 0;
    padding-top: 4px;
    border-top: 1px solid var(--primary-line);
}

.result-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--primary-line);
}

.result-row dt {
    font-size: 12.5px;
    color: var(--ink-soft);
}

.result-row dd {
    margin: 0;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .12s ease;
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary);
    color: var(--on-color);
}

.btn-primary:hover { background: var(--primary-strong); }

.btn-primary:active { transform: translateY(1px); }

.btn-ghost {
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink-soft);
}

.btn-ghost:hover {
    border-color: var(--primary);
    background: var(--primary-tint);
    color: var(--primary-ink);
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.field input:disabled,
.field select:disabled {
    background: var(--surface-soft);
    color: var(--muted);
    cursor: not-allowed;
}

.api-price {
    margin: 0 0 8px;
    font-size: 34px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.02em;
    color: var(--primary-ink);
    font-variant-numeric: tabular-nums;
}

.plan-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0 16px;
    padding: 0;
    list-style: none;
    font-size: 13.5px;
    color: var(--ink-soft);
}

.plan-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.plan-list li::before {
    content: "¹3";
    flex: none;
    color: var(--success-ink);
    font-weight: 700;
}

.api-cta {
    width: 100%;
    text-decoration: none;
}

.formula {
    margin: 0 0 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table th,
.table td {
    padding: 12px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    white-space: nowrap;
}

.table th {
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.table tbody tr:last-child td { border-bottom: none; }

.table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table .sum {
    color: var(--primary-ink);
    font-weight: 700;
}

.table tfoot td {
    background: var(--surface-soft);
    font-weight: 700;
}

.table .foot-label {
    text-align: right;
    color: var(--muted);
    font-weight: 600;
}

.link-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--danger);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.link-btn:hover { text-decoration: underline; }

.link-btn:focus-visible {
    outline: 2px solid var(--danger);
    outline-offset: 3px;
    border-radius: 4px;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 50;
    max-width: min(92vw, 460px);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: var(--on-color);
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 16px);
    transition: opacity .2s ease, transform .2s ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast.is-error { background: var(--danger); }

.footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    margin-top: 32px;
    font-size: 13px;
    color: var(--muted);
    text-align: center;
}

.footer div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0 4px;
}

.footer a {
    color: var(--muted);
    text-decoration: none;
    transition: color .15s ease;
}

.footer a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.footer a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

.footer .footer-highlight {
    color: var(--primary);
    font-weight: 600;
}

.footer-sep {
    margin: 0 8px;
    color: var(--line-strong);
}

.contact-modal {
    width: min(92vw, 420px);
    max-width: 420px;
    margin: auto;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--ink);
}

.contact-modal::backdrop { background: var(--overlay); }

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

.contact-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.contact-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    font-family: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.contact-close:hover {
    border-color: var(--primary);
    color: var(--primary-ink);
}

.contact-close:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.contact-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.contact-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.contact-list span {
    font-size: 12.5px;
    color: var(--muted);
}

.contact-list a {
    color: var(--primary-ink);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.contact-list a:hover { text-decoration: underline; }

.contact-list a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

@media (min-width: 1420px) {
    .top-wrap { margin: 0; height: 0; }
    .top-links {
        position: fixed;
        top: 24px;
        right: 16px;
        z-index: 40;
        width: calc(50% - 588px);
        max-width: 520px;
    }
}

@media (max-width: 860px) {
    .svc-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
    .layout { grid-template-columns: minmax(0, 1fr); }
    .layout-side {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .layout-side > .card { flex: 1 1 280px; }
}

@media (max-width: 640px) {
    body { padding: 16px 0 28px; }
    .top-wrap { margin: 0 0 12px; }
    .top-links { max-width: none; }
    .top-link {
        min-height: 32px;
        padding: 0 12px;
        font-size: 12px;
        gap: 4px;
        border-radius: 0;
    }
    .hero { padding: 0 16px; }
    .layout { gap: 16px; }
    .svc-rail {
        margin-bottom: 24px;
        padding: 8px;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }
    .card {
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }
    .footer { padding: 0 16px; }
    .svc-tile {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 8px 4px;
        text-align: center;
    }
    .svc-icon {
        width: 30px;
        height: 30px;
    }
    .svc-name {
        justify-content: center;
        font-size: 12.5px;
    }
    .svc-api {
        margin-left: 0;
        font-size: 8px;
    }
    .svc-sub { display: none; }
    .footer-sep { display: none; }
    .footer div { gap: 4px 12px; }
    .hero { margin-bottom: 20px; }
    .title-api { font-size: 17px; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .result-grid { grid-template-columns: minmax(0, 1fr); }
    .card-head { padding: 12px 16px; }
    .card-body { padding: 16px; }
    .layout-side { flex-direction: column; }
    .layout-side > .card { flex: 1 1 auto; }
    .card-actions .btn { flex: 1 1 auto; }
    .table th,
    .table td {
        padding: 8px 12px;
        font-size: 12.5px;
    }
    .result { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
