/* componentes: estilos compartilhados. */
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button {
  color: inherit;
}
a {
  color: var(--blueink);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button,
.card,
.patient,
.nav-item {
  transition:
    background 0.2s,
    transform 0.2s,
    box-shadow 0.2s;
}
button:hover:not(:disabled) {
  filter: brightness(0.98);
}
button:active:not(:disabled) {
  transform: scale(0.98);
}
svg.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 27px;
  background: var(--soft);
  flex-shrink: 0;
  overflow: hidden;
}
.avatar.lg {
  width: 74px;
  height: 74px;
  font-size: 48px;
}
.avatar.sm {
  width: 32px;
  height: 32px;
  font-size: 22px;
}
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.btn {
  border: 1px solid #dae1f1;
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  font-size: 13px;
  white-space: nowrap;
}
.btn.primary {
  background: var(--blue);
  border-color: transparent;
  color: var(--blueink);
  font-weight: 550;
}
.btn.lilac {
  background: var(--soft);
  border-color: transparent;
  color: #7053a7;
}
.btn.danger {
  color: #b45668;
  background: #fff0f3;
  border-color: transparent;
}
.btn.small {
  padding: 6px 10px;
  min-height: 34px;
  font-size: 12px;
}
.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  border: 0;
  background: transparent;
  border-radius: 10px;
}
.iconbtn:hover {
  background: var(--soft);
}
.card {
  background: var(--surface);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.split {
  display: grid;
  grid-template-columns: minmax(250px, 32%) minmax(0, 1fr);
  gap: 20px;
}
.split.wide {
  grid-template-columns: minmax(250px, 38%) minmax(0, 1fr);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.between {
  justify-content: space-between;
}
.grow {
  flex: 1;
  min-width: 0;
}
.search {
  position: relative;
  flex: 1;
  min-width: 160px;
}
.search .icon {
  position: absolute;
  left: 12px;
  top: 13px;
  color: var(--muted);
  width: 17px;
  height: 17px;
}
.search input {
  padding-left: 38px;
  width: 100%;
}
input,
select,
textarea {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid #dae0ef;
  border-radius: 9px;
  padding: 10px 12px;
  min-height: 42px;
  max-width: 100%;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  font-size: 12px;
}
textarea {
  resize: vertical;
  min-height: 100px;
  width: 100%;
}
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.patient,
.list-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  width: 100%;
  text-align: left;
  border-radius: 11px;
}
.patient.active,
.list-item.active {
  background: var(--blue);
  border-color: transparent;
}
.patient:hover,
.list-item:hover {
  background: var(--bg);
}
.patient strong,
.list-item strong {
  display: block;
  font-weight: 600;
}
.patient small,
.list-item small {
  display: block;
  margin-top: 3px;
}
.badge {
  font-size: 11px;
  padding: 5px 10px;
  background: var(--soft);
  color: #785aa6;
  border-radius: 20px;
  display: inline-flex;
  gap: 5px;
  align-items: center;
  white-space: nowrap;
}
.badge.blue {
  background: var(--blue);
  color: var(--blueink);
}
.badge.green {
  background: #e9f6f0;
  color: #38836b;
}
.badge.rose {
  background: #fcecf0;
  color: #ac526b;
}
.badge.gray {
  background: var(--bg);
  color: var(--muted);
}
.badge.amber {
  background: #fdf3e5;
  color: #947140;
}
.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  background: color-mix(in srgb, var(--bg) 40%, var(--surface));
  border: 1px solid var(--line);
  padding: 20px;
  border-radius: 13px;
  margin: 20px 0;
}
.datum label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
}
.datum {
  font-size: 13px;
}
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.tab {
  padding: 11px 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
}
.tab.active {
  background: var(--soft);
  color: #7053a7;
  border-color: transparent;
  font-weight: 550;
}
.tabs.under {
  border-bottom: 1px solid var(--line);
  gap: 0;
}
.tabs.under .tab {
  border: 0;
  border-radius: 7px 7px 0 0;
  flex: 1;
}
.tabs.under .tab.active {
  box-shadow: inset 0 -3px var(--accent);
}
.timeline .event {
  padding: 17px 0;
  display: flex;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.bubble-icon {
  width: 38px;
  height: 38px;
  background: var(--soft);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8e72be;
  flex-shrink: 0;
}
.event p {
  font-size: 13px;
}
.event small {
  display: block;
  margin-top: 4px;
}
.table-wrap {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  font-size: 13px;
}
th {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
  padding: 14px 12px;
  white-space: nowrap;
}
td {
  padding: 17px 12px;
  border-bottom: 1px solid var(--line);
}
td small {
  display: block;
  margin-top: 4px;
}
tr.selected td {
  background: var(--blue);
}
tbody tr.clickable {
  cursor: pointer;
}
tbody tr.clickable:hover {
  background: var(--bg);
}
.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}
.empty .icon {
  width: 32px;
  height: 32px;
  margin-bottom: 10px;
}
.foot {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.progress {
  height: 8px;
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
  margin: 15px 0;
}
.progress i {
  height: 100%;
  display: block;
  background: var(--accent);
  border-radius: 10px;
  transition: width 0.6s;
}
.step {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  font-size: 13px;
}
.step .dot {
  width: 20px;
  height: 20px;
  border: 1.5px solid #c9c1e1;
  border-radius: 50%;
  flex-shrink: 0;
}
.step.done .dot {
  background: var(--blue);
}
.step.current .dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--soft);
}
.log {
  padding: 19px 0;
  display: flex;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}
