/* ==========================================================================
   灵感素材收集板 · 模块样式
   所有 class 以 mat- 前缀，避免污染共享基座
   ========================================================================== */

/* ---------------------------------------------------------------- 顶部统计 */
.mat-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.mat-stat {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: 12px 14px;
  min-width: 0;
  overflow: hidden;
}

.mat-stat::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -30px;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 32, 35, 0.04), transparent 70%);
  pointer-events: none;
}

.mat-stat-total {
  background: linear-gradient(140deg, #ffffff 0%, #fff6f7 100%);
  border-color: var(--brand-line);
}

.mat-stat-total .mat-stat-value {
  color: var(--brand-700);
}

.mat-stat-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--sub);
  white-space: nowrap;
}

.mat-stat-label svg {
  width: 13px;
  height: 13px;
  color: var(--muted);
}

.mat-stat-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

.mat-stat-foot {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.mat-stat-idea .mat-stat-value {
  color: var(--sub);
}

.mat-stat-todo .mat-stat-value {
  color: var(--warn);
}

.mat-stat-done .mat-stat-value {
  color: var(--ok);
}

.mat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: inline-block;
}

.mat-dot-idea {
  background: var(--muted);
}

.mat-dot-todo {
  background: var(--warn);
}

.mat-dot-done {
  background: var(--ok);
}

/* ---------------------------------------------------------------- 主布局 */
.mat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 16px;
  align-items: start;
}

.mat-main {
  min-width: 0;
}

.mat-side {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* ---------------------------------------------------------------- 工具栏 */
.mat-toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-bottom: 12px;
}

.mat-tool-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mat-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  min-width: 0;
}

.mat-search > svg {
  position: absolute;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.mat-search-input {
  padding-left: 34px;
  padding-right: 36px;
  min-height: 36px;
}

.mat-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  display: none;
}

.mat-search-clear {
  position: absolute;
  right: 5px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
}

.mat-search-clear:hover {
  background: #f2f2f4;
  color: var(--ink);
}

.mat-search-clear svg {
  width: 13px;
  height: 13px;
}

.mat-tool-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.mat-sort {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--sub);
  white-space: nowrap;
}

.mat-sort .select {
  width: auto;
  min-height: 32px;
  min-width: 154px;
  padding-top: 4px;
  padding-bottom: 4px;
  font-size: 12.5px;
}

.mat-view {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  overflow: hidden;
  background: #fff;
  flex: 0 0 auto;
}

.mat-view-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: var(--sub);
  display: grid;
  place-items: center;
}

.mat-view-btn:last-child {
  border-right: 0;
}

.mat-view-btn:hover {
  background: #f6f6f8;
  color: var(--ink);
}

.mat-view-btn.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.mat-view-btn svg {
  width: 15px;
  height: 15px;
}

.mat-filter-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.mat-filter-label {
  flex: 0 0 auto;
  min-width: 28px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.mat-filter-sep {
  width: 1px;
  height: 16px;
  background: var(--line);
  margin: 0 3px;
}

.mat-filter-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.mat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 27px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 99px;
  padding: 2px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--sub);
  transition: background 0.14s, border-color 0.14s, color 0.14s;
  white-space: nowrap;
}

.mat-chip:hover {
  border-color: #c2c5ca;
  color: var(--ink);
}

.mat-chip svg {
  width: 12px;
  height: 12px;
}

.mat-chip.is-on {
  background: var(--brand-soft);
  border-color: var(--brand-line);
  color: var(--brand-700);
  font-weight: 600;
}

.mat-chip-count {
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.mat-chip.is-on .mat-chip-count {
  color: var(--brand-700);
  opacity: 0.72;
}

.mat-chip .mat-dot {
  width: 5px;
  height: 5px;
}

/* ---------------------------------------------------------------- 当前筛选 */
.mat-active {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: #fff;
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  font-size: 12px;
  color: var(--sub);
}

.mat-active-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11.5px;
}

.mat-active-label svg {
  width: 13px;
  height: 13px;
}

.mat-active-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  color: var(--brand-700);
  border-radius: 99px;
  padding: 1px 3px 1px 9px;
  font-size: 11.5px;
  max-width: 100%;
}

.mat-active-chip > button {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--brand-700);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.mat-active-chip > button:hover {
  background: rgba(255, 46, 77, 0.14);
}

.mat-active-chip svg {
  width: 10px;
  height: 10px;
}

.mat-active-clear {
  margin-left: auto;
  white-space: nowrap;
}

.mat-result-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin: 0 2px 10px;
  font-size: 12px;
  color: var(--muted);
  min-height: 20px;
}

