/* BioStudio AI — admin developer notes: titlebar button + anchored panel */

/* --- titlebar button --- */

.win-btn.notes {
  position: relative;
}

.win-btn.notes .win-btn-glyph {
  font-size: clamp(12px, calc(13px * var(--shell-scale, 1)), 14px);
  line-height: 1;
  opacity: 0.75;
}

.win-btn.notes:hover .win-btn-glyph {
  opacity: 1;
}

.win-btn-badge {
  position: absolute;
  top: clamp(3px, 20%, 8px);
  right: clamp(2px, 15%, 7px);
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  pointer-events: none;
}

.win-btn-badge[hidden] {
  display: none;
}

/* The macOS theme renders .win-btn as a 12px traffic-light dot with a colour
   fill. The notes button is not one of the three lights, so it opts out and
   sits after them (order: 4) as a normal glyph button. */
#os.theme-macos .win-theme-picker {
  order: 5;
  height: auto;
  padding: 0;
  margin-left: 6px;
  gap: 4px;
}

#os.theme-macos .win-theme-dot {
  width: 11px;
  height: 11px;
}

#os.theme-macos .win-btn.notes {
  order: 4;
  /* Beat the 12px traffic-light rule so this stays a clickable glyph. */
  width: 26px !important;
  height: 20px !important;
  padding: 0;
  margin-left: 10px;
  border-radius: 5px;
  background: transparent !important;
  box-shadow: none !important;
  flex: none;
  pointer-events: auto;
}

#os.theme-macos .win-btn.notes:hover {
  filter: none;
  background: rgba(127, 127, 127, 0.18) !important;
}

#os.theme-macos .window:not(.focused) .win-btn.notes,
#os.theme-macos.dark .window:not(.focused) .win-btn.notes {
  background: transparent !important;
}

#os.theme-macos .win-btn.notes .win-btn-glyph {
  font-size: 12px;
}

/* Sit the badge fully outside the smaller macOS button so it never covers
   the glyph. */
#os.theme-macos .win-btn-badge {
  top: -6px;
  right: -8px;
}

/* --- panel --- */

.dev-notes-panel {
  position: fixed;
  z-index: 121000;
  width: min(400px, 94vw);
  max-height: min(70vh, 620px);
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  /* Deliberately an opaque literal rather than --win-body-bg: several themes
     define that variable as a frosted rgba, and a see-through backlog over a
     busy app window is unreadable. */
  background: #ffffff;
  color: var(--ink, #1b1b1f);
  border: 1px solid var(--win-border, rgba(0, 0, 0, 0.12));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.26);
}

body.dark .dev-notes-panel,
.dark .dev-notes-panel {
  background: #1a1f27;
  color: #e8eaed;
  border-color: rgba(255, 255, 255, 0.12);
}

.dev-notes-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--win-border, rgba(0, 0, 0, 0.08));
}

.dev-notes-title {
  font-size: 13px;
  font-weight: 700;
}

.dev-notes-app {
  font-size: 11.5px;
  color: var(--ink-soft, #5d6470);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dev-notes-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft, #5d6470);
  white-space: nowrap;
}

.dev-notes-x {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--ink-soft, #5d6470);
}

.dev-notes-x:hover {
  background: rgba(127, 127, 127, 0.18);
}

/* --- compose --- */

.dev-notes-compose {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--win-border, rgba(0, 0, 0, 0.08));
}

.dev-notes-compose-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.dev-notes-input,
.dev-notes-edit {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  padding: 7px 9px;
  border-radius: 8px;
  resize: vertical;
  border: 1px solid var(--win-border, rgba(0, 0, 0, 0.14));
  background: transparent;
  color: inherit;
}

.dev-notes-mic {
  flex: none;
  width: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  border: 1px solid var(--win-border, rgba(0, 0, 0, 0.14));
  background: transparent;
}

.dev-notes-mic:hover {
  background: rgba(127, 127, 127, 0.14);
}

.dev-notes-mic.is-listening {
  background: rgba(220, 38, 38, 0.16);
  border-color: rgba(220, 38, 38, 0.5);
  animation: dev-notes-pulse 1.4s ease-in-out infinite;
}

