/* Inter (SIL OFL 1.1, текст лицензии: inter-OFL.txt): латиница и кириллица, вес 400-700. */
@font-face {
  font-family: "Inter";
  src: url("/static/inter-ru.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #1f2a3c;
  --ink-hover: #2a374d;
  --ink-current: #34445f;
  --ink-line: #36435a;
  --ink-text: #e4e8ee;
  --ink-muted: #a3aec1;
  --field: #ebe8e3;
  --card: #f6f4f1;
  --text: #25282e;
  --muted: #5d636d;
  --line: #d3cec6;
  --accent: #1f6f6b;
  --accent-on-ink: #8fd0c8;
  --danger: #b3261e;
  --danger-hover: #c53a31;
  --off: #d8d3cb;
}

* {
  box-sizing: border-box;
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  display: flex;
  align-items: stretch;
  height: 100%;
  max-width: 100%;
  margin: 0;
  font: 16px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--field);
  overflow: hidden;
}

.side {
  display: flex;
  flex: 0 0 14rem;
  flex-direction: column;
  width: 14rem;
  height: 100%;
  padding: 1.25rem .75rem 1rem;
  overflow-x: hidden;
  overflow-y: auto;
  font-size: .95rem;
  color: var(--ink-text);
  background: var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .25rem .5rem;
  margin-bottom: 1.5rem;
  border-radius: 6px;
  font-weight: 650;
  line-height: 1.25;
  color: #fff;
  text-decoration: none;
}

.logo { flex: none; color: var(--accent-on-ink); }

.side nav { display: flex; flex-direction: column; gap: .125rem; }

.item {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  padding: .5rem .5rem;
  border-radius: 6px;
  color: var(--ink-text);
  text-decoration: none;
  cursor: pointer;
}

.ico { flex: none; }

.item:hover,
.brand:hover { background: var(--ink-hover); }

.item.current { color: #fff; background: var(--ink-current); }

.side a:focus-visible,
.side button:focus-visible { outline: 2px solid var(--accent-on-ink); outline-offset: -2px; }

.exit {
  margin: 2rem 0 0;
  padding: 0;
  border-top: 0;
}

.exit button {
  padding: .3rem .85rem;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  color: #fff;
  background: var(--danger);
  cursor: pointer;
}

.exit button:hover { background: var(--danger-hover); }

main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-width: 58rem;
  padding: 1.75rem 2rem 3rem;
  overflow-x: hidden;
  overflow-y: auto;
}

h1 { margin: 0 0 1.1rem; font-size: 1.6rem; font-weight: 650; line-height: 1.2; letter-spacing: -.01em; }

.profile-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .5rem;
}

.profile-heading[hidden] { display: none; }

.name-pen {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: .2rem;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: none;
  cursor: pointer;
}

.name-pen:hover { color: var(--accent); background: var(--off); }
.name-pen:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.name-pen .ico { width: 1.1rem; height: 1.1rem; }

.name-edit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .5rem;
  margin: 0 0 1.1rem;
}

.name-edit[hidden] { display: none; }

.name-edit .profile-prefix {
  font-size: 1.6rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -.01em;
}

.name-edit input {
  width: min(16rem, 100%);
  max-width: 16rem;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
}
h2,
h3 { margin: 0 0 .6rem; font-size: 1.05rem; font-weight: 650; line-height: 1.3; }

p { margin: 0 0 .75rem; }
a { color: var(--accent); }

.hint { font-size: .9rem; color: var(--muted); }

