:root {
  --bg: #f4f5f6;
  --panel: #ffffff;
  --ink: #1b222c;
  --muted: #677283;
  --line: #d0d5dd;
  --line-soft: #e7e9ee;
  --brand: #098842;
  --brand-deep: #087438;
  --brand-dark: #1e6b41;
  --mint: #098842;
  --mint-soft: #eaf6ef;
  --amber: #8f5514;
  --amber-soft: #fcf1e3;
  --rose: #b83a33;
  --rose-soft: #f9f1f1;
  --blue: #366cbf;
  --blue-soft: #f1f4f9;
  --neutral-70: #495365;
  --neutral-80: #2f3a4c;
  --neutral-90: #1b222c;
}

@font-face {
  font-family: "Noto Sans";
  src: url("/fonts/NotoSans-Regular-47b1593ad8faa986dd1c.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans";
  src: url("/fonts/NotoSans-Medium-183dc1733c6e701e0811.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans";
  src: url("/fonts/NotoSans-SemiBold-a38658cc126f57ba4818.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Code Pro";
  src: url("/fonts/SourceCodePro-Regular.ttf-84b900b88d09398d86b0.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--bg);
  font-family: "Noto Sans", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

.layui-btn {
  border-radius: 4px;
  font-weight: 500;
}

.layui-btn:not(.layui-btn-primary) {
  border-color: var(--brand);
  background-color: var(--brand);
}

.layui-btn:not(.layui-btn-primary):hover {
  border-color: var(--brand-deep);
  background-color: var(--brand-deep);
  color: #ffffff;
}

.layui-btn-primary {
  border-color: var(--line);
  background-color: #ffffff;
  color: var(--neutral-70);
}

.layui-btn-primary:hover {
  border-color: #b8dbc8;
  background-color: var(--mint-soft);
  color: var(--brand-dark);
}

.layui-layer-btn .layui-layer-btn0 {
  border-color: var(--brand) !important;
  background-color: var(--brand) !important;
  color: #ffffff !important;
}

.layui-layer-btn .layui-layer-btn0:hover {
  border-color: var(--brand-deep) !important;
  background-color: var(--brand-deep) !important;
  color: #ffffff !important;
}

.layer-input-dialog {
  display: grid;
  padding: 22px 22px 8px;
}

.layer-input-dialog .layui-input {
  height: 38px;
  border-color: var(--line);
  border-radius: 4px;
}

.layer-input-dialog .layui-input:focus {
  border-color: #8fc9a9;
  box-shadow: 0 0 0 2px var(--mint-soft);
}

.portal-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 28px;
  overflow: auto;
  background: var(--bg);
}

.portal-card {
  display: flex;
  flex-direction: column;
  width: min(460px, 100%);
  max-height: calc(100vh - 56px);
  max-height: calc(100dvh - 56px);
  min-height: 0;
  overflow: hidden;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(27, 34, 44, 0.08);
}

.portal-card.has-session {
  width: min(980px, 100%);
}

.portal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.portal-heading h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.28;
  font-weight: 700;
}

.user-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 24px;
}

.user-session {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  max-width: 46%;
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.user-session-label {
  flex: 0 0 auto;
  font-weight: 700;
}

.user-session strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.change-user.layui-btn {
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
  line-height: 24px;
  flex: 0 0 auto;
}

.user-name-input,
.draft-title-input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

.user-name-input:focus,
.draft-title-input:focus {
  border-color: #8fc9a9;
  box-shadow: 0 0 0 2px var(--mint-soft);
}

.draft-panel {
  min-height: 0;
}

.draft-browser {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 8px;
  height: clamp(300px, 56dvh, 520px);
  min-height: 0;
}

.project-panel,
.draft-list-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: #ffffff;
}

.project-panel-header,
.draft-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  margin-bottom: 8px;
}

.draft-list-heading {
  color: var(--neutral-80);
  font-size: 13px;
  font-weight: 700;
}

.draft-list-heading .create-draft.layui-btn {
  height: 30px;
  padding: 0 10px;
  line-height: 30px;
  flex: 0 0 auto;
}

.project-list,
.draft-list-host,
.draft-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.project-list,
.draft-list-host,
.draft-list {
  flex: 1;
}

.draft-list-host {
  display: flex;
  overflow: hidden;
  padding-right: 0;
}

.draft-list {
  width: 100%;
}

.project-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: #ffffff;
  cursor: pointer;
}

