/*
 * Wooshin Tutor notes reference layer
 * Loaded after the legacy stylesheets. This file intentionally changes only
 * the note library, note market, and handwriting editor surfaces.
 */

:root {
  --note-green: #0f654b;
  --note-green-strong: #0a513d;
  --note-green-soft: #edf7f2;
  --note-green-tint: #f6fbf8;
  --note-ink: #17211d;
  --note-muted: #68736e;
  --note-line: #dfe6e2;
  --note-line-strong: #cbd7d1;
  --note-canvas-bg: #edf1ef;
  --note-danger: #c73b33;
  --note-control-radius: 8px;
  --note-card-radius: 10px;
}

/* --------------------------------------------------------------------------
 * Note library frame
 * ----------------------------------------------------------------------- */

.notes-workspace {
  width: 100%;
  min-width: 0;
  color: var(--note-ink);
}

/* Profile tab integration may arrive after this isolated stylesheet. */
.profile-tab-notes {
  min-width: 0;
  overflow: visible;
  gap: 0;
}

.profile-tab-notes > .profile-cover,
.profile-tab-notes > .profile-navigation-shell {
  display: none;
}

.profile-tab-notes .notes-workspace {
  width: 100%;
  min-width: 0;
  margin: 0;
}

.notes-workspace,
.notes-workspace * {
  box-sizing: border-box;
}

.notes-workspace > .workspace-head {
  min-height: 0;
  margin: 0 0 22px;
  padding: 0 0 18px;
  border: 0;
  border-bottom: 1px solid var(--note-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.notes-workspace > .workspace-head::before,
.notes-workspace > .workspace-head::after {
  display: none;
}

.notes-workspace > .workspace-head .workspace-kicker,
.notes-workspace > .workspace-head .eyebrow {
  color: var(--note-green);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
}

.notes-workspace > .workspace-head h1,
.notes-workspace > .workspace-head h2 {
  margin: 4px 0 5px;
  color: var(--note-ink);
  font-size: clamp(25px, 3vw, 32px);
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: 0;
}

.notes-workspace > .workspace-head p {
  max-width: 660px;
  margin: 0;
  color: var(--note-muted);
  font-size: 14px;
  line-height: 1.55;
}

.notes-workspace .workspace-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.notes-workspace .workspace-head-actions > button {
  min-width: 0;
  min-height: 42px;
  padding: 0 15px;
  border-radius: var(--note-control-radius);
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
}

.notes-workspace .workspace-head-actions > .primary {
  border-color: var(--note-green);
  background: var(--note-green);
  color: #fff;
}

.notes-workspace .workspace-head-actions > .primary:hover {
  border-color: var(--note-green-strong);
  background: var(--note-green-strong);
}

.notes-workspace .workspace-head-actions > .ghost {
  border-color: var(--note-line-strong);
  background: #fff;
  color: var(--note-ink);
}

/* Recovery is important, but should not dominate the whole page. */
.notes-workspace .note-recovery-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  margin: 0 0 14px;
  padding: 11px 12px;
  border: 1px solid #d9e4dd;
  border-radius: var(--note-card-radius);
  background: var(--note-green-tint);
  color: var(--note-ink);
  box-shadow: none;
}

.notes-workspace .note-recovery-banner > div:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.notes-workspace .note-recovery-banner strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-workspace .note-recovery-banner span {
  overflow: hidden;
  color: var(--note-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-workspace .note-recovery-banner .chips {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.notes-workspace .note-recovery-banner button {
  min-height: 36px;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 13px;
  box-shadow: none;
}

/* Search and sort are one quiet utility row. */
.notes-workspace .note-toolbar.workspace-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 172px;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.notes-workspace .note-toolbar .search-field {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--note-line-strong);
  border-radius: var(--note-control-radius);
  background: #fff;
  box-shadow: none;
}

.notes-workspace .note-toolbar .search-field:focus-within {
  border-color: var(--note-green);
  box-shadow: 0 0 0 3px rgba(15, 101, 75, 0.1);
}

.notes-workspace .note-toolbar .search-field .icon {
  width: 18px;
  height: 18px;
  color: #75817b;
}

.notes-workspace .note-toolbar .search-field input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--note-ink);
  font-size: 14px;
  box-shadow: none;
}

.notes-workspace .note-toolbar .compact-select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--note-line-strong);
  border-radius: var(--note-control-radius);
  background-color: #fff;
  color: #38453f;
  font-size: 13px;
  font-weight: 650;
  box-shadow: none;
}