.log time {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.log details {
  width: 100%;
  font-size: 13px;
}
.log summary {
  cursor: pointer;
  list-style: none;
}
.log details[open] .changes {
  animation: rise 0.2s ease;
}
.changes {
  background: var(--soft);
  padding: 16px;
  border-radius: 10px;
  margin-top: 15px;
  display: flex;
  gap: 30px;
  font-size: 12px;
}
.switch {
  width: 41px;
  height: 24px;
  background: #d9dce7;
  border: 0;
  border-radius: 20px;
  padding: 3px;
  position: relative;
  flex-shrink: 0;
}
.switch:before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px #0002;
  transition: transform 0.2s;
}
.switch.on {
  background: var(--accent);
}
.switch.on:before {
  transform: translateX(17px);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}
.field.full {
  grid-column: 1/-1;
}
.field input,
.field select,
.field textarea {
  width: 100%;
}
.error {
  color: #b45668;
  font-size: 12px;
  margin: 12px 0;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: #24233642;
  backdrop-filter: blur(5px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade 0.18s;
}
.modal {
  background: var(--surface);
  border-radius: 23px;
  padding: 28px;
  width: min(680px, 100%);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 30px 90px #20203b2e;
  animation: rise 0.25s ease;
}
.modal.large {
  width: min(1000px, 100%);
}
.modal .card-title {
  margin-bottom: 22px;
}
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.signature {
  width: 100%;
  height: 140px;
  border: 1px dashed var(--accent);
  border-radius: 10px;
  touch-action: none;
  background: white;
}
.notice {
  background: var(--soft);
  color: #77618f;
  padding: 12px 15px;
  border-radius: 10px;
  font-size: 12px;
  margin-bottom: 18px;
}
#toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: #30344b;
  color: white;
  border-radius: 13px;
  padding: 13px 23px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
  font-size: 13px;
  max-width: 90%;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.section-label {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
  margin: 18px 10px 8px;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}
.check-row input {
  min-height: auto;
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}
.file-drop {
  border: 1px dashed var(--accent);
  border-radius: 13px;
  text-align: center;
  padding: 26px;
  background: var(--bg);
  margin-bottom: 20px;
}
.file-drop input {
  max-width: 100%;
  margin-top: 12px;
}
.file-preview {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 10px;
}
.badge-count {
  background: var(--soft);
  color: #785aa6;
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 10px;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes petFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-7px) rotate(1deg);
  }
}
@keyframes wiggle {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-8deg);
  }
  75% {
    transform: rotate(8deg);
  }
}
.reduce-motion * {
  animation: none !important;
  transition: none !important;
}
/* v1.6 — campos e anexos, mantendo os estilos das telas. */
.field > small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23838aa6' stroke-width='1.8' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 37px !important;
  cursor: pointer;
}
.referral-type {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.referral-type legend {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  padding: 0;
}
.type-segments {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 5px;
  background: var(--bg);
  border-radius: 16px;
  border: 1px solid var(--line);
}
.type-segments label {
  position: relative;
  cursor: pointer;
}
.type-segments input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  min-height: 0;
  padding: 0;
}
.type-segments label > span {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 10px 5px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--muted);
  transition:
    background 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}
