.notes-panel {
  position: absolute;
  z-index: 880;
  display: flex;
  flex-direction: column;
  width: 520px;
  height: 470px;
  min-width: 360px;
  min-height: 300px;
  max-width: min(820px, calc(100vw - 24px));
  max-height: calc(100vh - 96px);
  overflow: hidden;
  resize: both;
  color: var(--ui-text-main, #eadfca);
  border: 1px solid rgba(214, 179, 107, 0.28);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025), transparent 18%),
    rgba(24, 20, 14, 0.97);
  box-shadow: 0 22px 60px rgba(0,0,0,0.48), inset 0 1px 0 rgba(255,255,255,0.04);
  backdrop-filter: blur(12px);
}

.notes-panel.hidden { display: none; }

.notes-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  cursor: move;
  user-select: none;
  border-bottom: 1px solid rgba(214, 179, 107, 0.18);
  background: linear-gradient(180deg, rgba(89, 67, 38, 0.45), rgba(46, 36, 24, 0.32));
}

.notes-panel-header span {
  display: block;
  color: #bca778;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.notes-panel-header h2 { margin: 2px 0 0; font-size: 18px; }
.notes-close {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(214, 179, 107, 0.25);
  border-radius: 7px;
  color: #dac9a7;
  background: rgba(0,0,0,0.22);
  font-size: 20px;
  line-height: 1;
}

.notes-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.notes-search {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid rgba(214, 179, 107, 0.18);
  border-radius: 7px;
  background: rgba(0,0,0,0.25);
}

.notes-search input {
  width: 100%;
  min-width: 0;
  padding: 9px 0;
  color: inherit;
  border: 0;
  outline: 0;
  background: transparent;
}

.notes-new-button {
  padding: 8px 12px;
  border: 1px solid rgba(192, 155, 83, 0.46);
  border-radius: 7px;
  color: #2b2114;
  background: linear-gradient(180deg, #d8c18b, #a98b52);
  font-weight: 700;
}

.notes-workspace {
  display: grid;
  grid-template-columns: minmax(145px, 38%) minmax(0, 1fr);
  min-height: 0;
  flex: 1;
}

.notes-list {
  min-height: 0;
  overflow: auto;
  padding: 8px;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.notes-list-item {
  display: block;
  width: 100%;
  margin: 0 0 6px;
  padding: 9px 10px;
  overflow: hidden;
  text-align: left;
  color: #ddcfb3;
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(255,255,255,0.025);
}

.notes-list-item:hover,
.notes-list-item.is-active {
  border-color: rgba(202, 164, 91, 0.32);
  background: rgba(160, 124, 60, 0.13);
}

.notes-list-item strong,
.notes-list-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-list-item strong { font-size: 13px; }
.notes-list-item span { margin-top: 4px; color: #8f846f; font-size: 11px; }
.notes-list-empty { padding: 14px 8px; color: #8f846f; font-size: 12px; }

.notes-editor,
.notes-editor-empty {
  min-width: 0;
  min-height: 0;
}

.notes-editor {
  display: flex;
  flex-direction: column;
  padding: 10px;
}

.notes-editor.hidden,
.notes-editor-empty.hidden { display: none; }

.notes-editor-empty {
  display: grid;
  place-items: center;
  padding: 24px;
  color: #8f846f;
  text-align: center;
}

.notes-editor textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 0;
  flex: 1;
  resize: none;
  padding: 12px;
  color: #e5d9c1;
  border: 1px solid rgba(214, 179, 107, 0.16);
  border-radius: 8px;
  outline: none;
  background: rgba(8, 7, 5, 0.38);
  line-height: 1.5;
}

.notes-editor textarea:focus { border-color: rgba(214, 179, 107, 0.42); }
.notes-editor footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
}

.notes-save-status { min-height: 16px; color: #948a77; font-size: 11px; }
.notes-save-status.is-saved { color: #91ad78; }
.notes-save-status.is-error { color: #d78673; }
.notes-delete-button {
  padding: 6px 9px;
  color: #c88c7c;
  border: 1px solid rgba(193, 91, 72, 0.25);
  border-radius: 6px;
  background: rgba(100, 34, 26, 0.14);
}

@media (max-width: 768px) {
  .notes-panel {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto !important;
    height: min(72vh, 620px) !important;
    min-width: 0;
    min-height: 360px;
    max-width: none;
    max-height: calc(100vh - 24px);
    resize: none;
    z-index: 970;
  }

  .notes-panel-header { cursor: default; }
  .notes-workspace { grid-template-columns: 128px minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .notes-workspace { grid-template-columns: 1fr; grid-template-rows: 132px minmax(0, 1fr); }
  .notes-list { border-right: 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
  .notes-toolbar { grid-template-columns: 1fr; }
}
