:root {
  --resource-primary: #10b981;
  --resource-primary-dark: #059669;
  --resource-primary-soft: #ecfdf5;
  --resource-bg-top: #f7faf9;
  --resource-bg-bottom: #f0fdf4;
  --resource-border: #e5efe9;
  --resource-text: #172033;
  --resource-muted: #6b7280;
  --resource-panel-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  color: var(--resource-text);
  background: linear-gradient(180deg, var(--resource-bg-top) 0%, var(--resource-bg-bottom) 100%);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.character-modal-open {
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.page-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: #fff;
  border-right: 1px solid var(--resource-border);
  padding: 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.legacyAntdSider {
  height: 100vh;
  background: #fff !important;
  border-right: 1px solid var(--resource-border);
}

.legacyAntdBrand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--resource-border);
  background: #fff;
}

.legacyAntdBrand img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: contain;
}

.legacyAntdBrand .ant-typography {
  margin: 0;
}

.legacyAntdBrandEyebrow {
  display: block;
  color: var(--resource-primary-dark);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.legacyAntdMenu {
  border-inline-end: 0 !important;
  padding: 10px 8px 18px;
}

.legacyAntdMenu .ant-menu-submenu-title,
.legacyAntdMenu .ant-menu-item {
  margin-inline: 0;
  width: 100%;
}

.legacyAntdMenu .ant-menu-item-selected {
  font-weight: 700;
}

.sidebar-header {
  padding: 10px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(135deg, var(--resource-primary) 0%, var(--resource-primary-dark) 100%);
  text-align: left;
}

.sidebar-header h1 {
  color: #fff;
  font-size: 0.92rem;
  margin: 0;
}

.sidebar-header .refresh-info {
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  margin-top: 6px;
  display: none;
}

.sidebar-header .sidebar-brand {
  justify-content: flex-start;
  gap: 8px;
  min-height: 32px;
}

.sidebar-header .sidebar-brand-logo {
  width: 32px;
  height: 32px;
  padding: 3px;
  border-radius: 10px;
}

.sidebar-header .sidebar-brand-copy {
  align-items: center;
}

.sidebar-header .sidebar-brand-copy h1 {
  line-height: 1;
  white-space: nowrap;
}

.sidebar-header .sidebar-brand-copy .refresh-info {
  text-align: center;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav-groups {
  display: grid;
  gap: 10px;
  padding: 12px 8px 18px;
}

.sidebar-nav-group {
  display: grid;
  gap: 4px;
}

.sidebar-nav-group h2 {
  margin: 4px 8px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.sidebar-error {
  margin: 12px 8px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  background: #fef2f2;
  font-size: 12px;
  line-height: 1.5;
}

.sidebar-nav li {
  margin: 3px 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  color: #555;
  text-decoration: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.sidebar-nav a:hover {
  background: #f0f2f5;
  color: #333;
}

.sidebar-nav a.active {
  background: linear-gradient(135deg, var(--resource-primary) 0%, var(--resource-primary-dark) 100%);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12), 0 8px 18px rgba(16, 185, 129, 0.18);
}

.sidebar-nav .nav-icon {
  margin-right: 10px;
  font-size: 1.1em;
  width: 24px;
  text-align: center;
}

.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 16px;
  min-height: 100vh;
}

.content-container {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--resource-border);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.materials-shell,
.resource-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.materials-tabs {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
  align-self: flex-start;
  padding: 4px;
  border: 1px solid var(--resource-border);
  border-radius: 12px;
  background: #f3f6fa;
}

.materials-tab {
  border: 0;
  background: transparent;
  color: #435066;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.materials-tab:hover {
  background: rgba(255,255,255,0.8);
  color: #172033;
}

.materials-tab.active {
  background: #fff;
  color: #172033;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.resource-hero-card,
.resource-card {
  background: #fff;
  border: 1px solid var(--resource-border);
  border-radius: 12px;
  box-shadow: var(--resource-panel-shadow);
}

.resource-hero-card {
  display: none;
  padding: 24px;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.resource-page-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--resource-primary-dark);
}

.resource-hero-card h1 {
  margin: 8px 0 0;
  color: var(--resource-text);
  font-size: 28px;
}

.resource-hero-card p {
  margin: 10px 0 0;
  color: var(--resource-muted);
  line-height: 1.6;
  max-width: 760px;
}

.resource-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-width: 300px;
  flex: 1;
}

.resource-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 16px;
}

.resource-stat-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--resource-border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.resource-stat-card span {
  display: block;
  font-size: 12px;
  color: #64748b;
}

.resource-stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
  font-weight: 700;
  color: #0f172a;
}

.resource-card {
  padding: 16px;
}

.resource-inline-input,
.resource-inline-select {
  width: 100%;
  min-width: 120px;
  min-height: 36px;
  border: 1px solid var(--resource-border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--resource-text);
  background: #fff;
}

.resource-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--resource-text);
}

.invitation-config-toggle {
  margin: 4px 0 14px;
}

@media (max-width: 860px) {
  .resource-stat-grid {
    grid-template-columns: 1fr;
  }
}

.membership-batch-form-grid {
  grid-template-columns: minmax(180px, 1.2fr) minmax(130px, 0.6fr) minmax(120px, 0.6fr) minmax(180px, 1fr) auto;
}

.membership-batch-table th:nth-child(4),
.membership-batch-table td:nth-child(4) {
  width: 110px;
  text-align: center;
}

.membership-batch-qr {
  width: 82px;
  height: 82px;
  object-fit: contain;
  border: 1px solid #e5efe9;
  border-radius: 10px;
  background: #fff;
}

.membership-batch-token,
.membership-batch-remark {
  margin-top: 4px;
  color: var(--resource-muted);
  font-size: 12px;
  line-height: 1.45;
}

.membership-batch-token {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

.membership-batch-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  background: #ecfdf5;
  color: #047857;
}

.membership-batch-status--disabled {
  background: #f3f4f6;
  color: #6b7280;
}

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

.resource-card-head h3 {
  margin: 0;
  font-size: 16px;
  color: var(--resource-text);
}

.resource-card-head p {
  margin: 6px 0 0;
  color: var(--resource-muted);
  font-size: 13px;
  line-height: 1.5;
}

.resource-filter-grid,
.resource-inline-grid {
  display: grid;
  gap: 12px;
}

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

.resource-inline-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
}

.task-config-item {
  cursor: grab;
  transition: opacity 0.16s ease, outline-color 0.16s ease, transform 0.16s ease;
}

.task-config-item:active {
  cursor: grabbing;
}

.task-config-item--dragging {
  opacity: 0.58;
}

.task-config-item--drag-over {
  outline: 2px dashed var(--resource-primary);
  outline-offset: 4px;
  transform: translateY(-1px);
}