.card {
  max-width: 34rem;
  padding: 1.1rem 1.25rem;
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.card > :last-child { margin-bottom: 0; }
.earlier { margin: 0 0 .75rem; padding-left: 1.1rem; font-size: .9rem; color: var(--muted); }
.card form > :last-child { margin-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .85rem; }
.actions form { margin: 0; }

.bar { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .5rem 1rem; margin: 0 0 1rem; }
.bar .spans { margin: 0; }
.pick { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .4rem .75rem; margin-left: auto; }
.pick [hidden] { display: none; }
.pick .range { font-size: .9rem; font-variant-numeric: tabular-nums; color: var(--text); }
.download { white-space: nowrap; }
.btn.small { padding: .25rem .7rem; font-size: .9rem; }

.spans { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.spans a {
  padding: .3rem .7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  background: var(--card);
}
.spans a.current, .btn.plain[aria-pressed="true"] { color: #fff; background: var(--ink); border-color: var(--ink); }

thead a { color: inherit; text-decoration: none; }
thead a:hover { color: var(--accent); }

tr.entry { cursor: pointer; }
tr.entry:hover { background: #e7e2da; }
tr.entry td:nth-child(2) { font-size: 1.05rem; font-weight: 650; font-variant-numeric: tabular-nums; }
tr.entry td:nth-child(3),
tr.entry td:nth-child(4),
tr.entry td:nth-child(5) { font-variant-numeric: tabular-nums; }
td.when a { color: inherit; font-weight: 600; text-decoration: none; }

.triple { display: flex; gap: .75rem; }
.triple label { flex: 1; }
.triple input { max-width: none; }
.back { margin-bottom: .6rem; }
.back a { color: var(--muted); text-decoration: none; }
.back a:hover { color: var(--accent); }

.empty p:first-child { margin-bottom: .25rem; font-size: 1.1rem; font-weight: 600; }

label { display: block; margin: 0 0 .85rem; font-size: .9rem; font-weight: 500; }

input {
  display: block;
  width: 100%;
  max-width: 22rem;
  margin-top: .25rem;
  padding: .5rem .65rem;
  border: 1px solid #bfb9af;
  border-radius: 6px;
  font: inherit;
  font-weight: 400;
  color: var(--text);
  background: #fff;
}

.tip[hidden] { display: none; }

input[type="hidden"] { display: none; }

input:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input:focus-visible { border-color: var(--accent); }

.btn {
  display: inline-block;
  padding: .5rem 1.1rem;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
  text-decoration: none;
  background: var(--ink);
  cursor: pointer;
}

.btn:hover { background: var(--ink-hover); }

.btn.plain { color: var(--text); background: var(--off); }
.btn.plain:hover { background: #cbc5bb; }

.btn:disabled,
.btn:disabled:hover {
  color: #6b6f77;
  background: var(--off);
  cursor: not-allowed;
}

.rows { margin: 0; }

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem 1rem;
  padding: .6rem 0;
  border-top: 1px solid var(--line);
}

.row:first-child { padding-top: 0; border-top: 0; }
.row:last-child { padding-bottom: 0; }
.row dt { flex: 0 0 7.5rem; font-size: .9rem; color: var(--muted); }
.name-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  width: 100%;
  min-width: 0;
  margin: 0;
}
.name-form input {
  flex: 1 1 12rem;
  min-width: 0;
  max-width: none;
  margin: 0;
}
.name-form .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.goal-form { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0; }
.goal-form input { flex: 0 0 4.5rem; width: 4.5rem; max-width: 4.5rem; margin: 0; text-align: center; }
.goal-form input::placeholder { color: var(--muted); opacity: 1; }
.goal-form .btn { flex: 0 0 auto; white-space: nowrap; }
.row dd > .hint, .row dd > .error { flex-basis: 100%; margin: 0; }
.row dd { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin: 0; min-width: 0; overflow-wrap: anywhere; flex: 1 1 12rem; }

.tz-picker {
  position: relative;
  flex: 1 1 12rem;
  min-width: 0;
}
.tz-field {
  display: block;
  width: 100%;
  min-height: 2.5rem;
  padding: .5rem .65rem;
  border: 1px solid #bfb9af;
  border-radius: 6px;
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  color: var(--text);
  background: #fff;
  cursor: pointer;
}
.tz-field:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
.tz-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tz-panel {
  position: absolute;
  top: calc(100% + .25rem);
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  max-height: 16rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.tz-panel[hidden] { display: none; }
.tz-search {
  flex: none;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: .5rem .65rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 6px 6px 0 0;
  font: inherit;
  font-size: 1rem;
}
.tz-list {
  flex: 1 1 auto;
  margin: 0;
  padding: .25rem 0;
  overflow-x: hidden;
  overflow-y: auto;
  list-style: none;
}
.tz-list [role="option"] {
  padding: .45rem .65rem;
  font-size: 1rem;
  line-height: 1.35;
  cursor: pointer;
}
.tz-list [role="option"]:hover,
.tz-list [role="option"][aria-selected="true"] {
  background: #ebe8e3;
}
.tz-list [role="option"][hidden] { display: none; }

.scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
th, td { padding: .55rem .8rem; border: 0; border-bottom: 1px solid var(--line); text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #ece8e2; }
th { font-size: .8rem; font-weight: 600; white-space: nowrap; color: var(--muted); }
th:nth-child(n+2):nth-child(-n+5),
td:nth-child(n+2):nth-child(-n+5) { text-align: right; }
td:nth-child(1) { white-space: nowrap; color: var(--muted); }
td:nth-child(2) { font-size: 1.15rem; font-weight: 650; }

.error { color: #9b1c1c; }
.notice { color: #1f6b3a; }
.banner {
  margin: 0 0 1rem;
  padding: .65rem .85rem;
  border: 1px solid #e8c48a;
  border-radius: 6px;
  color: #7a3b00;
  background: #fff4e5;
}
.code { font: 600 1.6rem ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .05em; }

@media (max-width: 40rem) {
  .side { flex-basis: 9rem; width: 9rem; padding: 1rem .4rem .75rem; font-size: .9rem; }
  .brand { gap: .4rem; padding: .25rem; margin-bottom: 1rem; font-size: .9rem; }
  .logo { width: 22px; height: 22px; }
  .item { gap: .45rem; padding: .45rem .3rem; }
  .exit { padding: .75rem .3rem 0; }
  main { padding: 1rem .9rem 2rem; }
  h1 { font-size: 1.35rem; }
  .card { padding: .9rem; max-width: none; }
  th, td { padding: .5rem .55rem; }
  .row dt { flex-basis: 100%; }
}

/* Узкий экран (~390px): меню сверху полосой, страница не уезжает вбок. */
@media (max-width: 30rem) {
  html {
    height: auto;
    overflow: visible;
    overflow-x: hidden;
  }

  body {
    flex-direction: column;
    align-items: stretch;
    height: auto;
    min-height: 100vh;
    overflow: visible;
    overflow-x: hidden;
  }

  .side {
    flex: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .5rem;
    width: 100%;
    height: auto;
    max-width: 100%;
    padding: .65rem .75rem;
    overflow: visible;
  }

  .brand {
    flex: 0 0 auto;
    margin: 0 .25rem 0 0;
    padding: .2rem .35rem;
  }

  .side nav {
    flex: 1 1 auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: .15rem;
    min-width: 0;
  }

  .item {
    width: auto;
    padding: .35rem .45rem;
    white-space: nowrap;
  }

  main {
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    max-width: 100%;
    padding: .9rem .75rem 2rem;
    overflow: visible;
  }

  .bar { gap: .5rem; }
  .pick { margin-left: 0; justify-content: flex-start; }
  .toggles { margin-left: 0; }
  .chart-card { overflow: hidden; }
  .name-form .btn { flex: 0 0 auto; }
}

dialog.ask {
  width: min(22rem, calc(100vw - 2rem));
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--card);
}

dialog.point {
  width: min(36rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--field);
}

dialog.ask::backdrop,
dialog.point::backdrop { background: rgba(31, 42, 60, .45); }
.point .card { max-width: none; }
.point .ask-buttons { margin-top: .25rem; }
.ask p { margin-bottom: 1rem; font-size: 1.05rem; font-weight: 600; }
.ask-buttons { display: flex; justify-content: flex-end; gap: .6rem; }
.ask .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.toggles { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; margin-left: auto; }
.toggles label { display: inline-flex; align-items: center; gap: .4rem; margin: 0; padding: .3rem 0; font-size: .95rem; cursor: pointer; }
.toggles label[hidden] { display: none; }
.toggles input { display: inline-block; width: auto; max-width: none; margin: 0; accent-color: var(--ink); }
.swatch { display: inline-block; width: 1.8rem; height: 0; border-top: .3rem solid; }
.swatch.sys { border-top-color: #a51212; }
.swatch.dia { border-top-style: dashed; border-top-color: #2d87cd; }
.swatch.pulse { border-top-style: dotted; border-top-color: #5fbc55; }

.chart-card { max-width: none; }
.summary { margin: -.25rem 0 .75rem; font-size: .95rem; font-variant-numeric: tabular-nums; }
.summary[hidden] { display: none; }
.summary p { margin: 0 0 .2rem; }
.summary .little { color: var(--muted); }
.doctor { margin: 0 0 .75rem; font-size: .95rem; }
.doctor[hidden] { display: none; }
.doctor summary { cursor: pointer; color: var(--muted); }
.doctor p { margin: .35rem 0 0; max-width: 48rem; }
td .part { margin-left: .35rem; font-size: .8rem; font-weight: 400; color: var(--muted); }
.chart-frame { position: relative; margin: 0 0 .75rem; }
.weeks { margin: 0 0 .75rem; }
.weeks[hidden] { display: none; }
.weeks .hint { margin: 0; }
.weeks svg { display: block; width: 100%; height: auto; }
.weeks svg text { font: 14px "Inter", system-ui, sans-serif; fill: var(--text); }
.weeks svg text.few { fill: var(--muted); }
.chart-frame svg text.goal { fill: var(--muted); font-size: 12px; }
.chart-frame svg text.event { font-size: 12px; }
.chart-frame svg { display: block; width: 100%; height: auto; touch-action: pan-y; cursor: zoom-in; user-select: none; -webkit-user-select: none; }
.chart-frame svg circle { cursor: default; }
.chart-frame svg circle.dot { cursor: pointer; }
.chart-frame svg text { font: 14px "Inter", system-ui, sans-serif; fill: var(--text); }
.tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding: .4rem .6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: .85rem;
  line-height: 1.35;
  white-space: nowrap;
  pointer-events: none;
  background: #fff;
}

.tip[hidden] { display: none; }

.remind { display: flex; flex-direction: column; align-items: flex-start; gap: .85rem; }
.remind > * { margin: 0; }
.remind form { margin: 0; }
.switch { display: inline-flex; align-items: center; gap: .65rem; margin: 0; padding: 0; border: 0; background: none; font: inherit; font-size: 1rem; font-weight: 600; color: inherit; cursor: pointer; }
.track { position: relative; flex: none; width: 2.6rem; height: 1.5rem; border-radius: 999px; background: #bfb9af; transition: background .15s; }
.track i { position: absolute; top: .2rem; left: .2rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch[aria-checked="true"] .track { background: var(--accent); }
.switch[aria-checked="true"] .track i { transform: translateX(1.1rem); }
.switch:focus-visible .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; list-style: none; }
.chip { display: inline-flex; align-items: center; gap: .15rem; padding: .15rem .3rem .15rem .85rem; border: 1px solid var(--line); border-radius: 999px; font-variant-numeric: tabular-nums; background: var(--field); }
.chip-x { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; margin: 0; padding: 0; border: 0; border-radius: 50%; background: none; font: inherit; font-size: 1.15rem; font-weight: 400; line-height: 1; color: var(--muted); cursor: pointer; }
.chip-x:hover { color: var(--danger); background: var(--off); }
.chip-x:focus-visible { outline: 2px solid var(--accent); }
.add { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.add input { width: 8rem; margin: 0; }
.event-form { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.event-form input { margin: 0; }
.event-form input[name="text"] { flex: 1 1 16rem; min-width: 0; }
.event-form input[name="at"] { flex: 0 0 auto; width: auto; }
.events .chip form { margin: 0; }

.legend { display: flex; flex-direction: column; gap: .4rem; font-size: .9rem; color: var(--muted); }
.legend[hidden] { display: none; }
.legend div { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.legend .key,
.legend .sample { display: inline-flex; align-items: center; gap: .45rem; padding: .2rem .7rem; border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; color: var(--text); background: var(--card); }
.legend .sample svg { flex: none; width: 3rem; height: .6rem; }
.legend .note + .note { padding-left: .6rem; border-left: 1px solid var(--line); }
