/* L2 Capital Research Portal */
:root {
    --bg:      #f0f2f5;
    --surface: #ffffff;
    --border:  #e2e5ea;
    --fg:      #111827;
    --muted:   #6b7280;
    --accent:  #e94560;
    --accent-h:#c73350;
    --success: #16a34a;
    --warning: #b45309;
    --danger:  #dc2626;
    --radius:  6px;
    --shadow:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
    --font-mono: "SF Mono", Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.5;
    min-height: 100vh;
}

/* ── Header ── */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
header h1 { margin: 0; font-size: 1.05rem; font-weight: 300; letter-spacing: 5px; text-transform: uppercase; }
header h1 a { color: var(--fg); text-decoration: none; }
header h1 a .brand-accent { color: var(--accent); }

header nav a, .btn-text {
    margin-left: 1.2rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.15s;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}
header nav a:hover, .btn-text:hover { color: var(--fg); }

.nav-user { margin-left: 1.2rem; color: var(--muted); font-size: 0.875rem; }

/* ── Layout ── */
main { max-width: 1100px; margin: 1.5rem auto; padding: 0 1.5rem; }

/* ── Cards ── */
.submit-card, .reports-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}

.card-narrow { max-width: 400px; margin: 4rem auto 0; }

h2 { margin-top: 0; font-size: 1.05rem; font-weight: 600; color: var(--fg); }

.hint  { color: var(--muted); font-size: 0.85rem; margin: 0.5rem 0 0; }
.muted { color: var(--muted); }

/* ── Forms ── */
.ticker-form { display: flex; gap: 0.5rem; }

input, select, textarea {
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--fg);
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233,69,96,0.12);
}
input::placeholder, textarea::placeholder { color: var(--muted); }

.ticker-form input { flex: 0 0 200px; text-transform: uppercase; font-size: 0.95rem; }

.settings-form .field { margin-bottom: 1rem; }
.settings-form label { display: block; font-weight: 500; font-size: 0.875rem; margin-bottom: 0.3rem; }
.settings-form input, .settings-form select, .settings-form textarea { width: 100%; }
.settings-form textarea { font-family: var(--font-mono); font-size: 0.8rem; }

/* ── Buttons ── */
button[type="submit"]:not(.action-link):not(.btn-text),
.ticker-form button {
    padding: 0.5rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 500;
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}
button[type="submit"]:not(.action-link):not(.btn-text):hover,
.ticker-form button:hover { background: var(--accent-h); }
button[type="submit"]:disabled { opacity: 0.5; cursor: wait; }

/* ── Table ── */
.reports-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.reports-table th, .reports-table td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.reports-table th { color: var(--muted); font-weight: 500; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.reports-table tbody tr:last-child td { border-bottom: none; }
.reports-table tbody tr:hover { background: #f8f9fa; }
.reports-table .ticker { font-weight: 600; }
.reports-table .ts { color: var(--muted); white-space: nowrap; }
.reports-table .actions-cell { white-space: nowrap; }
.smtp-table th { width: 30%; }
.mono { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }

/* column widths */
.col-ticker  { width: 72px; }
.col-created { width: 180px; }
.col-status  { width: 110px; }
.col-model   { width: 170px; }
.col-actions { width: 200px; }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f3f4f6;
    color: var(--muted);
}
.badge-done    { background: #dcfce7; color: var(--success); }
.badge-failed  { background: #fee2e2; color: var(--danger); }
.badge-pending,
.badge-running { background: #fef3c7; color: var(--warning); }

/* ── Action links ── */
.action-link {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius);
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    vertical-align: middle;
    line-height: 1.6;
    margin-right: 0.25rem;
    transition: background 0.15s, border-color 0.15s;
}
.action-link:hover { background: var(--accent-h); border-color: var(--accent-h); }
.action-secondary { background: transparent; border-color: var(--border); color: var(--muted); }
.action-secondary:hover { background: #f3f4f6; color: var(--fg); border-color: #d1d5db; }
.action-danger { background: transparent; border-color: var(--border); color: var(--muted); }
.action-danger:hover { background: #fee2e2; color: var(--danger); border-color: #fca5a5; }

.inline-form { display: inline; margin: 0; }

/* ── Flash messages ── */
.flashes { list-style: none; padding: 0; margin: 0 0 1rem; }
.flash {
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
}
.flash-success { background: #dcfce7; color: var(--success); border-color: #bbf7d0; }
.flash-error   { background: #fee2e2; color: var(--danger);  border-color: #fca5a5; }

/* ── Misc ── */
.error-msg { color: var(--danger); font-size: 0.8rem; margin-top: 0.3rem; }

.poll-indicator { margin-left: 0.6rem; font-size: 0.75rem; color: var(--success); font-weight: normal; }

.code-preview {
    white-space: pre-wrap;
    word-wrap: break-word;
    background: #f8f9fa;
    border: 1px solid var(--border);
    padding: 1em;
    border-radius: var(--radius);
    max-height: 400px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin: 0;
    color: var(--fg);
}

.smtp-hint { margin-bottom: 0.8rem; }
