.crm-timesheet-page {
    color: var(--crm-text);
}

.crm-page-head-timesheet {
    display: grid;
    grid-template-columns: max-content minmax(320px, 430px) max-content;
    align-items: center;
    column-gap: 18px;
}

.crm-page-head-timesheet .crm-page-head-title {
    justify-self: start;
}

.crm-page-head-timesheet .crm-page-head-controls {
    justify-self: center;
}

.crm-page-head-timesheet .crm-page-head-actions {
    justify-self: end;
}

.crm-page-head-timesheet .crm-page-head-mobile-actions {
    display: none;
}


.crm-timesheet-sticky {
    position: sticky;
    top: 0;
    z-index: 30;
    margin: calc(var(--margin-content, 16px) * -1) calc(var(--margin-content, 16px) * -1) var(--padding-bottom-header, 16px);
    padding: var(--padding-top-header, 16px) var(--padding-left-header, 16px) var(--padding-bottom-header, 16px);
    background: color-mix(in srgb, var(--crm-bg) 92%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid color-mix(in srgb, var(--crm-border) 72%, transparent);
}

.crm-timesheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.crm-timesheet-title h1 {
    margin: 0;
    font-size: var(--h1-size, 28px);
    line-height: 1.15;
    color: var(--crm-text);
    font-weight: 500;
}

.crm-timesheet-title p {
    margin: 4px 0 0;
    color: var(--crm-muted);
    font-size: 14px;
}

.crm-timesheet-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 22px;
    line-height: 1;
    margin-right: 4px;
}

.crm-timesheet-add-mobile {
    display: none !important;
    font-size: 26px;
    line-height: 1;
}

.crm-timesheet-toolbar {
    display: grid;
    grid-template-columns: var(--crm-icon-btn-size, 42px) minmax(150px, 1fr) var(--crm-icon-btn-size, 42px) auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
    width: min(430px, 100%);
}

.crm-timesheet-spacer {
    flex: 1 1 auto;
}

.crm-timesheet-month {
    width: 100%;
    min-width: 0;
    text-align: center;
    font-weight: 500;
    text-transform: capitalize;
    cursor: pointer;
}

.crm-timesheet-summary {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid var(--crm-border);
    border-radius: 999px;
    background: var(--crm-surface);
    color: var(--crm-muted);
    font-size: 13px;
    white-space: nowrap;
}

.crm-timesheet-legend {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--crm-muted);
    font-size: 13px;
    white-space: nowrap;
}

.crm-timesheet-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.crm-timesheet-legend i,
.crm-timesheet-line-dot {
    width: 9px;
    height: 9px;
    display: inline-block;
    border-radius: 999px;
    background: #94a3b8;
}

.crm-timesheet-legend .is-open,
.crm-timesheet-line.is-open .crm-timesheet-line-dot {
    background: #f59e0b;
}

.crm-timesheet-legend .is-closed,
.crm-timesheet-line.is-closed .crm-timesheet-line-dot {
    background: #22c55e;
}

.crm-timesheet-notice,
.crm-timesheet-loading,
.crm-timesheet-empty {
    margin: var(--margin-content, 16px) 0;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    color: var(--crm-muted);
}

.crm-timesheet-notice.is-error {
    color: #991b1b;
    background: #fff1f2;
    border-color: #fecdd3;
}

.crm-timesheet-notice.is-success {
    color: #166534;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.crm-timesheet-calendar {
    margin: var(--margin-content, 16px) 0;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    box-shadow: var(--crm-shadow);
    overflow: hidden;
}

