body { font-family: system-ui, sans-serif; max-width: 40rem; margin: 2rem auto; padding: 0 1rem; }
button { padding: 0.5rem 1rem; cursor: pointer; }

#vers-nav {
  display: flex;
  gap: 1rem;
  margin: 0.75rem 0;
}
#vers-nav a {
  text-decoration: none;
  color: #333;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}
#vers-nav a.active {
  background: #e8e8e8;
  font-weight: 600;
}
.vers-section label { display: block; margin: 0.5rem 0; }
.hint { color: #666; font-size: 0.9rem; }

.form-toolbar { margin-bottom: 0.75rem; }
.req { color: #b00; }
.form-error { color: #b00; font-weight: 600; }
.money-wrap {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.money-prefix { font-weight: 600; }
.money-wrap input { flex: 1; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; }
#log-form input[type="text"],
#log-form input[type="email"],
#log-form input[type="tel"],
#log-form input[type="number"] {
  width: 100%;
  max-width: 24rem;
  padding: 0.4rem 0.5rem;
  box-sizing: border-box;
}
#submit-form-btn { margin-top: 1rem; }

/* Modals */
body.modal-open { overflow: hidden; }
#modal-confirm-root {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
#modal-confirm-root.is-open { display: flex; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.modal-dialog {
  position: relative;
  background: #fff;
  max-width: 22rem;
  width: calc(100% - 2rem);
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  z-index: 1;
}
.modal-title { margin: 0 0 0.5rem; font-size: 1.15rem; }
.modal-message { margin: 0 0 1.25rem; color: #333; line-height: 1.4; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
.modal-btn { padding: 0.45rem 0.9rem; cursor: pointer; border: 1px solid #ccc; border-radius: 4px; background: #f5f5f5; }
.modal-btn-ok { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.modal-btn-danger { background: #c62828; border-color: #c62828; color: #fff; }

#modal-status-root {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 1.25rem;
  z-index: 900;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
#modal-status-root[hidden] { display: none !important; }
.status-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  max-width: 28rem;
  width: calc(100% - 2rem);
  padding: 0.85rem 1rem;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.status-toast.is-success { border-color: #2e7d32; }
.status-toast.is-error { border-color: #c62828; }
.status-toast-message { margin: 0; flex: 1; line-height: 1.4; }
.status-toast-close {
  border: none;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
  color: #555;
}

.repeatable-block { margin: 0.75rem 0; padding: 0.75rem; border: 1px solid #ddd; border-radius: 6px; }
.repeatable-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-end; margin-bottom: 0.5rem; }
.repeatable-row label { flex: 1; min-width: 6rem; margin: 0; }
.time-slot-radios label { display: flex; align-items: center; gap: 0.4rem; margin: 0.35rem 0; }

.drug-rack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
}
.drug-rack-item { width: 5.5rem; }
.vial-button {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: center;
}
.vial-button svg { display: block; width: 100%; height: auto; }
.vial-dose-summary { font-size: 0.7rem; margin-top: 0.25rem; }
.vial-dose-chip {
  display: block;
  background: #f0f0f0;
  border-radius: 3px;
  padding: 0.1rem 0.25rem;
  margin-top: 0.15rem;
}
.drug-pref-row {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
}
#dose-modal-root {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
#dose-modal-root.is-open { display: flex; }
.dose-dialog { max-width: 28rem; max-height: 90vh; overflow: auto; }

.prefs-save-status {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}
.prefs-save-status.is-success { background: #e8f5e9; border: 1px solid #2e7d32; }
.prefs-save-status.is-error { background: #ffebee; border: 1px solid #c62828; }
.prefs-save-status.is-info { background: #e3f2fd; border: 1px solid #1565c0; }

.records-month-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0;
}
.records-month-label { display: flex; gap: 0.35rem; }
.records-week { margin: 1.25rem 0; }
.records-week-title { font-size: 1rem; margin: 0 0 0.5rem; color: #444; }
.record-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  background: #fff;
  overflow: hidden;
}
.record-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
}
.record-header:hover { background: #f7f7f7; }
.record-patient { display: block; }
.record-meta { font-size: 0.85rem; color: #666; }
.record-chevron { color: #888; }
.record-body { padding: 0 1rem 1rem; border-top: 1px solid #eee; }
.record-dl { display: grid; grid-template-columns: 8rem 1fr; gap: 0.25rem 0.75rem; }
.record-dl dt { color: #666; }
.record-dl dd { margin: 0; }
.record-total { margin-top: 0.75rem; font-size: 1.05rem; }
.record-delete-btn {
  margin-top: 0.75rem;
  background: #c62828;
  color: #fff;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: 4px;
  cursor: pointer;
}
.souvenirs-block { margin-top: 0.75rem; }


.submit-hint {
  color: #1565c0;
  font-weight: 600;
  margin: 0.5rem 0 0;
}
#submit-form-btn.is-armed {
  outline: 2px solid #1565c0;
  outline-offset: 2px;
}

#drugs-summary-label.is-alert { color: #c62828; font-weight: 700; }
.drugs-details > summary { cursor: pointer; font-weight: 600; }

.contract-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
}
.contract-status { color: #888; font-size: 0.9rem; }
.contract-status.is-signed { color: #1565c0; font-weight: 700; }

#contract-modal-root {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: #fafafa;
}
#contract-modal-root.is-open { display: block; }
.contract-modal {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 40rem;
  margin: 0 auto;
  padding: 0.5rem 1rem 1.5rem;
  box-sizing: border-box;
}
.contract-close {
  align-self: flex-end;
  background: none;
  border: none;
  color: #666;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.5rem 0;
}
.contract-scroll {
  flex: 1;
  overflow: auto;
  padding-bottom: 2rem;
}
#contract-pad {
  display: block;
  width: 100%;
  max-width: 560px;
  height: 160px;
  border: 1px solid #333;
  border-radius: 4px;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}
.contract-pad-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.contract-sign-msg.is-signed { color: #1565c0; font-weight: 700; }
.contract-sign-msg.is-error { color: #c62828; font-weight: 600; }
.contract-date { margin: 0.5rem 0; }


.dose-fraction {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 6.5rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.25rem 0.35rem;
  background: #fafafa;
}
.dose-frac-bar {
  height: 2px;
  background: #333;
  margin: 0.15rem 0;
}
.dose-fraction label { margin: 0; }
.dose-unit-label {
  display: block;
  font-size: 0.7rem;
  color: #555;
  font-weight: 600;
}
.dose-fraction input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #ddd;
  padding: 0.25rem;
}
.dose-row-fraction { align-items: center; }
.record-todos-section {
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fafafa;
}

.dose-list { margin-bottom: 0.75rem; }
.dose-list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}
.dose-entry { margin: 0.5rem 0; }