/* Categories behave like document tabs, not a row of floating pills. */
.notes-workspace .note-tabs.workspace-tabs {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  margin: 0 0 14px;
  padding: 0;
  overflow-x: auto;
  border: 0;
  border-bottom: 1px solid var(--note-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.notes-workspace .note-tabs.workspace-tabs::-webkit-scrollbar {
  display: none;
}

.notes-workspace .note-tabs.workspace-tabs > button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  min-width: 0;
  min-height: 43px;
  margin: 0;
  padding: 0 14px;
  scroll-snap-align: start;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #65716b;
  font-size: 13px;
  font-weight: 650;
  box-shadow: none;
}

.notes-workspace .note-tabs.workspace-tabs > button::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
}

.notes-workspace .note-tabs.workspace-tabs > button:hover {
  background: transparent;
  color: var(--note-green);
}

.notes-workspace .note-tabs.workspace-tabs > button.active {
  border: 0;
  background: transparent;
  color: var(--note-green);
  box-shadow: none;
}

.notes-workspace .note-tabs.workspace-tabs > button.active::after {
  background: var(--note-green);
}

.notes-workspace .note-tabs .icon {
  width: 16px;
  height: 16px;
}

.notes-workspace .note-tabs .chip-count {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 5px;
  border-radius: 10px;
  background: #eef2f0;
  color: #5f6a65;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.notes-workspace .note-tabs > button.active .chip-count {
  background: var(--note-green-soft);
  color: var(--note-green);
}

/* Optional metrics retain one shared surface instead of four nested cards. */
.notes-workspace .note-workspace-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 14px;
  overflow: hidden;
  border: 1px solid var(--note-line);
  border-radius: var(--note-card-radius);
  background: #fff;
  box-shadow: none;
}

.notes-workspace .note-stat {
  display: grid;
  min-width: 0;
  min-height: 62px;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 10px;
  border: 0;
  border-right: 1px solid var(--note-line);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.notes-workspace .note-stat:last-child {
  border-right: 0;
}

.notes-workspace .note-stat strong {
  color: var(--note-ink);
  font-size: 20px;
  font-weight: 750;
  line-height: 1;
}

.notes-workspace .note-stat span {
  color: var(--note-muted);
  font-size: 11px;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
 * Library list and selected document
 * ----------------------------------------------------------------------- */

.notes-workspace .note-layout.grid.two {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.22fr);
  align-items: start;
  gap: 18px;
  min-width: 0;
}

.notes-workspace .note-layout.grid.two.is-empty {
  grid-template-columns: minmax(0, 1fr);
}

.notes-workspace .note-list.notice-list {
  display: grid;
  min-width: 0;
  max-height: min(690px, calc(100dvh - 250px));
  gap: 0;
  padding: 0;
  overflow: hidden auto;
  border: 1px solid var(--note-line);
  border-radius: var(--note-card-radius);
  background: #fff;
  box-shadow: none;
  scrollbar-color: #c8d3cd transparent;
  scrollbar-width: thin;
}

.notes-workspace .note-card.notice-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  grid-template-rows: auto minmax(30px, auto) auto;
  column-gap: 12px;
  row-gap: 7px;
  min-width: 0;
  margin: 0;
  padding: 14px;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--note-line);
  border-radius: 0;
  background: #fff;
  color: var(--note-ink);
  outline: 0;
  box-shadow: none;
  transform: none;
  transition: background-color 140ms ease, color 140ms ease;
}

