:root {
  --ink: #203c32;
  --green: #234c3c;
  --soft: #e8eee8;
  --paper: #f6f4ee;
  --line: #dce1d8;
  --muted: #69746d;
  --red: #ae403a;
  --amber: #926321;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: #25392f;
  font: var(--ui-body)/var(--ui-leading) var(--ui-font);
}
h1,
h2,
h3,
.brand {
  font-family: var(--ui-font);
  font-weight: 500;
  color: #183c30;
  line-height: 1.15;
}
h1 {
  font-size: 38px;
  margin: 0 0 12px;
}
h2 {
  font-size: 26px;
  margin: 0 0 18px;
}
h3 {
  font-size: 21px;
  margin: 0 0 12px;
}
p {
  margin: 8px 0;
}
a {
  color: var(--green);
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  border: 1px solid var(--line);
  background: white;
  color: var(--green);
  padding: 10px 16px;
  border-radius: 9px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: var(--ui-leading);
}
button:hover,
.button:hover {
  background: var(--soft);
}
button.primary,
.button.primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
button.danger {
  background: #fff1ef;
  color: var(--red);
  border-color: #efd0ca;
}
button.small {
  font-size: var(--ui-caption);
  padding: 6px 10px;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #cdd6ce;
  background: white;
  border-radius: 8px;
  padding: 10px 12px;
  color: #203c32;
  min-height: 43px;
}
input[type='checkbox'],
input[type='radio'] {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--green);
}
textarea {
  min-height: 95px;
  resize: vertical;
}
label {
  display: block;
  margin: 0 0 15px;
  font-size: var(--ui-caption);
  font-weight: 500;
}
label > input,
label > select,
label > textarea {
  margin-top: 5px;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 18px;
}
legend {
  margin-bottom: 8px;
  font-size: var(--ui-caption);
}
.check {
  display: flex;
  gap: 9px;
  align-items: center;
  margin: 7px 0;
  font-weight: 400;
}
.check input {
  flex-shrink: 0;
}
.checks {
  display: flex;
  gap: 10px 20px;
  flex-wrap: wrap;
}
.muted,
small {
  color: var(--muted);
}
small {
  font-size: var(--ui-caption);
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 22px 0;
}
:focus-visible {
  outline: 3px solid #86b8a1;
  outline-offset: 3px;
}
.layout {
  display: grid;
  grid-template-columns: 205px 1fr;
  min-height: 100vh;
}
.sidebar {
  padding: 25px 16px;
  border-right: 1px solid var(--line);
  background: #faf9f5;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.brand {
  font-size: 45px;
  text-align: center;
  text-decoration: none;
  margin: 0 0 26px;
}
.brand span {
  font-family: var(--ui-font);
  display: block;
  font-size: 34px;
  line-height: 0.8;
}
.role {
  text-align: center;
  font-size: var(--ui-caption);
  color: var(--muted);
  margin: -14px 0 20px;
}
.nav {
  display: grid;
  gap: 5px;
}
.nav a {
  padding: 12px 14px;
  border-radius: 10px;
  text-decoration: none;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: var(--ui-caption);
}
.nav a.active {
  background: var(--green);
  color: white;
}
.nav a:hover:not(.active) {
  background: var(--soft);
}
.nav i {
  font-style: normal;
  width: 21px;
  font-size: 20px;
}
.sidebar footer {
  margin-top: auto;
  padding-top: 25px;
  display: grid;
  gap: 10px;
}
.main {
  min-width: 0;
  padding: 0 30px 50px;
  max-width: 1900px;
  width: 100%;
  margin: auto;
}
.topbar {
  min-height: 85px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
  background:
    linear-gradient(90deg, var(--paper) 20%, #f6f4ee66),
    url('/mountains.png') center 35% / cover;
}
.topbar .name {
  font-weight: 600;
  background: #f6f4eee8;
  padding: 8px 14px;
  border-radius: 8px;
}
.topbar small {
  background: #f6f4eee8;
  padding: 7px;
}
.pagehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin: 0 0 22px;
}
.pagehead h1 {
  margin: 0;
}
.tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.tools input,
.tools select {
  width: auto;
  min-width: 150px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.card {
  padding: 23px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  margin-bottom: 20px;
  min-width: 0;
}
.grid > .card {
  margin-bottom: 0;
}
.empty {
  padding: 35px 25px;
  text-align: center;
  border: 1px dashed #c5d1c5;
  border-radius: 10px;
  color: var(--muted);
}
.empty p {
  margin-bottom: 17px;
}
.pill {
  font-size: var(--ui-caption);
  display: inline-block;
  padding: 4px 9px;
  border-radius: 20px;
  background: var(--soft);
  color: var(--green);
  white-space: normal;
}
.pill.red,
.bad {
  background: #ffebe8;
  color: var(--red);
}
.pill.amber,
.rise {
  background: #fff0d9;
  color: var(--amber);
}
.notice {
  padding: 13px 18px;
  background: #eef1e9;
  border-left: 3px solid var(--green);
  border-radius: 5px;
  margin: 15px 0;
  font-size: var(--ui-caption);
}
.error {
  background: #fff0ee;
  border-color: var(--red);
  color: var(--red);
}
.success {
  color: var(--green);
}
.row {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #ecede8;
}
.row:last-child {
  border: 0;
}
.row .grow {
  flex: 1;
}
.row p {
  margin: 2px 0;
}
.row img {
  width: 65px;
  height: 65px;
  object-fit: cover;
  border-radius: 8px;
}
.tablewrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  max-height: 72vh;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--ui-caption);
  text-align: left;
}
th {
  font-weight: 500;
  color: #51635a;
  background: #eef1eb;
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}
th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid #e5e9e1;
  vertical-align: top;
}
tbody tr:hover {
  background: #f9fbf7;
}
td a {
  font-weight: 500;
}
.tablewrap.history td {
  min-width: 92px;
  max-width: 290px;
}
.tablewrap.history th:first-child,
.tablewrap.history td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #f5f7f0;
}
.tablewrap.history th:first-child {
  z-index: 3;
}
.avatar {
  width: 42px;
  height: 42px;
  object-fit: cover;
  background: var(--soft);
  border-radius: 50%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  flex-shrink: 0;
}
.route {
  position: relative;
  height: 430px;
  overflow: hidden;
  border-radius: 15px;
  margin: 20px 0;
  background: url('/mountains.png') center/cover;
}
.route .routehead {
  position: absolute;
  left: 24px;
  top: 18px;
  padding: 12px 16px;
  background: #faf7efd9;
  border-radius: 10px;
  z-index: 1;
}
.route h2 {
  margin: 0 0 6px;
}
.route svg {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}
.route .daybadge {
  position: absolute;
  bottom: 15px;
  right: 16px;
  background: white;
  padding: 8px 15px;
  border-radius: 8px;
}
.goalcard {
  background: linear-gradient(115deg, #fff, #eff2e9);
}
.goalcard h2 {
  margin-top: 8px;
}
.balance {
  display: flex;
  gap: 10px;
  font-weight: 600;
}
.balance span {
  background: #fff;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.phrase {
  font: italic 20px/var(--ui-leading) var(--ui-font);
  padding: 18px 23px;
  border-left: 3px solid #9bae98;
}
.tabs {
  display: flex;
  gap: 8px;
  overflow: auto;
  margin: 18px 0;
}
.tabs button,
.tabs a {
  white-space: nowrap;
}
.tabs .active {
  background: var(--green);
  color: white;
}
.formgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}
.formgrid .full {
  grid-column: 1/-1;
}
.photos {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.photos img {
  width: 90px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
}
.thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 14px;
}
.modal-bg {
  position: fixed;
  inset: 0;
  background: #152a2366;
  z-index: 30;
  padding: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.modal {
  background: var(--paper);
  padding: 26px;
  border-radius: 15px;
  max-width: 780px;
  width: 100%;
  max-height: 92vh;
  overflow: auto;
  box-shadow: 0 20px 70px #10231e44;
}
.modal.wide {
  max-width: 1100px;
}
.modalhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modalhead h2 {
  margin: 0;
}
.modalhead button {
  padding: 6px 12px;
}
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
}
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
}
.auth-art {
  background:
    linear-gradient(0deg, #122b3180, transparent),
    url('/mountains.png') center/cover;
  padding: 55px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: white;
}
.auth-art .brand {
  color: white;
  text-align: left;
}
.auth-art h1 {
  font-size: 54px;
  color: white;
  max-width: 500px;
}
.auth-form {
  max-width: 500px;
  padding: 55px 35px;
  margin: auto;
  width: 100%;
}
.auth-form h1 {
  font-size: 36px;
}
.auth-form .primary {
  width: 100%;
  margin-top: 10px;
}
.chat {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 20px;
}
.chatlist {
  display: grid;
  align-content: start;
  gap: 8px;
}
.messages {
  height: 430px;
  overflow: auto;
  padding: 15px;
  background: #f1f3ed;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 15px;
}
.bubble {
  background: white;
  padding: 13px 16px;
  border-radius: 12px;
  max-width: 85%;
  margin-bottom: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble.mine {
  background: #deebe0;
  margin-left: auto;
}
.bubble small {
  display: block;
  margin-top: 7px;
}
.bubble blockquote {
  margin: 5px 0;
  padding: 8px;
  border-left: 2px solid #a4b4a5;
  font-size: var(--ui-caption);
}
.inline-editor {
  padding: 15px;
  background: #f4f6f0;
  border-radius: 9px;
  margin: 12px 0;
}
.meal-edit {
  display: grid;
  grid-template-columns: 1.5fr 2fr 120px 100px 40px;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}
.ingredient-edit {
  display: grid;
  grid-template-columns: 1fr 130px 40px;
  gap: 8px;
  margin-bottom: 10px;
}
.mobilebrand {
  display: none;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 22px;
  background: #173e30;
  color: white;
  border-radius: 9px;
  box-shadow: 0 4px 20px #0003;
  max-width: 90%;
  z-index: 100;
  display: none;
}
.loader {
  padding: 80px;
  text-align: center;
}
.inline {
  display: inline;
}
.nowrap {
  white-space: nowrap;
}
.smalltext {
  font-size: var(--ui-caption);
}
.summary {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.summary strong {
  font-size: 25px;
  font-family: var(--ui-font);
}
.family {
  width: 78px !important;
  display: inline-block;
}
.shopping td {
  vertical-align: middle;
}
.shopping .groupgap td {
  border-top: 10px solid var(--paper);
}
.home-product {
  opacity: 0.65;
  background: #eaf0e8;
}
.subnav {
  margin-bottom: 18px;
}
.legend {
  display: flex;
  gap: 18px;
  padding: 12px;
  font-size: var(--ui-caption);
}
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}
.recipe-grid .card {
  margin: 0;
}
.menuicon {
  display: none;
}
.readonly {
  opacity: 0.9;
}
.textbody {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 170px 1fr;
  }
  .main {
    padding: 0 20px 35px;
  }
  .sidebar {
    padding: 20px 10px;
  }
  .nav a {
    font-size: var(--ui-caption);
    padding: 11px 9px;
  }
  .grid.three {
    grid-template-columns: 1fr 1fr;
  }
  .route {
    height: 350px;
  }
  .meal-edit {
    grid-template-columns: 1fr 1fr;
  }
  .meal-edit label {
    margin-bottom: 5px;
  }
  .chat {
    grid-template-columns: 180px 1fr;
  }
}
@media (max-width: 760px) {
  body {
    font-size: var(--ui-caption);
  }
  .layout {
    display: block;
  }
  .sidebar {
    position: fixed;
    left: -240px;
    width: 220px;
    z-index: 25;
    transition: left 0.2s;
    box-shadow: 5px 0 30px #0002;
  }
  .sidebar.open {
    left: 0;
  }
  .main {
    padding: 0 14px 30px;
  }
  .topbar {
    min-height: 65px;
    margin-bottom: 20px;
    gap: 6px;
  }
  .topbar small {
    display: none;
  }
  .menuicon {
    display: block;
    padding: 7px 11px;
  }
  .mobilebrand {
    display: block;
    font: 27px var(--ui-font);
  }
  .topbar .name {
    font-size: var(--ui-caption);
    padding: 5px;
  }
  .pagehead {
    align-items: flex-start;
  }
  .pagehead h1 {
    font-size: 29px;
  }
  h1 {
    font-size: 30px;
  }
  h2 {
    font-size: 24px;
  }
  .grid,
  .grid.three,
  .formgrid,
  .chat {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 18px;
  }
  .grid {
    gap: 14px;
  }
  .route {
    height: 330px;
  }
  .route .routehead {
    top: 10px;
    left: 10px;
    padding: 8px;
  }
  .route h2 {
    font-size: 21px;
  }
  .goalcard h2 {
    font-size: 24px;
  }
  .balance span {
    font-size: var(--ui-caption);
    padding: 8px;
  }
  .tools input,
  .tools select {
    min-width: 100px;
    max-width: 100%;
  }
  .auth {
    display: block;
  }
  .auth-art {
    min-height: 220px;
    padding: 25px;
  }
  .auth-art h1 {
    font-size: 32px;
  }
  .auth-art .brand {
    font-size: 36px;
  }
  .auth-art p {
    display: none;
  }
  .auth-form {
    padding: 30px 24px;
  }
  .modal-bg {
    padding: 10px;
  }
  .modal {
    padding: 20px;
    max-height: 95vh;
  }
  .chatlist {
    display: flex;
    overflow: auto;
  }
  .chatlist button {
    white-space: nowrap;
  }
  .messages {
    height: 400px;
  }
  .tablewrap {
    max-height: 70vh;
  }
  .history {
    font-size: var(--ui-caption);
  }
  .row {
    flex-wrap: wrap;
  }
  .row .tools {
    margin-left: auto;
  }
  .formgrid .full {
    grid-column: auto;
  }
  .recipe-grid {
    grid-template-columns: 1fr;
  }
  .ingredient-edit {
    grid-template-columns: 1fr 90px 35px;
  }
  .thumb {
    height: 220px;
  }
  .phrase {
    font-size: var(--ui-body);
  }
  .shopping th,
  .shopping td {
    padding: 10px;
  }
  .shopping {
    min-width: 650px;
  }
  .nav {
    gap: 2px;
  }
  .sidebar footer {
    padding-top: 12px;
  }
  .summary {
    gap: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
.route-avatar {
  position: absolute;
  transform: translate(-50%, -150%);
  border: 3px solid #fff1c9;
  border-radius: 50%;
  box-shadow: 0 3px 8px #0004;
}
.route-avatar .avatar {
  width: 43px;
  height: 43px;
  font-size: 20px;
}

.currency-icon {
  width: 30px;
  height: 34px;
  flex: none;
  display: inline-block;
  vertical-align: middle;
}
.currency-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.currency-options legend {
  font-size: var(--ui-body);
  margin-bottom: 12px;
}
.currency-options label {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 10px;
  margin: 0;
  background: #fff;
  cursor: pointer;
}
.currency-options label:has(input:checked) {
  border-color: #35644f;
  background: #edf3ed;
  box-shadow: 0 0 0 1px #35644f;
}
.currency-options input {
  margin: 0;
}
#reward-preview:empty {
  display: none;
}
#reward-preview img {
  display: block;
  width: 100%;
  height: 210px;
  object-fit: cover;
  border-radius: 12px;
  margin: 0 0 20px;
}
#custom-reward[hidden] {
  display: none;
}
.unified-profile {
  max-width: 1100px;
}
.unified-profile fieldset:disabled input,
.unified-profile fieldset:disabled select,
.unified-profile fieldset:disabled textarea {
  color: var(--ink);
  opacity: 1;
  -webkit-text-fill-color: var(--ink);
  background: #f8faf7;
  cursor: default;
}
.profile-access {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 20px;
}
.profile-log,
.goal-archive article {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.profile-log:last-child,
.goal-archive article:last-child {
  border-bottom: 0;
}
.profile-log p {
  font-size: var(--ui-caption);
  white-space: pre-wrap;
}
.profile-log p span {
  color: var(--muted);
}
.goal-profile > fieldset > button + button {
  margin-left: 10px;
}
.goal-archive h3 {
  margin-bottom: 5px;
}
.import-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 10px 0 16px;
}
.import-tools .small {
  font-size: var(--ui-caption);
  padding: 7px 11px;
}
@media (max-width: 760px) {
  .currency-card .currency-icon {
    width: 22px;
    height: 27px;
  }
  .currency-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }
  .currency-options label {
    padding: 9px;
    font-size: var(--ui-caption);
    gap: 6px;
  }
  .goal-profile > fieldset > button + button {
    margin: 10px 0 0;
  }
  .goal-profile > fieldset > button {
    width: 100%;
  }
}
fieldset {
  min-inline-size: 0;
}
.currency-options label {
  min-width: 0;
}
@media (max-width: 760px) {
  .currency-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .currency-options .currency-icon {
    width: 23px;
    height: 27px;
  }
  .currency-options label {
    font-size: var(--ui-caption);
    gap: 4px;
    padding: 8px 5px;
  }
  .currency-options input {
    flex: none;
    width: 15px;
    height: 15px;
  }
  .currency-options span {
    overflow-wrap: anywhere;
  }
}

