/* MioFlow Design System — Obsidian / Bronze Gold / Silver */
:root {
  color-scheme: dark;

  /* Brand */
  --mio-gold-300: #d7b56d;
  --mio-gold-400: #b8893f;
  --mio-gold-500: #936a2e;
  --mio-gold-600: #6f4d22;
  --mio-gold-rgb: 184, 137, 63;

  /* Neutral surfaces */
  --mio-black: #070708;
  --mio-bg: #0a0a0b;
  --mio-surface-1: #101012;
  --mio-surface-2: #151517;
  --mio-surface-3: #1b1b1e;
  --mio-surface-4: #222226;
  --mio-overlay: rgba(2, 5, 14, 0.85);

  /* Text */
  --mio-text-1: #f3f1ed;
  --mio-text-2: #bbb8b1;
  --mio-text-3: #7f7d78;
  --mio-text-disabled: #55534f;
  --mio-text-inverse: #14110c;

  /* Lines */
  --mio-line-soft: rgba(255, 255, 255, 0.06);
  --mio-line: rgba(255, 255, 255, 0.10);
  --mio-line-strong: rgba(255, 255, 255, 0.16);
  --mio-line-gold: rgba(var(--mio-gold-rgb), 0.38);

  /* Semantic */
  --mio-success: #75a884;
  --mio-warning: #c6a15c;
  --mio-danger: #c46f6f;
  --mio-info: #8299b7;

  /* Typography */
  --mio-font-sans: Inter, "SF Pro Display", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mio-font-mono: "SFMono-Regular", "JetBrains Mono", Consolas, monospace;
  --mio-text-xs: 11px;
  --mio-text-sm: 12px;
  --mio-text-md: 14px;
  --mio-text-lg: 16px;
  --mio-text-xl: 20px;
  --mio-text-2xl: 26px;
  --mio-text-3xl: 36px;

  /* Spacing — 4px base */
  --mio-space-1: 4px;
  --mio-space-2: 8px;
  --mio-space-3: 12px;
  --mio-space-4: 16px;
  --mio-space-5: 20px;
  --mio-space-6: 24px;
  --mio-space-8: 32px;
  --mio-space-10: 40px;
  --mio-space-12: 48px;

  /* Shape */
  --mio-radius-xs: 4px;
  --mio-radius-sm: 7px;
  --mio-radius-md: 10px;
  --mio-radius-lg: 14px;
  --mio-radius-xl: 18px;
  --mio-radius-pill: 999px;

  /* Elevation */
  --mio-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.28);
  --mio-shadow-2: 0 12px 30px rgba(0, 0, 0, 0.28);
  --mio-shadow-3: 0 24px 64px rgba(0, 0, 0, 0.46);
  --mio-focus: 0 0 0 3px rgba(var(--mio-gold-rgb), 0.16);

  /* Layout */
  --mio-sidebar-width: 72px;
  --mio-header-height: 60px;
  --mio-content-max: 1440px;

  /* Motion */
  --mio-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mio-duration-fast: 140ms;
  --mio-duration: 220ms;
  --mio-duration-slow: 360ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--mio-bg); }
body {
  margin: 0;
  color: var(--mio-text-1);
  background:
    radial-gradient(900px 520px at 82% -12%, rgba(var(--mio-gold-rgb), 0.055), transparent 64%),
    var(--mio-bg);
  font-family: var(--mio-font-sans);
  font-size: var(--mio-text-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
::selection { color: var(--mio-text-inverse); background: var(--mio-gold-300); }

.mio-page-title { margin: 0; font-size: var(--mio-text-2xl); line-height: 1.25; font-weight: 650; letter-spacing: -0.02em; }
.mio-section-title { margin: 0; font-size: var(--mio-text-lg); line-height: 1.35; font-weight: 620; }
.mio-caption { color: var(--mio-text-3); font-size: var(--mio-text-sm); }
.mio-mono { font-family: var(--mio-font-mono); font-variant-numeric: tabular-nums; }

.mio-panel {
  background: var(--mio-surface-1);
  border: 1px solid var(--mio-line);
  border-radius: var(--mio-radius-lg);
  box-shadow: var(--mio-shadow-1);
}
.mio-card {
  background: var(--mio-surface-2);
  border: 1px solid var(--mio-line-soft);
  border-radius: var(--mio-radius-md);
  transition: border-color var(--mio-duration) var(--mio-ease), transform var(--mio-duration) var(--mio-ease), background var(--mio-duration) var(--mio-ease);
}
.mio-card.is-interactive:hover { background: var(--mio-surface-3); border-color: var(--mio-line-strong); transform: translateY(-1px); }

.mio-btn {
  min-height: 36px; padding: 0 14px; border-radius: var(--mio-radius-sm);
  border: 1px solid var(--mio-line); background: var(--mio-surface-2);
  color: var(--mio-text-1); display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  cursor: pointer; font-weight: 560; transition: all var(--mio-duration-fast) var(--mio-ease);
}
.mio-btn:hover { background: var(--mio-surface-3); border-color: var(--mio-line-strong); }
.mio-btn:focus-visible { outline: none; box-shadow: var(--mio-focus); border-color: var(--mio-line-gold); }
.mio-btn--primary { color: var(--mio-text-inverse); background: var(--mio-gold-400); border-color: var(--mio-gold-400); }
.mio-btn--primary:hover { background: var(--mio-gold-300); border-color: var(--mio-gold-300); }
.mio-btn--quiet { background: transparent; border-color: transparent; color: var(--mio-text-2); }
.mio-btn--danger { color: #e5aaaa; border-color: rgba(196, 111, 111, 0.28); background: rgba(196, 111, 111, 0.08); }
.mio-btn:disabled { opacity: 0.38; cursor: not-allowed; transform: none; }
.mio-back-btn {
  min-height: 38px; padding: 0 15px; border: 1px solid var(--mio-line-strong); border-radius: var(--mio-radius-md);
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--mio-text-1); background: var(--mio-surface-1); cursor: pointer;
  font-weight: 540; text-decoration: none;
  box-shadow: var(--mio-shadow-1);
  transition: color var(--mio-duration-fast), background var(--mio-duration-fast), border-color var(--mio-duration-fast);
}
.mio-back-btn:hover { color: var(--mio-gold-300); background: var(--mio-surface-2); border-color: var(--mio-line-gold); }
.mio-back-btn:focus-visible { outline: none; box-shadow: var(--mio-focus); }
.mio-back-btn__chevron { font-size: 20px; line-height: 1; font-weight: 600; transform: translateY(-1px); }

.mio-field { display: grid; gap: 7px; }
.mio-label { color: var(--mio-text-2); font-size: var(--mio-text-sm); font-weight: 550; }
.mio-input, .mio-select, .mio-textarea {
  width: 100%; min-height: 40px; padding: 9px 12px;
  color: var(--mio-text-1); background: var(--mio-surface-1);
  border: 1px solid var(--mio-line); border-radius: var(--mio-radius-sm); outline: none;
  transition: border-color var(--mio-duration-fast), box-shadow var(--mio-duration-fast), background var(--mio-duration-fast);
}
.mio-input:hover, .mio-select:hover, .mio-textarea:hover { border-color: var(--mio-line-strong); }
.mio-input:focus, .mio-select:focus, .mio-textarea:focus { border-color: var(--mio-line-gold); box-shadow: var(--mio-focus); background: var(--mio-surface-2); }
.mio-input::placeholder, .mio-textarea::placeholder { color: var(--mio-text-disabled); }
.mio-textarea { min-height: 88px; resize: vertical; }

.mio-tabs {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--mio-surface-1); border: 1px solid var(--mio-line); border-radius: var(--mio-radius-md);
}
.mio-tab {
  min-height: 32px; padding: 0 14px; border: 0; border-radius: var(--mio-radius-sm);
  color: var(--mio-text-3); background: transparent; cursor: pointer; font-weight: 560;
}
.mio-tab:hover { color: var(--mio-text-1); background: var(--mio-surface-2); }
.mio-tab.is-active { color: var(--mio-text-inverse); background: var(--mio-gold-400); }

.mio-badge {
  min-height: 22px; padding: 2px 8px; border-radius: var(--mio-radius-pill);
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--mio-text-2); background: var(--mio-surface-3); border: 1px solid var(--mio-line);
  font-size: var(--mio-text-xs); font-weight: 600;
}
.mio-badge--gold { color: var(--mio-gold-300); background: rgba(var(--mio-gold-rgb), 0.09); border-color: rgba(var(--mio-gold-rgb), 0.24); }

.mio-app-shell { min-height: 100vh; padding-left: var(--mio-sidebar-width); }
.mio-sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 50; width: var(--mio-sidebar-width);
  padding: 16px 8px; display: flex; flex-direction: column; align-items: center;
  background: rgba(8,8,9,.96); border-right: 1px solid var(--mio-line-soft);
}
.mio-sidebar__brand {
  width: 38px; height: 38px; margin-bottom: 22px; border-radius: var(--mio-radius-md);
  display: grid; place-items: center; color: var(--mio-text-inverse); background: var(--mio-gold-400);
  font-weight: 800; text-decoration: none;
}
.mio-sidebar__nav { width: 100%; display: grid; gap: 5px; }
.mio-sidebar__item {
  min-height: 50px; border-radius: var(--mio-radius-sm); display: grid; place-items: center; gap: 2px;
  color: var(--mio-text-3); text-decoration: none; font-size: var(--mio-text-xs);
}
.mio-sidebar__item:hover { color: var(--mio-text-1); background: var(--mio-surface-2); }
.mio-sidebar__item.is-active { color: var(--mio-gold-300); background: rgba(var(--mio-gold-rgb),.09); box-shadow: inset 2px 0 var(--mio-gold-400); }
.mio-sidebar__avatar { width: 32px; height: 32px; margin-top: auto; border-radius: 50%; background: var(--mio-surface-4); border: 1px solid var(--mio-line); }

