/**
 * H5 列表（卡片 / 紧凑行式）：仅在手机 / 小程序 mp 模式下生效。
 */

html.mp-h5-cards-on .layui-table-view .mp-h5-table-hidden,
html.mp-h5-cards-on .layui-table-view[data-mp-h5-ready='1'] .layui-table-box,
html[data-mp-webview='1'] .layui-table-view[data-mp-h5-ready='1'] .layui-table-box,
html.mp-h5-adapt .layui-table-view[data-mp-h5-ready='1'] .layui-table-box {
  display: none !important;
}

html.mp-h5-cards-on .layui-table-view[data-mp-h5-cards='1'] .layui-table-tool {
  margin-bottom: 8px;
  border: 0;
  background: transparent;
  padding: 0 4px;
}

html.mp-h5-cards-on .layui-table-view[data-mp-h5-cards='1'] .layui-table-page {
  border: 0;
  background: transparent;
  padding: 8px 4px 4px;
}

.mp-h5-card-list {
  display: none;
  padding: 4px 0 8px;
}

html.mp-h5-cards-on .mp-h5-card-list,
html[data-mp-webview='1'] .mp-h5-card-list,
html.mp-h5-adapt .mp-h5-card-list,
html.mp-h5-cards-on .layui-table-view .mp-h5-card-list {
  display: block !important;
}

.mp-h5-empty-state {
  text-align: center;
  color: #999;
  font-size: 13px;
  padding: 28px 12px;
  background: #fafafa;
  border-radius: 10px;
}

/* 筛选默认收起 */
.mp-h5-filter-panel {
  margin: 0 0 10px;
}

.mp-h5-filter-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #e8ecf1;
  border-radius: 10px;
  background: #fff;
  color: #333;
  font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mp-h5-filter-caret {
  font-style: normal;
  color: #999;
  transition: transform 0.15s ease;
}

.mp-h5-filter-panel.is-open .mp-h5-filter-caret {
  transform: rotate(180deg);
}

.mp-h5-filter-panel.is-collapsed > .mp-h5-filter,
.mp-h5-filter-panel:not(.is-open) > .mp-h5-filter,
.mp-h5-filter-panel.is-collapsed > .toolbar,
.mp-h5-filter-panel:not(.is-open) > .toolbar {
  display: none !important;
}

.mp-h5-filter-panel.is-open > .mp-h5-filter {
  display: block !important;
  margin-top: 8px !important;
  overflow: visible !important;
}

.mp-h5-filter-panel.is-open > .mp-h5-filter.sq-toolbar {
  display: flex !important;
  flex-direction: column !important;
  overflow: visible !important;
}

.mp-h5-filter-panel.is-open .mp-h5-filter.toolbar {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px 8px !important;
  align-items: start;
}

.mp-h5-filter-panel.is-open .ip-filter-row {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px 8px !important;
}

.mp-h5-filter-panel.is-open .ip-field {
  grid-column: auto !important;
  min-width: 0 !important;
}

.mp-h5-filter-panel.is-open .ip-actions {
  grid-column: 1 / -1 !important;
}

.mp-h5-mode-switch {
  display: none !important;
}

.mp-h5-mode-label {
  color: #999;
  margin-right: 2px;
}

.mp-h5-mode-btn {
  appearance: none;
  border: 1px solid #e5e5e5;
  background: #fff;
  color: #666;
  font-size: 12px;
  line-height: 1;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  cursor: pointer;
}

.mp-h5-mode-btn.is-active {
  border-color: #0d9488;
  color: #0d9488;
  background: rgba(13, 148, 136, 0.08);
}

.mp-h5-card {
  background: #fff;
  border: 1px solid #ebebeb;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 8px;
  box-shadow: none;
}

.mp-h5-card-head {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  margin-bottom: 8px;
}

.mp-h5-card-eyebrow {
  font-size: 11px;
  color: #999;
  letter-spacing: 0.02em;
}

.mp-h5-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #222;
  line-height: 1.35;
  word-break: break-word;
}

.mp-h5-card-fields {
  margin: 0;
  display: grid;
  gap: 6px;
}

