body.lang-fa {
    --font-family-ui: var(--font-family-fa-primary);
}

body:not(.lang-fa) {
    --font-family-ui: var(--font-family-ui-fallback);
}

.app-shell--guest {
    background: var(--color-surface-muted);
}

body,
button,
input,
select,
textarea,
label,
table,
th,
td,
.button,
.pill,
.notice,
.field__hint,
.field__error,
.shell-nav__item,
.shell-nav__subitem,
.shell-nav__summary,
.sheet-grid__toolbar-button,
.sheet-grid__summary-chip,
.sheet-grid__pill,
.sheet-grid__menu-item {
    font-family: var(--font-family-ui);
}

.shell-header,
.shell-sidebar,
.card,
.table-shell,
.notice,
.settings-preview,
.settings-font-panel,
.settings-menu-builder__toolbar,
.settings-menu-builder__column,
.settings-menu-builder__card,
.sheet-grid__menu-panel,
.sheet-grid__filter-panel,
.page-login__card,
.page-install .card {
    background: var(--color-surface);
    border-color: var(--color-border);
    box-shadow: var(--shadow-soft);
}

.card {
    color: var(--color-text-base);
}

.button,
.pill,
.sheet-grid__toolbar-button,
.sheet-grid__summary-chip,
.sheet-grid__pill {
    font-size: var(--font-size-13);
    font-weight: var(--font-weight-medium);
}

.button {
    min-height: 2.5rem;
    padding: 0.48rem 0.95rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-accent);
    background: var(--color-accent);
    color: var(--color-white);
}

.button:hover,
.button:focus-visible {
    background: var(--color-accent-strong);
    border-color: var(--color-accent-strong);
    color: var(--color-white);
    outline: none;
}

.button--ghost {
    background: var(--color-surface);
    border-color: var(--color-border-strong);
    color: var(--color-text-strong);
}

.button--ghost:hover,
.button--ghost:focus-visible {
    background: var(--color-surface-muted);
    border-color: var(--color-accent);
    color: var(--color-accent-strong);
}

.button--danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: var(--color-white);
}

.button--danger:hover,
.button--danger:focus-visible {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: var(--color-white);
    filter: brightness(0.95);
}

.pill,
.sheet-grid__pill {
    background: rgba(51, 122, 183, 0.08);
    border-color: rgba(51, 122, 183, 0.18);
    color: var(--color-accent-strong);
}

.pill--danger,
.pill--fail {
    background: rgba(217, 83, 79, 0.1);
    border-color: rgba(217, 83, 79, 0.22);
    color: var(--color-danger);
}

.pill--warning {
    background: rgba(255, 185, 40, 0.18);
    border-color: rgba(255, 185, 40, 0.28);
    color: var(--color-text-strong);
}

.pill--success,
.pill--ok {
    background: rgba(51, 122, 183, 0.08);
    border-color: rgba(51, 122, 183, 0.18);
    color: var(--color-accent-strong);
}

.field input,
.field select,
.field textarea,
.sheet-grid__search input,
.sheet-grid__filter-control,
.sheet-grid__filter-menu-control,
.shell-header__search input {
    min-height: 2.4rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border-strong);
    border-radius: 0.55rem;
    background: var(--color-surface);
    color: var(--color-text-base);
    font-size: var(--font-size-14);
}

.field textarea {
    min-height: 6.5rem;
}

.field input::placeholder,
.field textarea::placeholder,
.sheet-grid__search input::placeholder,
.shell-header__search input::placeholder {
    color: var(--color-text-muted);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.sheet-grid__search input:focus,
.sheet-grid__filter-control:focus,
.sheet-grid__filter-menu-control:focus,
.shell-header__search input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(51, 122, 183, 0.12);
}

.field__error {
    font-size: var(--font-size-12);
    color: var(--color-danger);
    font-weight: var(--font-weight-regular);
}

.notice {
    font-size: var(--font-size-13);
    color: var(--color-text-strong);
    border-radius: 0.65rem;
}

.notice--error {
    background: rgba(217, 83, 79, 0.1);
    border-color: rgba(217, 83, 79, 0.24);
    color: var(--color-danger);
}

.notice--success,
.notice--info {
    background: rgba(51, 122, 183, 0.08);
    border-color: rgba(51, 122, 183, 0.18);
    color: var(--color-accent-strong);
}

.table-shell {
    background: var(--color-surface);
    border-color: var(--color-border);
}

.data-table th,
.data-table td {
    color: var(--color-text-base);
    font-size: var(--font-size-14);
}

.data-table thead th {
    background: var(--color-surface-muted);
    color: var(--color-text-strong);
    font-size: var(--font-size-13);
    font-weight: var(--font-weight-bold);
}

.data-table tbody tr:nth-child(even) {
    background: rgba(241, 241, 241, 0.55);
}

.table-shell--sheet {
    background: var(--color-surface);
}

.table-shell--sheet .data-table tbody tr:hover td {
    background: rgba(51, 122, 183, 0.05);
}

.table-shell--sheet .data-table tbody tr.is-selected td {
    background: rgba(51, 122, 183, 0.1);
}

