.ag-module {
  --ag-green: #416957;
  --ag-soft: #eef4ef;
  --ag-line: #e4ebe6;
}
.ag-module .page-header {
  margin-bottom: 20px;
}
.ag-view-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 12px;
}
.ag-view-tabs .btn {
  white-space: nowrap;
}
.ag-layout {
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  gap: 20px;
}
.ag-sidebar {
  background: #fff;
  border: 1px solid var(--ag-line);
  border-radius: 20px;
  padding: 16px;
  align-self: start;
}
.ag-mini-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 4px;
}
.ag-mini-title strong {
  font-size: 12px;
  text-transform: capitalize;
}
.ag-mini-title .btn {
  padding: 6px 10px;
  min-height: 28px;
}
.ag-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.ag-weekletter {
  text-align: center;
  font-size: 10px;
  color: #7f8d85;
  padding: 6px 0;
}
.ag-mini-day {
  aspect-ratio: 1;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: #2c4035;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.ag-mini-day:hover {
  background: #e9f0eb;
}
.ag-mini-day.today {
  box-shadow: inset 0 0 0 1px #416957;
}
.ag-mini-day.selected {
  background: #416957;
  color: white;
  font-weight: 700;
}
.ag-mini-day.outside:not(.selected) {
  color: #bac2bd;
}
.ag-filter-details {
  margin-top: 22px;
  border-top: 1px solid var(--ag-line);
  padding-top: 16px;
}
.ag-filter-details summary {
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 14px;
}
.ag-filter-fields {
  display: grid;
  gap: 10px;
}
.ag-filter-fields .form-field {
  margin: 0;
}
.ag-filter-fields label {
  font-size: 11px;
}
.ag-filter-fields input,
.ag-filter-fields select {
  width: 100%;
  min-width: 0;
  font-size: 11px;
  min-height: 35px;
}
.ag-legend {
  display: grid;
  gap: 9px;
  margin: 20px 0;
  font-size: 10px;
  color: #62766a;
}
.ag-legend strong {
  font-size: 11px;
  color: #2e4538;
}
.ag-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}
.ag-legend i,
.ag-column-title i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ag-main {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--ag-line);
  border-radius: 20px;
  overflow: hidden;
}
.ag-date-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  flex-wrap: wrap;
}
.ag-date-toolbar > div {
  display: flex;
  gap: 5px;
}
.ag-date-toolbar h2 {
  font-size: 14px;
  margin: 0;
  font-weight: 650;
  text-transform: capitalize;
}
.ag-date-toolbar .btn {
  min-height: 34px;
  padding: 7px 11px;
}
.ag-date-jump {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 10px;
  color: #718074;
}
.ag-date-jump input {
  min-height: 34px;
  max-width: 142px;
  font-size: 12px;
}
.ag-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 0 18px 16px;
  font-size: 11px;
  color: #7a877f;
}
.ag-summary b {
  color: #2e4838;
  font-size: 13px;
  margin-right: 3px;
}
.ag-grid-scroll {
  overflow: auto;
  max-height: calc(100vh - 265px);
  min-height: 360px;
  border-top: 1px solid var(--ag-line);
  outline-offset: -3px;
}
.ag-grid {
  display: grid;
  grid-template-columns: 54px repeat(var(--ag-columns), minmax(120px, 1fr));
  min-width: calc(54px + var(--ag-columns) * 120px);
  grid-template-rows: 66px var(--ag-height);
  position: relative;
}
.ag-grid-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 5;
  background: #f8faf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #77867c;
  border-right: 1px solid var(--ag-line);
  border-bottom: 1px solid var(--ag-line);
}
.ag-column-title {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #fbfcfb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--ag-line);
  border-right: 1px solid var(--ag-line);
  padding: 6px;
  text-align: center;
  overflow: hidden;
}
.ag-column-title > span {
  font-size: 10px;
  text-transform: uppercase;
  color: #718277;
}
.ag-column-title button {
  border: 0;
  background: transparent;
  border-radius: 10px;
  width: 30px;
  height: 30px;
  color: #283e30;
  font-size: 19px;
  cursor: pointer;
}
.ag-column-title.today button {
  background: #416957;
  color: white;
}
.ag-column-title strong {
  font-size: 11px;
  font-weight: 600;
}
.ag-column-title small {
  font-size: 9px;
  color: #7c897f;
}
.ag-column-title i {
  position: absolute;
  left: 8px;
  top: 10px;
}
.ag-times {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fbfcfb;
  border-right: 1px solid var(--ag-line);
  grid-column: 1;
  grid-row: 2;
}
.ag-times span {
  position: absolute;
  right: 8px;
  font-size: 9px;
  color: #7d8b81;
  transform: translateY(3px);
}
.ag-day-column {
  position: relative;
  grid-row: 2;
  border-right: 1px solid var(--ag-line);
  background: white;
  overflow: hidden;
}
.ag-slot {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  height: var(--ag-slot);
  border: 0;
  border-bottom: 1px solid #edf1ed;
  background: transparent;
  cursor: pointer;
}
.ag-slot:hover {
  background: #eaf4ee;
}
.ag-outside-hours {
  background: repeating-linear-gradient(135deg, #fafbfa, #fafbfa 5px, #f0f3f0 5px, #f0f3f0 6px);
}
.ag-event {
  position: absolute;
  z-index: 2;
  border: 1px solid #d8e4dc;
  border-left: 3px solid var(--event-color);
  border-radius: 7px;
  background: #edf5ef;
  color: #2c4b38;
  cursor: pointer;
  padding: 5px 6px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  font-size: 10px;
  line-height: 1.25;
  min-width: 0;
}
.ag-event:hover {
  filter: brightness(0.98);
  box-shadow: 0 3px 10px #183a2820;
  z-index: 3;
}
.ag-event strong {
  font-size: 11px;
  font-weight: 650;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.ag-event > span:not(.ag-event-time),
.ag-event small {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  font-size: 9px;
}
.ag-event-time {
  font-size: 9px;
  opacity: 0.85;
  white-space: nowrap;
}
.ag-status-confirmed {
  background: #edf4fa;
  border-color: #d4e1ed;
}
.ag-status-arrived {
  background: #fff3d9;
  border-color: #eddfbc;
}
.ag-status-in_progress {
  background: #d9efdf;
  border-color: #92b89f;
}
.ag-status-completed {
  background: #f1f4f1;
  color: #77867b;
  border-color: #dfe5df;
}
.ag-status-cancelled {
  background: #f5f5f5;
  color: #9a9f9a;
  border-color: #e7e7e7;
  text-decoration: line-through;
  opacity: 0.6;
}
.ag-status-missed {
  background: #fcf0ed;
  border-color: #ebd5d0;
  color: #9e6758;
}
.ag-type-block {
  background: repeating-linear-gradient(135deg, #f0edf5, #f0edf5 6px, #e7e4ec 6px, #e7e4ec 7px);
  color: #766681;
  border-color: #dbd6e1;
}
.ag-type-reminder {
  background: #fff8e8;
  border-color: #eee0bf;
  color: #9b8051;
}
.ag-type-event {
  background: #f0eefb;
  border-color: #dfd8ed;
  color: #74628a;
}
.ag-grid-help {
  margin: 0;
  padding: 12px 16px;
  font-size: 10px;
  color: #7e8a81;
  line-height: 1.5;
}
.ag-cell-sub {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: #869188;
}
.ag-module .data-table td {
  vertical-align: middle;
}
.ag-module .data-table {
  font-size: 12px;
}
.ag-inline-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ag-consult-fields,
.ag-event-fields {
  display: contents;
}
.ag-consult-fields[hidden],
.ag-event-fields[hidden] {
  display: none !important;
}
.ag-extra-procedures {
  grid-column: 1/-1;
}
.ag-extra-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 85px auto;
  gap: 8px;
  margin-bottom: 8px;
}
.ag-extra-row select {
  min-width: 0;
}
.ag-extra-row .btn {
  padding: 6px 10px;
}
.ag-form-note {
  background: #f3f7f3;
  padding: 14px 16px;
  border: 1px solid #e0e9e1;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.6;
  color: #66796b;
}
.ag-form-note strong {
  color: #3c5c47;
}
.ag-form-note p {
  margin: 5px 0 0;
}
.ag-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  line-height: 1.5;
}
.ag-check input {
  width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  accent-color: #416957;
}
.ag-detail .person {
  margin-bottom: 14px;
}
.ag-detail h3 {
  margin-top: 0;
}
.ag-detail-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 20px;
}
.ag-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 0 0 24px;
}
.ag-detail-grid dt,
.ag-wait-card dt {
  font-size: 11px;
  color: #829187;
  margin-bottom: 5px;
}
.ag-detail-grid dd,
.ag-wait-card dd {
  margin: 0;
  font-size: 13px;
  color: #334c3c;
}
.ag-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e9ede9;
}
.ag-muted {
  font-size: 11px;
  color: #849186;
  line-height: 1.5;
}
.ag-notes {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.65;
  background: #f8faf8;
  padding: 14px;
  border-radius: 10px;
}
.ag-wait-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.ag-wait-card {
  border: 1px solid #e0e9e2;
  border-radius: 16px;
  padding: 18px;
  background: #fff;
}
.ag-wait-card > .badge {
  margin-top: 14px;
}
.ag-wait-card dl {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}
.ag-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ag-empty-inline {
  padding: 20px;
  color: #8a958d;
  font-size: 13px;
  text-align: center;
}
.ag-vacancies {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}
.ag-vacancies .btn {
  text-align: left;
  justify-content: flex-start;
  white-space: normal;
}
.ag-working-days {
  border: 1px solid #e0e8e1;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.ag-working-days legend {
  font-size: 12px;
  font-weight: 600;
  color: #4b6554;
  padding: 0 6px;
}
.ag-working-days label {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
}
.ag-working-days input {
  width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  accent-color: #416957;
}
.ag-module button:focus-visible,
.ag-mini-day:focus-visible {
  outline: 3px solid #83b89a;
  outline-offset: 2px;
}
.ag-sidebar > .btn {
  font-size: 11px;
  text-align: left;
  white-space: normal;
  width: 100%;
}
.ag-module .full,
#ag-appointment-form .full,
#ag-cancel-form .full,
#ag-waitlist-form .full {
  grid-column: 1/-1;
}
@media (min-width: 1500px) {
  .ag-grid {
    grid-template-columns: 58px repeat(var(--ag-columns), minmax(145px, 1fr));
  }
  .ag-layout {
    grid-template-columns: 238px minmax(0, 1fr);
  }
}
@media (max-width: 1150px) {
  .ag-layout {
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 12px;
  }
  .ag-sidebar {
    padding: 12px;
  }
  .ag-mini-title strong {
    font-size: 10px;
  }
  .ag-date-toolbar {
    padding: 12px;
  }
  .ag-date-jump > span {
    display: none;
  }
}
@media (max-width: 850px) {
  .ag-layout {
    grid-template-columns: 1fr;
  }
  .ag-sidebar {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 16px;
  }
  .ag-filter-details {
    margin: 0;
    padding: 0;
    border: 0;
  }
  .ag-filter-fields {
    grid-template-columns: 1fr 1fr;
  }
  .ag-legend {
    display: none;
  }
  .ag-sidebar > .btn {
    grid-column: 1/-1;
  }
  .ag-grid-scroll {
    max-height: 620px;
  }
  .ag-date-toolbar h2 {
    order: 3;
    width: 100%;
    text-align: center;
  }
  .ag-main {
    border-radius: 15px;
  }
  .ag-wait-cards {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 520px) {
  .ag-sidebar {
    display: block;
  }
  .ag-mini {
    display: none;
  }
  .ag-filter-fields {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .ag-filter-fields .form-field:first-child {
    grid-column: 1/-1;
  }
  .ag-filter-details summary {
    margin: 0 0 10px;
  }
  .ag-sidebar > .btn {
    margin-top: 10px;
  }
  .ag-summary {
    gap: 10px;
    font-size: 10px;
    padding: 0 12px 12px;
  }
  .ag-summary b {
    font-size: 11px;
  }
  .ag-view-tabs {
    gap: 5px;
  }
  .ag-view-tabs .btn {
    font-size: 11px;
    padding: 8px 11px;
  }
  .ag-grid {
    grid-template-columns: 46px repeat(var(--ag-columns), minmax(132px, 1fr));
    min-width: calc(46px + var(--ag-columns) * 132px);
  }
  .ag-grid-scroll {
    min-height: 340px;
    max-height: 570px;
  }
  .ag-detail-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  .ag-extra-row {
    grid-template-columns: minmax(0, 1fr) 65px;
  }
  .ag-extra-row .btn {
    grid-column: 1/-1;
  }
  .ag-vacancies {
    grid-template-columns: 1fr;
  }
  .ag-date-toolbar .btn {
    padding: 6px 9px;
  }
  .ag-date-toolbar {
    gap: 8px;
  }
  .ag-date-toolbar h2 {
    font-size: 12px;
  }
  .ag-date-jump input {
    max-width: 130px;
  }
  .ag-detail-actions .btn {
    flex: 1 1 auto;
  }
}
body[data-view='agenda'] #view > .module-tabs {
  display: none;
}
