:root {
    --bg: #f5f6fa;
    --card: #fff;
    --primary: #2563eb;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1600px; margin: 0 auto; padding: 0 1rem; }

/* Nav */
nav {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    margin-bottom: 1.5rem;
}
nav .container { display: flex; align-items: center; gap: 2rem; }
nav .brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
nav .links { display: flex; gap: 1.5rem; }
nav .links a { color: var(--muted); font-size: 0.9rem; }
nav .links a.active { color: var(--primary); font-weight: 600; }
nav .spacer { flex: 1; }
nav .logout { color: var(--muted); font-size: 0.85rem; }

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--muted); gap: 0.25rem; }
.filters input, .filters select {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
}
.filters button {
    padding: 0.4rem 1rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; min-width: 900px; }
th { text-align: left; color: var(--muted); font-weight: 600; padding: 0.5rem; border-bottom: 2px solid var(--border); }
td { padding: 0.5rem; border-bottom: 1px solid var(--border); }
tr:hover { background: #f8fafc; }
.mono { font-family: "SF Mono", "Fira Code", monospace; font-size: 0.8rem; }
.addr { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; cursor: pointer; }
.addr.expanded { max-width: none; overflow: visible; white-space: normal; word-break: break-all; }

/* Pagination */
.pagination { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1rem; }
.pagination a, .pagination span {
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
}
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Analytics */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { text-align: center; }
.stat-card .value { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 0.85rem; color: var(--muted); }

.section-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; }

/* Login */
.login-wrap { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { font-size: 1.3rem; margin-bottom: 1rem; text-align: center; }
.login-card .field { margin-bottom: 0.75rem; }
.login-card label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.25rem; }
.login-card input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.95rem;
}
.login-card button {
    width: 100%;
    padding: 0.6rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    cursor: pointer;
}
.login-card .error { color: #dc2626; font-size: 0.85rem; margin-bottom: 0.75rem; text-align: center; }

/* PnL colors */
.text-green { color: #16a34a; }
.text-red { color: #dc2626; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: 4px;
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--border);
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { opacity: 0.9; }
.btn-outline { background: var(--card); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
