@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --motion-fast:.16s;
    --motion-normal:.22s;
    --ease-standard:cubic-bezier(.2,.8,.2,1);
    --bg: #070c18;
    --surface: rgba(15, 21, 38, 0.76);
    --surface-strong: rgba(13, 18, 32, 0.92);
    --line: rgba(255, 255, 255, 0.07);
    --text: #e2e8f0;
    --muted: #64748b;
    --blue: #60a5fa;
    --purple: #a78bfa;
    --green: #34d399;
    --red: #f87171;
    --yellow: #fbbf24;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    background: radial-gradient(ellipse at top, #0d1424 0%, var(--bg) 60%);
    color: var(--text);
    font-family: Inter, Pretendard, "Noto Sans KR", sans-serif;
}
button, input, select { font: inherit; }
button { color: inherit; }

.glass,
.glass-card {
    background: var(--surface);
    backdrop-filter: blur(16px) saturate(150%);
    border: 1px solid var(--line);
}
.glass-card { border-radius: 16px; }
.glow-purple { box-shadow: 0 0 24px rgba(139, 92, 246, 0.14); }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 24px;
    border-radius: 0;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 108px;
    color: inherit;
    text-decoration: none;
}
.brand-mark {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    box-shadow: 0 0 16px rgba(59, 130, 246, .32);
}
.brand-copy {
    display: flex;
    align-items: center;
    min-width: 0;
}
.brand strong {
    display: block;
    color: #f8fafc;
    font-size: 16px;
    font-weight: 750;
    line-height: 1;
    letter-spacing: -0.035em;
    white-space: nowrap;
}
.search-box {
    width: min(400px, 38vw);
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    background: rgba(255,255,255,.04);
}
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-box kbd { color: #334155; font-size: 10px; }
.topbar-spacer { flex: 1; }
.control-select, .icon-button, .profile-button {
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.04);
    border-radius: 9px;
}
.control-select { padding: 7px 12px; color: #94a3b8; }
.icon-button { width: 36px; height: 36px; cursor: pointer; }
.profile-button { display: flex; align-items: center; gap: 9px; padding: 5px 10px; cursor: pointer; }
.profile-avatar { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, #8b5cf6, #3b82f6); }
.profile-copy { text-align: left; }
.profile-copy strong, .profile-copy small { display: block; }
.profile-copy strong { font-size: 12px; }
.profile-copy small { color: #475569; font-size: 10px; }

.body-grid { display: grid; grid-template-columns: 230px minmax(0, 1fr) 300px; min-height: calc(100vh - 60px); }
.left-sidebar { position: relative; overflow: visible; padding: 16px 12px; border-right: 1px solid rgba(255,255,255,.05); }
.main-nav { display: grid; gap: 4px; }
.market-menu { position: relative; display: grid; gap: 4px; }
.market-toggle { justify-content: space-between; }
.market-arrow {
    margin-left: auto;
    transition: transform .2s ease;
}
.market-menu:hover .market-arrow,
.market-menu:focus-within .market-arrow {
    transform: rotate(-90deg);
}

/* Market 메뉴에 마우스를 올리면 오른쪽으로 열리는 플라이아웃 */
.market-item-list {
    position: absolute;
    top: 0;
    left: calc(100% + 10px);
    z-index: 80;

    display: grid;
    width: 250px;
    max-height: min(520px, calc(100vh - 100px));
    gap: 3px;
    padding: 10px;

    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-10px);

    border: 1px solid rgba(255,255,255,.10);
    border-radius: 14px;
    background: rgba(15, 23, 42, .98);
    box-shadow: 0 20px 55px rgba(0,0,0,.42);
    backdrop-filter: blur(18px);

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

    scrollbar-width: none;
}
.market-item-list::-webkit-scrollbar { display: none; }
.market-menu:hover .market-item-list,
.market-menu:focus-within .market-item-list {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
}
.market-item-list .item-button {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 11px;
}
.nav-item, .item-button {
    width: 100%; display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border: 1px solid transparent; border-radius: 10px;
    background: transparent; color: var(--muted); cursor: pointer; text-align: left;
}
.nav-item:hover, .item-button:hover { color: #94a3b8; background: rgba(255,255,255,.04); }
.nav-item.active { color: var(--text); background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.2); }
.pro-badge { margin-left: auto; padding: 2px 6px; border-radius: 4px; background: linear-gradient(135deg,#7c3aed,#4f46e5); color: #e0d9ff; font-size: 9px; font-weight: 700; }
.favorite-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.06); }
.favorite-section h2 { margin: 0 12px 8px; color: #334155; font-size: 10px; letter-spacing: .1em; }
.favorite-list { display: grid; gap: 2px; }
.empty-favorites {
    margin: 0 6px;
    padding: 12px;
    border: 1px dashed rgba(255,255,255,.08);
    border-radius: 10px;
    color: #475569;
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
}
.item-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); flex: 0 0 auto; }
.item-button span:last-child { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main-content { min-width: 0; padding: 20px 20px 40px; display: grid; gap: 16px; }
.item-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 24px; }
.item-identity { display: flex; align-items: center; gap: 12px; }
.item-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg,rgba(59,130,246,.3),rgba(139,92,246,.3)); border: 1px solid rgba(96,165,250,.25); font-size: 22px; }
.item-header h1 { margin: 0 0 5px; font-size: 22px; }
.item-header p { margin: 0; color: #475569; font-size: 12px; }
.headline-price { text-align: right; }
.headline-price strong { display: block; font-size: 30px; letter-spacing: -.04em; }
.headline-price span { display: block; margin-top: 5px; color: var(--muted); font-size: 14px; font-weight: 600; }

.chart-card { padding: 20px 24px; }
.chart-toolbar { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.range-buttons { display: flex; gap: 2px; }
.range-buttons button { padding: 4px 12px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.range-buttons button:hover { color: #94a3b8; background: rgba(255,255,255,.05); }
.range-buttons button.active { color: var(--blue); background: rgba(59,130,246,.15); border-color: rgba(59,130,246,.3); }
.chart-legend { display: flex; gap: 14px; color: var(--muted); font-size: 11px; }
.legend-dot { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; }
.legend-dot.price { background: var(--blue); }
.legend-dot.average { background: var(--purple); }
.event-toggle { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.event-toggle input { display: none; }
.toggle-ui { width: 36px; height: 20px; border-radius: 10px; background: rgba(255,255,255,.08); position: relative; cursor: pointer; }
.toggle-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #475569; transition: .2s; }
.event-toggle input:checked + .toggle-ui { background: rgba(59,130,246,.3); }
.event-toggle input:checked + .toggle-ui::after { left: 19px; background: var(--blue); }
.chart-area { position: relative; height: 340px; }

.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stat-card { padding: 16px 18px; transition: .18s; }
.stat-card:hover { transform: translateY(-1px); border-color: rgba(96,165,250,.2); }
.stat-card span { display: block; color: #475569; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.stat-card strong { display: block; margin: 10px 0 4px; font-size: 19px; color: var(--blue); overflow-wrap: anywhere; }
.stat-card small { color: #475569; font-size: 10px; }

.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-heading h2 { margin: 0; font-size: 13px; color: #94a3b8; }
.section-heading button { border: 0; background: transparent; color: var(--blue); cursor: pointer; }
.event-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.event-card { padding: 16px 18px; }
.event-card-head { display: flex; align-items: center; gap: 8px; }
.event-card small { display: block; margin: 7px 0; color: #475569; }
.event-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }

.right-sidebar { padding: 16px 12px 16px 0; display: flex; flex-direction: column; gap: 14px; }
.ai-card, .portfolio-card, .ad-card { padding: 18px; }
.panel-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-title > div { display: flex; align-items: center; gap: 7px; }
.panel-title small { color: #475569; }
.prediction-box, .portfolio-total { padding: 13px 14px; border-radius: 11px; background: linear-gradient(135deg,rgba(139,92,246,.14),rgba(59,130,246,.1)); border: 1px solid rgba(139,92,246,.18); }
.prediction-box span, .prediction-box strong, .prediction-box small, .portfolio-total span, .portfolio-total strong, .portfolio-total small { display: block; }
.prediction-box span, .portfolio-total span { color: var(--purple); font-size: 11px; }
.prediction-box strong, .portfolio-total strong { margin: 7px 0 4px; font-size: 18px; }
.prediction-box small, .portfolio-total small { color: var(--muted); }
.analysis-row { display: flex; justify-content: space-between; margin-top: 11px; color: var(--muted); font-size: 11px; }
.analysis-row strong { color: #94a3b8; }
.notice { margin: 14px 0 0; padding: 10px 12px; border-radius: 8px; background: rgba(139,92,246,.08); color: var(--muted); font-size: 10px; line-height: 1.5; }
.primary-button { width: 100%; margin-top: 12px; padding: 10px; border: 1px solid rgba(96,165,250,.3); border-radius: 9px; background: rgba(59,130,246,.15); color: var(--blue); cursor: pointer; }
.ad-slot {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 5px;
    border-style: dashed;
    color: #475569;
    text-align: center;
}
.ad-slot span { font-size: 9px; letter-spacing: .12em; }
.ad-slot strong { color: var(--muted); font-size: 12px; }
.ad-slot small { color: #334155; font-size: 10px; }
.sidebar-ad { min-height: 170px; margin-top: 16px; padding: 14px; }
.chart-ad { min-height: 96px; padding: 14px; }
.ad-card { min-height: 170px; display: grid; place-items: center; align-content: center; gap: 6px; color: #475569; border-style: dashed; }
.ad-card span { font-size: 9px; letter-spacing: .12em; }
.ad-card strong { color: var(--muted); }

@media (max-width: 1180px) {
    .body-grid { grid-template-columns: 210px minmax(0,1fr); }
    .right-sidebar { grid-column: 2; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 0 20px 30px; }
    .ad-card { display: none; }
    .stats-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 780px) {
    .search-box, .profile-copy { display: none; }
    .body-grid { display: block; }
    .left-sidebar { border-right: 0; border-bottom: 1px solid rgba(255,255,255,.05); }
    .main-nav { grid-template-columns: repeat(4,1fr); }
    .favorite-section, .sidebar-ad { display: none; }
    .right-sidebar { display: block; padding: 0 14px 24px; }
    .right-sidebar > * { margin-bottom: 12px; }
    .item-header { align-items: flex-start; flex-direction: column; }
    .headline-price { text-align: left; }
    .stats-grid, .event-grid { grid-template-columns: 1fr; }
    .chart-toolbar { align-items: flex-start; flex-wrap: wrap; }
    .event-toggle { margin-left: 0; }
}

/* ===== 월·주·일 차트 기능 확장 ===== */
.legend-line {
    display: inline-block;
    width: 18px;
    height: 2px;
    margin-right: 6px;
    vertical-align: middle;
    border-radius: 999px;
}
.legend-line.price { background: var(--blue); }
.legend-line.average { background: var(--purple); }
.legend-candle {
    display: inline-block;
    width: 8px;
    height: 13px;
    margin-right: 6px;
    vertical-align: middle;
    border-radius: 2px;
}
.legend-candle.up { background: var(--green); }
.legend-candle.down { background: var(--red); }

.chart-event-strip {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    min-height: 34px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,.06);
}
.chart-event-strip[hidden] { display: none; }
.chart-event-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid rgba(96,165,250,.28);
    border-radius: 999px;
    background: rgba(59,130,246,.10);
    color: var(--blue);
    font-size: 10px;
    cursor: default;
}
.chart-event-badge strong { font-size: 10px; font-weight: 600; }
.chart-event-badge span { font-size: 11px; }

/* ===== v5: 비로그인 UX · 화면 전환 · 안정적인 마켓 플라이아웃 ===== */
.brand {
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 0;
    text-align: left;
}
.guest-profile {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 10px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 9px;
    background: rgba(255,255,255,.04);
    color: inherit;
    text-decoration: none;
    transition: border-color .18s ease, background .18s ease;
}
.guest-profile:hover {
    border-color: rgba(96,165,250,.28);
    background: rgba(59,130,246,.08);
}
.profile-avatar.guest { background: linear-gradient(135deg, #334155, #1e293b); }

/* 본문은 사이드바 오른쪽 전체를 하나의 작업 공간으로 사용 */
.body-grid { grid-template-columns: 230px minmax(0, 1fr); }
.workspace { min-width: 0; position: relative; }
.app-view { display: none; min-height: calc(100vh - 60px); }
.app-view.active { display: grid; }
#view-market.active { grid-template-columns: minmax(0, 1fr) 300px; }
.blank-view.active { display: block; }
.calendar-view.active { display: block; padding: 20px; }

/* 클릭 또는 hover 상태 모두에서 메뉴 유지. 사이 틈을 없애 포인터가 이동해도 닫히지 않음 */
.market-menu::after {
    content: "";
    position: absolute;
    top: 0;
    left: 100%;
    width: 18px;
    height: min(520px, calc(100vh - 100px));
    pointer-events: none;
}
.market-menu:hover::after,
.market-menu.open::after { pointer-events: auto; }
.market-item-list {
    left: calc(100% - 2px);
    transform: translateX(-8px);
}
.market-menu:hover .market-item-list,
.market-menu:focus-within .market-item-list,
.market-menu.open .market-item-list {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
}
.market-menu.open .market-arrow,
.market-menu:hover .market-arrow { transform: rotate(90deg); }
.flyout-head {
    display: grid;
    gap: 3px;
    margin: 0 2px 7px;
    padding: 8px 9px 11px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.flyout-head strong { font-size: 12px; color: #cbd5e1; }
.flyout-head small { font-size: 10px; color: #475569; }

.teaser-box strong { line-height: 1.35; }
.feature-list {
    display: grid;
    gap: 8px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
    color: #94a3b8;
    font-size: 11px;
}
.feature-list li { position: relative; padding-left: 16px; }
.feature-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--blue);
    font-weight: 700;
}

/* 달력 */
.calendar-shell { padding: 24px; min-height: calc(100vh - 100px); }
.calendar-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.calendar-toolbar h1 { margin: 5px 0 7px; font-size: 24px; }
.calendar-toolbar p { margin: 0; color: var(--muted); font-size: 12px; }
.eyebrow { color: var(--blue); font-size: 9px; letter-spacing: .14em; }
.calendar-actions { display: flex; align-items: center; gap: 8px; }
.calendar-actions button {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    background: rgba(255,255,255,.04);
    color: #94a3b8;
    cursor: pointer;
}
.calendar-actions button:hover { color: var(--text); background: rgba(59,130,246,.10); }
.calendar-actions strong { min-width: 116px; text-align: center; font-size: 14px; }
.calendar-weekdays,
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays {
    margin-top: 18px;
    color: #475569;
    font-size: 10px;
    text-align: center;
}
.calendar-weekdays span { padding: 8px; }
.calendar-grid {
    margin-top: 4px;
    border-top: 1px solid rgba(255,255,255,.06);
    border-left: 1px solid rgba(255,255,255,.06);
}
.calendar-day {
    position: relative;
    min-height: 112px;
    padding: 10px;
    border-right: 1px solid rgba(255,255,255,.06);
    border-bottom: 1px solid rgba(255,255,255,.06);
    background: rgba(255,255,255,.012);
}
.calendar-day.outside { opacity: .28; }
.calendar-day.today { background: rgba(59,130,246,.07); box-shadow: inset 0 0 0 1px rgba(96,165,250,.22); }
.calendar-date {
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 11px;
}
.calendar-day.today .calendar-date { background: var(--blue); color: #07111f; font-weight: 700; }
.calendar-events { display: grid; gap: 5px; margin-top: 7px; }
.calendar-event {
    overflow: hidden;
    padding: 5px 7px;
    border: 1px solid rgba(96,165,250,.20);
    border-radius: 6px;
    background: rgba(59,130,246,.09);
    color: #93c5fd;
    font-size: 9px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.modal-close { position: absolute; top: 11px; right: 13px; border: 0; background: transparent; color: #64748b; font-size: 23px; cursor: pointer; }
.modal-icon { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 13px; border-radius: 13px; background: linear-gradient(135deg,#7c3aed,#3b82f6); }
.modal-actions { display: grid; gap: 9px; margin-top: 21px; }
.modal-primary { display: grid; place-items: center; margin-top: 0; text-decoration: none; }
.secondary-button { width: 100%; padding: 10px; border: 1px solid rgba(255,255,255,.08); border-radius: 9px; background: rgba(255,255,255,.03); color: #94a3b8; cursor: pointer; }

@media (max-width: 1180px) {
    #view-market.active { grid-template-columns: minmax(0, 1fr); }
    #view-market .right-sidebar { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 0 20px 30px; }
}
@media (max-width: 780px) {
    .workspace { display: block; }
    #view-market.active { display: block; }
    .calendar-view.active { padding: 14px; }
    .calendar-toolbar { align-items: flex-start; flex-direction: column; }
    .calendar-actions { flex-wrap: wrap; }
    .calendar-day { min-height: 78px; padding: 6px; }
    .calendar-event { font-size: 8px; padding: 3px 4px; }
}

/* v5 flyout final behavior: click to open/close; stable while moving pointer */
.market-menu:hover .market-item-list,
.market-menu:focus-within .market-item-list {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-8px);
}
.market-menu.open .market-item-list {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
}
.market-menu:hover .market-arrow,
.market-menu:focus-within .market-arrow { transform: none; }
.market-menu.open .market-arrow { transform: rotate(90deg); }

/* =========================================================
   v6: 상단 지정 아이템 자동완성 · 메뉴 순서 · 캘린더 2열 구성
========================================================= */
.search-box-wrap {
    position: relative;
    width: min(400px, 38vw);
    flex: 0 1 auto;
}
.search-box-wrap .search-box { width: 100%; }
.item-autocomplete {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 150;
    width: 100%;
    max-height: 330px;
    padding: 7px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 12px;
    background: rgba(11, 17, 31, .98);
    box-shadow: 0 20px 55px rgba(0,0,0,.46);
    backdrop-filter: blur(18px);
    scrollbar-width: none;
}
.item-autocomplete[hidden] { display: none; }
.item-autocomplete::-webkit-scrollbar { display: none; }
.autocomplete-option {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    text-align: left;
}
.autocomplete-option:hover,
.autocomplete-option:focus-visible {
    border-color: rgba(96,165,250,.18);
    background: rgba(59,130,246,.10);
    color: #e2e8f0;
    outline: none;
}
.autocomplete-empty {
    padding: 14px 12px;
    color: #64748b;
    font-size: 11px;
    line-height: 1.55;
}

/* 플라이아웃은 선택만 담당하며 검색 UI를 포함하지 않는다. */
.flyout-head { margin-bottom: 5px; }

/* 각 PRO 배지가 메뉴/패널 제목의 오른쪽에 자연스럽게 정렬되도록 한다. */
.nav-item .pro-badge { margin-left: auto; }
.panel-title > div {
    display: flex;
    align-items: center;
    gap: 8px;
}
.panel-title > div .pro-badge { margin-left: 0; }

/* 이벤트 캘린더도 마켓과 동일하게 중앙 콘텐츠 + 우측 패널 구조를 사용한다. */
#view-events.active {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    padding: 0;
}
.calendar-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
}
.calendar-shell {
    min-height: auto;
    padding: 24px;
}
.calendar-ad {
    min-height: 104px;
}
.event-right-sidebar {
    align-self: stretch;
}

@media (max-width: 1180px) {
    #view-events.active { grid-template-columns: minmax(0, 1fr); }
    #view-events .right-sidebar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 0 20px 30px;
    }
    #view-events .right-sidebar .ad-card { grid-column: 1 / -1; }
}

@media (max-width: 780px) {
    .search-box-wrap { width: 100%; }
    #view-events.active { display: block; }
    .calendar-main { padding: 14px; }
    #view-events .right-sidebar { display: block; padding: 0 14px 24px; }
    #view-events .right-sidebar > * { margin-bottom: 12px; }
}

/* =========================================================
   v7: 검색 결과 지연 노출 · 아이템 차트 카테고리 메뉴
========================================================= */

/* 빈 검색창을 눌렀을 때는 결과 패널을 표시하지 않는다. */
.item-autocomplete:empty,
.item-autocomplete[hidden] {
    display: none;
}

.market-menu {
    position: relative;
}

.market-toggle .market-arrow {
    margin-left: auto;
    transition: transform .2s ease;
}
.market-menu.open .market-toggle .market-arrow {
    transform: rotate(180deg);
}

/* 아이템 차트 아래에 나타나는 1차 카테고리 메뉴 */
.market-category-list {
    display: grid;
    gap: 3px;
    max-height: 0;
    margin: 0 5px;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height .24s ease, opacity .18s ease, padding .24s ease;
}
.market-menu.open .market-category-list {
    max-height: 150px;
    padding: 6px 0 4px 12px;
    opacity: 1;
}
.market-category-list[aria-hidden="true"] {
    pointer-events: none;
}
.market-menu.open .market-category-list[aria-hidden="false"] {
    pointer-events: auto;
}

.market-category {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-size: 11px;
    cursor: pointer;
    text-align: left;
    transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.market-category:hover,
.market-category:focus-visible,
.market-category.active {
    border-color: rgba(96,165,250,.16);
    background: rgba(59,130,246,.09);
    color: #cbd5e1;
    outline: none;
}
.market-category span:last-child {
    color: #475569;
    font-size: 16px;
    transition: transform .18s ease, color .18s ease;
}
.market-category.active span:last-child {
    transform: translateX(2px);
    color: var(--blue);
}

/* 2차 아이템 패널: 카테고리 위에 포인터를 올리면 오른쪽에 안정적으로 노출 */
.market-item-flyout {
    position: absolute;
    top: 0;
    left: calc(100% - 1px);
    z-index: 90;
    width: 250px;
    max-height: min(520px, calc(100vh - 86px));
    padding: 9px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 12px;
    background: rgba(9, 16, 29, .985);
    box-shadow: 18px 22px 55px rgba(0,0,0,.42);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-8px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
    scrollbar-width: none;
}
.market-item-flyout::-webkit-scrollbar { display: none; }
.market-menu.category-open .market-item-flyout {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
}

/* 사이드바와 플라이아웃 사이의 포인터 이동 안전 구간 */
.market-menu.category-open::after {
    content: "";
    position: absolute;
    top: 0;
    left: calc(100% - 8px);
    width: 18px;
    height: 100%;
    pointer-events: auto;
}

.category-panel {
    display: none;
}
.category-panel.active {
    display: grid;
    gap: 3px;
}
.category-panel .item-button {
    min-height: 38px;
    padding: 8px 10px;
}
.category-panel .item-button.selected {
    border-color: rgba(96,165,250,.22);
    background: rgba(59,130,246,.12);
    color: #e2e8f0;
}
.maple-point-dot {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245,158,11,.10);
}

@media (max-width: 780px) {
    .market-item-flyout {
        position: static;
        width: auto;
        max-height: 280px;
        margin: 5px 0 0 12px;
        transform: translateY(-5px);
    }
    .market-menu.category-open .market-item-flyout {
        transform: translateY(0);
    }
    .market-menu.category-open::after { display: none; }
}

/* ===== 이벤트 캘린더 v8: 전체 이벤트·툴팁·진행 예정 ===== */
.calendar-grid {
    align-items: stretch;
}

.calendar-day {
    min-height: 128px;
    height: auto;
}

.calendar-events {
    align-content: start;
    gap: 5px;
}

.calendar-event {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    min-width: 0;
    padding: 5px 7px;
    border: 1px solid rgba(96,165,250,.20);
    border-radius: 7px;
    background: rgba(59,130,246,.09);
    color: #bfdbfe;
    font: inherit;
    font-size: 9px;
    text-align: left;
    cursor: default;
    transition: transform .14s ease, border-color .14s ease, background .14s ease;
}

.calendar-event:hover,
.calendar-event:focus-visible {
    z-index: 2;
    border-color: rgba(125,211,252,.42);
    background: rgba(59,130,246,.16);
    transform: translateY(-1px);
    outline: none;
}

.calendar-event-emoji {
    flex: 0 0 auto;
    font-size: 10px;
    line-height: 1;
}

.calendar-event-name {
    overflow: hidden;
    min-width: 0;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.calendar-event-progression,
.calendar-event-growth { border-color: rgba(249,115,22,.24); background: rgba(249,115,22,.09); color: #fdba74; }
.calendar-event-enhancement { border-color: rgba(234,179,8,.24); background: rgba(234,179,8,.09); color: #fde047; }
.calendar-event-boss { border-color: rgba(239,68,68,.24); background: rgba(239,68,68,.09); color: #fca5a5; }
.calendar-event-reward,
.calendar-event-compensation { border-color: rgba(34,197,94,.24); background: rgba(34,197,94,.09); color: #86efac; }
.calendar-event-system,
.calendar-event-patch { border-color: rgba(168,85,247,.24); background: rgba(168,85,247,.09); color: #d8b4fe; }

.calendar-event-tooltip {
    position: fixed;
    z-index: 500;
    display: grid;
    gap: 5px;
    width: max-content;
    max-width: min(280px, calc(100vw - 20px));
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 10px;
    background: rgba(7, 13, 24, .97);
    box-shadow: 0 14px 38px rgba(0,0,0,.42);
    color: #e2e8f0;
    pointer-events: none;
    backdrop-filter: blur(12px);
}

.calendar-event-tooltip[hidden] { display: none; }
.calendar-event-tooltip strong { font-size: 12px; font-weight: 700; }
.calendar-event-tooltip span { color: #94a3b8; font-size: 10px; }

.upcoming-events-shell {
    margin-top: 16px;
    padding: 20px 22px;
}

.upcoming-events-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.upcoming-events-header h2 {
    margin: 5px 0 0;
    font-size: 17px;
}

.upcoming-events-count {
    padding: 5px 9px;
    border: 1px solid rgba(96,165,250,.18);
    border-radius: 999px;
    background: rgba(59,130,246,.08);
    color: #93c5fd;
    font-size: 10px;
}

.upcoming-events-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-top: 14px;
}

.upcoming-event-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid rgba(255,255,255,.065);
    border-radius: 10px;
    background: rgba(255,255,255,.022);
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.upcoming-event-item:hover {
    border-color: rgba(96,165,250,.20);
    background: rgba(59,130,246,.055);
    transform: translateY(-1px);
}

.upcoming-event-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(255,255,255,.045);
    font-size: 15px;
}

.upcoming-event-content {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.upcoming-event-content strong {
    overflow: hidden;
    color: #dbeafe;
    font-size: 11px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.upcoming-event-content span {
    color: #64748b;
    font-size: 9px;
}

.upcoming-event-dday {
    padding: 5px 8px;
    border-radius: 7px;
    background: rgba(99,102,241,.10);
    color: #a5b4fc;
    font-size: 10px;
    font-weight: 700;
}

.upcoming-events-empty {
    grid-column: 1 / -1;
    padding: 18px;
    border: 1px dashed rgba(255,255,255,.08);
    border-radius: 10px;
    color: #64748b;
    font-size: 11px;
    text-align: center;
}

@media (max-width: 900px) {
    .upcoming-events-list { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
    .calendar-day { min-height: 92px; }
    .calendar-event { padding: 4px 5px; }
    .calendar-event-name { max-width: 72px; }
    .upcoming-events-shell { padding: 16px; }
}

/* ===== Chart hover tooltip & grouped emoji event markers ===== */
.chart-area {
    position: relative;
    overflow: visible;
}

.chart-external-tooltip {
    position: absolute;
    z-index: 30;
    width: max-content;
    min-width: 150px;
    max-width: min(300px, calc(100vw - 32px));
    padding: 12px 14px;
    border: 1px solid rgba(96, 165, 250, .28);
    border-radius: 11px;
    background: rgba(9, 16, 31, .97);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .42);
    color: #e2e8f0;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity .12s ease, transform .12s ease, visibility .12s ease;
    backdrop-filter: blur(14px);
}

.chart-external-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chart-tooltip-date {
    margin-bottom: 9px;
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
}

.chart-tooltip-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    min-height: 24px;
    font-size: 11px;
}

.chart-tooltip-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
}

.chart-tooltip-label i {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--dot, #60a5fa);
}

.chart-tooltip-row strong {
    color: #e2e8f0;
    font-size: 12px;
}

.chart-tooltip-divider {
    height: 1px;
    margin: 9px 0;
    background: rgba(255, 255, 255, .07);
}

.chart-tooltip-events {
    display: grid;
    gap: 8px;
}

.chart-tooltip-event {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: start;
    gap: 7px;
}

.chart-tooltip-event > span {
    font-size: 16px;
    line-height: 1.2;
    text-align: center;
}

.chart-tooltip-event strong,
.chart-tooltip-event small {
    display: block;
}

.chart-tooltip-event strong {
    color: #e2e8f0;
    font-size: 11px;
    line-height: 1.35;
}

.chart-tooltip-event small {
    margin-top: 2px;
    color: #64748b;
    font-size: 9px;
    line-height: 1.35;
}


/* ===== 전체 기간 차트 · 가로 스크롤 ===== */
.chart-area {
    position: relative;
    height: 360px;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(96, 165, 250, .55) rgba(255, 255, 255, .045);
    overscroll-behavior-x: contain;
}

.chart-scroll-stage {
    position: relative;
    height: 340px;
}

.chart-scroll-stage > canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.chart-area::-webkit-scrollbar {
    height: 9px;
}

.chart-area::-webkit-scrollbar-track {
    margin: 0 6px;
    border: 1px solid rgba(255, 255, 255, .04);
    border-radius: 999px;
    background: rgba(255, 255, 255, .035);
}

.chart-area::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(59, 130, 246, .72), rgba(139, 92, 246, .72));
    background-clip: padding-box;
}

.chart-area::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, rgba(96, 165, 250, .92), rgba(167, 139, 250, .92));
    background-clip: padding-box;
}

@media (max-width: 780px) {
    .chart-area { height: 340px; }
    .chart-scroll-stage { height: 320px; }
}

/* ===== 배포용 반응형 안정화 · 이벤트 마커 정돈 ===== */
.chart-card,
.chart-area,
.chart-scroll-stage,
.main-content,
.workspace,
.app-view {
    min-width: 0;
}

.chart-event-badge > span {
    font-size: 10px;
    line-height: 1;
}

.chart-external-tooltip {
    max-height: min(340px, calc(100vh - 32px));
    overflow-y: auto;
}

@media (max-width: 1280px) {
    .topbar {
        gap: 12px;
        padding-inline: 16px;
    }
    .search-box { width: min(330px, 32vw); }
    .body-grid { grid-template-columns: 210px minmax(0, 1fr); }
    .main-content { padding: 18px 16px 34px; }
    .chart-card { padding: 18px; }
    .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
    .topbar {
        height: auto;
        min-height: 60px;
        flex-wrap: wrap;
        padding-block: 10px;
    }
    .search-box-wrap {
        order: 3;
        flex: 1 0 100%;
    }
    .search-box { width: 100%; }
    .topbar-spacer { display: none; }
    .body-grid { display: block; }
    .left-sidebar {
        position: relative;
        z-index: 12;
        padding: 10px 12px;
        border-right: 0;
        border-bottom: 1px solid rgba(255,255,255,.06);
    }
    .main-nav {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .main-nav::-webkit-scrollbar { display: none; }
    .main-nav > * { flex: 0 0 auto; }
    .nav-item,
    .market-toggle { width: auto; white-space: nowrap; }
    .favorite-section,
    .sidebar-ad { display: none; }
    #view-market.active,
    #view-events.active { display: block; }
    #view-market .right-sidebar,
    #view-events .right-sidebar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 0 16px 28px;
    }
    .market-category-list,
    .market-item-flyout {
        position: fixed;
        top: 112px;
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
        max-height: calc(100vh - 132px);
    }
    .market-item-flyout { left: min(270px, 32vw); }
    .chart-toolbar { flex-wrap: wrap; }
    .event-toggle { margin-left: auto; }
}

@media (max-width: 720px) {
    .topbar { padding-inline: 12px; }
    .icon-button,
    .profile-copy { display: none; }
    .control-select { margin-left: auto; max-width: 145px; }
    .main-content,
    .calendar-main { padding: 12px; }
    .item-header {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
        padding: 16px;
    }
    .headline-price { text-align: left; }
    .headline-price strong { font-size: clamp(23px, 7vw, 30px); }
    .chart-card { padding: 14px 12px 12px; }
    .chart-toolbar { gap: 10px; margin-bottom: 12px; }
    .chart-legend { order: 3; flex: 1 0 100%; overflow-x: auto; }
    .event-toggle { margin-left: 0; }
    .chart-area { height: 320px; }
    .chart-scroll-stage { height: 300px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .stat-card { padding: 13px 14px; }
    .event-grid { grid-template-columns: 1fr; }
    #view-market .right-sidebar,
    #view-events .right-sidebar {
        display: block;
        padding: 0 12px 22px;
    }
    #view-market .right-sidebar > *,
    #view-events .right-sidebar > * { margin-bottom: 10px; }
    .chart-external-tooltip {
        min-width: 142px;
        max-width: min(260px, calc(100vw - 24px));
        padding: 10px 11px;
    }
    .chart-tooltip-row { gap: 14px; }
    .chart-tooltip-event > span { font-size: 14px; }
    .market-category-list,
    .market-item-flyout {
        top: 106px;
        left: 8px;
        right: 8px;
        max-height: calc(100vh - 118px);
    }
    .market-item-flyout { left: 8px; top: 160px; }
}

@media (max-width: 440px) {
    .brand { min-width: auto; }
    .brand strong { font-size: 15px; }
    .control-select { max-width: 122px; padding-inline: 8px; }
    .range-buttons button { padding-inline: 9px; }
    .stats-grid { grid-template-columns: 1fr; }
    .chart-area { height: 300px; }
    .chart-scroll-stage { height: 280px; }
    .chart-event-strip { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
    .chart-event-badge { flex: 0 0 auto; }
}


/* =========================================================
   Market navigation redesign
   Primary sidebar + secondary side panel + main workspace
   ========================================================= */

:root {
    --topbar-height: 60px;
    --primary-sidebar-width: 230px;
    --secondary-panel-width: 260px;
}

.body-grid {
    display: grid !important;
    grid-template-columns:
        var(--primary-sidebar-width)
        minmax(0, 1fr) !important;
    align-items: start;
    min-width: 0;
}

.left-sidebar {
    position: sticky !important;
    top: var(--topbar-height) !important;
    z-index: 18;
    height: calc(100dvh - var(--topbar-height));
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: rgba(7, 12, 24, .92);
    backdrop-filter: blur(18px);
}

.workspace {
    grid-column: 2;
    min-width: 0;
}

.market-secondary-panel {
    position: fixed;
    z-index: 120;
    top: var(--topbar-height);
    bottom: 0;
    left: var(--primary-sidebar-width);
    width: var(--secondary-panel-width);
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    min-width: 0;
    padding: 16px 12px 18px;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, .08);
    background: rgba(9, 16, 29, .985);
    box-shadow: 18px 0 48px rgba(0, 0, 0, .28);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-14px);
    transition:
        opacity .18s ease,
        transform .2s ease,
        visibility .18s ease;
}

.market-secondary-panel.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
}

.market-secondary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 2px 5px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.market-secondary-head small,
.market-secondary-head strong {
    display: block;
}

.market-secondary-head small {
    margin-bottom: 5px;
    color: #60a5fa;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .14em;
}

.market-secondary-head strong {
    color: #e2e8f0;
    font-size: 14px;
}

.market-secondary-close {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 9px;
    color: #7f8da3;
    background: rgba(255, 255, 255, .025);
    cursor: pointer;
    font-size: 20px;
}

.market-secondary-close:hover,
.market-secondary-close:focus-visible {
    color: #ffffff;
    border-color: rgba(96, 165, 250, .28);
    background: rgba(59, 130, 246, .09);
}

.market-category-list {
    display: grid !important;
    gap: 5px !important;
    max-height: none !important;
    margin: 12px 0 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    opacity: 1 !important;
}

.market-category {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid rgba(255, 255, 255, .055);
    border-radius: 9px;
    background: rgba(255, 255, 255, .018);
    color: #7f8da3;
}

.market-category:hover,
.market-category:focus-visible,
.market-category.active {
    border-color: rgba(96, 165, 250, .22);
    background: rgba(59, 130, 246, .10);
    color: #dbeafe;
}

.market-category span:last-child {
    transform: none !important;
    transition: transform .18s ease, color .18s ease;
}

.market-category.active span:last-child {
    transform: rotate(180deg) !important;
    color: #60a5fa;
}

.market-item-list-panel {
    min-height: 0;
    margin-top: 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(96, 165, 250, .24) transparent;
}

.market-item-list-panel::-webkit-scrollbar {
    width: 5px;
}

.market-item-list-panel::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(96, 165, 250, .22);
}

.market-item-list-panel .category-panel {
    display: none;
}

.market-item-list-panel .category-panel.active {
    display: grid;
    gap: 4px;
    animation: market-panel-in .18s ease both;
}

.market-item-list-panel .flyout-head {
    position: sticky;
    top: 0;
    z-index: 2;
    margin-bottom: 6px;
    padding: 10px 8px 9px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    background: rgba(9, 16, 29, .97);
}

.market-item-list-panel .flyout-head strong,
.market-item-list-panel .flyout-head small {
    display: block;
}

.market-item-list-panel .flyout-head strong {
    color: #dbeafe;
    font-size: 12px;
}

.market-item-list-panel .flyout-head small {
    margin-top: 4px;
    color: #52617a;
    font-size: 9px;
}

.market-item-list-panel .item-button {
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
}

.market-item-list-panel .item-button:hover,
.market-item-list-panel .item-button:focus-visible,
.market-item-list-panel .item-button.selected {
    border-color: rgba(96, 165, 250, .18);
    background: rgba(59, 130, 246, .09);
}

@keyframes market-panel-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Medium desktop: keep the main workspace visible and usable. */
@media (max-width: 1260px) {
    :root {
        --primary-sidebar-width: 190px;
        --secondary-panel-width: 230px;
    }

    .body-grid {
        grid-template-columns:
            var(--primary-sidebar-width)
            minmax(0, 1fr) !important;
    }

    #view-market.active {
        display: block !important;
    }

    #view-market .right-sidebar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 0 14px 28px;
    }

    #view-market .right-sidebar .ad-card {
        display: none;
    }
}

/* Compact desktop/tablet: secondary panel becomes a controlled drawer.
   The main screen remains rendered behind it instead of disappearing. */
@media (max-width: 920px) {
    :root {
        --topbar-height: 108px;
        --primary-sidebar-width: 0px;
        --secondary-panel-width: min(310px, calc(100vw - 24px));
    }

    .body-grid {
        display: block !important;
    }

    .left-sidebar {
        position: sticky !important;
        top: var(--topbar-height) !important;
        z-index: 65;
        width: 100%;
        height: auto;
        padding: 7px 9px;
        overflow: visible;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, .06);
    }

    .main-nav {
        display: flex !important;
        gap: 5px;
        overflow-x: auto !important;
        overflow-y: hidden;
        scrollbar-width: none;
    }

    .main-nav::-webkit-scrollbar {
        display: none;
    }

    .main-nav > *,
    .nav-item,
    .market-toggle {
        flex: 0 0 auto;
        width: auto !important;
        white-space: nowrap;
    }

    .workspace {
        grid-column: auto;
        display: block !important;
        min-height: 0;
    }

    .market-secondary-panel {
        top: calc(var(--topbar-height) + 52px);
        bottom: 12px;
        left: 12px;
        width: var(--secondary-panel-width);
        border: 1px solid rgba(96, 165, 250, .16);
        border-radius: 14px;
        box-shadow: 0 22px 60px rgba(0, 0, 0, .46);
    }

    #view-market .right-sidebar {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    :root {
        --secondary-panel-width: calc(100vw - 16px);
    }

    .market-secondary-panel {
        top: calc(var(--topbar-height) + 50px);
        right: 8px;
        bottom: 8px;
        left: 8px;
        width: auto;
        padding-inline: 10px;
    }

    .market-secondary-head {
        padding-inline: 3px;
    }

    .market-category {
        min-height: 44px;
    }

    .market-item-list-panel .item-button {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .market-secondary-panel,
    .market-item-list-panel .category-panel {
        animation: none !important;
        transition: none !important;
    }
}


/* Legacy menu neutralizer */
.market-menu::after,
.market-item-flyout {
    display: none !important;
}


/* unified animation system */
.nav-item,
.item-button,
.favorite-toggle,
.market-category{
 transition:
   background var(--motion-fast) var(--ease-standard),
   color var(--motion-fast) var(--ease-standard),
   border-color var(--motion-fast) var(--ease-standard);
}

.chart-area,
.event-grid,
.favorite-list{
 contain:layout paint;
}


/* =========================================================
   Event impact analysis
   ========================================================= */

.event-impact-card {
    display: grid;
    gap: 8px;
}

.event-impact-card .event-card-head {
    min-width: 0;
}

.event-impact-card .event-card-head > strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-impact-badge {
    flex: 0 0 auto;
    margin-left: auto;
    padding: 4px 7px;
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 999px;
    color: #94a3b8;
    background: rgba(148, 163, 184, .07);
    font-size: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.event-impact-badge.up {
    border-color: rgba(52, 211, 153, .22);
    color: #6ee7b7;
    background: rgba(5, 150, 105, .09);
}

.event-impact-badge.down {
    border-color: rgba(248, 113, 113, .22);
    color: #fca5a5;
    background: rgba(220, 38, 38, .09);
}

.event-impact-prices {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, .055);
    border-radius: 10px;
    background: rgba(2, 6, 23, .22);
}

.event-impact-prices > span {
    min-width: 0;
    color: #64748b;
    font-size: 10px;
    line-height: 1.45;
}

.event-impact-prices > span[aria-hidden="true"] {
    color: #475569;
    font-size: 13px;
}

.event-impact-prices strong {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: #cbd5e1;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .event-impact-prices {
        grid-template-columns: 1fr;
    }

    .event-impact-prices > span[aria-hidden="true"] {
        display: none;
    }
}


/* =========================================================
   Mobile market component polish — final override
   ========================================================= */
@media (max-width: 640px) {
    .glass-card { border-radius: 14px; }
    .item-header { min-height: 0; }

    .item-icon {
        flex: 0 0 auto;
        width: 48px;
        height: 48px;
        border-radius: 13px;
    }

    .favorite-icon {
        width: 20px;
        height: 20px;
    }

    .favorite-toggle {
        width: 30px !important;
        height: 30px !important;
        border-radius: 7px !important;
    }

    .range-buttons button {
        min-width: 40px;
        padding: 7px 11px !important;
    }

    .event-toggle { font-size: 10px !important; }

    .toggle-ui {
        width: 34px;
        height: 19px;
    }

    .toggle-ui::after {
        width: 13px;
        height: 13px;
    }

    .event-toggle input:checked + .toggle-ui::after {
        left: 18px;
    }
}


/* =========================================================
   Mechart home dashboard — polished production UI
   ========================================================= */

body.mechart-home .topbar .search-box-wrap {
    display: none !important;
}

body.mechart-home #view-market .main-content > :not(.home-dashboard) {
    display: none !important;
}

body:not(.mechart-home) .home-dashboard {
    display: none !important;
}

body.mechart-home .market-toggle.active,
body.mechart-home .nav-item.active {
    color: var(--muted) !important;
    border-color: transparent !important;
    background: transparent !important;
}

.home-dashboard {
    display: grid;
    gap: 16px;
    width: 100%;
    max-width: 1180px;
    margin-inline: auto;
    padding: 6px 0 28px;
}

.home-search-card,
.home-summary-card,
.home-trend-card {
    padding: 24px;
}

.home-search-inner {
    position: relative;
    width: min(700px, 100%);
    margin-inline: auto;
}

.home-search-field {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 54px;
    padding: 0 18px;
    border: 1px solid rgba(96, 165, 250, .20);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.015));
    box-shadow: inset 0 1px rgba(255,255,255,.02);
}

.home-search-field:focus-within {
    border-color: rgba(96, 165, 250, .45);
    box-shadow:
        0 0 0 3px rgba(59, 130, 246, .08),
        inset 0 1px rgba(255,255,255,.03);
}

.home-search-icon {
    color: #64748b;
    font-size: 18px;
}

.home-search-field input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
    font-size: 15px;
}

.home-search-field input::placeholder {
    color: #475569;
}

.home-item-autocomplete {
    position: absolute;
    top: 62px;
    right: 0;
    left: 0;
    z-index: 260;
    display: grid;
    max-height: 310px;
    padding: 7px;
    overflow-y: auto;
    border: 1px solid rgba(96,165,250,.20);
    border-radius: 12px;
    background: rgba(9,16,29,.99);
    box-shadow: 0 20px 50px rgba(0,0,0,.42);
}

.home-item-autocomplete[hidden] {
    display: none !important;
}

.home-autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 9px 11px;
    border: 0;
    border-radius: 8px;
    color: #94a3b8;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.home-autocomplete-item::before {
    width: 6px;
    height: 6px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--blue);
    content: "";
}

.home-autocomplete-item:hover,
.home-autocomplete-item.active,
.home-autocomplete-item:focus-visible {
    color: #dbeafe;
    outline: 0;
    background: rgba(59,130,246,.11);
}

.home-autocomplete-empty {
    padding: 14px;
    color: #64748b;
    font-size: 12px;
    text-align: center;
}

.home-popular {
    display: grid;
    gap: 11px;
    margin-top: 20px;
}

.home-popular-label {
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-align: center;
}

.home-popular-list {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.home-popular-list span,
.home-popular-list button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid rgba(96,165,250,.10);
    border-radius: 999px;
    color: #a6b3c7;
    background: rgba(59,130,246,.055);
    cursor: default;
    user-select: none;
}

.home-popular-list button {
    appearance: none;
    font: inherit;
    cursor: pointer;
}

.home-popular-list button:hover {
    opacity: .82;
}

.home-popular-list i {
    display: inline-grid;
    place-items: center;
    min-width: 21px;
    height: 21px;
    padding-inline: 5px;
    border-radius: 999px;
    color: #7dd3fc;
    background: rgba(56,189,248,.08);
    font-size: 9px;
    font-style: normal;
    font-weight: 700;
}

.home-summary-card {
    display: grid;
    gap: 18px;
}

.home-summary-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 46px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.home-summary-heading small {
    display: block;
    margin-bottom: 4px;
    color: #475569;
    font-size: 10px;
}

.home-summary-heading h2 {
    margin: 0;
    color: #dbe4f0;
    font-size: 16px;
}

.home-summary-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border: 1px solid rgba(52,211,153,.18);
    border-radius: 999px;
    color: #6ee7b7;
    background: rgba(52,211,153,.07);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .08em;
}

.home-summary-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 12px;
    margin: 0;
}

