/*
 * Kinderlicht public surfaces
 * Final, shared polish for authentication, invitation, case, request and event pages.
 * This intentionally loads after each page's local styles so the existing page-specific
 * layouts and behavior remain intact while their visual language stays consistent.
 */

:root {
    --public-ink: #18181b;
    --public-ink-soft: #3f3f46;
    --public-muted: #62616b;
    --public-orange: #c2410c;
    --public-orange-hover: #9a3412;
    --public-orange-soft: #fff4e8;
    --public-canvas: #f6f4f1;
    --public-surface: #ffffff;
    --public-surface-soft: #faf9f7;
    --public-border: #dedbd5;
    --public-border-strong: #c9c4bc;
    --public-danger: #b42318;
    --public-success: #047857;
    --public-focus: rgba(194, 65, 12, .24);
    --public-shadow-sm: 0 1px 2px rgba(24, 24, 27, .05), 0 6px 18px rgba(24, 24, 27, .04);
    --public-shadow-lg: 0 24px 64px rgba(24, 24, 27, .11);

    --bg: var(--public-canvas);
    --surface: var(--public-surface);
    --surface-soft: var(--public-surface-soft);
    --text: var(--public-ink);
    --muted: var(--public-muted);
    --orange: var(--public-orange);
    --orange-dark: var(--public-orange-hover);
    --primary: var(--public-orange);
    --primary-dark: var(--public-orange-hover);
    --secondary: var(--public-ink-soft);
    --border: var(--public-border);
    --danger: var(--public-danger);
    --success: var(--public-success);
    --focus: var(--public-focus);
    --shadow: var(--public-shadow-lg);
}