.task-item-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.task-order-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--resource-border);
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.task-order-btn:hover:not(:disabled) {
  border-color: var(--resource-primary);
  color: var(--resource-primary-dark);
}

.task-order-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.task-order-btn--drag {
  cursor: grab;
  color: var(--resource-primary-dark);
}

.user-form-grid {
  align-items: end;
}

.user-form-grid .user-tags-field {
  grid-column: span 2;
}

.tag-form-grid {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.user-tag-form-grid {
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(180px, 1fr) auto;
  align-items: end;
}

.user-tag-form-actions {
  flex-direction: row;
  flex-wrap: nowrap;
}

.user-tag-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.user-tag-group {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.user-tag-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

.user-tag-group-head strong {
  color: #111827;
  font-size: 14px;
}

.user-tag-group-head span {
  color: var(--resource-muted);
  font-size: 12px;
}

.user-tag-tree {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.user-tag-node {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.user-tag-node-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

.user-tag-node-main strong {
  color: #111827;
}

.user-tag-children {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px 28px;
}

.user-tag-children .user-tag-node {
  background: #f8fafc;
}

.user-tag-node .danger-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.resource-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.resource-field > span {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.resource-field > input,
.resource-field > select,
.resource-field > textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 13px;
  color: var(--resource-text);
  background: #fff;
}

.resource-field > textarea {
  min-height: 120px;
  resize: vertical;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 14px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 22px;
  color: var(--resource-text);
  cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  flex: 0 0 18px;
}

.checkbox-item span {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--resource-text);
}

.resource-actions-inline,
.resource-filter-actions,
.resource-actions-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.materials-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  color: var(--resource-muted);
  font-size: 13px;
}

.resource-filter-actions {
  align-items: end;
}

.fixed-recurring-template-actions {
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr) auto auto;
}

.fixed-recurring-rule-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 420px;
}

.fixed-recurring-rule-steps .resource-chip-option {
  white-space: nowrap;
}

.fixed-recurring-rule-steps .resource-chip-option--disabled {
  cursor: not-allowed;
  opacity: 0.46;
  filter: grayscale(1);
}

.fixed-recurring-rule-steps .resource-chip-option--disabled span {
  color: #8a8f99;
}

.fixed-recurring-submit-actions {
  justify-content: center;
  grid-column: 1 / -1;
}

.task-loading-mask,
.resource-loading-mask,
.page-loading-mask {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
}

.resource-loading-mask,
.page-loading-mask {
  display: none;
}

.resource-loading-mask.is-visible,
.page-loading-mask.is-visible {
  display: flex;
}

.task-loading-panel,
.resource-loading-panel {
  width: min(360px, 100%);
  min-height: 180px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 28px 24px;
}

.task-loading-panel strong,
.resource-loading-panel strong {
  font-size: 18px;
  color: var(--resource-text);
}

.task-loading-panel span,
.resource-loading-panel span {
  font-size: 13px;
  color: var(--resource-muted);
}

.task-loading-spinner,
.resource-loading-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #d1fae5;
  border-top-color: var(--resource-primary);
  border-radius: 999px;
  animation: task-loading-spin 0.8s linear infinite;
}

@keyframes task-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.resource-primary-btn,
.resource-secondary-btn,
.resource-warning-btn,
.resource-danger-btn {
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--resource-primary) 0%, var(--resource-primary-dark) 100%);
  border: 0;
  color: #fff;
}

.primary-btn:hover {
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.25);
}

.secondary-btn {
  background: #fff;
  color: var(--resource-primary);
  border: 2px solid var(--resource-primary);
}

.resource-primary-btn {
  background: linear-gradient(135deg, var(--resource-primary) 0%, var(--resource-primary-dark) 100%);
  border: 0;
  color: #fff;
}

.resource-primary-btn:hover {
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.25);
}

.resource-secondary-btn {
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
}

.resource-secondary-btn:hover {
  background: #f8fafc;
}

.resource-warning-btn {
  background: #f97316;
  border: 1px solid #f97316;
  color: #fff;
}

.resource-warning-btn:hover {
  background: #ea580c;
  border-color: #ea580c;
  box-shadow: 0 6px 16px rgba(249, 115, 22, 0.25);
}

.secondary-btn:hover {
  background: #f0fdf4;
  color: var(--resource-primary-dark);
  border-color: var(--resource-primary-dark);
}

.ghost-btn {
  background: #f8fafc;
  color: #374151;
  border: 1px solid #d1d5db;
}

.ghost-btn:hover {
  background: #f1f5f9;
}

.danger-btn {
  background: #fff1f2;
  color: #dc2626;
  border: 1px solid #fecdd3;
}

.resource-danger-btn {
  background: #fff1f2;
  color: #dc2626;
  border: 1px solid #fecdd3;
}

.danger-btn:hover {
  background: #ffe4e6;
}

.resource-danger-btn:hover {
  background: #ffe4e6;
}

.task-detail-panel {
  background: #fbfdff;
  border-color: #d8e3ef;
}

.task-detail-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.task-detail-summary span,
.task-instance-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #dce6f1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 13px;
}

.task-detail-subtitle {
  margin: 16px 0 10px;
  color: #172033;
  font-size: 14px;
}

.task-day-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.task-day-card {
  border: 1px solid #dce6f1;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.task-day-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #edf2f7;
}

.task-day-card__head span {
  color: #64748b;
  font-size: 12px;
}

.task-step-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.task-step-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.task-step-row__index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 12px;
  font-weight: 700;
}

.task-step-row__title {
  color: #172033;
  font-weight: 700;
  font-size: 13px;
}

.task-step-row__meta {
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.task-instance-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-instance-chip--focus {
  border-color: #10b981;
  background: #ecfdf5;
  color: #047857;
}

.task-batch-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.task-batch-preview__item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #dce6f1;
  border-radius: 8px;
  background: #fff;
}

.task-batch-preview__item strong {
  color: #047857;
  font-size: 13px;
}

.task-batch-preview__item span {
  color: #172033;
  font-size: 13px;
  font-weight: 700;
}

.task-batch-preview__item small {
  color: #64748b;
  line-height: 1.5;
}

.resource-table tr.task-row-highlight td {
  background: #ecfdf5;
}

.resource-note,
.resource-muted {
  color: var(--resource-muted);
  font-size: 12px;
  line-height: 1.6;
}

.resource-actions-bar {
  justify-content: space-between;
  align-items: center;
}

.resource-selection-summary {
  color: var(--resource-muted);
  font-size: 13px;
}

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

.resource-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
}

.resource-table-input,
.resource-table-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 14px;
  color: var(--resource-text);
  background: #fff;
}

.user-table {
  min-width: 1300px;
  table-layout: fixed;
}

.user-table__col-nickname {
  width: 110px;
}

.user-table__col-weekday {
  width: 104px;
}

.user-table__col-wechat {
  width: 96px;
}

