:root {
    --bg: #0f1419;
    --bg-card: #1a2332;
    --bg-panel: #243044;
    --accent: #3d9a6a;
    --accent-dim: rgba(61, 154, 106, 0.15);
    --text: #e8eef4;
    --text-muted: #8b9cb3;
    --border: #334155;
    --up: #ef5350;
    --down: #26a69a;
    --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

.hidden { display: none !important; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

.page-wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px 32px; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(15, 20, 25, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    margin: 0 -16px 20px;
    padding: 0 16px;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
}

.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.back-link:hover { color: var(--text); }

.header-title { flex: 1; min-width: 0; }
.header-title h1 { font-size: 1.1rem; line-height: 1.3; }
.header-title .subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.language-select {
    background: var(--bg-panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
}

.sync-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
}
.sync-indicator.hidden { display: none; }
.sync-indicator.syncing { color: var(--text-muted); }
.sync-indicator.success { color: var(--accent); border-color: var(--accent); }
.sync-indicator.error { color: var(--up); }
.sync-indicator.fade-out { opacity: 0; transition: opacity 0.4s; }

.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    align-items: start;
}

.sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    position: sticky;
    top: 72px;
}

.search-box { position: relative; margin-bottom: 14px; }
.search-box input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text);
}

.search-results {
    position: absolute;
    left: 0; right: 0; top: calc(100% + 4px);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 260px;
    overflow: auto;
    z-index: 20;
}
.search-results.hidden { display: none; }
.search-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}
.search-item:hover { background: var(--accent-dim); }
.search-item small { color: var(--text-muted); margin-left: 6px; }

.sidebar-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.sidebar-head h2 { font-size: 0.95rem; }
.text-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
}
.text-btn:hover { color: var(--text); }

.watch-list { list-style: none; }
.watch-group { margin-bottom: 10px; }
.watch-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 6px 4px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    text-align: left;
}
.watch-group-head:hover { color: var(--text); background: var(--accent-dim); }
.watch-group-head .count {
    font-weight: 500;
    opacity: 0.8;
}
.watch-group.collapsed .watch-group-items { display: none; }
.watch-group.drag-over-group .watch-group-head {
    color: var(--accent);
    outline: 1px dashed var(--accent);
}
.watch-group-items { list-style: none; }
.watch-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 6px;
    border-radius: 8px;
    cursor: pointer;
    border-top: 2px solid transparent;
    border-bottom: 2px solid transparent;
}
.watch-item:hover, .watch-item.active { background: var(--accent-dim); }
.watch-item.dragging { opacity: 0.45; }
.watch-item.drag-over-before { border-top-color: var(--accent); }
.watch-item.drag-over-after { border-bottom-color: var(--accent); }
.watch-item .drag-handle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    padding: 0;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: grab;
    touch-action: none;
}
.watch-item .drag-handle svg { fill: currentColor; }
.watch-item .drag-handle:hover { color: var(--text); }
.watch-item.dragging .drag-handle { cursor: grabbing; }
.watch-item .code { font-weight: 600; font-size: 0.85rem; }
.watch-item .name {
    flex: 1;
    font-size: 0.78rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.watch-item .remove {
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
}
.watch-item .remove:hover { color: var(--up); }

.sidebar-hint {
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.main-area { min-width: 0; }

.page-notice {
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: var(--radius);
    border: 1px solid rgba(212, 168, 75, 0.45);
    background: rgba(212, 168, 75, 0.12);
    color: #e8d5a3;
    font-size: 0.82rem;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text);
    cursor: pointer;
}
.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.muted { color: var(--text-muted); font-size: 0.8rem; }

.state-msg {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
}
.state-msg.hidden { display: none; }
.empty-sample-hint { margin: 8px 0 16px; }
.state-msg .btn { margin-top: 4px; }

.spinner {
    width: 28px; height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.earnings-panel {
    margin-top: 18px;
    margin-bottom: 8px;
    padding: 14px 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.earnings-panel.hidden { display: none; }
.earnings-head {
    margin-bottom: 10px;
}
.earnings-head h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 4px;
}
.earnings-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.earnings-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 10px 14px;
    align-items: baseline;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    font: inherit;
}
.earnings-row:hover {
    border-color: var(--border);
    border-left-color: var(--accent);
}
.earnings-row.soon {
    border-left-color: var(--accent);
}
.earn-sym {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 8px;
    min-width: 0;
}
.earn-sym strong { font-size: 0.95rem; }
.earn-name {
    color: var(--text-muted);
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.earn-next, .earn-last {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    min-width: 0;
    font-size: 0.88rem;
}
.earn-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: none;
}
.earn-val { font-variant-numeric: tabular-nums; }
.earn-soon {
    font-size: 0.72rem;
    color: var(--accent);
}
.earnings-empty { margin: 4px 0 0; }
@media (max-width: 720px) {
    .earnings-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

.news-feed-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px 16px;
}
.news-feed-filter {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-card);
}
.news-filter-btn {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.78rem;
    padding: 5px 10px;
    border-radius: 999px;
    cursor: pointer;
}
.news-filter-btn:hover { color: var(--text); }
.news-filter-btn.active {
    background: var(--accent);
    color: #fff;
}