@keyframes dev-notes-pulse {
  50% { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
  .dev-notes-mic.is-listening { animation: none; }
}

.dev-notes-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.dev-notes-tag {
  font: inherit;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--win-border, rgba(0, 0, 0, 0.12));
  background: transparent;
  color: var(--ink-soft, #5d6470);
}

.dev-notes-tag.is-on {
  color: var(--tag-color);
  border-color: color-mix(in srgb, var(--tag-color) 50%, transparent);
  background: color-mix(in srgb, var(--tag-color) 14%, transparent);
  font-weight: 600;
}

.dev-notes-add {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  background: #2563eb;
  color: #fff;
}

.dev-notes-add:hover {
  background: #1d4ed8;
}

/* --- controls --- */

.dev-notes-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 8px 12px;
}

.dev-notes-search {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  font-size: 12.5px;
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid var(--win-border, rgba(0, 0, 0, 0.14));
  background: transparent;
  color: inherit;
}

.dev-notes-filters {
  display: flex;
  flex: none;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--win-border, rgba(0, 0, 0, 0.14));
}

.dev-notes-filter {
  font: inherit;
  font-size: 11.5px;
  padding: 5px 9px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--ink-soft, #5d6470);
}

.dev-notes-filter.is-on {
  background: rgba(37, 99, 235, 0.15);
  color: #1d4ed8;
  font-weight: 600;
}

.dev-notes-selbtn {
  flex: none;
  font: inherit;
  font-size: 11.5px;
  padding: 5px 9px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--win-border, rgba(0, 0, 0, 0.14));
  background: transparent;
  color: var(--ink-soft, #5d6470);
}

.dev-notes-selbtn.is-on {
  background: rgba(37, 99, 235, 0.15);
  border-color: rgba(37, 99, 235, 0.4);
  color: #1d4ed8;
  font-weight: 600;
}

/* --- bulk action strip --- */

.dev-notes-bulk {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 12px;
  border-top: 1px solid var(--win-border, rgba(0, 0, 0, 0.08));
  border-bottom: 1px solid var(--win-border, rgba(0, 0, 0, 0.08));
  background: rgba(37, 99, 235, 0.07);
}

.dev-notes-bulk[hidden] {
  display: none;
}

.dev-notes-bulk-all {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  cursor: pointer;
  user-select: none;
}

.dev-notes-bulk-count {
  font-size: 11px;
  color: var(--ink-soft, #5d6470);
  white-space: nowrap;
}

.dev-notes-bulk-acts {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
}

.dev-notes-bulk-btn {
  font: inherit;
  font-size: 11.5px;
  padding: 4px 8px;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid var(--win-border, rgba(0, 0, 0, 0.14));
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
}

.dev-notes-bulk-btn:hover {
  background: rgba(127, 127, 127, 0.2);
}

.dev-notes-bulk-btn.is-danger {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.35);
}

/* --- list --- */

.dev-notes-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 12px 8px;
}