.crm-timesheet-weekdays,
.crm-timesheet-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.crm-timesheet-weekdays {
    background: color-mix(in srgb, var(--crm-bg) 70%, #fff);
    border-bottom: 1px solid var(--crm-border);
}

.crm-timesheet-weekdays > div {
    padding: 12px 10px;
    color: var(--crm-muted);
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

.crm-timesheet-week + .crm-timesheet-week {
    border-top: 1px solid var(--crm-border);
}

.crm-timesheet-day {
    position: relative;
    display: block;
    min-height: 132px;
    padding: 34px 8px 8px;
    border: 0;
    border-right: 1px solid var(--crm-border);
    background: var(--crm-surface);
    text-align: left;
    color: var(--crm-text);
    cursor: pointer;
    transition: background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.crm-timesheet-day:nth-child(7n) {
    border-right: 0;
}

.crm-timesheet-day:hover {
    background: color-mix(in srgb, var(--crm-primary) 5%, var(--crm-surface));
}

.crm-timesheet-day.is-out {
    background: color-mix(in srgb, var(--crm-bg) 72%, #fff);
    color: #98a2b3;
}

.crm-timesheet-day.is-today {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--crm-primary) 62%, #fff);
    background: color-mix(in srgb, var(--crm-primary) 7%, var(--crm-surface));
}

.crm-timesheet-day.is-expanded {
    background: color-mix(in srgb, var(--crm-primary) 10%, var(--crm-surface));
}

.crm-timesheet-date {
    position: absolute;
    top: 9px;
    right: 10px;
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 500;
}

.crm-timesheet-indicator {
    position: absolute;
    top: 8px;
    left: 8px;
    min-width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border-radius: 999px;
    background: #eef2ff;
    color: #1e293b;
    border: 1px solid #c7d2fe;
    font-size: 12px;
    font-weight: 500;
}

.crm-timesheet-indicator.is-open {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.crm-timesheet-indicator.is-closed {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.crm-timesheet-shifts {
    display: grid;
    gap: 6px;
}

.crm-timesheet-shift {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 8px;
    align-items: center;
    padding: 7px 8px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: #eff6ff;
    font-size: 12px;
    line-height: 1.25;
}

.crm-timesheet-shift strong {
    min-width: 0;
    color: var(--crm-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
}

.crm-timesheet-shift span {
    color: #475569;
    font-variant-numeric: tabular-nums;
}

.crm-timesheet-shift.is-open {
    background: #fff7ed;
    border-color: #fed7aa;
}

.crm-timesheet-shift.is-closed {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.crm-timesheet-shift-duration {
    grid-column: 1 / -1;
    font-weight: 400;
    color: #166534 !important;
}

.crm-timesheet-more {
    display: inline-flex;
    width: fit-content;
    padding: 4px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--crm-primary) 9%, #fff);
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 500;
}

.crm-timesheet-details {
    padding: 12px;
    border-top: 1px dashed var(--crm-border);
    background: color-mix(in srgb, var(--crm-bg) 55%, #fff);
}

.crm-timesheet-details-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.crm-timesheet-details-head strong {
    font-size: 14px;
}

.crm-timesheet-details-list {
    display: grid;
    gap: 8px;
}

.crm-timesheet-details-empty {
    padding: 8px 2px;
    color: var(--crm-muted);
    font-size: 14px;
}

.crm-timesheet-line {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--crm-border);
    border-radius: 14px;
    background: var(--crm-surface);
    color: var(--crm-text);
    cursor: pointer;
    text-align: left;
}

.crm-timesheet-line:hover {
    background: color-mix(in srgb, var(--crm-primary) 5%, var(--crm-surface));
}

.crm-timesheet-line-employee {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.crm-timesheet-line-time,
.crm-timesheet-line-duration {
    color: var(--crm-muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.crm-timesheet-line-duration {
    font-weight: 500;
    color: #166534;
}

.crm-timesheet-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, .42);
}

.crm-timesheet-modal {
    width: min(760px, 100%);
    max-height: min(760px, calc(100dvh - 36px));
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    background: var(--crm-surface);
    box-shadow: 0 30px 90px rgba(15, 23, 42, .28);
    overflow: hidden;
}

.crm-timesheet-modal form {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.crm-timesheet-modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--crm-border);
    background: color-mix(in srgb, var(--crm-surface) 94%, transparent);
    backdrop-filter: blur(12px);
}

.crm-timesheet-modal-header h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.15;
    color: var(--crm-text);
}

.crm-timesheet-modal-header p {
    margin: 4px 0 0;
    color: var(--crm-muted);
    font-size: 13px;
}

.crm-timesheet-modal-actions {
    display: flex;
    gap: 8px;
}

.crm-timesheet-modal-body {
    min-height: 0;
    overflow: auto;
    display: grid;
    gap: 14px;
    padding: 18px 20px;
}

.crm-timesheet-row-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.crm-timesheet-field {
    display: grid;
    gap: 7px;
}

.crm-timesheet-field > span {
    color: #475569;
    font-size: 13px;
    font-weight: 500;
}

.crm-timesheet-field small {
    color: var(--crm-muted);
    font-weight: 500;
}

.crm-timesheet-field select,
.crm-timesheet-field input,
.crm-timesheet-field textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--crm-border);
    border-radius: 13px;
    background: #fff;
    color: var(--crm-text);
    font: inherit;
    outline: none;
}

.crm-timesheet-field textarea {
    min-height: 82px;
    resize: vertical;
}

.crm-timesheet-field select:focus,
.crm-timesheet-field input:focus,
.crm-timesheet-field textarea:focus {
    border-color: color-mix(in srgb, var(--crm-primary) 55%, var(--crm-border));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--crm-primary) 12%, transparent);
}

.crm-timesheet-field select:disabled {
    color: #64748b;
    background: #f8fafc;
}

.crm-timesheet-time-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.crm-timesheet-time-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--crm-border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--crm-bg) 45%, #fff);
}