.mio-header {
  height: var(--mio-header-height); padding: 0 24px; display: flex; align-items: center; gap: 16px;
  background: rgba(10,10,11,.82); border-bottom: 1px solid var(--mio-line-soft); backdrop-filter: blur(18px);
}
.mio-header__title { min-width: 0; color: var(--mio-text-1); font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mio-header__center { margin: 0 auto; }
.mio-header__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Product/module header: shared by top-level tools such as Inspiration, Notes and Writing. */
.mio-product-header {
  height: 62px;
  min-width: 0;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--mio-line-soft);
  background: rgba(10,10,11,.94);
  backdrop-filter: blur(18px);
}
.mio-product-header__actions {
  min-width: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mio-product-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--mio-text-1);
  text-decoration: none;
}
.mio-product-brand__mark {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid rgba(var(--mio-gold-rgb), .24);
  border-radius: var(--mio-radius-md);
  color: var(--mio-gold-300);
  background: rgba(var(--mio-gold-rgb), .08);
}
.mio-product-brand__mark svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mio-product-brand__copy {
  min-width: 0;
}
.mio-product-brand__title {
  margin: 0;
  display: block;
  overflow: hidden;
  color: var(--mio-text-1);
  font-size: 14px;
  font-weight: 620;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mio-product-brand__subtitle {
  margin-top: 1px;
  display: block;
  overflow: hidden;
  color: var(--mio-text-3);
  font-size: var(--mio-text-xs);
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Shared project rail and compact project card. */
.mio-project-rail {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--mio-line);
  border-radius: 14px;
  background: #0c0c0e;
}
.mio-project-rail__head {
  height: 52px;
  padding: 0 12px 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--mio-line-soft);
}
.mio-project-rail__head > div { display: flex; align-items: center; gap: 7px; }
.mio-project-rail__head strong { color: var(--mio-text-2); font-size: 12px; font-weight: 650; }
.mio-project-rail__head span { color: var(--mio-text-3); font: 500 9px/1 var(--mio-font-mono); }
.mio-project-rail__head > button {
  width: 27px;
  height: 27px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--mio-gold-300);
  border: 1px solid rgba(var(--mio-gold-rgb),.2);
  border-radius: 7px;
  background: rgba(var(--mio-gold-rgb),.06);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.mio-project-rail__head > button:hover { border-color: rgba(var(--mio-gold-rgb),.38); background: rgba(var(--mio-gold-rgb),.1); }
