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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0f1419;
    color: #e7e9ea;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid #2f3336;
}

header h1 {
    color: #1d9bf0;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    color: #71767b;
    font-size: 1.1rem;
}

.screener-form {
    background: #16181c;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid #2f3336;
}

.screener-form h2 {
    margin-bottom: 20px;
    color: #e7e9ea;
    font-size: 1.3rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.9rem;
    color: #71767b;
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    padding: 12px;
    border: 1px solid #2f3336;
    border-radius: 8px;
    background: #0f1419;
    color: #e7e9ea;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1d9bf0;
}

.form-group small {
    color: #71767b;
    font-size: 0.8rem;
    margin-top: 4px;
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #e7e9ea;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.criteria-info {
    background: #1e2732;
    border-radius: 12px;
    padding: 16px;
    margin: 20px 0;
}

.criteria-info h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #1d9bf0;
}

.criteria-info ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

.criteria-info li {
    color: #71767b;
    font-size: 0.9rem;
    padding-left: 20px;
    position: relative;
}

.criteria-info li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #00ba7c;
}

.btn-primary {
    background: #1d9bf0;
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
    margin-top: 10px;
}

.btn-primary:hover {
    background: #1a8cd8;
}

.btn-primary:disabled {
    background: #2f3336;
    cursor: not-allowed;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #2f3336;
    border-top-color: #1d9bf0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.results-section {
    background: #16181c;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #2f3336;
}

.results-section h2 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#resultCount {
    font-size: 0.9rem;
    color: #71767b;
    font-weight: normal;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.results-table th,
.results-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #2f3336;
}

.results-table th {
    color: #71767b;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.results-table tr:hover {
    background: #1e2732;
}

.results-table .ticker {
    font-weight: 600;
    color: #1d9bf0;
}

.results-table .positive {
    color: #00ba7c;
}

.results-table .negative {
    color: #f4212e;
}

.results-table .amber {
    color: #ffad1f;
}

.results-table .highlight {
    background: #1e2732;
    font-weight: 600;
}

.result-card {
    background: #1e2732;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.result-card-ticker {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1d9bf0;
}

.result-card-name {
    color: #71767b;
    font-size: 0.9rem;
}

.result-card-return {
    text-align: right;
}

.result-card-return .value {
    font-size: 1.8rem;
    font-weight: 700;
}

.result-card-return .label {
    font-size: 0.8rem;
    color: #71767b;
}

.result-card-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-item .label {
    font-size: 0.8rem;
    color: #71767b;
}

.detail-item .value {
    font-size: 1.1rem;
    font-weight: 500;
}

.positive {
    color: #00ba7c;
}

.negative {
    color: #f4212e;
}

.amber {
    color: #ffad1f;
}

.error-message {
    background: #2d1215;
    border: 1px solid #f4212e;
    color: #f4212e;
    padding: 16px;
    border-radius: 12px;
    margin-top: 20px;
}

.hidden {
    display: none;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #71767b;
}

.result-card-footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #2f3336;
    text-align: center;
}

.chart-link {
    display: inline-block;
    color: #1d9bf0;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 10px 20px;
    border: 1px solid #1d9bf0;
    border-radius: 9999px;
    transition: all 0.2s;
}

.chart-link:hover {
    background: #1d9bf0;
    color: white;
}

/* Auth pages */

.auth-card {
    max-width: 420px;
    margin: 80px auto;
    background: #16181c;
    border: 1px solid #2f3336;
    border-radius: 16px;
    padding: 40px;
}

.auth-card h1 {
    color: #1d9bf0;
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 4px;
}

.auth-card h2 {
    color: #71767b;
    font-size: 1.1rem;
    font-weight: 400;
    text-align: center;
    margin-bottom: 24px;
}

.auth-card .form-group {
    margin-bottom: 16px;
}

.auth-card .btn-primary {
    margin-top: 8px;
}

.recaptcha-wrap {
    display: flex;
    justify-content: center;
    margin: 16px 0 8px;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    color: #71767b;
    font-size: 0.9rem;
}

.auth-link a {
    color: #1d9bf0;
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* Flash messages */

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.flash-error {
    background: #2d1215;
    border: 1px solid #f4212e;
    color: #f4212e;
}

.flash-success {
    background: #0d2818;
    border: 1px solid #00ba7c;
    color: #00ba7c;
}

.flash-info {
    background: #0d1d2d;
    border: 1px solid #1d9bf0;
    color: #1d9bf0;
}

/* Header nav (logged-in) */

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-email {
    color: #71767b;
    font-size: 0.9rem;
}

.nav-link {
    color: #1d9bf0;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 14px;
    border: 1px solid #2f3336;
    border-radius: 9999px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: #1d9bf0;
    color: white;
    border-color: #1d9bf0;
}

/* Admin table */

.admin-table-wrap {
    background: #16181c;
    border: 1px solid #2f3336;
    border-radius: 16px;
    overflow: hidden;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.admin-table th {
    text-align: left;
    padding: 14px 16px;
    color: #71767b;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    border-bottom: 1px solid #2f3336;
}

.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #2f3336;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: #1e2732;
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-approved {
    background: #0d2818;
    color: #00ba7c;
}

.badge-pending {
    background: #2d1f0d;
    color: #ffad1f;
}

.badge-admin {
    background: #0d1d2d;
    color: #1d9bf0;
}

.btn-small {
    padding: 4px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-small:hover {
    opacity: 0.85;
}

.btn-approve {
    background: #00ba7c;
    color: white;
}

.btn-revoke {
    background: #ffad1f;
    color: #0f1419;
}

.btn-delete {
    background: #f4212e;
    color: white;
}

.actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.muted {
    color: #71767b;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .results-table {
        font-size: 0.8rem;
    }

    .results-table th,
    .results-table td {
        padding: 8px;
    }

    .header-top {
        flex-direction: column;
        gap: 12px;
    }

    .admin-table {
        font-size: 0.8rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 10px;
    }
}
