:root {
    --tb-primary: #235F67;       /* deep teal - main brand */
    --tb-secondary: #4DCAA1;     /* mint - success / legacy */
    --tb-danger: #B4232A;        /* destructive actions */
    --tb-success: #198754;      /* Bootstrap 5 success */
    --tb-success-hover: #157347;
    --tb-dark: #062028;          /* dark navy hero background */
    --tb-darker: #04181F;        /* deepest navy - footer */
    --tb-night: #0A2B36;          /* slightly lighter dark surface */
    --tb-accent: #F2A455;        /* warm amber - CTAs / highlights */
    --tb-accent-hover: #E89342;  /* amber hover */
    --tb-accent-soft: #FAC38B;   /* soft amber */
    --tb-box-light: #FAC38B;     /* light cardboard */
    --tb-box-mid: #E6CBA0;       /* mid cardboard */
    --tb-box-dark: #9B6839;      /* dark cardboard */
    --tb-bg: #F4F6F7;            /* page background (warm grey) */
    --tb-bg-soft: #ECEFF1;       /* soft band */
    --tb-surface: #FFFFFF;       /* card surface */
    --tb-text: #0F1F26;          /* primary text */
    --tb-text-muted: #5C6E76;    /* secondary text */
    --tb-muted: var(--tb-text-muted);
    --tb-border: #E2E6E9;        /* hairline border */
    --tb-border-strong: #6B787F; /* 4.3:1 on white - 1.4.11 controls */
    --tb-accent-text: #8A4A00;   /* 6.86:1 on white - amber as text */
    --tb-placeholder: var(--tb-text-muted);
    --tb-focus: #235F67;
    --tb-focus-offset: #ffffff;

    --landing-bg: var(--tb-bg);
    --landing-surface: #FFFFFF;
    --landing-border: var(--tb-border);
    --landing-border-strong: rgba(8, 40, 52, 0.18);
    --landing-text: var(--tb-text);
    --landing-text-soft: var(--tb-text-muted);
    --landing-accent: var(--tb-accent);
    --landing-accent-soft: var(--tb-accent-soft);
    --landing-shadow: 0 10px 30px rgba(6, 32, 40, 0.08);
}

/* Shared footer. These rules deliberately do not change QR/chat containers. */
html body.tb-footer-page {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
}
body.tb-footer-page > .tb-page-content {
    flex: 1 0 auto;
    min-height: 0;
    max-height: none;
}
.tidybox-footer.tidybox-footer--compact {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 12px 20px;
    padding-right: max(20px, env(safe-area-inset-right, 0px));
    padding-left: max(20px, env(safe-area-inset-left, 0px));
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    background: var(--tb-darker);
    color: var(--tb-bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: start;
}
.tidybox-footer--compact * { box-sizing: border-box; }
.tidybox-footer--compact .tidybox-footer__inner {
    display: block;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
}
.tidybox-footer__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 12px;
}
.tidybox-footer--compact .tidybox-footer__brandline {
    display: inline-flex;
    flex: 0 1 auto;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    min-width: 0;
    margin: 0;
    color: inherit;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
}
.tidybox-footer--compact .tidybox-footer__icon {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 6px;
}
.tidybox-footer--compact .tidybox-footer__copyright {
    width: auto;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    color: inherit;
    font-size: 0.8125rem;
}
.tidybox-footer__social {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-inline-start: auto;
}
.tidybox-footer__social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: inherit;
    border-radius: 8px;
}
.tidybox-footer__social svg { display: block; flex: none; }
.tidybox-footer__links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 20px;
}
.tidybox-footer__links a,
.tidybox-footer__links button {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    min-height: 32px;
    max-width: 100%;
    margin: 0;
    padding: 4px 0;
    border: 0;
    border-radius: 2px;
    background: none;
    color: inherit;
    font: inherit;
    text-align: start;
    text-decoration: none;
    overflow-wrap: anywhere;
    cursor: pointer;
}
.tidybox-footer--compact a:hover,
.tidybox-footer--compact button:hover { color: var(--tb-accent); }
.tidybox-footer--compact :is(a, button):focus-visible {
    outline: 2px solid var(--tb-accent);
    outline-offset: 2px;
    box-shadow: none;
}
.tidybox-footer--compact .tidybox-footer__mt-disclaimer {
    margin: 8px 0 0;
    font-size: 0.75rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
@media (max-width: 600px) {
    .tidybox-footer.tidybox-footer--compact {
        padding-inline: 16px;
        padding-right: max(16px, env(safe-area-inset-right, 0px));
        padding-left: max(16px, env(safe-area-inset-left, 0px));
    }
    .tidybox-footer__links { gap: 0 16px; }
    .tidybox-footer__links a,
    .tidybox-footer__links button { min-height: 36px; }
}
@media print {
    .tidybox-footer--compact { display: none; }
}

/* WCAG 2.4.7 / 1.4.11: visible focus ring (teal 6.67:1 on page bg). */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--tb-focus);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--tb-focus-offset);
}

a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible),
[tabindex]:not([tabindex="-1"]):focus:not(:focus-visible),
[role="button"]:focus:not(:focus-visible) {
    outline: none;
}

/* Close glyphs only: retain each overlay's positioning, touch target and iOS
   viewport/safe-area rules. Component styles load later (some dynamically),
   so these two typography properties deliberately take precedence. */
body :is(
    .dashboard-modal__close, .tb-modal__close, .collections-edit__close,
    .labels-history-dialog-heading > button,
    .tb-more-panel__close, .tb-drawer__close, .tb-lightbox__close,
    .tb-photo-recognize-modal__close, .tb-photo-upload-summary__close,
    .tb-boxes-close, .tb-share__close, .generate-lightbox__close,
    .shop-gallery__lightbox-close, .camera-close,
    .window-popup-insert .closeBtn, .close-window, .close-window-setting
) {
    font-size: 32px !important;
    line-height: 1 !important;
}

body :is(
    .dashboard-modal__close, .tb-modal__close, .shop-gallery__lightbox-close,
    .camera-close, .window-popup-insert .closeBtn, .close-window, .close-window-setting
) > i {
    font-size: inherit !important;
    line-height: inherit !important;
}
