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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fff;
    color: #1a1a1a;
    font-size: 13px;
    line-height: 1.4;
}

#app {
    padding: 20px 24px;
    max-width: 100%;
}

.section {
    margin-bottom: 40px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.header-left h1 {
    font-size: 22px;
    font-weight: 700;
    color: #111;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 13px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
}

.live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #22c55e;
    border-radius: 50%;
    margin-right: 2px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stock-count {
    font-size: 13px;
    color: #666;
    background: #f3f4f6;
    padding: 6px 14px;
    border-radius: 6px;
    white-space: nowrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    font-family: inherit;
    white-space: nowrap;
}

.btn-primary {
    background: #111;
    color: #fff;
    border-color: #111;
}

.btn-primary:hover {
    background: #333;
}

.btn-outline {
    background: #fff;
    color: #333;
    border-color: #d1d5db;
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-icon {
    padding: 6px 8px;
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #666;
    cursor: pointer;
}

.btn-icon:hover {
    background: #f3f4f6;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-danger {
    color: #dc2626;
    border-color: #fca5a5;
}

.btn-danger:hover {
    background: #fef2f2;
}

/* Table */
.table-container {
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

thead th {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

thead th:hover {
    background: #f3f4f6;
}

tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.1s;
}

tbody tr:hover {
    background: #f9fafb;
}

tbody td {
    padding: 8px 12px;
    vertical-align: middle;
}

.loading-cell {
    text-align: center;
    padding: 40px !important;
    color: #9ca3af;
    font-size: 14px;
}

/* Ticker cell */
.ticker-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticker-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: #f3f4f6;
    flex-shrink: 0;
}

.ticker-logo-fallback {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.ticker-symbol {
    font-weight: 600;
    color: #111;
}

.stock-name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #374151;
}

/* Price & Change */
.price {
    font-weight: 600;
}

.change {
    display: flex;
    align-items: center;
    gap: 2px;
    font-weight: 500;
}

.change.positive { color: #16a34a; }
.change.negative { color: #dc2626; }

.arrow-down::before { content: '↘'; margin-right: 2px; }
.arrow-up::before { content: '↗'; margin-right: 2px; }

/* RSI */
.rsi-value {
    font-weight: 500;
}

/* Signal badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-neutral {
    background: #f3f4f6;
    color: #6b7280;
}

.badge-bearish,
.badge-oversold {
    background: #fef2f2;
    color: #dc2626;
}

.badge-bullish {
    background: #f0fdf4;
    color: #16a34a;
}

.badge-buy {
    background: #16a34a;
    color: #fff;
}

.badge-sell {
    background: #dc2626;
    color: #fff;
}

.badge-hold {
    background: #6b7280;
    color: #fff;
}

/* BB Position */
.bb-lower { color: #dc2626; font-weight: 500; }
.bb-upper { color: #16a34a; font-weight: 500; }
.bb-middle { color: #6b7280; font-weight: 500; }

/* Dist 200 */
.dist-positive { color: #16a34a; font-weight: 500; }
.dist-negative { color: #dc2626; font-weight: 500; }

/* Volume */
.vol-high { color: #16a34a; }
.vol-low { color: #6b7280; }

/* Cross */
.cross-positive { color: #16a34a; font-weight: 500; }
.cross-negative { color: #dc2626; font-weight: 500; }

/* Analysts bar */
.analysts-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.analysts-bar {
    width: 50px;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    background: #e5e7eb;
}

.analysts-bar-buy {
    background: #16a34a;
    height: 100%;
}

.analysts-bar-hold {
    background: #f59e0b;
    height: 100%;
}

.analysts-bar-sell {
    background: #dc2626;
    height: 100%;
}

/* EPS Surprises */
.eps-cell {
    display: flex;
    gap: 3px;
}

.eps-badge {
    display: inline-block;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    min-width: 36px;
    text-align: center;
}

.eps-positive {
    background: #dcfce7;
    color: #16a34a;
}

.eps-negative {
    background: #fef2f2;
    color: #dc2626;
}

.eps-neutral {
    background: #f3f4f6;
    color: #6b7280;
}

/* Last updated */
.last-updated {
    color: #9ca3af;
    font-size: 12px;
}

/* Info icon */
.info-icon {
    color: #9ca3af;
    cursor: help;
    font-size: 11px;
}

/* Fwd P/E */
.pe-value {
    font-weight: 500;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    display: inline-block;
    height: 14px;
    width: 50px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Context menu / delete */
.row-actions {
    position: relative;
}

.delete-btn {
    opacity: 0;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    transition: opacity 0.15s, color 0.15s;
}

tbody tr:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    color: #dc2626;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 12px;
    padding: 0;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    border: none !important;
    font-size: 20px;
    line-height: 1;
    padding: 4px 8px !important;
}

.modal-body {
    padding: 20px;
}

.modal-body input[type="text"],
.modal-body input[type="number"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.modal-body input:focus {
    border-color: #111;
}

.modal-hint {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 8px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
}

.setting-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 12px;
}

.setting-label input {
    margin-top: 6px;
}

.settings-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

/* Sort indicator */
th.sort-asc::after {
    content: ' ▲';
    font-size: 10px;
}

th.sort-desc::after {
    content: ' ▼';
    font-size: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    #app { padding: 12px; }
    .header { flex-direction: column; }
    .header-right { flex-wrap: wrap; }
    .stock-count { display: none; }
}

/* Scrollbar */
.table-container::-webkit-scrollbar {
    height: 6px;
}
.table-container::-webkit-scrollbar-track {
    background: #f3f4f6;
}
.table-container::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

/* GuruFocus link */
.guru-link {
    color: #2563eb;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
}

.guru-link:hover {
    text-decoration: underline;
    color: #1d4ed8;
}

/* Empty/dash */
.dash {
    color: #d1d5db;
}
