/* Project notes — collapsible panel pinned to the bottom-right of the project
   page, outside the tab frame. z-index clears the mobile .budget-line-toolbar
   (50, invoices.css) and stays under the sticky nav (100, base.css). Styled as
   an M3 floating sheet: it overlays the page, so it carries elevation. */

.project-notes {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* Launcher: a primary-container FAB-style button. */
.project-notes-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  cursor: pointer;
  box-shadow: var(--md-sys-elevation-level2);
  transition:
    background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    box-shadow var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.project-notes-launcher:hover {
  background: color-mix(in srgb, var(--md-sys-color-primary-container), var(--md-sys-color-on-primary-container) 8%);
  box-shadow: var(--md-sys-elevation-level3);
}

.project-notes-launcher .icon {
  width: 1.15rem;
  height: 1.15rem;
}

/* Unread indicator: an M3 small badge. */
.project-notes-dot {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-error);
}

.project-notes-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
  width: min(380px, calc(100vw - 48px));
  max-height: min(60vh, 520px);
  overflow-y: auto;
  padding: 16px 16px 16px 24px;
  border: none;
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-surface-container-low);
  box-shadow: var(--md-sys-elevation-level2);
}

.project-notes.is-open .project-notes-panel {
  display: flex;
}

.project-notes.is-open .project-notes-launcher {
  order: 1;
}

.project-notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-notes-header h2 {
  margin: 0;
  font: var(--md-sys-typescale-title-large);
  letter-spacing: var(--md-sys-typescale-title-large-tracking);
  color: var(--md-sys-color-on-surface);
}

/* Icon-style close control: 40px circle, state layer on hover. */
.project-notes-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  background: none;
  padding: 0;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.project-notes-close .icon { width: 20px; height: 20px; vertical-align: 0; }

.project-notes-close:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-on-surface-variant) 8%, transparent);
  color: var(--md-sys-color-on-surface);
}

.project-notes-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: var(--md-sys-typescale-body-medium);
  letter-spacing: var(--md-sys-typescale-body-medium-tracking);
  color: var(--md-sys-color-on-surface);
}

.project-notes-stamp {
  margin: 10px 0 0;
  font: var(--md-sys-typescale-body-small);
  letter-spacing: var(--md-sys-typescale-body-small-tracking);
  color: var(--md-sys-color-on-surface-variant);
}

/* M3 outlined text area. */
.project-notes-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-extra-small);
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--md-sys-color-on-surface);
  font: var(--md-sys-typescale-body-large);
  letter-spacing: var(--md-sys-typescale-body-large-tracking);
  resize: vertical;
  outline: none;
  transition:
    border-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    box-shadow var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.project-notes-input:hover {
  border-color: var(--md-sys-color-on-surface);
}

.project-notes-input:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: inset 0 0 0 1px var(--md-sys-color-primary);
}

.project-notes-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 640px) {
  .project-notes {
    right: 12px;
    bottom: 12px;
  }

  .project-notes-panel {
    width: calc(100vw - 24px);
  }
}
