@import url("/assets/fonts/noto-sans/noto-sans.css");

:root {
    --bg: #f7f8fa;
    --panel: #ffffff;
    --ink: #1f2937;
    --muted: #667085;
    --line: #d9e0e7;
    --soft: #f1f5f9;
    --accent: #0f7f95;
    --accent-2: #cd7a25;
    --safe-top: env(safe-area-inset-top, 0px);
    --legal-anchor-offset: calc(88px + var(--safe-top));
}

html {
    scroll-padding-top: var(--legal-anchor-offset);
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: "Noto Sans", Arial, sans-serif;
    letter-spacing: 0;
}

body.legal-admin-shell {
    background: var(--bg) !important;
    color: var(--ink);
}

.page-fade-ready body {
    opacity: 0;
    transform: translateY(4px);
}

.page-fade-ready.page-fade-in body {
    opacity: 1;
    transform: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.page-loading-layer {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(247, 248, 250, 0.58);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.14s ease;
}

.page-loading-layer.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.page-loading-card {
    display: grid;
    justify-items: center;
    gap: 10px;
    width: min(100%, 320px);
    border: 1px solid rgba(217, 224, 231, 0.92);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    padding: 16px;
    box-shadow: 0 18px 46px rgba(17, 24, 39, 0.14);
}

.page-loading-skeleton:empty {
    display: none;
}

.page-loading-message {
    color: #4b5563;
    font-size: 13px;
    font-weight: 800;
}

.loading-spinner,
.loading-button-spinner {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 2px solid rgba(15, 127, 149, 0.2);
    border-top-color: var(--accent);
    animation: legal-loading-spin 0.75s linear infinite;
}

.loading-skeleton-grid,
.loading-skeleton-form,
.loading-skeleton-table {
    width: 100%;
    display: grid;
    gap: 8px;
}

.loading-skeleton-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.loading-skeleton-table {
    grid-template-columns: 0.8fr 1.2fr 0.9fr;
}

.loading-skeleton-grid span,
.loading-skeleton-form span,
.loading-skeleton-table span {
    display: block;
    min-height: 13px;
    border-radius: 8px;
    background: linear-gradient(90deg, #e5e7eb 0%, #f8fafc 42%, #e5e7eb 78%);
    background-size: 220% 100%;
    animation: legal-loading-shimmer 1.2s ease-in-out infinite;
}

.loading-skeleton-grid span {
    min-height: 52px;
}

@keyframes legal-loading-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes legal-loading-shimmer {
    0% { background-position: 120% 0; }
    100% { background-position: -120% 0; }
}

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

    .page-fade-ready body {
        opacity: 1;
        transform: none;
    }
}

body *,
body *::before,
body *::after {
    box-sizing: border-box;
    letter-spacing: 0;
}

.skip-link {
    position: fixed;
    left: 12px;
    top: 10px;
    z-index: 100;
    padding: 10px 12px;
    border-radius: 8px;
    background: #111827;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transform: translateY(-140%);
    transition: transform 0.14s ease;
}

.skip-link:focus-visible {
    transform: translateY(0);
}

.legal-topbar {
    position: sticky;
    top: 0;
    z-index: 980;
    padding: calc(10px + var(--safe-top)) 16px 10px;
    background: #111827;
    color: #ffffff;
    border-bottom: 1px solid #1f2937;
}

.legal-topbar-row {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.legal-brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.legal-brand-mark {
    width: 138px;
    height: 36px;
    display: grid;
    place-items: center;
}

.legal-brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.legal-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.legal-nav a,
.legal-action {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
}

.legal-nav a[aria-current="page"] {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.legal-nav a:hover {
    background: #f3f4f6;
    color: #111827;
}

.legal-nav a[aria-current="page"]:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}

.legal-nav .legal-nav-danger {
    background: #7f1d1d;
    border-color: #991b1b;
    color: #fee2e2;
}

.legal-nav .legal-nav-danger:hover {
    background: #991b1b;
    border-color: #b91c1c;
    color: #ffffff;
}

.legal-wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

.legal-admin-shell .legal-wrap {
    padding-top: 24px;
}

.legal-hero {
    margin: 8px 0 22px;
}

.legal-kicker {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.legal-title {
    margin: 0 0 10px;
    max-width: 760px;
    color: #111827;
    font-size: clamp(30px, 5vw, 44px);
    line-height: 1.08;
}

.legal-lead {
    margin: 0;
    max-width: 780px;
    color: #475467;
    font-size: 16px;
    line-height: 1.6;
}

.legal-meta {
    margin: 14px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.legal-pill {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    color: #536271;
    font-size: 12px;
    font-weight: 700;
}

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

.legal-toc {
    position: sticky;
    top: calc(74px + var(--safe-top));
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 14px;
}

.legal-toc h2 {
    margin: 0 0 10px;
    color: #111827;
    font-size: 14px;
}

.legal-toc nav {
    display: grid;
    gap: 2px;
}

.legal-toc a {
    display: block;
    padding: 7px 0;
    color: #475467;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-decoration: none;
}

.legal-toc a:hover {
    color: var(--accent);
}

.legal-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    overflow: hidden;
}

.legal-section {
    padding: 22px 24px;
    scroll-margin-top: var(--legal-anchor-offset);
}

.legal-section + .legal-section {
    border-top: 1px solid var(--line);
}

.legal-section h2 {
    margin: 0 0 10px;
    color: #111827;
    font-size: 22px;
    line-height: 1.2;
}

.legal-section h3 {
    margin: 18px 0 8px;
    color: #243244;
    font-size: 16px;
    line-height: 1.25;
}

.legal-section p {
    margin: 0 0 12px;
    color: #344054;
    font-size: 14px;
    line-height: 1.65;
}

.legal-section p:last-child {
    margin-bottom: 0;
}

.legal-section ul {
    margin: 10px 0 0;
    padding-left: 20px;
    color: #344054;
}

.legal-section li {
    margin: 7px 0;
    line-height: 1.6;
}

.legal-note {
    border-left: 4px solid var(--accent-2);
    background: #fff8ed;
    padding: 12px 14px;
    border-radius: 0 8px 8px 0;
}

.legal-section .legal-note {
    color: #51391f;
}

.legal-link-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.legal-link-grid a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--soft);
    color: #1f4f72;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
}

.legal-footer {
    margin-top: 24px;
    padding: 14px 0 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.legal-footer a {
    color: #475467;
    font-weight: 700;
    text-decoration: none;
}

.legal-footer-links {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

a:focus-visible,
button:focus-visible {
    outline: 3px solid rgba(15, 127, 149, 0.45);
    outline-offset: 2px;
    border-radius: 8px;
}

@media (max-width: 860px) {
    :root {
        --legal-anchor-offset: calc(168px + var(--safe-top));
    }

    .legal-topbar-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .legal-nav {
        justify-content: flex-start;
    }

    .legal-layout {
        grid-template-columns: 1fr;
    }

    .legal-toc {
        position: static;
    }
}

@media (max-width: 560px) {
    :root {
        --legal-anchor-offset: calc(228px + var(--safe-top));
    }

    .legal-topbar {
        padding-left: 14px;
        padding-right: 14px;
    }

    .legal-brand-mark {
        width: 128px;
        height: 34px;
    }

    .legal-nav {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .legal-nav a {
        padding: 0 10px;
    }

    .legal-wrap {
        padding: 22px 14px 44px;
    }

    .legal-section {
        padding: 18px 16px;
    }
}