.medicine-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 20px;
}
.medicine-catalog-photo {
  width: 80px;
  height: 100px;
  object-fit: contain;
  background: white;
  border-radius: 10px;
}
.permissions-table input[type='checkbox'] {
  width: 20px;
  height: 20px;
}
.permissions-group {
  background: #edf2ee;
}
.permissions-table td {
  text-align: center;
}
.permissions-table th {
  min-width: 145px;
}
.tomorrow-plan {
  margin-top: 20px;
}
.tomorrow-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.tomorrow-item {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 12px 0;
}
.tomorrow-item small {
  display: block;
}
.import-tools {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 16px 0;
}
@media (max-width: 700px) {
  .tomorrow-grid {
    grid-template-columns: 1fr;
  }
}
.password-control {
  margin-bottom: 15px;
  min-width: 0;
}
.password-control > label {
  margin: 0 0 5px;
}
.password-input {
  position: relative;
}
.password-input > input {
  padding-right: 50px;
  margin: 0;
}
.password-input > .password-toggle {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 44px;
  padding: 0;
  border: 0;
  border-radius: 0 7px 7px 0;
  background: transparent;
  color: #557765;
  box-shadow: none;
  cursor: pointer;
}
.password-input > .password-toggle:hover {
  background: #edf3ed;
  color: #234c3c;
}
.password-input > .password-toggle:focus-visible {
  outline: 2px solid #86b8a1;
  outline-offset: -4px;
}
.password-toggle svg {
  pointer-events: none;
  flex: none;
}
.password-input input::-ms-reveal,
.password-input input::-ms-clear {
  display: none;
}