.project-row:hover,
.project-row.active {
  border-color: #b8dbc8;
  background: var(--mint-soft);
}

.project-btn {
  min-width: 0;
  width: 100%;
  min-height: 26px;
  display: flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.project-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-row-actions {
  display: inline-flex;
  gap: 2px;
}

.draft-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: #ffffff;
  cursor: pointer;
}

.draft-card:hover {
  border-color: #b8dbc8;
  background: var(--mint-soft);
}

.draft-list.is-opening-draft .draft-card,
.draft-list.is-opening-draft .draft-open,
.draft-list.is-opening-draft .draft-card-actions {
  pointer-events: none;
}

.draft-open {
  display: grid;
  gap: 4px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.draft-card-title {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-card-meta,
.draft-card-preview,
.save-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.draft-card-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.layui-layer.draft-open-layer-shell {
  overflow: hidden;
  border-radius: 6px;
  background: transparent;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
}

.layui-layer.draft-open-layer-shell .layui-layer-content {
  overflow: visible;
  background: transparent;
}

.draft-open-layer {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 172px;
  padding: 18px 22px;
  border: 1px solid #cfe6db;
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.draft-open-layer-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #cfe6db;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: draft-open-layer-spin 0.75s linear infinite;
}

@keyframes draft-open-layer-spin {
  to {
    transform: rotate(360deg);
  }
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.section-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.brand-block {
  display: block;
  align-items: center;
  padding: 4px 4px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.brand-block h1 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
}

.back-to-drafts.layui-btn {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  justify-items: start;
  gap: 6px;
  width: 100%;
  height: 32px;
  margin-top: 12px;
  padding: 0 10px;
  line-height: 32px;
  text-align: left;
}

.draft-title-line {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.2;
  font-weight: 700;
}

.draft-title-line .icon-button.icon-button-mini.rename-active-draft {
  width: 28px;
  height: 28px;
  color: var(--muted);
  font-size: 20px;
  flex: 0 0 auto;
}

.draft-title-line .icon-button.icon-button-mini.rename-active-draft .layui-icon {
  font-size: 20px;
}

.save-status::before {
  content: " / ";
}

.section-buttons {
  display: grid;
  gap: 6px;
}

.section-row {
  position: relative;
  display: block;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
}

.section-btn.layui-btn {
  display: grid;
  align-items: center;
  justify-items: start;
  width: 100%;
  height: 36px;
  margin: 0;
  padding: 0 56px 0 10px;
  border: 0;
  border-radius: 4px;
  color: var(--neutral-70);
  background: transparent;
  line-height: 36px;
  text-align: left;
}

.section-row:hover,
.section-row.active {
  border-color: #b8dbc8;
  color: var(--brand-dark);
  background: var(--mint-soft);
}

.section-row:hover .section-btn,
.section-row.active .section-btn {
  color: var(--brand-dark);
  background: transparent;
}

.section-row-actions {
  position: absolute;
  right: 5px;
  top: 50%;
  display: inline-flex;
  gap: 3px;
  transform: translateY(-50%);
}

.icon-button-mini {
  width: 22px;
  height: 22px;
  border-color: transparent;
  background: transparent;
  font-size: 12px;
}

.icon-button-mini .layui-icon {
  font-size: 12px;
}

.section-row-actions .icon-button-mini .layui-icon {
  font-size: 15px;
}

.section-row .icon-button-mini {
  opacity: 0.58;
}

.section-row:hover .icon-button-mini,
.section-row:focus-within .icon-button-mini,
.section-row.active .icon-button-mini {
  opacity: 1;
}

.section-create.layui-btn {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  justify-items: start;
  width: 100%;
  height: 36px;
  margin: 6px 0 0;
  padding: 0 10px;
  border-color: #b8dbc8;
  background: var(--mint-soft);
  color: var(--brand-dark);
  line-height: 36px;
  text-align: left;
}

.section-create.layui-btn:hover {
  border-color: var(--brand);
  background: #dff1e7;
  color: var(--brand-dark);
}

.section-loading,
.section-empty {
  min-height: 40px;
  font-size: 12px;
}

.workspace {
  display: flex;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  flex-direction: column;
  padding: 18px 20px;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

#sectionTitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 700;
}

.panel-host {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.section-panel {
  display: flex;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.section-panel[hidden] {
  display: none;
}

.section-panel > .area {
  flex: 1;
  min-width: 0;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(210px, 24%) minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.candidate-panel-host {
  min-height: 0;
  overflow: hidden;
}

.area {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: none;
}

.area-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.area-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.area-title-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.generated-style-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.generated-style-button {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: #ffffff;
  cursor: pointer;
}

.generated-style-button:hover,
.generated-style-button.active {
  color: var(--brand-dark);
  border-color: #b8dbc8;
  background: var(--mint-soft);
}

.shirt-icon {
  position: relative;
  width: 13px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-top: 0;
  border-radius: 1px 1px 2px 2px;
}

.shirt-icon::before,
.shirt-icon::after {
  position: absolute;
  top: -3px;
  width: 5px;
  height: 6px;
  border: 1.5px solid currentColor;
  content: "";
}

.shirt-icon::before {
  left: -5px;
  border-right: 0;
  border-radius: 2px 0 0 1px;
  transform: skewY(-18deg);
}

.shirt-icon::after {
  right: -5px;
  border-left: 0;
  border-radius: 0 2px 1px 0;
  transform: skewY(18deg);
}

.generated-style-button[data-style="underline"] .shirt-icon {
  box-shadow: inset 0 -3px 0 currentColor;
}

.word-count-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.word-count-label {
  line-height: 22px;
}

.area-count {
  min-width: 30px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  color: var(--brand-dark);
  background: var(--mint-soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

.area-action.layui-btn {
  height: 28px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--brand);
  border-radius: 4px;
  background: var(--brand);
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  line-height: 28px;
}

.area-action.layui-btn:hover {
  border-color: var(--brand-deep);
  background: var(--brand-deep);
  color: #ffffff;
}

.candidate-search-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  background: #ffffff;
}

.candidate-search-button.layui-btn {
  height: 28px;
  margin: 0;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--neutral-70);
  font-size: 12px;
  line-height: 28px;
}

.candidate-search-button.layui-btn:hover {
  border-color: #b8dbc8;
  background: var(--mint-soft);
  color: var(--brand-dark);
}

.candidate-search-input {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: #ffffff;
  font-size: 12px;
  outline: none;
}

.candidate-search-input:focus {
  border-color: #86caa5;
  box-shadow: 0 0 0 2px var(--mint-soft);
}

.candidate-list {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 8px;
  flex: 1;
  height: auto;
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.generated-list {
  display: block;
  flex: 1;
  height: auto;
  min-height: 0;
  overflow: auto;
  padding: 12px;
  font-size: 13px;
  line-height: 1.63;
  font-family: "Source Code Pro", "Noto Sans", monospace;
  caret-color: #000000;
  cursor: text;
  contain: layout paint style;
}

.generated-list.is-empty {
  display: flex;
  align-items: flex-start;
}

.generated-empty-caret {
  width: 2px;
  height: 1.5em;
  margin-top: 4px;
  background: #000000;
  animation: caret-blink 1s steps(1, end) infinite;
}

.generated-empty-caret:focus {
  outline: none;
}

@keyframes caret-blink {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

.is-window-resizing .generated-list {
  content-visibility: hidden;
  contain-intrinsic-size: 0 520px;
  pointer-events: none;
  visibility: hidden;
}

.is-window-resizing .generated-actions {
  display: none;
}

.is-window-resizing .generated-list * {
  animation: none !important;
  transition: none !important;
}

@supports not (content-visibility: hidden) {
  .is-window-resizing .generated-list {
    display: none;
  }
}

.candidate-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px 30px;
  gap: 8px;
  align-items: start;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 52px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}

.candidate-select {
  display: block;
  align-self: stretch;
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  line-height: normal;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}

.candidate-card:hover,
.candidate-card:focus-within {
  border-color: #86caa5;
  box-shadow: inset 0 0 0 1px #86caa5;
  outline: none;
}

.candidate-copy {
  display: block;
  min-width: 0;
}

.candidate-title {
  display: block;
  margin-bottom: 4px;
  font-size: var(--candidate-title-font-size, 14px);
  line-height: var(--candidate-title-line-height, 1.38);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.candidate-card-long .candidate-title {
  line-height: var(--candidate-title-line-height, 1.5);
}

.candidate-card-xlong {
  padding: 11px 12px;
}

.candidate-card-xlong .candidate-title {
  line-height: var(--candidate-title-line-height, 1.62);
}

.edit-candidate {
  color: var(--brand);
}

.edit-candidate:hover {
  color: var(--brand-deep);
  border-color: #b8dbc8;
  background: var(--mint-soft);
}

.remove-candidate {
  color: var(--muted);
}

.remove-candidate:hover {
  color: var(--rose);
  border-color: #fecdd3;
  background: var(--rose-soft);
}

.generated-card {
  position: relative;
  display: inline;
  margin-right: 14px;
}

.generated-card.manual-card {
  margin-right: 0.5ch;
}

.generated-card:has(+ .manual-card) {
  margin-right: 0.5ch;
}

.generated-card.empty-manual-card {
  display: inline;
  margin-right: 0.5ch;
  z-index: 2;
}

.generated-card.empty-manual-card .sentence-shell {
  display: inline;
  padding: 0;
  border-radius: 3px;
  background: transparent;
  box-shadow: none;
}

.generated-card.empty-manual-card .sentence-shell::before {
  content: "\00a0";
  visibility: hidden;
}

.generated-card.manual-card .sentence-shell {
  border-radius: 3px;
  background: transparent;
  box-shadow: none;
}

.generated-card.manual-card:hover .sentence-shell,
.generated-card.manual-card .sentence-shell:focus,
.generated-card.manual-card .sentence-shell.is-pattern-hover {
  background: var(--blue-soft);
  box-shadow: 0 0 0 2px #c3d0e3;
}

.generated-card.manual-card:not(.empty-manual-card) .sentence-shell {
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.generated-actions {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 3000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 8px));
  transition: opacity 0.12s ease, visibility 0.12s ease;
}

.generated-actions.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.generated-actions.is-below {
  transform: translate(-50%, 8px);
}

.generated-actions .icon-button {
  pointer-events: auto;
}

.generated-actions.is-delete-only .reroll-generated {
  display: none;
}

.generated-caret {
  position: fixed;
  z-index: 4000;
  display: none;
  width: 2px;
  background: #000000;
  pointer-events: none;
  animation: caret-blink 1s steps(1, end) infinite;
}

.generated-caret.is-visible {
  display: block;
}

.generated-caret-marker {
  display: inline-block;
  width: 0;
  min-height: 1.35em;
  line-height: inherit;
  overflow: hidden;
}

.icon-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: #ffffff;
  cursor: pointer;
}

.icon-button.icon-button-mini {
  width: 22px;
  height: 22px;
  border-color: transparent;
  background: transparent;
  font-size: 12px;
}

.icon-button.icon-button-mini .layui-icon {
  font-size: 12px;
}

.icon-button:hover {
  color: var(--brand);
  border-color: #b8dbc8;
  background: var(--mint-soft);
}

.remove-generated:hover {
  color: var(--rose);
  border-color: #fecdd3;
  background: var(--rose-soft);
}

.sentence-shell {
  display: inline;
  color: var(--neutral-90);
  line-height: 1.66;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: text;
  caret-color: transparent;
}

.sentence-editor {
  min-width: 1ch;
  outline: none;
}

.sentence-editor:focus {
  background: transparent;
  box-shadow: none;
}

.sentence-shell.is-pattern-hover {
  border-radius: 3px;
  background: var(--blue-soft);
  box-shadow: 0 0 0 2px #c3d0e3;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.generated-style-bubble .generated-card:not(.manual-card):hover:not(:has(.term-token:hover)) .sentence-shell {
  border-radius: 3px;
  background: var(--blue-soft);
  box-shadow: 0 0 0 2px #c3d0e3;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.sentence-token {
  display: inline;
  border-radius: 3px;
  cursor: text;
  transition: background 0.12s ease, box-shadow 0.12s ease, color 0.12s ease;
}

.sentence-token:hover,
.sentence-token:focus-visible {
  outline: none;
}

.sentence-token.text-token:hover,
.sentence-token.text-token:focus-visible {
  background: transparent;
  box-shadow: none;
}

.term-token {
  color: var(--brand-dark);
  padding: 0 2px;
  border-radius: 3px;
  background: transparent;
  box-shadow: none;
  caret-color: transparent;
  font-weight: 700;
  white-space: normal;
}

.term-token strong {
  caret-color: transparent;
  font-weight: 700;
}

.term-token:hover,
.term-token:focus-visible,
.term-token.is-token-selected {
  color: var(--brand-dark);
  background: var(--mint-soft);
  box-shadow: 0 0 0 2px #b8dbc8;
}

.generated-style-underline .sentence-shell.is-pattern-hover {
  border-radius: 0;
  background: transparent;
  box-shadow: inset 0 -2px 0 #c3d0e3;
}

.generated-style-underline .sentence-shell.is-pattern-hover:has(.term-token:hover),
.generated-style-underline .sentence-shell.is-pattern-hover:has(.term-token.is-token-selected) {
  box-shadow: none;
}

.generated-style-underline .generated-card:not(.manual-card):hover:not(:has(.term-token:hover)):not(:has(.term-token.is-token-selected)) .sentence-shell {
  border-radius: 0;
  background: transparent;
  box-shadow: inset 0 -2px 0 #c3d0e3;
}

.generated-style-underline .generated-card.manual-card:hover .sentence-shell,
.generated-style-underline .generated-card.manual-card .sentence-shell:focus,
.generated-style-underline .generated-card.manual-card .sentence-shell.is-pattern-hover {
  border-radius: 0;
  background: transparent;
  box-shadow: inset 0 -2px 0 #c3d0e3;
}

.generated-list:has(.generated-card:hover) .sentence-shell.is-auto-focus-highlight:not(:hover) {
  background: transparent;
  box-shadow: none;
}

.generated-style-underline .term-token {
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.generated-style-underline .term-token:hover,
.generated-style-underline .term-token:focus-visible {
  border-radius: 3px;
  color: var(--brand-dark);
  background: var(--mint-soft);
  box-shadow: 0 0 0 2px #b8dbc8;
}

.generated-style-underline .term-token.is-token-selected {
  border-radius: 3px;
  color: var(--brand-dark);
  background: var(--mint-soft);
  box-shadow: 0 0 0 2px #b8dbc8;
}

.bottom-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: none;
}

.copy-textarea {
  position: fixed;
  left: -9999px;
  top: -9999px;
}

.empty-state,
.loading-state,
.error-state {
  display: grid;
  min-height: 120px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: #ffffff;
  font-size: 13px;
}

.error-state {
  color: var(--rose);
  background: var(--rose-soft);
  border-color: #fecdd3;
}

.choice-wrap {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.choice-btn {
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
  cursor: pointer;
}

.choice-btn:hover,
.choice-btn.active {
  border-color: #86caa5;
  background: var(--mint-soft);
}

.choice-id {
  display: block;
  margin-bottom: 4px;
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 700;
}

.choice-preview {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.rule-editor {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 16px;
  background: var(--bg);
}

.rule-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 42%);
  gap: 12px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.rule-editor-left,
.rule-editor-right {
  display: grid;
  align-content: start;
  gap: 12px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.rule-editor-left {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 10px;
  padding-right: 2px;
}

.rule-editor-right {
  grid-template-rows: auto minmax(0, 1fr);
  padding-right: 2px;
}

.rule-editor-rules {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
}

.rule-editor-rules .editor-pattern-list {
  overflow: auto;
  padding-right: 2px;
  gap: 8px;
  align-content: start;
}

.rule-editor-terms {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
}

.rule-editor-terms .editor-term-list {
  overflow: auto;
  padding-right: 2px;
}

.rule-editor-layer {
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

.rule-editor-layer .layui-layer-content {
  background: var(--bg);
  overflow: hidden !important;
}

.rule-editor-layer .layui-layer-title {
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
}

.editor-field {
  display: grid;
  gap: 8px;
}

.editor-field label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.editor-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.editor-inline-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.editor-list {
  display: grid;
  gap: 10px;
}

.editor-row {
  display: grid;
  gap: 10px;
  align-items: start;
}

.pattern-row {
  grid-template-columns: minmax(0, 1fr) 32px;
}

.term-row {
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr) 32px;
}

.rule-editor .layui-input,
.rule-editor .layui-textarea,
.rule-editor .layui-select {
  border-color: var(--line);
  border-radius: 4px;
  background: #ffffff;
}

.rule-editor .layui-input:focus,
.rule-editor .layui-textarea:focus,
.rule-editor .layui-select:focus {
  border-color: #86caa5 !important;
  box-shadow: 0 0 0 2px var(--mint-soft);
}

.rule-editor .layui-textarea {
  min-height: 62px;
  resize: vertical;
}

.editor-panel-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .section-rail {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 14px;
  }

  .brand-block {
    padding-bottom: 12px;
  }

  .section-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    padding: 16px;
  }

  .section-panel {
    height: 100%;
    min-height: 0;
  }

  .main-grid {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  }

  .candidate-panel-host {
    min-height: 0;
  }

  .candidate-list,
  .generated-list {
    max-height: none;
  }

  .term-row {
    grid-template-columns: 1fr;
  }

  .rule-editor {
    overflow: hidden;
  }

  .rule-editor-layout {
    grid-template-columns: 1fr;
  }

  .rule-editor-left,
  .rule-editor-right,
  .rule-editor-rules,
  .rule-editor-terms {
    overflow: hidden;
  }

  .rule-editor-rules .editor-pattern-list,
  .rule-editor-terms .editor-term-list {
    max-height: 48vh;
  }
}

@media (max-width: 520px) {
  .section-buttons {
    grid-template-columns: 1fr;
  }

  .draft-browser {
    grid-template-columns: 1fr;
    height: min(520px, 60dvh);
  }

  .draft-title-line {
    font-size: 22px;
  }

  .area-header {
    min-height: 50px;
    padding: 12px;
  }

  .candidate-list,
  .generated-list {
    padding: 10px;
  }

  .bottom-bar {
    justify-content: stretch;
  }

  .bottom-bar .layui-btn {
    width: 100%;
  }

  .workspace-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .editor-field-head {
    align-items: stretch;
    flex-direction: column;
  }

  .editor-inline-actions {
    justify-content: stretch;
  }

  .pattern-row {
    grid-template-columns: 1fr;
  }
}