.mat-result-count b {
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.mat-result-sub {
  color: var(--muted);
}

.mat-result-sep {
  color: var(--faint);
}

.mat-result-hint {
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  border-radius: 99px;
  padding: 0 8px;
  font-size: 10.5px;
  line-height: 1.7;
}

.mat-result-bar .spacer {
  flex: 1 1 auto;
}

.mat-result-bar .link-btn {
  font-size: 11.5px;
}

/* ---------------------------------------------------------------- 卡片流 */
.mat-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.mat-cards.is-empty {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
}

.mat-loading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 200px;
  color: var(--sub);
  font-size: 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
}

.mat-loading svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.mat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: 13px 14px 11px;
  overflow: hidden;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.mat-card:hover {
  border-color: #ddd5d8;
  box-shadow: 0 10px 24px rgba(20, 16, 20, 0.065);
  transform: translateY(-1px);
}

.mat-card.is-pinned {
  border-color: #f2d6db;
  background: linear-gradient(180deg, #fffbfb 0%, #ffffff 26%);
}

.mat-card.is-pinned::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand), #ffb3bf 62%, rgba(255, 179, 191, 0));
}

.mat-card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 22px;
}

.mat-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.55;
  white-space: nowrap;
}

.mat-type svg {
  width: 12px;
  height: 12px;
}

.mat-tone-brand {
  background: var(--brand-soft);
  color: var(--brand-700);
}

.mat-tone-blue {
  background: var(--info-soft);
  color: var(--info);
}

.mat-tone-green {
  background: var(--ok-soft);
  color: var(--ok);
}

.mat-tone-amber {
  background: var(--warn-soft);
  color: var(--warn);
}

.mat-tone-violet {
  background: #f4efff;
  color: #7b2cff;
}

.mat-marks {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.mat-mark {
  width: 21px;
  height: 21px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-700);
}

.mat-mark svg {
  width: 12px;
  height: 12px;
}

.mat-mark-fav {
  background: var(--bad-soft);
  color: var(--bad);
}

