:root {
    font-family: Roboto, "Segoe UI", sans-serif;
    --page-header-height: 64px;
}

.page-message-region { position: sticky; top: var(--page-header-height); z-index: 1050; background: var(--mud-palette-background); }
.public-toolbar-spacer { flex: 1 1 auto; }
.page-message-container { padding-top: 0; padding-bottom: 0; }
.page-message-container:has(.mud-alert) { padding-top: 8px; padding-bottom: 8px; }
.page-message-scroll { max-height: min(45dvh, calc(100dvh - var(--page-header-height) - 100px)); overflow-y: auto; overscroll-behavior: contain; }
.page-message-scroll:focus-visible { outline: 3px solid var(--mud-palette-primary); outline-offset: -3px; }
.page-message { margin-bottom: 8px; }
.page-message:last-child { margin-bottom: 0; }
.page-message .mud-alert-message { min-width: 0; width: 100%; }
.page-message-row { display: flex; gap: 8px; align-items: flex-start; }
.page-message-text { min-width: 0; flex: 1; overflow-wrap: anywhere; white-space: pre-wrap; }
.page-message-text a { display: inline-block; margin-left: .35em; }
.page-message-row .mud-icon-button { flex-shrink: 0; min-width: 44px; min-height: 44px; }
@media (max-width: 599px) {
    :root { --page-header-height: 56px; }
    .authenticated-layout { --page-header-height: 112px; }
    .public-layout .app-toolbar .mud-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px; padding-left: 8px; padding-right: 8px; }
    .public-layout .app-toolbar .public-toolbar-spacer { display: none; }
    .public-layout .artree-brand { min-width: 0; margin-right: 0; }
    .public-layout .app-toolbar .mud-button-root { min-width: 0; padding-left: 4px; padding-right: 4px; font-size: .75rem; }
}

body {
    margin: 0;
    background: #f6f7fb;
}

.account-panel {
    max-width: 32rem;
}

.registration-confirmation { overflow-wrap: anywhere; }
.confirmation-address { display: block; margin-top: .4rem; }
.registration-confirmation h1 { scroll-margin-top: calc(var(--page-header-height) + 16px); }
.registration-confirmation .mud-button-root { white-space: normal; max-width: 100%; }

.validation-message,
.validation-summary-errors {
    color: #b3261e;
}

#blazor-error-ui {
    background: #fff2f2;
    border-top: 1px solid #b3261e;
    bottom: 0;
    display: none;
    left: 0;
    padding: 1rem;
    position: fixed;
    right: 0;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    float: right;
}

.loading-progress {
    display: block;
    height: 8rem;
    margin: 20vh auto 1rem;
    width: 8rem;
}

.loading-progress circle {
    fill: none;
    stroke: #d7d9e0;
    stroke-width: .6rem;
}

.loading-progress circle:last-child {
    stroke: #6750a4;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * .8), 500%;
}

.loading-progress-text {
    text-align: center;
}
.app-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 70vh; padding: 24px; text-align: center; }
.app-loading-progress { margin-top: 16px; max-width: 100%; width: 200px; }