.medicine-favorite {
  margin: 12px 0;
}
.medicine-favorite.is-favorite {
  color: #375a42;
  background: #edf5ed;
  border-color: #91ad98;
}
.medicine-catalog-grid .row > div {
  min-width: 0;
}
.medicine-catalog-grid h2 {
  overflow-wrap: anywhere;
}
.medicine-catalog-photo {
  object-fit: contain;
  background: white;
}

/* Paired prescription fields share the same row for every role and viewport. */
.medicine-form-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.medicine-form-pair > * {
  min-width: 0;
}
.medicine-form-pair input,
.medicine-form-pair select {
  min-width: 0;
  max-width: 100%;
}
.medicine-photo-field .thumb {
  max-width: 100%;
  object-fit: contain;
}
@media (max-width: 480px) {
  .medicine-form-pair {
    gap: 10px;
  }
  .medicine-form-pair input[type='date'] {
    padding-left: 6px;
    padding-right: 6px;
    font-size: 14px;
  }
  .medicine-photo-field input[type='file'] {
    padding: 8px 6px;
    font-size: 12px;
  }
  .medicine-photo-field input[type='file']::file-selector-button {
    max-width: 100%;
  }
}

img[data-medicine-zoom] {
  cursor: zoom-in;
}
img[data-medicine-zoom]:focus-visible {
  outline: 3px solid #426e52;
  outline-offset: 3px;
}
.medicine-photo-viewer {
  padding: 48px 16px 16px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  max-width: 94vw;
  max-height: 94dvh;
  overflow: auto;
}
.medicine-photo-viewer::backdrop {
  background: rgba(0, 0, 0, 0.72);
}
.medicine-photo-viewer > img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(85vw, 1000px);
  max-height: 78dvh;
  object-fit: contain;
  margin: auto;
}
.medicine-photo-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 30px;
  line-height: 1;
}

