.wbgen {
  max-width: 1180px;
  margin: 2rem auto 3rem;
  padding: 0 1rem;
  color: #1f2937;
  font-family: Aptos, "Segoe UI", Arial, sans-serif;
}

.wbgen__header {
  margin-bottom: 1rem;
}

.wbgen__header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.wbgen__title {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

.wbgen__subtitle {
  margin: 0.4rem 0 0;
  color: #4b5563;
}

.wbgen__status {
  min-height: 1.5rem;
  margin: 0.75rem 0 0;
  font-weight: 600;
}

.wbgen__top-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wbgen-card {
  margin-top: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  padding: 1rem;
}

.wbgen-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.wbgen-card__head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.wbgen-recents {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.wbgen-recents label {
  font-size: 0.9rem;
  font-weight: 700;
}

.wbgen-recents select {
  min-width: 320px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
  font-family: Aptos, "Segoe UI", Arial, sans-serif;
}

.wbgen-grid {
  display: grid;
  grid-template-columns: minmax(280px, 2fr) auto;
  gap: 0.75rem 1rem;
  align-items: end;
}

.wbgen-grid--intake {
  grid-template-columns: minmax(320px, 2fr) minmax(220px, 1fr);
  align-items: start;
}

.wbgen-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wbgen-field span {
  font-weight: 600;
  font-size: 0.95rem;
}

.wbgen-field input,
.wbgen-field textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.6rem 0.65rem;
  font-size: 0.95rem;
  font-family: Aptos, "Segoe UI", Arial, sans-serif;
}

.wbgen-field input:focus,
.wbgen-field textarea:focus {
  outline: 2px solid #93c5fd;
  outline-offset: 0;
  border-color: #60a5fa;
}

.wbgen-field--wide {
  grid-column: 1 / -1;
}

.wbgen-upload {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 0.8rem;
  background: #f8fafc;
}

.wbgen-actions {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.wbgen-actions--top {
  margin-top: 0;
}

.wbgen-actions--dense {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.wbgen-dict-limit {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
}

.wbgen-dict-limit input {
  width: 5.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  font-size: 0.85rem;
  color: #0f172a;
  background: #fff;
}

.wbgen-dict-limit select {
  min-width: 13rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  font-size: 0.85rem;
  color: #0f172a;
  background: #fff;
  font-family: Aptos, "Segoe UI", Arial, sans-serif;
}

.wbgen-dict-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
}

.wbgen-dict-toggle input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
}

.wbgen-btn {
  border: 1px solid #94a3b8;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.wbgen-btn:hover {
  background: #eef2ff;
}

.wbgen-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.wbgen-btn--primary {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

.wbgen-btn--primary:hover {
  background: #1e40af;
}

.wbgen-links {
  margin-top: 0.9rem;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.wbgen-links__title {
  margin: 0 0 0.5rem;
  font-weight: 700;
}

.wbgen-links p {
  margin: 0.15rem 0;
}

.wbgen-dictionary {
  margin-top: 0.9rem;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.wbgen-dictionary__title {
  margin: 0 0 0.5rem;
  font-weight: 700;
}

.wbgen-dictionary p {
  margin: 0.15rem 0;
}

.wbgen-help {
  margin: 0;
  font-size: 0.88rem;
  color: #475569;
}

.wbgen-help--inline {
  margin-left: 0.35rem;
  align-self: center;
}

.wbgen-table-wrap {
  overflow-x: auto;
}

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

.wbgen-table--compact th,
.wbgen-table--compact td {
  padding: 0.42rem 0.35rem;
  font-size: 0.82rem;
}

.wbgen-table th,
.wbgen-table td {
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: middle;
  padding: 0.55rem 0.4rem;
  font-size: 0.9rem;
}

.wbgen-table thead th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #475569;
  background: #f8fafc;
}

.wbgen-table__row--focus td {
  background: #fef9c3;
  transition: background-color 220ms ease;
}

.wbgen-table__id-input {
  min-width: 380px;
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.45rem 0.5rem;
  font-size: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.wbgen-table__page-input {
  width: 96px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.45rem 0.5rem;
  font-size: 0.9rem;
}

.wbgen-table__actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.wbgen-table__btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 6px;
  padding: 0.3rem 0.45rem;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
}

.wbgen-table__btn:hover {
  background: #f8fafc;
}

.wbgen-dict-queue-row--active td {
  background: #eef2ff;
}

.wbgen-dict-queue-senses-row td {
  background: #f8fafc;
  padding: 0.55rem 0.4rem;
}

.wbgen-dict-queue-senses-row .wbgen-dict-senses {
  margin-top: 0;
}

.wbgen-dict-senses {
  margin-top: 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem;
  background: #f8fafc;
}

.wbgen-dict-senses__title {
  margin: 0 0 0.4rem;
  font-weight: 700;
}

.wbgen-dict-senses__meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.wbgen-dict-senses__meta-row .wbgen-help {
  margin: 0;
}

.wbgen-dict-senses__filter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: #475569;
}

.wbgen-dict-senses__filter select {
  min-width: 180px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.25rem 0.35rem;
  font-size: 0.8rem;
  background: #fff;
  color: #0f172a;
}

.wbgen-dict-audit {
  margin: 0.65rem 0 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.65rem;
  background: #f8fafc;
  display: grid;
  gap: 0.5rem;
}

.wbgen-dict-audit .wbgen-help {
  margin-bottom: 0.1rem;
}

.wbgen-dict-audit-filter {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.wbgen-dict-audit-filter input {
  flex: 1 1 auto;
}

.wbgen-dict-audit-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.wbgen-audit-row--filtered-empty td {
  color: #64748b;
  font-style: italic;
}

.wbgen-dict-senses__list {
  margin-top: 0.55rem;
  max-height: 300px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
}

.wbgen-dict-sense-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid #f1f5f9;
}

.wbgen-dict-sense-row:last-child {
  border-bottom: 0;
}

.wbgen-dict-sense-row input[type='radio'] {
  margin-top: 0.2rem;
}

.wbgen-dict-sense-row input[type='checkbox'] {
  margin-top: 0.2rem;
}

.wbgen-dict-sense-row--locked {
  background: #f8fafc;
}

.wbgen-dict-sense-row__body {
  min-width: 0;
  width: 100%;
}

.wbgen-dict-sense-row__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.wbgen-dict-sense-row__meta {
  margin: 0 0 0.2rem;
  font-size: 0.74rem;
  color: #475569;
}

.wbgen-dict-sense-row__definition {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.35;
}

.wbgen-dict-sense-row__edit {
  margin-left: auto;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.74rem;
  padding: 0.15rem 0.5rem;
  cursor: pointer;
}

.wbgen-dict-sense-row__edit:hover {
  background: #f8fafc;
}

.wbgen-dict-senses__add-btn {
  margin-left: auto;
}

.wbgen-dict-sense-editor {
  margin-top: 0.55rem;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #eff6ff;
  padding: 0.6rem;
}

.wbgen-dict-sense-editor__title {
  margin: 0 0 0.4rem;
  font-size: 0.84rem;
  font-weight: 700;
  color: #1e3a8a;
}

.wbgen-dict-sense-editor__grid {
  margin-bottom: 0.4rem;
}

@media (max-width: 880px) {
  .wbgen__header-row {
    flex-direction: column;
    align-items: stretch;
  }

  .wbgen__top-actions {
    justify-content: flex-start;
  }

  .wbgen-grid {
    grid-template-columns: 1fr;
  }

  .wbgen-recents {
    width: 100%;
  }

  .wbgen-recents select {
    min-width: 0;
    width: 100%;
  }
}