.artree-login { max-width: 480px; margin: 0 auto; }
.artree-logo { display: block; width: 100%; max-width: 320px; height: auto; object-fit: contain; background: #fff; margin: 0 auto 20px; border-radius: 12px; }
.artree-brand { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; margin-right: 16px; color: inherit; text-decoration: none; font-size: 1.1rem; font-weight: 600; }
.artree-header-logo { display: block; width: 72px; height: auto; object-fit: contain; background: #fff; border-radius: 4px; }
.artree-brand span { max-width: 170px; overflow-wrap: anywhere; line-height: 1.2; }
.artree-login .mud-typography { overflow-wrap: anywhere; }
.artree-brand:focus-visible { outline: 3px solid white; outline-offset: 3px; border-radius: 4px; }
.app-toolbar .mud-toolbar { align-items: center; }
.app-toolbar .mud-select { width: 100%; min-width: 0; }
.app-toolbar .mud-select-input { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 959px) {
    .artree-brand { gap: 5px; margin-right: 8px; font-size: .9rem; }
    .artree-header-logo { width: 42px; }
    .artree-brand span { max-width: 105px; }
    .artree-logo { max-width: 260px; }
    .app-toolbar .mud-toolbar { padding-left: 12px; padding-right: 12px; }
    .app-toolbar .mud-icon-button { width: 44px; min-width: 44px; flex-shrink: 0; }
    .app-toolbar .mud-menu { flex-shrink: 0; }
}
.home-section { overflow-wrap: anywhere; }
.home-event { padding: 12px 0; border-bottom: 1px solid #e1e1e8; }
.people-sort-explanation { display: block; overflow-wrap: anywhere; }
.events-list { list-style: none; padding: 0; margin: 0; }
.events-list li, .event-author { overflow-wrap: anywhere; }
.event-heading { display: flex; gap: 10px; align-items: center; min-width: 0; }
.event-filter-actions { flex-wrap: wrap; }
.event-heading > div { min-width: 0; overflow-wrap: anywhere; }
.people-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.people-list .person-list-item { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 12px; padding: 12px; min-height: 64px; border: 1px solid var(--mud-palette-lines-default); border-radius: 8px; background: var(--mud-palette-surface); color: var(--mud-palette-text-primary); text-decoration: none; }
.people-list .person-list-item { grid-template-columns: 56px minmax(0, 1fr); }
.person-list-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.person-list-name { font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.person-list-date { font-size: .9rem; line-height: 1.4; }
.people-list-photo { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; }
.people-list-placeholder { display: flex; align-items: center; justify-content: center; background: var(--mud-palette-background-grey); color: var(--mud-palette-text-secondary); }
.people-list .person-list-item:hover { border-color: var(--mud-palette-primary); }
.people-list .person-list-item:focus-visible { outline: 3px solid var(--mud-palette-primary); outline-offset: 2px; }

.tree-switcher { flex: 1 1 180px; min-width: 0; max-width: 420px; align-self: center; }
.tree-switcher .mud-input-control { margin: 0; }
.tree-switcher .mud-input { height: 44px; min-height: 44px; background: white; border-radius: 4px; }
.tree-switcher-popover .mud-list-item-text, .tree-switcher-popover .mud-list-item { white-space: normal; overflow-wrap: anywhere; }
.screen-reader-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.tree-choices { max-width: 640px; }
.tree-choice { justify-content: flex-start; text-align: left; white-space: normal; overflow-wrap: anywhere; min-height: 48px; }
#new-tree { scroll-margin-top: 80px; }
@media (max-width: 599px) {
    .authenticated-layout .app-toolbar .mud-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 44px 44px; gap: 6px; min-height: 112px; padding-top: 6px; padding-bottom: 6px; }
    .authenticated-layout .artree-brand { grid-column: 1; grid-row: 1; min-width: 0; }
    .authenticated-layout .tree-switcher { grid-column: 1 / -1; grid-row: 2; max-width: none; width: 100%; }
    .authenticated-layout .toolbar-notifications { grid-column: 2; grid-row: 1; }
    .authenticated-layout .toolbar-account { grid-column: 3; grid-row: 1; }
    .authenticated-layout .mud-main-content { padding-top: 112px; }
    #new-tree { scroll-margin-top: 124px; }
}
.account-menu-email { overflow-wrap: anywhere; max-width: 280px; }
.desktop-navigation { position: fixed; top: 64px; bottom: 0; width: 200px; padding: 24px 12px; background: white; border-right: 1px solid #ddd; }
.mobile-navigation { display: none; }
.authenticated-layout .mud-main-content { padding-left: 200px; }
.section-link { display: flex; gap: 12px; align-items: center; padding: 12px; color: #333; text-decoration: none; border-radius: 8px; min-height: 48px; }
.section-link.active { color: #4935b8; background: #eee9ff; font-weight: 600; }
.section-link:focus-visible, .skip-link:focus-visible { outline: 3px solid #205ab8; outline-offset: -3px; }
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 1500; background: white; padding: 12px; }
.skip-link:focus { top: 8px; }
@media (max-width: 959px) {
    .desktop-navigation { display: none; }
    .mobile-navigation { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1100; background: white; border-top: 1px solid #ddd; padding-bottom: env(safe-area-inset-bottom); }
    .mobile-navigation .section-link { flex: 1; flex-direction: column; gap: 2px; padding: 8px 0; border-radius: 0; font-size: .8rem; }
    .authenticated-layout .mud-main-content { padding-left: 0; padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
}

.person-photo {
    width: 180px;
    max-height: 220px;
    object-fit: contain;
}

.person-sections { display: flex; flex-wrap: wrap; gap: 4px; }
.person-sections a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 12px; color: #4935b8; text-decoration: none; border-radius: 6px; }
.person-sections a.active { background: #eee9ff; font-weight: 600; }
.person-sections a:focus-visible { outline: 3px solid #205ab8; }
.mud-picker-calendar-container .mud-picker-calendar-day { min-width: 32px; min-height: 32px; width: 32px; height: 32px; }

.relative-photo {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: .5rem;
}

.diagram-viewport {
    width: 100%;
    max-height: min(70vh, 750px);
    overflow: auto;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
    border: 1px solid #c7c9d1;
    border-radius: 12px;
    background: #fbfbff;
}

.diagram-canvas { display: block; max-width: none; }
.diagram-parent-line { stroke: #605d70; stroke-width: 2.5; }
.diagram-partner-line { stroke: #8750a5; stroke-width: 2.5; stroke-dasharray: 7 5; }
.diagram-node { fill: #fff; stroke: #a8a5b3; stroke-width: 2; }
.diagram-focus { fill: #f2ebff; stroke: #6750a4; stroke-width: 3; }
.diagram-canvas a:hover .diagram-node,
.diagram-canvas a:focus .diagram-node { stroke: #2e6bce; stroke-width: 3; }
.diagram-name { fill: #20202a; font-size: 15px; font-weight: 600; }
.diagram-date { fill: #555563; font-size: 13px; }
.edit-difference td { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 120px; max-width: 360px; }

@media (max-width: 600px) {
    .diagram-viewport { height: 62vh; }
    .app-account-email { display: none; }
    .app-toolbar .mud-button-root { min-width: 0; padding-left: 6px; padding-right: 6px; }
    .app-toolbar .mud-typography-h6 { font-size: 1rem; }
}

.notification { overflow-wrap: anywhere; }
.notification-unread { border-left: 4px solid #6750a4; }
.notification-difference { white-space: pre-wrap; margin-bottom: .75rem; }
@media (max-width: 600px) {
    .mud-container { padding-left: 12px; padding-right: 12px; }
    .mud-typography-h4 { font-size: 1.6rem; }
    .mud-stack-row > .mud-input-control { min-width: min(240px, 100%); flex: 1 1 240px; }
    .mud-stack-row > * { max-width: 100%; }
    .mud-button-root { min-height: 44px; }
    .mud-icon-button { min-height: 44px; min-width: 44px; }
    .edit-difference table { table-layout: fixed; width: 100%; }
    .edit-difference th, .edit-difference td { min-width: 0; max-width: none; padding: 8px; overflow-wrap: anywhere; font-size: .8rem; }
}
