input,
select,
textarea,
button {
    height: 36px;
    padding: 6px 10px !important;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-control);
    color: var(--color-text);
    font-size: 13px;
    line-height: 1.2;
    resize: none;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, color .15s ease;
}

input:hover:not(:disabled):not([readonly]),
select:hover:not(:disabled),
textarea:hover:not(:disabled):not([readonly]) {
    border-color: var(--color-border-strong);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

input::placeholder,
textarea::placeholder {
    color: var(--color-text-muted);
    opacity: .8;
}

input:disabled,
select:disabled,
textarea:disabled,
input[readonly],
textarea[readonly] {
    background: var(--color-surface-subtle);
    color: var(--color-text-muted);
}

input[type="checkbox"] {
    width: 17px;
    height: 17px;
    padding: 0 !important;
    border-radius: 5px;
    accent-color: var(--color-primary);
}

/* поле */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
    width: auto;
    min-width: 0;
}

/* подпись */
.field label {
    text-align: center;
    width: 100%;
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
}

/* Убираем стрелки в number */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-primary);
    background: var(--color-primary);
    color: var(--color-on-accent);
    box-shadow: 0 4px 10px color-mix(in srgb, var(--color-primary) 18%, transparent);
    font-weight: 600;
    cursor: pointer;
    transition: transform .08s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.btn:hover:not(:disabled) {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--color-primary) 24%, transparent);
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}


/*день недели */
.day-tag {
    width: 36px;
    height: 36px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-control);
}

/*фикс лейаута даты */
.date-line {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
    height: 36px !important;
    box-sizing: border-box;
}

/* время */
.time {
    width: 80px;
}

/* оператор */
.operator {
    width: 110px;
}

/* источник */
.source {
    width: 150px;
}

.order-status {
    width: 130px;
}

/* игроки */
.players {
    width: 55px;
}


.comment {
    width: 188px;
}

.sum-box {
    position: relative;
    width: 90px;
    height: 36px;
    background: var(--color-surface-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-soft);
    font-size: 16px;
}

/* Листание периода: стрелки склеены с подписью посередине — выбор месяца
   в отчётах, график смен, календари заказов. */
.period-nav {
    display: inline-flex;
    align-items: stretch;
}

.period-nav > :not(.date-picker-source) {
    position: relative;
    margin-left: -1px;
    border-radius: 0;
}