.medicine-schedule-editor {
  margin-top: 20px;
}
.medicine-schedule-preview {
  padding: 16px;
  background: #edf5ee;
  border: 1px solid #cbdccc;
  border-radius: 8px;
  margin: 14px 0;
}
.medicine-schedule-preview ul {
  margin: 10px 0 0;
  padding-left: 24px;
}
.medicine-schedule-preview li {
  margin: 6px 0;
}
.medicine-schedule-editor input[readonly] {
  background: #edf5ee;
}
[data-schedule-error] {
  color: #a52c2c;
}

.medicine-break-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(85px, 0.45fr);
  gap: 10px;
}

.client-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
  max-width: 100%;
}
.client-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 14px;
  background: #e5efe8;
  color: #315a45;
  font-size: 13px;
  overflow-wrap: anywhere;
  line-height: var(--ui-leading);
}
.client-tags-edit {
  font-size: 13px;
  padding: 3px 7px;
  background: transparent;
  color: #315a45;
  text-decoration: underline;
  border: 0;
  cursor: pointer;
}

/* Keep the entire medicine package visible; override generic .row image cropping. */
body .medicine-catalog-grid .row > img.medicine-catalog-photo,
body .medicine-card .row > img.medicine-catalog-photo {
  width: 80px;
  height: 120px;
  min-width: 80px;
  object-fit: contain;
  object-position: center;
  border-radius: 6px;
  flex: 0 0 80px;
  background: #fff;
}
body #medicine-photo-preview img[data-medicine-zoom] {
  width: auto;
  max-width: 100%;
  height: 180px;
  object-fit: contain;
  object-position: center;
}
body .ws-name-photo img[data-medicine-zoom] {
  object-fit: contain;
  object-position: center;
}
body img.md-thumb.medicine-photo,
body .stats-row-name img.medicine-photo {
  object-fit: contain;
  object-position: center;
  background: #fff;
}
