:root {
    --bull: #16a34a;
    --bear: #dc2626;
    --neutral: #6b7280;
    --bg: #0f1115;
    --card: #1a1d24;
    --border: #2a2e37;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --accent: #3b82f6;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 24px;
}

.wrap { max-width: 900px; margin: 0 auto; }

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

h1 { font-size: 1.5rem; margin: 0; }

.tier-badge {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.tier-free { background: #2a2e37; color: var(--muted); }
.tier-pro { background: #1e3a2f; color: var(--bull); }

.flash-container { margin-bottom: 16px; }
.flash {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.flash-success { background: #1e3a2f; color: #4ade80; }
.flash-error { background: #3a1e1e; color: #f87171; }

.add-form {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.add-form input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 0.95rem;
}
.add-form button {
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    background: var(--accent);
    color: white;
    font-weight: 600;
    cursor: pointer;
}
.info-btn {
    margin-top: 14px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(59, 130, 246, 0.12);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
}
.info-btn:hover {
    background: rgba(59, 130, 246, 0.18);
}
.simple-dialog {
    width: min(560px, 90vw);
    border: none;
    border-radius: 18px;
    padding: 0;
    background: var(--card);
    color: var(--text);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}
.simple-dialog::backdrop {
    background: rgba(15, 17, 21, 0.75);
    backdrop-filter: blur(2px);
}
.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 0;
    gap: 12px;
}
.dialog-header h3 {
    margin: 0;
    font-size: 1.05rem;
}
.dialog-close {
    border: none;
    background: none;
    color: var(--muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}
.dialog-body {
    padding: 0 24px 20px;
    color: var(--muted);
    line-height: 1.7;
}
.dialog-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0 24px 24px;
}
.dialog-button {
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    cursor: pointer;
    font-weight: 600;
}
.dialog-button:hover {
    background: #2563eb;
}
.limit-note { color: var(--muted); font-size: 0.85rem; margin: 0 0 20px; }

.upgrade-banner {
    background: linear-gradient(135deg, #1e293b, #1a1d24);
    border: 1px solid var(--accent);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.upgrade-btn {
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    background: var(--accent);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.watchlist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.empty { color: var(--muted); }

.stock-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}

.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.ticker { font-weight: 700; font-size: 1.1rem; }
.remove-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.9rem;
}
.remove-btn:hover { color: var(--bear); }

.price { font-size: 1.6rem; font-weight: 700; }
.price.unavailable { color: var(--muted); font-size: 1rem; }
.change { font-size: 0.9rem; margin-bottom: 12px; }
.change.up { color: var(--bull); }
.change.down { color: var(--bear); }

.ai-section { border-top: 1px solid var(--border); padding-top: 10px; }
.pro-lock { color: var(--muted); font-size: 0.8rem; }
.analyze-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}
.analyze-btn:hover { border-color: var(--accent); }

.ai-result { margin-top: 8px; font-size: 0.85rem; }
.ai-result p { margin: 4px 0 0; color: var(--muted); }
.verdict { font-weight: 700; }
.verdict.bullish { color: var(--bull); }
.verdict.bearish { color: var(--bear); }
.verdict.neutral { color: var(--neutral); }

footer { text-align: center; margin-top: 20px; }
.link-btn {
    background: none;
    border: none;
    color: var(--muted);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.85rem;
}