.home-metric-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 118px;
    padding: 18px;
    border: 1px solid rgba(255,255,255,.055);
    border-radius: 13px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.021), rgba(255,255,255,.012));
}

.home-metric-card > div {
    display: grid;
    gap: 11px;
    min-width: 0;
}

.home-metric-card dt {
    color: #64748b;
    font-size: 11px;
}

.home-metric-card dd {
    margin: 0;
    color: #dbeafe;
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.home-metric-card dd.positive,
.home-ranking-list .positive {
    color: var(--green);
}

.home-metric-card dd.negative,
.home-ranking-list .negative {
    color: var(--red);
}

.home-metric-icon {
    display: inline-grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 50%;
    font-size: 22px;
    font-weight: 700;
}

.icon-items {
    color: #60a5fa;
    background: rgba(59,130,246,.12);
}

.icon-rise {
    color: #34d399;
    background: rgba(52,211,153,.11);
}

.icon-fall {
    color: #f87171;
    background: rgba(248,113,113,.11);
}

.home-trend-card {
    display: grid;
    gap: 16px;
}

.home-trend-head {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    min-height: 44px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.home-summary-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.home-summary-tab {
    min-width: 68px;
    height: 40px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
}

.home-summary-tab:hover {
    color: #aebbd0;
    background: rgba(255,255,255,.035);
}

.home-summary-tab.active {
    color: #e8eff8;
    border-color: rgba(59,130,246,.20);
    background: rgba(59,130,246,.12);
}

.home-summary-tab:focus-visible {
    outline: 2px solid rgba(96,165,250,.85);
    outline-offset: 2px;
}

.home-trend-body {
    min-height: 246px;
}

.home-summary-panel {
    min-height: 246px;
}

.home-summary-panel[hidden] {
    display: none !important;
}

.home-ranking-list {
    display: grid;
    grid-template-rows: repeat(5, 44px);
    gap: 7px;
    min-height: 248px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: home-rank;
}

.home-ranking-list li {
    counter-increment: home-rank;
    display: grid;
    grid-template-columns: 28px 38px minmax(0,1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 13px;
    border: 1px solid rgba(255,255,255,.05);
    border-radius: 10px;
    color: #a4b0c3;
    background: rgba(255,255,255,.017);
}

.home-ranking-list li::before {
    content: counter(home-rank);
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.home-ranking-list li::after {
    content: "";
    grid-column: 2;
    grid-row: 1;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(96,165,250,.12);
    border-radius: 9px;
    background:
        linear-gradient(135deg, rgba(59,130,246,.12), rgba(139,92,246,.10));
}

.home-ranking-list li span {
    grid-column: 3;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-ranking-list strong {
    grid-column: 4;
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}

.home-ranking-empty {
    grid-template-columns: 1fr !important;
    grid-row: 1 / -1;
    place-items: center;
    color: #475569 !important;
}

.home-ranking-empty::before,
.home-ranking-empty::after {
    display: none !important;
}

@media (max-width: 960px) {
    body.mechart-home .topbar {
        grid-template-rows: auto !important;
        min-height: 60px !important;
    }

    body.mechart-home .topbar .search-box-wrap {
        display: none !important;
    }

    body.mechart-home .left-sidebar {
        top: 60px !important;
    }
}

@media (max-width: 720px) {
    .home-search-card,
    .home-summary-card,
    .home-trend-card {
        padding: 18px;
    }

    .home-summary-metrics {
        grid-template-columns: 1fr;
    }

    .home-metric-card {
        min-height: 84px;
    }
}

@media (max-width: 480px) {
    .home-dashboard {
        gap: 12px;
        padding-bottom: 16px;
    }

    .home-search-card,
    .home-summary-card,
    .home-trend-card {
        padding: 15px;
    }

    .home-popular-list {
        gap: 6px;
    }

    .home-popular-list span,
.home-popular-list button {
        padding-inline: 9px;
        font-size: 11px;
    }

    .home-summary-tabs {
        width: 100%;
    }

    .home-summary-tab {
        flex: 1;
    }

    .home-ranking-list li {
        grid-template-columns: 24px 32px minmax(0,1fr) auto;
        gap: 8px;
        padding-inline: 9px;
    }

    .home-ranking-list li::after {
        width: 30px;
        height: 30px;
    }
}


/* Item image integration */
.item-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.home-ranking-list li {
    grid-template-columns: 28px 38px minmax(0, 1fr) auto;
}

.home-ranking-icon {
    grid-column: 2;
    width: 34px;
    height: 34px;
    object-fit: contain;
    display: block;
}

.home-ranking-list li::after {
    display: none !important;
}

.home-ranking-list li span {
    grid-column: 3;
}

.home-ranking-list li strong {
    grid-column: 4;
}


/* =========================================================
   Beta / coming-soon feature states
   ========================================================= */
.beta-badge,
.coming-soon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin-left: auto;
    padding: 2px 7px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: .03em;
    white-space: nowrap;
}

.beta-badge {
    color: #bfdbfe;
    border-color: rgba(96, 165, 250, .24);
    background: rgba(59, 130, 246, .13);
}

.coming-soon-badge {
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, .18);
    background: rgba(100, 116, 139, .12);
}

.feature-status-trigger {
    cursor: pointer;
}

.feature-status-trigger:hover,
.feature-status-trigger:focus-visible {
    color: #94a3b8;
    background: rgba(255,255,255,.04);
}

.feature-status-modal[hidden] {
    display: none;
}

.feature-status-modal {
    position: fixed;
    inset: 0;
    z-index: 420;
    display: grid;
    place-items: center;
    padding: 20px;
}

.feature-status-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, .78);
    backdrop-filter: blur(6px);
}

.feature-status-card {
    position: relative;
    z-index: 1;
    width: min(430px, 100%);
    padding: 30px 28px 24px;
    text-align: center;
    box-shadow: 0 30px 90px rgba(0,0,0,.48);
}

.feature-status-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin: 0 auto 12px;
    border: 1px solid rgba(96, 165, 250, .24);
    border-radius: 14px;
    color: #93c5fd;
    background: rgba(59, 130, 246, .12);
    font-size: 21px;
}

