.quest-overview-panel,
.quest-filters-panel { margin-bottom: 10px; }

.quest-login-notice {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px 14px;
    border: 1px solid #f2d09b;
    border-radius: 6px;
    background: #fff9ed;
    color: #8a4d12;
    text-align: left;
}
.quest-login-notice:hover { background: #fff4dc; }
.quest-login-notice strong,
.quest-login-notice small { display: block; font-weight: 400; }
.quest-login-notice strong { font-size: 14px; color: #713f12; }
.quest-login-notice small { margin-top: 1px; font-size: 12px; color: #a16207; }
.quest-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quest-filter-grid > :first-child,
.quest-filter-grid > :last-child { grid-column: span 2 / span 2; }
.quest-filter-dropdown.is-open { z-index: 12; }
.quest-filter-menu {
    z-index: 2;
    max-height: min(320px, calc(100vh - 180px));
    overscroll-behavior: contain;
}
.quest-filter-menu.is-wide {
    width: 320px;
    max-width: calc(100vw - 2rem);
}
.quest-filter-menu.is-fluid { width: 100%; }
.quest-filter-menu.is-align-left {
    right: auto;
    left: 0;
}
.quest-filter-menu.is-align-right {
    right: 0;
    left: auto;
}
.quest-sort-dropdown { width: 100%; }
.quest-sort-dropdown.is-open { z-index: 12; }
.quest-sort-trigger {
    display: flex;
    width: 100%;
    height: 40px;
    min-width: 0;
    align-items: center;
    gap: 8px;
    padding: 0 10px 0 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #334155;
    font-size: 14px;
    text-align: left;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.quest-sort-trigger:hover { border-color: #cbd5e1; background: #f8fafc; }
.quest-sort-trigger.is-open { border-color: #a855f7; box-shadow: 0 0 0 2px #f3e8ff; }
.quest-sort-current-dir { flex: 0 0 auto; color: #2563eb; font-size: 12px; }
.quest-sort-menu {
    position: absolute;
    right: 0;
    z-index: 2;
    width: 270px;
    max-width: calc(100vw - 2rem);
    max-height: min(370px, calc(100vh - 180px));
    margin-top: 6px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
    overscroll-behavior: contain;
}
.quest-sort-option { display: flex; min-height: 36px; align-items: center; gap: 8px; padding: 4px 5px 4px 8px; border-radius: 5px; color: #334155; font-size: 14px; }
.quest-sort-option:hover { background: #f8fafc; }
.quest-sort-option.is-selected { background: #eff6ff; color: #2563eb; }
.quest-sort-option-icon { display: flex; width: 18px; flex: 0 0 18px; align-items: center; justify-content: center; color: #94a3b8; font-size: 15px; }
.quest-sort-option.is-selected .quest-sort-option-icon { color: #2563eb; }
.quest-sort-option-label { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quest-sort-directions { display: inline-flex; flex: 0 0 auto; overflow: hidden; border: 1px solid #dbe3ec; border-radius: 5px; background: #fff; }
.quest-sort-directions button { width: 32px; height: 26px; color: #64748b; font-size: 12px; transition: background-color .12s ease, color .12s ease; }
.quest-sort-directions button + button { border-left: 1px solid #dbe3ec; }
.quest-sort-directions button:hover { background: #f1f5f9; color: #2563eb; }
.quest-sort-directions button.is-active { background: #2563eb; color: #fff; }
.quest-progress-tabs { display: inline-flex; padding: 3px; border: 1px solid #e2e8f0; border-radius: 6px; background: #f8fafc; }
.quest-progress-tabs button { min-width: 68px; height: 28px; padding: 0 10px; border-radius: 4px; color: #64748b; font-size: 12px; font-weight: 400; }
.quest-progress-tabs button:hover { color: #334155; }
.quest-progress-tabs button.is-active { background: #fff; color: #2563eb; box-shadow: 0 1px 2px rgba(15, 23, 42, .1); }
.quest-progress-help { display: flex; min-width: 300px; min-height: 34px; flex: 0 1 auto; align-items: center; justify-content: center; gap: 7px; padding: 5px 12px; border: 1px solid #bbf7d0; border-radius: 999px; background: #f0fdf4; color: #166534; box-shadow: 0 1px 2px rgba(22, 101, 52, .08); font-size: 12px; font-weight: 500; }
.quest-progress-help > [class*="icon-"] { flex: 0 0 auto; color: #16a34a; font-size: 18px; }
.quest-list-shell { overflow: visible; border: 0; border-radius: 6px; background: #fff; }
.quest-row { border-bottom: 1px solid #edf1f5; color: #334155; font-size: 13px; }
.quest-row:last-of-type { border-bottom: 0; }
.quest-row.is-saving { opacity: .65; }
.quest-row.is-completed .quest-summary { background: #f8fcfa; }
.quest-row.is-completed .quest-name { color: #64748b; text-decoration: line-through; text-decoration-color: #94a3b8; }
.quest-summary { display: flex; min-height: 66px; align-items: center; gap: 12px; padding: 9px 12px; cursor: pointer; transition: background-color .15s ease; }
.quest-summary:hover, .quest-summary:focus-visible { background: #f8fbff; outline: 0; }
.quest-row.is-expanded .quest-summary { background: #f5f9fd; }
.quest-check { position: relative; display: inline-flex; width: 23px; height: 23px; flex: 0 0 23px; align-items: center; justify-content: center; overflow: visible; border: 1px solid #cbd5e1; border-radius: 5px; background: #fff; color: transparent; transition: .15s ease; }
.quest-check:hover { border-color: #22c55e; }
.quest-check.is-checked { border-color: #22c55e; background: #22c55e; color: #fff; }
.quest-check:disabled { cursor: wait; }
.quest-check::after { position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 30; width: max-content; max-width: 220px; padding: 5px 8px; border-radius: 6px; background: #15803d; color: #fff; content: attr(data-progress-tip); font-size: 12px; font-weight: 400; line-height: 18px; opacity: 0; pointer-events: none; transform: translateY(-2px); transition: opacity .12s ease, transform .12s ease; white-space: nowrap; }
.quest-check::before { position: absolute; bottom: calc(100% + 3px); left: 6px; z-index: 31; width: 0; height: 0; border-top: 5px solid #15803d; border-right: 5px solid transparent; border-left: 5px solid transparent; content: ''; opacity: 0; pointer-events: none; transition: opacity .12s ease; }
.quest-check.is-checked::after { background: #b45309; }
.quest-check.is-checked::before { border-top-color: #b45309; }
.quest-check:hover::after, .quest-check:focus-visible::after, .quest-check:hover::before, .quest-check:focus-visible::before { opacity: 1; }
.quest-check:hover::after, .quest-check:focus-visible::after { transform: translateY(0); }
.quest-summary-main { min-width: 260px; flex: 1 1 420px; }
.quest-title-line { display: flex; min-width: 0; align-items: baseline; gap: 8px; }
.quest-name { display: inline-block; width: fit-content; max-width: 100%; overflow: hidden; color: #1e4b78; font-size: 14px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.quest-series { min-width: 0; overflow: hidden; color: #94a3b8; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.quest-subline { display: flex; min-width: 0; flex-wrap: wrap; gap: 3px 8px; margin-top: 4px; color: #94a3b8; font-size: 11px; }
.quest-subline > span { white-space: nowrap; }
.quest-subline span:first-child { flex: 0 0 auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.quest-inline-entity { display: inline-block; width: fit-content; color: #64748b; }
.quest-inline-entity:hover { color: #2563eb; text-decoration: underline; }
.quest-summary-stats { display: flex; flex: 0 1 auto; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.quest-stat { display: inline-flex; height: 24px; align-items: center; gap: 4px; padding: 0 7px; border-radius: 4px; background: #f1f5f9; color: #64748b; font-size: 11px; font-weight: 400; white-space: nowrap; }
.quest-stat-area { background: #ecfdf3; color: #15803d; }
.quest-stat-completed { background: #fff1f2; color: #be123c; }
.quest-stat-exp { background: #f5f3ff; color: #6d4bc3; }
.quest-stat-money { background: #fff7ed; color: #b45309; }
.quest-expand-label { display: inline-flex; height: 26px; align-items: center; gap: 2px; padding-left: 4px; color: #2563eb; font-size: 12px; white-space: nowrap; }
.quest-expand-label [class*="chevron-down"] { transition: transform .15s ease; }
.quest-expand-label .is-rotated { transform: rotate(180deg); }
.quest-details { padding: 16px 46px 18px; border-top: 1px solid #e5ebf1; background: #fbfdff; }
.quest-description { max-width: 1040px; color: #526171; font-size: 13px; line-height: 1.75; }
.quest-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.quest-detail-section { min-width: 0; padding: 12px; border: 1px solid #e2e8f0; border-radius: 6px; background: #fff; }
.quest-detail-section h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 9px; color: #475569; font-size: 13px; font-weight: 500; }
.quest-detail-rewards h3 { color: #9a5b11; }
.quest-detail-entries { display: flex; flex-wrap: wrap; gap: 7px; }
.quest-detail-entry { display: inline-flex; min-height: 30px; max-width: 100%; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 5px; background: #f8fafc; color: #475569; }
.quest-detail-rewards .quest-detail-entry { background: #fff9ed; color: #8a5a18; }
.quest-detail-entry b { flex: 0 0 auto; color: #64748b; font-weight: 400; }
.quest-entry-icon { display: flex; width: 22px; height: 22px; flex: 0 0 22px; align-items: center; justify-content: center; }
.quest-entry-icon img { max-width: 22px; max-height: 22px; object-fit: contain; }
.quest-entry-fallback { flex: 0 0 auto; color: #94a3b8; font-size: 17px; }
.quest-entry-name { display: inline-block; width: fit-content; max-width: 230px; overflow: hidden; color: inherit; text-overflow: ellipsis; white-space: nowrap; }
a.quest-entry-name:hover { color: #2563eb; text-decoration: underline; }
.quest-detail-empty { color: #94a3b8; font-size: 12px; }
.quest-detail-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.quest-entity { display: flex; width: fit-content; max-width: 100%; align-items: center; gap: 7px; color: #475569; }
.quest-entity-icon { display: flex; width: 28px; height: 28px; flex: 0 0 28px; align-items: center; justify-content: center; }
.quest-entity-icon img { width: 28px; height: 28px; object-fit: contain; }
.quest-entity-name { display: inline-block; width: fit-content; max-width: 180px; overflow: hidden; color: #475569; text-overflow: ellipsis; white-space: nowrap; }
.quest-entity-name:hover { color: #2563eb; }
.quest-muted { color: #94a3b8 !important; }
.quest-view-link { display: inline-flex; width: fit-content; align-items: center; color: #2563eb; font-weight: 400; }
.quest-view-link:hover { text-decoration: underline; }
.quest-filter-empty { padding: 32px; color: #94a3b8; text-align: center; font-size: 13px; }

.dark .quest-login-notice { border-color: rgba(245, 158, 11, .25); background: rgba(120, 53, 15, .18); color: #fbbf24; }
.dark .quest-login-notice:hover { background: rgba(120, 53, 15, .25); }
.dark .quest-login-notice strong { color: #fde68a; }
.dark .quest-login-notice small { color: #d6a850; }
.dark .quest-progress-tabs { border-color: #333b46; background: #15191e; }
.dark .quest-progress-tabs button { color: #94a3b8; }
.dark .quest-progress-tabs button.is-active { background: #252c35; color: #7dd3fc; box-shadow: none; }
.dark .quest-progress-help { border-color: rgba(74, 222, 128, .28); background: rgba(22, 101, 52, .2); color: #bbf7d0; box-shadow: none; }
.dark .quest-progress-help > [class*="icon-"] { color: #6ee7b7; }
.dark .quest-sort-trigger { border-color: #333b46; background: #1d2228; color: #e2e8f0; }
.dark .quest-sort-trigger:hover { border-color: #465160; background: #252c35; }
.dark .quest-sort-trigger.is-open { border-color: #c084fc; box-shadow: 0 0 0 2px rgba(168, 85, 247, .15); }
.dark .quest-sort-current-dir { color: #7dd3fc; }
.dark .quest-sort-menu { border-color: #333b46; background: #20252c; box-shadow: 0 12px 28px rgba(0, 0, 0, .35); }
.dark .quest-sort-option { color: #cbd5e1; }
.dark .quest-sort-option:hover { background: #252c35; }
.dark .quest-sort-option.is-selected { background: rgba(14, 165, 233, .12); color: #7dd3fc; }
.dark .quest-sort-option.is-selected .quest-sort-option-icon { color: #7dd3fc; }
.dark .quest-sort-directions { border-color: #3b4552; background: #181c21; }
.dark .quest-sort-directions button { color: #94a3b8; }
.dark .quest-sort-directions button + button { border-color: #3b4552; }
.dark .quest-sort-directions button:hover { background: #303844; color: #7dd3fc; }
.dark .quest-sort-directions button.is-active { background: #0284c7; color: #fff; }
.dark .quest-list-shell { background: #171a1f; }
.dark .quest-row { border-color: #262d35; color: #cbd5e1; }
.dark .quest-summary:hover, .dark .quest-summary:focus-visible, .dark .quest-row.is-expanded .quest-summary { background: #1b232c; }
.dark .quest-row.is-completed .quest-summary { background: #18231f; }
.dark .quest-check { border-color: #4b5563; background: #171a1f; }
.dark .quest-check.is-checked { border-color: #22c55e; background: #22c55e; }
.dark .quest-name { color: #bae6fd; }
.dark .quest-inline-entity, .dark .quest-entity-name { color: #cbd5e1; }
.dark .quest-stat { background: #252c35; color: #aeb9c7; }
.dark .quest-stat-area { background: rgba(34, 197, 94, .1); color: #86efac; }
.dark .quest-stat-completed { background: rgba(244, 63, 94, .1); color: #fda4af; }
.dark .quest-stat-exp { background: rgba(139, 92, 246, .12); color: #c4b5fd; }
.dark .quest-stat-money { background: rgba(245, 158, 11, .1); color: #fcd34d; }
.dark .quest-details { border-color: #2a323c; background: #15191e; }
.dark .quest-description { color: #aeb9c7; }
.dark .quest-detail-section { border-color: #303741; background: #1b2026; }
.dark .quest-detail-section h3 { color: #cbd5e1; }
.dark .quest-detail-rewards h3 { color: #fcd38a; }
.dark .quest-detail-entry { background: #252c35; color: #cbd5e1; }
.dark .quest-detail-rewards .quest-detail-entry { background: rgba(120, 53, 15, .18); color: #fcd38a; }
.dark .quest-view-link { color: #7dd3fc; }

@media (min-width: 1100px) {
    .quest-details { padding-right: 82px; }
}

@media (min-width: 640px) {
    .quest-filter-grid > :last-child { grid-column: span 1 / span 1; }
}

@media (min-width: 768px) {
    .quest-sort-dropdown {
        width: 210px;
        flex: 0 0 210px;
    }
}

@media (min-width: 1024px) {
    .quest-filter-grid {
        grid-template-columns: minmax(280px, 1.4fr) repeat(2, minmax(150px, .7fr));
    }
    .quest-filter-grid > :first-child { grid-column: span 1 / span 1; }
}

@media (min-width: 1280px) {
    .quest-filter-grid {
        grid-template-columns: minmax(260px, 1.35fr) repeat(5, minmax(140px, .7fr));
    }
}

@media (max-width: 767px) {
    .quest-login-notice { align-items: flex-start; }
    .quest-progress-help { width: 100%; min-width: 0; justify-content: flex-start; border-radius: 6px; }
    .quest-summary { align-items: flex-start; flex-wrap: wrap; gap: 9px; padding: 11px 10px; }
    .quest-summary-main { min-width: 0; flex: 1 1 calc(100% - 42px); }
    .quest-summary-stats { width: 100%; padding-left: 35px; justify-content: flex-start; }
    .quest-series { display: none; }
    .quest-stat-completed { order: 4; }
    .quest-expand-label { margin-left: auto; }
    .quest-details { padding: 14px 12px 16px; }
    .quest-detail-grid { grid-template-columns: 1fr; }
    .quest-detail-footer { align-items: flex-start; flex-direction: column; }
}
