/* All shell colors inherit the shared semantic palette. */
:root { --tt-header-height: 78px; --tt-sidebar-width: 224px; }
body:has(.tt-header) { padding-top: var(--tt-header-height); background: var(--teber-color-canvas); }
.tt-header { height: var(--tt-header-height); padding: 12px 22px; gap: 16px; flex-wrap: nowrap; background: var(--teber-color-surface); border-bottom: 1px solid var(--teber-color-border); box-shadow: var(--teber-shadow-sm); }
.tt-brand { display: flex; align-items: center; gap: 12px; flex: 0 0 186px; color: var(--teber-color-text-strong); text-decoration: none; font: 600 21px/1.05 Georgia, serif; }
.tt-brand img { object-fit: contain; flex-shrink: 0; }
.tt-search { display: flex; align-items: center; flex: 1 1 auto; min-width: 130px; height: 42px; border: 1px solid var(--teber-color-border); border-radius: 8px; overflow: hidden; background: var(--teber-color-surface); }
.tt-search > svg { margin-left: 13px; width: 18px; color: var(--teber-color-text-muted); flex-shrink: 0; }
.tt-search input.form-control { min-width: 0; border: 0; background: transparent; box-shadow: none; color: var(--teber-color-text); font-family: Georgia, serif; }
.tt-header .tt-search:focus-within,
.tt-header .tt-search input.form-control:focus,
.tt-header .tt-search button:focus-visible { outline: 0; box-shadow: none; }
.tt-search button { align-self: stretch; width: 48px; flex-shrink: 0; border: 0; color: var(--teber-color-on-primary); background: var(--teber-color-primary-strong); }
.tt-search button svg { width: 19px; }
.tt-header-links { align-items: center; gap: 24px; padding: 0 10px; white-space: nowrap; font-family: Georgia, serif; }
.tt-header-links a, .tt-text-button { color: var(--teber-color-text-strong); text-decoration: none; }
.tt-text-button { background: transparent; border: 0; padding: 0; font: inherit; }
.tt-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 36px; flex-shrink: 0; border: 0; border-radius: 6px; color: var(--teber-color-text-muted); background: transparent; }
.tt-icon-button svg { width: 20px; height: 20px; }
.tt-icon-button:hover, .tt-text-button:hover { color: var(--teber-color-primary-strong); background: var(--teber-color-hover); }
.tt-header :focus-visible, .tt-sidebar :focus-visible { outline: 2px solid var(--teber-color-focus-border); outline-offset: 3px; }
.tt-header-menu { position: relative; flex-shrink: 0; }
.tt-header-menu summary { list-style: none; cursor: pointer; }
.tt-header-menu summary::-webkit-details-marker { display: none; }
.tt-header-popover { position: absolute; right: 0; top: calc(100% + 12px); width: 250px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 90px); overflow-y: auto; padding: 6px; background: var(--teber-color-surface); border: 1px solid var(--teber-color-border); border-radius: 8px; box-shadow: var(--teber-shadow-md); }
/* Shared admin actions are direct rows here, including downstream page actions. */
.tt-popup-list { display: flex; flex-direction: column; }
.tt-popup-list .dropdown-item { padding: 9px 14px; color: var(--teber-color-text); white-space: normal; text-align: left; }
.tt-popup-list .dropdown-item:hover, .tt-popup-list .dropdown-item:focus-visible { color: var(--teber-color-primary-strong); background: var(--teber-color-hover); }
.tt-popup-list :is(svg, [data-feather], img) { display: none; }
.tt-popup-list .dropdown-divider { border-color: var(--teber-color-border); margin: 6px 0; }
.tt-sidebar { --bs-offcanvas-width: var(--tt-sidebar-width); color: var(--teber-color-text); background: var(--teber-color-surface-subtle); }
.tt-sidebar .offcanvas-body { padding: 20px 14px; display: flex; flex-direction: column; }
.tt-menu { display: flex; flex-direction: column; width: 100%; gap: 3px; }
.tt-menu-link { display: flex; align-items: center; gap: 16px; padding: 11px 14px; border-radius: 9px; font: 15px/1.3 Georgia, serif; color: var(--teber-color-text-muted); text-decoration: none; }
.tt-menu-link svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.6; }
.tt-menu-link:hover { background: var(--teber-color-hover); color: var(--teber-color-primary-strong); }
.tt-menu-link.active { background: var(--teber-color-primary-soft); color: var(--teber-color-primary-strong); font-weight: 600; }
.tt-skip-link { position: fixed; top: -100px; left: 16px; z-index: 1100; padding: 10px 16px; background: var(--teber-color-surface); color: var(--teber-color-primary); }
.tt-skip-link:focus { top: 8px; }
@media (min-width: 992px) {
    .tt-sidebar.offcanvas-lg { position: fixed; top: var(--tt-header-height); bottom: 0; left: 0; width: var(--tt-sidebar-width); visibility: visible; background: var(--teber-color-surface-subtle) !important; border-right: 1px solid var(--teber-color-border); overflow-y: auto; }
    .tt-sidebar .offcanvas-body { height: 100%; min-height: min-content; }
    body:has(.tt-header) .main > .public-body,
    body:has(.tt-header) .main > .footer { margin-left: var(--tt-sidebar-width); }
    body:has(.tt-header) .public-body > div > .container-lg { max-width: none; }
}
@media (max-width: 1199.98px) { .tt-header { gap: 10px; } }
@media (max-width: 767.98px) {
    :root { --tt-header-height: 104px; }
    .tt-header { flex-wrap: wrap; align-content: center; padding: 10px 12px; gap: 8px; }
    .tt-brand { flex: 1 1 auto; font-size: 18px; gap: 8px; }
    .tt-brand img { width: 34px; height: 34px; }
    .tt-search { order: 10; flex-basis: 100%; height: 38px; }
    .tt-header .dropdown-menu { max-width: calc(100vw - 24px); }
}
[data-bs-theme="dark"] body:has(.tt-header) .main,
[data-bs-theme="dark"] body:has(.tt-header) .content,
[data-bs-theme="dark"] body:has(.tt-header) .footer { background: var(--teber-color-canvas); color: var(--teber-color-text); }
[data-bs-theme="dark"] body:has(.tt-header) .card,
[data-bs-theme="dark"] body:has(.tt-header) .card-body { background: var(--teber-color-surface); color: var(--teber-color-text); border-color: var(--teber-color-border); }