.feature-status-badge {
    width: fit-content;
    margin: 0 auto 12px;
}

.feature-status-card h2 {
    margin: 0 0 10px;
    font-size: 21px;
}

.feature-status-card p {
    margin: 0;
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.7;
}

.feature-status-card .modal-actions {
    margin-top: 20px;
}

.site-footer{margin-top:40px;padding:24px;border-top:1px solid rgba(255,255,255,.08);text-align:center}.footer-links{display:flex;justify-content:center;gap:18px;flex-wrap:wrap;margin-bottom:10px}.footer-links a{text-decoration:none;color:#aeb8d0}.footer-copy{font-size:12px;color:#7f8aa3}

/* ===== MECHART profile dropdown ===== */
.profile-menu-wrap {
    position: relative;
    flex: 0 0 auto;
}

.profile-menu-wrap .profile-button {
    max-width: min(220px, 36vw);
    color: inherit;
    transition:
        border-color .16s ease,
        background .16s ease,
        box-shadow .16s ease;
}

.profile-menu-wrap .profile-button:hover,
.profile-menu-wrap .profile-button.is-open {
    border-color: rgba(96, 165, 250, .28);
    background: rgba(255, 255, 255, .07);
}

.profile-chevron {
    display: inline-block;
    color: #64748b;
    transition: transform .16s ease;
}

.profile-button.is-open .profile-chevron {
    transform: rotate(180deg);
}

.profile-dropdown[hidden] {
    display: none !important;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1200;
    width: min(280px, calc(100vw - 24px));
    padding: 8px;
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 14px;
    background: rgba(12, 19, 35, .98);
    box-shadow:
        0 18px 50px rgba(0, 0, 0, .38),
        inset 0 1px 0 rgba(255, 255, 255, .04);
    backdrop-filter: blur(18px);
    opacity: 0;
    transform: translateY(-5px) scale(.985);
    transform-origin: top right;
    pointer-events: none;
    transition:
        opacity .14s ease,
        transform .14s ease;
}

.profile-dropdown.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.profile-dropdown-head {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 10px 10px 9px;
}

.profile-dropdown-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
}