.news-feed-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 560px;
    overflow-y: auto;
}
.news-feed-item {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 2fr);
    gap: 8px 14px;
    align-items: baseline;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
}
.news-feed-item:hover {
    border-color: var(--border);
    border-left-color: var(--accent);
}
.news-feed-item.kind-filing { border-left-color: rgba(100, 116, 139, 0.45); }
.news-feed-item.kind-news { border-left-color: rgba(37, 99, 235, 0.35); }
.news-feed-sym {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 8px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-align: left;
}
.news-feed-sym:hover .news-feed-name,
.news-feed-sym:hover strong {
    color: var(--accent);
}
.news-feed-sym strong { font-size: 0.9rem; }
.news-feed-name {
    color: var(--text-muted);
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.news-kind-tag {
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: var(--bg-panel);
}
.news-feed-item.kind-news .news-kind-tag {
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.35);
}
.news-feed-body { min-width: 0; }
.news-feed-title-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.news-feed-title {
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}
.news-feed-title:hover { color: var(--accent); }
.news-score {
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    padding: 2px 7px;
    border-radius: 999px;
    white-space: nowrap;
    line-height: 1.4;
}
.news-score.high {
    color: #b45309;
    background: rgba(245, 158, 11, 0.18);
}
.news-score.mid {
    color: #1d4ed8;
    background: rgba(59, 130, 246, 0.14);
}
.news-score.low {
    color: var(--text-muted);
    background: rgba(148, 163, 184, 0.16);
}
.news-feed-meta {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
@media (max-width: 720px) {
    .news-feed-item {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .news-feed-head {
        flex-direction: column;
    }
}

.card-grid {
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.card-grid.hidden { display: none; }
.card-group-title {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 600;
}
.card-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.quote-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}
.quote-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}
.quote-card .top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.quote-card .symbol { font-weight: 700; }
.quote-card .market-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-panel);
    color: var(--text-muted);
}
.quote-card .name {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.quote-card .price { font-size: 1.4rem; font-weight: 700; }
.quote-card .change { font-size: 0.85rem; margin-top: 4px; }
.quote-card .change.up { color: var(--up); }
.quote-card .change.down { color: var(--down); }
.quote-card .meta {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.quote-card.error { border-color: var(--up); opacity: 0.85; }

.detail-dialog {
    width: min(920px, 96vw);
    max-height: 90vh;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    padding: 0;
    margin: auto;
    position: fixed;
    inset: 0;
}
.detail-dialog::backdrop { background: rgba(0,0,0,0.55); }

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}
.detail-header h2 { font-size: 1.1rem; }
.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.detail-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 18px 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    flex-wrap: nowrap;
}
.tab-btn {
    padding: 8px 14px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    flex: 0 0 auto;
}
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.detail-body { padding: 16px 18px 20px; overflow: auto; max-height: calc(90vh - 160px); }
.tab-panel.hidden { display: none; }

.period-btns { display: flex; gap: 8px; margin-bottom: 0; flex-wrap: wrap; }
.chart-controls { margin-bottom: 12px; }
.chart-controls .period-btns { margin-bottom: 8px; }
.range-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.range-btn {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.78rem;
}
.range-btn.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent);
}
.period-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text-muted);
    cursor: pointer;
}
.period-btn.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent);
}

.chart-wrap {
    position: relative;
    height: 320px;
    width: 100%;
    overflow: hidden;
}
.chart-wrap canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}
.chart-wrap canvas.hidden { display: none; }
.chart-empty { text-align: center; padding: 48px 12px; }
.chart-empty p { margin-bottom: 12px; line-height: 1.6; }
.chart-truncated { margin-top: 8px; font-size: 0.78rem; }
.chart-retry-btn { margin-top: 4px; }
.chart-retry-btn:disabled { opacity: 0.65; cursor: not-allowed; }

.fin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.fin-table th, .fin-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.fin-table th { color: var(--text-muted); font-weight: 500; }
.fin-table.periods th, .fin-table.periods td { white-space: nowrap; }