.mat-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.mat-card-main {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.mat-headline {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.55;
  letter-spacing: 0.005em;
  color: var(--ink);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mat-quote {
  margin: 0;
  padding-left: 10px;
  border-left: 2px solid var(--brand-line);
  font-size: 13.5px;
  line-height: 1.72;
  color: var(--ink-2);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mat-source {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.mat-source svg {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  margin-top: 2px;
}

.mat-note {
  font-size: 12px;
  line-height: 1.65;
  color: var(--sub);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mat-note.is-empty {
  color: var(--muted);
}

.mat-note svg {
  width: 11px;
  height: 11px;
  margin-right: 3px;
  vertical-align: -1px;
  color: var(--muted);
}

.mat-track {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  max-width: 100%;
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--info-soft);
  color: var(--info);
  font-size: 11px;
  line-height: 1.7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mat-track svg {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
}

.mat-link-domain {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  max-width: 100%;
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 11px;
  line-height: 1.7;
}

.mat-link-domain svg {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
}

.mat-link-domain span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mat-url {
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mat-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 9px;
  overflow: hidden;
  background: #f3f3f5;
  border: 1px solid var(--line);
}

.mat-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mat-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.mat-thumb-empty svg {
  width: 22px;
  height: 22px;
}

/* 选题状态条 */
.mat-topic-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding: 6px 8px;
  background: #fafafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mat-status-select {
  width: auto;
  min-width: 76px;
  min-height: 25px;
  height: 25px;
  padding: 1px 24px 1px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  background-position: right 8px center;
}

.mat-status-select.mat-status-idea {
  background-color: #f1f1f3;
  border-color: var(--line-2);
  color: var(--sub);
}

.mat-status-select.mat-status-todo {
  background-color: var(--warn-soft);
  border-color: var(--warn-line);
  color: var(--warn);
}

.mat-status-select.mat-status-done {
  background-color: var(--ok-soft);
  border-color: var(--ok-line);
  color: var(--ok);
}

.mat-date {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

.mat-date svg {
  width: 11px;
  height: 11px;
}

.mat-date-ok {
  color: var(--ok);
}

/* 卡片标签 */
.mat-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.mat-tag {
  max-width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f5f5f7;
  color: var(--sub);
  font-size: 10.5px;
  line-height: 1.7;
  padding: 1px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.14s, color 0.14s;
}

.mat-tag:hover {
  background: var(--brand-soft);
  color: var(--brand-700);
}

/* 卡片底部 */
.mat-card-foot {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.mat-times {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  font-size: 10px;
  line-height: 1.5;
  color: var(--muted);
}

.mat-times span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.mat-times svg {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
}

.mat-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  margin-left: auto;
  flex: 0 0 auto;
}

.mat-icon-btn {
  width: 27px;
  height: 27px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: background 0.14s, color 0.14s;
}

.mat-icon-btn svg {
  width: 14px;
  height: 14px;
}

.mat-icon-btn:hover {
  background: #f2f2f4;
  color: var(--ink);
}

.mat-icon-btn.is-on {
  background: var(--brand-soft);
  color: var(--brand-700);
}

.mat-icon-btn.is-fav {
  background: var(--bad-soft);
  color: var(--bad);
}

.mat-icon-btn.danger:hover {
  background: var(--bad-soft);
  color: var(--bad);
}

/* 列表视图 */
.mat-cards.is-list {
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
}

.mat-cards.is-list .mat-card {
  padding: 12px 14px 10px;
  gap: 8px;
}

.mat-cards.is-list .mat-card-body {
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
}

.mat-cards.is-list .mat-thumb {
  width: 116px;
  flex: 0 0 116px;
  aspect-ratio: 4 / 3;
}

.mat-cards.is-list .mat-card-main {
  flex: 1 1 auto;
  gap: 5px;
}

.mat-cards.is-list .mat-headline {
  -webkit-line-clamp: 2;
}

.mat-cards.is-list .mat-note {
  -webkit-line-clamp: 2;
}

.mat-cards.is-list .mat-card-foot {
  padding-top: 7px;
}

.mat-cards.is-list .mat-times {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.mat-cards.is-list .mat-tags {
  gap: 4px;
}

/* 空态动作 */
.mat-empty-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* 搜索高亮 */
mark.mat-hl {
  background: rgba(255, 46, 77, 0.16);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ---------------------------------------------------------------- 侧栏 */
.mat-side-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: 14px;
}

.mat-side-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.mat-side-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
}

.mat-side-title svg {
  width: 15px;
  height: 15px;
  color: var(--brand);
}

.mat-side-count {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--muted);
  background: #f4f4f6;
  border-radius: 99px;
  padding: 1px 8px;
  font-variant-numeric: tabular-nums;
}

.mat-tag-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 348px;
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 1px;
}

.mat-tag-row {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 7px;
  min-height: 30px;
}

.mat-tag-row:hover {
  background: #f7f7f9;
}

.mat-tag-row.is-on {
  background: var(--brand-soft);
}

.mat-tag-hit {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  padding: 5px 6px;
  border-radius: 7px;
  text-align: left;
  font-size: 12.5px;
  color: var(--sub);
}

.mat-tag-row.is-on .mat-tag-hit {
  color: var(--brand-700);
  font-weight: 600;
}

.mat-tag-hash {
  color: var(--faint);
  font-size: 11.5px;
  flex: 0 0 auto;
}

.mat-tag-row.is-on .mat-tag-hash {
  color: var(--brand);
}

.mat-tag-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mat-tag-count {
  margin-left: auto;
  flex: 0 0 auto;
  min-width: 20px;
  text-align: center;
  font-size: 10px;
  line-height: 1.6;
  color: var(--muted);
  background: #f2f2f4;
  border-radius: 99px;
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
}

.mat-tag-row.is-on .mat-tag-count {
  background: rgba(255, 255, 255, 0.7);
  color: var(--brand-700);
}

.mat-tag-del {
  flex: 0 0 auto;
  width: 23px;
  height: 23px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.14s, background 0.14s, color 0.14s;
}

.mat-tag-row:hover .mat-tag-del,
.mat-tag-del:focus-visible {
  opacity: 1;
}

.mat-tag-del:hover {
  background: var(--bad-soft);
  color: var(--bad);
}

.mat-tag-del svg {
  width: 11px;
  height: 11px;
}

/* 触屏设备没有 hover，删除按钮常显 */
@media (hover: none) {
  .mat-tag-del {
    opacity: 1;
  }
}

.mat-side-hint {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--muted);
}

.mat-side-empty {
  padding: 14px 8px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
}

.mat-tip {
  background: linear-gradient(150deg, #ffffff 0%, #fff7f8 100%);
  border-color: var(--brand-line);
}

.mat-tip-text {
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--sub);
}

.mat-tip-text b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.mat-tip-warn {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin: 8px 0 10px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  color: var(--warn);
  font-size: 11px;
  line-height: 1.6;
}

.mat-tip-warn svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  margin-top: 2px;
}

.mat-tip .btn-block {
  margin-top: 2px;
}

.mat-fallback {
  border-color: var(--warn-line);
  background: var(--warn-soft);
}

.mat-fallback .mat-side-title {
  color: var(--warn);
}

.mat-fallback .mat-side-title svg {
  color: var(--warn);
}

.mat-fallback .mat-tip-text {
  color: var(--warn);
  margin-top: 2px;
}

/* ---------------------------------------------------------------- 录入弹窗 */
.mat-editor {
  display: flex;
  flex-direction: column;
}

.mat-type-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.mat-type-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 7px 8px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fff;
  color: var(--sub);
  font-size: 12.5px;
  font-weight: 500;
  transition: all 0.14s;
}

.mat-type-card svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.mat-type-card:hover {
  border-color: #c2c5ca;
  color: var(--ink);
  background: #fafafb;
}