.mp-h5-field {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 6px;
  align-items: start;
  font-size: 12px;
  line-height: 1.4;
}

.mp-h5-field dt {
  margin: 0;
  color: #888;
  font-weight: 400;
}

.mp-h5-field dd {
  margin: 0;
  color: #333;
  word-break: break-word;
}

.mp-h5-empty {
  color: #ccc;
}

.mp-h5-more {
  margin-top: 8px;
  font-size: 13px;
}

.mp-h5-more summary {
  cursor: pointer;
  color: #16baaa;
  user-select: none;
  list-style: none;
  padding: 4px 0;
}

.mp-h5-more summary::-webkit-details-marker {
  display: none;
}

.mp-h5-more[open] summary {
  margin-bottom: 6px;
}

.mp-h5-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
  height: auto !important;
  line-height: normal !important;
  overflow: visible !important;
}

.mp-h5-card-actions .layui-btn,
.mp-h5-row-actions .layui-btn {
  margin: 0 !important;
  height: 28px;
  line-height: 26px;
  padding: 0 8px;
  font-size: 12px;
  width: auto !important;
  flex: 0 0 auto;
}

.mp-h5-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* —— 紧凑行式列表 —— */
.mp-h5-row-list {
  border: 1px solid #e8ecf1;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.mp-h5-row {
  border-bottom: 1px solid #f0f2f5;
  background: #fff;
}

.mp-h5-row:last-child {
  border-bottom: 0;
}

.mp-h5-row-main {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mp-h5-row-main:active {
  background: #f7f8fa;
}

.mp-h5-row-no {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: #f3f4f6;
  color: #666;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mp-h5-row-main-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mp-h5-row-title {
  font-size: 13px;
  font-weight: 500;
  color: #222;
  line-height: 1.3;
  word-break: break-word;
}

.mp-h5-row-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.mp-h5-chip {
  font-size: 11px;
  color: #555;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mp-h5-chip em {
  font-style: normal;
  color: #999;
  margin-right: 3px;
}

.mp-h5-row-arrow {
  flex: 0 0 auto;
  color: #bbb;
  font-size: 12px;
  transition: transform 0.15s ease;
}

.mp-h5-row.is-open .mp-h5-row-arrow {
  transform: rotate(90deg);
}

.mp-h5-row-body {
  display: none;
  padding: 0 10px 10px;
  background: #fafbfc;
  border-top: 1px solid #f0f2f5;
}

.mp-h5-row.is-open .mp-h5-row-body {
  display: block;
}

.mp-h5-row-fields {
  margin: 8px 0 0;
  display: grid;
  gap: 4px;
}

.mp-h5-row-actions {
  margin-top: 8px;
  padding-top: 8px;
}

/* 表头 Tab / 工具条在手机端更易点 */
html.mp-h5-cards-on .layui-tab-title {
  display: flex !important;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}

html.mp-h5-cards-on .layui-tab-title li {
  flex: 0 0 auto;
}

html.mp-h5-cards-on .pear-container {
  padding: 8px !important;
}

/* 手机端：隐藏页面内卡片标题，避免与外壳标题重复 */
html.mp-h5-cards-on .layui-card-header,
html.mp-h5-cards-on .pear-container .layui-card-header {
  display: none !important;
}

html.mp-h5-cards-on .layui-layer .layui-card-header,
html.mp-h5-cards-on .layui-layer-content .layui-card-header {
  display: block !important;
  font-size: 15px;
  padding: 10px 12px;
}

html.mp-h5-cards-on .mp-table-zoom-toolbar {
  display: none !important;
}

html.mp-h5-cards-on .layui-table-view[data-mp-h5-cards='1'] .layui-table-tool .layui-table-tool-self {
  display: none;
}

@media (min-width: 769px) {
  html:not([data-mp-webview='1']):not(.mp-h5-adapt) .layui-table-view .layui-table-box {
    display: block !important;
  }
  html:not([data-mp-webview='1']):not(.mp-h5-adapt) .mp-h5-card-list {
    display: none !important;
  }
}
