/* Notes panel — the sticky-note template gallery opened from the editor's
   MAIN tools bar (beside Legal), not from the Annotate menu.

   Every selector is `.pwn-` / `#pw-notes-panel` so it cannot collide with
   editor.css or app.css. The panel rides above the editor chrome and borrows
   its colours from the app's own CSS variables.

   It is DOCKED, not a modal (the client's reference: "Sticky Note" beside the
   sheet, the page still visible and clickable while you pick), so you can
   choose a template and still see where it will land. */

.pwn-wrap {
  position: fixed;
  left: 14px;
  top: 72px;
  bottom: 14px;
  width: 302px;
  z-index: 141;
}

.pwn-wrap[hidden] { display: none; }

.pwn-sheet {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #10213d;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(11, 24, 45, 0.22), 0 2px 8px rgba(11, 24, 45, 0.08);
  overflow: hidden;
}

.pwn-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
}

.pwn-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.2px;
}

.pwn-x {
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 1;
  color: #52627a;
  background: #f4f7fb;
  border: 1px solid #e3e9f2;
  border-radius: 9px;
  cursor: pointer;
}

.pwn-x:hover { background: #eaf0f9; color: #10213d; }

/* Templates / Custom — the two views of the same sheet. */
.pwn-tabs {
  display: flex;
  gap: 22px;
  padding: 0 18px;
  border-bottom: 1px solid #eef2f8;
}
.pwn-tab {
  padding: 9px 0 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #7b8aa1;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.pwn-tab:hover { color: #35455e; }
.pwn-tab.is-on { color: #2563eb; border-bottom-color: #2563eb; }

.pwn-lead {
  margin: 12px 18px 10px;
  color: #52627a;
  font-size: 12.5px;
  line-height: 1.45;
}

.pwn-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  /* Rows keep their own height: with a single saved note the card used to
     stretch down the whole panel (grid rows stretch by default), which made
     one note look like a column of empty card. */
  align-content: start;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
  gap: 12px;
  padding: 4px 18px 18px;
}

.pwn-tpl {
  align-self: start;
  display: grid;
  gap: 8px;
  padding: 9px;
  text-align: left;
  background: #fff;
  border: 1px solid #e3e9f2;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
}

.pwn-tpl:hover,
.pwn-tpl:focus-visible {
  border-color: #b9cdf7;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.14);
  outline: none;
}

.pwn-prev {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 88px;
  padding: 9px 8px;
  border-radius: 2px 2px 8px 2px;
  box-shadow: inset 0 0 0 1px rgba(16, 33, 61, 0.08);
  overflow: hidden;
}

.pwn-prev b {
  font-size: 12px;
  font-weight: 750;
}

.pwn-prev i {
  font-size: 10.5px;
  font-style: normal;
  line-height: 1.45;
  white-space: pre-wrap;
  opacity: 0.82;
}

.pwn-tpl { position: relative; }
.pwn-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  line-height: 18px;
  text-align: center;
  font-size: 15px;
  color: #52627a;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.12s;
}
.pwn-tpl:hover .pwn-del, .pwn-tpl:focus-within .pwn-del { opacity: 1; }
.pwn-del:hover { color: #b3261e; background: #fee7e4; }

.pwn-empty {
  grid-column: 1 / -1;
  margin: 6px 2px;
  color: #7b8aa1;
  font-size: 12.5px;
  line-height: 1.5;
}

.pwn-name {
  font-size: 11.5px;
  font-weight: 650;
  color: #35455e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pwn-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px 16px;
  border-top: 1px solid #eef2f8;
}

.pwn-field {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: #52627a;
}

.pwn-seg {
  display: inline-flex;
  gap: 6px;
}

.pwn-size {
  min-width: 38px;
  padding: 6px 0;
  font: inherit;
  font-size: 12.5px;
  color: #10213d;
  background: #fff;
  border: 1px solid #dce4ef;
  border-radius: 8px;
  cursor: pointer;
}

.pwn-size.is-on {
  background: #eef4ff;
  border-color: #9db8f0;
  color: #2563eb;
  font-weight: 700;
}

/* The Colour row: swatches that tint the note about to be added. Press the
   same swatch again to go back to the template's own colour. */
.pwn-colors { display: inline-flex; gap: 5px; }
.pwn-c {
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(15, 35, 60, 0.18);
  background: var(--c, #FFD500);
  cursor: pointer;
}
.pwn-c.on { outline: 2px solid #2563eb; outline-offset: 2px; }

@media (max-width: 620px) {
  .pwn-wrap { left: 8px; right: 8px; width: auto; top: 64px; bottom: 8px; }
  .pwn-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
  .pwn-prev { min-height: 74px; }
}

@media (prefers-reduced-motion: no-preference) {
  .pwn-sheet { animation: pwn-in 0.16s ease-out; }
  @keyframes pwn-in {
    from { transform: translateY(6px); opacity: 0.6; }
    to { transform: none; opacity: 1; }
  }
}
