.day-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 4px);
  min-height: 640px;
  padding-bottom: 44px;
}

.day-view__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 77px;
  padding: 20px 16px 20px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.day-view__nav {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.day-view__nav-group {
  display: flex;
  align-items: center;
  gap: var(--agenda-nav-gap);
}

.day-view__title-group { display: contents; }

.day-view__title {
  margin: 0 4px;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.day-view__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--history-bg);
  color: var(--history-text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.day-view__button:hover,
.day-view__button:focus { border-color: var(--border); background: #e4eaf0; color: var(--text); }

.day-view__button--icon {
  width: var(--agenda-nav-button-width);
  height: var(--agenda-nav-button-height);
  padding: 0;
  border-radius: var(--agenda-nav-button-radius);
  font-size: 0;
  line-height: 1;
}

.day-view__button--new { display: none; }

.day-view__button--view { width: 64px; padding: 8px 10px; white-space: nowrap; }

.day-view__legend {
  display: flex;
  align-items: center;
  gap: 12px;
}

.day-view__button--history { position: relative; margin-left: 12px; }

.day-view__button--history::before {
  position: absolute;
  top: 4px;
  left: -13px;
  width: 1px;
  height: 24px;
  background: var(--border);
  content: "";
}

.day-view__chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 4px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.day-view__chip--confirmado { border-color: var(--confirmed-border); background: var(--confirmed-bg); color: var(--confirmed-text); }
.day-view__chip--pre_reserva { border-color: var(--pre-reservation-border); background: var(--pre-reservation-bg); color: var(--pre-reservation-text); }
.day-view__chip--awaiting { border-color: var(--awaiting-border); background: var(--awaiting-bg); color: var(--awaiting-text); }

.day-view__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  margin: 16px 24px 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.day-view__summary-indicators {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.day-view__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 4px 12px;
  border: 1px solid var(--history-border);
  border-radius: 999px;
  background: var(--history-bg);
  color: var(--history-text);
  font-size: 12px;
  font-weight: 700;
}

.day-view__button--secondary {
  background: var(--action-secondary-bg);
  color: var(--action-secondary-text);
}

.day-view__button--primary {
  border-color: transparent;
  background: var(--sidebar);
  color: #ffffff;
}

.day-view__button--primary:hover,
.day-view__button--primary:focus {
  border-color: transparent;
  background: var(--sidebar-active);
  color: #ffffff;
}

.day-view__route-label--mobile { display: none; }

.day-view__receivables {
  flex: 0 0 108px;
  box-sizing: border-box;
  height: 108px;
  min-width: 0;
  margin: 16px 20px 0;
  padding: 14px 15px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.day-view__receivables-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-width: 0;
}

.day-view__receivables-header > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 17px;
}

.day-view__receivables-subtitle--mobile { display: none; }

.day-view__receivables-title {
  margin: 0;
  flex: 0 0 auto;
  color: #242e3d;
  font-size: 13px;
  font-weight: 600;
  line-height: 16px;
}

.day-view__receivables-subtitle {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #6e7887;
  font-size: 11px;
  line-height: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-view__receivables-list {
  display: flex;
  gap: 16px;
  min-width: 0;
  margin-top: 9px;
}

.day-view__receivable {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  height: 52px;
  padding: 8px 12px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f5faff;
  border-color: #c7d9f5;
}

.day-view__receivable-content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.day-view__receivable-label {
  color: #245eb8;
  font-size: 10px;
  font-weight: 600;
  line-height: 12px;
}

.day-view__receivable--overdue {
  border-color: #f2b299;
  background: #fff6f2;
}

.day-view__receivable--overdue .day-view__receivable-label { color: #b8381f; }

.day-view__receivable-detail {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #2e3d52;
  font-size: 12px;
  font-weight: 500;
  line-height: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-view__receivable--overdue .day-view__receivable-detail { color: #57332e; }

.day-view__receivable-confirm {
  flex: 0 0 auto;
  height: 28px;
  padding: 6px 12px;
  font-size: 11px;
}

.receivable-modal {
  position: absolute;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: start center;
  padding: 186px 16px 16px;
}

.receivable-modal[hidden] { display: none; }

.receivable-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgb(38 50 56 / 36%);
}

.receivable-modal__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  width: 520px;
  height: 500px;
  max-width: 100%;
  flex-direction: column;
  box-sizing: border-box;
  padding: 20px 23px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgb(38 50 56 / 18%);
}

.receivable-modal--processing .receivable-modal__dialog { height: 560px; }

.receivable-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-width: 0;
}

.receivable-modal__header h2 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  line-height: 24px;
}

.receivable-modal__header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 15px;
}

.receivable-modal__close {
  display: inline-flex;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  margin: -4px -8px 0 12px;
  padding: 0;
  border: 1px solid #d9dee7;
  border-radius: 6px;
  background: #eef2f6;
  color: var(--text);
  font-family: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.receivable-modal__summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  height: 82px;
  margin-top: 22px;
  padding: 9px 11px;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid #d7e1ea;
  border-radius: 8px;
  background: #f8fafc;
}

.receivable-modal__summary-identity,
.receivable-modal__summary-amount {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.receivable-modal__summary-identity {
  flex: 1 1 auto;
  gap: 9px;
}

.receivable-modal__summary-amount {
  flex: 0 0 180px;
  align-items: flex-end;
  gap: 8px;
  text-align: right;
}

.receivable-modal__summary-identity strong {
  color: #24323a;
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
}

.receivable-modal__summary-identity span {
  color: #5f6b7a;
  font-size: 12px;
  line-height: 16px;
}

.receivable-modal__summary-amount span {
  color: #6b7280;
  font-size: 11px;
  line-height: 16px;
}

.receivable-modal__summary-amount strong {
  color: #1f2937;
  font-size: 18px;
  font-weight: 600;
  line-height: 22px;
}

.receivable-form {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  margin-top: 16px;
}

.receivable-form__field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #596678;
  font-size: 11px;
  font-weight: 600;
  line-height: 13px;
}

.receivable-form__field + .receivable-form__field { margin-top: 20px; }

.receivable-form select,
.receivable-form input {
  width: 100%;
  height: 40px;
  box-sizing: border-box;
  padding: 0 12px;
  border: 1px solid #d1d9e3;
  border-radius: 6px;
  background: #fafbfc;
  color: #293342;
  font: 13px/40px inherit;
}

.receivable-form select:focus,
.receivable-form input:focus,
.receivable-modal__close:focus { outline: 2px solid #8db7ee; outline-offset: 1px; }

.receivable-form__helper {
  flex: 0 0 64px;
  height: 64px;
  margin: 20px 0 0;
  padding: 11px 12px;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid #a9c7f7;
  border-radius: 6px;
  background: #f2f7ff;
  color: #355c91;
  font-size: 11px;
  line-height: 16px;
}

.receivable-form__error {
  margin: -2px 0 0;
  color: #8a4b08;
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
}

.receivable-form--validation-error .receivable-form__field + .receivable-form__field {
  margin-top: 8px;
}

.receivable-form--validation-error select {
  border-color: #f4a259;
  color: #8a4b08;
}

.receivable-form__processing-error {
  display: flex;
  flex: 0 0 48px;
  align-items: center;
  gap: 12px;
  height: 48px;
  margin-top: 12px;
  padding: 8px 15px;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid #f4a259;
  border-radius: 8px;
  background: #fff4e5;
  color: #8a4b08;
  font-size: 12px;
  line-height: 16px;
}

.receivable-form__processing-error:focus {
  outline: 2px solid #f4a259;
  outline-offset: 1px;
}

.receivable-form__processing-error-icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  color: #8a4b08;
  font-size: 12px;
  line-height: 1;
}

.receivable-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: auto;
  margin-bottom: 12px;
}