.mat-type-card.is-on {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-700);
  box-shadow: 0 0 0 2px rgba(255, 46, 77, 0.07);
  font-weight: 600;
}

.mat-tag-edit {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 38px;
  padding: 5px 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.mat-tag-edit:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(31, 32, 35, 0.08);
}

.mat-tag-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.mat-tag-placeholder {
  font-size: 12.5px;
  color: #a9acb3;
  padding: 1px 2px;
}

.mat-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 1px 2px 1px 8px;
  border: 1px solid var(--brand-line);
  background: var(--brand-soft);
  color: var(--brand-700);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.7;
}

.mat-tag-pill > button {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--brand-700);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.mat-tag-pill > button:hover {
  background: rgba(255, 46, 77, 0.13);
}

.mat-tag-pill > button svg {
  width: 10px;
  height: 10px;
}

.mat-tag-input {
  flex: 1 1 120px;
  min-width: 100px;
  height: 24px;
  min-height: 24px;
  padding: 0 2px;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--ink);
}

.mat-tag-input::placeholder {
  color: #a9acb3;
}

.mat-tag-suggest {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
  min-height: 0;
}

.mat-tag-suggest:empty {
  display: none;
}

.mat-suggest-label {
  font-size: 10.5px;
  color: var(--muted);
  margin-right: 1px;
}

.mat-suggest-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--sub);
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 11px;
  line-height: 1.7;
  transition: all 0.14s;
}

.mat-suggest-btn:hover {
  border-color: var(--brand-line);
  background: var(--brand-soft);
  color: var(--brand-700);
}

.mat-note-input {
  min-height: 66px;
}

.mat-switch-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.mat-switch-row .field-hint {
  margin-top: 0;
}

.mat-img-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.mat-img-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 132px;
  max-height: 260px;
  padding: 8px;
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  background: #fafafb;
  overflow: hidden;
}

.mat-img-preview img {
  display: block;
  max-width: 100%;
  max-height: 240px;
  width: auto;
  height: auto;
  border-radius: 6px;
  object-fit: contain;
}

.mat-img-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11.5px;
}

.mat-img-empty svg {
  width: 24px;
  height: 24px;
}

.mat-confirm-snippet {
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  background: #f7f7f9;
  border: 1px solid var(--line);
  color: var(--sub);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1180px) {
  .mat-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mat-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1020px) {
  .mat-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .mat-side {
    position: static;
    order: -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }

  .mat-tag-list {
    max-height: 188px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    gap: 1px 6px;
  }

  .mat-side-card {
    padding: 12px;
  }
}

@media (max-width: 720px) {
  /* 手机上把工具条提到最前，标签栏紧随其后，备份说明放到卡片流之后 */
  .mat-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .mat-main,
  .mat-side {
    display: contents;
  }

  .mat-toolbar {
    order: 1;
    margin-bottom: 0;
  }

  .mat-side-card:first-child {
    order: 2;
  }

  .mat-active {
    order: 3;
  }

  .mat-result-bar {
    order: 4;
  }

  .mat-cards {
    order: 5;
  }

  .mat-side .mat-tip {
    order: 6;
  }

  .mat-side .mat-fallback {
    order: 7;
  }

  .mat-stats {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .mat-stats::-webkit-scrollbar {
    display: none;
  }

  .mat-stat {
    flex: 1 0 110px;
    padding: 10px 12px;
  }

  .mat-stat-value {
    font-size: 22px;
  }

  .mat-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .mat-tool-right {
    width: 100%;
    margin-left: 0;
  }

  .mat-sort {
    flex: 1 1 auto;
  }

  .mat-sort .select {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
  }

  .mat-view {
    margin-left: auto;
  }

  .mat-filter-sep {
    display: none;
  }

  .mat-side {
    grid-template-columns: minmax(0, 1fr);
  }

  .mat-tag-list {
    max-height: 196px;
  }

  .mat-type-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mat-cards.is-list .mat-thumb {
    width: 88px;
    flex-basis: 88px;
  }

  .mat-cards.is-list .mat-times {
    flex-direction: column;
    gap: 1px;
  }
}

@media (max-width: 560px) {
  .mat-filter-label {
    min-width: auto;
  }

  .mat-toolbar {
    padding: 12px;
  }

  .mat-tool-row {
    gap: 8px;
  }

  .mat-search {
    flex-basis: 100%;
  }

  .mat-type-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mat-switch-row {
    gap: 8px 16px;
  }

  .mat-card {
    padding: 12px 12px 10px;
  }

  .mat-card-foot {
    gap: 4px;
  }

  .mat-actions {
    gap: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mat-card,
  .mat-tag,
  .mat-chip,
  .mat-icon-btn,
  .mat-type-card {
    transition: none;
  }

  .mat-card:hover {
    transform: none;
  }
}