.notes-workspace .note-card.notice-card:last-child {
  border-bottom: 0;
}

.notes-workspace .note-card.notice-card:hover {
  border-color: var(--note-line);
  background: #f8faf9;
  box-shadow: none;
  transform: none;
}

.notes-workspace .note-card.notice-card:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--note-green);
  outline-offset: -2px;
  background: #f8faf9;
}

.notes-workspace .note-card.notice-card.active-note {
  border-color: var(--note-line);
  background: var(--note-green-soft);
  color: var(--note-ink);
  box-shadow: none;
  transform: none;
}

.notes-workspace .note-card .card-head {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.notes-workspace .note-card .card-head strong {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: 15px;
  font-weight: 720;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-workspace .note-card .badge {
  flex: 0 0 auto;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid #d7e4dd;
  border-radius: 6px;
  background: #f5faf7;
  color: var(--note-green);
  font-size: 10px;
  font-weight: 700;
}

.notes-workspace .note-card .note-thumb {
  grid-column: 2;
  grid-row: 1 / 4;
  align-self: stretch;
  width: 72px;
  height: 88px;
  max-width: 100%;
  max-height: 88px;
  margin: 0;
  border: 1px solid var(--note-line);
  border-radius: 7px;
  background: #f7f9f8;
  object-fit: cover;
  box-shadow: none;
}

.notes-workspace .note-card > p {
  grid-column: 1 / -1;
  grid-row: 2;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--note-muted);
  font-size: 13px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-workspace .note-card:has(.note-thumb) > p {
  grid-column: 1;
}

.notes-workspace .note-card .meta {
  grid-column: 1;
  grid-row: 3;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #7b857f;
  font-size: 11px;
  font-weight: 550;
  line-height: 1.4;
}

.notes-workspace .note-card .meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-workspace .note-card .meta span + span::before {
  content: "\00b7";
  margin-right: 7px;
  color: #a1aaa5;
}

.notes-workspace .note-list[data-empty="true"]::after {
  content: "Search results are empty.";
  display: grid;
  min-height: 150px;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--note-muted);
  font-size: 13px;
  font-weight: 600;
}

.notes-workspace .note-empty.empty {
  display: grid;
  min-height: 230px;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 28px 20px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--note-muted);
  text-align: center;
}

.notes-workspace .note-empty strong {
  color: var(--note-ink);
  font-size: 16px;
  font-weight: 720;
}

.notes-workspace .note-empty span {
  max-width: 310px;
  font-size: 13px;
  line-height: 1.55;
}

.notes-workspace .note-empty button {
  min-height: 39px;
  margin-top: 7px;
  padding: 0 13px;
  border-radius: var(--note-control-radius);
  font-size: 13px;
  box-shadow: none;
}

.notes-workspace .note-inspector.panel {
  position: sticky;
  top: 80px;
  min-width: 0;
  min-height: 330px;
  margin: 0;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--note-line);
  border-radius: var(--note-card-radius);
  background: #fff;
  box-shadow: none;
}

.notes-workspace .note-inspector > .form,
.notes-workspace .note-inspector > form {
  display: grid;
  min-width: 0;
  gap: 12px;
}

.notes-workspace .note-inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.notes-workspace .note-inspector-head .badge {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid #d6e4dc;
  border-radius: 6px;
  background: var(--note-green-soft);
  color: var(--note-green);
  font-size: 11px;
}

