/* MG AI Hub — mobile bottom sheet (Modal Bottom Sheet / Action Sheet) */
@media (max-width: 767px) {
  select.input {
    -webkit-appearance: none;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #b7c0cc 50%), linear-gradient(135deg, #b7c0cc 50%, transparent 50%);
    background-position: calc(0% + 12px) calc(50% - 2px), calc(0% + 17px) calc(50% - 2px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-left: 30px;
  }
}

body.mg-sheet-lock {
  overflow: hidden;
}

.mg-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, .58);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.mg-sheet-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.mg-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10001;
  background: #1a212b;
  border-top: 1px solid #2a3340;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -18px 50px rgba(0, 0, 0, .45);
  transform: translateY(102%);
  transition: transform .26s cubic-bezier(.2, .8, .2, 1);
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

.mg-sheet.open {
  transform: translateY(0);
}

.mg-sheet-handle {
  display: flex;
  justify-content: center;
  padding: 9px 0 3px;
  touch-action: none;
  cursor: grab;
}

.mg-sheet-handle span {
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: #3b4656;
}

.mg-sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 18px 10px;
}

.mg-sheet-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mg-sheet-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: #212a36;
  color: #b7c0cc;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.mg-sheet-search {
  padding: 0 14px 8px;
}

.mg-sheet-search input {
  width: 100%;
  border: 1px solid #2a3340;
  background: #12161c;
  color: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
}

.mg-sheet-search input:focus {
  border-color: #e8252a;
}

.mg-sheet-list {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 8px 8px;
}

.mg-sheet-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #b7c0cc;
  text-align: right;
  padding: 12px 10px;
  font-size: 13px;
  line-height: 1.7;
  cursor: pointer;
}

.mg-sheet-option:active {
  background: #212a36;
}

.mg-sheet-option.selected {
  background: rgba(232, 37, 42, .1);
  color: #fff;
}

.mg-sheet-option .check {
  color: #e8252a;
  font-weight: 800;
  flex-shrink: 0;
}

.mg-sheet-empty {
  padding: 18px 12px;
  color: #b7c0cc;
  font-size: 12px;
  text-align: center;
}

.mg-sheet-cancel {
  margin: 4px 14px 6px;
  border: 1px solid #2a3340;
  border-radius: 12px;
  background: #212a36;
  color: #b7c0cc;
  padding: 11px;
  font-size: 12px;
  cursor: pointer;
}

@media (min-width: 768px) {
  .mg-sheet,
  .mg-sheet-overlay {
    display: none !important;
  }
}

/* Chat composer safe area */
.chat-composer {
  padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
}

/* Chat mobile: make the sheet-style conversation panel a little app-like */
@media (max-width: 1023px) {
  #conv-panel {
    border-radius: 0;
    box-shadow: -18px 0 50px rgba(0, 0, 0, .35);
  }
}
