/* Shared readability, responsive controls and keyboard navigation. */
:root {
    --text-muted: #a1a1aa;
    --ui-focus: var(--gold, #d4af37);
}
[data-theme="light"] { --text-muted: #626873; --ui-focus: #806000; }
body { text-rendering: optimizeLegibility; }
:where(button, input, select, textarea) { font: inherit; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid var(--ui-focus) !important;
    outline-offset: 4px;
}
:where(button, .btn, input[type="submit"]):disabled {
    cursor: not-allowed;
    opacity: .55;
}
:where(input, select, textarea) { max-width: 100%; }
:where(input, textarea)::placeholder { color: var(--text-muted); opacity: 1; }
:where(.form-label, .form-group > label) { display: block; margin-bottom: .5rem; }
:where(.form-control, .auth-form input:not([type="hidden"]), .login-form input:not([type="hidden"])) {
    min-height: 46px;
    font-size: 1rem;
}
:where(.btn, .header-btn, .sidebar-toggle, .alert-close, .table-actions button, .table-actions a) {
    min-height: 44px;
    min-width: 44px;
}
.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 2147483647;
    padding: .8rem 1.1rem;
    border-radius: 8px;
    background: var(--ui-focus);
    color: #111;
    font-weight: 700;
    transform: translateY(-200%);
}
.skip-link:focus { transform: translateY(0); }
[data-theme="light"] .skip-link { color: #fff; }
#main-content { scroll-margin-top: 100px; }
.table-responsive, .table-wrapper {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
}
.empty-state, .empty-state-modern { padding: clamp(1.5rem, 5vw, 3rem); }
.empty-state p, .empty-state-modern p { max-width: 46ch; margin-inline: auto; line-height: 1.65; }
.toast-container { pointer-events: none; }
.toast-container > * { pointer-events: auto; }
.auth-container { width: 100%; padding: clamp(1rem, 4vw, 2.5rem); }
.auth-card { width: min(100%, 460px); margin-inline: auto; }
.auth-header p, .auth-footer { line-height: 1.65; }

/* Admin working surface: clear hierarchy, quiet panels, readable data. */
body.admin-ui { --text-muted: #9ca8b8; --text-secondary: #b3becc; --ui-focus: var(--primary); font-size: 16px; }
.admin-ui .content-wrapper { max-width: 1680px; width: 100%; margin-inline: auto; }
.admin-ui .page-title { font-size: clamp(1.5rem, 2.4vw, 2rem); line-height: 1.25; letter-spacing: -.025em; }
.admin-ui .page-subtitle { font-size: .95rem; max-width: 70ch; line-height: 1.6; }
.admin-ui .card { border-color: var(--border-color); box-shadow: none; }
.admin-ui .card-header { gap: 1rem; flex-wrap: wrap; }
.admin-ui .form-control { border-color: #485363; border-radius: 8px; }
.admin-ui .table th { color: var(--text-secondary); font-size: .9rem; letter-spacing: .025em; }
.admin-ui .table td { font-size: .95rem; line-height: 1.55; }
.admin-ui .table th, .admin-ui .table td { padding: .9rem 1rem; }
.admin-ui .table tbody tr:hover { background: var(--bg-light); }
.admin-ui .nav-link { min-height: 44px; font-size: .95rem; }
.admin-ui .nav-link.active { box-shadow: inset 3px 0 var(--primary); }
.admin-ui .admin-dropdown.open .dropdown-menu,
.admin-ui .admin-dropdown:focus-within .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.admin-ui .stat-label, .admin-ui .form-label { font-size: .95rem; }
.admin-ui .table-responsive, .admin-ui .table-wrapper { margin-inline: 0; }

@media (max-width: 768px) {
    :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { font-size: 16px !important; }
    .admin-ui .content-wrapper { padding: 1rem; }
    .admin-ui .page-header { gap: 1rem; }
    .admin-ui .table-actions { flex-wrap: nowrap; gap: .5rem; }
    .admin-ui .form-row { flex-wrap: wrap; }
    .admin-ui .form-row > .form-group { min-width: min(100%, 220px); flex: 1 1 220px; }
    .admin-ui .modal, .admin-ui .modal-content { max-width: calc(100vw - 2rem); max-height: calc(100dvh - 2rem); overflow-y: auto; }
    .bottom-nav { padding-bottom: env(safe-area-inset-bottom, 0px); }
    .auth-card { padding: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