.notes-workspace .note-inspector-head .muted {
  min-width: 0;
  overflow: hidden;
  color: var(--note-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-workspace .note-title-edit {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 3px;
  padding: 0 0 11px;
  border: 0;
  border-bottom: 1px solid var(--note-line);
  border-radius: 0;
  background: transparent;
  color: var(--note-ink);
  text-align: left;
  box-shadow: none;
}

.notes-workspace .note-title-edit:hover span {
  color: var(--note-green);
}

.notes-workspace .note-title-edit span {
  width: 100%;
  overflow: hidden;
  font-size: 19px;
  font-weight: 750;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-workspace .note-title-edit small {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--note-muted);
  font-size: 11px;
  font-weight: 600;
}

.notes-workspace .note-title-edit small .icon {
  width: 13px;
  height: 13px;
}

.notes-workspace .hand-note-summary {
  display: grid;
  width: 100%;
  min-width: 0;
  max-height: 440px;
  place-items: center;
  overflow: auto;
  border: 1px solid var(--note-line);
  border-radius: 8px;
  background: #f5f7f6;
}

.notes-workspace .hand-note-summary img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 420px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  object-fit: contain;
  box-shadow: none;
}

.notes-workspace .note-inspector :is(.input, .select, .textarea) {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--note-line-strong);
  border-radius: var(--note-control-radius);
  background-color: #fff;
  color: var(--note-ink);
  box-shadow: none;
}

.notes-workspace .note-inspector :is(.input, .select) {
  min-height: 43px;
  padding-inline: 12px;
}

.notes-workspace .note-inspector :is(.input, .select, .textarea):focus {
  border-color: var(--note-green);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(15, 101, 75, 0.1);
}

.notes-workspace .note-textarea {
  min-height: 350px;
  padding: 13px 14px;
  resize: vertical;
  background-color: #fff;
  background-image: linear-gradient(to bottom, transparent 30px, #edf1ef 31px);
  background-size: 100% 31px;
  font-size: 14px;
  line-height: 31px;
  overflow-wrap: anywhere;
}

.notes-workspace .note-inspector .chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.notes-workspace .note-inspector .chips > button {
  min-height: 40px;
  padding: 0 13px;
  border-radius: var(--note-control-radius);
  font-size: 13px;
  font-weight: 680;
  box-shadow: none;
}

.notes-workspace .note-inspector .chips > .primary {
  border-color: var(--note-green);
  background: var(--note-green);
  color: #fff;
}

.notes-workspace .note-inspector .chips > .ghost {
  border-color: var(--note-line-strong);
  background: #fff;
  color: var(--note-ink);
}

.notes-workspace .note-inspector .chips > .danger {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--note-danger);
}

.notes-workspace .note-inspector :is(.katex-display, pre, table) {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.notes-workspace .note-inspector :is(p, span, strong, textarea) {
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
 * Note market
 * ----------------------------------------------------------------------- */

.notes-workspace > .panel:not(.note-toolbar):not(.note-inspector),
.notes-workspace .note-tabs + .panel {
  min-width: 0;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--note-line);
  border-radius: var(--note-card-radius);
  background: #fff;
  box-shadow: none;
}

.notes-workspace .compact-title.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}

.notes-workspace .compact-title h2 {
  margin: 0;
  color: var(--note-ink);
  font-size: 19px;
  font-weight: 750;
}

.notes-workspace .compact-title .compact-select {
  width: auto;
  min-width: 120px;
  min-height: 40px;
  border: 1px solid var(--note-line-strong);
  border-radius: var(--note-control-radius);
  background-color: #fff;
  box-shadow: none;
}

.notes-workspace .market-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.notes-workspace .market-card.notice-card {
  display: grid;
  min-width: 0;
  gap: 9px;
  margin: 0;
  padding: 13px;
  overflow: hidden;
  border: 1px solid var(--note-line);
  border-radius: var(--note-card-radius);
  background: #fff;
  box-shadow: none;
}

.notes-workspace .market-card:hover {
  border-color: var(--note-line-strong);
  transform: none;
}

.notes-workspace .note-full-preview {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--note-line);
  border-radius: 7px;
  background: #f5f7f6;
  box-shadow: none;
}

.notes-workspace .market-card .note-thumb {
  display: block;
  width: 100%;
  height: auto;
  max-height: 250px;
  aspect-ratio: 3 / 4;
  border: 0;
  border-radius: 0;
  object-fit: cover;
}

