/* Wealth Dashboard - clean, white, minimal style */

:root {
    --bg: #f7f8fa;
    --surface: #ffffff;
    --border: #e6e8eb;
    --text: #1c2128;
    --text-muted: #6b7280;
    --accent: #0f6fde;
    --accent-dark: #0b57b0;
    --pos: #12805c;
    --pos-bg: #e6f4ee;
    --neg: #c22a2a;
    --neg-bg: #fbe9e9;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

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

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

h1, h2, h3 { font-weight: 600; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

/* --- Layout shell --- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
}
.sidebar .brand {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 24px;
    padding: 0 8px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
    color: var(--text);
    padding: 9px 10px;
    border-radius: 8px;
    font-weight: 500;
}
.sidebar nav a:hover { background: var(--bg); text-decoration: none; }
.sidebar nav a.active { background: #eaf2fd; color: var(--accent-dark); }
.sidebar .logout { padding: 9px 10px; color: var(--text-muted); font-size: 13px; }

.main { flex: 1; padding: 28px 32px; max-width: 1180px; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}
.topbar .updated { color: var(--text-muted); font-size: 12.5px; }

/* --- Cards --- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 26px;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.card .label { color: var(--text-muted); font-size: 12.5px; margin-bottom: 6px; }
.card .value { font-size: 21px; font-weight: 650; }
.card .sub { font-size: 12.5px; margin-top: 4px; }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 22px;
    overflow: hidden;
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.panel-body { padding: 18px; }

/* --- Allocation bar --- */
.alloc-bar {
    display: flex;
    height: 10px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
    background: var(--bg);
}
.alloc-bar span { height: 100%; }
.alloc-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-muted); }
.alloc-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

/* --- Tables --- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
td.name-cell { white-space: normal; }
td.wrap { white-space: normal; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.asset-name { font-weight: 600; }
.asset-sub { color: var(--text-muted); font-size: 12px; }
.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--bg);
    color: var(--text-muted);
}
.row-actions a { margin-left: 10px; font-size: 12.5px; }

.pos { color: var(--pos); }
.neg { color: var(--neg); }
.pos-bg { background: var(--pos-bg); color: var(--pos); }
.neg-bg { background: var(--neg-bg); color: var(--neg); }

/* --- Forms --- */
form { display: flex; flex-direction: column; gap: 14px; max-width: 480px; }
form.inline { flex-direction: row; align-items: flex-end; gap: 10px; max-width: none; flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 13px; color: var(--text); }
input, select, textarea {
    font: inherit;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #cfe1fb; border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 620px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
}
.btn:hover { text-decoration: none; background: var(--bg); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger { color: var(--neg); border-color: #f3caca; }
.btn-danger:hover { background: var(--neg-bg); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.hint { color: var(--text-muted); font-size: 12.5px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin: 0 0 6px; }
.alert-error { background: var(--neg-bg); color: var(--neg); }
.alert-ok { background: var(--pos-bg); color: var(--pos); }

code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 12.5px; }

/* --- Auth pages --- */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}
.auth-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 34px 32px;
    width: 340px;
}
.auth-box h1 { font-size: 19px; margin-bottom: 18px; }

/* --- Chart --- */
.chart-wrap { position: relative; height: 280px; }

@media (max-width: 820px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; }
    .sidebar nav { flex-direction: row; }
    .sidebar .brand { margin: 0 12px 0 0; }
    .main { padding: 18px; }
    .form-grid { grid-template-columns: 1fr; }
}