.profile-dropdown-head strong,
.profile-dropdown-head small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-dropdown-head strong {
    color: #e5edf8;
    font-size: 12px;
    line-height: 1.5;
}

.profile-dropdown-head small {
    margin-top: 2px;
    color: #64748b;
    font-size: 10px;
}

.profile-dropdown-divider {
    height: 1px;
    margin: 5px 4px;
    background: rgba(148, 163, 184, .12);
}

.profile-dropdown-item {
    width: 100%;
    min-height: 39px;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #cbd5e1;
    font: inherit;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    transition:
        color .14s ease,
        background .14s ease;
}

.profile-dropdown-item:hover,
.profile-dropdown-item:focus-visible {
    outline: none;
    color: #f8fafc;
    background: rgba(255, 255, 255, .055);
}

.profile-dropdown-item > small {
    color: #526176;
    font-size: 9px;
}

.profile-logout-form {
    margin: 0;
}

.profile-logout {
    grid-template-columns: 22px minmax(0, 1fr);
    color: #f87171;
}

.profile-logout:hover,
.profile-logout:focus-visible {
    color: #fca5a5;
    background: rgba(239, 68, 68, .09);
}

@media (max-width: 520px) {
    .profile-menu-wrap {
        max-width: 46px;
    }

    .profile-dropdown {
        position: fixed;
        top: 58px;
        right: 10px;
        width: min(280px, calc(100vw - 20px));
    }
}