.crm-timesheet-time-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.crm-timesheet-time-card-head strong {
    font-size: 15px;
    color: var(--crm-text);
}

.crm-timesheet-time-card-head span {
    color: var(--crm-muted);
    font-size: 12px;
    text-align: right;
}

.crm-timesheet-date-time-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(118px, .85fr);
    gap: 10px;
}

.crm-timesheet-page .flatpickr-calendar {
    border: 1px solid var(--crm-border);
    border-radius: 18px;
    box-shadow: 0 22px 70px rgba(15, 23, 42, .22);
    overflow: hidden;
    font-family: inherit;
}

.crm-timesheet-page .flatpickr-months,
.crm-timesheet-page .flatpickr-weekdays {
    background: color-mix(in srgb, var(--crm-bg) 65%, #fff);
}

.crm-timesheet-page .flatpickr-current-month {
    font-size: 15px;
}

.crm-timesheet-page .flatpickr-day.selected,
.crm-timesheet-page .flatpickr-day.startRange,
.crm-timesheet-page .flatpickr-day.endRange,
.crm-timesheet-page .flatpickr-day.selected:hover {
    border-color: var(--crm-primary);
    background: var(--crm-primary);
}

.crm-timesheet-page .flatpickr-day.today {
    border-color: color-mix(in srgb, var(--crm-primary) 60%, var(--crm-border));
}

.crm-timesheet-total {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--crm-primary) 6%, #fff);
    border: 1px solid color-mix(in srgb, var(--crm-primary) 16%, var(--crm-border));
}

.crm-timesheet-total span {
    color: var(--crm-muted);
}

.crm-timesheet-total strong {
    font-size: 18px;
    font-weight: 500;
}

.crm-timesheet-error {
    padding: 10px 12px;
    border-radius: 14px;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #991b1b;
    font-size: 14px;
}

.crm-timesheet-modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--crm-border);
    background: color-mix(in srgb, var(--crm-surface) 94%, transparent);
    backdrop-filter: blur(12px);
}

@media (min-width: 901px) {
    .crm-timesheet-details {
        display: none;
    }
}

@media (max-width: 1100px) {
    .crm-timesheet-summary {
        display: none;
    }
}

@media (max-width: 900px) {
    .crm-timesheet-sticky {
        margin-left: calc(var(--margin-content, 12px) * -1);
        margin-right: calc(var(--margin-content, 12px) * -1);
        padding-left: var(--padding-left-header, 12px);
        padding-right: var(--padding-right-header, 12px);
    }

    .crm-timesheet-title p,
    .crm-timesheet-legend,
    .crm-timesheet-today,
    .crm-timesheet-add-desktop {
        display: none !important;
    }

    .crm-timesheet-add-mobile {
        display: inline-flex !important;
    }

    .crm-timesheet-header {
        margin-bottom: 12px;
    }

    .crm-timesheet-toolbar {
        justify-content: center;
    }

    .crm-timesheet-spacer {
        display: none;
    }

    .crm-timesheet-month {
        min-width: 160px;
    }

    .crm-timesheet-calendar {
        border-radius: 16px;
    }

    .crm-timesheet-weekdays > div {
        padding: 9px 4px;
        font-size: 12px;
    }

    .crm-timesheet-day {
        min-height: 58px;
        padding: 22px 5px 5px;
    }

    .crm-timesheet-shifts {
        display: none;
    }

    .crm-timesheet-date {
        top: 6px;
        right: 7px;
        font-size: 11px;
    }

    .crm-timesheet-indicator {
        top: 5px;
        left: 5px;
        min-width: 19px;
        height: 19px;
        font-size: 11px;
    }

    .crm-timesheet-modal-backdrop {
        align-items: stretch;
        padding: 0;
    }

    .crm-timesheet-modal {
        width: 100%;
        max-height: none;
        height: 100dvh;
        border-radius: 0;
    }

    .crm-timesheet-modal-header {
        padding: 14px 14px;
    }

    .crm-timesheet-modal-body {
        padding: 14px;
    }

    .crm-timesheet-modal-footer {
        padding: 12px 14px;
    }

    .crm-timesheet-row-2,
    .crm-timesheet-time-grid,
    .crm-timesheet-date-time-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .crm-timesheet-line {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 8px;
        padding: 9px 10px;
    }

    .crm-timesheet-line-duration {
        grid-column: 2 / -1;
    }
}