.period-nav > :first-child {
    margin-left: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.period-nav > :last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.period-nav > :hover,
.period-nav > :focus-visible,
.period-nav > .date-picker--open {
    z-index: 1;
}

.period-nav__arrow {
    width: 36px;
    padding: 0 !important;
    color: var(--color-text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.period-nav__arrow:hover:not(:disabled) {
    border-color: var(--color-border-strong);
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.period-nav__arrow:disabled {
    opacity: .4;
    cursor: default;
}

.period-nav .date-picker {
    min-width: 170px;
}

/* Переключатель вида (день, неделя, месяц) — сегменты в одной рамке. */
.segmented {
    display: inline-flex;
    gap: 2px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-control);
}

.segmented__item {
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 6px;
    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.segmented__item:hover {
    color: var(--color-text);
}

.segmented__item--active,
.segmented__item--active:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

/* вкладки страницы */
.page-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.page-tab {
    padding: 8px 16px;
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transform: translateY(1px);
}

.page-tab:hover {
    color: var(--color-text);
}

.page-tab--active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Две строки текста в ячейке таблицы вместо обрезания в одну. */
.table .cell-clamp {
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    word-break: break-word;
}

/* Под таблицей, что приходит порциями: сколько показано и кнопка за следующей. */
.more-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.more-count {
    color: var(--color-text-muted);
}

/* Свой календарь (core/datePicker.js): поле даты спрятано, вместо него кнопка. */
.date-picker-source {
    display: none;
}

.date-picker {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 132px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    cursor: pointer;
}

.date-picker:hover:not(:disabled) {
    border-color: var(--color-border-strong);
}

.date-picker--open,
.date-picker--open:hover:not(:disabled) {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.date-picker--invalid {
    border-color: var(--color-danger);
}

.date-picker:disabled {
    background: var(--color-surface-subtle);
    color: var(--color-text-muted);
    cursor: default;
}

.date-picker--label {
    justify-content: center;
    font-weight: 600;
}

.date-picker--label .date-picker__icon {
    display: none;
}

.date-picker--range {
    min-width: 190px;
}

.time-picker {
    min-width: 88px;
}

.date-picker__text--empty {
    color: var(--color-text-muted);
}

.date-picker__icon {
    width: 15px;
    height: 15px;
    flex: none;
    fill: none;
    stroke: var(--color-text-muted);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Пара полей «с» и «по» под одной кнопкой. */
.date-range {
    display: flex;
}

.date-popover {
    position: fixed;
    z-index: 1500;
    width: 272px;
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-elevated);
    box-shadow: var(--shadow-float);
    color: var(--color-text);
    animation: date-popover-in .12s ease-out;
}

.date-popover--range {
    width: auto;
}

@keyframes date-popover-in {
    from { opacity: 0; transform: translateY(-4px); }
}

/* Общий стиль button задаёт высоту и padding с !important — здесь свои размеры. */
.date-popover button {
    height: auto;
    padding: 0 !important;
    border: 1px solid transparent;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.date-popover button:disabled {
    color: var(--color-text-muted);
    opacity: .4;
    cursor: default;
}

.date-popover__pair {
    display: flex;
    gap: 16px;
}

.date-popover__month-block {
    width: 250px;
}

.date-popover__head {
    display: grid;
    grid-template-columns: 30px 1fr 30px;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}

.date-popover .date-popover__arrow {
    height: 30px;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    font-size: 20px;
    line-height: 1;
}

/* Лишняя стрелка держит место, чтобы заголовок месяца стоял по центру. */
.date-popover__arrow--spacer {
    visibility: hidden;
}

.date-popover .date-popover__title {
    height: 30px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
}

.date-popover .date-popover__title:disabled {
    color: var(--color-text);
    opacity: 1;
}

.date-popover .date-popover__arrow:hover,
.date-popover .date-popover__title:hover:not(:disabled) {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.date-popover__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px 0;
}

.date-popover__weekday {
    padding: 4px 0;
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

.date-popover__weekday--off {
    color: var(--color-danger);
    opacity: .75;
}

.date-popover .date-popover__day,
.date-popover .date-popover__month {
    height: 32px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.date-popover .date-popover__day--off {
    color: var(--color-danger);
}

.date-popover .date-popover__day--outside {
    color: var(--color-text-muted);
    opacity: .55;
}

.date-popover .date-popover__day:hover:not(:disabled),
.date-popover .date-popover__month:hover:not(:disabled),
.date-popover .date-popover__week:hover:not(:disabled) {
    background: var(--color-surface-hover);
}

.date-popover .date-popover__day--today,
.date-popover .date-popover__month--today,
.date-popover .date-popover__week--today {
    border-color: var(--color-primary-border);
    color: var(--color-primary);
    font-weight: 700;
}

.date-popover .date-popover__day--in-range,
.date-popover .date-popover__day--in-range:hover:not(:disabled) {
    border-radius: 0;
    background: var(--color-primary-soft);
}

.date-popover .date-popover__day--selected,
.date-popover .date-popover__month--selected,
.date-popover .date-popover__week--selected,
.date-popover .date-popover__day--selected:hover:not(:disabled),
.date-popover .date-popover__month--selected:hover:not(:disabled),
.date-popover .date-popover__week--selected:hover:not(:disabled) {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: var(--color-on-accent);
    font-weight: 700;
    opacity: 1;
}

.date-popover__months {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.date-popover .date-popover__month {
    height: 40px;
}

.date-popover__weeks {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.date-popover .date-popover__week {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 36px;
    padding: 0 10px !important;
    border-radius: var(--radius-sm);
    font-size: 13px;
    text-align: left;
}

.date-popover__week-number {
    width: 48px;
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 600;
}

.date-popover .date-popover__week--selected .date-popover__week-number {
    color: inherit;
    opacity: .8;
}

.date-popover__foot {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-divider);
}

.date-popover .date-popover__link {
    height: 28px;
    padding: 0 8px !important;
    border-radius: var(--radius-sm);
    color: var(--color-primary);
    font-size: 13px;
    font-weight: 600;
}

.date-popover .date-popover__link:hover:not(:disabled) {
    background: var(--color-primary-soft);
}

.date-popover .date-popover__link--muted {
    margin-left: auto;
    color: var(--color-text-muted);
}

/* Выбор времени (core/timePicker.js): колонки часов и минут. */
.time-popover {
    display: flex;
    gap: 8px;
    width: auto;
}

.time-popover__column {
    display: flex;
    flex-direction: column;
    width: 64px;
}

.time-popover__title {
    padding: 4px 0;
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

.time-popover__list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 232px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.date-popover .time-popover__option {
    flex: none;
    height: 30px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.date-popover .time-popover__option:hover {
    background: var(--color-surface-hover);
}

.date-popover .time-popover__option--selected,
.date-popover .time-popover__option--selected:hover {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: var(--color-on-accent);
    font-weight: 700;
}

@media (max-width: 620px) {
    .date-popover__pair {
        flex-direction: column;
        gap: 8px;
    }
}

/* Кнопка-значок с подсказкой (фильтр, режим техничек). summary не
   кнопка, поэтому размеры заданы здесь, а не общим button. */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    min-width: 36px;
    height: 36px;
    padding: 0 9px !important;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-control);
    color: var(--color-text);
    list-style: none;
    cursor: pointer;
}

.icon-btn:hover {
    border-color: var(--color-border-strong);
    background: var(--color-surface-hover);
}

.icon-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Фильтр галочками под кнопкой-значком (макрос check_filter, core/checkFilter.js). */
.check-filter__count {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}

.check-filter,
.multi-select {
    position: relative;
}

.check-filter summary::-webkit-details-marker,
.multi-select summary::-webkit-details-marker {
    display: none;
}

/* Список держится за окно, а не за страницу: у .content прокрутка по
   ширине, и всё, что вылезает ниже контента, она обрезала бы. Место
   ставит placePopover из core/datePicker.js. */
.check-filter__list {
    position: fixed;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: max-content;
    min-width: 220px;
    max-width: min(320px, calc(100vw - 32px));
    max-height: 60vh;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-elevated);
    box-shadow: var(--shadow-float);
}

/* Шапка списка галочек: название и «Все / Снять». Общая у фильтра
   check_filter и у списков формы триггера. */
.check-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 4px 6px 4px 10px;
    border-bottom: 1px solid var(--color-divider);
}

.check-head__title {
    margin-right: auto;
    color: var(--color-text);
    font-size: 13px;
    font-weight: 600;
}

.check-head button {
    height: 28px;
    padding: 2px 8px !important;
    border-color: transparent;
    background: transparent;
    color: var(--color-text-muted);
    box-shadow: none;
    font-size: 12px;
}

.check-head button:hover:not(:disabled) {
    color: var(--color-primary);
}

/* В выпадающем списке шапка стоит над прокруткой и не уезжает. */
.check-filter__list > .check-head {
    position: sticky;
    top: -8px;
    z-index: 1;
    margin: -8px -8px 4px;
    background: var(--color-surface-elevated);
}

.check-filter__group {
    padding: 6px 4px 2px;
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .035em;
}

.check-filter__option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 13px;
    cursor: pointer;
}

.check-filter__option:hover {
    background: var(--color-surface-hover);
}

/* Фильтр списка с несколькими значениями (макрос multi_select,
   core/multiSelect.js): кнопка на месте select, список — от check_filter.
   Ширину задаёт кнопка, а не классы applyDicts (.operator, .source). */
.multi-select {
    width: auto;
}

.multi-select__button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 120px;
    max-width: 220px;
    height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-control);
    color: var(--color-text);
    font-size: 13px;
    line-height: 1.2;
    list-style: none;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.multi-select__button::after {
    content: "";
    flex: none;
    width: 6px;
    height: 6px;
    margin-top: -3px;
    border-right: 1.5px solid var(--color-text-muted);
    border-bottom: 1.5px solid var(--color-text-muted);
    transform: rotate(45deg);
}

.multi-select__button:hover {
    border-color: var(--color-border-strong);
}

.multi-select__button:focus-visible,
.multi-select[open] .multi-select__button {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
    outline: none;
}

.multi-select__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Вкладки и крестик окна — как у формы заказа (.order-form-tabs в form.css,
   .customer-form-tabs у клиента); новым окнам — отсюда. */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
}

.modal-tab {
    min-width: 110px;
    height: 34px;
    margin-bottom: -1px;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    background: transparent;
    color: var(--color-text-muted);
    box-shadow: none;
    font-weight: 600;
}

.modal-tab--active {
    border-color: var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
}

.modal-tab:hover:not(.modal-tab--active) {
    background: var(--color-surface-hover);
}

.modal-close {
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0 !important;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-control);
    color: var(--color-text-soft);
    box-shadow: none;
    font-size: 25px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
}

.modal-close:hover {
    border-color: var(--color-danger-border);
    background: var(--color-danger-surface);
    color: var(--color-danger);
}

/* Перетаскивание строк таблицы за ручку: порядок справочников и триггеров. */
.drag-col {
    width: 28px;
    padding-right: 0 !important;
}

.drag-handle {
    display: inline-block;
    padding: 2px 6px;
    color: var(--color-text-muted);
    cursor: grab;
    user-select: none;
    letter-spacing: -2px;
}

.drag-handle:active {
    cursor: grabbing;
}

.row--dragging {
    opacity: 0.4;
}

.row--drop-target td {
    box-shadow: inset 0 2px 0 var(--color-primary);
}
