/* jennico · shared dashboard — modern, warm, calm.
   Light + dark via prefers-color-scheme. */

:root {
  --sage: #6f8f6a;
  --sage-600: #5c7a58;
  --terracotta: #c9714e;
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --text: #23271f;
  --muted: #6d7168;
  --border: #e3dfd6;
  --pos: #2f8f5b;
  --neg: #c0503a;
  --shadow: 0 1px 2px rgba(30, 35, 25, 0.04), 0 8px 24px rgba(30, 35, 25, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sage: #8fae89;
    --sage-600: #7c9c76;
    --terracotta: #d98a67;
    --bg: #0f1512;
    --surface: #171d19;
    --surface-2: #1e2621;
    --text: #e7eae4;
    --muted: #9aa197;
    --border: #2a332c;
    --pos: #57c98a;
    --neg: #e07a63;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
button { font-family: inherit; cursor: pointer; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 0.9em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Buttons */
.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.1rem;
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--sage); color: #fff; }
.btn-primary:hover { background: var(--sage-600); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; border-color: var(--border); color: var(--neg); }
.btn-danger:hover { background: color-mix(in srgb, var(--neg) 12%, transparent); }
.icon-btn { background: none; border: none; color: var(--muted); font-size: 1rem; padding: 6px; border-radius: 8px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; letter-spacing: -0.02em; font-size: 1.15rem; }
.brand .leaf { font-size: 1.2rem; }

/* Language switch (EN | NL) */
.lang-switch { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px; gap: 2px; }
.lang-opt {
  border: none; background: transparent; color: var(--muted);
  font-weight: 700; font-size: 0.72rem; letter-spacing: 0.03em;
  padding: 0.28rem 0.6rem; border-radius: 999px; line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}
.lang-opt:hover { color: var(--text); }
.lang-opt.active { background: var(--sage); color: #fff; }
.login-lang { position: absolute; top: 1.25rem; right: 1.25rem; }

/* ---------- Login ---------- */
.login-view {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  background:
    radial-gradient(1200px 600px at 15% -10%, color-mix(in srgb, var(--sage) 22%, transparent), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--terracotta) 18%, transparent), transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.login-card h1 { font-size: 1.5rem; margin-top: 0.75rem; }
.login-card .brand { margin-bottom: 0.25rem; }
.login-card label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-top: 0.75rem; }
.login-foot { text-align: center; margin-top: 1.25rem; }
input, select, textarea {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sage) 25%, transparent); }
textarea { resize: vertical; min-height: 84px; }
.form-error { color: var(--neg); font-size: 0.85rem; margin: 0.5rem 0 0; }
.login-card .btn-primary { margin-top: 1.1rem; padding: 0.7rem; }

/* ---------- App shell ---------- */
.app { min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.7rem 1.25rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.tabs { display: flex; gap: 0.25rem; margin: 0 auto 0 1rem; }
.tab {
  background: none; border: none; color: var(--muted);
  padding: 0.5rem 0.9rem; border-radius: 999px; font-weight: 600; font-size: 0.92rem;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.active { color: #fff; background: var(--sage); }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
#who { font-weight: 600; font-size: 0.9rem; }

.view { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.view-title { font-size: 1.6rem; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.view-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.search { width: auto; min-width: 180px; }
#dashboard .view-title { margin-bottom: 1.25rem; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: 0.35rem; box-shadow: var(--shadow);
}
.stat-label { color: var(--muted); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.panel-head h3 { font-size: 1.05rem; }
.chart-wrap { position: relative; width: 100%; }

/* Recipes */
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.recipe-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem; display: flex; flex-direction: column; gap: 0.6rem;
  cursor: pointer; transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.recipe-card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(30,35,25,.08), 0 16px 40px rgba(30,35,25,.10); }
.recipe-card h3 { font-size: 1.1rem; }
.recipe-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chip { font-size: 0.75rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip.cat { background: color-mix(in srgb, var(--sage) 18%, transparent); color: var(--sage-600); }
.recipe-card p { margin: 0; color: var(--muted); font-size: 0.9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Holdings table */
.table-scroll { overflow-x: auto; }
.holdings-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.holdings-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
.holdings-table td { padding: 0.75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.holdings-table tr:last-child td { border-bottom: none; }
.holdings-table .ticker { font-weight: 700; }
.holdings-table .sub { color: var(--muted); font-size: 0.8rem; }
.owner-tag { font-size: 0.72rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.row-actions { display: flex; gap: 0.25rem; justify-content: flex-end; }
.stale-dot { color: var(--terracotta); cursor: help; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1.25rem; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 20, 16, 0.5); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; width: 100%; max-width: 520px; max-height: 88dvh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-body { padding: 1.25rem; display: grid; gap: 0.9rem; }
.modal-body label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.modal-foot { display: flex; justify-content: flex-end; gap: 0.6rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.modal-view-block { white-space: pre-wrap; }
.modal-view-block h4 { margin: 0 0 0.3rem; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }

/* Toast */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 0.7rem 1.15rem; border-radius: 999px;
  font-size: 0.9rem; font-weight: 600; box-shadow: var(--shadow); z-index: 60;
}
.toast.err { background: var(--neg); color: #fff; }

/* Responsive */
@media (max-width: 760px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .tabs { order: 3; width: 100%; margin: 0.25rem 0 0; justify-content: center; }
  .topbar { flex-wrap: wrap; }
  .form-row { grid-template-columns: 1fr; }
}