/* ===== v1 launch polish ===== */
.home-intro {
    width: min(700px, 100%);
    margin: 0 auto 18px;
    text-align: center;
}
.home-intro h1 {
    margin: 6px 0 8px;
    font-size: clamp(20px, 2vw, 28px);
    line-height: 1.25;
}
.home-intro p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}
/* AdSense/affiliate inventory is not live yet. Remove this block when real ads are wired. */
.ad-slot,
.ad-card,
.ad-panel {
    display: none !important;
}


/* ===== Home dashboard: actionable market movers ===== */
.home-ranking-link {
    cursor: pointer;
    border-radius: 10px;
    outline: none;
    transition:
        background var(--motion-fast) var(--ease-standard),
        transform var(--motion-fast) var(--ease-standard),
        box-shadow var(--motion-fast) var(--ease-standard);
}

.home-ranking-link:hover {
    background: rgba(255,255,255,.045);
    transform: translateX(2px);
}

.home-ranking-link:focus-visible {
    background: rgba(96,165,250,.08);
    box-shadow: inset 0 0 0 1px rgba(96,165,250,.34);
}

.home-ranking-link:active {
    transform: translateX(1px);
}

#home-summary-date {
    display: block;
    margin-top: 5px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #526077;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .01em;
    line-height: 1.35;
    white-space: nowrap;
}