.user-table__col-status {
  width: 72px;
}

.user-table__col-membership {
  width: 130px;
}

.user-table__col-coins {
  width: 60px;
}

.user-table__col-tags {
  width: 160px;
}

.user-table__col-created,
.user-table__col-login {
  width: 112px;
}

.user-table__col-actions {
  width: 300px;
}

.user-identity-input {
  min-width: 210px;
}

.user-level-progress {
  display: grid;
  gap: 4px;
  min-width: 112px;
}

.user-level-progress span {
  color: var(--resource-muted);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}

.user-wechat-binding {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid #d1d5db;
  color: var(--resource-muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.user-wechat-binding.is-bound {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #047857;
}

.user-wechat-binding.is-empty {
  background: #f8fafc;
}

.user-table-tags {
  gap: 6px;
  min-width: 160px;
}

.user-edit-assigned-tags {
  margin-top: 0;
}

.user-membership-cell {
  display: grid;
  gap: 4px;
}

.user-membership-cell small,
.user-membership-preview,
.user-membership-summary small {
  color: var(--resource-muted);
  font-size: 12px;
  line-height: 1.5;
}

.user-membership-summary {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #d1fae5;
  border-radius: 8px;
  background: #ecfdf5;
}

.user-membership-summary strong {
  color: var(--resource-text);
}

.user-membership-preview {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}

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

.user-row-actions .resource-secondary-btn {
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.user-create-modal,
.user-edit-modal {
  width: min(980px, 100%);
}

.user-membership-modal {
  width: min(560px, 100%);
}

.user-edit-modal-actions {
  margin-left: auto;
}

.user-invitation-modal {
  width: min(1040px, 100%);
}

.user-edit-identity {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.user-edit-identity__item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--resource-border);
  border-radius: 8px;
  background: #f8fafc;
}

.user-edit-identity__item span {
  color: var(--resource-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.user-edit-identity__item code {
  color: var(--resource-text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

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

.user-edit-form-grid .user-tags-field {
  grid-column: 2 / -1;
}

.user-edit-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.user-edit-detail-card {
  display: grid;
  gap: 5px;
  border: 1px solid var(--resource-border);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.user-edit-detail-card span,
.user-edit-detail-card small {
  color: var(--resource-muted);
  font-size: 12px;
  line-height: 1.35;
}

.user-edit-detail-card strong {
  color: var(--resource-text);
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.invitation-config-section {
  display: grid;
  gap: 12px;
}

.invitation-config-section + .invitation-config-section {
  padding-top: 16px;
  border-top: 1px solid var(--resource-border);
}

.invitation-config-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.invitation-config-head h4 {
  margin: 0;
  color: var(--resource-text);
  font-size: 15px;
  line-height: 1.4;
}

.invitation-config-head p {
  margin: 4px 0 0;
  color: var(--resource-muted);
  font-size: 12px;
  line-height: 1.5;
}

.invitation-relation-box {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--resource-border);
  border-radius: 8px;
  background: #f8fafc;
}

.invitation-relation-box > div {
  display: grid;
  gap: 5px;
}

.invitation-relation-box strong {
  color: var(--resource-text);
  font-size: 14px;
  line-height: 1.4;
}

.invitation-relation-box small {
  color: var(--resource-muted);
  font-size: 12px;
}

.invitation-add-grid {
  grid-template-columns: minmax(240px, 1fr) minmax(210px, auto) auto;
  align-items: end;
}

.invitation-paid-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--resource-text);
  font-size: 13px;
  font-weight: 700;
}

.invitation-paid-toggle input {
  width: 16px;
  height: 16px;
}

.invitation-paid-toggle--inline {
  min-height: 0;
  font-weight: 600;
}

.invitation-table {
  min-width: 760px;
}

.resource-table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.task-assignment-id-col {
  min-width: 56px;
  width: 56px;
  white-space: nowrap;
}

.task-assignment-name-col {
  min-width: 320px;
  width: 32%;
}

.task-assignment-actions-col {
  min-width: 360px;
  width: 360px;
}

.task-assignment-actions {
  flex-wrap: nowrap;
}

.task-assignment-actions .resource-secondary-btn,
.task-assignment-actions .resource-danger-btn {
  white-space: nowrap;
}

.qa-question-actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.qa-edit-options-list {
  display: grid;
  gap: 10px;
}

.qa-edit-option-row {
  display: grid;
  grid-template-columns: 42px minmax(160px, 1fr) minmax(160px, 1fr) 90px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--resource-border);
  border-radius: 10px;
  background: #fbfdff;
}

.qa-edit-option-row .resource-field {
  gap: 6px;
}

.qa-edit-option-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
}

.qa-edit-option-actions {
  display: flex;
  justify-content: flex-end;
}

.printable-layout-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.printable-layout-card {
  padding: 16px;
}

.printable-preview-box {
  margin: 12px 0;
  width: 100%;
  aspect-ratio: 3508 / 2480;
  border: 1px solid var(--resource-border);
  background: #f8fafc;
  overflow: hidden;
}

.printable-preview-box img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.lesson-resource-table th,
.lesson-resource-table td {
  vertical-align: top;
}

.lesson-resource-shell {
  gap: 12px;
}

.lesson-resource-shell .resource-card {
  padding: 14px;
}

.lesson-resource-shell .resource-card-head {
  margin-bottom: 10px;
}

.lesson-resource-table th:nth-child(2),
.lesson-resource-table td:nth-child(2) {
  min-width: 230px;
}

.lesson-resource-table th:nth-child(7),
.lesson-resource-table td:nth-child(7) {
  min-width: 210px;
}

.lesson-resource-media-strip {
  display: grid;
  grid-template-columns: repeat(3, 58px);
  gap: 5px;
  margin-top: 6px;
}

.lesson-resource-bulk-actions {
  align-items: flex-start;
}

.lesson-resource-bulk-actions button {
  white-space: nowrap;
}

.lesson-resource-parse-bulk {
  align-items: end;
  display: flex;
  flex: 1 1 100%;
  gap: 8px;
  padding-top: 2px;
}

.lesson-resource-parse-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
}

.lesson-resource-parse-field span {
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.lesson-resource-parse-field select {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  color: var(--resource-text);
  font-size: 12px;
  height: 31px;
  padding: 5px 8px;
}

.lesson-resource-parse-last {
  color: var(--resource-muted);
  flex: 1 1 260px;
  font-size: 11px;
  line-height: 1.4;
  min-width: 240px;
  overflow-wrap: anywhere;
  padding-bottom: 3px;
}

.lesson-resource-links {
  margin-top: 4px;
}

.lesson-resource-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.lesson-resource-metric {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-height: 23px;
}

.lesson-resource-metric + .lesson-resource-metric {
  margin-top: 2px;
}

.lesson-resource-metric--title {
  color: var(--resource-text);
}

.lesson-resource-metric--ready {
  color: #15803d;
}

.lesson-resource-metric--failed {
  color: #dc2626;
}

.lesson-resource-metric--processing {
  color: #059669;
}

.lesson-resource-metric--not-started {
  color: var(--resource-muted);
}

.lesson-resource-mini-btn {
  border: 1px solid #d1d5db;
  border-radius: 7px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  padding: 2px 7px;
  white-space: nowrap;
}

.lesson-resource-mini-btn:hover {
  border-color: #10b981;
  color: #047857;
}

.lesson-resource-mini-btn--danger {
  background: #fff7f7;
  border-color: #fecaca;
  color: #dc2626;
}

.lesson-resource-line {
  margin-top: 4px;
}

.lesson-resource-keywords,
.lesson-resource-preview-link {
  margin-top: 3px;
}

.lesson-resource-media-states {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.lesson-resource-title {
  display: block;
  font-size: 13px;
  line-height: 1.25;
}

.lesson-resource-meta {
  margin-top: 2px;
}

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

.resource-table th {
  background: #f8fafc;
  font-size: 12px;
  color: var(--resource-muted);
  font-weight: 700;
}

.resource-table td {
  font-size: 13px;
}

.resource-table th:has(> input[type="checkbox"]),
.resource-table td:has(> input[type="checkbox"]) {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  padding-left: 6px;
  padding-right: 6px;
  text-align: center;
  white-space: nowrap;
}

.resource-table th:has(> input[type="checkbox"]) input[type="checkbox"],
.resource-table td:has(> input[type="checkbox"]) input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.lesson-resource-table {
  min-width: 1260px;
}

.lesson-resource-table th,
.lesson-resource-table td {
  font-size: 12px;
  line-height: 1.35;
  padding: 5px 8px;
}

.lesson-resource-table .resource-muted {
  font-size: 11px;
  line-height: 1.35;
}

.lesson-resource-table .resource-status {
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.2;
  padding: 2px 7px;
}

.lesson-resource-table .materials-admin-link-list {
  gap: 8px;
}

.lesson-resource-table .lesson-resource-media {
  border-radius: 6px;
  height: 40px;
  object-fit: cover;
  width: 58px;
}

.lesson-resource-bulk-actions button {
  border-radius: 8px;
  font-size: 12px;
  padding: 5px 8px;
}

.parse-result-shell {
  gap: 12px;
}

.parse-result-filter-grid {
  grid-template-columns: minmax(160px, 220px) minmax(160px, 240px) minmax(180px, 1fr) auto;
}

.parse-result-table {
  min-width: 1420px;
}

.parse-result-table th:nth-child(1),
.parse-result-table td:nth-child(1) {
  width: 235px;
}

.parse-result-table th:nth-child(2),
.parse-result-table td:nth-child(2) {
  width: 500px;
}

.parse-result-table th:nth-child(3),
.parse-result-table td:nth-child(3) {
  width: 170px;
}

.parse-result-table th:nth-child(4),
.parse-result-table td:nth-child(4) {
  width: 430px;
}

.parse-result-table th,
.parse-result-table td {
  padding: 8px 8px;
}

.parse-lesson-stats {
  display: grid;
  gap: 2px;
  margin-top: 6px;
  color: var(--resource-muted);
  font-size: 11px;
}

.parse-title-edit-btn {
  margin-top: 6px;
}

.parse-lesson-notes {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.parse-lesson-editable {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 5px;
  align-items: start;
  color: var(--resource-muted);
  font-size: 11px;
  line-height: 1.45;
}

.parse-lesson-editable__label {
  color: var(--resource-text);
  font-weight: 700;
  white-space: nowrap;
}

.parse-lesson-editable__value {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.parse-list-block {
  display: grid;
  gap: 6px;
}

.parse-keyword-row,
.parse-add-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(180px, 1.4fr) auto auto auto;
  gap: 5px;
  align-items: center;
}

.parse-add-row {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--resource-border);
  grid-template-columns: minmax(120px, 0.8fr) minmax(180px, 1.4fr) auto;
}

.parse-match-state {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  white-space: nowrap;
}

.parse-match-state.is-matched {
  background: #ecfdf5;
  color: #047857;
}

.parse-match-state.is-unmatched {
  background: #fff7ed;
  color: #c2410c;
}

.parse-sentence-row {
  display: grid;
  grid-template-columns: max-content minmax(220px, 1fr) max-content;
  gap: 5px;
  padding: 4px;
  align-items: start;
  border: 1px solid var(--resource-border);
  border-radius: 8px;
  background: #fbfcfe;
}

.parse-sentence-row--view {
  align-items: center;
}

.parse-sentence-row--new {
  border-style: dashed;
}

.parse-sentence-meta {
  display: grid;
  grid-template-columns: 38px 38px 46px;
  gap: 4px;
}

.parse-sentence-row--new .parse-sentence-meta {
  grid-template-columns: 54px 38px 46px;
}

.parse-sentence-tag,
.parse-page-label {
  color: var(--resource-muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.parse-sentence-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.parse-sentence-readable {
  color: var(--resource-text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.parse-sentence-translation {
  color: var(--resource-muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.parse-keyword-hit {
  background: #dcfce7;
  border-radius: 4px;
  color: #047857;
  font-weight: 800;
  padding: 0 2px;
}

.parse-sentence-row .resource-table-input,
.parse-sentence-row .resource-table-select,
.parse-keyword-row .resource-table-input,
.parse-keyword-row .resource-table-select,
.parse-add-row .resource-table-input,
.parse-add-row .resource-table-select {
  border-radius: 8px;
  font-size: 12px;
  padding: 4px 6px;
}

.parse-sentence-text {
  line-height: 1.35;
  min-height: 30px;
  resize: vertical;
}

.parse-sentence-row .resource-table-actions {
  gap: 4px;
  flex-wrap: nowrap;
}

@media (max-width: 900px) {
  .parse-sentence-row {
    grid-template-columns: 1fr;
  }

  .parse-sentence-row .resource-table-actions {
    flex-wrap: wrap;
  }

  .parse-page-sentence-block,
  .parse-lesson-editable {
    grid-template-columns: 1fr;
  }
}

.parse-page-list-block {
  gap: 8px;
}

.parse-page-sentence-block {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: 34px minmax(0, 1fr);
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--resource-border);
}

.parse-page-sentence-block:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.parse-page-preview {
  color: var(--resource-muted);
  display: grid;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  justify-items: center;
  position: sticky;
  top: 8px;
}

.parse-page-preview img {
  background: #f8fafc;
  border: 1px solid var(--resource-border);
  border-radius: 6px;
  display: block;
  max-height: 218px;
  object-fit: contain;
  width: 166px;
}

.parse-image-list {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.parse-image-list .parse-page-preview {
  position: static;
}

.parse-image-list .parse-page-preview img {
  max-height: 142px;
  width: 130px;
}

.parse-page-sentences {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.parse-add-sentence-btn {
  justify-self: start;
}

.resource-image,
.resource-video {
  display: block;
  width: 180px;
  max-width: 100%;
  border-radius: 12px;
  background: #f1f5f9;
}

.resource-empty-media {
  width: 180px;
  max-width: 100%;
  min-height: 110px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  color: var(--resource-muted);
}

.page-images-table th:first-child,
.page-images-table td:first-child {
  width: 240px;
}

.page-image-material-cell {
  vertical-align: top;
}

.page-image-material-cell strong {
  display: block;
  margin-bottom: 6px;
}

.page-image-material-action {
  margin-top: 10px;
}

.page-image-description-editor {
  min-height: 104px;
}

.page-image-description-lesson {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.page-image-description-lesson + .page-image-description-lesson {
  padding-top: 16px;
  border-top: 1px dashed var(--resource-border);
}

.page-image-description-page textarea {
  min-height: 104px;
}

.page-image-lesson-block + .page-image-lesson-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--resource-border);
}

.page-image-lesson-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #1f2937;
}

.page-image-lesson-title > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.page-image-lesson-title strong {
  min-width: 0;
}

.page-image-lesson-title span {
  color: var(--resource-muted);
  font-size: 12px;
  white-space: nowrap;
}

.page-image-lesson-title span.is-main-range-missing {
  color: #dc2626;
  font-weight: 700;
}

.page-image-style-action {
  flex: 0 0 auto;
}

.page-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
}

.page-image-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  color: inherit;
}

.page-image-caption {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.page-image-meta {
  font-size: 11px;
  color: var(--resource-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-image-sentences {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  margin-top: 3px;
  padding: 8px;
  border: 1px solid var(--resource-border);
  border-radius: 8px;
  background: #fbfdff;
}

.page-image-sentences--empty {
  color: var(--resource-muted);
  font-size: 12px;
  line-height: 1.5;
}

.page-image-sentence {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
}

.page-image-sentence-index {
  color: #047857;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
}

.page-image-sentence-body {
  min-width: 0;
}

.page-image-sentence-en,
.page-image-sentence-zh {
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.page-image-sentence-en {
  color: #172033;
  font-size: 12px;
  font-weight: 700;
}

.page-image-sentence-zh {
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

.page-image-style-provider-field {
  min-width: min(260px, 100%);
}

.page-image-style-prompt-settings {
  max-width: 1180px;
}

.page-image-style-prompt-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

.page-image-view-mode-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-image-view-mode-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--resource-border);
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.page-image-view-mode-option input {
  width: 14px;
  height: 14px;
}

.page-image-views {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 6px;
  align-items: start;
}

.page-image-view-panel {
  display: block;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

button.page-image-view-panel {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.page-image-view-label {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 700;
  color: #64748b;
}

.page-image-view-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--resource-border);
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.page-image-view-panel--styled .page-image-view-wrap {
  border-color: rgba(16, 185, 129, 0.24);
  background: #f7faf9;
}

.page-image-view-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.page-image-tile-actions {
  display: flex;
  gap: 5px;
  align-items: center;
}

.page-image-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  min-height: 26px;
  border: 1px solid rgba(22, 101, 52, 0.28);
  border-radius: 8px;
  color: #166534;
  background: rgba(240, 253, 244, 0.94);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.page-image-mini-btn:hover:not(:disabled) {
  border-color: #16a34a;
  background: #dcfce7;
}

.page-image-mini-btn:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.resource-status {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.resource-status-ready {
  background: #dcfce7;
  color: #166534;
}

.resource-status-processing,
.resource-status-queued {
  background: #e5efe9;
  color: #059669;
}

.resource-status-partial {
  background: #fef3c7;
  color: #92400e;
}

.resource-status-failed {
  background: #fee2e2;
  color: #b91c1c;
}

.resource-status-not_started {
  background: #e5e7eb;
  color: #374151;
}

.resource-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: #ecfccb;
  color: #4d7c0f;
}

.resource-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.resource-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 8px;
  background: #fafafa;
  color: #475569;
  border: 1px solid #d9d9d9;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
}

.material-body-table {
  table-layout: fixed;
  min-width: 1180px;
}

.material-body-table .material-body-col--select {
  width: 42px;
}

.material-body-table .material-body-col--material {
  width: 140px;
}

.material-body-table .material-body-col--body {
  width: auto;
}

.material-body-table .material-body-col--keywords {
  width: 260px;
}

.material-body-table .material-body-col--patterns {
  width: 140px;
}

.material-body-table .material-body-col--status {
  width: 116px;
}

.material-body-table .material-body-col--material,
.material-body-table .material-body-col--patterns,
.material-body-table .material-body-col--status {
  overflow-wrap: anywhere;
}

.material-body-sentence-list,
.material-body-keyword-list,
.material-body-pattern-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.material-body-page-list {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.material-body-page-row {
  display: grid;
  grid-template-columns: minmax(132px, 0.32fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--resource-border);
}

.material-body-page-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.material-body-page-overview {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 10px;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  line-height: 1.55;
}

.material-body-sentence {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  line-height: 1.5;
}

.material-body-sentence-main {
  min-width: 0;
}

.material-body-sentence-text {
  display: block;
}

.material-body-translation {
  display: block;
  margin-top: 3px;
  color: var(--resource-muted);
  font-size: 12px;
  line-height: 1.5;
}

.material-body-highlight {
  border-radius: 4px;
  background: #fef3c7;
  color: #92400e;
  padding: 0 2px;
}

.material-body-narration {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--resource-border);
  color: #475569;
  font-size: 12px;
  line-height: 1.55;
}

.material-body-keyword {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--resource-border);
}

.material-body-keyword:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.material-body-icon-btn {
  flex: 0 0 auto;
}

.material-body-inline-edit-btn {
  min-height: 24px;
  padding: 2px 8px;
  font-size: 12px;
  line-height: 1.2;
}

.material-body-pattern {
  line-height: 1.45;
}

.resource-tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  background: #fff;
}

.resource-tag-picker--compact {
  min-height: 88px;
}

.resource-tag-picker__empty {
  display: inline-flex;
  align-items: center;
  color: var(--resource-muted);
  font-size: 12px;
}

.resource-tag-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 4px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  background: #fafafa;
  color: #475569;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  transition: all 0.18s ease;
}

.resource-tag-chip:hover {
  border-color: #86efac;
  background: #ecfdf5;
  color: #059669;
}

.resource-tag-chip.is-selected {
  border-color: #86efac;
  background: #d1fae5;
  color: #047857;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.1);
}

.resource-tag-chip.is-selected:hover {
  border-color: #10b981;
  background: #bbf7d0;
  color: #047857;
}

.resource-tag-chip:focus-visible {
  outline: 2px solid rgba(16, 185, 129, 0.36);
  outline-offset: 2px;
}

.resource-table-select--multi {
  min-height: 110px;
}

.resource-empty {
  padding: 40px 12px;
  text-align: center;
  color: var(--resource-muted);
}

audio {
  width: 220px;
  max-width: 100%;
}

.resource-audio-item {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--resource-border);
}

.resource-audio-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.resource-audio-item__label {
  margin-bottom: 4px;
  color: var(--resource-muted);
  font-size: 12px;
}

.resource-audio-item__text,
.resource-audio-item__stale-text {
  max-width: 280px;
  margin-bottom: 6px;
  color: var(--resource-text);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.resource-audio-item__stale-text,
.resource-audio-stale {
  color: #b45309;
}

.resource-audio-stale {
  font-weight: 700;
}

.qa-question-audio-cell {
  min-width: 280px;
  display: grid;
  gap: 14px;
}

.qa-question-audio-cell__group > strong {
  display: block;
  margin-bottom: 8px;
  color: var(--resource-text);
  font-size: 13px;
}

.materials-create-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.materials-create-actions,
.materials-create-submit {
  align-self: end;
}

.materials-create-files,
.materials-create-description {
  grid-column: 1 / -1;
}

.materials-group-list,
.materials-admin-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.materials-group-card,
.materials-admin-card {
  border: 1px solid var(--resource-border);
  border-radius: 12px;
  background: #fff;
  padding: 16px;
  box-shadow: none;
}

.materials-group-card__head,
.materials-admin-card__head,
.materials-group-section__head,
.resource-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.materials-group-card__head h4,
.materials-admin-card__title h4,
.materials-group-section__head h3,
.resource-modal-head h3 {
  margin: 0;
}

.materials-group-card__head p,
.materials-group-section__head p,
.resource-modal-head p,
.materials-admin-card__desc {
  margin: 6px 0 0;
  color: var(--resource-muted);
  line-height: 1.6;
}

.materials-group-card__meta,
.materials-admin-card__meta {
  margin: 12px 0;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--resource-muted);
  font-size: 13px;
}

.materials-group-section + .materials-group-section {
  margin-top: 22px;
}

.materials-admin-card__title {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.materials-admin-table {
  min-width: 980px;
}

.materials-admin-link-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.materials-admin-link-list a {
  color: var(--resource-primary-dark);
}

.materials-admin-status-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.materials-admin-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #374151;
  font-size: 13px;
  line-height: 1.55;
}

.materials-admin-summary strong {
  color: #111827;
}

.materials-admin-error {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
}

.materials-filter-grid {
  margin-bottom: 18px;
}

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

.resource-modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.38);
  padding: 20px;
  z-index: 9998;
}

.resource-modal-overlay.is-visible {
  display: flex;
}

.resource-modal {
  width: min(640px, 100%);
  max-height: calc(100dvh - 40px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.resource-modal--wide {
  width: min(1180px, 100%);
}

.resource-modal-head,
.resource-modal-body,
.resource-modal-footer {
  padding: 20px 22px;
}

.resource-modal-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  border-top: 1px solid var(--resource-border);
  border-bottom: 1px solid var(--resource-border);
}

.resource-modal-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

#quickSortModalOverlay .resource-modal {
  height: min(760px, calc(100dvh - 40px));
}

.materials-quick-sort-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.materials-quick-sort-column {
  border: 1px solid var(--resource-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.materials-quick-sort-column__head {
  align-items: center;
  background: #f8fafc;
  border-bottom: 1px solid var(--resource-border);
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
}

.materials-quick-sort-column__head h4 {
  color: var(--resource-text);
  font-size: 14px;
  margin: 0;
}

.materials-quick-sort-column__head span {
  color: var(--resource-muted);
  font-size: 12px;
}

.materials-quick-sort-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow: auto;
  padding: 8px;
}

.materials-quick-sort-item {
  align-items: center;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 9px;
  color: var(--resource-text);
  cursor: grab;
  display: flex;
  gap: 8px;
  min-height: 42px;
  padding: 7px 9px;
  text-align: left;
  width: 100%;
}

.materials-quick-sort-item:hover,
.materials-quick-sort-item.is-selected {
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.12);
}

.materials-quick-sort-item.is-dragging {
  opacity: 0.48;
}

.materials-quick-sort-item.is-editing {
  cursor: text;
}

.materials-quick-sort-item.is-virtual {
  background: #f8fafc;
}

.materials-quick-sort-item__handle {
  color: var(--resource-muted);
  flex: 0 0 auto;
  font-size: 14px;
}

.materials-quick-sort-item__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.materials-quick-sort-item__text strong,
.materials-quick-sort-item__text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.materials-quick-sort-item__text strong {
  font-size: 13px;
  line-height: 1.25;
}

.materials-quick-sort-item__text small {
  color: var(--resource-muted);
  font-size: 11px;
}

.materials-quick-sort-edit-input {
  border: 1px solid #10b981;
  border-radius: 7px;
  color: var(--resource-text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  min-width: 0;
  outline: none;
  padding: 5px 7px;
  width: 100%;
}

.resource-prompt-textarea {
  min-height: 220px;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.6;
}

.resource-prompt-textarea--small {
  min-height: 180px;
}

.materials-admin-table--lessons {
  min-width: 1320px;
}

.materials-asset-summary,
.materials-asset-links {
  margin-top: 12px;
}

.materials-asset-pill {
  margin-right: 8px;
  margin-bottom: 8px;
}

.materials-asset-pill--ready {
  background: #dcfce7;
  color: #166534;
}

.materials-asset-pill--failed,
.materials-asset-pill--partial_failed {
  background: #fee2e2;
  color: #991b1b;
}

.materials-asset-pill--processing,
.materials-asset-pill--queued {
  background: #e0f2fe;
  color: #075985;
}

.materials-admin-link-list--inline {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
}

.character-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
}

.character-list-card {
  border: 1px solid var(--resource-border);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faf9 100%);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
  padding: 16px;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
}

.character-list-card__preview {
  width: 120px;
  height: 120px;
  border-radius: 18px;
  background: linear-gradient(135deg, #e5efe9 0%, #fef3c7 100%);
  border: 1px solid var(--resource-border);
  overflow: hidden;
}

.character-list-card__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.character-list-card__preview-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #1e293b;
}

.character-list-card__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.character-list-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.character-list-card__head h4 {
  margin: 0;
  font-size: 20px;
  color: #0f172a;
}

.character-list-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.resource-pill--muted {
  background: #e5e7eb;
  color: #4b5563;
}

.resource-pill--published {
  background: #dcfce7;
  color: #166534;
}

.character-admin-card__key {
  background: #f0fdf4;
  color: #059669;
}

.character-list-card__desc {
  margin: 0;
  color: var(--resource-muted);
  line-height: 1.6;
}

.character-list-card__summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  color: #475569;
  font-size: 13px;
}

.character-list-card__actions {
  justify-content: flex-end;
}

.character-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.character-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
}

.character-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: 16px auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.character-modal__header,
.character-modal__footer {
  padding: 20px 22px;
  border-bottom: 1px solid var(--resource-border);
  background: #fff;
}

.character-modal__footer {
  border-top: 1px solid var(--resource-border);
  border-bottom: 0;
  display: flex;
  justify-content: flex-end;
}

.character-modal__subtitle {
  margin: 8px 0 0;
  color: var(--resource-muted);
  line-height: 1.6;
}

.character-modal__body {
  padding: 22px;
  overflow: auto;
  background: linear-gradient(180deg, #fbfdff 0%, #f8fafc 100%);
}

.character-editor-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
}

.character-preview-panel,
.character-editor-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.character-preview-card,
.character-upload-panel,
.character-emotion-section,
.character-editor-panel > .resource-field,
.character-editor-grid {
  border: 1px solid var(--resource-border);
  border-radius: 16px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
}

.character-preview-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.character-preview-card__avatar,
.character-upload-preview {
  width: 100%;
  min-height: 180px;
  border-radius: 18px;
  border: 1px dashed #cbd5e1;
  background: linear-gradient(135deg, #ecfdf5 0%, #fff7ed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #334155;
  font-size: 28px;
  font-weight: 700;
}

.character-preview-card__avatar img,
.character-upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.character-preview-card__copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.character-preview-card__copy strong {
  font-size: 22px;
  color: #0f172a;
}

.character-preview-card__copy span {
  color: var(--resource-muted);
}

.character-preview-help {
  padding: 16px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid var(--resource-border);
  color: var(--resource-muted);
  line-height: 1.7;
}

.character-preview-help p {
  margin: 0;
}

.character-preview-help p + p {
  margin-top: 10px;
}

.character-editor-grid {
  align-items: start;
}

.character-upload-panel__head,
.character-emotion-section__head {
  padding: 0;
  margin-bottom: 14px;
}

.character-upload-panel__head h4,
.character-emotion-section__head h4 {
  margin: 0;
  color: #0f172a;
}

.character-upload-panel__head p,
.character-emotion-section__head p {
  margin: 6px 0 0;
  color: var(--resource-muted);
  line-height: 1.6;
}

.character-upload-panel__body {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.character-emotion-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.character-emotion-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr) 160px auto;
  gap: 12px;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #fbfdff;
  align-items: end;
}

.character-emotion-row__image-field {
  min-width: 0;
}

.character-emotion-row__preview {
  min-height: 112px;
  border-radius: 14px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--resource-muted);
}

.character-emotion-row__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.character-emotion-row__actions {
  flex-direction: column;
  align-items: stretch;
}

.character-emotion-empty {
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f7faf9;
  color: var(--resource-muted);
}

.materials-order-actions {
  align-items: flex-start;
}

.micro-gif-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
}

