:root {
  --bg: #f4f6f5;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --text: #202624;
  --muted: #68736f;
  --line: #d8dfdc;
  --brand: #226c5f;
  --brand-dark: #174b43;
  --accent: #9a5f28;
  --warn: #a7412f;
  --ok: #2f7a4f;
  --shadow: 0 10px 30px rgba(37, 35, 31, 0.08);
  --shadow-soft: 0 8px 20px rgba(37, 35, 31, 0.06);
  --motion: 180ms ease;
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

html {
  scroll-behavior: smooth;
}

::selection {
  background: rgba(34, 108, 95, 0.18);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
.button-secondary {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 40px;
  padding: 0 14px;
  transition: background var(--motion), border-color var(--motion), box-shadow var(--motion), color var(--motion), transform var(--motion);
}

button:hover,
.button-secondary:hover {
  background: var(--brand-dark);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

button:active,
.button-secondary:active {
  box-shadow: none;
  transform: translateY(0) scale(0.985);
}

.button-secondary {
  align-items: center;
  display: inline-flex;
  height: 40px;
}

.ghost-button {
  background: #f7fbf9;
  border: 1px solid rgba(34, 108, 95, 0.26);
  color: var(--brand-dark);
}

.ghost-button:hover {
  background: #eaf4ef;
  border-color: rgba(34, 108, 95, 0.45);
  color: var(--brand-dark);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  min-height: 40px;
  padding: 8px 10px;
  transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus,
a:focus {
  outline: 2px solid rgba(34, 108, 95, 0.25);
  outline-offset: 2px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(34, 108, 95, 0.55);
  box-shadow: 0 0 0 3px rgba(34, 108, 95, 0.08);
}

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
}

.sidebar {
  background: #25231f;
  color: #f8f4ec;
  display: flex;
  flex-direction: column;
  height: 100vh;
  left: 0;
  padding: 22px 18px;
  position: fixed;
  top: 0;
  width: 236px;
  overflow: hidden;
}

.brand {
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  display: grid;
  gap: 4px;
  padding-bottom: 20px;
}

.brand strong {
  font-size: 20px;
}

.brand span,
.user-box small {
  color: #c7c0b4;
  font-size: 12px;
}

.sidebar nav {
  flex: 1;
  display: grid;
  gap: 8px;
  margin-top: 22px;
  min-height: 0;
  overflow-y: auto;
  padding: 0 4px 12px 0;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
  scrollbar-width: thin;
}

.sidebar nav a {
  border-radius: 6px;
  color: #f8f4ec;
  padding: 10px 12px;
  transition: background var(--motion), color var(--motion), transform var(--motion);
}

.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(2px);
}

.sidebar nav a.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 900;
  box-shadow: inset 3px 0 0 #f3c98b;
}

.user-box {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding-top: 18px;
  flex-shrink: 0;
}

.user-box a {
  color: #f3c98b;
  margin-top: 8px;
}

.app-main {
  margin-left: 236px;
  min-height: 100vh;
  padding: 28px;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(216, 223, 220, 0.85);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 12px;
  position: sticky;
  top: 12px;
  z-index: 15;
}

.topbar div {
  display: grid;
  gap: 2px;
}

.topbar span {
  color: var(--muted);
  font-size: 12px;
}

.logout-button {
  min-height: 36px;
}

.watermark {
  bottom: 14px;
  color: rgba(37, 35, 31, 0.22);
  font-size: 12px;
  pointer-events: none;
  position: fixed;
  right: 18px;
  z-index: 20;
}

.login-shell {
  align-items: center;
  display: flex;
  min-height: 100vh;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  max-width: 420px;
  padding: 30px;
  width: 100%;
}

.login-card h1,
.hero-panel h1,
.section-head h1,
.detail-panel h1 {
  font-size: 28px;
  line-height: 1.2;
  margin: 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.alert {
  background: #fff1ed;
  border: 1px solid #efc2b4;
  border-radius: 6px;
  color: var(--warn);
  padding: 10px 12px;
}

.danger-zone {
  align-items: center;
  background: #fff1ed;
  border-color: #efc2b4;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.danger-zone h2 {
  color: var(--warn);
}

.success-alert {
  background: #e8f4eb;
  border-color: #c5dfcd;
  color: var(--ok);
}

.hero-panel,
.toolbar-panel,
.detail-panel,
.section-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  padding: 22px;
}

.hero-panel {
  align-items: end;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
}

.workspace-hero {
  align-items: center;
  background: #f7f3eb;
  border: 1px solid #dfd3c2;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(240px, 0.75fr) minmax(420px, 1.5fr);
  margin-bottom: 16px;
  padding: 22px;
}

.workspace-hero-title h1 {
  font-size: 28px;
  line-height: 1.2;
  margin: 0;
}

.workspace-hero-title p {
  color: var(--muted);
  margin: 8px 0 0;
}

.workspace-search .search-row {
  grid-template-columns: 1fr auto auto;
}

.workspace-search input {
  min-height: 54px;
  font-size: 16px;
}

.workspace-metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.workspace-main {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  margin-bottom: 18px;
}

.prototype-rail,
.prototype-focus {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.prototype-rail {
  position: sticky;
  top: 86px;
}

.proto-rail-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 210px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-color: rgba(34, 108, 95, 0.3) transparent;
  scrollbar-width: thin;
}

.workspace-proto-card {
  background: #fffdf8;
  border: 1px solid #e3d9ca;
  border-radius: var(--radius);
  display: grid;
  gap: 7px;
  padding: 13px;
  transition: background var(--motion), border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.workspace-proto-card:hover,
.workspace-proto-card.active {
  background: #f4fbf7;
  border-color: rgba(34, 108, 95, 0.45);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.workspace-proto-card span {
  color: var(--muted);
}

.mini-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-stat-row em {
  background: #edf6f2;
  border: 1px solid #cfe4da;
  border-radius: 999px;
  color: var(--brand-dark);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  padding: 3px 7px;
}

.mini-stat-row em.hit-rate {
  background: #fff1de;
  border-color: #efd5b2;
  color: var(--accent);
}

.mini-stat-row em.qualified-rate {
  background: #e8f4ee;
  border-color: #c5dfd3;
  color: var(--brand-dark);
}

.prototype-focus-head {
  align-items: start;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.prototype-focus-head h2 {
  font-size: 26px;
  line-height: 1.2;
  margin: 0;
}

.compact-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.prototype-notes {
  background: #f7fbf8;
  border: 1px dashed rgba(34, 108, 95, 0.38);
  border-radius: var(--radius);
  display: grid;
  gap: 4px;
  margin: 12px 0 14px;
  padding: 14px;
}

.prototype-notes p {
  margin: 0;
}

.workspace-case-table td:first-child {
  min-width: 360px;
  white-space: normal;
}

.workspace-support {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr 1fr;
}

.compact-title-list {
  display: grid;
  gap: 8px;
}

.compact-title-link {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 8px 0;
  transition: color var(--motion), transform var(--motion);
}

.compact-title-link:hover {
  color: var(--brand-dark);
  transform: translateX(2px);
}

.compact-title-link span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-title-link strong {
  color: var(--brand-dark);
  flex: 0 0 auto;
}

.risk-link strong {
  color: var(--warn);
}

.action-chip {
  transition: background var(--motion), border-color var(--motion), transform var(--motion);
}

.action-chip:hover {
  background: #eaf4ef;
  border-color: rgba(34, 108, 95, 0.45);
  transform: translateY(-1px);
}

.workbench-page {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 1120px;
}

.workbench-titlebar {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.workbench-titlebar h1 {
  font-size: 24px;
  line-height: 1.15;
  margin: 0;
}

.workbench-titlebar p {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 0;
}

.workbench-command {
  align-items: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(420px, 1fr) auto auto auto;
  padding: 10px 14px 8px;
}

.workbench-command label {
  color: var(--text);
  font-size: 13px;
}

.workbench-command input {
  min-height: 40px;
}

.workbench-step-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  grid-column: 1 / -1;
}

.step-chip {
  background: #f3f5f3;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
}

.step-chip.active {
  background: #e8f4ee;
  border-color: #c5dfd3;
  color: var(--brand-dark);
}

.workbench-columns {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(290px, 340px) minmax(520px, 1fr) minmax(330px, 420px);
  height: calc(100vh - 220px);
  min-height: 560px;
  overflow: hidden;
}

.home-workbench .workbench-columns {
  height: calc(100vh - 136px);
}

.library-page .workbench-columns {
  height: calc(100vh - 128px);
}

.prototype-workbench {
  min-width: 1480px;
}

.prototype-workbench .workbench-columns {
  grid-template-columns: minmax(540px, 680px) minmax(430px, 1fr) minmax(300px, 380px);
}

.search-workbench {
  min-width: 1480px;
}

.search-workbench .workbench-columns {
  grid-template-columns: minmax(260px, 320px) minmax(760px, 1fr) minmax(300px, 380px);
}

.word-detail-workbench {
  min-width: 1480px;
}

.word-detail-workbench .workbench-columns {
  grid-template-columns: minmax(270px, 340px) minmax(780px, 1fr) minmax(300px, 380px);
}

.search-title-split {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.search-title-column {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.search-title-split .workbench-title-card {
  grid-template-columns: 1fr;
}

.search-title-split .title-card-actions {
  align-items: center;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  justify-items: start;
}

.search-title-split .title-card-actions .text-link {
  grid-column: 1 / -1;
}

.prototype-map-split {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.prototype-map-split section {
  min-width: 0;
}

.map-subhead {
  align-items: baseline;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.map-subhead strong {
  color: var(--brand-dark);
  font-size: 14px;
}

.map-subhead span {
  color: var(--muted);
  font-size: 11px;
}

.prototype-map-split .workbench-prototype-card {
  padding: 8px;
}

.prototype-map-split .workbench-prototype-card strong {
  font-size: 14px;
  line-height: 1.25;
}

.prototype-map-split .workbench-prototype-card span {
  font-size: 12px;
}

.prototype-map-split .mini-stat-row {
  gap: 4px;
}

.prototype-map-split .mini-stat-row em {
  font-size: 10px;
  padding: 2px 5px;
}

.workbench-column {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  transition: border-color var(--motion), box-shadow var(--motion);
}

.workbench-column:focus-within {
  border-color: rgba(34, 108, 95, 0.34);
  box-shadow: 0 12px 34px rgba(37, 35, 31, 0.1);
}

.column-head {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-shrink: 0;
  gap: 12px;
  justify-content: space-between;
  padding: 13px 16px 10px;
}

.column-head h2 {
  font-size: 16px;
  line-height: 1.3;
  margin: 0;
}

.column-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 13px 16px 16px;
  scroll-behavior: smooth;
  scrollbar-color: rgba(34, 108, 95, 0.3) transparent;
  scrollbar-width: thin;
}

.keyword-box,
.side-tool,
.workbench-prototype-summary,
.workbench-title-card {
  background: #fffdf8;
  border: 1px solid #e3d9ca;
  border-radius: var(--radius);
}

.keyword-box {
  display: grid;
  gap: 9px;
  margin-bottom: 14px;
  padding: 12px;
}

.keyword-box-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.keyword-box-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.keyword-box strong,
.side-tool h3,
.workbench-left h3,
.compact-title h3 {
  margin: 0;
}

.keyword-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.keyword-chip {
  background: #fff1de;
  border-color: #efd5b2;
  color: var(--accent);
  gap: 5px;
  padding: 4px 7px;
}

.keyword-chip b {
  font-size: 12px;
}

.keyword-chip small {
  color: inherit;
  font-size: 10px;
  opacity: 0.75;
}

.keyword-chip.type-location,
.keyword-chip.type-category {
  background: #e8f4ee;
  border-color: #c5dfd3;
  color: var(--brand-dark);
}

.keyword-chip.type-emotion,
.keyword-chip.type-scene,
.keyword-chip.type-word {
  background: #eef1fb;
  border-color: #d3daf0;
  color: #394d7a;
}

.keyword-chip.type-time,
.keyword-chip.type-discount {
  background: #fff1de;
  border-color: #efd5b2;
  color: var(--accent);
}

.keyword-chip.type-risk {
  background: #fbe8e2;
  border-color: #efc8bd;
  color: var(--warn);
}

.keyword-match-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}

.workbench-prototype-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.workbench-prototype-card {
  background: #fffdf8;
  border: 1px solid #e3d9ca;
  border-radius: var(--radius);
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  transition: background var(--motion), border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.workbench-prototype-card:hover,
.workbench-prototype-card.active {
  background: #e8f4ee;
  border-color: rgba(34, 108, 95, 0.7);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.workbench-prototype-card span {
  color: var(--muted);
}

.match-reason-row {
  align-items: center;
  background: #f6fbf8;
  border: 1px dashed #c9ded4;
  border-radius: 6px;
  display: grid;
  gap: 2px;
  padding: 6px 8px;
}

.match-reason-row strong {
  color: var(--brand-dark);
  font-size: 11px;
}

.match-reason-row span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.match-reason-row.muted-match {
  background: #f8f5ee;
  border-color: var(--line);
}

.workbench-prototype-summary {
  background: #e8f4ee;
  border-color: #bad8ca;
  display: grid;
  gap: 9px;
  margin-bottom: 14px;
  padding: 14px;
}

.workbench-prototype-summary h2 {
  color: var(--brand-dark);
  font-size: 22px;
  line-height: 1.2;
  margin: 0;
}

.summary-grid {
  display: grid;
  gap: 6px;
}

.summary-grid p {
  font-size: 13px;
  margin: 0;
}

.compact-title {
  margin-bottom: 10px;
}

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

.workbench-title-card {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px 14px;
  transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.workbench-title-card:hover {
  border-color: rgba(34, 108, 95, 0.35);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.title-card-main h3 {
  font-size: 16px;
  line-height: 1.35;
  margin: 0 0 8px;
}

.title-card-main p,
.title-card-main small,
.side-tool p,
.review-tool small,
.workbench-favorite-item span {
  color: var(--muted);
}

.title-card-main p {
  font-size: 12px;
  margin: 0 0 3px;
}

.title-card-main small {
  font-size: 11px;
}

.title-card-actions {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: auto auto auto;
  justify-items: end;
}

.title-card-actions .text-link {
  grid-column: 1 / -1;
}

.title-card-actions button,
.workbench-favorite-form button {
  min-height: 34px;
}

.title-card-actions .copy-button {
  margin-top: 0;
}

.side-tool {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.side-tool:hover {
  border-color: rgba(34, 108, 95, 0.26);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.word-focus-card {
  background: #e8f4ee;
  border: 1px solid #bad8ca;
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
}

.word-focus-card h2 {
  color: var(--brand-dark);
  font-size: 28px;
  line-height: 1.1;
  margin: 0;
}

.word-focus-card p {
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}

.word-detail-workbench .action-panel {
  background: #fffdf8;
  box-shadow: none;
  margin: 0 0 12px;
  padding: 12px;
}

.word-detail-workbench .action-panel h2 {
  font-size: 15px;
}

.word-detail-workbench .favorite-form {
  align-items: stretch;
  grid-template-columns: 1fr;
}

.word-detail-workbench .favorite-form input,
.word-detail-workbench .favorite-form select {
  min-height: 34px;
}

.side-tool textarea {
  min-height: 116px;
}

.word-quick-list,
.workbench-favorites {
  display: grid;
  gap: 9px;
}

.word-tool .word-quick-list {
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-color: rgba(34, 108, 95, 0.3) transparent;
  scrollbar-width: thin;
}

.favorite-tool .workbench-favorites {
  max-height: 210px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-color: rgba(34, 108, 95, 0.3) transparent;
  scrollbar-width: thin;
}

.word-quick-group {
  display: grid;
  gap: 7px;
}

.word-group-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.word-group-head > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.word-chip-bucket {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.word-quick-chip {
  background: #e8f4ee;
  border: 1px solid #c5dfd3;
  border-radius: 999px;
  color: var(--brand-dark);
  font-size: 11px;
  min-height: 26px;
  padding: 0 10px;
}

.word-quick-chip.is-hidden {
  display: none;
}

.word-refresh-button {
  background: #f7fbf9;
  border: 1px solid rgba(34, 108, 95, 0.22);
  border-radius: 999px;
  color: var(--brand-dark);
  font-size: 11px;
  min-height: 26px;
  padding: 0 10px;
}

.word-quick-chip.risk-word {
  background: #fbe8e2;
  border-color: #efc8bd;
  color: var(--warn);
}

.review-line {
  align-items: center;
  background: #fff;
  border: 1px solid #dbe7e0;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
}

.review-line span {
  color: var(--muted);
}

.review-line strong {
  color: var(--brand-dark);
  font-size: 12px;
}

.review-line strong.warn {
  color: var(--warn);
}

.workbench-favorite-item {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 2px;
  padding: 7px 0;
  transition: color var(--motion), transform var(--motion);
}

.workbench-favorite-item:hover {
  color: var(--brand-dark);
  transform: translateX(2px);
}

.text-link {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}

.text-link:hover {
  text-decoration: underline;
}

.hero-panel p {
  color: var(--muted);
  margin: 10px 0 0;
  max-width: 680px;
}

.hero-search {
  display: grid;
  gap: 8px;
}

.search-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.entry-grid,
.dashboard-grid,
.proto-grid,
.word-grid {
  display: grid;
  gap: 14px;
}

.entry-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.entry-card,
.metric-card,
.proto-card,
.word-card,
.title-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  padding: 16px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.entry-card:hover,
.proto-card:hover,
.word-card:hover,
.title-card:hover {
  border-color: rgba(34, 108, 95, 0.45);
  transform: translateY(-1px);
}

.entry-card h2,
.proto-card h3,
.title-card h3,
.section-block h2,
.detail-panel h2 {
  margin: 0;
}

.entry-card p,
.proto-card p,
.muted {
  color: var(--muted);
  margin: 0;
}

.filter-grid {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: 2fr repeat(4, minmax(150px, 1fr)) auto;
}

.compact-filter {
  grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
}

.stacked-filter {
  display: grid;
  gap: 10px;
}

.stacked-filter label {
  color: var(--text);
  font-size: 12px;
}

.stacked-filter input,
.stacked-filter select {
  min-height: 38px;
}

.mini-metric {
  align-items: baseline;
  background: #f8f5ee;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
}

.mini-metric strong {
  color: var(--brand-dark);
  font-size: 24px;
  line-height: 1;
}

.mini-metric span {
  color: var(--muted);
  font-size: 12px;
}

.vertical-actions {
  align-items: stretch;
  display: grid;
  gap: 8px;
}

.vertical-actions a,
.vertical-actions button {
  justify-content: center;
  width: 100%;
}

.mini-row-list {
  display: grid;
}

.representative-case-row {
  align-items: stretch;
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr);
}

.mini-row-main {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.mini-row-main span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-row-main b {
  color: var(--brand-dark);
  font-size: 12px;
}

.mini-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-favorite-form {
  margin: 0;
}

.mini-action-button {
  border-radius: 999px;
  font-size: 11px;
  min-height: 26px;
  padding: 0 9px;
}

.duplicate-check-line {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 6px;
  min-height: 18px;
}

.duplicate-check-line.ok {
  color: var(--ok);
}

.duplicate-check-line.warn {
  color: var(--warn);
  font-weight: 800;
}

.duplicate-check-line a {
  color: var(--warn);
  text-decoration: underline;
}

.result-head,
.section-head,
.section-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0 0 14px;
}

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

.feedback-list {
  display: grid;
  gap: 12px;
}

.feedback-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  padding: 16px;
}

.feedback-card p {
  margin: 0;
  white-space: normal;
  word-break: break-word;
}

.feedback-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.title-card h3 {
  font-size: 18px;
  line-height: 1.35;
}

.manage-title-card {
  gap: 12px;
}

.manage-title-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.card-meta,
.meta-grid {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 13px;
}

.meta-grid {
  background: #f8f5ee;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 18px 0;
  padding: 12px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.badge {
  background: #eef4ef;
  border: 1px solid #d5e3d8;
  border-radius: 999px;
  color: var(--brand-dark);
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
}

.badge.warn {
  background: #fff2e6;
  border-color: #edc79d;
  color: #8d4f18;
}

.chip.muted {
  background: #f0ede7;
  border-color: var(--line);
  color: var(--muted);
}

.proto-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.proto-card .code {
  color: var(--accent);
  font-weight: 900;
  margin-right: 8px;
}

.word-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compact-page-head {
  margin-bottom: 10px;
}

.compact-page-head h1 {
  font-size: 26px;
  line-height: 1.15;
}

.compact-word-toolbar {
  margin-bottom: 12px;
  padding: 12px;
}

.compact-word-toolbar .filter-grid {
  grid-template-columns: minmax(260px, 2fr) minmax(180px, 1fr) auto;
}

.compact-word-grid {
  align-items: start;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.compact-word-card {
  border-radius: 8px;
  gap: 3px;
  min-height: 0;
  padding: 8px 10px;
}

.compact-word-card strong {
  color: var(--brand-dark);
  font-size: 15px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-word-card span,
.compact-word-card small {
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-card span,
.word-card small,
.proto-card small {
  color: var(--muted);
}

.dashboard-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 18px;
}

.dashboard-split {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.metric-card strong {
  font-size: 30px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.rank-list {
  display: grid;
  gap: 8px;
}

.rank-list div {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 8px 0;
}

.rank-list span {
  color: var(--text);
}

.rank-list strong {
  color: var(--accent);
}

.data-table {
  border-collapse: collapse;
  width: 100%;
}

.table-scroll {
  overflow-x: auto;
  width: 100%;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

.data-table.compact th,
.data-table.compact td {
  font-size: 12px;
  padding: 8px;
  white-space: nowrap;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
}

.data-table small {
  color: var(--muted);
  display: block;
}

.status {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.status.active {
  background: #e8f4eb;
  color: var(--ok);
}

.status.observing,
.status.pending,
.status.need_more_info {
  background: #fff2e6;
  color: #8d4f18;
}

.status.approved {
  background: #e8f4eb;
  color: var(--ok);
}

.status.ok {
  background: #e8f4eb;
  color: var(--ok);
}

.status.active,
.status.low {
  background: #e8f4eb;
  color: var(--ok);
}

.status.rejected {
  background: #f8e9e4;
  color: var(--warn);
}

.status.risk {
  background: #f8e9e4;
  color: var(--warn);
}

.status.watch {
  background: #fff2e6;
  color: #8d4f18;
}

.status.medium {
  background: #fff2e6;
  color: #8d4f18;
}

.status.high {
  background: #f8e9e4;
  color: var(--warn);
}

.status.invalid_title,
.status.parse_error,
.status.too_many_rows,
.status.open {
  background: #fff2e6;
  color: #8d4f18;
}

.status.duplicate,
.status.importing,
.status.pending_review,
.status.reviewing {
  background: #eef4ef;
  color: var(--brand-dark);
}

.status.done {
  background: #e8f4eb;
  color: var(--ok);
}

.status.paused {
  background: #f0ede7;
  color: var(--muted);
}

.status.disabled {
  background: #f0ede7;
  color: var(--muted);
}

.status.failed {
  background: #f8e9e4;
  color: var(--warn);
}

.status.closed {
  background: #f0ede7;
  color: var(--muted);
}

.status.online {
  background: #e8f4eb;
  color: var(--ok);
}

.status.maybe-offline {
  background: #fff2e6;
  color: #8d4f18;
}

.status.offline {
  background: #f0ede7;
  color: var(--muted);
}

.device-cell {
  max-width: 260px;
  white-space: normal;
}

.import-error-table pre {
  margin: 8px 0 0;
  max-width: 520px;
  white-space: pre-wrap;
  word-break: break-word;
}

.inline-form {
  display: inline-flex;
  gap: 6px;
  margin: 0 6px 0 0;
  vertical-align: middle;
}

.inline-form input {
  min-height: 34px;
  width: 120px;
}

.inline-form button {
  min-height: 34px;
}

.mini-row-actions .mini-action-button {
  font-size: 11px;
  min-height: 26px;
  padding: 0 9px;
}

.action-cell {
  min-width: 260px;
}

.edit-cell {
  min-width: 520px;
}

.user-edit-form {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(120px, 1fr) minmax(100px, 0.8fr) minmax(110px, 0.8fr) minmax(120px, 0.9fr) auto;
}

.user-edit-form label {
  font-size: 12px;
}

.ai-prompt-template-panel {
  border-color: rgba(34, 108, 95, 0.22);
}

.ai-prompt-template-form {
  display: grid;
  gap: 10px;
}

.ai-prompt-template-form textarea {
  font-size: 13px;
  line-height: 1.55;
  min-height: 260px;
}

.ai-prompt-template-form button {
  justify-self: start;
}

.prompt-token-box {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-token-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.prompt-token-box code {
  background: #eef4ef;
  border: 1px solid #d5e3d8;
  border-radius: 999px;
  color: var(--brand-dark);
  font-size: 12px;
  padding: 4px 8px;
}

.check-label {
  align-items: center;
  color: var(--text);
  display: flex;
  gap: 6px;
  min-height: 40px;
}

.check-label input {
  min-height: auto;
  width: auto;
}

.folder-edit-form input {
  width: 180px;
}

.source-edit-form {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(130px, 1fr) 90px repeat(3, minmax(92px, auto)) minmax(180px, 1.2fr) auto;
  min-width: 780px;
}

.source-edit-form label {
  font-size: 12px;
}

.source-create-form,
.word-create-form,
.word-edit-form,
.risk-rule-create-form,
.risk-rule-edit-form,
.prototype-create-form,
.prototype-edit-form,
.metric-form {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
}

.word-edit-form,
.risk-rule-edit-form {
  min-width: 840px;
}

.prototype-edit-form {
  min-width: 780px;
}

.prototype-edit-cell {
  min-width: 820px;
}

.preview-panel {
  display: grid;
  gap: 14px;
}

.preview-grid {
  margin-bottom: 0;
}

.preview-title-cell {
  max-width: 420px;
  min-width: 260px;
  white-space: normal;
  word-break: break-word;
}

.metric-form {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}

.score-title-card,
.score-detail-panel {
  gap: 14px;
}

.score-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.score-badge {
  border-radius: 6px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 900;
  padding: 7px 10px;
}

.score-badge.excellent {
  background: #e8f4eb;
  color: var(--ok);
}

.score-badge.good {
  background: #eef4ef;
  color: var(--brand-dark);
}

.score-badge.watch {
  background: #fff2e6;
  color: #8d4f18;
}

.score-badge.risk {
  background: #f8e9e4;
  color: var(--warn);
}

.score-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.score-parts span {
  background: #f8f5ee;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 5px 8px;
}

.reason-risk,
.reason-fatigue {
  background: #fff2e6;
  border-color: #edc79d;
  color: #8d4f18;
}

.reason-negative {
  background: #f8e9e4;
  border-color: #ecc3b9;
  color: var(--warn);
}

.score-reason-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.score-reason-grid ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.score-reason-grid li {
  color: var(--muted);
  margin: 4px 0;
}

.source-remark {
  min-width: 180px;
}

.empty-state,
.note-box,
.note-inline {
  background: #fff8e9;
  border: 1px solid #ead3a5;
  border-radius: 6px;
  color: #6f4a18;
  padding: 14px;
}

.copy-button {
  margin-top: 14px;
}

.action-panel {
  background: #f8f5ee;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
}

.action-panel h2 {
  font-size: 16px;
  margin: 0;
}

.favorite-form {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(140px, 0.8fr) minmax(120px, 0.7fr) minmax(220px, 1.6fr) auto;
}

.review-form {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(130px, 0.8fr) minmax(260px, 1.6fr) auto;
}

.review-panel {
  margin-top: -2px;
}

.inline-create {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 420px) auto;
}

.title-form {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.full-span {
  grid-column: 1 / -1;
}

.wide-span {
  grid-column: span 2;
}

.form-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.favorite-list {
  display: grid;
  gap: 12px;
}

.favorite-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  padding: 16px;
}

.favorite-card h3 {
  font-size: 18px;
  line-height: 1.35;
  margin: 0;
}

.favorite-card p,
.note-mini {
  color: var(--muted);
  margin: 0;
}

.note-mini {
  background: #f8f5ee;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.favorite-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.favorite-status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  margin-right: 6px;
  padding: 4px 8px;
}

.favorite-status.normal {
  background: #eef4ef;
  color: var(--brand-dark);
}

.favorite-status.this_week {
  background: #fff2e6;
  color: #8d4f18;
}

.favorite-status.used {
  background: #e8f4eb;
  color: var(--ok);
}

.favorite-status.avoid {
  background: #f8e9e4;
  color: var(--warn);
}

.note-inline {
  max-width: 520px;
}

.back-link {
  color: var(--brand);
  display: inline-flex;
  font-weight: 800;
  margin-bottom: 12px;
}

.mini-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 10px 0;
}

.mini-row.representative-case-row {
  align-items: stretch;
  display: grid;
  gap: 7px;
  grid-template-columns: 1fr;
  justify-content: stretch;
  padding: 9px 0;
}

.mini-row.representative-case-row .mini-row-main {
  display: block;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.mini-row.representative-case-row .mini-row-main span {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mini-row.representative-case-row .mini-row-actions {
  justify-content: flex-start;
}

.pager {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: center;
  margin: 22px 0;
}

.pager a {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-main > section,
.app-main > .topbar {
  animation: fade-up 220ms ease both;
}

.workbench-case-list > .workbench-title-card,
.workbench-prototype-list > .workbench-prototype-card,
.compact-word-grid > .compact-word-card,
.dashboard-grid > .metric-card,
.dashboard-split > .section-block {
  animation: fade-up 240ms ease both;
}

.toast-stack {
  display: grid;
  gap: 8px;
  pointer-events: none;
  position: fixed;
  right: 22px;
  top: 22px;
  z-index: 2000;
}

.toast-message {
  animation: toast-in 180ms ease both;
  background: rgba(23, 75, 67, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(18, 40, 36, 0.18);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  min-width: 150px;
  padding: 10px 12px;
}

.toast-message.is-leaving {
  animation: toast-out 220ms ease both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 1100px) {
  .app-main {
    overflow-x: auto;
  }

  .filter-grid,
  .favorite-form,
  .review-form,
  .title-form,
  .user-edit-form,
  .source-edit-form,
  .source-create-form,
  .word-create-form,
  .word-edit-form,
  .risk-rule-create-form,
  .risk-rule-edit-form,
  .prototype-create-form,
  .prototype-edit-form,
  .metric-form,
  .hero-panel,
  .workspace-hero,
  .workspace-main,
  .workspace-support,
  .entry-grid,
  .dashboard-grid,
  .dashboard-split,
  .score-reason-grid,
  .proto-grid,
  .word-grid {
    grid-template-columns: 1fr 1fr;
  }

  .compact-word-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .workspace-main,
  .workspace-support {
    grid-template-columns: 1fr;
  }

  .prototype-rail {
    position: static;
  }

  .proto-rail-list {
    max-height: 460px;
  }

  .workbench-page {
    min-width: 1060px;
  }

  .workbench-columns {
    grid-template-columns: minmax(280px, 320px) minmax(460px, 1fr) minmax(300px, 360px);
  }

  .title-card-actions {
    grid-template-columns: 1fr;
  }

  .title-card-actions .text-link {
    grid-column: 1;
  }
}

@media (max-width: 760px) {
  .sidebar {
    height: auto;
    position: static;
    width: 100%;
  }

  .sidebar nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .app-main {
    margin-left: 0;
    padding: 16px;
  }

  .filter-grid,
  .favorite-form,
  .review-form,
  .inline-create,
  .title-form,
  .user-edit-form,
  .source-edit-form,
  .source-create-form,
  .word-create-form,
  .word-edit-form,
  .risk-rule-create-form,
  .risk-rule-edit-form,
  .prototype-create-form,
  .prototype-edit-form,
  .metric-form,
  .hero-panel,
  .workspace-hero,
  .workspace-metrics,
  .workspace-main,
  .workspace-support,
  .compact-metrics,
  .entry-grid,
  .dashboard-grid,
  .dashboard-split,
  .score-reason-grid,
  .proto-grid,
  .word-grid,
  .search-row {
    grid-template-columns: 1fr;
  }

  .workbench-page {
    min-width: 0;
  }

  .prototype-workbench {
    min-width: 0;
  }

  .search-workbench {
    min-width: 0;
  }

  .word-detail-workbench {
    min-width: 0;
  }

  .workbench-titlebar,
  .workbench-command {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .workbench-columns {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .prototype-map-split {
    grid-template-columns: 1fr;
  }

  .search-title-split {
    grid-template-columns: 1fr;
  }

  .compact-word-toolbar .filter-grid,
  .compact-word-grid {
    grid-template-columns: 1fr 1fr;
  }

  .workbench-column {
    min-height: 520px;
  }

  .column-scroll {
    max-height: 68vh;
  }

  .workbench-title-card {
    grid-template-columns: 1fr;
  }

  .title-card-actions {
    justify-items: stretch;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    position: static;
  }

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

  .prototype-focus-head {
    flex-direction: column;
  }

  .workspace-case-table td:first-child {
    min-width: 260px;
  }

  .wide-span {
    grid-column: 1;
  }

  .result-head,
  .section-head,
  .section-title,
  .danger-zone,
  .manage-title-head,
  .feedback-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
}