.dev-notes-row {
  display: flex;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  border-left: 3px solid var(--tag-color, #94a3b8);
  background: color-mix(in srgb, var(--tag-color, #94a3b8) 7%, transparent);
}

.dev-notes-row + .dev-notes-row {
  margin-top: 5px;
}

.dev-notes-row.is-done {
  opacity: 0.55;
}

.dev-notes-row.is-done .dev-notes-text {
  text-decoration: line-through;
}

.dev-notes-check,
.dev-notes-select {
  flex: none;
  margin-top: 3px;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.dev-notes-select {
  accent-color: #2563eb;
}

.dev-notes-row.is-selected {
  outline: 1.5px solid rgba(37, 99, 235, 0.55);
  outline-offset: -1px;
}

/* Importance marker. Kept in the text line so a starred note reads as
   emphasised rather than as a second control column. */
.dev-notes-star {
  flex: none;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--ink-soft, #9aa3af);
  opacity: 0.45;
}

.dev-notes-row:hover .dev-notes-star,
.dev-notes-star:focus-visible {
  opacity: 1;
}

.dev-notes-star.is-on {
  color: #f59e0b;
  opacity: 1;
}

.dev-notes-row.is-starred {
  background: color-mix(in srgb, #f59e0b 10%, transparent);
}

.dev-notes-row.is-starred .dev-notes-text {
  font-weight: 600;
}

.dev-notes-main {
  flex: 1 1 auto;
  min-width: 0;
}

.dev-notes-line {
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
}

.dev-notes-tagchip {
  flex: none;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tag-color, #64748b);
}

.dev-notes-text {
  font-size: 12.5px;
  line-height: 1.45;
  cursor: text;
  overflow-wrap: anywhere;
}

.dev-notes-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--ink-soft, #5d6470);
}

.dev-notes-del {
  font: inherit;
  font-size: 10.5px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #dc2626;
  opacity: 0;
}

.dev-notes-row:hover .dev-notes-del,
.dev-notes-del:focus-visible {
  opacity: 1;
}

/* --- captured context --- */

.dev-notes-ctx {
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-soft, #5d6470);
}

.dev-notes-ctx summary {
  cursor: pointer;
  user-select: none;
}

.dev-notes-ctx-line {
  padding: 2px 0;
}

.dev-notes-err {
  margin: 3px 0 0;
  padding: 5px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
}

.dev-notes-empty {
  margin: 14px 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-soft, #5d6470);
}

/* --- footer --- */

.dev-notes-foot {
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  border-top: 1px solid var(--win-border, rgba(0, 0, 0, 0.08));
}

.dev-notes-link {
  font: inherit;
  font-size: 11.5px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #2563eb;
}

.dev-notes-link:hover {
  text-decoration: underline;
}

/* --- copy scope menu --- */

.dev-notes-copy {
  position: relative;
}

.dev-notes-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 1;
  min-width: 168px;
  display: flex;
  flex-direction: column;
  padding: 4px;
  border-radius: 9px;
  background: #ffffff;
  border: 1px solid var(--win-border, rgba(0, 0, 0, 0.12));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.dev-notes-menu[hidden] {
  display: none;
}

.dev-notes-menu-item {
  font: inherit;
  font-size: 12px;
  text-align: left;
  padding: 6px 9px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.dev-notes-menu-item:hover {
  background: rgba(37, 99, 235, 0.14);
}

/* --- dark mode --- */

body.dark .dev-notes-filter.is-on,
.dark .dev-notes-filter.is-on {
  background: rgba(96, 165, 250, 0.2);
  color: #bfdbfe;
}

body.dark .dev-notes-err,
.dark .dev-notes-err {
  background: rgba(248, 113, 113, 0.16);
  color: #fecaca;
}

body.dark .dev-notes-link,
.dark .dev-notes-link {
  color: #93c5fd;
}

body.dark .dev-notes-menu,
.dark .dev-notes-menu {
  background: #232a34;
  border-color: rgba(255, 255, 255, 0.14);
}

body.dark .dev-notes-bulk,
.dark .dev-notes-bulk {
  background: rgba(96, 165, 250, 0.12);
}

body.dark .dev-notes-bulk-btn,
.dark .dev-notes-bulk-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
}

body.dark .dev-notes-selbtn.is-on,
.dark .dev-notes-selbtn.is-on {
  background: rgba(96, 165, 250, 0.2);
  color: #bfdbfe;
}

.dev-notes-capture-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dev-notes-shotbtn {
  font: inherit;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--line, rgba(0, 0, 0, 0.16));
  background: transparent;
  cursor: pointer;
}

.dev-notes-privacy {
  font-size: 11px;
  opacity: 0.65;
}

.dev-notes-shots,
.dev-notes-att-row,
.dev-notes-inbox-shots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.dev-notes-thumb-wrap {
  position: relative;
}

.dev-notes-thumb,
.dev-notes-att,
.dev-notes-inbox-shot {
  display: block;
  max-width: 160px;
  max-height: 110px;
  border-radius: 6px;
  object-fit: cover;
  cursor: zoom-in;
}

.dev-notes-inbox-shot {
  max-width: 100%;
  max-height: 280px;
}

.dev-notes-thumb-x {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
}

.dev-notes-replies {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dev-notes-reply {
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(127, 127, 127, 0.08);
  font-size: 12px;
}

.dev-notes-reply-time {
  margin-left: 8px;
  opacity: 0.6;
  font-size: 11px;
}

.dev-notes-reply-input {
  width: 100%;
  font: inherit;
  font-size: 12px;
  resize: vertical;
  border-radius: 6px;
  border: 1px solid var(--line, rgba(0, 0, 0, 0.16));
  padding: 6px 8px;
}

.dev-notes-sync {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.6;
}

.dev-notes-inbox {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.dev-notes-inbox-toolbar,
.dev-notes-inbox-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 12px 0;
}

.dev-notes-inbox-title {
  font-weight: 700;
}

.dev-notes-inbox-status {
  font-size: 12px;
  opacity: 0.7;
}

.dev-notes-inbox-select,
.dev-notes-inbox-search,
.dev-notes-inbox-date {
  font: inherit;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--line, rgba(0, 0, 0, 0.16));
  background: var(--surface, #fff);
}

.dev-notes-inbox-search {
  min-width: 180px;
  flex: 1;
}

.dev-notes-inbox-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.dev-notes-inbox-body {
  display: grid;
  grid-template-columns: minmax(260px, 34%) 1fr;
  gap: 0;
  min-height: 0;
  flex: 1;
  margin-top: 8px;
  border-top: 1px solid var(--line, rgba(0, 0, 0, 0.1));
}

.dev-notes-inbox-list {
  overflow: auto;
  border-right: 1px solid var(--line, rgba(0, 0, 0, 0.1));
}

.dev-notes-inbox-detail {
  overflow: auto;
  padding: 12px 16px 20px;
}

.dev-notes-inbox-row {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line, rgba(0, 0, 0, 0.08));
  background: transparent;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
}

.dev-notes-inbox-row.is-on {
  background: rgba(245, 158, 11, 0.12);
}

.dev-notes-inbox-row.is-done {
  opacity: 0.65;
}

.dev-notes-inbox-row-top,
.dev-notes-inbox-row-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}

.dev-notes-inbox-preview {
  margin: 4px 0 0;
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dev-notes-inbox-row-meta,
.dev-notes-inbox-user {
  font-size: 11px;
  opacity: 0.65;
}

.dev-notes-inbox-text {
  font-size: 14px;
  line-height: 1.45;
}

.dev-notes-inbox-detail-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}

.dev-notes-inbox-detail-head h3 {
  margin: 0;
}

.dev-notes-inbox-status-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0 12px;
}

.dev-notes-snip {
  position: fixed;
  inset: 0;
  z-index: 200000;
  cursor: crosshair;
  user-select: none;
  touch-action: none;
}

.dev-notes-snip-blur {
  position: fixed;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  background: rgba(12, 16, 22, 0.28);
}

.dev-notes-snip-sel {
  position: fixed;
  pointer-events: none;
  border: 2px solid #4da3ff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  display: none;
}

.dev-notes-snip-hint {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(12, 16, 22, 0.78);
  color: #fff;
  font-size: 12px;
  pointer-events: none;
  z-index: 1;
}

.dev-notes-anno {
  position: fixed;
  inset: 0;
  z-index: 200100;
  display: flex;
  flex-direction: column;
  background: rgba(10, 14, 20, 0.92);
  color: #f4f6f8;
}

.dev-notes-anno-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  flex-wrap: wrap;
}