/* The bundled light navbar fixes dropdowns on small screens; the shell anchors them locally. */
.tt-header .tt-language { position: relative; flex: 0 0 32px; }
[data-bs-theme="dark"] .tt-brand img { filter: invert(1); }
[data-bs-theme="dark"] body:has(.tt-header) :is(h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6) { color: var(--teber-color-text-strong); }

.tt-menu { flex-shrink: 0; }
.tt-sidebar-footer { margin-top: auto; padding: 28px 10px 8px; color: var(--teber-color-text-muted); font-size: .72rem; line-height: 1.8; }
.tt-sidebar-footer a { color: inherit; text-decoration: none; }
.tt-sidebar-footer a:hover { color: var(--teber-color-primary); text-decoration: underline; }

.tt-footer-years { white-space: nowrap; }

.tt-language-flag { object-fit: contain; flex-shrink: 0; }
@media (max-width: 359.98px) {
    .tt-header { gap: 4px; padding-inline: 8px; }
    .tt-icon-button { width: 28px; }
    .tt-header .tt-language { flex-basis: 28px; }
    .tt-brand { font-size: 16px; gap: 6px; }
    .tt-brand img { width: 28px; height: 28px; }
}

/* Natural wrapping keeps translated names intact within the fixed header. */
.tt-brand { min-width: 0; }
.tt-brand > span { min-width: 0; max-width: 136px; }
.tt-brand > span:lang(ru) { font-size: 16px; }
@media (max-width: 767.98px) {
    .tt-brand { flex: 1 1 0; }
    .tt-brand > span { display: none; }
}

/* The bundled light stylesheet fixes modal surfaces to white. */
[data-bs-theme="dark"] body:has(.tt-header) .modal {
    --bs-modal-bg: var(--teber-color-surface);
    --bs-modal-color: var(--teber-color-text);
    --bs-modal-border-color: var(--teber-color-border);
    --bs-modal-header-border-color: var(--teber-color-border);
    --bs-modal-footer-border-color: var(--teber-color-border);
}
[data-bs-theme="dark"] body:has(.tt-header) .modal .form-control {
    background-color: var(--teber-color-surface-subtle);
    color: var(--teber-color-text);
    border-color: var(--teber-color-border);
}
[data-bs-theme="dark"] body:has(.tt-header) .modal .form-floating > label::after { background: var(--teber-color-surface-subtle); }
[data-bs-theme="dark"] body:has(.tt-header) .modal .close { background: transparent; border: 0; color: var(--teber-color-text); }
