:root {
  --background: #fafafa;
  --foreground: #222222;
  --foreground-muted: #2222227f;
  --primary: #0d6efd;
  --primary-muted: #8ebbff;
  --error: #dc3545;
  --size-extra-small: 0.3rem;
  --size-small: 0.5rem;
}

html {
  font-size: 20px;
}

* {
  line-height: 1.5;
}

body {
  background-color: var(--background);
  color: var(--foreground);
  max-width: 95%;
  font-family: -apple-system, sans-serif;
  margin: 2rem auto 4rem auto;
}

img {
  max-width: 100%;
  page-break-after: always;
}

a,
a:visited {
  color: var(--primary);
}

h1 {
  font-size: 1.953rem;
  line-height: 1.1;
}

h2 {
  font-size: 1.563rem;
  line-height: 1.2;
}

h3 {
  font-size: 1.25rem;
  line-height: 1.4;
  margin: 1rem auto 1rem auto;
}

h1,
h2 {
  margin: 2rem auto 1rem auto;
}

p,
ul,
ol {
  margin: 1rem 0;
}

img {
  margin: 2rem 0;
}

a>*,
.flex>* {
  margin: 0;
}

.border {
  border: 1px solid var(--foreground);
}

.muted {
  color: var(--foreground-muted);
}

.flex {
  display: flex;
  gap: 1rem;
}

.column {
  flex-direction: column;
}

.row {
  flex-direction: row;
  align-items: center;
}

.centred {
  justify-content: center;
  align-items: center;
}

nav > div {
  display: flex;
  flex-direction: column;
  gap: var(--size-extra-small);
  flex-wrap: wrap;
}

nav .line {
  display: flex;
  gap: var(--size-extra-small);
  flex-wrap: wrap;
}

nav .line div.left + div.left::before,
nav .line div.right + div.right::before {
  content: "·";
  margin-right: var(--size-extra-small);
}

nav .line .gap {
  margin: auto;
}

footer {
  margin-top: 2rem;
  font-size: 0.75rem;
}

footer nav {
  gap: var(--size-extra-small);
}

/* Home */

.slogan {
  text-align: center;
  font-size: 1.4rem;
  font-weight: bold;
  width: 70%;
  margin: 60px auto;
}

/* Forms */

fieldset {
  border: none;
}

form {
  display: table;
}

fieldset > div {
  display: table-row;
}

label,
input,
legend,
select {
  display: table-cell;
}

form > div {
  margin-bottom: 12px;
}

legend {
  font-weight: bold;
}

label {
  font-weight: bold;
  padding-right: 10px;
}

select {
  width: 100%;
  padding: 4px;
}

a:visited.button,
.button {
  display: inline-block;
  text-decoration: none;
}

input,
input[type="submit"],
button,
select,
.button {
  border: 1px solid #999;
  border-radius: 2px;
  -webkit-border-radius: 2px;
  font-size: 1rem;
}

input[type="email"] {
  width: 300px;
}

input[type="submit"],
button,
a:visited.button,
.button {
  padding: 4px 8px;
  font-weight: bold;
  background-color: #eee;
  color: var(--foreground);
}

input[type="submit"]:disabled,
button:disabled {
  border: 1px solid #ccc;
  background-color: #f0f0f0;
  color: #ccc;
}

.primary {
  background-color: var(--primary);
  color: var(--background);
  border: 1px solid var(--primary);
}

button.primary:disabled {
  background-color: var(--primary-muted);
  border: 1px solid var(--primary-muted);
  color: #fff;
}

input[type="submit"].small,
button.small {
  font-size: 0.7rem;
}

input[type="date"],
input[type="datetime-local"] {
  font-family: -apple-system, sans-serif;
}

p.help {
  color: #666;
  font-size: 0.8rem;
}

/* Tables */

table {
  border-top: 1px solid #999;
  border-left: 1px solid #999;
  border-spacing: 0;
  width: 100%;
}

td, th {
  border-right: 1px solid #999;
  border-bottom: 1px solid #999;
}

th {
  background-color: #ccc;
}

td {
  padding: 2px 6px;
}

tbody > tr:nth-of-type(even) {
  background-color: #eee;
}

.operation {
  text-align: center;
}

.numeric_value {
  text-align: right;
}

/* Layout */

#content {
  display: none;
}

#info_message,
#error_message {
  padding: 0.5rem;
  color: #fff;
  display: none;
}

#info_message {
  background-color: var(--primary);
}

#error_message {
  background-color: var(--error);
}

@media (min-width: 880px) {
  body {
    max-width: 850px;
    -webkit-text-size-adjust: none;
  }
}

/* Calendar */

#calendar_header {
  display: flex;
  align-items: baseline;
}

#calendar_header h2 {
  flex-grow: 1;
  text-align: center;
}

#calendar table {
  table-layout: fixed;
}

#calendar td {
  vertical-align: top;
  width: 14%;
  overflow: hidden;
  padding: 2px;
}

#calendar .weekend,
#calendar .prev_month,
#calendar .next_month {
  color: #999;
}

#calendar .day {
  display: flex;
  flex-direction: column;
}

#calendar ul {
  margin: 0;
  padding: 0;
}

#calendar li {
  list-style-type: none;
}

#calendar .appointments {
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#calendar .appointment {
  display: flex;
  flex-direction: column;
  background-color: #eee;
  border: 1px solid #ccc;
  border-radius: 2px;
  padding: 2px;
  color: var(--foreground);
}

#calendar .appointment.control {
  background-color: #e8ffe8;
}

#calendar .appointment.first_visit {
  background-color: #ffe1fa;
}

#calendar .appointment.iris {
  background-color: #fffce5;
}

#calendar .appointment.bioimpedance {
  background-color: #e2faff;
}

#calendar .appointment.integration {
  background-color: #ffe7e7;
}

#calendar .appointment.bach {
  background-color: #e8e6ff;
}

#calendar .appointment .first_line {
  display: flex;
  justify-content: space-between;
}

#calendar .appointment .appointment_type {
  font-size: 0.6rem;
  color: #999;
}

#calendar .appointment .reminder_sent {
  font-size: 0.5rem;
}

/* Message thread */

#messages_list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.message {
  border: 1px solid #ccc;
  border-radius: 16px;
  padding: 8px 12px;
  width: 80%;
}

.message.filodiretto {
  text-align: right;
  background-color: #ecfce7;
  border: 1px solid #b8feb8;
  margin-left: auto;
}

.message time {
  font-size: 0.8rem;
  color: #999;
}

/* Weights + Waist/hip measurements */

#weights_table {
  width: 500px;
}

#waist_hips_table {
  width: 550px;
}

#add_weight_form,
#add_waist_hip_form {
  display: flex;
  font-size: 0.7rem;
  align-items: flex-end;
  column-gap: 12px;
  margin-top: 12px;
  margin-bottom: 12px;
}

#add_weight_form label,
#add_weight_form input,
#add_waist_hip_form label,
#add_waist_hip_form input {
  display: block;
  font-size: 0.7rem;
  width: 108px;
}

/* Dynamic elements */

#authenticated {
  display: none;
}
