:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #5b6b7b;
  --accent: #0b66c3;
  --accent-dark: #094f97;
  --ok: #1e8e3e;
  --warn: #e8a100;
  --bad: #d93025;
  --verybad: #a50e0e;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { font-size: 18px; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
header.topbar {
  background: var(--accent);
  color: #fff;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
header.topbar h1 { font-size: 1.15rem; margin: 0; }
header.topbar a {
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
  background: rgba(255,255,255,0.18);
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
}
main { max-width: 860px; margin: 0 auto; padding: 1rem; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(16,30,50,0.08);
}
.card h2 { margin: 0 0 0.8rem; font-size: 1.05rem; color: var(--muted); }

.person-buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.person-buttons button {
  font-size: 1.25rem;
  padding: 0.9rem 1.5rem;
  border: 2px solid var(--accent);
  background: #fff;
  color: var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
}
.person-buttons button.selected { background: var(--accent); color: #fff; }

label { display: block; font-size: 1rem; color: var(--muted); margin-bottom: 0.25rem; }
input, select, textarea {
  width: 100%;
  font-size: 1.35rem;
  padding: 0.6rem 0.7rem;
  border: 1.5px solid #c3cdd8;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
textarea { font-size: 1.05rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.8rem; }
.field { margin-bottom: 0.9rem; }

.toggle { display: flex; gap: 0.6rem; }
.toggle button {
  flex: 1;
  font-size: 1.15rem;
  padding: 0.8rem;
  border: 2px solid #c3cdd8;
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  color: var(--muted);
}
.toggle button.selected { border-color: var(--accent); background: #e8f1fb; color: var(--accent-dark); font-weight: 600; }

.btn-big {
  width: 100%;
  font-size: 1.5rem;
  padding: 1rem;
  background: var(--ok);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
}
.btn-big:disabled { opacity: 0.6; }
.btn {
  font-size: 1rem;
  padding: 0.55rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 9px;
  cursor: pointer;
}
.btn.secondary { background: #e3e9f0; color: var(--text); }
.btn.danger { background: var(--bad); }

.msg-ok {
  background: #e6f4ea;
  color: var(--ok);
  border-radius: 10px;
  padding: 0.8rem;
  font-size: 1.15rem;
  text-align: center;
  margin-top: 0.8rem;
}
.msg-err {
  background: #fdecea;
  color: var(--bad);
  border-radius: 10px;
  padding: 0.8rem;
  font-size: 1.05rem;
  text-align: center;
  margin-top: 0.8rem;
}
.hidden { display: none !important; }

table { width: 100%; border-collapse: collapse; font-size: 1rem; }
th, td { padding: 0.55rem 0.5rem; text-align: left; border-bottom: 1px solid #e4e9ef; }
th { color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.bp { font-weight: 700; }
.bp.cat-normal { color: var(--ok); }
.bp.cat-ridicat { color: var(--warn); }
.bp.cat-hta1 { color: var(--bad); }
.bp.cat-hta2 { color: var(--verybad); }
.state-tag {
  font-size: 0.85rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #e3e9f0;
  color: var(--muted);
}
.range-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.range-buttons button {
  font-size: 1rem;
  padding: 0.5rem 1rem;
  border: 2px solid #c3cdd8;
  background: #fff;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
}
.range-buttons button.selected { border-color: var(--accent); background: #e8f1fb; color: var(--accent-dark); font-weight: 600; }

#pin-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
#pin-overlay .card { width: 100%; max-width: 380px; text-align: center; }
#pin-overlay input { text-align: center; letter-spacing: 0.3rem; }

.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e4e9ef;
  font-size: 1.05rem;
}
.legend-hint { font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem; }

dialog {
  border: none;
  border-radius: var(--radius);
  padding: 1.2rem;
  width: min(95vw, 460px);
}
dialog::backdrop { background: rgba(0,0,0,0.4); }

/* Pe mobil: totul mult mai mare, pentru vedere slaba. */
@media (max-width: 900px) {
  html { font-size: 19px; }
  main { padding: 0.7rem; }
  .grid3 { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }

  .card h2 { font-size: 1.1rem; }
  label { font-size: 1.05rem; font-weight: 600; color: var(--text); }

  input, select, textarea {
    font-size: 1.5rem;
    padding: 0.7rem 0.8rem;
    border-width: 2px;
  }
  input[type="datetime-local"] { font-size: 1.15rem; }
  textarea { font-size: 1.1rem; }

  .person-buttons { flex-direction: column; }
  .person-buttons button {
    width: 100%;
    font-size: 1.4rem;
    padding: 0.9rem;
  }

  .toggle button { font-size: 1.2rem; padding: 0.85rem; }
  .btn-big { font-size: 1.5rem; padding: 1rem; }
  .btn { font-size: 1.05rem; padding: 0.65rem 1.05rem; }

  .recent-item { font-size: 1.1rem; }
  .msg-ok { font-size: 1.2rem; }
  .msg-err { font-size: 1.1rem; }

  th, td { padding: 0.6rem 0.45rem; font-size: 1rem; }
  .range-buttons button { font-size: 1.05rem; padding: 0.6rem 1rem; }

  #pin-overlay input { font-size: 1.9rem; }
}