.micro-gif-preview-panel,
.micro-gif-config-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.micro-gif-preview-card,
.micro-gif-config-grid,
.micro-gif-meta-card,
.micro-gif-notes {
  border: 1px solid var(--resource-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
}

.micro-gif-preview-card {
  padding: 16px;
}

.micro-gif-preview-card__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.micro-gif-preview-box {
  min-height: 280px;
  border-radius: 18px;
  border: 1px dashed #cbd5e1;
  background: linear-gradient(135deg, #ecfdf5 0%, #fff7ed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #475569;
  padding: 10px;
  text-align: center;
}

.micro-gif-preview-box--result {
  background: linear-gradient(135deg, #fefce8 0%, #ecfdf5 100%);
}

.micro-gif-preview-box img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 14px;
}

.micro-gif-config-grid {
  padding: 16px;
  margin-top: 0;
}

.micro-gif-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.micro-gif-meta-card {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.micro-gif-meta-card span {
  color: var(--resource-muted);
  font-size: 12px;
}

.micro-gif-meta-card strong {
  color: #172033;
  line-height: 1.6;
}

.micro-gif-notes {
  padding: 16px 18px;
}

.micro-gif-notes strong {
  display: block;
  color: #172033;
  margin-bottom: 8px;
}

.micro-gif-notes ul {
  margin: 0;
  padding-left: 18px;
  color: var(--resource-muted);
  line-height: 1.8;
}

.micro-gif-result-meta {
  min-height: 108px;
}

.micro-gif-result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.micro-gif-result-card {
  border: 1px solid var(--resource-border);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.micro-gif-result-card span {
  color: var(--resource-muted);
  font-size: 12px;
}

.micro-gif-result-card strong,
.micro-gif-result-card a {
  color: #172033;
  word-break: break-all;
  line-height: 1.6;
}

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

  .page-wrapper {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .resource-hero-card {
    flex-direction: column;
  }

  .resource-hero-stats,
  .resource-filter-grid,
  .resource-inline-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }

  .materials-create-grid,
  .materials-filter-grid--lessons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tag-form-grid {
    grid-template-columns: 1fr;
  }

  .user-tag-form-grid,
  .user-tag-groups {
    grid-template-columns: 1fr;
  }

  .user-tag-form-actions,
  .user-tag-node-main {
    align-items: stretch;
    flex-direction: column;
  }

  .user-edit-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-edit-form-grid .user-tags-field {
    grid-column: 1 / -1;
  }

  .user-edit-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .invitation-add-grid {
    grid-template-columns: 1fr;
  }

  .character-list-grid {
    grid-template-columns: 1fr;
  }

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

  .character-upload-panel__body {
    grid-template-columns: 1fr;
  }

  .character-emotion-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .micro-gif-layout {
    grid-template-columns: 1fr;
  }

  .micro-gif-result-grid,
  .micro-gif-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .main-content {
    padding: 12px;
  }

  .materials-shell,
  .resource-shell {
    padding: 12px;
  }

  .resource-hero-stats,
  .resource-filter-grid,
  .resource-inline-grid {
    grid-template-columns: 1fr;
  }

  .character-list-card {
    grid-template-columns: 1fr;
  }

  .character-list-card__preview {
    width: 100%;
  }

  .character-modal__dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    margin: 8px auto;
  }

  .character-modal__body,
  .character-modal__header,
  .character-modal__footer {
    padding: 14px;
  }

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

  .micro-gif-result-grid,
  .micro-gif-meta-grid {
    grid-template-columns: 1fr;
  }

  .materials-create-grid,
  .materials-filter-grid--lessons {
    grid-template-columns: 1fr;
  }

  .resource-table {
    min-width: 860px;
  }

  .user-edit-form-grid,
  .user-edit-identity,
  .user-edit-detail-grid,
  .invitation-add-grid {
    grid-template-columns: 1fr;
  }

  .user-edit-modal-actions {
    width: 100%;
    margin-left: 0;
  }

  .user-edit-modal-actions .resource-danger-btn {
    width: 100%;
  }
}
.parser-filter-grid {
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 1.2fr) minmax(180px, 1.2fr) auto;
}

.parser-main-actions {
  align-content: flex-start;
}

.parser-actions-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.parser-status-line {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.parser-ai-prompt {
  display: grid;
  gap: 6px;
  max-width: 520px;
  padding: 10px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #f9fafb;
}

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

.parser-ai-prompt-head strong {
  color: #101828;
  font-size: 13px;
}

.parser-ai-prompt-head span {
  color: #667085;
  font-size: 12px;
  text-align: right;
}

.parser-ai-prompt-textarea {
  width: 100%;
  min-height: 136px;
  padding: 8px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  color: #344054;
  background: #fff;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  resize: vertical;
}

.parser-control-bottom {
  display: grid;
  grid-template-columns: minmax(360px, max-content) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 12px;
}

.parser-control-bottom .parser-page-browser {
  grid-column: 1 / -1;
}

.parser-error {
  color: #b42318;
  font-size: 13px;
}

.parser-progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  max-width: min(420px, 100%);
  padding: 4px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  color: #344054;
  background: #f9fafb;
  font-size: 13px;
  line-height: 20px;
  overflow-wrap: anywhere;
}

.parser-progress.is-active {
  border-color: #86efac;
  color: #047857;
  background: #ecfdf5;
}

.parser-progress.is-failed {
  border-color: #fecdca;
  color: #b42318;
  background: #fef3f2;
}

.parser-progress-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: currentColor;
}

