.notification-toggle { position: relative; }
.notification-toggle b {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #ff5c7a;
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}

.platform-empty { padding: 24px 0; color: var(--muted); }
.platform-error { padding: 14px; border-left: 3px solid #ff6473; color: #ff7b87; }
.home-workbench {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: min(1040px, 100%);
  margin-top: 28px;
}
.workbench-item {
  display: grid;
  min-height: 92px;
  align-content: space-between;
  gap: 10px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--workbench-color, var(--hot)) 58%, var(--line));
  background: color-mix(in srgb, var(--workbench-color, var(--hot)) 9%, var(--surface));
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 8px 20px rgb(0 0 0 / .12);
  transition: transform .18s ease, border-color .18s ease;
}
.workbench-item:hover { transform: translateY(-3px); border-color: var(--workbench-color, var(--hot)); }
.workbench-item span { color: var(--muted); font-size: 12px; }

.managed-content-section {
  margin: 0 0 22px;
  padding: 16px 0 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.managed-content-title { margin: 0 0 12px; font-size: 15px; }
.managed-content-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.managed-content-card {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 10px;
  padding: 15px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.managed-content-card h3,
.managed-content-card p { margin: 0; overflow-wrap: anywhere; }
.managed-content-card p { color: var(--muted); line-height: 1.6; }
.managed-content-meta,
.managed-content-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.managed-content-meta span,
.managed-content-tags span { padding: 3px 7px; border: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.managed-content-open { width: max-content; color: var(--hot); text-decoration: none; }
.managed-content-details summary { cursor: pointer; color: var(--hot); }
.managed-content-details p { margin-top: 10px; white-space: pre-wrap; }

.prompt-studio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .82fr);
  border: 1px solid var(--line);
  background: var(--surface);
}
.prompt-studio-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 22px;
  border-right: 1px solid var(--line);
}
.prompt-studio-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.prompt-studio-form input,
.prompt-studio-form select,
.prompt-studio-output textarea,
.platform-form input,
.platform-form select,
.platform-form textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  outline: 0;
  background: var(--surface-2);
  color: var(--text);
}
.prompt-studio-form input:focus,
.prompt-studio-form select:focus,
.prompt-studio-output textarea:focus,
.platform-form input:focus,
.platform-form textarea:focus { border-color: var(--hot); }
.prompt-studio-wide,
.prompt-studio-actions { grid-column: 1 / -1; }
.prompt-studio-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.prompt-studio-actions button,
.prompt-studio-output button,
#gallery-refresh,
.platform-action {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.prompt-studio-actions button:first-child { border-color: var(--hot); background: color-mix(in srgb, var(--hot) 18%, var(--surface)); }
.prompt-studio-output { display: grid; grid-template-rows: auto 1fr; min-width: 0; padding: 22px; }
.prompt-studio-output header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.prompt-studio-output textarea { min-height: 360px; resize: vertical; line-height: 1.65; }

#generator-analyze-reference { margin-left: auto; }
#generator-publish-gallery { margin-left: 8px; }

.gallery-grid,
.learning-path-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.gallery-card,
.learning-path-card {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--surface);
}
.gallery-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #050706; }
.gallery-card-body,
.learning-path-card { padding: 16px; }
.gallery-card-body { display: grid; gap: 8px; }
.gallery-card p,
.learning-path-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.gallery-card small { color: var(--muted); }
.gallery-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.gallery-actions button,
.learning-path-item button {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.learning-path-card { display: grid; align-content: start; gap: 12px; }
.learning-path-card header { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.learning-path-card h3 { margin: 0; }
.learning-path-card ol { display: grid; gap: 8px; margin: 0; padding-left: 22px; }
.learning-path-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.learning-path-item.is-done { color: var(--muted); text-decoration: line-through; }

.profile-platform { margin-top: 26px; }
.platform-profile-head,
.platform-tabs,
.platform-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.platform-profile-head { padding: 16px; border: 1px solid var(--line); background: var(--surface); }
.platform-profile-head h3,
.platform-section h3 { margin: 0; }
.platform-profile-head p { margin: 5px 0 0; color: var(--muted); }
.platform-level { flex: 0 0 auto; padding: 8px 10px; border: 1px solid var(--hot); color: var(--hot); }
.platform-tabs { justify-content: flex-start; overflow-x: auto; margin-top: 12px; border-bottom: 1px solid var(--line); }
.platform-tabs button {
  min-width: max-content;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.platform-tabs button.is-active { border-color: var(--hot); color: var(--text); }
.platform-tab-panel { padding: 18px 0; }
.platform-record-list { display: grid; border: 1px solid var(--line); }
.platform-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.platform-record:last-child { border-bottom: 0; }
.platform-record > div { min-width: 0; }
.platform-record strong,
.platform-record p { overflow-wrap: anywhere; }
.platform-record p { margin: 5px 0 0; color: var(--muted); font-size: 13px; white-space: pre-wrap; }
.platform-record small { color: var(--muted); }
.platform-record-actions { display: flex; align-items: center; gap: 6px; }
.platform-record-actions button { min-height: 34px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; }
.platform-form { display: grid; gap: 12px; max-width: 720px; }
.platform-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.platform-danger { border-color: #ff6473 !important; color: #ff7b87 !important; }

.community-rankings { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.community-rankings h3 { margin: 0 0 10px; }
.community-rankings p { color: var(--muted); line-height: 1.6; }
.community-rankings ol { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.community-rankings li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.community-rankings small { color: var(--muted); }

.notification-popover {
  position: fixed;
  z-index: 120;
  top: 78px;
  right: max(14px, calc((100vw - var(--page-width, 1180px)) / 2));
  width: min(390px, calc(100vw - 28px));
  max-height: min(620px, calc(100vh - 100px));
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 18px 50px rgb(0 0 0 / .35);
}
.notification-popover header { display: flex; justify-content: space-between; align-items: center; padding: 14px; border-bottom: 1px solid var(--line); }
.notification-popover-list { display: grid; }
.notification-item { display: grid; gap: 4px; padding: 13px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.notification-item[data-read="false"] { box-shadow: inset 3px 0 var(--hot); background: color-mix(in srgb, var(--hot) 8%, var(--surface)); }
.notification-item p { margin: 0; color: var(--muted); font-size: 13px; }

.admin-platform-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.admin-platform-panel { min-width: 0; border: 1px solid var(--line); background: var(--surface); }
.admin-platform-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.admin-platform-panel h4 { margin: 0; }
.admin-platform-panel-body { display: grid; max-height: 520px; overflow: auto; }
.admin-flag-row,
.admin-suite-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.admin-suite-row p { margin: 4px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.admin-suite-row button,
.admin-flag-row button { min-height: 34px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; }
.admin-flag-row button[data-enabled="true"] { border-color: #51d779; color: #51d779; }
.admin-suite-toolbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px; }
.admin-suite-toolbar button,
.admin-suite-toolbar a { min-height: 38px; padding: 8px 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); text-decoration: none; cursor: pointer; }
.admin-suite-toolbar input,
.admin-suite-toolbar select { min-width: 130px; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.admin-content-editor { grid-column: 1 / -1; }
.admin-content-editor form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 16px; }
.admin-content-editor .wide { grid-column: 1 / -1; }
.admin-content-quality { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
  .home-workbench { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prompt-studio-layout { grid-template-columns: 1fr; }
  .prompt-studio-form { border-right: 0; border-bottom: 1px solid var(--line); }
  .gallery-grid,
  .learning-path-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-platform-grid { grid-template-columns: 1fr; }
  .managed-content-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .home-workbench,
  .gallery-grid,
  .learning-path-grid,
  .prompt-studio-form { grid-template-columns: 1fr; }
  .prompt-studio-wide,
  .prompt-studio-actions { grid-column: auto; }
  .prompt-studio-form,
  .prompt-studio-output { padding: 14px; }
  .platform-profile-head,
  .platform-section-head { align-items: stretch; flex-direction: column; }
  .platform-record { grid-template-columns: 1fr; }
  .platform-record-actions { flex-wrap: wrap; }
  .admin-content-editor form { grid-template-columns: 1fr; }
  .admin-content-editor .wide { grid-column: auto; }
  .managed-content-grid { grid-template-columns: 1fr; }
  #profile .section-head h2 { font-size: 42px; line-height: 1.05; }
}