.dev-notes-anno-head strong {
  font-size: 14px;
}

.dev-notes-anno-sub {
  font-size: 12px;
  opacity: 0.7;
  flex: 1;
}

.dev-notes-anno-acts {
  display: flex;
  gap: 8px;
}

.dev-notes-anno-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px 10px;
  flex-wrap: wrap;
}

.dev-notes-anno-tool {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

.dev-notes-anno-tool.is-on {
  background: #2563eb;
  border-color: #2563eb;
}

.dev-notes-anno-sep {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 4px;
}

.dev-notes-anno-color {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.dev-notes-anno-color.is-on {
  border-color: #fff;
}

.dev-notes-anno-width {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.85;
}

.dev-notes-anno-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px 16px;
  overflow: auto;
  background: #2a2f36;
}

.dev-notes-anno-status {
  position: absolute;
  z-index: 2;
  color: #fff;
  font-size: 13px;
}

.dev-notes-anno-frame {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}

.dev-notes-anno-photo {
  display: block;
  max-width: min(96vw, 1400px);
  max-height: calc(100vh - 140px);
  background: #fff;
}

.dev-notes-anno-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.dev-notes-anno-type {
  position: absolute;
  z-index: 3;
  min-width: 6ch;
  max-width: 78%;
  margin: 0;
  padding: 0 1px;
  border: 0;
  outline: none;
  background: transparent;
  font-family: sans-serif;
  font-weight: 600;
  line-height: 1.2;
  resize: none;
  overflow: hidden;
  white-space: pre;
  box-shadow: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}