.fin-group {
    margin-bottom: 18px;
}
.fin-group h3 {
    font-size: 0.88rem;
    margin-bottom: 8px;
    color: var(--text);
}
.fin-group .muted { margin: 4px 0 8px; }
.fin-group.sandbox .muted { margin-bottom: 12px; }
.sandbox-inferred-hint { margin-top: 8px; font-size: 0.75rem; }
.val-band-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.val-band-head h3 { margin-bottom: 0; }
.val-band-toggles { display: flex; gap: 6px; }
.val-band-wrap {
    position: relative;
    height: 180px;
    width: 100%;
}

.compare-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 16px;
}
.compare-panel.hidden { display: none; }
.compare-scroll { overflow-x: auto; }
.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    min-width: 720px;
}
.compare-table th, .compare-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}
.compare-table th { color: var(--text-muted); font-weight: 500; }

.sandbox-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 12px;
    line-height: 1.55;
}
.sandbox-verdict {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
}
.sandbox-verdict-label {
    font-weight: 600;
    font-size: 1.02rem;
    margin-bottom: 6px;
}
.sandbox-verdict-text {
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.7;
}
.sandbox-verdict.cheap {
    border-color: var(--down);
    background: color-mix(in srgb, var(--down) 10%, var(--bg-panel));
}
.sandbox-verdict.cheap .sandbox-verdict-label { color: var(--down); }
.sandbox-verdict.expensive {
    border-color: var(--up);
    background: color-mix(in srgb, var(--up) 10%, var(--bg-panel));
}
.sandbox-verdict.expensive .sandbox-verdict-label { color: var(--up); }
.sandbox-verdict.fair {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, var(--bg-panel));
}
.sandbox-verdict.fair .sandbox-verdict-label { color: var(--accent); }
.sandbox-verdict.muted .sandbox-verdict-label { color: var(--text-muted); }

.sandbox-row, .holding-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
}
.sandbox-row label, .holding-row label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.sandbox-row input, .holding-row input,
.note-textarea {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 8px 10px;
    font: inherit;
}
.sandbox-row input, .holding-row input { width: 120px; }
.note-textarea { width: 100%; resize: vertical; min-height: 88px; }

.thesis-block { margin-bottom: 20px; }
.thesis-block h3 { font-size: 0.9rem; margin-bottom: 10px; }
.note-composer-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}
.note-list {
    list-style: none;
    margin-top: 16px;
}
.note-empty { padding: 8px 0; }
.note-item {
    padding: 12px 0;
    border-top: 1px solid var(--border);
}
.note-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}
.note-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.note-item-head .link-btn {
    font-size: 0.68rem;
    text-decoration: none;
}
.note-item-head .note-delete-btn { color: var(--text-muted); }
.note-item-head .note-delete-btn:hover { color: var(--up); }
.note-item time {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.note-item-body {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.9rem;
    cursor: text;
}
.note-item .note-textarea { min-height: 80px; }
.thesis-hint { margin-top: 0; }
.thesis-hint.hidden { display: none; }
.fin-table + .thesis-hint { margin-top: 8px; }

.news-list { list-style: none; }
.news-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.news-item a { color: var(--text); text-decoration: none; }
.news-item a:hover { color: var(--accent); }
.news-item time { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

.detail-news-hint { margin-bottom: 10px; }
.detail-news-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.detail-news-item {
    grid-template-columns: 1fr;
}

.disclaimer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 24px 0 8px;
}

footer { text-align: center; padding-top: 8px; }

@media (max-width: 860px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: static; }

    .site-header {
        padding-top: 10px;
        padding-bottom: 12px;
    }
    .header-inner {
        flex-wrap: wrap;
        align-items: center;
        gap: 8px 10px;
        min-height: 0;
    }
    .back-link { order: 1; flex: 1 1 auto; }
    .sync-indicator { order: 2; }
    .language-select { order: 3; flex-shrink: 0; }
    .site-account { order: 4; flex-shrink: 0; }
    .header-title {
        order: 5;
        flex: 1 1 100%;
        padding: 2px 0 0;
    }
    .header-title h1 {
        font-size: 1.2rem;
        font-weight: 700;
    }
    .header-title .subtitle {
        margin-top: 4px;
        font-size: 0.8rem;
        line-height: 1.45;
    }
}

/* Site auth — dark-theme tweaks on top of common.css */
.site-account-menu-item:hover { background: var(--accent-dim); }
.site-auth-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.site-auth-tab-active { background: var(--accent-dim); }
.site-auth-status-error { color: var(--up); }
.site-auth-status-success { color: var(--accent); }

@media (max-width: 860px) {
    .site-account-email-btn {
        max-width: min(12rem, 42vw);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
