/* =============================================================
   Pension Modeller — app.css
   Mobile-first. No framework dependencies.
   ============================================================= */

:root {
  --navy-900: #0f2440;
  --navy-700: #1d3f66;
  --blue-500: #3a7bd5;
  --blue-300: #8fb8ec;
  --blue-100: #dceafc;
  --blue-50:  #f2f7fd;

  --paper:    #f4f6f9;
  --surface:  #ffffff;
  --border:   #d8e0ea;
  --border-md:#b9c8db;

  --text:      #16233a;
  --text-mid:  #3d4f6b;
  --text-muted:#6b7c94;

  --success-bg: #e4f6ee;
  --success-text: #146c43;
  --success-border: #2fb380;

  --error-bg:  #fde8e8;
  --error-text:#7c2020;
  --error-border:#e63946;

  --warning-bg: #fff4e0;
  --warning-text: #7a4a05;
  --warning-border: #f0a63a;

  --info-bg: #e8f1fd;
  --info-text: #1d466e;
  --info-border: #3a7bd5;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 4px rgba(15,36,64,0.07);
  --shadow-md: 0 3px 14px rgba(15,36,64,0.09);

  --nav-h: 54px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--paper);
  color: var(--text);
  min-height: 100vh;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
a { color: var(--blue-500); }
a:hover { color: var(--navy-700); }

/* --- Navigation ------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--navy-900);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  min-height: var(--nav-h);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.nav__brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.nav__brand:hover { color: var(--blue-300); text-decoration: none; }
.nav__brand-icon { font-size: 1.3rem; line-height: 1; }
.nav__links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav__link {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav__link:hover, .nav__link--active {
  color: #fff;
  background: rgba(255,255,255,0.12);
  text-decoration: none;
}
.nav__logout-form { display: inline; margin: 0; }
.nav__logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.8);
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.nav__logout:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* --- Page layout -------------------------------------------- */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}
.page__title { font-size: 1.5rem; margin-bottom: 0.35rem; color: var(--navy-900); }
.page__sub { color: var(--text-mid); margin-bottom: 1.25rem; max-width: 60ch; }

/* --- Sign-in / onboarding card -------------------------------- */
.signin-wrap {
  display: flex;
  justify-content: center;
  padding: 3rem 1rem;
}
.signin-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.signin-card--wide { max-width: 520px; text-align: left; }
.signin-card__logo { font-size: 2rem; margin-bottom: 0.5rem; }
.signin-card__title { font-size: 1.3rem; margin-bottom: 0.4rem; color: var(--navy-900); }
.signin-card__sub { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 1.25rem; }

/* --- Cards ---------------------------------------------------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}
.card__title { font-size: 1.1rem; color: var(--navy-900); margin-bottom: 0.75rem; }
.card__sub { color: var(--text-mid); font-size: 0.92rem; margin-bottom: 0.75rem; }

/* --- Forms ------------------------------------------------- */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.form-group {
  flex: 1 1 200px;
  margin-bottom: 0.9rem;
  text-align: left;
}
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 0.3rem;
}
.form-label__hint { font-weight: 400; color: var(--text-muted); }
.form-input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}
.form-input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px var(--blue-100);
}
.form-hint { font-size: 0.85rem; color: var(--text-muted); }
.fields-group { border-top: 1px dashed var(--border); padding-top: 0.75rem; margin-top: 0.25rem; }

/* --- Buttons -------------------------------------------------- */
.btn {
  display: inline-block;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.1rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s;
}
.btn:hover { filter: brightness(0.95); }
.btn--primary { background: var(--blue-500); color: #fff; }
.btn--ghost { background: transparent; color: var(--text-mid); border: 1px solid var(--border-md); }
.btn--small { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.btn--danger { background: var(--error-bg); color: var(--error-text); }
.btn--full { width: 100%; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }

/* --- Alerts ----------------------------------------------- */
.alert {
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}
.alert--error   { background: var(--error-bg);   color: var(--error-text);   border: 1px solid var(--error-border); }
.alert--success { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-border); }
.alert--warning { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-border); }
.alert--info    { background: var(--info-bg);    color: var(--info-text);    border: 1px solid var(--info-border); }

.debug-link {
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  background: var(--info-bg);
  border: 1px dashed var(--info-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--info-text);
}

/* --- Tables --------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 0.5rem 0.6rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.02em; }
.table__actions { display: flex; gap: 0.4rem; }
.inline-form { display: inline; margin: 0; }

.badge {
  display: inline-block;
  background: var(--blue-100);
  color: var(--navy-700);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 0.35rem;
}

/* --- Charts ----------------------------------------------- */
.chart-wrap { position: relative; width: 100%; }

@media (max-width: 640px) {
  .page { padding: 1rem 0.75rem 2rem; }
  .card { padding: 1rem; }
  .nav__links { gap: 0; }
}
