/*
 * Базові стилі: шрифт, типографіка, фокус, рух, друк (docs/UI-Redesign-TZ.md, розділи 1, 2, 8).
 * Sentence case: нічого не переводимо в UPPERCASE (крім дрібних оверлайнів .overline).
 */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: var(--fs-14);
    line-height: 1.5;
    color: var(--ink-900);
    background-color: var(--canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, .h1 { font-size: var(--fs-24); font-weight: var(--fw-semibold); line-height: 1.25; letter-spacing: -.01em; }
h2, .h2 { font-size: var(--fs-20); font-weight: var(--fw-semibold); line-height: 1.3; }
h3, .h3 { font-size: var(--fs-16); font-weight: var(--fw-semibold); line-height: 1.4; }
h4, .h4 { font-size: var(--fs-16); font-weight: var(--fw-semibold); line-height: 1.4; }
h5, .h5 { font-size: var(--fs-14); font-weight: var(--fw-semibold); line-height: 1.4; }
h6, .h6 { font-size: var(--fs-13); font-weight: var(--fw-semibold); line-height: 1.4; }

b, strong { font-weight: var(--fw-semibold); }

small, .small { font-size: var(--fs-13); }

a { text-underline-offset: 2px; }

::selection { background: var(--brand-100); color: var(--ink-900); }

/* Числа читаються: таблиці, KPI, інвентарні номери */
table, .tabular-nums, .kpi-value { font-variant-numeric: tabular-nums; }

/* Дрібний лейбл-оверлайн — єдиний дозволений UPPERCASE */
.overline {
    font-size: 11px;
    font-weight: var(--fw-semibold);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-400);
}

/* Фокус з клавіатури видно на всьому інтерактивному */
:focus-visible {
    outline: 2px solid var(--brand-600);
    outline-offset: 2px;
}

/* Панелі й модалки отримують фокус програмно (tabindex="-1") — рамка навколо всієї панелі зайва. */
.offcanvas:focus-visible,
.modal:focus-visible { outline: 0; }

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 1100;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    background: var(--ink-900);
    color: #fff;
    font-weight: var(--fw-medium);
    text-decoration: none;
    transform: translateY(-200%);
}

.skip-link:focus { transform: none; color: #fff; }

/*
 * iOS збільшує сторінку при фокусі на полі з шрифтом < 16px. Замість блокування зуму у viewport —
 * 16px на полях пристроїв із сенсорним екраном.
 */
@media (pointer: coarse) {
    input.form-control,
    textarea.form-control,
    .form-select,
    .search-input,
    .dataTables_filter input,
    .dataTables_length select {
        font-size: 16px !important;
    }
}

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

@media print {
    body { background: #fff; }

    .app-sidebar,
    .app-topbar,
    .app-tabbar,
    .app-footer,
    .app-backdrop,
    .app-sheet,
    .skip-link {
        display: none !important;
    }

    .app-main-wrap { padding: 0 !important; }
    .app-main { padding: 0 !important; }
}
