:root {
  --af-bg: #f3f5f9;
  --af-panel: #ffffff;
  --af-text: #111827;
  --af-muted: #6b7280;
  --af-border: #e5e7eb;
  --af-primary: #2563eb;
  --af-primary-soft: #eff6ff;
  --af-success: #059669;
  --af-warn: #d97706;
  --af-danger: #dc2626;
  --af-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --af-radius: 10px;
  --af-font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body.af-page {
  margin: 0;
  font-family: var(--af-font);
  color: var(--af-text);
  background: var(--af-bg);
  min-width: 0;
}

.af-pageWrap {
  padding: 18px;
}

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

.af-pageTitle {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.af-pageSub {
  margin: 6px 0 0;
  color: var(--af-muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.af-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--af-border);
  background: #fff;
  color: var(--af-text);
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

.af-btn:hover {
  background: #f9fafb;
}

.af-btn-primary {
  border-color: #93c5fd;
  background: var(--af-primary);
  color: #fff;
}

.af-btn-primary:hover {
  background: #1d4ed8;
}

.af-btn-danger {
  border-color: #fecaca;
  color: var(--af-danger);
}

.af-btn-ghost {
  background: transparent;
}

.af-card {
  background: var(--af-panel);
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius);
  box-shadow: var(--af-shadow);
}

.af-cardPad {
  padding: 16px;
}

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

.af-stat {
  padding: 14px 16px;
}

.af-statNum {
  font-size: 28px;
  font-weight: 900;
}

.af-statLbl {
  margin-top: 4px;
  color: var(--af-muted);
  font-size: 12px;
}

.af-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.af-input,
.af-select,
.af-textarea {
  width: 100%;
  border: 1px solid #cfd7ea;
  border-radius: 9px;
  background: #fff;
  color: var(--af-text);
  font-size: 14px;
  outline: none;
}

.af-input,
.af-select {
  height: 38px;
  padding: 0 12px;
}

.af-textarea {
  padding: 10px 12px;
  resize: vertical;
}

.af-input:focus,
.af-select:focus,
.af-textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.af-search {
  flex: 1;
  min-width: 220px;
}

.af-tableWrap {
  overflow: auto;
}

.af-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.af-table th,
.af-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--af-border);
  text-align: left;
  white-space: nowrap;
}

.af-table .character-appearance-desc {
  width: 28%;
  min-width: 220px;
  max-width: 360px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.5;
}

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

.af-table tbody tr:hover {
  background: #f8fafc;
}

.af-table .voc-sticky-col {
  position: sticky;
  background: #fff;
  z-index: 2;
}

.af-table th.voc-sticky-col {
  background: #f8fafc;
  z-index: 3;
}

.af-table .voc-sticky-type {
  left: 0;
  min-width: 86px;
  width: 86px;
}

.af-table .voc-sticky-term {
  left: 86px;
  min-width: 180px;
  width: 180px;
  box-shadow: 8px 0 12px -12px rgba(15, 23, 42, 0.42);
}

.af-table tbody tr:hover .voc-sticky-col {
  background: #f8fafc;
}

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

.af-pageActions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.af-pageBtn {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--af-border);
  background: #fff;
  color: var(--af-text);
  cursor: pointer;
}

.af-pageBtn:hover:not(:disabled) {
  background: #f8fafc;
}

.af-pageBtn:disabled {
  color: #cbd5e1;
  cursor: not-allowed;
}

.af-pageCurrent {
  min-width: 58px;
  text-align: center;
  color: var(--af-text);
}

.af-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--af-border);
}

.af-badge.ok {
  color: var(--af-success);
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.af-badge.warn {
  color: var(--af-warn);
  border-color: #fde68a;
  background: #fffbeb;
}

.af-badge.muted {
  color: var(--af-muted);
}

.af-formGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.af-field {
  display: grid;
  gap: 6px;
}

.af-field.full {
  grid-column: 1 / -1;
}

.af-label {
  font-size: 12px;
  color: var(--af-muted);
  font-weight: 700;
}

.af-hint {
  font-size: 12px;
  color: var(--af-muted);
  margin-bottom: 12px;
}

.af-empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--af-muted);
}

.af-emptyTitle {
  font-weight: 800;
  color: var(--af-text);
}

.af-emptySub {
  margin-top: 6px;
  font-size: 13px;
}

.af-msg {
  margin-top: 10px;
  font-size: 13px;
  min-height: 18px;
}

.af-msg.ok {
  color: var(--af-success);
}

.af-msg.err {
  color: var(--af-danger);
}

.af-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 80;
  overflow: auto;
}

.af-mask.af-mask-open {
  display: flex;
}

.af-modal {
  width: min(560px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--af-border);
  box-shadow: var(--af-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.af-modal > form {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.af-modalHead {
  padding: 12px 14px;
  border-bottom: 1px solid var(--af-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 800;
  flex: 0 0 auto;
}

.af-modalBody {
  padding: 14px;
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
}

.af-modalFoot {
  padding: 0 14px 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  background: #fff;
}

@supports (height: 100dvh) {
  .af-modal {
    max-height: calc(100dvh - 36px);
  }
}

@media (max-width: 920px) {
  .af-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .af-formGrid {
    grid-template-columns: 1fr;
  }
  .af-pageHead {
    align-items: stretch;
  }
  .af-toolbar .af-input,
  .af-toolbar .af-select,
  .af-toolbar .af-btn {
    flex: 1 1 180px;
  }
}

@media (max-width: 560px) {
  .af-pageWrap {
    padding: 12px;
  }
  .af-grid-4 {
    grid-template-columns: 1fr;
  }
  .af-pageHead {
    flex-direction: column;
  }
  .af-actions,
  .af-toolbar,
  .af-modalFoot {
    width: 100%;
  }
  .af-actions .af-btn,
  .af-toolbar .af-input,
  .af-toolbar .af-select,
  .af-toolbar .af-btn,
  .af-modalFoot .af-btn {
    width: 100%;
    flex: 1 1 100%;
  }
  .af-mask {
    align-items: stretch;
    padding: 10px;
  }
  .af-modal {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    border-radius: 10px;
  }
  .af-modalHead,
  .af-modalBody,
  .af-modalFoot {
    padding-left: 12px;
    padding-right: 12px;
  }
  .af-pagination {
    align-items: stretch;
    flex-direction: column;
  }
  .af-pageActions {
    justify-content: space-between;
  }
}

@supports (height: 100dvh) {
  @media (max-width: 560px) {
    .af-modal {
      max-height: calc(100dvh - 20px);
    }
  }
}