.notes-workspace .market-card .card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.notes-workspace .market-card .card-head strong {
  min-width: 0;
  overflow: hidden;
  color: var(--note-ink);
  font-size: 14px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-workspace .market-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  color: var(--note-muted);
  font-size: 11px;
}

.notes-workspace .market-card .chips {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
}

.notes-workspace .market-card .chips button {
  min-width: 0;
  min-height: 38px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 12px;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
 * Handwriting workspace
 * ----------------------------------------------------------------------- */

.app-shell.has-note-editor {
  width: 100%;
  min-width: 0;
  min-height: 100dvh;
  padding: 0;
  overflow: hidden;
  background: var(--note-canvas-bg);
}

.has-note-editor .note-editor-backdrop {
  position: fixed;
  z-index: 400;
  inset: 0;
  display: block;
  min-width: 0;
  min-height: 100dvh;
  padding: 0;
  background: var(--note-canvas-bg);
}

.has-note-editor .note-editor {
  display: grid;
  grid-template-rows: 62px minmax(0, 1fr);
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--note-canvas-bg);
  box-shadow: none;
}

.has-note-editor .note-editor-top {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto minmax(230px, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 62px;
  padding: 8px 14px;
  border: 0;
  border-bottom: 1px solid var(--note-line);
  background: #fff;
  box-shadow: none;
}

.has-note-editor .note-editor-leading,
.has-note-editor .note-editor-actions,
.has-note-editor .note-header-history {
  display: flex;
  align-items: center;
  min-width: 0;
}

.has-note-editor .note-editor-leading {
  gap: 9px;
}

.has-note-editor .note-document-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.has-note-editor .note-document-copy > span {
  color: var(--note-green);
  font-size: 10px;
  font-weight: 700;
}

.has-note-editor .note-title-input {
  width: min(38vw, 430px);
  min-width: 0;
  height: auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--note-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 740;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: none;
}

.has-note-editor .note-editor-back-button,
.has-note-editor .note-header-history .icon-ghost {
  display: inline-grid;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--note-control-radius);
  background: transparent;
  color: #4c5953;
  box-shadow: none;
}

.has-note-editor .note-editor-back-button:hover,
.has-note-editor .note-header-history .icon-ghost:hover {
  border-color: var(--note-line);
  background: #f5f8f6;
  color: var(--note-green);
}

.has-note-editor .note-save-status {
  justify-self: center;
  min-width: 72px;
  color: var(--note-muted);
  font-size: 11px;
  font-weight: 650;
  text-align: center;
  white-space: nowrap;
}

.has-note-editor .note-save-status[data-status="saving"],
.has-note-editor .note-save-status[data-status="dirty"],
.has-note-editor .note-save-status[data-status="local"] {
  color: #9a6a15;
}

.has-note-editor .note-save-status[data-status="saved"] {
  color: var(--note-green);
}

.has-note-editor .note-save-status[data-status="error"],
.has-note-editor .note-save-status[data-status="backup-error"] {
  color: var(--note-danger);
}

.has-note-editor .note-editor-actions {
  justify-self: end;
  gap: 6px;
}

.has-note-editor .note-header-history {
  gap: 2px;
  padding-right: 7px;
  border-right: 1px solid var(--note-line);
}

.has-note-editor .note-save-button,
.has-note-editor .note-share-button,
.has-note-editor .note-copy-button {
  min-width: 0;
  min-height: 40px;
  padding: 0 13px;
  border-radius: var(--note-control-radius);
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}

.has-note-editor .note-save-button {
  border-color: var(--note-line-strong);
  background: #fff;
  color: var(--note-ink);
}

.has-note-editor .note-share-button,
.has-note-editor .note-copy-button {
  border-color: var(--note-green);
  background: var(--note-green);
  color: #fff;
}

