/* One active rail design for Media and every other module. Media may change layout, not navigation identity. */
body[data-theme="qorgon"] .rail-item.active,
body[data-theme="qorgon"] .app-shell.media-active .rail-item.active {
  position: relative;
  overflow: visible;
  border: 1px solid rgba(255,255,255,.68);
  border-left-color: rgba(255,255,255,.36);
  border-radius: 0 20px 20px 0;
  background:
    linear-gradient(145deg, rgba(255,255,255,.52), rgba(255,255,255,.15) 58%, rgba(194,232,230,.13)),
    rgba(243,247,245,.28);
  color: #7259db;
  box-shadow:
    0 14px 25px rgba(45,63,76,.12),
    10px 17px 27px rgba(55,207,190,.10),
    0 19px 32px rgba(117,92,255,.10),
    inset 0 1px 0 rgba(255,255,255,.96),
    inset 0 -1px 0 rgba(45,63,76,.07);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
}
body[data-theme="qorgon"] .rail-item.active::before,
body[data-theme="qorgon"] .app-shell.media-active .rail-item.active::before { display: none; }
body[data-theme="qorgon"] .rail-item.active::after,
body[data-theme="qorgon"] .app-shell.media-active .rail-item.active::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 9px -9px -12px 8px;
  pointer-events: none;
  background:
    radial-gradient(circle at 77% 74%, rgba(48,217,190,.24), transparent 57%),
    radial-gradient(circle at 62% 22%, rgba(125,87,255,.20), transparent 55%);
  filter: blur(12px);
}
body[data-theme="qorgon"] .rail-item.active svg,
body[data-theme="qorgon"] .app-shell.media-active .rail-item.active svg { color: #7259db; filter: drop-shadow(0 2px 5px rgba(114,89,219,.16)); }

@media (max-width: 1280px) {
  .create-quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .create-work-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .create-detail-grid { grid-template-columns: 1fr; }
  .create-detail-head { align-items: flex-start; flex-direction: column; }
  .create-stage-grid { grid-template-columns: repeat(3, 1fr); }
  .context-permissions > div { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .create-quick-grid { grid-template-columns: 1fr; }
  .create-flow-card > div { grid-template-columns: repeat(2, 1fr); }
  .create-flow-card > div article::after { display: none; }
  .create-system-flow > div { grid-template-columns: 1fr; }
  .create-system-flow > div > svg { transform: rotate(90deg); justify-self: center; }
  .embedded-create-stages { grid-template-columns: repeat(3, 1fr); }
  .embedded-create-card footer { align-items: flex-start; flex-direction: column; }
  .embedded-create-card footer > div { width: 100%; }
  .embedded-create-card footer button { flex: 1; }
  .create-detail-actions { width: 100%; }
  .create-detail-actions button { flex: 1; }
  .create-stage-grid { grid-template-columns: repeat(2, 1fr); }
  .classroom-table-head { display: none; }
  .classroom-row { grid-template-columns: 1fr 1fr; padding: 9px; }
  .context-permissions > div { grid-template-columns: 1fr; }
  .market-ranking-note { grid-template-columns: 42px 1fr; }
  .market-ranking-note > b { grid-column: 2; justify-self: start; }
}


/* Tools tabs stay usable after adding Create. */
.tools-head { flex-wrap: wrap; }
.tools-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tools-tabs::-webkit-scrollbar { display: none; }
.tools-tab { flex: 0 0 auto; }


/* V11 unified Qorgon + Telegram search and explicit loading states. */
.search-state-card,
.content-loading-state {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  min-height: 150px;
  padding: 22px 16px;
  text-align: center;
  color: var(--muted);
}
.search-state-card strong,
.content-loading-state strong { color: var(--text); }
.search-state-card small,
.content-loading-state small { max-width: 260px; line-height: 1.45; }
.search-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: qorgon-search-spin .75s linear infinite;
}
@keyframes qorgon-search-spin { to { transform: rotate(360deg); } }

.global-search-results { display: grid; padding-bottom: 18px; }
.global-search-results > header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px 6px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.global-search-results > header span {
  min-width: 22px;
  padding: 2px 6px;
  text-align: center;
  border-radius: 999px;
  background: var(--surface-2);
}
.global-search-target,
.global-search-message {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: calc(100% - 12px);
  margin: 2px 6px;
  padding: 8px 9px;
  text-align: left;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
}
.global-search-target:hover,
.global-search-message:hover {
  border-color: color-mix(in srgb, var(--blue) 22%, var(--line));
  background: color-mix(in srgb, var(--blue) 9%, transparent);
}
.global-search-copy { display: grid; min-width: 0; gap: 3px; }
.global-search-copy > span { display: flex; align-items: center; min-width: 0; gap: 6px; }
.global-search-copy strong,
.global-search-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.global-search-copy small { color: var(--muted); font-size: 11px; }
.global-search-copy small b { color: var(--text-secondary, var(--text)); font-weight: 650; }
.global-search-target > svg { width: 16px; color: var(--muted); }
.global-search-message time { color: var(--muted); font-size: 10px; }
.search-message-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 800;
}
.search-message-avatar img { width: 100%; height: 100%; object-fit: cover; }
.global-search-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 10px;
  padding: 8px 10px;
  color: var(--muted);
  border-radius: 10px;
  background: color-mix(in srgb, var(--blue) 7%, transparent);
  font-size: 11px;
}
.global-search-progress .search-spinner { width: 15px; height: 15px; border-width: 2px; }
