:root {
    --hf-surface: #ffffff;
    --hf-surface-muted: #f8fafc;
    --hf-border: var(--theme-border-color, var(--border, #d6dce5));
    --hf-text: var(--theme-text-body, var(--text, #1f2937));
    --hf-text-muted: var(--theme-text-muted, var(--text-muted, #64748b));
    --hf-heading: var(--theme-text-heading, var(--text, #0f172a));
    --hf-primary: var(--theme-primary, var(--primary, #0f766e));
    --hf-primary-hover: var(--theme-primary-hover, var(--primary-hover, #0d6e66));
    --hf-danger: var(--theme-danger, var(--admin-danger, #dc2626));
    --hf-radius: 12px;
    --hf-radius-lg: 16px;
    --hf-shadow: 0 18px 38px rgba(15, 23, 42, 0.12), 0 6px 14px rgba(15, 23, 42, 0.08);
    --hf-focus-ring: 0 0 0 4px rgba(15, 118, 110, 0.14);
    --hf-font-size: 0.95rem;
    --hf-font-size-sm: 0.875rem;
    --hf-font-size-xs: 0.75rem;
}

.hf-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.hf-field__label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--hf-heading);
}

.hf-field__helper {
    font-size: var(--hf-font-size-xs);
    color: var(--hf-text-muted);
}

.hf-field__error {
    font-size: var(--hf-font-size-xs);
    color: var(--hf-danger);
}

.hf-select,
.hf-picker {
    position: relative;
    width: 100%;
}

.hf-select__native {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

.hf-select__button,
input[data-hf-picker] {
    width: 100%;
    height: calc(1.5em + 0.75rem + 2px);
    min-height: 0;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--hf-border);
    border-radius: var(--hf-radius);
    background: var(--hf-surface);
    color: var(--hf-text);
    font-size: var(--hf-font-size);
    line-height: 1.5;
    box-sizing: border-box;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease,
        color 0.18s ease, transform 0.18s ease;
}

.hf-select__button {
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    text-align: left;
    cursor: pointer;
}

.hf-select__button.form-select {
    background-image: none !important;
    padding-right: 0.75rem;
}

.hf-select__button:hover,
input[data-hf-picker]:hover {
    border-color: var(--hf-primary);
    background: #fcfefe;
}

.hf-select__button:focus,
.hf-select__button:focus-visible,
input[data-hf-picker]:focus,
input[data-hf-picker]:focus-visible {
    outline: none;
    border-color: var(--hf-primary);
    box-shadow: var(--hf-focus-ring);
}

.hf-select__button:disabled,
input[data-hf-picker]:disabled {
    cursor: not-allowed;
    background: #f1f5f9;
    color: #94a3b8;
}

.hf-select__value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hf-select__value.is-placeholder {
    color: var(--hf-text-muted);
}

.hf-select__actions {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.hf-select__clear,
.hf-panel__nav,
.hf-panel__footer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--hf-text-muted);
    cursor: pointer;
    transition: color 0.18s ease, background-color 0.18s ease;
}

.hf-select__clear {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 999px;
}

.hf-select__clear:hover,
.hf-panel__nav:hover,
.hf-panel__footer-btn:hover {
    background: rgba(15, 118, 110, 0.08);
    color: var(--hf-primary);
}

.hf-select__chevron {
    font-size: 0.78rem;
    color: var(--hf-text-muted);
}

.hf-select__button.is-open .hf-select__chevron {
    transform: rotate(180deg);
}

.hf-floating-panel {
    position: fixed;
    z-index: 2055;
    display: none;
    min-width: 280px;
    max-width: min(360px, calc(100vw - 24px));
    padding: 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: var(--hf-radius-lg);
    background: var(--hf-surface);
    box-shadow: var(--hf-shadow);
}

.hf-floating-panel.is-open {
    display: block;
}

.hf-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.8rem;
}

.hf-panel__header--compound {
    align-items: stretch;
}

.hf-panel__title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--hf-heading);
}

.hf-panel__header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.hf-panel__header-select {
    flex: 1;
    min-width: 0;
    height: 2.15rem;
    padding: 0.2rem 1.9rem 0.2rem 0.75rem;
    border: 1.5px solid rgba(15, 118, 110, 0.22);
    border-radius: 999px;
    background-color: rgba(15, 118, 110, 0.07);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%230f766e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    color: var(--hf-primary);
    font-size: 0.84rem;
    font-weight: 700;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    box-sizing: border-box;
}

.hf-panel__header-select:hover {
    border-color: rgba(15, 118, 110, 0.4);
    background-color: rgba(15, 118, 110, 0.13);
}

.hf-panel__header-select:focus {
    outline: none;
    border-color: var(--hf-primary);
    box-shadow: var(--hf-focus-ring);
    background-color: rgba(15, 118, 110, 0.1);
}

.hf-panel__header-select--year {
    flex: 0 0 5.6rem;
}

.hf-panel__nav {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 999px;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.hf-panel__search {
    width: 100%;
    min-height: 40px;
    margin-bottom: 0.8rem;
    padding: 0.68rem 0.82rem;
    border: 1px solid var(--hf-border);
    border-radius: 10px;
    background: var(--hf-surface-muted);
    font-size: var(--hf-font-size-sm);
    color: var(--hf-text);
}

.hf-panel__search:focus {
    outline: none;
    border-color: var(--hf-primary);
    box-shadow: var(--hf-focus-ring);
    background: var(--hf-surface);
}

.hf-select__options {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 256px;
    overflow-y: auto;
    padding-right: 0.15rem;
}

.hf-select__option {
    width: 100%;
    padding: 0.72rem 0.82rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--hf-text);
    font-size: var(--hf-font-size-sm);
    text-align: left;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.hf-select__option:hover,
.hf-select__option.is-active {
    background: rgba(15, 118, 110, 0.08);
    border-color: rgba(15, 118, 110, 0.16);
    color: var(--hf-primary);
}

.hf-select__option.is-selected {
    background: rgba(15, 118, 110, 0.12);
    border-color: rgba(15, 118, 110, 0.2);
    color: var(--hf-primary);
    font-weight: 600;
}

.hf-select__empty {
    padding: 0.9rem 0.75rem;
    border-radius: 10px;
    background: #f8fafc;
    color: var(--hf-text-muted);
    font-size: var(--hf-font-size-sm);
    text-align: center;
}

.hf-picker__weekdays,
.hf-picker__days,
.hf-picker__months,
.hf-picker__years {
    display: grid;
    gap: 0.35rem;
}

.hf-picker__weekdays,
.hf-picker__days {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.hf-picker__months {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.hf-picker__months .hf-picker__cell {
    min-height: 3.1rem;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 12px;
    flex-direction: column;
    gap: 0.2rem;
}

.hf-picker__years {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.hf-picker__years .hf-picker__cell {
    min-height: 2.7rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 12px;
}

.hf-picker__weekday {
    padding-bottom: 0.1rem;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--hf-text-muted);
}

.hf-picker__cell {
    min-height: 2.5rem;
    padding: 0.35rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--hf-text);
    font-size: var(--hf-font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.hf-picker__cell:hover,
.hf-picker__cell.is-active {
    background: rgba(15, 118, 110, 0.08);
    border-color: rgba(15, 118, 110, 0.18);
    color: var(--hf-primary);
}

.hf-picker__cell.is-selected {
    background: var(--hf-primary);
    border-color: var(--hf-primary);
    color: #ffffff;
    font-weight: 700;
}

.hf-picker__cell.is-muted {
    color: #94a3b8;
}

.hf-picker__cell.is-disabled {
    background: transparent;
    border-color: transparent;
    color: #cbd5e1;
    cursor: not-allowed;
}

.hf-panel__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.85rem;
    padding-top: 0.8rem;
    border-top: 1px solid #eef2f7;
}

.hf-panel__footer-btn {
    padding: 0.45rem 0.75rem;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
}

.hf-panel__footer-btn.hf-panel__footer-btn--primary {
    background: rgba(15, 118, 110, 0.1);
    color: var(--hf-primary);
}

.hf-panel__footer-btn.hf-panel__footer-btn--primary:hover {
    background: rgba(15, 118, 110, 0.16);
}

.hf-select__button.is-invalid,
input[data-hf-picker].is-invalid,
.hf-field--invalid .hf-select__button,
.hf-field--invalid input[data-hf-picker] {
    border-color: var(--hf-danger);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
}

.hf-select__button.form-select-sm,
.hf-select__button.form-control-sm,
input[data-hf-picker].form-select-sm,
input[data-hf-picker].form-control-sm {
    height: calc(1.5em + 0.5rem + 2px);
    padding: 0.25rem 0.5rem;
    font-size: 0.84rem;
}

.hf-select__button.form-select-lg,
.hf-select__button.form-control-lg,
input[data-hf-picker].form-select-lg,
input[data-hf-picker].form-control-lg {
    height: calc(1.5em + 1rem + 2px);
    padding: 0.5rem 1rem;
    font-size: 1.05rem;
}

.hf-select__button.text-center,
input[data-hf-picker].text-center {
    text-align: center;
}

@media (max-width: 767.98px) {
    .hf-floating-panel {
        max-width: calc(100vw - 16px);
        padding: 0.8rem;
        border-radius: 14px;
    }

    .hf-picker__months {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hf-picker__years {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