.parser-page-browser {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.parser-main-range-control {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  min-width: 0;
}

.parser-main-range-control label {
  display: grid;
  gap: 4px;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

.parser-main-range-control input {
  width: 96px;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  color: #101828;
  background: #fff;
  font-size: 14px;
}

.parser-main-range-quick-list {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
}

.parser-main-range-quick {
  width: 38px;
  min-height: 38px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  color: #344054;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.parser-main-range-quick:hover:not(:disabled) {
  border-color: #059669;
  color: #047857;
  background: #ecfdf5;
}

.parser-main-range-quick:disabled {
  color: #98a2b3;
  background: #f2f4f7;
  cursor: not-allowed;
}

.parser-page-thumbs {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  min-height: 88px;
  padding: 8px;
  border: 1px solid #eaecf0;
  border-radius: 8px;
  background: #fff;
  overflow-x: auto;
  overflow-y: visible;
}

.parser-page-thumbs--empty {
  align-items: center;
  justify-content: center;
  color: #98a2b3;
  font-size: 13px;
}

.parser-page-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 160px;
  margin: 0;
  text-align: center;
  cursor: pointer;
}

.parser-page-thumb-separator {
  align-self: center;
  flex: 0 0 auto;
  min-width: 44px;
  color: #98a2b3;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.parser-page-thumb > img {
  display: block;
  width: 100%;
  height: 240px;
  max-width: none;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #f8fafc;
  object-fit: contain;
}

.parser-page-thumb:hover > img,
.parser-page-thumb:focus-visible > img {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

.parser-page-thumb.is-main-boundary > img {
  border-color: #12b76a;
  box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.18);
}

.parser-page-thumb:focus-visible {
  outline: none;
}

.parser-page-thumb figcaption {
  margin-top: 6px;
  color: #475467;
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
}

.parser-page-thumb-pop {
  position: absolute;
  z-index: 30;
  left: 50%;
  top: calc(100% + 8px);
  display: none;
  width: min(420px, 70vw);
  padding: 8px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(16, 24, 40, 0.2);
  transform: translateX(-50%);
  pointer-events: none;
}

.parser-page-thumb-pop img {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.parser-page-thumb-pop span {
  display: block;
  margin-top: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

.parser-page-thumb:hover {
  z-index: 31;
}

.parser-page-thumb:hover .parser-page-thumb-pop {
  display: block;
}

.parser-workspace {
  width: 100%;
}

.parser-pages-card .resource-table-wrap {
  overflow-x: hidden;
}

.parser-pages-table {
  table-layout: fixed;
  width: 100%;
}

.parser-pages-table th:nth-child(1) {
  width: 64px;
}

.parser-pages-table th:nth-child(2) {
  width: 170px;
}

.parser-pages-table th:nth-child(3) {
  width: 150px;
}

.parser-pages-table th:nth-child(4) {
  width: 50px;
}

.parser-pages-table th:nth-child(5) {
  width: auto;
}

.parser-pages-table td {
  vertical-align: top;
  overflow-wrap: anywhere;
}

.parser-non-main-page {
  opacity: 0.74;
}

.parser-page-main-label,
.parser-page-non-main-label {
  font-size: 13px;
  font-weight: 600;
}

.parser-page-main-label {
  color: #039855;
}

.parser-page-non-main-label {
  color: #667085;
}

.parser-keyword-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  margin: 0 6px 6px 0;
  padding: 2px 8px;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  color: #047857;
  background: #ecfdf5;
  font-size: 12px;
  line-height: 18px;
  word-break: break-word;
}

.parser-image-button {
  display: block;
  width: 100%;
  min-height: 96px;
  padding: 0;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
}

.parser-image-button img {
  width: 100%;
  height: auto;
  display: block;
}

.parser-lesson-page-image {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.parser-lesson-page-image img {
  display: block;
  width: 100%;
  height: auto;
}

.parser-sentence-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.parser-sentence-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

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

.parser-sentence-index {
  color: #667085;
  font-size: 13px;
  line-height: 34px;
}

.parser-sentence-text {
  min-height: 44px;
  resize: vertical;
  width: 100%;
  min-width: 0;
}

.parser-sentence-actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.parser-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(16, 24, 40, 0.56);
}

.parser-crop-modal {
  width: min(960px, 96vw);
  max-height: 92vh;
  padding: 16px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 48px rgba(16, 24, 40, 0.24);
}

.parser-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.parser-crop-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 420px;
  max-height: 70vh;
  overflow: hidden;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #101828;
  touch-action: none;
}

.parser-crop-stage img {
  max-width: 100%;
  max-height: 70vh;
  user-select: none;
  pointer-events: none;
}

.parser-crop-box {
  position: absolute;
  border: 2px solid #12b76a;
  background: rgba(18, 183, 106, 0.12);
  box-shadow: 0 0 0 9999px rgba(16, 24, 40, 0.32);
}

@media (max-width: 1100px) {
  .parser-control-bottom {
    grid-template-columns: 1fr;
  }

  .parser-filter-grid {
    grid-template-columns: 1fr;
  }
}
