/* ── AssetTracker — minimal institutional stylesheet ────────────── */

:root {
  --primary: #2c5282;
  --primary-light: #ebf4ff;
  --danger: #c53030;
  --text: #1a202c;
  --muted: #718096;
  --border: #e2e8f0;
  --bg: #f7fafc;
}

*, *::before, *::after { box-sizing: border-box; }

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

/* ── Navigation ───────────────────────────────────────────────── */

.topnav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--primary);
  padding: 0.6rem 1.5rem;
}
.topnav .brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}
.nav-links a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.9rem;
  margin-right: 1rem;
}
.nav-links a:hover { color: #fff; }

/* ── Container ────────────────────────────────────────────────── */

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

/* ── Typography ───────────────────────────────────────────────── */

h1 { margin: 0 0 1rem; }
h1 small { color: var(--muted); font-weight: 400; }
h2 { margin: 1.5rem 0 0.5rem; }
h3 { margin: 1.25rem 0 0.4rem; }

/* ── Tables ───────────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}
th, td {
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
th { background: var(--primary-light); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable a { color: var(--text); text-decoration: none; }
th.sortable::after { content: ' \2195'; color: var(--muted); font-size: 0.75rem; }
th.sort-asc::after { content: ' \2191'; color: var(--primary); }
th.sort-desc::after { content: ' \2193'; color: var(--primary); }
tbody tr:hover { background: #edf2f7; }

/* ── Pagination ───────────────────────────────────────────────── */

.pagination {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  margin: 1rem 0;
  font-size: 0.9rem;
}
.pagination a, .pagination .page-current, .pagination .page-ellipsis {
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  text-decoration: none;
}
.pagination a { color: var(--primary); border: 1px solid var(--border); }
.pagination a:hover { background: var(--primary-light); }
.pagination .page-current {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
}
.pagination .page-ellipsis { color: var(--muted); }

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
}
.per-page-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}
.per-page-form label {
  display: inline;
  margin: 0;
  font-weight: 400;
}
.per-page-form select {
  display: inline;
  width: auto;
  max-width: none;
  padding: 0.2rem 0.4rem;
  font-size: 0.85rem;
}
.pagination-total { color: var(--muted); font-size: 0.85rem; }

/* ── Forms ────────────────────────────────────────────────────── */

label { display: block; margin-top: 0.75rem; font-weight: 600; font-size: 0.9rem; }
input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
  display: block;
  width: 100%;
  max-width: 400px;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.95rem;
}
textarea { min-height: 4rem; }
fieldset { border: 1px solid var(--border); border-radius: 4px; padding: 0.5rem 1rem; margin-top: 0.75rem; }
.checkbox-label { display: block; font-weight: 400; margin-top: 0.25rem; }

/* ── Buttons ──────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  padding: 0.45rem 1rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  margin-top: 0.75rem;
}
.btn:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); }

/* ── Flash messages ───────────────────────────────────────────── */

.flash {
  padding: 0.6rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.flash-success { background: #c6f6d5; color: #22543d; }
.flash-warning { background: #fefcbf; color: #744210; }
.flash-error   { background: #fed7d7; color: #742a2a; }

/* ── Filter form (forecast pages) ─────────────────────────────── */

.filter-form {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}
.filter-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.filter-group { flex: 1; min-width: 150px; }
.filter-group label { margin-top: 0; }
.filter-group select { width: 100%; max-width: 100%; }
.filter-group small { color: var(--muted); font-size: 0.78rem; }
.filter-group input[type="number"] { width: 100%; max-width: 100%; }
.filter-actions { display: flex; gap: 0.5rem; }
.btn-secondary {
  display: inline-block;
  padding: 0.45rem 1rem;
  background: #718096;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  margin-top: 0.75rem;
}
.btn-secondary:hover { opacity: 0.9; }

/* ── Nav user & logout ────────────────────────────────────────── */

.nav-user {
  margin-left: auto;
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.nav-user a { color: rgba(255,255,255,0.85); text-decoration: none; }
.nav-user a:hover { color: #fff; }

/* ── Login page ───────────────────────────────────────────────── */

.login-box {
  max-width: 360px;
  margin: 3rem auto;
  background: #fff;
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.login-box h1 { font-size: 1.4rem; margin-bottom: 0.25rem; }
.login-box p { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.25rem; }
.login-box input { max-width: 100%; }

/* ── Funding fieldset ─────────────────────────────────────────── */

.funding-fieldset { max-width: 500px; }
.funding-fieldset legend { font-weight: 600; font-size: 0.9rem; }
.funding-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.4rem;
}
.funding-row select { flex: 2; max-width: none; }
.funding-row input[type="number"] { flex: 1; max-width: 90px; }
.btn-remove-funding {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.3rem;
}
