:root {
  color-scheme: light;
  --paper: #f4f6ef;
  --surface: #fffefa;
  --ink: #192c23;
  --muted: #53655a;
  --line: #dce3d7;
  --pine: #254e3a;
  --deep: #183c2f;
  --soft: #e9efe3;
  --lime: #dceca5;
  --rust: #aa5236;
  --focus: #497f6d;
  font: 100% / 1.48 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { background: var(--paper); color: var(--ink); margin: 0; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; color: inherit; }
input, select, textarea {
  min-height: 45px; width: 100%; background: #fff; color: var(--ink);
  border: 1px solid #c7d2c7; padding: 9px 11px; border-radius: 10px;
}
select { appearance: none; padding-right: 34px; background: #fff; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: ""; pointer-events: none; position: absolute; right: 15px; top: 18px;
  width: 8px; height: 8px; border: solid var(--pine); border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
textarea { min-height: 86px; resize: vertical; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--pine); }
input[type="file"] { padding: 8px; }
input::file-selector-button {
  font: inherit; color: var(--ink); background: var(--soft); border: 0; border-radius: 6px; margin-right: 10px; padding: 6px 10px;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, .serif { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
h1 { font-size: clamp(2.25rem, 5vw, 3.65rem); letter-spacing: -0.045em; line-height: 1.02; margin-bottom: 9px; }
h2 { font-size: clamp(1.55rem, 3vw, 2rem); letter-spacing: -0.02em; line-height: 1.12; margin-bottom: 8px; }
h3 { font-size: 1.015rem; line-height: 1.3; margin-bottom: 5px; }
p { margin-bottom: 10px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.muted { color: var(--muted); }
.meta { font-size: .86rem; color: var(--muted); }
.tiny { font-size: .78rem; color: var(--muted); }
.skip { position: fixed; left: -9999px; top: 8px; z-index: 9; background: #fff; padding: 8px 12px; }
.skip:focus { left: 8px; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 222px minmax(0, 1fr); }
.sidebar {
  padding: 29px 20px 23px; background: #eef2e9; border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 40px;
}
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; align-self: flex-start; }
.logo img { border-radius: 12px; object-fit: cover; }
.logo strong { display: block; font: 1.53rem Georgia, serif; font-weight: 600; line-height: 1; }
.logo small { display: block; margin-top: 3px; color: var(--muted); font-size: .75rem; white-space: nowrap; }
.mobile-logo { display: none; }
.main-nav { display: grid; gap: 5px; }
.main-nav a, .sidebar-backup {
  text-decoration: none; display: flex; gap: 12px; min-height: 46px; align-items: center;
  padding: 9px 12px; border: 0; border-radius: 11px; font-size: .92rem; font-weight: 550; background: transparent;
}
.main-nav a[aria-current="page"] { background: #dce9d8; color: #1c3e2c; font-weight: 700; }
.main-nav a:hover, .sidebar-backup:hover, .button.secondary:hover, .button.quiet:hover { background: var(--soft); }
.nav-icon { font-size: 1.26rem; line-height: 1; width: 22px; text-align: center; }
.sidebar-backup { align-self: flex-start; margin-top: auto; color: var(--muted); }
.main { max-width: 1380px; width: 100%; padding: 0 clamp(23px, 4vw, 63px) 48px; margin-inline: auto; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 67px; gap: 10px; }
.top-date { font-size: .89rem; font-weight: 600; color: var(--muted); }
.top-date::first-letter { text-transform: uppercase; }
#view { outline: none; }
.page-head { margin: 15px 0 23px; }
.page-head p { margin-bottom: 0; max-width: 62ch; }
.hero {
  position: relative; overflow: hidden; display: grid; align-items: center; min-height: 285px;
  border-radius: 25px; color: #fff;
  background: linear-gradient(90deg, rgba(17,43,32,.95) 0%, rgba(17,43,32,.77) 33%, rgba(17,43,32,.21) 78%),
    #284f3b url("./media/dolomiti.jpg") center 53% / cover no-repeat;
}
.hero-content { padding: clamp(26px, 4vw, 48px); max-width: 550px; }
.hero h1 { font-size: clamp(2.45rem, 5.25vw, 4.3rem); max-width: 11ch; }
.hero p { color: #e8f0df; max-width: 35ch; margin-bottom: 19px; }
.hero .button { margin-top: 4px; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 17px 0 20px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 17px; min-width: 0;
  padding: clamp(15px, 2vw, 24px);
}
.metric { padding: 15px clamp(12px, 1.4vw, 19px); min-height: 104px; }
.metric-label { color: var(--muted); font-size: .85rem; line-height: 1.25; display: block; margin-bottom: 8px; }
.metric-value { font-size: clamp(1.42rem, 2.8vw, 2rem); font-weight: 650; line-height: 1; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.metric-unit { color: var(--muted); font-size: .79rem; padding-left: 4px; letter-spacing: 0; font-weight: 400; }
.metric small { margin-top: 6px; display: block; }
.demo-line {
  display: flex; align-items: center; justify-content: space-between; gap: 6px 15px;
  flex-wrap: wrap; margin-top: 13px; margin-bottom: -6px;
}
.demo-line .meta { margin: 0; }
.two-column { display: grid; gap: 15px; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); align-items: start; }
.equal-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: grid; gap: 14px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 11px; }
.card-head p, .card-head h2 { margin-bottom: 0; }
.button {
  border: 1px solid transparent; border-radius: 10px; min-height: 44px; padding: 9px 14px; color: var(--ink);
  font-size: .9rem; font-weight: 650; text-decoration: none; text-align: center;
  background: transparent; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.button.primary { color: #fff; background: var(--pine); }
.button.primary:hover { background: #1b3d2d; }
.button.lime { background: var(--lime); color: #233711; }
.button.lime:hover { background: #edf7ca; }
.button.secondary { border-color: #c9d5c8; background: #fcfdf9; }
.button.quiet { color: var(--pine); border-color: transparent; }
.button.small { font-size: .84rem; min-height: 39px; padding: 7px 11px; }
.button.danger { color: #972e25; border-color: #e4bab3; }
.button.danger:hover { background: #fae8e4; }
.button.close { min-width: 43px; font-size: 1.65rem; padding: 0 8px; }
.button.block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions.spaced { margin-top: 14px; }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.row {
  width: 100%; min-height: 63px; border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; text-align: left;
  display: flex; align-items: center; gap: 12px; color: var(--ink); background: #fefffc;
}
button.row:hover { background: var(--soft); }
.row-main { display: flex; flex: 1; flex-direction: column; max-width: 100%; min-width: 0; overflow-wrap: anywhere; }
.row-main strong { font-size: .95rem; font-weight: 660; }
.row-main small { font-size: .82rem; color: var(--muted); }
.row-end { color: var(--pine); font-size: .85rem; font-weight: 650; white-space: nowrap; }
.ico { display: grid; place-items: center; color: var(--pine); min-width: 39px; height: 39px; border-radius: 9px; background: var(--soft); font-size: 1.2rem; }
.empty { color: var(--muted); padding: 19px 0 8px; margin: 0; }
.chart-wrap { width: 100%; }
.chart { display: block; width: 100%; height: 177px; }
.chart.tall { height: 231px; }
.chart-desc { font-size: .82rem; color: var(--muted); margin: 5px 0 0; }
.chart-data { font-size: .86rem; color: var(--muted); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.chart-data summary { min-height: 32px; cursor: pointer; }
.chart-data ul { columns: 2; padding-left: 21px; }
.inline-stats { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 11px 28px; margin: 4px 0 9px; }
.inline-stat span { display: block; font-size: .81rem; color: var(--muted); }
.inline-stat strong { font-size: 1.51rem; letter-spacing: -.035em; font-weight: 650; }
.tabs { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px; border-radius: 11px; background: var(--soft); align-self: start; width: fit-content; }
.tabs button {
  border: 0; background: transparent; min-height: 39px; padding: 7px 14px; border-radius: 8px; color: var(--ink); font-size: .9rem;
}
.tabs button[aria-pressed="true"] { background: var(--pine); color: white; }
label.field { display: grid; gap: 5px; align-content: start; font-size: .88rem; font-weight: 650; min-width: 0; }
.field .tiny { font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
.form-block { margin-top: 14px; }
.form-error, .warning { border-radius: 10px; color: #83322a; background: #f9e9e4; padding: 11px 13px; font-size: .9rem; }
.form-error { margin: 8px 0 2px; }
.plan-editor { display: grid; gap: 12px; }
.plan-day {
  padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #f7f9f4;
}
.plan-day > summary { cursor: pointer; min-height: 35px; padding-block: 5px; font-weight: 650; }
.exercise-editor { margin-top: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.exercise-photo { display: block; width: 100%; max-height: 305px; object-fit: cover; object-position: center 49%; border-radius: 12px; margin: 8px 0 10px; }
.exercise-thumb { width: 60px; height: 55px; object-fit: cover; border-radius: 8px; align-self: end; }
.table { width: 100%; border-collapse: collapse; text-align: left; }
.table th, .table td { padding: 5px 4px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-size: .81rem; font-weight: 600; }
.table th:first-child, .table td:first-child { width: 41px; }
.table th:last-child, .table td:last-child { text-align: center; width: 51px; }
.table input[type="checkbox"] { vertical-align: middle; }
.table input:not([type="checkbox"]) { padding-inline: 7px; min-width: 0; }
.timer {
  position: sticky; bottom: 0; z-index: 3; margin-top: 12px; display: flex; justify-content: space-between; align-items: center;
  gap: 8px; padding: 8px 12px; border-radius: 11px; color: var(--ink); background: var(--lime); font-weight: 650;
}
.zone { display: grid; grid-template-columns: 40px 1fr auto; gap: 5px; align-items: center; background: var(--soft); padding: 10px; border-radius: 8px; }
.zone.z2 { background: var(--lime); }
.zone span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.heart-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.heart-metrics .metric { background: var(--paper); }
.info-note { margin: 9px 0 0; color: var(--muted); font-size: .88rem; }
dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 0; }
dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }
dl > * { overflow-wrap: anywhere; }
dialog {
  width: min(680px, calc(100% - 26px)); max-height: min(88dvh, 850px); padding: 0 0 15px; border-radius: 19px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 75px #18352936;
}
dialog::backdrop { background: #162c23a8; }
.dialog-head {
  position: sticky; top: 0; z-index: 4; background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 11px 15px 11px 19px; display: flex; gap: 10px; align-items: center; justify-content: space-between;
}
.dialog-head h2 { margin: 0; }
#modal-content { padding: 16px 19px 3px; }
.toast {
  position: fixed; right: 18px; bottom: 22px; z-index: 6; max-width: calc(100% - 36px);
  background: var(--deep); color: #fff; padding: 11px 15px; border-radius: 10px; box-shadow: 0 4px 17px #233a2555;
}
.health-workouts { max-height: 46dvh; overflow: auto; padding: 3px; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 172px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .main { padding-inline: 22px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .shell { display: block; }
  .sidebar { position: static; display: contents; }
  .sidebar > .logo, .sidebar-backup { display: none; }
  .main { padding: 0 15px calc(86px + env(safe-area-inset-bottom, 0px)); }
  .topbar { min-height: 66px; }
  .top-date { display: none; }
  .mobile-logo { display: inline-flex; align-self: center; }
  .mobile-logo img { border-radius: 10px; }
  .mobile-logo strong { font-size: 1.34rem; }
  .main-nav {
    position: fixed; z-index: 5; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px;
    padding: 4px 4px max(4px, env(safe-area-inset-bottom, 0px)); background: #f7f9f2; border-top: 1px solid var(--line);
  }
  .main-nav a { flex-direction: column; justify-content: center; gap: 4px; min-height: 51px; padding: 5px 1px; font-size: .76rem; }
  .main-nav .nav-icon { font-size: 1.17rem; }
  .two-column, .equal-columns { grid-template-columns: minmax(0, 1fr); }
  .hero { min-height: 251px; border-radius: 19px; background-position: center, 59% center; }
  .hero-content { padding: 23px 20px; }
  .hero h1 { font-size: clamp(2.5rem, 10vw, 3.15rem); }
  .hero p { max-width: 24ch; }
  .metrics-grid { gap: 8px; margin-top: 14px; }
  .metric { min-height: 85px; }
  .page-head { margin-top: 13px; }
  dialog { width: calc(100% - 18px); max-height: 91dvh; }
  .toast { bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 355px) {
  .main { padding-inline: 10px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .zone { font-size: .89rem; }
}
