:root {
  --blue: #1166a2;       /* from the Purée logo */
  --blue-dark: #0c4f7f;
  --blue-light: #7fb0d4;
  --blue-tint: #e6f0f8;
  --bg: #f5f8fb;
  --card: #ffffff;
  --text: #17222c;
  --muted: #5f6b76;
  --border: #dbe4ec;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom);
}

.site-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 64px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--card);
  border-bottom: 3px solid var(--blue);
}
.logo { height: 56px; width: auto; display: block; }

.lang-toggle { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); margin: 0; }
.flag-btn {
  display: block;
  padding: 6px;
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  line-height: 0;
}
.flag-btn:focus-visible { outline: 2px solid var(--blue); }
.flag { width: 38px; height: 20px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }

/* Root page: logo only, dead centre on the logo's own white background */
html:has(body.splash) { background: #fff; }
body.splash {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0;
  background: #fff;   /* matches the logo image background */
  overflow: hidden;
}
body.splash .container { max-width: none; margin: 0; padding: 0; }
.splash-logo { display: block; width: min(90vw, 400px); height: auto; }

.container { max-width: 720px; margin: 0 auto; padding: 16px; }

h1 { font-size: 1.5rem; margin: 8px 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
}

.form label, .form legend { display: block; font-weight: 600; margin: 14px 0 6px; }
.form label:first-child, .form fieldset:first-child legend { margin-top: 0; }
.form fieldset { border: 0; padding: 0; margin: 0; }

/* 16px+ font prevents iOS zoom on focus */
input[type=text], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; min-height: 140px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; }

.radio {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin: 8px 0 !important;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 500 !important;
  cursor: pointer;
}
.radio input { width: 20px; height: 20px; accent-color: var(--blue); }

.btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  background: var(--blue);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.btn:active { background: var(--blue-dark); }
.btn-small { width: auto; display: inline-block; margin: 0; padding: 10px 16px; }

.alert { padding: 12px 16px; border-radius: 10px; margin: 16px 0; font-weight: 500; }
.alert.success { background: var(--blue-tint); color: var(--blue-dark); }
.alert.error { background: #fde8e6; color: #9b2216; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
}
.stat-num { display: block; font-size: 1.6rem; font-weight: 700; color: var(--blue); }
.stat-label { font-size: .8rem; color: var(--muted); }

.period-form { display: flex; align-items: center; gap: 10px; }
.period-form label { font-weight: 600; white-space: nowrap; }
.period-form select { flex: 1; }

.bar-row { margin: 10px 0; }
.bar-label { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; margin-bottom: 4px; }
.bar { height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--blue); border-radius: 5px; }
.bar-fill.alt { background: var(--blue-light); }

.entries { list-style: none; padding: 0; margin: 0; }
.entry { margin: 10px 0; }
.entry-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.chip { background: var(--blue-tint); color: var(--blue-dark); padding: 2px 10px; border-radius: 999px; font-weight: 600; }
.entry-text { margin: 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (min-width: 600px) {
  .logo { height: 68px; }
  .btn { width: auto; display: inline-block; padding: 12px 28px; }
}