html {
    color-scheme: light;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: clip;
    background:
        radial-gradient(circle at 92% -8%, rgba(249, 115, 22, .14), transparent 30rem),
        linear-gradient(180deg, #fff 0, var(--public-canvas) 28rem) !important;
    color: var(--public-ink) !important;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    line-height: 1.55;
}

body,
main,
section,
article,
aside,
form,
fieldset,
.page,
.panel,
.hero,
.card,
.item,
.layout,
.workspace,
.section-grid,
.grid-2,
.contact-form-grid {
    min-width: 0;
}

img,
video,
iframe,
svg,
canvas {
    max-width: 100%;
}

a {
    color: var(--public-orange-hover);
    text-underline-offset: .18em;
    text-decoration-thickness: .08em;
}

a:hover {
    text-decoration-thickness: .12em;
}

:where(a, button, input, textarea, select, summary):focus-visible {
    outline: 3px solid var(--public-focus) !important;
    outline-offset: 2px !important;
}

::selection {
    color: var(--public-ink);
    background: #fed7aa;
}

.skip-link {
    position: fixed;
    z-index: 9999;
    top: .65rem;
    left: .65rem;
    padding: .65rem .85rem;
    border-radius: 10px;
    background: var(--public-ink);
    color: #fff;
    font-weight: 800;
    text-decoration: none;
    transform: translateY(calc(-100% - 1rem));
    transition: transform .15s ease;
}

.skip-link:focus {
    color: #fff;
    transform: translateY(0);
}

[hidden] {
    display: none !important;
}

.page {
    padding: clamp(.8rem, 2.2vw, 1.5rem) !important;
}

.brand {
    min-height: 64px;
    gap: .8rem !important;
    padding-block: .5rem 1rem !important;
    color: var(--public-ink) !important;
    border-radius: 14px;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    width: 44px !important;
    height: 44px !important;
    flex: 0 0 44px;
    border-radius: 13px !important;
    background: linear-gradient(145deg, #f97316 0 48%, #27272a 48% 100%) !important;
    box-shadow: 0 8px 18px rgba(194, 65, 12, .18);
    color: #fff !important;
    font-size: .9rem;
    letter-spacing: -.03em;
}

.brand strong {
    color: var(--public-ink);
    font-size: 1.02rem;
    letter-spacing: -.015em;
}

.brand span span {
    color: var(--public-muted) !important;
}

:where(.hero, .panel, .card, .form-panel, .faq) {
    border-color: var(--public-border) !important;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, .96) !important;
    box-shadow: var(--public-shadow-sm) !important;
}

.hero {
    position: relative;
    overflow: hidden;
    padding: clamp(1.2rem, 4vw, 2.15rem) !important;
    box-shadow: var(--public-shadow-lg) !important;
}

.hero::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: linear-gradient(180deg, #fb923c, var(--public-orange));
    content: "";
}

:where(h1, h2, h3) {
    color: var(--public-ink);
    text-wrap: balance;
}

h1 {
    letter-spacing: -.035em !important;
}

h2 {
    letter-spacing: -.02em !important;
}

p,
.muted,
.hint,
.meta {
    overflow-wrap: anywhere;
}

.eyebrow,
.step-kicker {
    color: var(--public-orange-hover) !important;
    font-weight: 850 !important;
    letter-spacing: .1em !important;
}

.panel {
    padding: clamp(1rem, 2.5vw, 1.35rem) !important;
}

.panel-head {
    padding-bottom: .7rem;
    border-bottom: 1px solid var(--public-border);
}

.item,
.child-item,
.person-entry,
.logistics-card,
.chat-message,
.topic-thread,
.request-decision,
.tracking-box,
.optional-empty,
.next-step {
    border-color: var(--public-border) !important;
    border-radius: 13px !important;
    background: var(--public-surface-soft) !important;
}

.empty,
.state {
    border: 1px dashed var(--public-border-strong) !important;
    border-radius: 14px !important;
    background: var(--public-surface-soft) !important;
    color: var(--public-muted) !important;
}

label {
    color: var(--public-ink-soft);
    font-weight: 750 !important;
}

input,
textarea,
select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 46px !important;
    border: 1px solid var(--public-border-strong) !important;
    border-radius: 11px !important;
    background: #fff !important;
    color: var(--public-ink) !important;
    font: inherit;
    box-shadow: 0 1px 1px rgba(24, 24, 27, .025);
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

textarea {
    min-height: 118px !important;
    resize: vertical;
}

input:hover,
textarea:hover,
select:hover {
    border-color: #aaa39a !important;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--public-orange) !important;
    box-shadow: 0 0 0 4px var(--public-focus) !important;
    outline: 0 !important;
}

input[readonly],
input:disabled,
textarea:disabled,
select:disabled {
    background: #f1efec !important;
    color: var(--public-muted) !important;
}

:where(input, textarea, select):user-invalid {
    border-color: var(--public-danger) !important;
    box-shadow: 0 0 0 3px rgba(180, 35, 24, .11) !important;
}

input[type="checkbox"],
input[type="radio"] {
    width: 1.2rem !important;
    min-width: 1.2rem !important;
    min-height: 1.2rem !important;
    height: 1.2rem !important;
    padding: 0 !important;
    accent-color: var(--public-orange);
    box-shadow: none !important;
}

input[type="file"] {
    min-height: 48px !important;
    padding: .45rem !important;
    overflow: hidden;
}

input[type="file"]::file-selector-button {
    min-height: 34px;
    margin-right: .65rem;
    border: 0;
    border-radius: 8px;
    padding: .4rem .7rem;
    background: #ece9e4;
    color: var(--public-ink);
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

:where(button, .btn, .button) {
    min-height: 44px !important;
    max-width: 100%;
    border-radius: 11px !important;
    font-weight: 800 !important;
    line-height: 1.2;
    text-decoration: none;
    transition: transform .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

:where(button, .btn, .button):not(:disabled):active {
    transform: translateY(1px);
}

:where(.btn-primary, .button, .auth-card button:not(.secondary)) {
    background: var(--public-orange) !important;
    color: #fff !important;
}

:where(.btn-primary, .button, .auth-card button:not(.secondary)):hover {
    background: var(--public-orange-hover) !important;
}

:where(.btn-secondary, button.secondary) {
    border-color: var(--public-border-strong) !important;
    background: #fff !important;
    color: var(--public-ink-soft) !important;
}

:where(.btn-secondary, button.secondary):hover {
    border-color: #a8a29e !important;
    background: #f6f4f1 !important;
}

.btn-danger {
    border-color: #f0b8b3 !important;
    background: #fff5f4 !important;
    color: #9f1d15 !important;
}

:where(button, .btn, .button):disabled,
:where(button, .btn, .button)[aria-busy="true"] {
    cursor: wait !important;
    opacity: .68;
    transform: none !important;
}

.spinner {
    width: 1rem !important;
    height: 1rem !important;
    border-width: 2px !important;
}

.notice,
.message,
.error,
.step-error {
    border-radius: 12px !important;
}

.notice.active,
.error:not(:empty),
.message:not(:empty),
.step-error.active {
    padding: .8rem .9rem !important;
}

.notice.error,
.error:not(:empty),
.message:not(.success):not(:empty),
.state-error {
    border: 1px solid #f4c7c3 !important;
    background: #fff5f4 !important;
    color: #8e1b14 !important;
}

.notice.success,
.message.success {
    border: 1px solid #a7dfc8 !important;
    background: #f0fdf7 !important;
    color: #046343 !important;
}

.status-pill,
.badge,
.summary-chip {
    border-radius: 999px !important;
    font-weight: 800 !important;
}

details {
    border-color: var(--public-border) !important;
    border-radius: 13px !important;
}

summary {
    min-height: 44px;
    align-content: center;
    cursor: pointer;
}

table {
    max-width: 100%;
}

.markdown-table-wrap,
.table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    border-radius: 12px;
}

.footer,
footer {
    color: var(--public-muted) !important;
}

/* Authentication has a deliberately calm, focused single-task shell. */
.auth-page {
    display: grid !important;
    place-items: center !important;
    min-height: 100dvh !important;
    padding: clamp(.75rem, 3vw, 2rem) !important;
}

.auth-card {
    width: min(480px, 100%) !important;
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: clamp(1.2rem, 4vw, 2rem) !important;
    border: 1px solid var(--public-border) !important;
    border-radius: 20px !important;
    background: rgba(255, 255, 255, .97) !important;
    box-shadow: var(--public-shadow-lg) !important;
}

.auth-card .brand {
    padding-top: 0 !important;
    margin-bottom: .45rem;
}

.auth-card h1 {
    margin-top: .25rem;
    font-size: clamp(1.7rem, 6vw, 2.15rem);
}

.auth-card p {
    margin-bottom: 1rem;
}

.auth-card label {
    margin-top: .85rem;
}

.auth-card button,
.auth-card .button {
    width: 100%;
}

.auth-register {
    margin-top: 1.25rem;
    padding: 0 !important;
    background: transparent !important;
}

.auth-register > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .7rem .8rem;
    list-style: none;
}

.auth-register > summary::-webkit-details-marker {
    display: none;
}

.auth-register > summary::after {
    content: "+";
    color: var(--public-orange-hover);
    font-size: 1.3rem;
}

.auth-register[open] > summary::after {
    content: "−";
}

.auth-register-content {
    padding: 0 .8rem .85rem;
    border-top: 1px solid var(--public-border);
}

.auth-card code {
    border-radius: 5px;
    padding: .08rem .3rem;
    background: #f0ede9;
    color: var(--public-ink-soft);
    font-size: .9em;
}

.password-guidance {
    margin: .35rem 0 0 !important;
    color: var(--public-muted);
    font-size: .88rem;
}

/* Dense public case/event workspaces stay generous on desktop and become linear on mobile. */
.case-page .layout,
.workspace {
    gap: 1.15rem !important;
}

.status-journey {
    display: grid;
    grid-template-columns: minmax(12rem, .32fr) minmax(0, 1fr);
    align-items: center;
    gap: 1.2rem;
    margin: 1rem 0;
    padding: 1rem 1.15rem;
    border: 1px solid var(--public-border);
    border-radius: 16px;
    background: rgba(255,255,255,.92);
    box-shadow: var(--public-shadow-sm);
}
.status-journey-head { min-width: 0; display: grid; }
.status-journey-head .eyebrow { font-size: .66rem; }
.status-journey-head strong { color: var(--public-ink); font-size: .92rem; }
.status-journey-head > span:last-child { margin-top: .15rem; color: var(--public-muted); font-size: .75rem; }
.status-journey ol {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}
.status-journey li {
    position: relative;
    min-width: 0;
    display: grid;
    justify-items: center;
    gap: .35rem;
    color: #8a847c;
    text-align: center;
}
.status-journey li::before {
    content: "";
    position: absolute;
    top: .9rem;
    right: 50%;
    left: -50%;
    height: 2px;
    background: var(--public-border);
}
.status-journey li:first-child::before { display: none; }
.status-journey li > span {
    position: relative;
    z-index: 1;
    width: 1.8rem;
    height: 1.8rem;
    display: grid;
    place-items: center;
    border: 2px solid var(--public-border-strong);
    border-radius: 50%;
    background: #fff;
    font-size: .68rem;
    font-weight: 850;
}
.status-journey li strong { overflow-wrap: anywhere; font-size: .68rem; line-height: 1.25; }
.status-journey li.is-complete::before,
.status-journey li.is-current::before { background: var(--public-orange); }
.status-journey li.is-complete > span { border-color: var(--public-orange); background: var(--public-orange); color: #fff; }
.status-journey li.is-current > span { border-color: var(--public-orange); color: var(--public-orange-hover); box-shadow: 0 0 0 4px var(--public-focus); }
.status-journey li.is-current strong { color: var(--public-ink); }
.request-case-relation {
    margin: .75rem 0 0;
    padding: .7rem .8rem;
    border-left: 3px solid var(--public-orange);
    border-radius: 8px;
    background: var(--public-orange-soft);
    color: var(--public-ink-soft);
    font-size: .84rem;
}
#progressPanel.has-no-progress .progress-bar { display: none; }

.next-step {
    top: 1rem !important;
}

.notification-stack {
    width: min(390px, calc(100vw - 1.5rem)) !important;
}

.topic-card {
    min-height: 54px;
}

.consent,
.privacy,
.check-field,
.needs-na,
.request-edit-check {
    border-color: var(--public-border) !important;
    border-radius: 12px !important;
    background: var(--public-surface-soft) !important;
}

.form-progress {
    background: var(--public-surface-soft) !important;
}

.progress-bar {
    background: linear-gradient(90deg, var(--public-orange), #fb923c) !important;
}

.step-indicator.is-active .step-indicator-number {
    border-color: var(--public-orange) !important;
    background: var(--public-orange) !important;
}

@media (max-width: 760px) {
    body {
        background:
            radial-gradient(circle at 100% 0, rgba(249, 115, 22, .11), transparent 18rem),
            var(--public-canvas) !important;
    }

    .page {
        width: 100% !important;
        padding: .65rem !important;
    }

    .brand {
        min-height: 58px;
        padding-inline: .2rem !important;
    }

    :where(.hero, .panel, .card, .form-panel, .faq) {
        border-radius: 15px !important;
    }

    .hero,
    .panel {
        padding: 1rem !important;
    }

    h1 {
        font-size: clamp(1.65rem, 8vw, 2.15rem) !important;
        overflow-wrap: anywhere;
    }

    .grid-2,
    .contact-form-grid,
    .section-grid,
    .hero-grid,
    .topic-shell,
    .location-picker,
    .route-box {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .hero-grid > :last-child,
    .hero-actions,
    .actions,
    .file-actions,
    .form-actions,
    .message-head {
        width: 100%;
    }

    .hero-actions,
    .actions,
    .file-actions,
    .form-actions {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr);
        gap: .5rem !important;
    }

    :where(.hero-actions, .actions, .file-actions, .form-actions) > :where(button, .btn, .button, a) {
        width: 100%;
        justify-content: center;
    }

    input,
    textarea,
    select,
    button,
    .btn,
    .button {
        font-size: 16px !important;
    }

    .topic-list {
        display: flex !important;
        max-width: 100%;
        overflow-x: auto;
        padding-bottom: .3rem;
        scroll-snap-type: x proximity;
    }

    .topic-card {
        min-width: min(78vw, 280px);
        scroll-snap-align: start;
    }

    .route-arrow {
        transform: rotate(90deg);
        justify-self: center;
    }

    .next-step {
        position: static !important;
        order: -1;
    }

    .status-journey { grid-template-columns: 1fr; gap: .8rem; padding: .9rem; }
    .status-journey-head { text-align: left; }
    .status-journey li strong { font-size: .62rem; }

    .step-list {
        gap: .3rem !important;
    }

    .step-indicator {
        justify-content: center;
    }

    .step-indicator > span:not(.step-indicator-number) {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .form-progress {
        padding: .8rem !important;
    }

    .form-step {
        padding: 1rem !important;
    }

    .markdown-table-wrap,
    .table-wrap {
        margin-inline: -.25rem;
    }
}

@media (max-width: 520px) {
    .auth-page {
        place-items: start center !important;
        padding: .5rem !important;
    }

    .auth-card {
        max-height: none;
        padding: 1rem !important;
        border-radius: 16px !important;
    }

    .notification-stack {
        inset: .5rem .5rem auto !important;
        width: auto !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media (forced-colors: active) {
    :where(.hero, .panel, .card, .form-panel, .faq, input, textarea, select, button, .btn, .button) {
        border: 1px solid CanvasText !important;
    }
}