.type-segments .icon {
  width: 16px;
  height: 16px;
}
.type-segments input:checked + span {
  color: #7961b7;
  background: var(--surface);
  box-shadow: 0 3px 10px #60548a12;
  font-weight: 600;
}
.type-segments input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.smart-field {
  position: relative;
  min-width: 0;
  gap: 7px;
}
.smart-field > label {
  font-size: 12px;
  color: var(--muted);
}
.smart-input-wrap {
  position: relative;
}
.smart-input-wrap > input {
  width: 100%;
  padding-right: 38px !important;
}
.smart-input-wrap > span {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.smart-input-wrap .icon {
  width: 16px;
  height: 16px;
}
.smart-options {
  position: absolute;
  top: 76px;
  left: 0;
  right: 0;
  max-height: 245px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: 0 14px 36px #34304a26;
  z-index: 110;
  padding: 5px;
}
.smart-options[hidden] {
  display: none;
}
.smart-options [role="option"] {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.smart-options [role="option"]:hover,
.smart-options [aria-selected="true"] {
  background: var(--soft);
}
.smart-options strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}
.smart-options small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.4;
}
.smart-empty {
  font-size: 11px;
  color: var(--muted);
  padding: 12px;
  line-height: 1.5;
}
.beautiful-file {
  min-width: 0;
}
.file-picker {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px 18px;
  border: 1.5px dashed #c8c5df;
  border-radius: 17px;
  background: color-mix(in srgb, var(--blue) 25%, var(--surface));
  cursor: pointer;
  position: relative;
  transition:
    border-color 0.2s,
    background 0.2s;
}
.file-picker:hover {
  border-color: var(--accent);
  background: var(--soft);
}
.file-picker:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.file-input-accessible {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  clip-path: inset(50%);
  overflow: hidden;
}
.file-picker-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--blue);
  color: var(--blueink);
}
.file-picker-icon .icon {
  width: 21px;
  height: 21px;
}
.file-picker-copy {
  flex: 1;
  min-width: 0;
}
.file-picker-copy strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
}
.file-picker-copy small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.file-picker-plus {
  color: var(--muted);
}
.file-picker-plus .icon {
  width: 18px;
  height: 18px;
}
.file-feedback {
  font-size: 11px;
  color: var(--muted);
}
input[type="file"]::file-selector-button {
  border: 0;
  border-radius: 12px;
  padding: 10px 15px;
  margin-right: 12px;
  background: var(--soft);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
#referral-form .form-grid {
  align-items: start;
}
#referral-form .field {
  gap: 7px;
}
#referral-form [name="time"] {
  font-variant-numeric: tabular-nums;
}
@media (max-width: 650px) {
  .smart-options {
    max-height: 205px;
  }
  .type-segments label > span {
    font-size: 11px;
  }
  .file-picker {
    padding: 14px;
  }
  .smart-field {
    grid-column: 1/-1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .type-segments label > span,
  .file-picker {
    transition: none;
  }
}
.modal:has(#referral-form) {
  width: min(760px, 94vw);
  padding: 25px;
}
#referral-form .form-grid {
  gap: 14px 17px;
}
#referral-form .field > small,
#referral-form .smart-field > small {
  font-size: 10px;
}
#referral-form .beautiful-file > .file-picker {
  padding: 12px;
}
#referral-form .file-picker-copy strong {
  font-size: 12px;
}
#referral-form .file-picker-copy small {
  font-size: 10px;
}
#referral-form .file-picker-icon {
  width: 31px;
  height: 31px;
  border-radius: 10px;
}
#referral-form .file-picker-icon .icon {
  width: 17px;
  height: 17px;
}
#referral-form .file-picker-plus {
  display: none;
}
@media (max-width: 650px) {
  .modal:has(#referral-form) {
    padding: 19px;
  }
  #referral-form .beautiful-file {
    grid-column: 1/-1;
  }
}
.modal:has(#referral-form) {
  width: min(700px, 94vw);
  padding: 23px;
}
.modal:has(#referral-form) > .card-title {
  margin-bottom: 18px;
}
#referral-form .form-grid {
  gap: 12px 16px;
}
#referral-form .modal-footer {
  margin-top: 16px;
  padding-top: 14px;
}

/* Horário digitável e listas da Lumi, sem o menu azul do Windows. */
.manual-time-error{color:#b14d65!important;font-size:11px;line-height:1.4}
.manual-time-error:empty{display:none}
.modal input[data-time-field]{font-variant-numeric:tabular-nums;letter-spacing:.06em}
.modal input[data-time-field][aria-invalid="true"]{border-color:#c57388;box-shadow:0 0 0 3px #c5738814}
.patient-picker{position:relative;min-width:0}
.patient-picker>input{width:100%;padding-right:16px}
.patient-options{top:76px;max-height:220px;padding:6px;border-radius:16px;overscroll-behavior:contain}
.patient-choice{display:block;width:100%;border:0;background:transparent;text-align:left;color:var(--ink);padding:12px!important;border-radius:11px;font:inherit;font-size:12px;line-height:1.5;cursor:pointer}
.patient-choice:hover,.patient-choice[aria-selected="true"]{background:var(--soft);color:var(--ink)}
.smart-options{border-radius:16px;padding:6px;border-color:var(--line);box-shadow:0 12px 30px #39314e20;scrollbar-width:thin;scrollbar-color:#c6b9e4 transparent;overscroll-behavior:contain}
.smart-options [role="option"]{border-radius:11px}
.smart-options::-webkit-scrollbar{width:6px}
.smart-options::-webkit-scrollbar-track{background:transparent}
.smart-options::-webkit-scrollbar-thumb{background:#c6b9e4;border-radius:10px}
