/*
 * Note interactions v2
 * Scope: module navigation, field states, transition pages, and plain-text symbol picker.
 * No API, database, workflow, or route logic changes.
 */

/* The 01—09 workflow stays in the sidebar. Cross-module navigation moves to the floating hub. */
.product-nav {
  display: none !important;
}

/* --- Floating module hub ------------------------------------------------ */
.note-module-hub {
  position: fixed;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 120;
  pointer-events: none;
}

.note-module-hub-toggle {
  width: 54px;
  height: 54px;
  border: 1px solid rgba(214, 45, 70, 0.18);
  border-radius: 50%;
  color: #fff;
  background: var(--brand-default, #d62d46);
  box-shadow: 0 10px 26px rgba(214, 45, 70, 0.24);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
}

.note-module-hub-menu {
  position: absolute;
  right: 0;
  bottom: 64px;
  display: grid;
  gap: 8px;
  justify-items: end;
  pointer-events: none;
}

.note-module-hub-action {
  min-width: 112px;
  height: 44px;
  padding: 0 13px 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-subtle, #ececec);
  border-radius: 999px;
  color: #333;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(10px) scale(0.92);
  transition: opacity 0.16s ease, transform 0.18s ease;
  pointer-events: none;
}

.note-module-hub.open .note-module-hub-action {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.note-module-hub-action .ico {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--brand-default, #d62d46);
  background: var(--brand-subtle, #fff0f3);
  font-size: 12px;
  font-weight: 700;
}

.note-module-hub-action[aria-current="page"] {
  color: var(--brand-default, #d62d46);
  border-color: rgba(214, 45, 70, 0.38);
  background: var(--brand-subtle, #fff0f3);
}

.note-module-hub button:focus-visible,
.note-module-hub a:focus-visible {
  outline: 3px solid rgba(214, 45, 70, 0.24);
  outline-offset: 2px;
}

/* --- Field states ------------------------------------------------------- */
.field {
  position: relative;
}

.ui-field-state {
  margin-left: 7px;
  padding: 2px 7px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  line-height: 16px;
  vertical-align: 1px;
}

.field.is-filled > .field-label .ui-field-state,
.field.is-filled > label .ui-field-state {
  color: #276a4c;
  background: #eef8f2;
}

.field.is-required-empty > .field-label .ui-field-state,
.field.is-required-empty > label .ui-field-state {
  color: #9a3d35;
  background: #fff0ef;
}

.field.is-not-applicable > .field-label .ui-field-state,
.field.is-not-applicable > label .ui-field-state {
  color: #777;
  background: #ededed;
}

.field.is-filled > input:not([type="checkbox"]):not([type="radio"]),
.field.is-filled > textarea,
.field.is-filled > select,
.field.is-filled .editor > textarea {
  border-color: #b9dbc7;
  background: #f6fbf8;
}

.field.is-required-empty > input:not([type="checkbox"]):not([type="radio"]),
.field.is-required-empty > textarea,
.field.is-required-empty > select,
.field.is-required-empty .editor > textarea {
  border-color: #edc9c5;
  background: #fffafa;
}

.field.is-not-applicable {
  color: #8f8f8f;
}

.field.is-not-applicable > input:not([type="checkbox"]):not([type="radio"]),
.field.is-not-applicable > textarea,
.field.is-not-applicable > select,
.field.is-not-applicable .editor > textarea {
  border-color: #e4e4e4;
  color: #999;
  background: #f5f5f5;
  cursor: not-allowed;
}

.choice-card:has(input[value="not_needed"]:checked) {
  color: #5f5f5f;
  border-color: #d7dbe0 !important;
  background: #f5f5f5 !important;
  box-shadow: inset 0 0 0 1px #d7dbe0 !important;
}

.choice-card:has(input[value="missing"]:checked) {
  color: #795720;
  border-color: #e6c46b !important;
  background: #fff8e8 !important;
  box-shadow: inset 0 0 0 1px #e6c46b !important;
}

/* --- Diagnosis-style transition page ---------------------------------- */
.transition-card-v2 {
  min-height: 440px;
  padding: 48px 24px !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.transition-spinner-v2 {
  width: 52px;
  height: 52px;
  margin-bottom: 22px;
  border: 4px solid var(--border-subtle, #ececec);
  border-top-color: var(--brand-default, #d62d46);
  border-radius: 50%;
  animation: note-v2-spin 0.9s linear infinite;
}

@keyframes note-v2-spin {
  to { transform: rotate(360deg); }
}

.transition-card-v2 h2 {
  margin: 0;
  color: var(--text-primary, #262626);
  font-size: 20px;
  font-weight: 500;
  line-height: 30px;
}

.transition-card-v2 > p {
  max-width: 560px;
  margin: 9px 0 0;
  color: #8c8c8c;
  font-size: 13px;
  line-height: 21px;
}

.transition-badge-v2 {
  margin-top: 14px;
  padding: 6px 11px;
  border-radius: 999px;
  color: var(--brand-default, #d62d46);
  background: var(--brand-subtle, #fff0f3);
  font-size: 11px;
  font-weight: 500;
}

.transition-card-v2 .loading-progress {
  width: min(320px, 100%);
  height: 6px;
  margin: 22px auto 0;
  background: var(--brand-subtle, #fff0f3);
}

.transition-card-v2 .loading-progress-bar {
  width: 40%;
  background: linear-gradient(
    90deg,
    transparent,
    var(--brand-default, #d62d46),
    transparent
  );
}

.transition-steps-v2 {
  width: min(260px, 100%);
  margin: 22px auto 0;
  padding: 0;
  display: grid;
  gap: 9px;
  color: #8c8c8c;
  font-size: 12px;
  text-align: left;
  list-style: none;
}

.transition-steps-v2 li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.transition-steps-v2 .done {
  color: #2f8f67;
}

.transition-steps-v2 .active {
  color: var(--brand-default, #d62d46);
  font-weight: 500;
}

.transition-steps-v2 .pending {
  color: #c7c7c7;
}

.transition-pulse-v2 {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--brand-default, #d62d46);
  box-shadow: 0 0 0 0 rgba(214, 45, 70, 0.35);
  animation: note-v2-pulse 1.5s ease-out infinite;
}

@keyframes note-v2-pulse {
  70% { box-shadow: 0 0 0 7px rgba(214, 45, 70, 0); }
  100% { box-shadow: 0 0 0 0 rgba(214, 45, 70, 0); }
}

/* --- Draft editor: plain text only ------------------------------------- */
.editor textarea#draft-body {
  min-height: 540px;
}

.plain-text-toolbar {
  margin: 8px 0 10px;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-subtle, #ececec);
  border-radius: 8px;
  background: var(--surface-subtle, #f5f5f5);
}

.plain-text-toolbar-label {
  margin-right: 2px;
  color: #8c8c8c;
  font-size: 11px;
}

.plain-text-tool {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-subtle, #ececec);
  border-radius: 8px;
  color: #555;
  background: #fff;
  font-size: 11px;
  font-weight: 500;
}

.plain-text-tool:hover,
.plain-text-tool.active {
  color: var(--brand-default, #d62d46);
  border-color: rgba(214, 45, 70, 0.35);
  background: var(--brand-subtle, #fff0f3);
}

.symbol-picker-v2 {
  position: fixed;
  right: 24px;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 140;
  width: min(460px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 140px));
  overflow: hidden;
  border: 1px solid var(--border-subtle, #ececec);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(38, 38, 38, 0.18);
}

.symbol-picker-v2[hidden] {
  display: none !important;
}

.symbol-picker-head-v2 {
  padding: 13px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle, #ececec);
}

.symbol-picker-head-v2 strong {
  color: var(--text-primary, #262626);
  font-size: 13px;
  font-weight: 500;
}

.symbol-picker-head-v2 span {
  display: block;
  margin-top: 2px;
  color: #8c8c8c;
  font-size: 10px;
}

.symbol-picker-close-v2 {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: #777;
  background: #f5f5f5;
  font-size: 20px;
}

.symbol-picker-tabs-v2 {
  padding: 10px 12px 0;
  display: flex;
  gap: 6px;
}

.symbol-picker-tab-v2 {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border-subtle, #ececec);
  border-radius: 8px;
  color: #777;
  background: #fff;
  font-size: 11px;
}

.symbol-picker-tab-v2.active {
  color: #fff;
  border-color: var(--brand-default, #d62d46);
  background: var(--brand-default, #d62d46);
}

.symbol-picker-body-v2 {
  max-height: 390px;
  padding: 12px;
  overflow: auto;
}

.symbol-section-v2 + .symbol-section-v2 {
  margin-top: 14px;
}

.symbol-section-v2 h4 {
  margin: 0 0 8px;
  color: #8c8c8c;
  font-size: 11px;
  font-weight: 500;
}

.symbol-grid-v2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
}

.symbol-grid-v2.kaomoji {
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
}

.symbol-item-v2 {
  min-height: 38px;
  padding: 4px 6px;
  border: 1px solid var(--border-subtle, #ececec);
  border-radius: 8px;
  color: var(--text-primary, #262626);
  background: #fff;
  font-size: 18px;
  line-height: 1.2;
}

.symbol-grid-v2.kaomoji .symbol-item-v2 {
  font-size: 12px;
  white-space: nowrap;
}

.symbol-item-v2:hover {
  border-color: rgba(214, 45, 70, 0.35);
  background: var(--brand-subtle, #fff0f3);
}

@media (max-width: 820px) {
  .note-module-hub {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .symbol-picker-v2 {
    right: 16px;
    bottom: calc(82px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) {
  .editor textarea#draft-body {
    min-height: 460px;
  }

  .symbol-picker-v2 {
    right: 8px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    width: calc(100vw - 16px);
    max-height: calc(100vh - 96px);
  }

  .symbol-picker-body-v2 {
    max-height: calc(100vh - 210px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .transition-spinner-v2,
  .transition-pulse-v2 {
    animation: none;
  }
}