/* SMK Tool — History / Dark Glass; isolated to history elements. */
#stepsContainer #routeFooterActions.next-footactions{grid-template-columns:repeat(3,minmax(0,1fr));}
.next-ui-app .next-history-quick{position:static;display:flex;align-items:center;justify-content:center;gap:8px;min-width:0;flex:1;height:42px;padding:0 10px;border:1px solid rgba(143,162,223,.28);border-radius:12px;color:#bdb0ff;background:rgba(120,92,215,.12);font-size:12px;cursor:pointer;}
.next-ui-app .next-history-quick .svg-icon{width:17px;height:17px;}
.next-ui-app .next-history-quick:hover{background:rgba(128,103,239,.24);border-color:rgba(170,154,255,.6);}
.history-overlay{position:fixed;inset:0;z-index:1000200;display:none;align-items:center;justify-content:center;padding:16px;box-sizing:border-box;background:rgba(3,7,18,.80);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);}
.history-overlay.active{display:flex;}
.history-overlay *{box-sizing:border-box;}
.history-dialog{display:flex;flex-direction:column;width:min(720px,100%);max-height:min(780px,calc(100dvh - 32px));overflow:hidden;border:1px solid rgba(147,161,222,.32);border-radius:26px;background:linear-gradient(140deg,rgba(31,43,72,.90),rgba(12,18,35,.95));box-shadow:0 30px 100px rgba(0,0,0,.50),inset 0 1px rgba(255,255,255,.09);color:#eaf0ff;}
.history-head{padding:23px 25px 17px;display:flex;align-items:flex-start;justify-content:space-between;gap:12px;border-bottom:1px solid rgba(150,176,235,.11);}
.history-eyebrow{font-size:10px;letter-spacing:2px;color:#ae9df9;font-weight:800;}
.history-head h2{margin:7px 0 4px;font-size:25px;letter-spacing:-.6px;}
.history-head p{margin:0;color:#99accd;font-size:12px;}
.history-close{display:grid;place-items:center;width:35px;height:35px;flex:0 0 35px;border:1px solid rgba(161,185,234,.23);border-radius:12px;background:rgba(98,118,168,.13);color:#c8d4f7;cursor:pointer;font-size:23px;}
.history-tools{display:flex;gap:10px;padding:18px 25px 10px;}
.history-search{display:flex;flex:1;align-items:center;gap:9px;padding:0 12px;min-width:0;border:1px solid rgba(160,175,222,.25);background:rgba(5,11,26,.46);border-radius:12px;color:#91aadb;}
.history-search input{font:inherit;font-size:13px;min-width:0;flex:1;max-width:100%;color:#fff;background:transparent;border:0;outline:0;padding:12px 0;}
.history-search:focus-within{border-color:#9386f2;box-shadow:0 0 0 3px rgba(138,112,237,.14);}
.history-tools select{font:inherit;font-size:12px;color:#d6e0fb;background:#17233d;border:1px solid rgba(160,175,222,.28);padding:10px;border-radius:11px;max-width:145px;}
.history-status{padding:0 25px;font-size:12px;color:#96b4ec;}
.history-status.history-error{color:#ffb6c3;padding-top:8px;}
.history-list{padding:7px 25px 12px;overflow-y:auto;overscroll-behavior:contain;flex:1;min-height:80px;display:flex;flex-direction:column;gap:10px;scrollbar-color:rgba(140,164,231,.5) transparent;}
.history-item{border:1px solid rgba(146,166,234,.22);background:linear-gradient(135deg,rgba(71,96,158,.14),rgba(25,33,61,.46));border-radius:16px;padding:15px 17px;}
.history-item-top{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;}
.history-route{color:#e7efff;font-size:16px;font-weight:750;}
.history-time{color:#9badcd;font-size:11px;white-space:nowrap;}
.history-sub{color:#96a9c9;font-size:12px;margin-top:4px;}
.history-badges{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    margin-top:12px;
}

.history-badge{
    display:inline-flex;
    align-items:center;
    gap:7px;
    min-height:32px;
    padding:7px 11px;
    border-radius:999px;

    font-size:12px;
    font-weight:650;
    line-height:1;

    border:1px solid rgba(149,172,243,.24);
    background:rgba(33,47,83,.48);
    color:#dce7ff;

    box-shadow:inset 0 1px rgba(255,255,255,.05);
}

.history-badge strong{
    font-size:13px;
    font-weight:800;
    color:#fff;
}

.history-badge .svg-icon{
    width:15px;
    height:15px;
    flex:0 0 15px;
}

.history-badge--milk{
    color:#b9d8ff;
    background:rgba(41,72,128,.28);
    border-color:rgba(102,153,255,.24);
}

.history-badge--egg{
    color:#ffd977;
    background:rgba(120,88,18,.20);
    border-color:rgba(251,191,36,.24);
}

.history-badge--total{
    color:#dccdff;
    background:rgba(86,56,129,.22);
    border-color:rgba(180,138,255,.24);
}

.history-badge.is-muted{
    opacity:.72;
}
.history-item-actions{display:flex;gap:9px;margin-top:14px;}
.history-item-actions button,.history-footer button,.history-viewer-banner button{border:1px solid rgba(149,172,243,.31);border-radius:11px;padding:10px 13px;font-size:12px;font-weight:750;cursor:pointer;color:#c9d9ff;background:rgba(69,106,183,.16);}
.history-item-actions .history-open{border-color:rgba(144,135,248,.40);background:linear-gradient(120deg,rgba(68,107,210,.33),rgba(134,91,208,.26));color:#e5dcff;}
.history-item-actions button:hover,.history-footer button:hover,.history-viewer-banner button:hover{filter:brightness(1.25);}
.history-item-actions .history-remove,.history-footer button{margin-left:auto;color:#e6b1c4;border-color:rgba(213,116,150,.22);background:rgba(119,47,72,.13);}
.history-empty{text-align:center;padding:38px 15px;color:#8ea3c6;font-size:14px;line-height:1.5;}
.history-footer{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:13px 25px 16px;border-top:1px solid rgba(150,176,235,.12);font-size:11px;color:#8ea2c3;}
.history-viewer-banner{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin:0 0 18px;padding:14px 17px;border:1px solid rgba(166,140,249,.38);border-radius:16px;background:linear-gradient(100deg,rgba(81,90,190,.25),rgba(76,50,146,.25));}
.history-viewer-banner[hidden]{display:none!important;}
.history-viewer-banner>div{display:flex;flex-direction:column;gap:5px;}
.history-viewer-eyebrow{font-size:10px;letter-spacing:1.5px;color:#bbafff;font-weight:800;}
.history-viewer-banner strong{font-size:13px;color:#fff;}
@media(max-width:1100px){.next-ui-app .next-history-quick{width:39px;height:39px;min-width:39px;flex:0 0 39px;padding:0;border-radius:12px;}.next-ui-app .next-brand{padding-right:136px;}}
@media(max-width:600px){#stepsContainer #routeFooterActions.next-footactions{grid-template-columns:1fr 1fr;}#stepsContainer #routeFooterActions .history-footer-btn{grid-column:span 2;}.history-dialog{border-radius:20px;max-height:calc(100dvh - 22px);}.history-overlay{padding:11px;}.history-head{padding:17px 15px 14px;}.history-head h2{font-size:21px;}.history-tools{padding:13px 15px 9px;flex-direction:column;}.history-tools select{max-width:none;width:100%;}.history-list{padding:7px 15px;}.history-status{padding:0 15px;}.history-item{padding:13px;}.history-item-top{flex-direction:column;gap:4px;}.history-item-actions button{font-size:11px;padding:10px;}.history-footer{padding:12px 15px;}.history-footer>span{max-width:155px;line-height:1.4;}.history-viewer-banner{align-items:stretch;flex-direction:column;}.history-viewer-banner button{width:100%;}}
@media(max-width:360px){.next-ui-app .next-history-quick{width:32px;min-width:32px;height:34px;flex-basis:32px;}.next-ui-app .next-brand{padding-right:119px;}}
@media(prefers-reduced-motion:reduce){.history-dialog,.history-item{animation:none!important;transition:none!important;}}

/* ========================================
   HISTORY — GLASS OPEN ANIMATION
   ======================================== */

.history-overlay {
    display: flex;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity .3s ease,
        visibility .3s ease;
}

.history-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.history-dialog {
    opacity: 0;
    transform: translateY(20px) scale(.96);
    transition:
        opacity .38s ease,
        transform .38s cubic-bezier(.16, 1, .3, 1);
    will-change: transform, opacity;
}

.history-overlay.active .history-dialog {
    opacity: 1;
    transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
    .history-overlay,
    .history-dialog {
        transition: none !important;
    }
}

/* Подтверждение поверх окна истории */
#historyConfirm {
    z-index: 1000300 !important;
}

#historyConfirm .history-confirm-actions {
    display: flex;
    gap: 10px;
}

#historyConfirm .history-confirm-actions
.custom-alert-btn {
    flex: 1;
    min-width: 0;
    width: auto;
}

#historyConfirm .history-confirm-delete {
    background: rgba(180, 65, 100, .20) !important;
    border-color: rgba(245, 120, 155, .40) !important;
    color: #ffcada !important;
}

#historyConfirm .history-confirm-delete:hover {
    background: rgba(180, 65, 100, .35) !important;
}
/* Компактный индикатор просмотра истории */
.history-viewer-banner {
    display: flex;
    align-items: center;
    justify-content: center;

    padding: 12px 18px;
    text-align: center;

    color: #b6a5ff;
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.7px;
}
/* Неактивная кнопка очистки */
#historyClear:disabled {
    opacity: .35;
    cursor: not-allowed;
    filter: grayscale(.5);
    pointer-events: none;
    box-shadow: none;
}

/* ========================================
   HISTORY — CUSTOM FILTER
   ======================================== */

#historyModal #historyFilter {
    appearance: none;
    -webkit-appearance: none;

    flex: 0 0 155px;
    width: 155px;
    max-width: none;
    height: 44px;

    padding: 0 38px 0 14px;

    font-size: 13px;
    font-weight: 650;
    color: #dce5ff;

    background-color: rgba(24, 36, 65, .65);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23b6a5ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    background-size: 16px;

    border: 1px solid rgba(159, 178, 244, .30);
    border-radius: 13px;

    box-shadow:
        inset 0 1px rgba(255,255,255,.06);

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    cursor: pointer;
    outline: none;
    color-scheme: dark;

    transition:
        background-color .2s ease,
        border-color .2s ease,
        box-shadow .2s ease;
}

/* Наведение */
#historyModal #historyFilter:hover {
    background-color: rgba(50, 63, 106, .65);
    border-color: rgba(173, 158, 255, .55);
}

/* Фокус */
#historyModal #historyFilter:focus-visible {
    border-color: #a78bfa;
    box-shadow: 0 0 0 3px rgba(167,139,250,.15);
}

/* Пункты раскрывающегося списка */
#historyModal #historyFilter option {
    background: #17213a;
    color: #e5edff;
}

/* Мобильная версия */
@media (max-width: 600px) {
    #historyModal #historyFilter {
        flex: 1 1 auto;
        width: 100%;
        max-width: 100%;
    }
}
/* ========================================
   HISTORY — CUSTOM FILTER
   ======================================== */

.history-filter{
    position:relative;
    flex:0 0 155px;
    width:155px;
}

#historyFilter{
    display:none;
}

.history-filter-trigger{
    width:100%;
    height:44px;
    padding:0 38px 0 14px;

    display:flex;
    align-items:center;
    justify-content:flex-start;

    border:1px solid rgba(159,178,244,.30);
    border-radius:13px;

    background:rgba(24,36,65,.65);
    color:#dce5ff;

    font-size:13px;
    font-weight:650;
    cursor:pointer;

    box-shadow:inset 0 1px rgba(255,255,255,.06);
    backdrop-filter:blur(12px);
    -webkit-backdrop-filter:blur(12px);

    position:relative;
    transition:
        background-color .2s ease,
        border-color .2s ease,
        box-shadow .2s ease;
}

.history-filter-trigger::after{
    content:"";
    position:absolute;
    right:14px;
    top:50%;
    width:8px;
    height:8px;
    border-right:2px solid #b6a5ff;
    border-bottom:2px solid #b6a5ff;
    transform:translateY(-65%) rotate(45deg);
    transition:transform .2s ease;
}

.history-filter.open .history-filter-trigger::after{
    transform:translateY(-35%) rotate(-135deg);
}

.history-filter-trigger:hover{
    background:rgba(50,63,106,.65);
    border-color:rgba(173,158,255,.55);
}

.history-filter-trigger:focus-visible{
    outline:none;
    border-color:#a78bfa;
    box-shadow:0 0 0 3px rgba(167,139,250,.15);
}

.history-filter-menu{
    position:absolute;
    top:calc(100% + 8px);
    left:0;
    right:0;
    z-index:25;

    display:flex;
    flex-direction:column;
    gap:4px;

    padding:6px;

    border:1px solid rgba(159,178,244,.30);
    border-radius:14px;

    background:rgba(18,27,49,.92);
    box-shadow:0 18px 40px rgba(0,0,0,.35);

    backdrop-filter:blur(14px);
    -webkit-backdrop-filter:blur(14px);

    opacity:0;
    transform:translateY(-6px) scale(.98);
    pointer-events:none;

    transition:
        opacity .18s ease,
        transform .18s ease;
}

.history-filter.open .history-filter-menu{
    opacity:1;
    transform:translateY(0) scale(1);
    pointer-events:auto;
}

.history-filter-option{
    width:100%;
    min-height:38px;
    padding:10px 12px;

    border:0;
    border-radius:10px;
    background:transparent;
    color:#dce5ff;

    text-align:left;
    font-size:13px;
    font-weight:650;
    cursor:pointer;
    transition:background .16s ease,color .16s ease;
}

.history-filter-option:hover{
    background:rgba(82,102,170,.22);
}

.history-filter-option.active{
    background:linear-gradient(120deg,rgba(78,108,204,.36),rgba(133,94,202,.28));
    color:#fff;
}

@media (max-width:600px){
    .history-filter{
        flex:1 1 auto;
        width:100%;
    }
}
/* Скрываем меню, пока оно закрыто */
.history-filter-menu[hidden] {
    display: none !important;
}

/* Выпадающий список поверх карточек */
.history-filter {
    position: relative;
    z-index: 30;
}

/* Активный фильтр */
.history-filter.open {
    z-index: 31;
}

/* ========================================
   HISTORY — SMOOTH DROPDOWN
   ======================================== */

.history-filter-menu {
    visibility: hidden;
    opacity: 0;

    transform:
        translateY(-10px)
        scale(.96);

    transform-origin: top right;

    pointer-events: none;

    transition:
        opacity .22s ease,
        transform .28s cubic-bezier(.16,1,.3,1),
        visibility 0s linear .28s;
}

/* Раскрытое меню */
.history-filter.open .history-filter-menu {
    visibility: visible;
    opacity: 1;

    transform:
        translateY(0)
        scale(1);

    pointer-events: auto;
    transition-delay: 0s;
}

/* Фильтр поверх карточек */
.history-tools {
    position: relative;
    z-index: 5;
}

.history-list {
    position: relative;
    z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
    .history-filter-menu {
        transition: none !important;
    }
}

/* ========================================
   HISTORY — BADGES & BUTTONS
   ======================================== */

/* Пропущенные яйца — яркий текст */
.history-badge--egg.is-muted {
    opacity: 1;
}

.history-badge--egg.is-muted span {
    color: #ffffff;
    font-weight: 800;
}

/* Открыть результат — голубой акцент */
#historyModal .history-item-actions .history-open {
    background: linear-gradient(
        120deg,
        rgba(43, 100, 181, .38),
        rgba(38, 128, 190, .28)
    );

    border: 1px solid rgba(100, 180, 255, .48);
    color: #b9deff;

    box-shadow: inset 0 1px rgba(255,255,255,.07);

    transition:
        background .2s ease,
        border-color .2s ease,
        box-shadow .2s ease,
        transform .2s ease;
}

/* Наведение */
#historyModal .history-item-actions .history-open:hover {
    background: linear-gradient(
        120deg,
        rgba(55, 125, 220, .52),
        rgba(44, 150, 208, .42)
    );

    border-color: #78bcff;
    color: #ffffff;

    box-shadow: 0 0 18px rgba(59, 130, 246, .16);
    transform: translateY(-1px);
}

/* Нажатие */
#historyModal .history-item-actions .history-open:active {
    transform: scale(.97);
}