.sheet-grid__toolbar-button,
.sheet-grid__summary-chip {
    min-height: 2.1rem;
    border-radius: 0.55rem;
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text-strong);
}

.sheet-grid__toolbar-button:hover,
.sheet-grid__toolbar-button:focus-visible,
.sheet-grid__summary-chip:hover,
.sheet-grid__summary-chip:focus-visible,
.sheet-grid__summary-chip.is-active {
    background: rgba(51, 122, 183, 0.08);
    border-color: rgba(51, 122, 183, 0.22);
    color: var(--color-accent-strong);
}

.sheet-grid__menu-item,
.sheet-grid__summary-chip,
.sheet-grid__pill,
.sheet-grid__toolbar-button,
.sheet-grid__sort-button {
    line-height: 1.4;
}

.sheet-grid__sort-button,
.sheet-grid__focus-filter,
.sheet-grid__head-cell.is-filtered .sheet-grid__focus-filter {
    color: var(--color-text-strong);
}

.sheet-grid__focus-filter:hover,
.sheet-grid__focus-filter:focus-visible,
.sheet-grid__focus-filter.is-open {
    background: rgba(51, 122, 183, 0.08);
    color: var(--color-accent-strong);
}

.shell-header {
    background: var(--color-surface);
    backdrop-filter: none;
}

.shell-header__brand-copy strong {
    font-size: var(--font-size-16);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-strong);
}

.shell-header__brand-copy span {
    color: var(--color-text-secondary);
}

.shell-header__brand-mark,
.shell-header__avatar {
    background: rgba(51, 122, 183, 0.08);
    color: var(--color-accent-strong);
    border-color: rgba(51, 122, 183, 0.18);
}

.shell-sidebar {
    background: var(--color-surface);
}

.shell-sidebar__brand {
    border-bottom-color: var(--color-border);
}

.shell-sidebar__brand h2 {
    font-size: var(--font-size-18);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-strong);
}

.shell-nav__item,
.shell-nav__subitem,
.shell-nav__summary {
    font-size: var(--font-size-14);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-base);
}

.shell-nav__item,
.shell-nav__group,
.shell-nav__subitem {
    border-color: var(--color-border);
    background: var(--color-surface);
}

.shell-nav__item:hover,
.shell-nav__subitem:hover,
.shell-nav__summary:hover {
    background: rgba(51, 122, 183, 0.07);
}

.shell-nav__item.is-active,
.shell-nav__subitem.is-active,
.shell-nav__group.is-active > .shell-nav__summary,
.shell-nav__group[open] > .shell-nav__summary {
    background: rgba(51, 122, 183, 0.1);
    color: var(--color-accent-strong);
}

.shell-toolbar__action {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-accent-strong);
}

.shell-toolbar__action::after {
    background: var(--color-shell);
    color: var(--color-white);
    font-size: var(--font-size-12);
}

.page-login__card,
.guest-shell__intro {
    background: var(--color-surface);
}

.page-login__submit {
    background: var(--color-shell);
    border-color: var(--color-shell);
    color: var(--color-white);
}

.page-login__submit:hover,
.page-login__submit:focus-visible {
    background: var(--color-accent-deep);
    border-color: var(--color-accent-deep);
}

.install-stepper__item {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text-base);
}

.install-stepper__item.is-active {
    background: rgba(255, 185, 40, 0.18);
    color: var(--color-text-strong);
}

.install-stepper__count {
    background: rgba(48, 73, 103, 0.08);
    color: var(--color-shell);
}

.settings-page__hero h2,
.settings-page__card h2,
.settings-preview__header strong,
.settings-menu-builder__column-head strong,
.settings-font-panel strong {
    color: var(--color-text-strong);
}

.settings-menu-builder__status.is-saving,
.settings-menu-builder__status.is-success {
    color: var(--color-accent-strong);
}

.settings-menu-builder__status.is-error {
    color: var(--color-danger);
}

.accounting-stepper,
.accounting-stepper__item,
.menu-builder-column,
.menu-builder-column__empty,
.menu-builder-card {
    background: var(--color-surface);
    border-color: var(--color-border);
}

.accounting-stepper__item.is-current,
.menu-builder-card.is-selected,
.menu-builder-column__list.is-drag-over {
    background: rgba(51, 122, 183, 0.08);
    color: var(--color-accent-strong);
}

.accounting-stepper__item.is-complete,
.menu-builder-board__status.is-success {
    color: var(--color-accent-strong);
}

.menu-builder-board__status.is-error,
.menu-builder-card__chip.is-muted {
    color: var(--color-danger);
}

.menu-builder-card__chip,
.accounting-hero__badge {
    background: rgba(51, 122, 183, 0.08);
    color: var(--color-accent-strong);
}

.menu-builder-card__chip.is-soft,
.accounting-stepper__count {
    background: rgba(48, 73, 103, 0.08);
    color: var(--color-text-secondary);
}

.accounting-hero__accent {
    color: var(--color-accent-strong);
}

.accounting-panel--alert,
.accounting-panel--alert.is-ok,
.accounting-panel--alert.is-danger {
    border-color: var(--color-border);
    background: var(--color-surface);
}