@media (max-width: 420px) {
    .crm-timesheet-month {
        min-width: 132px;
        padding-left: 10px;
        padding-right: 10px;
        font-size: 14px;
    }

    .crm-timesheet-modal-footer {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .crm-timesheet-modal-footer .crm-btn-danger {
        grid-column: 1 / -1;
    }
}

/* ===== v0.1.4: выбор даты/времени как в старой Vue CRM ===== */
.crm-timesheet-datetime-input {
    cursor: pointer;
    background: #fff;
}

.crm-timesheet-datetime-input::placeholder {
    color: #98a2b3;
}

html.crm-timesheet-picker-open,
body.crm-timesheet-picker-open {
    overflow: hidden;
}

.crm-ts-picker-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, .58);
    color: var(--crm-text);
}

.crm-ts-picker-backdrop * {
    box-sizing: border-box;
}

.crm-ts-picker-sheet {
    position: relative;
    width: min(620px, calc(100vw - 36px));
    max-height: calc(100dvh - 36px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--crm-border) 80%, transparent);
    border-radius: 24px;
    background: var(--crm-surface);
    box-shadow: 0 34px 110px rgba(15, 23, 42, .42);
}

.crm-ts-picker-head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 16px;
    border-bottom: 1px solid var(--crm-border);
    background: color-mix(in srgb, var(--crm-surface) 96%, #fff);
    backdrop-filter: blur(12px);
}

.crm-ts-picker-head strong {
    font-size: 16px;
    font-weight: 500;
    color: var(--crm-text);
}