.has-note-editor .note-editor-body {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.has-note-editor .note-toolrail {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  padding: 8px 7px;
  overflow: hidden auto;
  border: 0;
  border-right: 1px solid var(--note-line);
  background: #fff;
  box-shadow: none;
  scrollbar-width: thin;
}

.has-note-editor .note-tool-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.has-note-editor .note-toolrail .note-tool-group {
  width: 100%;
  flex-direction: column;
}

.has-note-editor .note-toolrail .note-tool-group + .note-tool-group {
  padding-top: 8px;
  border-top: 1px solid #edf1ef;
}

.has-note-editor .note-toolrail button {
  position: relative;
  display: grid;
  width: 52px;
  min-width: 52px;
  height: 44px;
  min-height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #52605a;
  box-shadow: none;
}

.has-note-editor .note-toolrail button:hover {
  background: #f1f5f3;
  color: var(--note-green);
}

.has-note-editor .note-toolrail button.active,
.has-note-editor .note-toolrail button[aria-pressed="true"] {
  background: var(--note-green-soft);
  color: var(--note-green);
  box-shadow: none;
}

.has-note-editor .note-toolrail button .icon,
.has-note-editor .note-toolrail button svg {
  width: 20px;
  height: 20px;
}

.has-note-editor .note-toolrail button > span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.has-note-editor .note-rail-actions {
  margin-top: auto;
}

.has-note-editor .note-workbench {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.has-note-editor .note-tool-inspector {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 56px;
  padding: 7px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 0;
  border-bottom: 1px solid var(--note-line);
  background: #fff;
  box-shadow: none;
  scrollbar-color: #c8d3cd transparent;
  scrollbar-width: thin;
}

.has-note-editor .note-active-tool-state {
  display: grid;
  flex: 0 0 auto;
  min-width: 66px;
  gap: 0;
}

.has-note-editor .note-active-tool-state span,
.has-note-editor .note-size-wrap > span {
  color: var(--note-muted);
  font-size: 10px;
  font-weight: 650;
}

.has-note-editor .note-active-tool-state strong {
  color: var(--note-ink);
  font-size: 13px;
  font-weight: 720;
}

.has-note-editor .note-colors {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
  padding: 0 11px;
  border-inline: 1px solid var(--note-line);
}

.has-note-editor .note-colors button {
  width: 25px;
  min-width: 25px;
  height: 25px;
  min-height: 25px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px #bfcac4;
}

.has-note-editor .note-colors button.active {
  box-shadow: 0 0 0 2px var(--note-green);
}

.has-note-editor .note-size-wrap {
  display: grid;
  grid-template-columns: auto minmax(84px, 136px) 34px;
  align-items: center;
  flex: 0 0 auto;
  gap: 7px;
  min-width: 0;
  margin: 0;
}

.has-note-editor .note-size-wrap input[type="range"] {
  min-width: 84px;
  accent-color: var(--note-green);
}

.has-note-editor .note-size-wrap output {
  color: #5f6b65;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.has-note-editor .shape-detail-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
}

.has-note-editor .shape-detail-tools > button,
.has-note-editor .pen-only-button {
  width: auto;
  min-width: 40px;
  height: 36px;
  min-height: 36px;
  padding: 0 9px;
  border: 1px solid var(--note-line-strong);
  border-radius: 7px;
  background: #fff;
  color: #52605a;
  box-shadow: none;
}

.has-note-editor .shape-detail-tools > button.active,
.has-note-editor .pen-only-button.active {
  border-color: #a9cbbd;
  background: var(--note-green-soft);
  color: var(--note-green);
  box-shadow: none;
}

.has-note-editor .note-editor:not([data-active-tool="line"]):not([data-active-tool="arrow"]):not([data-active-tool="rect"]):not([data-active-tool="ellipse"]):not([data-active-tool="triangle"]):not([data-active-tool="diamond"]) .shape-detail-tools {
  display: none;
}

.has-note-editor .note-editor[data-active-tool="eraser"] .note-colors,
.has-note-editor .note-editor[data-active-tool="eraser"] .pen-only-button {
  display: none;
}

.has-note-editor .hand-canvas-stage {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(14px, 2.5vw, 34px);
  background-color: var(--note-canvas-bg);
  background-image: radial-gradient(#ccd5d0 0.65px, transparent 0.65px);
  background-size: 18px 18px;
}

.has-note-editor #handCanvas {
  display: block;
  max-width: none;
  margin: auto;
  border: 1px solid #ccd5d0;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(23, 33, 29, 0.11);
  touch-action: none;
}

.has-note-editor .mobile-tabbar,
.has-note-editor .bottom-ask {
  display: none !important;
}

/* --------------------------------------------------------------------------
 * Responsive behavior
 * ----------------------------------------------------------------------- */

@media (max-width: 960px) {
  .notes-workspace .note-layout.grid.two {
    grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
    gap: 12px;
  }

  .notes-workspace .market-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell:has(.notes-workspace) .container {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .notes-workspace {
    padding-bottom: 10px;
  }

  .notes-workspace > .workspace-head {
    margin-bottom: 16px;
    padding-bottom: 15px;
  }

  .notes-workspace > .workspace-head h1,
  .notes-workspace > .workspace-head h2 {
    font-size: 24px;
  }

  .notes-workspace > .workspace-head p {
    max-width: 100%;
    font-size: 13px;
  }

  .notes-workspace .workspace-head-actions {
    width: 100%;
  }

  .notes-workspace .workspace-head-actions > button {
    flex: 1 1 0;
    min-height: 42px;
  }

  .notes-workspace .note-recovery-banner {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
  }

  .notes-workspace .note-recovery-banner .chips {
    width: 100%;
  }

  .notes-workspace .note-recovery-banner .chips > button {
    flex: 1 1 0;
  }

  .notes-workspace .note-toolbar.workspace-section {
    grid-template-columns: minmax(0, 1fr) 126px;
  }

  .notes-workspace .note-tabs.workspace-tabs > button {
    min-height: 42px;
    padding-inline: 12px;
  }

  .notes-workspace .note-layout.grid.two {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .notes-workspace .note-list.notice-list {
    max-height: min(44dvh, 430px);
  }

  .notes-workspace .note-inspector.panel {
    position: static;
    min-height: 0;
    padding: 15px;
  }

  .notes-workspace .note-textarea {
    min-height: 300px;
  }

  .notes-workspace .market-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .notes-workspace .market-card.notice-card {
    grid-template-columns: 82px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    align-items: start;
  }

  .notes-workspace .market-card .note-full-preview {
    grid-column: 1;
    grid-row: 1 / 4;
  }

  .notes-workspace .market-card .note-thumb {
    max-height: none;
    aspect-ratio: 3 / 4;
  }

  .notes-workspace .market-card .card-head,
  .notes-workspace .market-card > p,
  .notes-workspace .market-card .meta,
  .notes-workspace .market-card .chips {
    grid-column: 2;
    min-width: 0;
  }

  .notes-workspace .market-card .chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .has-note-editor .note-editor {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .has-note-editor .note-editor-top {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    min-height: calc(58px + env(safe-area-inset-top));
    padding: max(7px, env(safe-area-inset-top)) max(9px, env(safe-area-inset-right)) 7px max(9px, env(safe-area-inset-left));
  }

  .has-note-editor .note-editor-leading {
    gap: 5px;
  }

  .has-note-editor .note-editor-back-button {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
  }

  .has-note-editor .note-document-copy > span {
    display: none;
  }

  .has-note-editor .note-title-input {
    width: min(43vw, 190px);
    height: 22px !important;
    min-height: 22px !important;
    font-size: 14px;
    line-height: 22px;
  }

  .has-note-editor .note-save-status {
    position: absolute;
    left: calc(max(9px, env(safe-area-inset-left)) + 43px);
    bottom: 4px;
    height: 14px;
    min-width: 0;
    min-height: 14px;
    font-size: 9px;
    line-height: 14px;
  }

  .has-note-editor .note-header-history {
    display: none;
  }

  .has-note-editor .note-editor-actions {
    gap: 4px;
  }

  .has-note-editor .note-save-button,
  .has-note-editor .note-share-button,
  .has-note-editor .note-copy-button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
  }

  .has-note-editor .note-save-button span,
  .has-note-editor .note-share-button span,
  .has-note-editor .note-copy-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .has-note-editor .note-editor-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) calc(56px + env(safe-area-inset-bottom));
  }

  .has-note-editor .note-workbench {
    grid-column: 1;
    grid-row: 1;
    grid-template-rows: 52px minmax(0, 1fr);
  }

  .has-note-editor .note-toolrail {
    grid-column: 1;
    grid-row: 2;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    padding: 5px max(8px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    overflow: auto hidden;
    border: 0;
    border-top: 1px solid var(--note-line);
    background: #fff;
    scrollbar-width: none;
  }

  .has-note-editor .note-toolrail::-webkit-scrollbar {
    display: none;
  }

  .has-note-editor .note-toolrail .note-tool-group {
    width: auto;
    flex: 0 0 auto;
    flex-direction: row;
  }

  .has-note-editor .note-toolrail .note-tool-group + .note-tool-group {
    padding: 0 0 0 6px;
    border-top: 0;
    border-left: 1px solid var(--note-line);
  }

  .has-note-editor .note-toolrail button {
    width: 44px;
    min-width: 44px;
    height: 42px;
    min-height: 42px;
  }

  .has-note-editor .note-rail-actions {
    margin-top: 0;
  }

  .has-note-editor .note-tool-inspector {
    min-height: 52px;
    gap: 8px;
    padding: 6px 8px;
  }

  .has-note-editor .note-active-tool-state {
    min-width: 55px;
  }

  .has-note-editor .note-colors {
    gap: 4px;
    padding-inline: 8px;
  }

  .has-note-editor .note-colors button {
    width: 23px;
    min-width: 23px;
    height: 23px;
    min-height: 23px;
  }

  .has-note-editor .note-size-wrap {
    grid-template-columns: auto 78px 31px;
  }

  .has-note-editor .note-size-wrap input[type="range"] {
    min-width: 78px;
  }

  .has-note-editor .shape-detail-tools > button,
  .has-note-editor .pen-only-button {
    height: 34px;
    min-height: 34px;
  }

  .has-note-editor .hand-canvas-stage {
    padding: 10px;
  }
}

@media (max-width: 430px) {
  .notes-workspace .note-toolbar.workspace-section {
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 6px;
  }

  .notes-workspace .note-toolbar .search-field {
    padding-inline: 10px;
  }

  .notes-workspace .note-tabs.workspace-tabs > button {
    gap: 5px;
    padding-inline: 11px;
    font-size: 12px;
  }

  .notes-workspace .note-tabs .chip-count {
    min-width: 18px;
    height: 18px;
    padding-inline: 4px;
  }

  .notes-workspace .note-card.notice-card {
    grid-template-columns: minmax(0, 1fr) 64px;
    column-gap: 10px;
    padding: 12px;
  }

  .notes-workspace .note-card .note-thumb {
    width: 64px;
    height: 78px;
    max-height: 78px;
  }

  .notes-workspace .note-card .card-head strong {
    font-size: 14px;
  }

  .notes-workspace .note-inspector.panel {
    padding: 13px;
  }

  .notes-workspace .note-inspector .chips {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notes-workspace .note-inspector .chips > button {
    width: 100%;
    min-width: 0;
  }

  .notes-workspace .note-inspector .chips > .danger {
    margin-left: 0;
  }

  .notes-workspace .market-card.notice-card {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .has-note-editor .note-title-input {
    width: min(36vw, 142px);
  }

  .has-note-editor .note-active-tool-state {
    display: none;
  }

  .has-note-editor .shape-detail-tools > button span,
  .has-note-editor .pen-only-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .notes-workspace .note-card,
  .notes-workspace button,
  .has-note-editor button {
    scroll-behavior: auto;
    transition: none !important;
  }
}