.mio-project-rail__search {
  height: 30px;
  margin: 7px 9px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--mio-line);
  border-radius: 7px;
  background: #111113;
}
.mio-project-rail__search:focus-within { border-color: var(--mio-line-gold); box-shadow: var(--mio-focus); }
.mio-project-rail__search svg { width: 12px; flex: none; color: var(--mio-text-3); stroke-width: 1.8; stroke-linecap: round; }
.mio-project-rail__search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--mio-text-2);
  background: transparent;
  font-size: 10px;
}
.mio-project-rail__search input::placeholder { color: var(--mio-text-disabled); }
.mio-project-rail__list {
  min-height: 0;
  padding: 4px 9px 12px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--mio-surface-4) transparent;
}
.mio-project-card {
  position: relative;
  margin-bottom: 5px;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: border-color .15s ease, background .15s ease;
}
.mio-project-card:hover { background: rgba(255,255,255,.027); }
.mio-project-card.is-active { border-color: rgba(var(--mio-gold-rgb),.24); background: rgba(var(--mio-gold-rgb),.075); }
.mio-project-card__body {
  width: 100%;
  min-width: 0;
  padding: 12px;
  display: block;
  color: inherit;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.mio-project-card__body > strong {
  display: block;
  overflow: hidden;
  color: #bdb9b1;
  padding-right: 28px;
  font-size: 11px;
  font-weight: 620;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mio-project-card.is-active .mio-project-card__body > strong { color: #e2dccf; }
.mio-project-card__body > p {
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--mio-text-3);
  padding-right: 28px;
  font-size: 9px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mio-project-card__meta {
  min-width: 0;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  color: var(--mio-text-4);
  font: 500 8.5px/1.4 var(--mio-font-sans);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mio-project-card__tag {
  height: 17px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  flex: none;
  color: var(--mio-text-3);
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 999px;
  background: rgba(255,255,255,.025);
  line-height: 1;
}
.mio-project-card__tag.is-status {
  color: #bda367;
  border-color: rgba(var(--mio-gold-rgb),.15);
  background: rgba(var(--mio-gold-rgb),.055);
}
.mio-project-card__tag.is-failed {
  color: #c98780;
  border-color: rgba(177,74,66,.18);
  background: rgba(177,74,66,.065);
}
.mio-project-card__stat { flex: none; color: var(--mio-text-3); }
.mio-project-card__meta time {
  min-width: 0;
  overflow: hidden;
  color: var(--mio-text-4);
  text-overflow: ellipsis;
}
.mio-project-card__delete {
  width: 24px;
  height: 24px;
  padding: 0;
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--mio-text-3);
  border: 0;
  border-radius: 6px;
  background: rgba(12,12,14,.94);
  box-shadow: -8px 0 14px rgba(12,12,14,.9);
  transition: opacity .15s ease, color .15s ease, background .15s ease;
}
.mio-project-card:hover .mio-project-card__delete,
.mio-project-card:focus-within .mio-project-card__delete { opacity: 1; pointer-events: auto; }
.mio-project-card__delete:hover { color: #d88f88; background: rgba(177,74,66,.12); }
.mio-project-card__delete svg { width: 13px; height: 13px; stroke-width: 1.7; stroke-linecap: round; }
.mio-project-card__progress {
  height: 2px;
  position: absolute;
  right: 10px;
  bottom: 4px;
  left: 10px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--mio-surface-4);
}
.mio-project-card__progress b { height: 100%; display: block; background: var(--mio-gold-400); }

/* Title-only project card shared by Notes and Writing project rails. */
.mio-project-rail .mio-project-card--title-only {
  margin-bottom: 2px;
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
  transform: none;
}
.mio-project-rail .mio-project-card--title-only:hover {
  background: rgba(255,255,255,.05);
  box-shadow: none;
  transform: none;
}
.mio-project-rail .mio-project-card--title-only.is-active {
  background: rgba(255,255,255,.09);
}
.mio-project-card--title-only .mio-project-card__body {
  min-height: 36px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  border-radius: 7px;
  transition: padding-right .14s ease;
}
.mio-project-card--title-only:hover .mio-project-card__body,
.mio-project-card--title-only:focus-within .mio-project-card__body { padding-right: 64px; }
.mio-project-card--title-only .mio-project-card__body > strong {
  min-width: 0;
  flex: 1;
  padding-right: 0;
  color: #c7c4be;
  font-size: 11px;
  font-weight: 520;
  line-height: 1.35;
}
.mio-project-card--title-only.is-active .mio-project-card__body > strong { color: #f0eee9; font-weight: 590; }
.mio-project-card__leading {
  width: 15px;
  height: 15px;
  margin-right: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 15px;
  color: #77746e;
}
.mio-project-card__leading svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mio-project-card--title-only.is-active .mio-project-card__leading { color: #aaa69e; }
.mio-project-card__leading--audio,
.mio-project-card__leading--link,
.mio-project-card__leading--note { color: #89857d; }
.mio-project-card--title-only.is-active .mio-project-card__leading--audio,
.mio-project-card--title-only.is-active .mio-project-card__leading--link,
.mio-project-card--title-only.is-active .mio-project-card__leading--note { color: var(--mio-gold-300); }
.mio-project-card__actions {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 5px;
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0;
  transform: translateY(-50%);
  pointer-events: none;
  transition: opacity .15s ease;
}
.mio-project-card:hover .mio-project-card__actions,
.mio-project-card:focus-within .mio-project-card__actions {
  opacity: 1;
  pointer-events: auto;
}
.mio-project-card__action {
  width: 25px;
  height: 25px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--mio-text-3);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  background: rgba(28,28,30,.96);
  cursor: pointer;
  box-shadow: none;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.mio-project-card__action svg {
  width: 13px;
  height: 13px;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mio-project-card__action--edit:hover {
  color: var(--mio-gold-300);
  border-color: rgba(var(--mio-gold-rgb),.24);
  background: rgba(var(--mio-gold-rgb),.11);
}
.mio-project-card__action--delete:hover {
  color: #d88f88;
  border-color: rgba(177,74,66,.2);
  background: rgba(177,74,66,.11);
}

/* Detail/workbench header: back + title + optional workflow + page actions. */
.mio-detail-header.mio-detail-header {
  height: var(--mio-header-height); min-height: var(--mio-header-height);
  padding: 0 24px; position: relative; display: flex; align-items: center; gap: 16px;
  color: var(--mio-text-1); background: rgba(10,10,11,.88);
  border-bottom: 1px solid var(--mio-line-soft); backdrop-filter: blur(18px);
}
.mio-detail-header__start {
  min-width: 0; display: flex; align-items: center; gap: 14px;
}
.mio-detail-header__title {
  min-width: 0; max-width: min(32vw,360px); margin: 0;
  overflow: hidden; color: var(--mio-text-2);
  font-size: 13px; font-weight: 580; line-height: 1.35;
  white-space: nowrap; text-overflow: ellipsis; letter-spacing: 0;
}
.mio-detail-header__center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
}
.mio-detail-header__actions {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
}
.mio-detail-header.mio-detail-header .mio-back-btn {
  height: 38px; min-height: 38px; padding: 0 15px;
  color: var(--mio-text-1); background: var(--mio-surface-1);
  border: 1px solid var(--mio-line-strong); border-radius: var(--mio-radius-md);
  font-size: 13px; font-weight: 540; box-shadow: var(--mio-shadow-1);
}
.mio-detail-header.mio-detail-header .mio-back-btn__chevron {
  color: var(--mio-text-2); font-family: Arial, sans-serif;
}
.mio-detail-header.mio-detail-header .mio-detail-header__title {
  padding: 0; color: var(--mio-text-2);
  font-size: 13px; font-weight: 580; line-height: 1.35;
}
@media (max-width: 820px) {
  .mio-detail-header.mio-detail-header { padding: 0 14px; gap: 10px; }
  .mio-detail-header__start { gap: 10px; }
  .mio-detail-header__title { max-width: 34vw; }
  .mio-detail-header__center { display: none; }
}

.mio-icon-btn {
  width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center;
  border: 1px solid var(--mio-line); border-radius: var(--mio-radius-sm);
  color: var(--mio-text-2); background: var(--mio-surface-1); cursor: pointer;
}
.mio-icon-btn:hover { color: var(--mio-text-1); background: var(--mio-surface-3); border-color: var(--mio-line-strong); }
.mio-icon-btn--compact { width: 30px; height: 30px; border-radius: 6px; }

/* Modal / Drawer close: icon only, never pair the X with “关闭” text. */
button.mio-close-btn {
  position: relative; width: 32px; height: 32px; padding: 0; flex: 0 0 32px;
  border: 1px solid var(--mio-line); border-radius: var(--mio-radius-sm);
  color: var(--mio-text-3); background: var(--mio-surface-2); cursor: pointer;
  transition: color 140ms var(--mio-ease), background-color 140ms var(--mio-ease), border-color 140ms var(--mio-ease);
}
button.mio-close-btn::before,
button.mio-close-btn::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 12px; height: 1.5px;
  border-radius: 999px; background: currentColor;
}
button.mio-close-btn::before { transform: translate(-50%, -50%) rotate(45deg); }
button.mio-close-btn::after { transform: translate(-50%, -50%) rotate(-45deg); }
button.mio-close-btn:hover { color: var(--mio-text-1); background: var(--mio-surface-4); border-color: var(--mio-line-strong); }
button.mio-close-btn:focus-visible { outline: none; box-shadow: var(--mio-focus); }

.mio-menu {
  width: 220px; padding: 6px; background: var(--mio-surface-2); border: 1px solid var(--mio-line);
  border-radius: var(--mio-radius-md); box-shadow: var(--mio-shadow-3);
}
.mio-menu__label { padding: 7px 9px; color: var(--mio-text-3); font-size: var(--mio-text-xs); }
.mio-menu__item {
  width: 100%; min-height: 34px; padding: 0 9px; border: 0; border-radius: var(--mio-radius-sm);
  display: flex; align-items: center; gap: 9px; color: var(--mio-text-2); background: transparent; cursor: pointer;
}
.mio-menu__item:hover { color: var(--mio-text-1); background: var(--mio-surface-4); }
.mio-menu__item.is-danger { color: #d88d8d; }

/* Episode selector: shared by series and Agent workbenches. */
.mio-episode-select {
  position: relative; min-width: 0; display: inline-flex; align-items: center;
}
.mio-episode-select.has-context-chevron { gap: 8px; }
.mio-episode-select.has-context-chevron::before {
  content: ''; width: 6px; height: 6px; flex: none; border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor; color: var(--mio-text-3); transform: rotate(45deg);
}
.mio-episode-select[hidden], .mio-episode-select__menu[hidden] { display: none !important; }
.mio-episode-select__trigger {
  height: 32px; max-width: 168px; padding: 0 10px; border: 1px solid var(--mio-line);
  border-radius: var(--mio-radius-md); background: var(--mio-surface-2); color: var(--mio-text-2);
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap;
  font-size: 12px; font-weight: 560; box-shadow: var(--mio-shadow-1);
  transition: color var(--mio-duration-fast), background var(--mio-duration-fast), border-color var(--mio-duration-fast);
}
.mio-episode-select__trigger:hover,
.mio-episode-select__trigger[aria-expanded="true"] {
  color: var(--mio-text-1); background: var(--mio-surface-3); border-color: var(--mio-line-strong);
}
.mio-episode-select__trigger:focus-visible { outline: none; border-color: var(--mio-line-gold); box-shadow: var(--mio-focus); }
.mio-episode-select__trigger-label {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mio-episode-select__chevron {
  width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; color: var(--mio-text-3);
  transition: transform var(--mio-duration-fast) var(--mio-ease);
}
.mio-chevron-icon {
  width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.mio-episode-select__trigger[aria-expanded="true"] .mio-episode-select__chevron { transform: rotate(180deg); }
.mio-episode-select__menu {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 120; width: 240px; max-width: calc(100vw - 32px);
  padding: 7px; border: 1px solid var(--mio-line); border-radius: var(--mio-radius-lg);
  background: var(--mio-surface-1); box-shadow: var(--mio-shadow-3);
}
.mio-episode-select__item {
  width: 100%; min-height: 40px; padding: 6px 8px; border: 0; border-radius: var(--mio-radius-md);
  display: flex; align-items: center; gap: 10px; color: var(--mio-text-2); background: transparent;
  text-align: left; cursor: pointer; font-size: 12px;
  transition: color var(--mio-duration-fast), background var(--mio-duration-fast);
}
.mio-episode-select__item:hover { color: var(--mio-text-1); background: var(--mio-surface-3); }
.mio-episode-select__item.is-active { color: var(--mio-text-1); background: rgba(var(--mio-gold-rgb), .14); }
.mio-episode-select__number {
  width: 28px; height: 28px; flex: none; border: 1px solid var(--mio-line); border-radius: var(--mio-radius-sm);
  display: inline-flex; align-items: center; justify-content: center; color: var(--mio-text-2);
  background: var(--mio-surface-2); font-family: var(--mio-font-mono); font-variant-numeric: tabular-nums;
}
.mio-episode-select__item.is-active .mio-episode-select__number {
  color: var(--mio-gold-300); border-color: rgba(var(--mio-gold-rgb), .18); background: rgba(var(--mio-gold-rgb), .10);
}
.mio-episode-select__label {
  min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mio-episode-select__divider { height: 1px; margin: 6px 3px; background: var(--mio-line-soft); }
.mio-episode-select__item.is-create { color: var(--mio-gold-300); }
.mio-episode-select__item.is-create .mio-episode-select__number {
  color: var(--mio-gold-300); border-color: transparent; background: rgba(var(--mio-gold-rgb), .08);
  font-family: var(--mio-font-sans); font-size: 18px;
}
.mio-episode-select__item.is-create:hover { color: var(--mio-gold-300); background: rgba(var(--mio-gold-rgb), .10); }
.mio-episode-select__item:disabled { opacity: .42; cursor: wait; }

.mio-table-wrap { overflow: auto; border: 1px solid var(--mio-line); border-radius: var(--mio-radius-md); }
.mio-table { width: 100%; border-collapse: collapse; font-size: var(--mio-text-sm); }
.mio-table th {
  height: 40px; padding: 0 14px; color: var(--mio-text-3); background: var(--mio-surface-1);
  border-bottom: 1px solid var(--mio-line); text-align: left; font-weight: 560; white-space: nowrap;
}
.mio-table td { height: 48px; padding: 0 14px; color: var(--mio-text-2); border-bottom: 1px solid var(--mio-line-soft); }
.mio-table tbody tr:last-child td { border-bottom: 0; }
.mio-table tbody tr:hover td { background: rgba(255,255,255,.018); color: var(--mio-text-1); }

.mio-progress { height: 6px; overflow: hidden; background: var(--mio-surface-4); border-radius: var(--mio-radius-pill); }
.mio-progress__bar { height: 100%; width: var(--mio-progress, 50%); background: var(--mio-gold-400); border-radius: inherit; }
.mio-steps { display: flex; align-items: center; gap: 0; }
.mio-step { display: flex; align-items: center; gap: 8px; color: var(--mio-text-3); font-size: var(--mio-text-sm); }
.mio-step:not(:last-child)::after { content: ""; width: 38px; height: 1px; margin: 0 10px; background: var(--mio-line); }
.mio-step__index { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--mio-surface-3); border: 1px solid var(--mio-line); font-size: var(--mio-text-xs); }
.mio-step.is-active { color: var(--mio-text-1); }
.mio-step.is-active .mio-step__index { color: var(--mio-text-inverse); background: var(--mio-gold-400); border-color: var(--mio-gold-400); }
.mio-step.is-done .mio-step__index { color: var(--mio-gold-300); border-color: var(--mio-line-gold); }

.mio-upload {
  min-height: 150px; padding: 24px; display: grid; place-items: center; text-align: center;
  color: var(--mio-text-3); background: rgba(255,255,255,.012); border: 1px dashed var(--mio-line-strong);
  border-radius: var(--mio-radius-md); cursor: pointer;
}
.mio-upload:hover { color: var(--mio-text-2); border-color: var(--mio-line-gold); background: rgba(var(--mio-gold-rgb),.025); }
.mio-file {
  padding: 10px 12px; display: flex; align-items: center; gap: 10px;
  background: var(--mio-surface-2); border: 1px solid var(--mio-line); border-radius: var(--mio-radius-sm);
}
.mio-file__icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; color: var(--mio-gold-300); background: rgba(var(--mio-gold-rgb),.09); }
.mio-file__meta { min-width: 0; flex: 1; }
.mio-file__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--mio-text-1); font-size: var(--mio-text-sm); }
.mio-file__size { color: var(--mio-text-3); font-size: var(--mio-text-xs); }

/* Image / video upload — shared media picker */
.mio-media-upload {
  position: relative; min-height: 156px; padding: 20px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--mio-text-3); background: rgba(255,255,255,.012);
  border: 1px dashed var(--mio-line-strong); border-radius: var(--mio-radius-md);
  cursor: pointer; outline: none;
  transition: color var(--mio-duration-fast), border-color var(--mio-duration-fast), background var(--mio-duration-fast);
}
.mio-media-upload:hover,
.mio-media-upload:focus-within,
.mio-media-upload.is-dragover {
  color: var(--mio-text-2); border-color: rgba(var(--mio-gold-rgb),.42); background: rgba(var(--mio-gold-rgb),.025);
}
.mio-media-upload:focus-within { box-shadow: 0 0 0 2px rgba(var(--mio-gold-rgb),.11); }
.mio-media-upload__input {
  width: 1px; height: 1px; position: absolute; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.mio-media-upload__empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; }
.mio-media-upload__icon {
  width: 38px; height: 38px; margin-bottom: 2px; display: grid; place-items: center;
  color: var(--mio-text-3); background: var(--mio-surface-2); border: 1px solid var(--mio-line); border-radius: 50%;
  transition: color var(--mio-duration-fast), border-color var(--mio-duration-fast), background var(--mio-duration-fast);
}
.mio-media-upload:hover .mio-media-upload__icon,
.mio-media-upload:focus-within .mio-media-upload__icon,
.mio-media-upload.is-dragover .mio-media-upload__icon {
  color: var(--mio-gold-300); border-color: rgba(var(--mio-gold-rgb),.25); background: rgba(var(--mio-gold-rgb),.07);
}
.mio-media-upload__icon svg { width: 17px; height: 17px; }
.mio-media-upload__title { color: var(--mio-text-2); font-size: var(--mio-text-sm); font-weight: 580; line-height: 1.3; }
.mio-media-upload__hint { color: var(--mio-text-3); font-size: var(--mio-text-xs); line-height: 1.45; }
.mio-media-upload__preview { position: absolute; inset: 0; display: none; background: var(--mio-bg); }
.mio-media-upload__preview img,
.mio-media-upload__preview video { width: 100%; height: 100%; display: block; object-fit: contain; background: var(--mio-bg); }
.mio-media-upload.is-selected { padding: 0; border-style: solid; cursor: default; }
.mio-media-upload.is-selected .mio-media-upload__empty { display: none; }
.mio-media-upload.is-selected .mio-media-upload__preview { display: block; }
.mio-media-upload__meta {
  min-width: 0; padding: 24px 12px 10px; position: absolute; right: 0; bottom: 0; left: 0;
  display: flex; align-items: flex-end; gap: 8px; color: var(--mio-text-2); text-align: left;
  background: linear-gradient(transparent, rgba(0,0,0,.86));
}
.mio-media-upload__name { min-width: 0; flex: 1; overflow: hidden; font-size: var(--mio-text-xs); text-overflow: ellipsis; white-space: nowrap; }
.mio-media-upload__remove {
  width: 28px; height: 28px; padding: 0; flex: none; display: grid; place-items: center;
  color: var(--mio-text-2); background: rgba(10,10,11,.72); border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--mio-radius-sm); cursor: pointer;
}
.mio-media-upload__remove:hover { color: #e2a19a; border-color: rgba(196,111,111,.35); background: rgba(112,37,31,.4); }
.mio-media-upload.is-compact { min-height: 112px; padding: 14px; }
.mio-media-upload.is-compact .mio-media-upload__icon { width: 32px; height: 32px; }
.mio-media-upload.is-disabled { opacity: .42; cursor: not-allowed; pointer-events: none; }

/* Asset editor — single visual contract shared by Creation workbench and Agent. */
html .mio-asset-editor {
  position: fixed; inset: 0; z-index: 200; padding: 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--mio-overlay); backdrop-filter: blur(8px);
}
.mio-asset-editor,
.mio-asset-editor * { font-family: var(--mio-font-sans); }
.mio-asset-editor[hidden] { display: none; }
.mio-asset-editor .mio-asset-editor__backdrop {
  position: absolute; inset: 0; background: transparent; backdrop-filter: none;
}
.mio-asset-editor .mio-asset-editor__dialog {
  position: relative; width: min(1152px, 100%); height: 84vh; max-width: 96vw; max-height: 900px;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--mio-surface-1); border: 1px solid var(--mio-line); border-radius: var(--mio-radius-lg);
  box-shadow: var(--mio-shadow-3); animation: mioAssetEditorIn 200ms var(--mio-ease);
}
@keyframes mioAssetEditorIn {
  from { opacity: 0; transform: scale(.97) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.mio-asset-editor .mio-asset-editor__header {
  height: 48px; padding: 0 20px; flex: none; display: flex; align-items: center; justify-content: space-between;
  background: var(--mio-surface-1); border-bottom: 1px solid var(--mio-line-soft);
}
.mio-asset-editor .mio-asset-editor__title { color: var(--mio-text-1); font-size: var(--mio-text-md); font-weight: 650; }
.mio-asset-editor .mio-asset-editor__body { min-height: 0; flex: 1; display: flex; overflow: hidden; }
.mio-asset-editor .mio-asset-editor__aside {
  width: 46%; max-width: 500px; flex: none; display: flex; flex-direction: column; min-height: 0;
  background: rgba(7,7,8,.45); border-right: 1px solid var(--mio-line-soft); overflow: hidden;
}
.mio-asset-editor .mio-asset-editor__aside-top { padding: 16px; flex: none; }
.mio-asset-editor .mio-asset-editor__preview {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  background: var(--mio-bg); border: 1px solid var(--mio-line); border-radius: var(--mio-radius-md);
}
.mio-asset-editor .mio-asset-editor__preview > img { width: 100%; height: 100%; display: block; object-fit: contain; }
.mio-asset-editor .mio-asset-editor__main { min-width: 0; min-height: 0; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.mio-asset-editor .mio-asset-editor__form-head { padding: 20px 20px 0; flex: none; }
.mio-asset-editor .mio-asset-editor__scroll {
  min-height: 0; padding: 14px 20px 18px; flex: 1; display: flex; flex-direction: column; gap: 12px;
  overflow-x: hidden; overflow-y: auto;
}
.mio-asset-editor .mio-asset-editor__footer {
  padding: 12px 16px; flex: none; display: flex; align-items: center; gap: 10px;
  background: var(--mio-surface-1); border-top: 1px solid var(--mio-line-soft);
}
.mio-asset-editor .mio-asset-editor__footer .mio-asset-editor__submit { margin-left: auto; min-width: 180px; }
.mio-asset-editor .mio-label { display: block; margin-bottom: 6px; color: var(--mio-text-3); font-size: 10px; font-weight: 650; letter-spacing: .04em; }
.mio-asset-editor .mio-required { margin-left: 3px; color: #ff6b8f; }
.mio-asset-editor .mio-field { display: flex; flex-direction: column; gap: 6px; }
.mio-asset-editor .mio-field > .mio-label { margin-bottom: 0; }
.mio-asset-editor .mio-asset-editor__section { display: flex; flex-direction: column; gap: 10px; }
.mio-asset-editor .mio-input,
.mio-asset-editor .mio-textarea {
  width: 100%; color: var(--mio-text-1); background: var(--mio-bg); border: 1px solid var(--mio-line-strong);
  border-radius: var(--mio-radius-sm); outline: none;
}
.mio-asset-editor .mio-input { height: 40px; min-height: 40px; padding: 0 12px; font-size: 13.5px; }
.mio-asset-editor .mio-textarea {
  width: 100%; min-width: 0; height: 150px; min-height: 150px; max-height: 150px;
  padding: 10px 12px; flex: none; overflow-y: auto; resize: none; font-size: 13.5px; line-height: 1.7;
}
.mio-asset-editor .mio-input:focus,
.mio-asset-editor .mio-textarea:focus { border-color: rgba(var(--mio-gold-rgb),.5); box-shadow: var(--mio-focus); }
.mio-asset-editor .mio-media-upload.m-ref-add,
.mio-asset-editor .mio-media-upload.m-pick-sq { width: 100%; height: auto; flex: 1 0 100%; }
.mio-asset-editor .mio-media-upload.m-pick-sq-preview { width: 100%; height: 156px; }
.mio-asset-editor .mio-asset-variants {
  padding-bottom: 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  border-bottom: 1px solid var(--mio-line-soft);
}
.mio-asset-editor .mio-asset-variant {
  position: relative; min-height: 30px; display: inline-flex; align-items: center;
  background: rgba(255,255,255,.025); border: 1px solid var(--mio-line); border-radius: var(--mio-radius-sm);
}
.mio-asset-editor .mio-asset-variant.is-active {
  background: rgba(var(--mio-gold-rgb),.1); border-color: rgba(var(--mio-gold-rgb),.5);
}
.mio-asset-editor .mio-asset-variant__name {
  min-height: 30px; padding: 0 10px; color: var(--mio-text-3); background: transparent; border: 0;
  font: 560 var(--mio-text-sm)/1 var(--mio-font-sans); cursor: pointer;
}
.mio-asset-editor .mio-asset-variant.is-active .mio-asset-variant__name { color: var(--mio-gold-300); }
.mio-asset-editor .mio-asset-variant__more {
  width: 27px; height: 27px; padding: 0; display: grid; place-items: center;
  color: var(--mio-text-4); background: transparent; border: 0; border-left: 1px solid var(--mio-line-soft); cursor: pointer;
}
.mio-asset-editor .mio-asset-variant__more:hover { color: var(--mio-gold-300); }
.mio-asset-editor .mio-asset-variant__add {
  width: 30px; height: 30px; padding: 0; color: var(--mio-gold-300); background: transparent;
  border: 1px dashed rgba(var(--mio-gold-rgb),.38); border-radius: var(--mio-radius-sm); cursor: pointer;
}
.mio-asset-editor .mio-asset-history { min-height: 0; flex: 1; display: flex; flex-direction: column; overflow: hidden; border-top: 1px solid var(--mio-line-soft); }
.mio-asset-editor .mio-asset-history__head { padding: 10px 14px 8px; flex: none; display: flex; align-items: center; gap: 7px; }
.mio-asset-editor .mio-asset-history__title { color: var(--mio-text-3); font-size: 11px; font-weight: 650; }
.mio-asset-editor .mio-asset-history__count { padding: 1px 7px; color: var(--mio-text-3); background: rgba(255,255,255,.06); border: 1px solid var(--mio-line); border-radius: 999px; font-size: 10px; font-weight: 600; }
.mio-asset-editor .mio-asset-history__grid {
  --mio-history-size: 90px; min-height: 0; padding: 0 10px 12px; position: relative; flex: 1; display: grid;
  grid-template-columns: repeat(auto-fill,var(--mio-history-size)); grid-auto-rows: var(--mio-history-size);
  align-content: start; justify-content: start; gap: 6px; overflow-y: auto;
}
.mio-asset-editor .mio-asset-history__item {
  position: relative; width: var(--mio-history-size); height: var(--mio-history-size); overflow: hidden;
  background: var(--mio-bg); border: 2px solid transparent; border-radius: var(--mio-radius-sm); cursor: pointer;
}
.mio-asset-editor .mio-asset-history__item:hover { border-color: rgba(var(--mio-gold-rgb),.45); }
.mio-asset-editor .mio-asset-history__item.is-active {
  border-color: rgba(var(--mio-gold-rgb),.38); box-shadow: 0 0 0 2px rgba(213,162,66,.16);
}
.mio-asset-editor .mio-asset-history__item > img { width: 100%; height: 100%; display: block; object-fit: cover; }
.mio-asset-editor .mio-param-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.mio-asset-editor .mio-param-chip {
  height: 32px; padding: 0 11px; display: inline-flex; align-items: center; gap: 6px;
  color: var(--mio-text-2); background: var(--mio-bg); border: 1px solid var(--mio-line-strong);
  border-radius: var(--mio-radius-sm); font: 560 var(--mio-text-sm)/1 var(--mio-font-sans); cursor: pointer;
}
.mio-asset-editor .mio-param-chip > svg,
.mio-asset-editor .mio-param-chip > i {
  width: 12px; height: 12px; flex: none; color: inherit; font-size: 11px; line-height: 1;
}
.mio-asset-editor .mio-param-chip .mio-param-chip__arrow {
  width: 9px; height: 9px; margin-left: 1px; color: var(--mio-text-3);
}
.mio-asset-editor .mio-param-chip:hover { color: var(--mio-gold-300); border-color: rgba(var(--mio-gold-rgb),.35); }
.mio-generation-switch,
.mio-asset-editor .mio-generation-switch {
  width: 100%; padding: 4px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px;
  background: transparent; border: 1px solid var(--mio-line-strong); border-radius: var(--mio-radius-md);
}
.mio-generation-switch__option,
.mio-asset-editor .mio-generation-switch__option {
  height: 32px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  color: var(--mio-text-3); background: transparent; border: 1px solid transparent; border-radius: var(--mio-radius-sm);
  font: 560 var(--mio-text-sm)/1 var(--mio-font-sans); cursor: pointer; outline: none;
}
.mio-asset-editor .mio-media-upload {
  color: var(--mio-text-3); background: rgba(255,255,255,.012);
  border: 1px dashed var(--mio-line-strong); border-radius: var(--mio-radius-md);
}
.mio-asset-editor .mio-media-upload:hover,
.mio-asset-editor .mio-media-upload:focus-within,
.mio-asset-editor .mio-media-upload.is-dragover {
  color: var(--mio-text-2); background: rgba(var(--mio-gold-rgb),.025); border-color: rgba(var(--mio-gold-rgb),.42);
}
.mio-asset-editor .mio-media-upload .mio-media-upload__icon {
  color: var(--mio-text-3); background: var(--mio-surface-2); border: 1px solid var(--mio-line);
}
.mio-generation-switch__option:hover { color: var(--mio-text-2); background: rgba(255,255,255,.02); }
.mio-asset-editor .mio-generation-switch .mio-generation-switch__option.is-active,
.mio-asset-editor .mio-generation-switch .mio-generation-switch__option.active {
  color: var(--mio-gold-300); background: rgba(var(--mio-gold-rgb),.08); border-color: rgba(var(--mio-gold-rgb),.28);
}
.mio-asset-editor .mio-icon-btn--compact { width: 30px; height: 30px; border-radius: 6px; }
.mio-generation-switch__option:focus-visible { box-shadow: 0 0 0 2px rgba(var(--mio-gold-rgb),.14); }
.mio-generation-switch__option:disabled { opacity: .4; cursor: not-allowed; }
@media (max-width: 820px) {
  .mio-asset-editor .mio-asset-editor__dialog { height: calc(100vh - 20px); }
  .mio-asset-editor .mio-asset-editor__aside { display: none; }
}

.mio-chat { display: flex; flex-direction: column; gap: 14px; }
.mio-message { display: flex; align-items: flex-start; gap: 0; }
.mio-message.is-user { flex-direction: row-reverse; }
.mio-message__avatar {
  display: none;
}
.mio-message__bubble {
  max-width: 84%; padding: 11px 13px; color: var(--mio-text-2); background: var(--mio-surface-2);
  border: 1px solid var(--mio-line); border-radius: 12px 12px 12px 4px;
  font-size: 13px; line-height: 1.7;
}
.mio-message.is-user .mio-message__bubble {
  color: var(--mio-text-1); background: rgba(var(--mio-gold-rgb),.12);
  border-color: rgba(var(--mio-gold-rgb),.28); border-radius: 12px 12px 4px; font-weight: 480;
}
.mio-message.is-card .mio-message__bubble { width: 100%; max-width: 100%; }
.mio-message__ref { color: var(--mio-gold-300); border-bottom: 1px dashed rgba(var(--mio-gold-rgb),.4); }
.mio-message__meta { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; }

/* Agent thinking — global conversation state */
.mio-thinking {
  position: relative;
  margin-left: 0;
  overflow: visible;
  color: var(--mio-text-2);
  background: rgba(255,255,255,.018);
  border: 1px solid var(--mio-line);
  border-radius: 11px;
}
.mio-thinking::before {
  display: none;
}
.mio-thinking__head {
  width: 100%; min-height: 42px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--mio-text-2);
  background: transparent;
  border: 0;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  user-select: none;
}
.mio-thinking__head:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(var(--mio-gold-rgb),.18); }
.mio-thinking__state {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--mio-gold-400);
  box-shadow: 0 0 0 4px rgba(var(--mio-gold-rgb),.1);
}
.mio-thinking.is-processing .mio-thinking__state {
  animation: mio-thinking-pulse 1.4s ease-in-out infinite;
}
.mio-thinking.is-failed .mio-thinking__state { background: var(--mio-danger, #c46f6f); }
.mio-thinking__chevron {
  width: 16px;
  height: 16px;
  margin-left: auto;
  display: grid;
  place-items: center;
  color: var(--mio-text-3);
  transition: transform .2s ease;
}
.mio-thinking__chevron svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.mio-thinking.is-collapsed .mio-thinking__chevron { transform: rotate(-90deg); }
.mio-thinking.is-collapsed .mio-thinking__body { display: none; }
.mio-thinking__body { padding: 0 14px 12px; }
.mio-thinking__steps { display: flex; flex-direction: column; gap: 7px; }
.mio-thinking__step {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-height: 24px;
  padding: 4px 0;
  color: var(--mio-text-3);
  font-size: var(--mio-text-sm);
  line-height: 1.65;
}
.mio-thinking__step.is-active { color: var(--mio-gold-300); }
.mio-thinking__step.is-done { color: var(--mio-text-2); }
.mio-thinking__step.is-failed { color: var(--mio-danger, #d99090); }
.mio-thinking__step-icon {
  width: 14px;
  height: 14px;
  margin-top: 3px;
  flex: none;
  display: grid;
  place-items: center;
}
.mio-thinking__spinner {
  width: 12px;
  height: 12px;
  border: 1.5px solid rgba(var(--mio-gold-rgb),.2);
  border-top-color: var(--mio-gold-400);
  border-right-color: var(--mio-gold-300);
  border-radius: 50%;
  animation: mio-thinking-spin .8s linear infinite;
  box-shadow: 0 0 8px rgba(var(--mio-gold-rgb),.22);
}
.mio-thinking__check {
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  color: var(--mio-gold-300);
  background: rgba(var(--mio-gold-rgb),.14);
  border-radius: 50%;
  font-size: 9px;
}
.mio-thinking__step-detail { display: block; margin-top: 2px; color: var(--mio-text-3); font-size: var(--mio-text-xs); line-height: 1.55; }
.mio-thinking__error { color: var(--mio-danger, #d99090); font-weight: 700; }
.mio-thinking__extra:empty { display: none; }
@keyframes mio-thinking-spin { to { transform: rotate(360deg); } }
@keyframes mio-thinking-pulse { 50% { opacity: .48; transform: scale(.82); } }

.mio-media-card { overflow: hidden; background: var(--mio-surface-1); border: 1px solid var(--mio-line-soft); border-radius: var(--mio-radius-md); }
.mio-media-card__preview { aspect-ratio: 16/9; display: grid; place-items: center; color: var(--mio-text-3); background: linear-gradient(145deg,var(--mio-surface-3),var(--mio-surface-1)); }
.mio-media-card__body { padding: 12px; }
.mio-media-card__title { color: var(--mio-text-1); font-weight: 580; }
.mio-media-card__meta { margin-top: 4px; color: var(--mio-text-3); font-size: var(--mio-text-xs); }

/* Asset cards — shared by character, scene and prop libraries. */
.mio-asset-grid {
  display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px;
}
.mio-asset-card {
  min-width: 0; overflow: hidden; position: relative;
  background: var(--mio-surface-1); border: 1px solid var(--mio-line-soft); border-radius: 12px;
  cursor: pointer;
  transition: border-color var(--mio-duration) var(--mio-ease), transform var(--mio-duration) var(--mio-ease), box-shadow var(--mio-duration) var(--mio-ease);
}
.mio-asset-card:hover {
  border-color: rgba(var(--mio-gold-rgb),.28); transform: translateY(-1px); box-shadow: var(--mio-shadow-2);
}
.mio-asset-card__header {
  min-height: 44px; padding: 10px 44px 10px 12px; position: relative; z-index: 4;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.018); border-bottom: 1px solid var(--mio-line-soft);
}
.mio-asset-card__identity {
  min-width: 0; flex: 1; display: flex; align-items: center; gap: 6px;
}
.mio-asset-card__title {
  min-width: 0; margin: 0; overflow: hidden;
  color: var(--mio-text-1); font-size: 13px; font-weight: 600; line-height: 1.35;
  white-space: nowrap; text-overflow: ellipsis;
}
.mio-asset-card__voice {
  width: 18px; height: 18px; padding: 0; flex: none;
  display: inline-grid; place-items: center;
  color: var(--mio-text-3); background: transparent; border: 0; cursor: pointer;
  transition: color var(--mio-duration-fast) var(--mio-ease);
}
.mio-asset-card__voice:hover { color: var(--mio-gold-300); }
.mio-asset-card__voice svg { width: 15px; height: 15px; }
.mio-asset-card__delete {
  position: absolute; top: 9px; right: 10px; z-index: 2;
  width: 24px; height: 24px; padding: 0; flex: none;
  display: inline-grid; place-items: center;
  color: var(--mio-text-3); background: rgba(255,255,255,.04);
  border: 1px solid var(--mio-line); border-radius: 6px;
  opacity: 0; pointer-events: none; cursor: pointer;
  transition: opacity var(--mio-duration-fast), color var(--mio-duration-fast), background var(--mio-duration-fast), border-color var(--mio-duration-fast);
}
.mio-asset-card:hover .mio-asset-card__delete,
.mio-asset-card:focus-within .mio-asset-card__delete { opacity: 1; pointer-events: auto; }
.mio-asset-card__delete:hover {
  color: #e2a19a; background: rgba(112,37,31,.26); border-color: rgba(205,91,79,.38);
}
.mio-asset-card__delete svg { width: 13px; height: 13px; }
.mio-asset-card__preview {
  width: 100%; aspect-ratio: 16 / 9; overflow: hidden; position: relative;
  display: grid; place-items: center; color: var(--mio-text-3);
  background: radial-gradient(circle at 50% 42%,rgba(var(--mio-gold-rgb),.055),transparent 48%),var(--mio-bg);
}
.mio-asset-card__preview > img { width: 100%; height: 100%; display: block; object-fit: cover; }
.mio-asset-card.is-prop .mio-asset-card__preview > img { object-fit: contain; }
.mio-asset-card__empty {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
}
.mio-asset-card__empty-icon { width: 30px; height: 30px; color: var(--mio-text-disabled); }
.mio-asset-card__empty-text { color: var(--mio-text-3); font-size: var(--mio-text-sm); }
.mio-asset-card__empty-actions {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--mio-duration-fast) var(--mio-ease);
}
.mio-asset-card:hover .mio-asset-card__empty-actions,
.mio-asset-card:focus-within .mio-asset-card__empty-actions { opacity: 1; pointer-events: auto; }
.mio-asset-card__generate,
.mio-asset-card__upload {
  min-height: 32px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  border-radius: 7px; cursor: pointer; font-size: var(--mio-text-sm); font-weight: 600;
}
.mio-asset-card__generate {
  color: var(--mio-text-inverse); background: var(--mio-gold-400); border: 1px solid var(--mio-gold-400);
}
.mio-asset-card__generate:hover { background: var(--mio-gold-300); border-color: var(--mio-gold-300); }
.mio-asset-card__upload {
  color: var(--mio-text-2); background: var(--mio-surface-2); border: 1px solid var(--mio-line-strong);
}
.mio-asset-card__upload:hover { color: var(--mio-text-1); background: var(--mio-surface-3); }
.mio-asset-card__variants {
  min-height: 74px; padding: 9px 12px 10px; display: flex; align-items: flex-start; gap: 6px;
  overflow-x: auto; border-top: 1px solid var(--mio-line-soft); scrollbar-width: none;
}
.mio-asset-card__variants::-webkit-scrollbar { display: none; }
.mio-asset-card__variant {
  width: 54px; flex: 0 0 54px; padding: 0; overflow: hidden;
  color: var(--mio-text-3); background: rgba(255,255,255,.025);
  border: 1px solid var(--mio-line); border-radius: 7px; cursor: pointer; text-align: left;
}
.mio-asset-card__variant:hover { border-color: rgba(var(--mio-gold-rgb),.42); }
.mio-asset-card__variant.is-active {
  color: var(--mio-text-2); border-color: var(--mio-gold-400); box-shadow: 0 0 0 1px rgba(var(--mio-gold-rgb),.14);
}
.mio-asset-card__variant-preview {
  width: 52px; height: 34px; display: grid; place-items: center;
  background: rgba(255,255,255,.035); color: var(--mio-text-disabled);
}
.mio-asset-card__variant-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.mio-asset-card__variant-label {
  display: block; padding: 4px 5px 5px; overflow: hidden;
  font-size: 9px; line-height: 1.2; white-space: nowrap; text-overflow: ellipsis;
}
.mio-asset-card.is-prop .mio-asset-card__variants { display: none; }
.mio-asset-card__variants > .flex,
.mio-asset-card__variants > .grid { display: contents !important; }

/* Keep legacy module CSS from recoloring the shared card component. */
.mio-asset-card.mio-asset-card { background: var(--mio-surface-1); border-color: var(--mio-line-soft); }
.mio-asset-card .mio-asset-card__header { background: rgba(255,255,255,.018); border-color: var(--mio-line-soft); }
.mio-asset-card .mio-asset-card__title { color: var(--mio-text-1); }
.mio-asset-card .mio-asset-card__voice { width: 18px; height: 18px; color: var(--mio-text-3); background: transparent; border: 0; border-radius: 0; }
.mio-asset-card .mio-asset-card__voice:hover { color: var(--mio-gold-300); background: transparent; }
.mio-asset-card .mio-asset-card__preview { background: radial-gradient(circle at 50% 42%,rgba(var(--mio-gold-rgb),.055),transparent 48%),var(--mio-bg); }
.mio-asset-card .mio-asset-card__empty { color: var(--mio-text-3); background: transparent; }
.mio-asset-card .mio-asset-card__variants { background: transparent; border-color: var(--mio-line-soft); }
.mio-asset-card .mio-asset-card__variant { color: var(--mio-text-3); background: rgba(255,255,255,.025); border-color: var(--mio-line); }
.mio-asset-card .mio-asset-card__variant.is-active { color: var(--mio-text-2); border-color: var(--mio-gold-400); background: rgba(var(--mio-gold-rgb),.06); }

@media (max-width: 1040px) { .mio-asset-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width: 760px) { .mio-asset-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 520px) { .mio-asset-grid { grid-template-columns: 1fr; } }

.mio-empty { min-height: 220px; padding: 32px; display: grid; place-items: center; text-align: center; color: var(--mio-text-3); }
.mio-empty__icon { width: 48px; height: 48px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 50%; background: var(--mio-surface-3); border: 1px solid var(--mio-line); }
.mio-empty__title { margin-bottom: 5px; color: var(--mio-text-1); font-weight: 600; }

.mio-skeleton { position: relative; overflow: hidden; min-height: 14px; border-radius: 5px; background: var(--mio-surface-3); }
.mio-skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg,transparent,rgba(255,255,255,.045),transparent); animation: mio-shimmer 1.5s infinite; }
@keyframes mio-shimmer { to { transform: translateX(100%); } }

.mio-alert { padding: 11px 13px; display: flex; gap: 9px; border-radius: var(--mio-radius-sm); border: 1px solid var(--mio-line); color: var(--mio-text-2); background: var(--mio-surface-2); }
.mio-alert--success { border-color: rgba(117,168,132,.25); background: rgba(117,168,132,.07); }
.mio-alert--warning { border-color: rgba(198,161,92,.25); background: rgba(198,161,92,.07); }
.mio-alert--danger { border-color: rgba(196,111,111,.25); background: rgba(196,111,111,.07); }
.mio-toast { width: min(360px,calc(100vw - 32px)); padding: 12px 14px; display: flex; align-items: flex-start; gap: 10px; background: var(--mio-surface-3); border: 1px solid var(--mio-line-strong); border-radius: var(--mio-radius-md); box-shadow: var(--mio-shadow-3); }

.mio-modal-backdrop {
  padding: 32px; display: grid; place-items: center;
  background: rgba(0,0,0,.56); border-radius: var(--mio-radius-lg);
}
.mio-modal-backdrop--fixed {
  position: fixed; inset: 0; z-index: 200; padding: 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--mio-overlay); border-radius: 0; backdrop-filter: blur(8px);
}
.mio-modal {
  position: relative; width: min(560px,calc(100vw - 32px)); max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; overflow: hidden;
  color: var(--mio-text-1); background: var(--mio-surface-1);
  border: 1px solid var(--mio-line); border-radius: var(--mio-radius-lg);
  box-shadow: var(--mio-shadow-3); animation: mio-modal-in 200ms var(--mio-ease);
}
@keyframes mio-modal-in {
  from { opacity: 0; transform: scale(.97) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.mio-modal__header {
  height: 48px; padding: 0 16px 0 20px; flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--mio-surface-1); border-bottom: 1px solid var(--mio-line-soft);
}
.mio-modal__heading { min-width: 0; display: flex; align-items: center; gap: 10px; }
.mio-modal__title {
  min-width: 0; margin: 0; overflow: hidden; color: var(--mio-text-1);
  font-size: var(--mio-text-md); font-weight: 650; line-height: 1.35;
  white-space: nowrap; text-overflow: ellipsis;
}
.mio-modal__subtitle { color: var(--mio-text-3); font-size: var(--mio-text-xs); white-space: nowrap; }
.mio-modal__body { min-height: 0; padding: 20px; flex: 1; overflow-y: auto; color: var(--mio-text-2); }
.mio-modal__footer {
  min-height: 60px; padding: 12px 16px; flex: none;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  background: var(--mio-surface-1); border-top: 1px solid var(--mio-line-soft);
}
.mio-modal__footer .mio-modal__primary { min-width: 132px; justify-content: center; }

.mio-tooltip { display: inline-flex; padding: 5px 8px; color: var(--mio-text-2); background: var(--mio-surface-4); border: 1px solid var(--mio-line); border-radius: 6px; box-shadow: var(--mio-shadow-2); font-size: var(--mio-text-xs); }

.mio-divider { height: 1px; background: var(--mio-line-soft); border: 0; }
.mio-scrollbar { scrollbar-width: thin; scrollbar-color: var(--mio-surface-4) transparent; }
.mio-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.mio-scrollbar::-webkit-scrollbar-thumb { background: var(--mio-surface-4); border-radius: 6px; }

/* Project list cards — shared by Creation, Agent and SmartCut surfaces. */
.mio-project-section { margin-top: 26px; }
.mio-project-head {
  margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.mio-project-heading {
  display: flex; align-items: center; gap: 8px;
  color: var(--mio-text-1); font-size: 17px; font-weight: 610; line-height: 1.55; letter-spacing: -.015em;
}
.mio-project-heading__icon { width: 18px; height: 18px; color: var(--mio-gold-400); }
.mio-project-tools { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.mio-project-search {
  width: 200px; height: 36px; padding: 0 12px;
  display: flex; align-items: center; gap: 8px;
  color: var(--mio-text-2); background: var(--mio-surface-1);
  border: 1px solid var(--mio-line-soft); border-radius: 8px; backdrop-filter: blur(12px);
  transition: background var(--mio-duration) var(--mio-ease), border-color var(--mio-duration) var(--mio-ease);
}
.mio-project-search:hover, .mio-project-search:focus-within {
  background: var(--mio-surface-2); border-color: var(--mio-line-strong);
}
.mio-project-search:focus-within { box-shadow: var(--mio-focus); }
.mio-project-search input {
  width: 100%; height: 100%; min-width: 0; border: 0; outline: 0;
  color: var(--mio-text-1); background: transparent; font-size: var(--mio-text-sm);
}
.mio-project-search input::placeholder { color: var(--mio-text-disabled); }
.mio-project-search svg { width: 12px; height: 12px; flex: 0 0 12px; }
.mio-project-toolbar {
  height: 36px; padding: 3px; display: inline-flex; align-items: center; gap: 2px;
  background: var(--mio-surface-1); border: 1px solid var(--mio-line-soft);
  border-radius: 8px; backdrop-filter: blur(12px);
}
.mio-project-filter {
  min-height: 28px; padding: 0 11px; border: 0; border-radius: 6px;
  color: var(--mio-text-3); background: transparent; cursor: pointer; font-size: var(--mio-text-sm);
}
.mio-project-filter:hover { color: var(--mio-text-1); background: var(--mio-surface-3); }
.mio-project-filter.is-active { color: var(--mio-text-inverse); background: var(--mio-gold-400); }
.mio-project-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 16px; }
.mio-project-card {
  min-width: 0; overflow: visible; position: relative;
  background: var(--mio-surface-1); border: 1px solid var(--mio-line-soft); border-radius: 14px;
  cursor: pointer; transition: border-color .25s var(--mio-ease), box-shadow .25s var(--mio-ease), transform .25s var(--mio-ease);
}
.mio-project-card.is-series::before,
.mio-project-card.is-series::after {
  content: ""; position: absolute; pointer-events: none;
  height: 10px; border: 1px solid var(--mio-line-soft);
  border-radius: var(--mio-radius-md) var(--mio-radius-md) 0 0;
  transition: top var(--mio-duration) var(--mio-ease), background var(--mio-duration) var(--mio-ease);
}
.mio-project-card.is-series::before {
  top: -4px; left: 6px; right: 6px; z-index: -1;
  background: var(--mio-surface-4);
}
.mio-project-card.is-series::after {
  top: -8px; left: 12px; right: 12px; z-index: -2;
  background: var(--mio-surface-2);
}
.mio-project-card.is-series { z-index: 1; }
.mio-project-card.is-series:hover::before { top: -6px; background: var(--mio-surface-4); }
.mio-project-card.is-series:hover::after { top: -12px; background: var(--mio-surface-3); }
.mio-project-card.has-open-menu { overflow: visible; z-index: 30; }
.mio-project-card:hover {
  border-color: rgba(var(--mio-gold-rgb),.26); background: var(--mio-surface-2);
  box-shadow: var(--mio-shadow-2); transform: translateY(-2px);
}
.mio-project-cover {
  height: auto; aspect-ratio: 16 / 9; overflow: hidden; position: relative;
  border-radius: 13px 13px 0 0;
  background: radial-gradient(circle at 55% 35%,rgba(var(--mio-gold-rgb),.09),transparent 34%),var(--mio-surface-2);
}
.mio-project-cover img,
.mio-project-cover video {
  width: 100%; height: 100%; display: block; object-fit: cover;
  transition: transform var(--mio-duration-slow) var(--mio-ease), opacity var(--mio-duration) var(--mio-ease);
}
.mio-project-card:hover .mio-project-cover img,
.mio-project-card:hover .mio-project-cover video { transform: scale(1.025); }
.mio-project-folder {
  width: 70px; height: 52px; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%,-50%); border: 1px solid rgba(var(--mio-gold-rgb),.28);
  border-radius: 9px 9px 11px 11px;
  background: linear-gradient(160deg,rgba(var(--mio-gold-rgb),.2),rgba(var(--mio-gold-rgb),.07));
  box-shadow: inset 0 1px rgba(255,255,255,.06),0 14px 28px rgba(0,0,0,.22);
}
.mio-project-folder::before {
  content: ""; position: absolute; left: 1px; top: -7px; width: 34px; height: 12px;
  border: 1px solid rgba(var(--mio-gold-rgb),.25); border-bottom: 0;
  border-radius: 9px 9px 0 0; background: rgba(var(--mio-gold-rgb),.16);
}
.mio-project-folder::after {
  content: ""; position: absolute; left: 0; top: 8px; width: 100%; height: 1px;
  background: rgba(var(--mio-gold-rgb),.18);
}
.mio-project-tag {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  padding: 4px 8px; display: inline-flex; align-items: center; gap: 4px;
  color: #d4d4d8; background: rgba(0,0,0,.6);
  border: 1px solid rgba(255,255,255,.05); border-radius: 4px;
  backdrop-filter: blur(10px); font-size: 10px; font-weight: 700; line-height: 1.5;
}
.mio-project-tag.is-series {
  color: #09090b; border: 0;
  background: rgba(147,106,46,.9);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
}
.mio-project-tag svg { width: 10px; height: 10px; flex: 0 0 10px; }
.mio-project-edit,
.mio-project-delete {
  width: 30px; height: 30px; padding: 0; position: absolute; top: 9px; right: 9px; z-index: 4;
  display: grid; place-items: center; color: var(--mio-text-2);
  border: 1px solid rgba(255,255,255,.11); border-radius: 8px;
  background: rgba(10,10,11,.78); backdrop-filter: blur(10px);
  opacity: 0; transform: translateY(-3px); cursor: pointer;
  transition: opacity .18s ease, transform .18s ease, color .18s ease, border-color .18s ease, background .18s ease;
}
.mio-project-edit { right: 45px; }
.mio-project-card:hover .mio-project-edit,
.mio-project-card:focus-within .mio-project-edit,
.mio-project-card:hover .mio-project-delete,
.mio-project-card:focus-within .mio-project-delete,
.mat-session-card:hover .mio-project-edit,
.mat-session-card:focus-within .mio-project-edit,
.mat-session-card:hover .mio-project-delete,
.mat-session-card:focus-within .mio-project-delete,
.mio-project-host-card:hover .mio-project-delete,
.mio-project-host-card:focus-within .mio-project-delete { opacity: 1; transform: translateY(0); }
.mio-project-edit:hover {
  color: var(--mio-gold-300); border-color: rgba(var(--mio-gold-rgb),.38); background: rgba(var(--mio-gold-rgb),.12);
}
.mio-project-delete:hover {
  color: #e2a19a; border-color: rgba(205,91,79,.38); background: rgba(112,37,31,.34);
}
.mio-project-edit svg,
.mio-project-delete svg { width: 15px; height: 15px; }
.mio-project-info {
  padding: 13px 52px 14px 14px; position: relative;
  background: var(--mio-surface-1); border-top: 1px solid var(--mio-line-soft); border-radius: 0 0 13px 13px;
}
.mio-project-title {
  margin: 0; overflow: hidden; color: var(--mio-text-2);
  font-size: 13px; font-weight: 580; line-height: 1.35; white-space: nowrap; text-overflow: ellipsis;
}
.mio-project-meta { min-width: 0; margin-top: 5px; display: flex; align-items: center; gap: 7px; line-height: 1; }
.mio-project-time { color: #6d6b67; font-size: 10px; line-height: 1.55; white-space: nowrap; }
.mio-project-status {
  min-height: 19px; padding: 1px 6px; display: inline-flex; align-items: center; gap: 4px;
  color: var(--mio-gold-300); background: rgba(var(--mio-gold-rgb),.07);
  border: 1px solid rgba(var(--mio-gold-rgb),.18); border-radius: var(--mio-radius-pill);
  font-size: 9px; font-weight: 600; line-height: 1;
}
.mio-project-status.is-overlay { position: absolute; top: 12px; right: 12px; z-index: 3; backdrop-filter: blur(10px); }
.mio-project-status.is-info-corner { position: absolute; top: 10px; right: 14px; }
.mio-project-status.is-completed { color: #9cc0a5; background: rgba(117,168,132,.07); border-color: rgba(117,168,132,.2); }
.mio-project-status.is-partial { color: #d7ae70; background: rgba(185,131,51,.09); border-color: rgba(205,153,76,.24); }
.mio-project-status.is-failed { color: #d99090; background: rgba(196,111,111,.07); border-color: rgba(196,111,111,.2); }
.mio-project-more {
  width: 26px; height: 26px; padding: 0; position: absolute; right: 12px; bottom: 9px;
  display: grid; place-items: center; color: var(--mio-text-disabled);
  border: 0; border-radius: 0; background: transparent; cursor: pointer;
  transition: color .18s ease;
}
.mio-project-more:hover, .mio-project-more[aria-expanded="true"] {
  color: var(--mio-gold-300); background: transparent;
}
.mio-project-menu {
  width: 124px; padding: 5px; position: absolute; right: 10px; bottom: 48px; z-index: 20;
  background: var(--mio-surface-2); border: 1px solid var(--mio-line); border-radius: 9px; box-shadow: var(--mio-shadow-3);
}
.mio-project-menu button {
  width: 100%; min-height: 32px; padding: 0 9px; display: flex; align-items: center; gap: 7px;
  color: var(--mio-text-2); background: transparent; border: 0; border-radius: 6px; cursor: pointer;
  font-size: 11px; text-align: left;
}
.mio-project-menu button:hover { color: var(--mio-text-1); background: var(--mio-surface-4); }
.mio-project-menu button:disabled {
  color: var(--mio-text-disabled); background: transparent; cursor: not-allowed;
}
.mio-project-menu button.is-danger { color: #d99090; }
.mio-project-empty {
  min-height: 220px; display: grid; place-items: center; text-align: center;
  color: var(--mio-text-3); font-size: var(--mio-text-sm);
}

/* 可扩展的项目批量操作模式 */
.mio-project-count { color: var(--mio-text-3); font-size: 12px; font-weight: 400; white-space: nowrap; }
.mio-project-count strong { color: var(--mio-gold-300); font-weight: 600; }
.mio-batch-trigger { white-space: nowrap; }
.mio-list-action {
  height: 36px; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px;
  color: var(--mio-text-2); background: var(--mio-surface-1); border: 1px solid var(--mio-line-soft);
  border-radius: var(--mio-radius-sm); cursor: pointer; font: inherit; font-size: 13px; white-space: nowrap;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.mio-list-action:hover { color: var(--mio-text-1); border-color: var(--mio-line-strong); background: var(--mio-surface-2); }
.mio-list-action svg { width: 15px; height: 15px; flex: none; }
.mio-list-sort { position: relative; }
.mio-list-sort__trigger { min-width: 116px; justify-content: space-between; padding-left: 12px; padding-right: 10px; }
.mio-list-sort__trigger svg { color: var(--mio-text-3); transition: transform .2s ease; }
.mio-list-sort.is-open .mio-list-sort__trigger svg { transform: rotate(180deg); }
.mio-list-sort__menu {
  width: 116px; padding: 5px; position: absolute; top: calc(100% + 7px); right: 0; z-index: 30;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  background: var(--mio-surface-2); border: 1px solid var(--mio-line); border-radius: 10px; box-shadow: var(--mio-shadow-3);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}
.mio-list-sort.is-open .mio-list-sort__menu { opacity: 1; visibility: visible; transform: translateY(0); }
.mio-list-sort__menu button {
  width: 100%; height: 34px; padding: 0 10px; color: var(--mio-text-2); background: transparent;
  border: 0; border-radius: 7px; cursor: pointer; font: inherit; font-size: 13px; text-align: left;
}
.mio-list-sort__menu button:hover { color: var(--mio-text-1); background: var(--mio-surface-4); }
.mio-list-sort__menu button.is-active { color: var(--mio-gold-300); background: rgba(var(--mio-gold-rgb),.07); }
.mio-batch-bar {
  width: min(520px, calc(100vw - 32px)); min-height: 56px; padding: 7px 10px 7px 16px;
  position: fixed; left: 50%; bottom: 24px; z-index: 80;
  display: flex; align-items: center; gap: 8px;
  color: var(--mio-text-2); background: rgba(24,24,26,.96);
  border: 1px solid var(--mio-line); border-radius: 14px; box-shadow: 0 14px 38px rgba(0,0,0,.48);
  backdrop-filter: blur(18px); transform: translateX(-50%);
}
.mio-batch-bar[hidden] { display: none; }
.mio-batch-select-all {
  min-height: 32px; padding: 0; display: inline-flex; align-items: center; gap: 8px;
  color: var(--mio-text-1); background: transparent; border: 0; cursor: pointer;
  font: inherit; font-size: 12px; white-space: nowrap;
}
.mio-batch-select-box {
  width: 20px; height: 20px; display: grid; place-items: center; flex: none;
  color: transparent; background: transparent; border: 1px solid var(--mio-line-strong); border-radius: 7px;
}
.mio-batch-select-all.is-checked .mio-batch-select-box,
.mio-batch-select-all.is-partial .mio-batch-select-box { color: #fff; background: var(--mio-gold-400); border-color: var(--mio-gold-400); }
.mio-batch-select-box svg { width: 12px; height: 12px; }
.mio-batch-action {
  min-height: 34px; padding: 0 13px; display: inline-flex; align-items: center; gap: 6px;
  color: var(--mio-text-2); background: var(--mio-surface-3); border: 1px solid var(--mio-line);
  border-radius: 8px; cursor: pointer; font-size: 12px;
}
.mio-batch-action:hover { color: var(--mio-text-1); background: var(--mio-surface-4); }
.mio-batch-action.is-danger { color: #d99090; }
.mio-batch-action:disabled { opacity: .42; cursor: not-allowed; }
.mio-batch-delete { margin-left: auto; }
.mio-batch-action svg { width: 15px; height: 15px; }
.mio-batch-close {
  width: 30px; min-height: 30px; padding: 0; justify-content: center; color: var(--mio-text-4);
  background: transparent; border: 0; font-size: 22px; font-weight: 200;
}
.mio-batch-close:hover { color: var(--mio-text-2); background: transparent; }
.mio-project-card.is-selecting, .mat-session-card.is-selecting { cursor: pointer; }
.mio-project-card.is-selected, .mat-session-card.is-selected { outline: 2px solid var(--mio-gold-400); outline-offset: 2px; }
.mio-batch-check {
  width: 25px; height: 25px; position: absolute; top: 10px; left: 10px; z-index: 8;
  display: grid; place-items: center; color: transparent; background: rgba(10,10,11,.82);
  border: 1px solid rgba(255,255,255,.28); border-radius: 7px;
}
.is-selected .mio-batch-check { color: #111; background: var(--mio-gold-300); border-color: var(--mio-gold-300); }
.mio-batch-check svg { width: 15px; height: 15px; }

/* Agent 同款项目名称编辑弹窗，供所有项目列表复用 */
.project-name-modal {
  position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center;
  padding: 20px; background: rgba(0,0,0,.72); backdrop-filter: blur(8px);
}
.project-name-modal.open { display: flex; }
.project-name-dialog {
  width: min(420px,calc(100vw - 32px)); padding: 0; overflow: hidden;
  color: var(--mio-text-1); background: var(--mio-surface-1); border: 1px solid var(--mio-line);
  border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.58);
  animation: projectNameModalIn .2s cubic-bezier(.22,1,.36,1);
}
.project-name-dialog__form { padding: 0; }
.project-name-dialog__head { height: 54px; padding: 0 20px; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--mio-line); }
.project-name-dialog__title { margin: 0; font-size: 16px; font-weight: 650; }
.project-name-dialog__close { border: 0; background: transparent; color: var(--mio-text-3); cursor: pointer; font-size: 20px; }
.project-name-dialog__label { display: block; margin: 0 20px 8px; color: var(--mio-text-3); font-size: 12px; }
.project-name-dialog__input { width: calc(100% - 40px); height: 42px; margin: 0 20px; padding: 0 12px; border: 1px solid var(--mio-line); border-radius: 9px; outline: 0; color: var(--mio-text-1); background: var(--mio-surface-2); font: inherit; }
.project-name-dialog__input:focus { border-color: rgba(var(--mio-gold-rgb),.55); }
.project-name-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding: 0 20px 20px; }
.project-name-dialog__btn { height: 34px; padding: 0 14px; border: 1px solid var(--mio-line); border-radius: 8px; cursor: pointer; color: var(--mio-text-2); background: var(--mio-surface-2); }
.project-name-dialog__btn.primary { color: #17130c; border-color: var(--mio-gold-400); background: var(--mio-gold-400); font-weight: 650; }
.project-name-dialog__btn:disabled { opacity: .5; cursor: wait; }
@keyframes projectNameModalIn { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }

@media (max-width: 1240px) { .mio-project-grid { grid-template-columns: repeat(4,minmax(0,1fr)); } }
@media (max-width: 1040px) { .mio-project-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width: 820px) {
  .mio-project-head { align-items: flex-start; flex-direction: column; }
  .mio-project-tools, .mio-project-search { width: 100%; }
  .mio-project-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 520px) { .mio-project-grid { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