/* ===== MECHART profile modal v1 ===== */
.profile-modal[hidden] { display: none !important; }
.profile-modal { position: fixed; inset: 0; z-index: 2100; display: grid; place-items: center; padding: 20px; }
.profile-modal-backdrop { position: absolute; inset: 0; background: rgba(2, 6, 23, .72); backdrop-filter: blur(8px); }
.profile-modal-card { position: relative; z-index: 1; width: min(620px, 100%); max-height: min(820px, calc(100vh - 40px)); overflow: auto; padding: 26px; border: 1px solid rgba(148,163,184,.16); border-radius: 22px; background: rgba(12,19,35,.98); box-shadow: 0 28px 80px rgba(0,0,0,.48); }
.profile-modal-heading { display: grid; grid-template-columns: 54px minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 2px 2px 20px; }
.profile-modal-avatar { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; background: linear-gradient(135deg,#8b5cf6,#3b82f6); color: #fff; font-size: 19px; font-weight: 900; }
.profile-modal-kicker { color: #64748b; font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.profile-modal-heading h2 { margin: 3px 0 2px; color: #f8fafc; font-size: 22px; }
.profile-modal-heading p { margin: 0; color: #94a3b8; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-plan-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 26px; padding: 0 9px; border: 1px solid rgba(148,163,184,.16); border-radius: 999px; background: rgba(148,163,184,.08); color: #94a3b8; font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.profile-info-section { margin-top: 12px; padding: 18px; border: 1px solid rgba(148,163,184,.12); border-radius: 16px; background: rgba(255,255,255,.025); }
.profile-info-section h3 { margin: 0 0 14px; color: #e5edf8; font-size: 13px; }
.profile-info-grid, .profile-plan-details { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px 18px; margin: 0; }
.profile-info-grid div, .profile-plan-details div { min-width: 0; }
.profile-info-grid dt, .profile-plan-details dt { margin-bottom: 5px; color: #64748b; font-size: 10px; }
.profile-info-grid dd, .profile-plan-details dd { margin: 0; color: #dbe7f5; font-size: 12px; overflow-wrap: anywhere; }
.profile-state-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #f59e0b; }
.profile-state-dot.ok { background: #22c55e; }
.profile-section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.profile-section-title-row h3 { margin: 3px 0 0; font-size: 15px; }
.profile-plan-copy { margin: 0; color: #94a3b8; font-size: 11px; line-height: 1.7; }
.profile-manage-button { width: 100%; margin-top: 15px; }
.profile-security-section { padding-bottom: 10px; }
.profile-security-link, .profile-security-static { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 2px 8px; color: #cbd5e1; font-size: 12px; text-decoration: none; }
.profile-security-link:hover { color: #fff; }
.profile-security-static span:last-child { color: #64748b; font-size: 10px; }
@media (max-width: 560px) { .profile-modal { padding: 10px; } .profile-modal-card { padding: 20px 16px; max-height: calc(100vh - 20px); } .profile-modal-heading { grid-template-columns: 46px minmax(0,1fr); } .profile-modal-avatar { width: 46px; height: 46px; border-radius: 14px; } .profile-modal-heading > .profile-plan-badge { grid-column: 1 / -1; justify-self: start; } .profile-info-grid, .profile-plan-details { grid-template-columns: 1fr; } }


/* ===== MECHART password change modal ===== */
.profile-security-button { width: 100%; border: 0; background: transparent; font-family: inherit; cursor: pointer; }
.password-change-card { width: min(500px, 100%); }
.password-change-heading { padding: 2px 2px 18px; }
.password-change-heading h2 { margin: 5px 0 7px; color: #f8fafc; font-size: 21px; }
.password-change-heading p { margin: 0; color: #94a3b8; font-size: 11px; line-height: 1.6; }
.password-change-field { display: block; margin-top: 14px; }
.password-change-field > span { display: block; margin-bottom: 7px; color: #94a3b8; font-size: 10px; font-weight: 700; }
.password-change-field input { width: 100%; height: 44px; box-sizing: border-box; border: 1px solid rgba(148,163,184,.16); border-radius: 11px; outline: none; background: rgba(2,6,23,.46); color: #e5edf8; padding: 0 13px; font: inherit; font-size: 12px; transition: border-color .15s ease, box-shadow .15s ease; }
.password-change-field input:focus { border-color: rgba(96,165,250,.58); box-shadow: 0 0 0 3px rgba(59,130,246,.10); }
.password-change-field small { display: block; margin-top: 6px; color: #fb7185; font-size: 10px; line-height: 1.45; }
.password-change-message { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: rgba(34,197,94,.09); color: #86efac; font-size: 11px; }
.password-change-message.is-error { background: rgba(244,63,94,.09); color: #fda4af; }

.profile-account-action {
    margin-top: 12px;
}

.profile-account-action-button {
    width: 100%;
    min-height: 42px;
    margin: 0;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 10px;
    background: rgba(255,255,255,.035);
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background var(--motion-fast) var(--ease-standard),
        border-color var(--motion-fast) var(--ease-standard),
        color var(--motion-fast) var(--ease-standard);
}

.profile-account-action-button:hover {
    background: rgba(255,255,255,.055);
    border-color: rgba(96,165,250,.22);
    color: #e2e8f0;
}

.profile-account-action-button:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px rgba(96,165,250,.14);
    border-color: rgba(96,165,250,.34);
}

.password-change-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.password-change-actions > button {
    width: 100%;
    min-width: 0;
    height: 54px;
    min-height: 54px;
    margin: 0 !important;
    padding: 0 18px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    line-height: 1;
}

.password-change-actions > button:disabled {
    cursor: not-allowed;
    opacity: .62;
}


@media (max-width: 560px) {
    .password-change-actions {
        grid-template-columns: 1fr;
    }
}




/* ===== v12: fixed Y-axis + horizontally scrollable plot ===== */
.chart-shell {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: start;
    min-width: 0;
}

.chart-fixed-y-axis {
    position: relative;
    z-index: 4;
    height: 340px;
    background: var(--panel-bg, #0b1220);
    pointer-events: none;
}

.chart-fixed-y-axis > canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.chart-shell .chart-area {
    min-width: 0;
}

@media (max-width: 760px) {
    .chart-shell { grid-template-columns: 72px minmax(0, 1fr); }
}
\n\n/* ===== MECHART account center v2 ===== */
.profile-button .profile-copy { min-width: 0; }
.profile-button .profile-copy strong { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-dropdown-head { grid-template-columns: 38px minmax(0, 1fr); }
.profile-dropdown-head > div { min-width: 0; }
.profile-dropdown-head strong { margin-top: 0; }

.account-info-card {
    width: min(680px, calc(100vw - 40px));
    max-height: min(760px, calc(100vh - 40px));
    padding: 0;
    overflow: hidden auto;
    border: 1px solid rgba(148, 163, 184, .14);
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(18, 28, 48, .98), rgba(10, 17, 31, .99));
    box-shadow: 0 28px 80px rgba(0, 0, 0, .48), 0 0 0 1px rgba(255,255,255,.015) inset;
}

.account-info-card .modal-close {
    top: 18px;
    right: 18px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: #7f8da3;
    background: transparent;
    transition: background .15s ease, color .15s ease;
}
.account-info-card .modal-close:hover,
.account-info-card .modal-close:focus-visible {
    outline: 0;
    color: #e5edf8;
    background: rgba(148, 163, 184, .08);
}

.account-center-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 24px 62px 20px 24px;
    border-bottom: 1px solid rgba(148, 163, 184, .10);
}

.account-center-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, #7c5cff 0%, #4d8dff 100%);
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    box-shadow: 0 8px 24px rgba(79, 104, 255, .22);
}

.account-center-title { min-width: 0; }
.account-center-title h2 {
    margin: 0 0 5px;
    color: #f4f7fb;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.02em;
}
.account-center-title p {
    max-width: 480px;
    margin: 0;
    overflow: hidden;
    color: #7f8da3;
    font-size: 11px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-center-body {
    display: grid;
    gap: 0;
    padding: 6px 24px 22px;
}

.account-panel {
    padding: 20px 0;
    border-bottom: 1px solid rgba(148, 163, 184, .10);
}
.account-panel:last-child { border-bottom: 0; padding-bottom: 2px; }

.account-panel-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 13px;
}
.account-panel-heading h3 {
    margin: 0;
    color: #e9eef7;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -.01em;
}
.account-panel-heading p {
    margin: 0;
    color: #64748b;
    font-size: 10px;
    line-height: 1.5;
    text-align: right;
}

.account-detail-list {
    margin: 0;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .11);
    border-radius: 13px;
    background: rgba(4, 10, 22, .30);
}
.account-detail-row {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    align-items: center;
    min-height: 46px;
    padding: 0 15px;
    border-bottom: 1px solid rgba(148, 163, 184, .08);
}
.account-detail-row:last-child { border-bottom: 0; }
.account-detail-row dt {
    color: #6f7d92;
    font-size: 10px;
    font-weight: 700;
}
.account-detail-row dd {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: #dce5f2;
    font-size: 11px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-provider-badge,
.account-managed-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border: 1px solid rgba(96, 165, 250, .18);
    border-radius: 999px;
    background: rgba(59, 130, 246, .075);
    color: #a9c8ff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .01em;
}
.account-provider-badge { min-height: 24px; padding: 0 9px; }
.account-managed-badge { min-height: 28px; padding: 0 10px; flex: 0 0 auto; }

.account-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 58px;
    padding: 12px 14px;
    border: 1px solid rgba(148, 163, 184, .11);
    border-radius: 13px;
    background: rgba(4, 10, 22, .26);
}
.account-action-copy { min-width: 0; }
.account-action-copy strong {
    display: block;
    margin-bottom: 4px;
    color: #dce5f2;
    font-size: 11px;
    font-weight: 750;
}
.account-action-copy span {
    display: block;
    color: #6f7d92;
    font-size: 10px;
    line-height: 1.55;
}

.account-secondary-button,
.account-danger-button {
    flex: 0 0 auto;
    min-width: 72px;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 9px;
    font: inherit;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease, transform .15s ease;
}
.account-secondary-button {
    border: 1px solid rgba(148, 163, 184, .16);
    background: rgba(255, 255, 255, .035);
    color: #cbd5e1;
}
.account-secondary-button:hover,
.account-secondary-button:focus-visible {
    outline: 0;
    border-color: rgba(96, 165, 250, .35);
    background: rgba(96, 165, 250, .085);
    color: #f8fafc;
}

.account-danger-panel .account-panel-heading h3 { color: #f4d8df; }
.account-danger-row {
    border-color: rgba(244, 63, 94, .12);
    background: rgba(136, 19, 55, .045);
}
.account-danger-button {
    border: 1px solid rgba(244, 63, 94, .30);
    background: rgba(244, 63, 94, .08);
    color: #ff9caf;
}
.account-danger-button:hover,
.account-danger-button:focus-visible {
    outline: 0;
    border-color: rgba(251, 113, 133, .52);
    background: rgba(244, 63, 94, .14);
    color: #ffd4dc;
}

.account-delete-card { width: min(520px, calc(100vw - 40px)); }
.account-delete-warning { margin: 4px 0 16px; padding: 14px 15px; border: 1px solid rgba(244,63,94,.20); border-radius: 12px; background: rgba(244,63,94,.055); color: #cbd5e1; }
.account-delete-warning strong { display: block; margin-bottom: 8px; color: #fecdd3; font-size: 12px; }
.account-delete-warning ul { margin: 0; padding-left: 18px; color: #94a3b8; font-size: 10px; line-height: 1.75; }
.account-delete-provider-note { margin: 12px 0 0; color: #64748b; font-size: 10px; line-height: 1.6; }
.account-delete-confirm { display: flex; align-items: flex-start; gap: 9px; margin-top: 16px; color: #a7b3c4; font-size: 10px; line-height: 1.55; cursor: pointer; }
.account-delete-confirm input { width: 15px; height: 15px; margin: 1px 0 0; accent-color: #e11d48; }
.account-delete-checkbox-error { display: block; margin-top: 6px; color: #fb7185; font-size: 10px; line-height: 1.45; }
.account-delete-submit { width: 100%; min-width: 0; height: 54px; border: 1px solid rgba(244,63,94,.38); border-radius: 11px; background: #be123c; color: #fff; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.account-delete-submit:hover,
.account-delete-submit:focus-visible { outline: 0; background: #e11d48; }
.account-delete-submit:disabled { cursor: not-allowed; opacity: .62; }

@media (max-width: 700px) {
    .account-info-card { width: min(94vw, 680px); max-height: calc(100vh - 22px); border-radius: 17px; }
    .account-center-header { padding: 20px 52px 17px 18px; gap: 12px; }
    .account-center-avatar { width: 42px; height: 42px; flex-basis: 42px; border-radius: 12px; }
    .account-center-title h2 { font-size: 18px; }
    .account-center-body { padding: 4px 18px 18px; }
    .account-panel { padding: 17px 0; }
    .account-panel-heading { display: block; margin-bottom: 11px; }
    .account-panel-heading p { margin-top: 4px; text-align: left; }
    .account-detail-row { grid-template-columns: 100px minmax(0, 1fr); min-height: 44px; padding: 0 12px; }
    .account-action-row { align-items: flex-start; flex-direction: column; gap: 10px; }
    .account-secondary-button, .account-danger-button, .account-managed-badge { align-self: stretch; justify-content: center; width: 100%; }
}

/* =========================================================
   METEM Commercial Readability v1
   Slightly brighter production dark theme.
   Visual-only overrides: no chart/layout/behavior changes.
   ========================================================= */
:root {
    --bg: #0b1220;
    --surface: rgba(22, 31, 50, 0.84);
    --surface-strong: rgba(18, 27, 45, 0.96);
    --line: rgba(203, 213, 225, 0.11);
    --text: #edf2f7;
    --muted: #94a3b8;
}

html {
    background: #0b1220;
}

body {
    background:
        radial-gradient(ellipse at top, #17243a 0%, #0e1728 42%, var(--bg) 76%);
}

.glass,
.glass-card {
    border-color: rgba(203, 213, 225, 0.11);
    box-shadow:
        0 10px 30px rgba(2, 6, 23, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.018);
}

.topbar {
    background: rgba(18, 28, 47, 0.90);
    border-bottom: 1px solid rgba(203, 213, 225, 0.09);
}

.left-sidebar {
    background: rgba(16, 25, 42, 0.52);
    border-right-color: rgba(203, 213, 225, 0.08);
}

.search-box,
.control-select,
.icon-button,
.profile-button {
    background: rgba(255, 255, 255, 0.055);
    border-color: rgba(203, 213, 225, 0.12);
}

.search-box:focus-within,
.control-select:focus,
.icon-button:focus-visible,
.profile-button:focus-visible {
    border-color: rgba(96, 165, 250, 0.38);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

.search-box input::placeholder {
    color: #7f8da3;
}

.nav-item {
    color: #a8b4c6;
}

.nav-item:hover {
    color: #e5edf7;
    background: rgba(255, 255, 255, 0.045);
    border-color: rgba(203, 213, 225, 0.08);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(96, 165, 250, 0.26);
}

.stat-card span,
.stat-card small,
.event-card small,
.panel-title small {
    color: #8291a7;
}

.event-card p,
.info-page p,
.info-page li {
    color: #aeb9c9;
}

.secondary-button,
.calendar-actions button {
    background: rgba(255, 255, 255, 0.045);
    border-color: rgba(203, 213, 225, 0.11);
    color: #b7c2d2;
}

.calendar-day {
    border-color: rgba(203, 213, 225, 0.085);
}

.calendar-day:hover {
    background: rgba(255, 255, 255, 0.025);
}

.auth-card {
    border-color: rgba(203, 213, 225, 0.15);
    background: linear-gradient(180deg, rgba(27, 39, 62, .99), rgba(15, 24, 41, .995));
    box-shadow:
        0 30px 90px rgba(0, 0, 0, .42),
        0 0 0 1px rgba(255, 255, 255, .025) inset;
}

@media (max-width: 760px) {
    body {
        background:
            radial-gradient(ellipse at top, #162238 0%, #0e1728 44%, var(--bg) 78%);
    }
}

/* =========================================================
   METEM FINAL DARK TONE v1
   Production color system — unified navy/slate hierarchy.
   OP.GG dark mode is used only as tonal-hierarchy reference.
   No layout/chart/scroll/responsive behavior changes.
   ========================================================= */
:root {
    --bg: #0d1524;
    --surface: #121d30;
    --surface-strong: #101a2b;
    --line: rgba(148, 163, 184, .13);
    --text: #e6edf7;
    --muted: #8c9bb0;

    --metem-bg: #0d1524;
    --metem-shell: #101a2b;
    --metem-sidebar: #0f1929;
    --metem-panel: #142137;
    --metem-panel-soft: #17253c;
    --metem-panel-raised: #1a2a43;
    --metem-input: #16243a;
    --metem-line: rgba(148, 163, 184, .13);
    --metem-line-soft: rgba(148, 163, 184, .085);
    --metem-text: #e6edf7;
    --metem-text-2: #b5c0d0;
    --metem-text-3: #8291a6;
    --metem-blue: #5383e8;
    --metem-blue-soft: rgba(83, 131, 232, .16);
}

html {
    background: var(--metem-bg);
}

body {
    background:
        radial-gradient(ellipse at 48% -10%, #172640 0%, #111c2f 35%, var(--metem-bg) 72%);
    color: var(--metem-text);
}

.glass,
.glass-card {
    background: rgba(20, 33, 55, .92);
    border-color: var(--metem-line);
    box-shadow:
        0 8px 24px rgba(2, 6, 23, .14),
        inset 0 1px 0 rgba(255, 255, 255, .018);
}

.topbar {
    background: rgba(16, 26, 43, .96);
    border-bottom-color: var(--metem-line-soft);
    box-shadow: 0 1px 0 rgba(0, 0, 0, .18);
}

.left-sidebar {
    background: rgba(15, 25, 41, .96) !important;
    border-right-color: var(--metem-line-soft) !important;
    backdrop-filter: none;
}

.workspace {
    background: transparent;
}

.search-box,
.control-select,
.icon-button,
.profile-button {
    background: var(--metem-input);
    border-color: var(--metem-line);
}

.search-box:hover,
.control-select:hover,
.icon-button:hover,
.profile-button:hover {
    border-color: rgba(148, 163, 184, .20);
}

.search-box:focus-within,
.control-select:focus,
.icon-button:focus-visible,
.profile-button:focus-visible {
    border-color: rgba(83, 131, 232, .55);
    box-shadow: 0 0 0 3px rgba(83, 131, 232, .10);
}

.search-box input::placeholder,
.profile-copy small {
    color: var(--metem-text-3);
}

.nav-item,
.item-button {
    color: var(--metem-text-2);
}

.nav-item:hover,
.item-button:hover {
    color: var(--metem-text);
    background: rgba(255, 255, 255, .045);
}

.nav-item.active {
    color: #eef4ff;
    background: var(--metem-blue-soft);
    border-color: rgba(83, 131, 232, .30);
}

/* Secondary item-category panel */
.market-secondary-panel {
    background: var(--metem-shell) !important;
    border-right-color: var(--metem-line) !important;
    box-shadow:
        18px 0 42px rgba(2, 6, 23, .30),
        inset 1px 0 0 rgba(255, 255, 255, .012) !important;
}

.market-secondary-head {
    border-bottom-color: var(--metem-line-soft) !important;
}

.market-secondary-head strong {
    color: var(--metem-text);
}

.market-secondary-close {
    color: var(--metem-text-3);
    background: var(--metem-input);
    border-color: var(--metem-line);
}

.market-category {
    background: var(--metem-panel) !important;
    border-color: var(--metem-line-soft) !important;
    color: var(--metem-text-2) !important;
    box-shadow: none !important;
}

.market-category:hover,
.market-category:focus-visible {
    background: var(--metem-panel-soft) !important;
    border-color: rgba(83, 131, 232, .25) !important;
    color: var(--metem-text) !important;
}

.market-category.active {
    background: var(--metem-blue-soft) !important;
    border-color: rgba(83, 131, 232, .34) !important;
    color: #edf4ff !important;
}

.market-item-list-panel,
.market-item-list-panel .flyout-head,
.market-item-list {
    background: var(--metem-shell) !important;
    border-color: var(--metem-line) !important;
}

/* Chart surfaces: fixed Y-axis and plot read as one card */
.chart-fixed-y-axis,
.chart-fixed-y-axis > canvas {
    background: transparent !important;
}

.chart-card,
.chart-panel,
.chart-shell {
    border-color: var(--metem-line-soft);
}

/* Reusable secondary surfaces */
.stat-card,
.event-card,
.calendar-card,
.portfolio-card,
.account-detail-row,
.account-action-row {
    border-color: var(--metem-line-soft);
}

.stat-card span,
.stat-card small,
.event-card small,
.panel-title small {
    color: var(--metem-text-3);
}

.event-card p,
.info-page p,
.info-page li {
    color: var(--metem-text-2);
}

/* Event impact comparison */
.event-impact-prices {
    background: var(--metem-shell) !important;
    border-color: var(--metem-line-soft) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .012);
}

.event-impact-prices > span {
    color: var(--metem-text-3) !important;
}

.event-impact-prices > span[aria-hidden="true"] {
    color: #65758b !important;
}

.event-impact-prices strong {
    color: #dce5f1 !important;
}

.event-impact-card > p {
    color: #9aa9bd !important;
}

/* Buttons and low-emphasis controls */
.secondary-button,
.calendar-actions button {
    background: var(--metem-input);
    border-color: var(--metem-line);
    color: var(--metem-text-2);
}

.secondary-button:hover,
.calendar-actions button:hover {
    background: var(--metem-panel-raised);
    color: var(--metem-text);
}

/* Calendar */
.calendar-day {
    border-color: var(--metem-line-soft);
}

.calendar-day:hover {
    background: rgba(255, 255, 255, .028);
}

/* Auth/account surfaces */
.auth-card,
.account-info-card,
.password-change-card {
    background: linear-gradient(180deg, #17253c 0%, #111c2f 100%);
    border-color: var(--metem-line);
    box-shadow:
        0 28px 80px rgba(0, 0, 0, .38),
        inset 0 1px 0 rgba(255, 255, 255, .018);
}

@media (max-width: 760px) {
    body {
        background:
            radial-gradient(ellipse at 50% -8%, #172640 0%, #111c2f 38%, var(--metem-bg) 74%);
    }
}

