:root {
  --blue: #173f73;
  --bg: #f3f6fa;
  --line: #dce3ec;
  --green: #08783e;
  --red: #b42318;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  font:
    16px/1.4 Arial,
    sans-serif;
  color: #17233a;
}
.wrap {
  max-width: 1050px;
  margin: auto;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 16px;
  margin: 9px 0;
}
.head {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  align-items: center;
}
.head h1 {
  margin: 0;
  color: var(--blue);
  font-size: 24px;
}
.sub {
  color: #667085;
}
.back,
button {
  min-height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  cursor: pointer;
}
.back {
  font-size: 28px;
}
.controls .views,
.nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.controls .active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.date {
  text-align: center;
  font-size: 21px;
  font-weight: 800;
  color: var(--blue);
  margin: 10px 0;
}
.hidden {
  display: none !important;
}
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.dow {
  text-align: center;
  color: #667085;
  font-weight: 700;
}
.calday {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  padding: 4px 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--blue);
  text-align: center;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.calday b,
.calday small {
  display: block;
}
.calday.free {
  background: #e8f8f0;
}
.calday.partial {
  background: #fff5d6;
}
.calday.full {
  background: #fdeaea;
}
.calday.off {
  background: #edf1f5;
  color: #87909d;
}
.calday.vacation {
  background: #fff;
  color: #516174;
  border: 2px solid #7f9bbb;
}
.calday.selected {
  outline: 3px solid var(--blue);
  box-shadow: inset 0 0 0 2px #fff;
}
.legend {
  display: flex;
  gap: 8px 14px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}
.legend i {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-right: 5px;
  vertical-align: -2px;
}
.legend i.free {
  background: #e8f8f0;
}
.legend i.partial {
  background: #fff5d6;
}
.legend i.full {
  background: #fdeaea;
}
.legend i.off {
  background: #edf1f5;
}
.legend i.vacation-swatch {
  background: #fff;
  border: 2px solid #7f9bbb;
}
.card h2 {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 20px;
}
.list {
  display: grid;
  gap: 10px;
}
.visit {
  border: 1px solid var(--line);
  border-left: 6px solid var(--blue);
  border-radius: 12px;
  padding: 13px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 220px;
  gap: 12px;
}
.visit.visit-completed,
.visit.visit-arrived,
.visit.visit-started {
  border-left-color: #1b8c53;
}
.visit.visit-no_show {
  border-left-color: #c63c31;
}
.time {
  font-size: 22px;
  font-weight: 800;
  color: var(--blue);
}
.patient {
  font-size: 18px;
  font-weight: 800;
}
.meta {
  margin-top: 4px;
  color: #475467;
  overflow-wrap: anywhere;
}
.status-wrap {
  min-width: 210px;
}
.status-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #667085;
  margin-bottom: 5px;
}
.status {
  width: 100%;
  min-height: 44px;
  padding: 8px;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  font-weight: 700;
}
.status.status-arrived,
.status.status-started,
.status.status-completed {
  border-color: #58ad7b;
  background: #effaf3;
  color: #08783e;
}
.status.status-no_show {
  border-color: #e7a29b;
  background: #fff3f1;
  color: #a12a20;
}
.status-note {
  font-size: 11px;
  color: #667085;
  margin-top: 4px;
}
.empty {
  text-align: center;
  padding: 24px;
  color: #667085;
}
.msg {
  padding: 12px 14px;
  border-radius: 10px;
  margin-top: 10px;
  font-weight: 700;
}
.ok {
  background: #eaf8f0;
  color: var(--green);
  border: 1px solid #80c69e;
}
.err {
  background: #fff1f0;
  color: var(--red);
  border: 1px solid #efb2ac;
}
@media (max-width: 720px) {
  .wrap {
    padding: 4px 6px calc(7px + env(safe-area-inset-bottom));
  }
  .card {
    padding: 8px 9px;
    margin: 4px 0;
    border-radius: 13px;
  }
  .head {
    grid-template-columns: 39px 1fr;
    min-height: 58px;
  }
  .head h1 {
    font-size: 19px;
  }
  .head .sub {
    font-size: 11px;
  }
  .back,
  button {
    min-height: 39px;
    padding: 5px 7px;
  }
  .back {
    font-size: 25px;
  }
  .controls .views,
  .nav {
    gap: 4px;
  }
  .date {
    font-size: 18px;
    line-height: 1.15;
    margin: 5px 0;
  }
  .calendar {
    gap: 2px;
  }
  .dow {
    font-size: 10px;
  }
  .calday {
    min-height: 36px;
    padding: 1px;
    font-size: 12px;
    line-height: 1;
    gap: 2px;
    border-radius: 8px;
  }
  .calday small {
    font-size: 9px;
  }
  .legend {
    font-size: 11px;
    line-height: 1.15;
    gap: 5px 9px;
    margin: 0 0 7px;
  }
  .legend i {
    width: 11px;
    height: 11px;
    margin-right: 3px;
    border-radius: 3px;
  }
  .visit {
    display: block;
    padding: 11px;
  }
  .visit > div:first-child {
    display: flex;
    gap: 9px;
    align-items: baseline;
  }
  .status-wrap {
    width: 100%;
    min-width: 0;
    margin-top: 9px;
  }
  .time {
    font-size: 20px;
  }
  .patient {
    font-size: 17px;
  }
}