.receivable-form__actions .day-panel__button {
  height: 36px;
  padding: 8px 16px;
  font-size: 11px;
}

@media (max-width: 639px) {
  .day-view__route-label--desktop { display: none; }
  .day-view__route-label--mobile { display: inline; }
}

.day-view__list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 24px 0;
  padding: 0 12px 12px 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgb(69 90 100 / 85%) transparent;
}

.day-view__list::-webkit-scrollbar { width: 4px; }
.day-view__list::-webkit-scrollbar-track { background: transparent; }
.day-view__list::-webkit-scrollbar-thumb {
  background: rgb(69 90 100 / 85%);
  border-radius: 999px;
}

.day-view__card {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 212px minmax(0, 1fr) auto;
  gap: 16px;
  min-height: 116px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.day-view__card--has-alert {
  position: relative;
  grid-template-rows: 92px;
  min-height: 154px;
  padding: 12px 20px;
}

.day-view__alert {
  position: absolute;
  right: 20px;
  bottom: 12px;
  left: 20px;
  display: flex;
  align-items: center;
  height: 30px;
  min-width: 0;
  padding: 6px 12px;
  overflow: hidden;
  border: 1px solid #f2731f;
  border-radius: 6px;
  background: #fff3e6;
  color: #5c380d;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
}

.day-view__alert--contrato {
  border-color: #e8a61f;
  background: #fff8e6;
}

.day-view__alert--observacao {
  border-color: #adbac4;
  background: #eef2f6;
}

.day-view__alert-message {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-view__alert-message--mobile { display: none; }

.day-view__card-when {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.day-view__card-time {
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  line-height: 28px;
}

.day-view__card-arrival {
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

.day-view__card-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 3px;
  min-width: 0;
}

.day-view__card-name {
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  line-height: 24px;
}

.day-view__card-address,
.day-view__card-items {
  color: var(--muted);
  font-size: 12px;
  line-height: 20px;
}

.day-view__card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
}

.day-view__card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.day-view__empty {
  margin: 0;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

@media (min-width: 1024px) {
  .day-view { width: calc(100% - 2px); }

  .day-view__card {
    grid-template-columns: 190px minmax(0, 1fr) auto;
    gap: 24px;
  }
}

@media (max-width: 1023px) {
  .day-view__toolbar { flex-wrap: wrap; }
}

@media (max-width: 900px) {
  .receivable-modal__dialog { width: calc(100% - 16px); }

  .day-view {
    height: calc(100vh - 72px);
    min-height: 0;
    overflow: hidden;
    padding-bottom: 0;
  }

  .day-view__toolbar {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    grid-template-rows: 32px 32px 24px;
    grid-template-areas:
      "today nav new new"
      "title title title title"
      "legend legend legend legend";
    align-items: center;
    gap: 8px;
    min-height: 136px;
    padding: 12px;
  }

  .day-view__nav {
    display: contents;
  }

  #day-view-today { grid-area: today; }
  .day-view__nav-group { grid-area: nav; gap: 4px; }
  .day-view__button--icon { width: var(--agenda-nav-mobile-button-width); }
  #day-view-new {
    display: inline-flex;
    grid-area: new;
    justify-self: end;
    min-width: 82px;
    padding-right: 12px;
    padding-left: 12px;
    background: var(--sidebar);
    color: #ffffff;
  }

  .day-view__title-group {
    display: flex;
    grid-area: title;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  .day-view__title {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 19px;
    text-overflow: ellipsis;
  }

  .day-view__button--view {
    flex: 0 0 auto;
  }

  .day-view__legend {
    display: flex;
    grid-area: legend;
    gap: 8px;
    min-width: 0;
  }

  .day-view__button--history {
    margin-left: 0;
  }

  .day-view__button--history::before { display: none; }

  .day-view__summary {
    height: 70px;
    min-height: 70px;
    margin: 8px 0 0;
    padding: 12px;
  }

  .day-view__summary-indicators { gap: 8px; min-width: 0; }
  .day-view__summary .day-view__button--primary { flex: 0 0 auto; white-space: nowrap; }

  .day-view__receivables {
    flex: 0 0 164px;
    height: 164px;
    margin: 10px 0 0;
    padding: 9px 11px 11px;
    border-radius: 8px;
  }

  .day-view__receivables-header > div { gap: 0; }
  .day-view__receivables-subtitle--desktop { display: none; }
  .day-view__receivables-subtitle--mobile { display: inline; }
  .day-view__receivables-title { flex: 0 0 120px; font-size: 13px; line-height: 18px; }
  .day-view__receivables-subtitle { flex: 0 1 225px; margin-top: 0; font-size: 10px; line-height: 14px; }

  .day-view__receivables-list {
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
  }

  .day-view__receivable {
    flex: 0 0 48px;
    height: 48px;
    gap: 8px;
    padding: 8px 10px;
    border-color: #a9c7f7;
    background: #f2f7ff;
  }

  .day-view__receivable--overdue {
    flex-basis: 54px;
    height: 54px;
    border-color: #f2a28f;
    background: #fff4f2;
  }

  .day-view__receivable-content { gap: 0; }
  .day-view__receivable-label { font-size: 9px; line-height: 13px; }
  .day-view__receivable-detail { font-size: 11px; font-weight: 600; line-height: 20px; }
  .day-view__receivable-description { display: none; }
  .day-view__receivable-confirm { height: 28px; padding: 6px 10px; font-size: 10px; }

  .day-view__list {
    min-height: 0;
    margin: 8px 0 0;
    padding: 0 0 8px;
    scrollbar-width: none;
  }

  .day-view__list::-webkit-scrollbar { display: none; }

  .day-view__card {
    position: relative;
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 12px;
    min-height: 126px;
    height: 126px;
    padding: 12px;
  }

  .day-view__card-time { font-size: 18px; line-height: 24px; }
  .day-view__card-when { gap: 4px; }
  .day-view__card-arrival {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    line-height: 16px;
  }

  .day-view__card-arrival-label { display: none; }
  .day-view__card-arrival::before { content: "Chegada"; }

  .day-view__card-info {
    grid-column: 2;
    min-width: 0;
    gap: 2px;
    padding-top: 0;
  }

  .day-view__card-name { font-size: 16px; line-height: 20px; }
  .day-view__card-address,
  .day-view__card-items {
    overflow: hidden;
    font-size: 11px;
    line-height: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .day-view__card-side {
    position: absolute;
    inset: 12px;
    display: block;
    pointer-events: none;
  }

  .day-view__card-side > .day-view__chip {
    position: absolute;
    top: 0;
    right: 0;
  }

  .day-view__card-actions {
    position: absolute;
    left: 82px;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: flex-start;
    gap: 4px;
    pointer-events: auto;
  }

  .day-view__card-actions .day-view__button {
    height: 30px;
    padding: 7px 8px;
    font-size: 11px;
  }

  .day-view__card--has-alert {
    grid-template-rows: 92px;
    min-height: 156px;
    height: 156px;
    padding: 12px;
  }

  .day-view__card--has-alert .day-view__card-side {
    bottom: 40px;
  }

  .day-view__card--has-alert .day-view__alert {
    right: 12px;
    bottom: 10px;
    left: 12px;
    height: 26px;
    padding: 0 8px;
    border-radius: 5px;
    border-color: #f4a259;
    background: #fff4e5;
    color: #8a4b08;
    font-size: 9px;
    line-height: 1;
  }

  .day-view__card--has-alert .day-view__alert--contrato,
  .day-view__card--has-alert .day-view__alert--observacao {
    border-color: #f4a259;
    background: #fff4e5;
  }

  .day-view__alert-message--desktop { display: none; }
  .day-view__alert-message--mobile { display: block; }

  .day-view__button--responsive-label {
    min-width: 72px;
    font-size: 0 !important;
  }

  .day-view__button--responsive-label::after {
    content: attr(data-mobile-label);
    font-size: 11px;
  }
}

@media (max-width: 639px) {
  .receivable-modal {
    position: fixed;
    place-items: start center;
    padding: 92px 8px 0;
  }

  .receivable-modal__dialog {
    width: 100%;
    height: 646px;
    max-height: calc(100vh - 16px);
    padding: 16px 15px;
    border-radius: 10px;
  }

  .receivable-modal--processing .receivable-modal__dialog { height: 646px; }
  .receivable-modal__header h2 { font-size: 20px; line-height: 30px; }
  .receivable-modal__header p { max-width: 330px; margin-top: 0; font-size: 11px; line-height: 24px; }
  .receivable-modal__close { margin: -5px 0 0 8px; }
  .receivable-modal__summary {
    height: 100px;
    margin-top: 20px;
    padding: 10px 11px;
    gap: 2px;
    flex-direction: column;
  }

  .receivable-modal__summary-identity { gap: 9px; }
  .receivable-modal__summary-amount {
    width: 100%;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
  }

  .receivable-modal__summary-identity strong { font-size: 14px; line-height: 18px; }
  .receivable-modal__summary-identity span { font-size: 12px; line-height: 16px; }
  .receivable-modal__summary-amount span { font-size: 11px; line-height: 16px; }
  .receivable-modal__summary-amount strong { font-size: 18px; line-height: 22px; }
  .receivable-form { margin-top: 20px; }
  .receivable-form__field { gap: 4px; font-size: 10px; line-height: 18px; }
  .receivable-form__field + .receivable-form__field { margin-top: 16px; }
  .receivable-form--validation-error .receivable-form__field + .receivable-form__field { margin-top: 8px; }
  .receivable-form select,
  .receivable-form input { height: 40px; font-size: 12px; line-height: 40px; }
  .receivable-form__error { margin-top: 4px; font-size: 12px; line-height: 16px; }
  .receivable-form__helper {
    flex-basis: 70px;
    height: 70px;
    margin-top: 16px;
    padding: 10px 12px;
    font-size: 10px;
    line-height: 15px;
  }
  .receivable-form__processing-error {
    flex-basis: 48px;
    height: 48px;
    margin-top: 16px;
    padding: 8px 15px;
    line-height: 15px;
  }

  .receivable-form__actions { gap: 8px; margin-bottom: 16px; }
  .receivable-form__actions .day-panel__button { height: 36px; padding: 8px 16px; }
}