.crm-ts-picker-x {
    width: 38px;
    height: 38px;
    border: 1px solid var(--crm-border);
    border-radius: 13px;
    background: #fff;
    color: var(--crm-text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.crm-ts-picker-body {
    min-height: 0;
    overflow: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 176px;
    gap: 14px;
    padding: 14px;
    background: color-mix(in srgb, var(--crm-bg) 42%, #fff);
}

.crm-ts-picker-calendar,
.crm-ts-picker-time {
    border: 1px solid var(--crm-border);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
}

.crm-ts-picker-calendar {
    padding: 12px;
}

.crm-ts-picker-monthbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.crm-ts-picker-monthbar span {
    color: var(--crm-text);
    font-size: 14px;
    font-weight: 500;
    text-transform: capitalize;
}

.crm-ts-picker-monthbar button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--crm-border);
    border-radius: 13px;
    background: #fff;
    color: var(--crm-text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.crm-ts-picker-weekdays,
.crm-ts-picker-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.crm-ts-picker-weekdays {
    margin-bottom: 6px;
}

.crm-ts-picker-weekdays span {
    padding: 5px 0;
    color: var(--crm-muted);
    font-size: 11px;
    font-weight: 500;
    text-align: center;
}

.crm-ts-picker-day {
    aspect-ratio: 1 / 1;
    min-height: 36px;
    border: 1px solid transparent;
    border-radius: 13px;
    background: #fff;
    color: var(--crm-text);
    font-weight: 550;
    cursor: pointer;
}

.crm-ts-picker-day:hover {
    border-color: color-mix(in srgb, var(--crm-primary) 25%, var(--crm-border));
    background: color-mix(in srgb, var(--crm-primary) 7%, #fff);
}

.crm-ts-picker-day.is-out {
    color: #98a2b3;
    background: #f8fafc;
}

.crm-ts-picker-day.is-today {
    border-color: color-mix(in srgb, var(--crm-primary) 50%, var(--crm-border));
}

.crm-ts-picker-day.is-selected {
    background: var(--crm-primary);
    border-color: var(--crm-primary);
    color: var(--color-btn, #fff);
}

.crm-ts-picker-time {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 10px;
    padding: 16px 12px;
}

.crm-ts-picker-time-title {
    color: var(--crm-muted);
    font-size: 13px;
    font-weight: 500;
}

.crm-ts-picker-time-box {
    display: grid;
    grid-template-columns: 62px auto 62px;
    align-items: center;
    gap: 8px;
}

.crm-ts-picker-num {
    display: grid;
    gap: 6px;
}

.crm-ts-picker-step {
    height: 30px;
    border: 1px solid var(--crm-border);
    border-radius: 10px;
    background: #fff;
    color: var(--crm-text);
    cursor: pointer;
}

.crm-ts-picker-value {
    width: 62px;
    height: 52px;
    border: 1px solid color-mix(in srgb, var(--crm-primary) 24%, var(--crm-border));
    border-radius: 16px;
    background: color-mix(in srgb, var(--crm-primary) 6%, #fff);
    color: var(--crm-text);
    font-size: 23px;
    font-weight: 500;
    text-align: center;
    font-variant-numeric: tabular-nums;
    outline: none;
    cursor: pointer;
}

.crm-ts-picker-value:hover,
.crm-ts-picker-value:focus {
    border-color: color-mix(in srgb, var(--crm-primary) 60%, var(--crm-border));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--crm-primary) 12%, transparent);
}

.crm-ts-picker-colon {
    color: var(--crm-muted);
    font-size: 24px;
    font-weight: 500;
}

.crm-ts-picker-time-hint {
    max-width: 150px;
    color: var(--crm-muted);
    font-size: 11px;
    font-weight: 5000;
    line-height: 1.25;
    text-align: center;
}

.crm-ts-picker-selected {
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.crm-ts-picker-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px 14px;
    border-top: 1px solid var(--crm-border);
    background: color-mix(in srgb, var(--crm-surface) 96%, #fff);
    backdrop-filter: blur(12px);
}

.crm-ts-picker-spacer {
    flex: 1 1 auto;
}

.crm-ts-picker-btn {
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid var(--crm-border);
    border-radius: 12px;
    background: #fff;
    color: var(--crm-text);
    font-weight: 500;
    cursor: pointer;
}

.crm-ts-picker-btn.primary {
    border-color: var(--crm-primary);
    background: var(--crm-primary);
    color: var(--color-btn, #fff);
}

.crm-ts-time-panel-backdrop {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, .38);
    backdrop-filter: blur(4px);
}

.crm-ts-time-panel {
    width: min(420px, 100%);
    max-height: min(620px, calc(100dvh - 72px));
    overflow: auto;
    border: 1px solid var(--crm-border);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(15, 23, 42, .32);
}

.crm-ts-time-panel-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--crm-border);
    background: #fff;
}

.crm-ts-time-panel-head div {
    display: grid;
    gap: 3px;
}

.crm-ts-time-panel-head strong {
    font-size: 16px;
    font-weight: 500;
    color: var(--crm-text);
}

.crm-ts-time-panel-head span {
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 500;
}

.crm-ts-time-panel-x {
    width: 36px;
    height: 36px;
    border: 1px solid var(--crm-border);
    border-radius: 12px;
    background: #fff;
    color: var(--crm-text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.crm-ts-picker-choice-grid {
    display: grid;
    gap: 8px;
    padding: 14px;
}

.crm-ts-picker-choice-grid.is-hours {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.crm-ts-picker-choice-grid.is-minutes {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.crm-ts-picker-choice {
    min-height: 42px;
    border: 1px solid var(--crm-border);
    border-radius: 14px;
    background: #fff;
    color: var(--crm-text);
    font-size: 16px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.crm-ts-picker-choice:hover {
    border-color: color-mix(in srgb, var(--crm-primary) 35%, var(--crm-border));
    background: color-mix(in srgb, var(--crm-primary) 7%, #fff);
}

.crm-ts-picker-choice.is-selected {
    border-color: var(--crm-primary);
    background: var(--crm-primary);
    color: var(--color-btn, #fff);
}

@media (max-width: 900px) {
    .crm-ts-picker-backdrop {
        align-items: stretch;
        padding: 0;
    }

    .crm-ts-picker-sheet {
        width: 100%;
        max-height: none;
        height: 100dvh;
        border-radius: 0;
    }

    .crm-ts-picker-body {
        grid-template-columns: 1fr;
        align-content: start;
    }

    .crm-ts-picker-time-box {
        grid-template-columns: 78px auto 78px;
    }

    .crm-ts-picker-value {
        width: 78px;
    }

    .crm-ts-time-panel {
        width: 100%;
    }

    .crm-ts-picker-choice-grid.is-hours {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 420px) {
    .crm-ts-picker-footer {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .crm-ts-picker-spacer {
        display: none;
    }

    .crm-ts-picker-btn.primary {
        grid-column: 1 / -1;
    }

    .crm-ts-picker-choice-grid.is-hours,
    .crm-ts-picker-choice-grid.is-minutes {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}


.crm-timesheet-summary,
.crm-timesheet-legend {
    display: none !important;
}


/* ===== v0.1.5: табель под общий стандарт CRM-best-MD ===== */
.crm-timesheet-add-mobile {
    display: none !important;
}

.crm-timesheet-plus {
    display: none;
}

.crm-timesheet-calendar {
    margin-top: 0;
}

.crm-timesheet-modal {
    background: var(--crm-surface, #fff);
    border-radius: var(--crm-radius-lg, 20px);
}

.crm-timesheet-modal-header,
.crm-timesheet-modal-footer {
    background: var(--crm-modal-head-bg, var(--crm-bg, #f3f6fb));
    border-color: var(--crm-modal-head-border, rgba(15, 23, 42, .06));
    box-shadow: var(--crm-modal-head-shadow, none);
    backdrop-filter: blur(var(--crm-modal-head-blur, 10px));
    -webkit-backdrop-filter: blur(var(--crm-modal-head-blur, 10px));
}

.crm-timesheet-modal-header h2 {
    font-weight: 500;
    font-size: var(--crm-modal-head-title-size, 24px);
}

.crm-timesheet-field select,
.crm-timesheet-field input,
.crm-timesheet-field textarea {
    border-color: var(--crm-border, #e2e8f0);
    border-radius: var(--crm-radius-md, 14px);
    color: var(--crm-text, #0f172a);
}

.crm-timesheet-field > span {
    color: var(--crm-muted, #64748b);
    font-weight: 500;
}

.crm-ts-picker-backdrop {
}

.crm-ts-picker-step,
.crm-ts-picker-value,
.crm-ts-picker-choice,
.crm-ts-picker-btn,
.crm-ts-picker-monthbar button,
.crm-ts-picker-day,
.crm-ts-picker-x,
.crm-ts-time-panel-x {
    touch-action: manipulation;
}

.crm-ts-picker-body {
    scroll-behavior: auto;
}

@media (max-width: 1180px) {
    .crm-page-head-timesheet {
        grid-template-columns: max-content minmax(300px, 1fr) max-content;
        column-gap: 14px;
    }
}

@media (max-width: 900px) {
    .crm-page-head-timesheet {
        grid-template-columns: minmax(0, 1fr) auto;
        row-gap: 10px;
        column-gap: 12px;
        align-items: center;
    }

    .crm-page-head-timesheet .crm-page-head-title {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }

    .crm-page-head-timesheet .crm-page-head-title h1 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .crm-page-head-timesheet .crm-page-head-mobile-actions {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
    }

    .crm-page-head-timesheet .crm-page-head-actions {
        display: none;
    }

    .crm-page-head-timesheet .crm-timesheet-toolbar {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        max-width: none;
        justify-self: stretch;
        grid-template-columns: var(--crm-icon-btn-size, 42px) minmax(0, 1fr) var(--crm-icon-btn-size, 42px) auto;
    }

    .crm-timesheet-today {
        min-width: 84px;
    }

    .crm-timesheet-add-mobile {
        display: inline-flex !important;
    }
}

@media (max-width: 420px) {
    .crm-page-head-timesheet .crm-timesheet-toolbar {
        grid-template-columns: var(--crm-icon-btn-size, 42px) minmax(0, 1fr) var(--crm-icon-btn-size, 42px);
    }

    .crm-timesheet-today {
        display: none !important;
    }
}

/* ===== v0.1.7: единые иконки и мобильная модалка табеля ===== */
.crm-timesheet-modal-actions .crm-icon-btn .crm-icon,
.crm-ts-picker-x .crm-icon,
.crm-ts-time-panel-x .crm-icon {
    width: 18px;
    height: 18px;
}

.crm-ts-picker-x.crm-icon-btn,
.crm-ts-time-panel-x.crm-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: inherit;
    line-height: normal;
}

@media (max-width: 900px) {
    .crm-timesheet-modal-backdrop {
        align-items: stretch;
        justify-content: stretch;
        padding: 0;
    }

    .crm-timesheet-modal {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .crm-timesheet-modal form {
        height: 100%;
        max-height: 100%;
    }
}
