@import url("./css/variables.css");
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background-color: #f5f7fb;
  min-height: 100vh;
}

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-dark-bg);
  border-right: 1px solid var(--sidebar-dark-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transform: translateX(-100%);
  transition: var(--sidebar-transition);
}

@media (min-width: 768px) {
  .app-sidebar {
    position: static;
    transform: none;
  }
}

.app-sidebar.mobile-open {
  transform: translateX(0);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s linear;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 768px) {
  .sidebar-overlay {
    display: none;
  }
}

.app-sidebar #sidebarHeader,
.app-sidebar #sidebarHeader .nav-text {
  color: var(--sidebar-dark-text-hover);
}

.app-sidebar .nav-section-title {
  color: var(--sidebar-dark-text-muted) !important;
}

.nav-list {
  flex: 1;
  padding: 0.75rem 0.75rem 1rem;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  text-decoration: none;
  padding: var(--sidebar-nav-item-padding);
  color: var(--sidebar-dark-text);
  border-radius: var(--radius-lg);
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: var(--sidebar-nav-item-font-size);
  margin-bottom: 0.25rem;
  user-select: none;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-dark-text-hover);
}

.nav-item.active {
  background-color: var(--sidebar-dark-active-bg);
  color: var(--sidebar-dark-active-text);
  font-weight: 600;
}

.nav-item .nav-icon {
  margin-right: 0.75rem;
  font-size: 1.25rem;
  color: var(--sidebar-dark-icon);
  transition: color 0.2s ease;
}

.nav-item:hover .nav-icon {
  color: var(--sidebar-dark-text-hover);
}

.nav-item.active .nav-icon {
  color: var(--sidebar-dark-icon-active);
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--sidebar-dark-border);
}

.app-main {
  flex: 1;
  overflow: hidden;
  position: relative;
  width: 100%;
  background-color: #f5f7fb;
  display: flex;
  flex-direction: column;
}

.mobile-top-header {
  border-bottom: 1px solid var(--sidebar-dark-border);
  background-color: var(--sidebar-dark-bg-header);
}

.app-main-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  padding: 0.7rem 1rem 0;
  background: linear-gradient(180deg, #f5f7fb 78%, rgba(245, 247, 251, 0));
}

.app-topbar-inner {
  max-width: 88rem;
  margin: 0 auto;
  display: flex;
  justify-content: flex-end;
}

.user-menu {
  position: relative;
}

.user-menu-trigger {
  border: 1px solid #d9e2ee;
  background: #ffffff;
  color: #1f2937;
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 12px;
}

.user-menu-label {
  color: #64748b;
}

.user-menu-trigger strong {
  font-size: 12px;
  font-weight: 600;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 160px;
  border: 1px solid #d9e2ee;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.user-menu-item {
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  text-align: left;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
}

.user-menu-item:hover {
  background: #f1f5f9;
}

.user-menu-item.danger {
  color: #b91c1c;
}

.profile-balance-card {
  background: linear-gradient(135deg, #f8fbff, #eef4ff);
}

.profile-balance-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.profile-balance-label {
  margin: 0;
  color: #64748b;
  font-size: 13px;
}

.profile-balance-value {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.profile-balance-value strong {
  font-size: 34px;
  line-height: 1;
  color: #1e3a8a;
}

.profile-balance-value span {
  color: #334155;
  font-weight: 600;
}

.profile-balance-sub {
  margin: 0.35rem 0 0;
  font-size: 12px;
  color: #64748b;
}

.profile-recharge-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
}

@media (min-width: 980px) {
  .profile-recharge-grid {
    grid-template-columns: 1fr;
  }
}

.recharge-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.recharge-preset {
  border: 1px solid #cfdcf0;
  background: #fff;
  color: #334155;
  border-radius: 10px;
  padding: 0.48rem 0.75rem;
  font-size: 13px;
  cursor: pointer;
}

.recharge-preset.active {
  border-color: #4f7cff;
  color: #1d4ed8;
  background: #eff4ff;
}

.credit-balance-line {
  margin: 0 0 0.85rem;
  color: #475569;
  font-size: 15px;
}

.credit-balance-line strong {
  color: #111827;
}

.credit-pack-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.credit-pack {
  position: relative;
  border: 1px solid #d7deea;
  background: #f6f8fc;
  border-radius: 12px;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
  align-items: center;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.15s ease;
}

.credit-pack-price {
  font-size: 21px;
  font-weight: 700;
  color: inherit;
}

.credit-pack-points {
  font-size: 12px;
  color: inherit;
}

.credit-pack-points em {
  font-style: normal;
  font-weight: 600;
}

.credit-pack.active {
  border-color: #6a5ce3;
  background: #fff;
  color: #5a4bc8;
  box-shadow: inset 0 0 0 1px rgba(106, 92, 227, 0.14);
}

.credit-pack:hover {
  border-color: #c6d1e6;
}

.profile-pay-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.btn-pay {
  border: 1px solid transparent;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 0.62rem 0.95rem;
  min-width: 128px;
  cursor: pointer;
  box-shadow: none;
  transition: filter 0.15s ease;
}

.btn-pay-alipay {
  background: linear-gradient(180deg, #2f9bff, #1684eb);
}

.btn-pay-wechat {
  background: linear-gradient(180deg, #45b95d, #2f9f49);
}

.btn-pay:hover {
  filter: brightness(1.03);
}

.btn-pay:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.credit-notes {
  margin-top: 0.85rem;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.75;
}

.credit-notes p {
  margin: 0;
}

@media (min-width: 980px) {
  .credit-pack-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.credit-pack-custom {
  align-items: stretch;
  justify-content: center;
  padding: 0.65rem 0.75rem;
  cursor: default;
  gap: 0.3rem;
}

.credit-pack-custom .field-label {
  font-size: 12px;
  color: #475569 !important;
}

.credit-pack-custom input {
  width: 100%;
  border: 1px solid #d4deed !important;
  border-radius: 8px;
  padding: 0.42rem 0.55rem;
  font-size: 13px;
  background: #fff !important;
  color: #0f172a !important;
}

.recharge-panel {
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}

.profile-recharge-action {
  display: flex;
  justify-content: flex-end;
}

.profile-orders-wrap {
  overflow-x: auto;
}

.custom-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--sidebar-dark-border);
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

#mainAppContainer {
  max-width: 88rem;
  margin-left: auto;
  margin-right: auto;
  padding: 1.25rem 1rem 2rem;
}

.view-page[hidden] {
  display: none !important;
}

@media (min-width: 768px) {
  #mainAppContainer {
    padding: 1.5rem 1.5rem 2.25rem;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.workspace-header {
  background: #ffffff;
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid #e6ebf2;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}


.workspace-header::before {
  content: none;
  position: absolute;
  top: -30%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.workspace-header-content {
  position: relative;
  z-index: 1;
  max-width: 640px;
}

.workspace-header h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1f2937 !important;
}

.workspace-header .workspace-lead {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #6b7280 !important;
}

.user-chip {
  position: relative;
  z-index: 1;
  background: #f3f6fb;
  border: 1px solid #e8edf5;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  min-width: 0;
}

.user-chip span {
  display: block;
  font-size: 11px;
  color: #9aa8bc;
}

.user-chip strong {
  color: #3b4a5f;
  font-weight: 500;
  font-size: 14px;
}

.space-y-6 > * + * {
  margin-top: 1.5rem;
}

.modern-card {
  background: #ffffff;
  border: 1px solid #e6ebf2;
  box-shadow: none;
  border-radius: var(--radius-xl);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
  padding: 1.25rem 1.5rem;
}

@media (min-width: 768px) {
  .modern-card {
    padding: 1.5rem 1.75rem;
  }
}

.modern-card:hover {
  border-color: #d9e2ee;
}

.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eef2f7;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.section-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: #1f2937 !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.section-title-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-xl);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#mainAppContainer label,
#mainAppContainer .field-label {
  color: #475569 !important;
}

#mainAppContainer select {
  background-color: #fff !important;
  border: 1px solid #d9e2ee !important;
  color: #1f2937 !important;
  border-radius: var(--radius-lg);
  padding: 0.625rem 0.875rem;
  font-size: var(--font-size-sm);
  width: 100%;
  cursor: pointer;
}

#mainAppContainer select option {
  background-color: #f8fbff;
  color: #1f2937;
}

#mainAppContainer select option:checked {
  background-color: #e8f0ff;
  color: #1e40af;
}

#mainAppContainer select:focus {
  outline: 2px solid transparent;
  border-color: var(--sidebar-dark-active-text) !important;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

#mainAppContainer input[type="text"],
#mainAppContainer input[type="password"],
#mainAppContainer input[type="email"],
#mainAppContainer input[type="number"],
#mainAppContainer textarea,
#mainAppContainer input[type="file"] {
  background-color: #fff !important;
  border: 1px solid #d9e2ee !important;
  color: #1f2937 !important;
  border-radius: var(--radius-lg);
  padding: 0.625rem 0.875rem;
  font-size: var(--font-size-sm);
  width: 100%;
}

#mainAppContainer input:focus {
  outline: 2px solid transparent;
  outline-offset: 0;
  border-color: var(--sidebar-dark-active-text) !important;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

#mainAppContainer textarea {
  resize: vertical;
  min-height: 88px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.field-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.inline-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  flex-direction: row;
}

.checkbox-field {
  margin-bottom: 0.75rem;
}

.config-hint {
  font-size: var(--font-size-sm);
  color: #6b7280;
  margin: 0 0 1rem;
  line-height: 1.5;
}

.db-source-block {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eef2f7;
}

.db-source-block .field {
  margin-bottom: 0.75rem;
}

.actions-field {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
}

.section-header-tight {
  margin-bottom: 0.5rem;
}

.section-subtitle {
  margin: 0;
  font-size: var(--font-size-base);
  color: var(--sidebar-dark-text-hover);
}

.site-info-card {
  border: 1px solid var(--sidebar-dark-border);
  border-radius: var(--radius-lg);
  padding: 0.75rem 0.9rem;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 0.85rem;
  color: var(--sidebar-dark-text);
  font-size: var(--font-size-sm);
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.3rem;
}

.site-key-manager {
  border: 1px solid var(--sidebar-dark-border);
  border-radius: var(--radius-lg);
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 1rem;
}

.site-key-manager.disabled {
  opacity: 0.6;
  pointer-events: none;
}

.site-key-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

.key-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--sidebar-dark-border);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.55rem;
}

.key-main {
  flex: 1;
  color: var(--sidebar-dark-text-hover);
  font-size: var(--font-size-sm);
}

.key-status {
  color: var(--sidebar-dark-text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.key-empty {
  color: var(--sidebar-dark-text-muted);
  font-size: var(--font-size-sm);
  padding: 0.3rem 0;
}

.key-editor-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .key-editor-grid {
    grid-template-columns: 2fr 1fr;
  }
}

.key-actions {
  margin-top: 0.7rem;
  display: flex;
  justify-content: flex-end;
}

.quick-translate-picker {
  margin-bottom: 1rem;
  padding: 0.875rem;
  border: 1px solid #d9e2ee;
  border-radius: var(--radius-xl);
  background: #f8fafc;
}

.quick-translate-title {
  color: #1f2937;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  margin-bottom: 0.75rem;
}

.quick-translate-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .quick-translate-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.upload-zone-modern {
  border: 2px dashed #d2dbe8;
  border-radius: var(--radius-xl);
  background-color: #fafcff;
  transition: all 0.2s ease;
  padding: 1.25rem;
}

.upload-zone-modern:hover {
  border-color: #7aa5ff;
  background-color: #f2f7ff;
}

.upload-zone-modern.drag-over {
  border-color: #4f7cff;
  background-color: #eaf2ff;
}

.upload-zone-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
}

.upload-zone-center .field-label {
  font-weight: 600;
  color: #334155 !important;
}

.upload-file-icons {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.upload-file-icon-svg {
  filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.12));
}

.upload-picker-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.btn-pick-file {
  background: linear-gradient(180deg, #4f7cff, #3f67ef);
  color: #fff;
  min-width: 180px;
  border-radius: 8px;
  box-shadow: 0 8px 16px rgba(79, 124, 255, 0.22);
}

.btn-pick-file:hover {
  background: linear-gradient(180deg, #5c87ff, #4b72f3);
}

.file-picked-name {
  font-size: 12px;
  color: #64748b;
}

.file-input-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.upload-tips {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  color: #94a3b8;
  font-size: 12px;
}

.workspace-translate-panel {
  margin-top: 0.9rem;
  border: 1px solid #e5eaf3;
  border-radius: 12px;
  background: #ffffff;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.upload-zone-center .workspace-translate-panel {
  width: 100%;
  align-self: stretch;
  text-align: left;
}

.workspace-translate-filebar {
  border: 1px solid #e6edf8;
  border-radius: 10px;
  background: #f8fbff;
  padding: 0.65rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.workspace-picked-file-row {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  color: #334155;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-all;
}

.workspace-picked-file-name {
  color: #1f2937;
  font-weight: 600;
}

.workspace-picked-file-actions {
  display: flex;
  justify-content: flex-start;
}

.workspace-translate-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.workspace-translate-controls .field {
  margin-bottom: 0;
}

.workspace-translate-controls .field-inline-toggle {
  grid-column: 1 / -1;
}

.workspace-translate-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.1rem;
  gap: 0.45rem;
}

.workspace-glossary-box {
  margin-top: 0.55rem;
  border: 1px solid #e6edf7;
  border-radius: 10px;
  padding: 0.65rem 0.7rem;
  background: #f8fbff;
}

.workspace-glossary-select-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: end;
  margin-top: 0.45rem;
}

.workspace-translate-controls .workspace-glossary-box {
  grid-column: 1 / -1;
}

.workspace-glossary-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.15rem;
}

#workspaceGlossarySetSelect {
  min-height: 2.5rem;
  max-width: 100%;
}

.glossary-panel {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0.8rem;
}

.glossary-sidebar {
  border: 1px solid #e6edf7;
  border-radius: 10px;
  background: #f8fbff;
  min-height: 320px;
}

.glossary-sidebar-list {
  padding: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.glossary-side-item {
  width: 100%;
  text-align: left;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  padding: 0.48rem 0.56rem;
  cursor: pointer;
}

.glossary-side-item.active {
  border-color: #6366f1;
  background: #eef2ff;
}

.glossary-side-name {
  font-size: 13px;
  color: #1f2937;
  font-weight: 600;
}

.glossary-side-meta {
  margin-top: 0.15rem;
  font-size: 12px;
  color: #64748b;
}

.glossary-editor {
  border: 1px solid #e6edf7;
  border-radius: 10px;
  background: #fff;
  padding: 0.7rem;
}

.glossary-empty-state {
  border: 1px dashed #d8dbe3;
  border-radius: 12px;
  background: #f8f8fb;
  padding: 1.2rem 1rem;
  text-align: center;
  color: #6b7280;
}

.glossary-empty-state h3 {
  margin: 0.45rem 0 0.6rem;
  font-size: 20px;
  color: #374151;
}

.glossary-empty-state p {
  margin: 0.2rem 0;
  font-size: 13px;
}

.glossary-empty-actions {
  margin-top: 0.9rem;
  display: flex;
  justify-content: center;
  gap: 0.6rem;
}

/* 添加术语 / 创建术语表：仅居中白卡片，背后无蒙层色（透明点击层可点空白关闭） */
.task-detail-modal.glossary-add-modal-root {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  box-sizing: border-box;
  min-height: 100dvh;
}

.task-detail-modal.glossary-add-modal-root .task-detail-modal-mask {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
  align-self: stretch;
  justify-self: stretch;
}

.glossary-meta-modal__enabled {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.glossary-meta-modal__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  user-select: none;
}

.glossary-meta-modal__toggle input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: #6d28d9;
  flex-shrink: 0;
}

.glossary-meta-lang-select {
  width: 100%;
  max-width: 100%;
}

.glossary-modal-panel.glossary-add-modal {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  z-index: 1;
  max-width: 480px;
  width: min(480px, calc(100vw - 2rem));
  margin: 0 !important;
  max-height: min(92dvh, 640px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: none;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.14);
  background: #fff;
}

.glossary-modal-panel.glossary-add-modal.glossary-meta-modal {
  max-width: 420px;
  width: min(420px, calc(100vw - 2rem));
}

.glossary-add-modal-mask {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  cursor: default;
}

.glossary-add-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  background: #fff;
  border-bottom: 1px solid #f0f0f3;
  flex-shrink: 0;
}

.glossary-add-modal__header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.01em;
}

.glossary-add-modal__close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    transform 0.12s ease;
}

.glossary-add-modal__close:hover {
  background: #f3f4f6;
  color: #4b5563;
}

.glossary-add-modal__close:active {
  transform: scale(0.96);
}

.glossary-add-modal__inner {
  padding: 1rem 1.15rem 1.1rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.glossary-add-modal__inner--sheet {
  padding-top: 0.75rem;
}

.glossary-modal-sheet-hint {
  margin: 0 0 0.85rem;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.45;
}

.glossary-modal-term-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}

.glossary-modal-term-table th {
  text-align: left;
  padding: 0.55rem 0.7rem;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  color: #374151;
  font-weight: 600;
}

.glossary-modal-term-table td {
  padding: 0.55rem;
  vertical-align: middle;
}

.glossary-modal-term-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.6rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  background: #fafafa;
  color: #111827;
}

.glossary-modal-term-input:focus {
  outline: none;
  border-color: #a78bfa;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.glossary-modal-lang-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

@media (max-width: 520px) {
  .glossary-modal-lang-row {
    grid-template-columns: 1fr;
  }
}

.glossary-modal-lang-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
}

.glossary-modal-lang-field__label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

.glossary-modal-lang-select {
  padding: 0.5rem 0.55rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  background: #fafafa;
  color: #111827;
}

.glossary-add-modal__tabs {
  display: inline-flex;
  padding: 2px;
  background: #f3f4f6;
  border-radius: 8px;
  gap: 2px;
  margin-bottom: 1rem;
}

.glossary-add-modal__tab {
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 13px;
  font-weight: 500;
  padding: 0.42rem 0.95rem;
  border-radius: 7px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.glossary-add-modal__tab.active {
  background: #ede9fe;
  color: #6d28d9;
  font-weight: 600;
  box-shadow: none;
}

.glossary-add-modal__fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.glossary-add-field {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  margin: 0;
  cursor: default;
}

.glossary-add-field__label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

.glossary-add-field__row {
  display: grid;
  grid-template-columns: minmax(108px, 128px) 1fr;
  gap: 0.55rem;
}

@media (max-width: 480px) {
  .glossary-add-field__row {
    grid-template-columns: 1fr;
  }
}

.glossary-add-modal__select,
.glossary-add-modal__input {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  font-size: 14px;
  background: #fafafa;
  color: #111827;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.glossary-add-modal__select:focus,
.glossary-add-modal__input:focus {
  outline: none;
  border-color: #a78bfa;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.glossary-add-modal__inner--simple .glossary-add-field__row {
  grid-template-columns: 1fr;
}

.glossary-add-modal__inner--simple .glossary-add-modal__select {
  display: none;
}

.glossary-add-modal__footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem 1.1rem;
  background: #fafafa;
  border-top: 1px solid #f0f0f3;
  flex-shrink: 0;
}

.glossary-add-modal__footer-hint {
  margin: 0;
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.5;
}

.glossary-add-modal__footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

@media (max-width: 420px) {
  .glossary-add-modal__footer-row {
    flex-direction: column;
    align-items: stretch;
  }

  .glossary-add-modal__footer-left .glm-btn {
    flex: 1;
    min-width: 0;
  }

  .glossary-add-modal .glm-btn--primary {
    width: 100%;
  }
}

.glossary-add-modal__footer-left {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.glossary-add-modal .glm-btn {
  border: none;
  font-size: 13px;
  font-weight: 600;
  padding: 0.48rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.glossary-add-modal .glm-btn:active {
  transform: scale(0.98);
}

.glossary-add-modal .glm-btn--secondary {
  background: #fff;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

.glossary-add-modal .glm-btn--secondary:hover {
  background: #f9fafb;
  color: #374151;
  border-color: #d1d5db;
}

/* 参考产品：完成 = 浅紫底 + 紫色字 */
.glossary-add-modal .glm-btn--primary {
  background: #ede9fe;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
  box-shadow: none;
}

.glossary-add-modal .glm-btn--primary:hover {
  background: #ddd6fe;
  color: #5b21b6;
  border-color: #c4b5fd;
  filter: none;
}

.glm-btn {
  border: none;
  font-size: 14px;
  font-weight: 600;
  padding: 0.52rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    box-shadow 0.15s ease,
    background 0.15s ease,
    color 0.15s ease,
    filter 0.15s ease;
}

.glm-btn:active {
  transform: scale(0.98);
}

.glm-btn--ghost {
  background: transparent;
  color: #64748b;
}

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

.glm-btn--soft {
  background: #eef2ff;
  color: #4338ca;
}

.glm-btn--soft:hover {
  background: #e0e7ff;
}

.glm-btn--primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.32);
}

.glm-btn--primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.38);
}

.glm-btn--danger {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}

.glm-btn--danger:hover {
  filter: brightness(1.05);
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.42);
}

.glossary-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 0.6rem;
}

/* 术语配置页：多术语表下拉 + 表格（参照产品布局） */
.glossary-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}

.glossary-table-selector-wrap {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 200px;
}

.glossary-table-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.95rem;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.glossary-table-trigger:hover {
  border-color: #c7d2fe;
}

.glossary-table-trigger[aria-expanded="true"] {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.glossary-table-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  background: #eef2ff;
  color: #4338ca;
}

.glossary-table-chevron {
  color: #6b7280;
}

.glossary-lang-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 0 0 0.5rem;
  font-size: 12px;
  color: #6b7280;
}

.glossary-lang-strip__label {
  font-weight: 600;
  color: #9ca3af;
}

.glossary-lang-strip__arrow {
  color: #9ca3af;
  font-weight: 500;
}

.glossary-lang-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: #f3f4f6;
  color: #374151;
  font-weight: 600;
  font-size: 12px;
}

.glossary-lang-summary-compact {
  margin: 0 0 0.55rem;
  font-size: 12px;
  line-height: 1.45;
  color: #9ca3af;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.glossary-search-scope-wrap {
  flex-shrink: 0;
}

.glossary-search-scope {
  padding: 0.42rem 0.55rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  color: #374151;
  background: #fff;
  min-width: 7.5rem;
}

.glossary-confirm-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #374151;
}

.glossary-table-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 260px;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
  z-index: 30;
  padding: 0.35rem;
}

.glossary-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.52rem 0.65rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
}

.glossary-menu-item:hover {
  background: #f3f4f6;
}

.glossary-menu-item.active {
  background: #eef2ff;
  color: #4338ca;
  font-weight: 600;
}

.glossary-menu-item.add-new {
  margin-top: 0.25rem;
  padding-top: 0.55rem;
  border-top: 1px solid #f3f4f6;
  text-align: center;
  color: #6366f1;
  font-weight: 600;
}

.glossary-menu-item.danger {
  color: #b91c1c;
}

.glossary-head-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.glossary-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  transition: background 0.15s ease;
}

.glossary-icon-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.glossary-more-wrap {
  position: relative;
}

.glossary-more-menu {
  left: auto;
  right: 0;
  transform: none;
  min-width: 180px;
}

.glossary-entries-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.glossary-btn-add-term {
  align-self: flex-start;
  border: 1px solid #a5b4fc;
  color: #4f46e5;
  background: #eef2ff;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: 8px;
}

.glossary-btn-add-term:hover {
  background: #e0e7ff;
  border-color: #818cf8;
}

.glossary-toolbar-search-row {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.75rem;
  flex-wrap: wrap;
}

.glossary-entries-search {
  flex: 1;
  min-width: 180px;
  max-width: 420px;
  padding: 0.45rem 0.65rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
}

.glossary-sub-toolbar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  margin-left: auto;
}

.glossary-format-pill {
  font-size: 12px;
  color: #9ca3af;
  padding: 2px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  user-select: none;
}

.glossary-entries-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

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

.glossary-entries-table th {
  text-align: left;
  padding: 0.55rem 0.65rem;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  color: #6b7280;
  font-weight: 600;
}

.glossary-entries-table td {
  padding: 0.28rem 0.45rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.glossary-col-idx {
  width: 44px;
  text-align: center;
  color: #9ca3af;
  font-variant-numeric: tabular-nums;
}

.glossary-col-lang {
  width: 7.5rem;
  min-width: 6.5rem;
  vertical-align: middle;
}

.glossary-row-lang-select {
  width: 100%;
  max-width: 10rem;
  box-sizing: border-box;
  padding: 0.32rem 0.35rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 12px;
  background: #fafafa;
  color: #111827;
}

.glossary-col-actions {
  width: 8.5rem;
  min-width: 7rem;
  text-align: right;
  white-space: nowrap;
}

.glossary-col-actions .glossary-row-edit,
.glossary-col-actions .glossary-row-del {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.28rem 0.55rem;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
}

.glossary-col-actions .glossary-row-edit:hover {
  border-color: #c7d2fe;
  color: #4338ca;
  background: #fafbff;
}

.glossary-col-actions .glossary-row-del {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fff;
}

.glossary-col-actions .glossary-row-del:hover {
  background: #fef2f2;
  border-color: #f87171;
}

.glossary-entries-table input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid transparent;
  padding: 0.4rem 0.45rem;
  border-radius: 8px;
  font-size: 13px;
}

.glossary-entries-table input[type="text"]:focus {
  border-color: #c7d2fe;
  outline: none;
  background: #fafbff;
}

.glossary-entries-table .glossary-cell-term,
.glossary-entries-table .glossary-cell-translation {
  word-break: break-word;
}

.glossary-entries-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 0.65rem 0.75rem;
  background: #fafafa;
  border-top: 1px solid #e5e7eb;
}

#glossaryEntriesInput {
  min-height: 220px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .glossary-panel {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 900px) {
  .workspace-translate-controls {
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
  }
  .workspace-translate-actions {
    margin-top: 0;
  }
}

.settings-workspace-picker {
  margin-bottom: 1rem;
}

.workspace-current-card {
  padding-top: 1rem;
}

.workspace-note-line {
  margin: 0 0 0.85rem;
  font-size: 12px;
  color: #64748b;
}

.workspace-current-single-card {
  border: 1px solid #e5ebf4;
  border-radius: 12px;
  background: #f9fbff;
  padding: 0.72rem 0.78rem;
}

.workspace-current-single-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.workspace-current-file {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
  max-width: 76%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-current-meta {
  margin-top: 0.42rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  font-size: 11px;
  color: #64748b;
}

.workspace-current-status-text {
  margin-top: 0.35rem;
  color: #334155;
  font-size: 11px;
  font-weight: 500;
}

.workspace-current-progress {
  margin-top: 0.52rem;
}

.workspace-current-actions {
  margin-top: 0.62rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workspace-current-empty {
  display: grid;
  gap: 0.4rem;
  color: #475569;
  font-size: 13px;
}

.workspace-current-empty strong {
  color: #0f172a;
}

.workspace-current-empty p {
  margin: 0;
}

.workspace-current-badge {
  font-size: 11px;
  line-height: 1;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  border-width: 1px;
  border-style: solid;
  font-weight: 600;
}

.workspace-current-single-card .workspace-current-badge.status-queued {
  color: #3b82f6;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.workspace-current-single-card .workspace-current-badge.status-processing {
  color: #b45309;
  background: #fff7ed;
  border-color: #fed7aa;
}

.workspace-current-single-card .workspace-current-badge.status-done {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.workspace-current-single-card .workspace-current-badge.status-failed {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

.workspace-download-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.workspace-download-links .btn {
  padding: 0.35rem 0.55rem;
  font-size: 11px;
}

.history-jobs-table-wrap {
  overflow-x: auto;
  border: 1px solid #d9e4f2;
  border-radius: 14px;
  background: #ffffff;
}

.history-jobs-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 920px;
}

.history-jobs-table th,
.history-jobs-table td {
  border-bottom: 1px solid #edf2f7;
  padding: 0.85rem 0.7rem;
  text-align: left;
  font-size: 12px;
  color: #334155;
  white-space: nowrap;
  vertical-align: middle;
}

.history-jobs-table th {
  color: #475569;
  font-weight: 600;
  background: #f6f9ff;
  position: sticky;
  top: 0;
  z-index: 1;
}

.history-jobs-table tbody tr:hover {
  background: #f8fbff;
}

.history-jobs-table td:first-child {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.9rem;
}

.history-overview-card {
  border: 1px solid #dbe7f7;
  border-radius: 12px;
  background: linear-gradient(180deg, #f9fcff, #f2f7ff);
  padding: 0.72rem 0.78rem;
  display: grid;
  gap: 0.2rem;
}

.history-overview-card strong {
  color: #1e293b;
  font-size: 20px;
  line-height: 1;
}

.history-overview-label {
  color: #64748b;
  font-size: 12px;
}

.history-file-cell {
  min-width: 320px;
}

.history-file-title {
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
  max-width: 350px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-file-meta {
  margin-top: 0.18rem;
  color: #94a3b8;
  font-size: 11px;
}

.history-scale-cell {
  color: #475569;
  font-weight: 500;
}

.history-status-cell .status {
  font-size: 11px;
  padding: 0.2rem 0.56rem;
}

.history-status-cell .status-queued {
  background: #eaf3ff;
  color: #2463d6;
  border-color: #bfd6ff;
}

.history-status-cell .status-processing {
  background: #fff7e6;
  color: #b7791f;
  border-color: #f9dca5;
}

.history-status-cell .status-done {
  background: #eafaf2;
  color: #17894c;
  border-color: #b8ecd1;
}

.history-status-cell .status-failed {
  background: #fff0f0;
  color: #c24141;
  border-color: #f7c3c3;
}

.history-status-text {
  margin-top: 0.28rem;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #64748b;
  font-size: 11px;
}

.workspace-empty-cell {
  text-align: center !important;
  color: #94a3b8 !important;
}

.task-detail-modal[hidden] {
  display: none !important;
}

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

.task-detail-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
}

.task-detail-modal-panel {
  position: relative;
  z-index: 1;
  width: min(680px, calc(100vw - 2rem));
  margin: 8vh auto 0;
  background: #ffffff;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
  overflow: hidden;
}

.task-detail-modal-header {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #edf2f7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.task-detail-modal-header h3 {
  margin: 0;
  font-size: 15px;
  color: #1f2937;
}

.task-detail-modal-body {
  padding: 1rem 1rem 1.15rem;
}

.task-detail-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.task-detail-file {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  max-width: 78%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-detail-meta-grid {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.task-detail-meta-item {
  border: 1px solid #e6edf7;
  border-radius: 10px;
  padding: 0.58rem 0.65rem;
  background: #f9fbff;
  display: grid;
  gap: 0.15rem;
}

.task-detail-meta-item span {
  font-size: 11px;
  color: #64748b;
}

.task-detail-meta-item strong {
  font-size: 12px;
  color: #1e293b;
  line-height: 1.4;
}

.task-detail-section {
  margin-top: 0.95rem;
  padding-top: 0.75rem;
  border-top: 1px solid #edf2f7;
}

.task-detail-label {
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 0.55rem;
}

.task-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.task-detail-empty {
  margin: 0;
  color: #94a3b8;
  font-size: 12px;
}

.workspace-guides-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 960px) {
  .workspace-guides-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.workspace-guides-grid h3 {
  margin: 0 0 0.45rem;
  color: #1f2937;
  font-size: 14px;
}

.workspace-guides-grid ol {
  margin: 0;
  padding-left: 1.1rem;
  color: #64748b;
  font-size: 12px;
  line-height: 1.75;
}

.workspace-tools-card {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}

.workspace-tools-title {
  margin: 0 0 1rem;
  color: #111827;
  font-size: 32px;
  line-height: 1.2;
  font-weight: 800;
}

.workspace-tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 900px) {
  .workspace-tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.workspace-tool-item {
  border: 1px solid #d9e2ee;
  border-radius: 12px;
  background: #fff;
  padding: 1.2rem 1.1rem;
}

.workspace-tool-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6a5ce3;
  background: rgba(106, 92, 227, 0.12);
  border: 1px solid rgba(106, 92, 227, 0.25);
}

.workspace-tool-item h3 {
  margin: 0.75rem 0 0.45rem;
  font-size: 30px;
  line-height: 1.15;
  color: #111827;
  font-weight: 700;
}

.workspace-tool-item p {
  margin: 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.7;
  min-height: 72px;
}

.workspace-tool-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  margin-top: 0.7rem;
  color: #5b6cf2;
  font-size: 16px;
  font-weight: 600;
  padding: 0;
}

.workspace-tools-note {
  margin-top: 1.2rem;
  color: #6b7280;
  font-size: 15px;
  line-height: 1.8;
}

.workspace-tools-note p {
  margin: 0.1rem 0;
}

.workspace-pdf-tools-panel {
  margin-top: 1rem;
  border-top: 1px solid #e8edf5;
  padding-top: 1rem;
}

.workspace-pdf-tool {
  border: 1px solid #d9e2ee;
  border-radius: 12px;
  background: #fbfdff;
  padding: 0.95rem;
}

.workspace-pdf-tool + .workspace-pdf-tool {
  margin-top: 0.85rem;
}

.workspace-tool-head h3 {
  margin: 0;
  color: #1f2937;
  font-size: 16px;
}

.workspace-tool-desc {
  margin: 0.45rem 0 0.7rem;
  color: #64748b;
  font-size: 13px;
}

.workspace-tool-picked {
  margin: 0.45rem 0 0;
  color: #64748b;
  font-size: 12px;
}

.workspace-sort-list {
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.workspace-sort-item {
  border: 1px solid #d6deec;
  background: #ffffff;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: grab;
  user-select: none;
}

.workspace-sort-item.dragging {
  opacity: 0.55;
}

.workspace-sort-index {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #eef3ff;
  color: #3b5bdb;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.workspace-sort-name {
  color: #334155;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-sort-tip {
  margin: 0.45rem 0 0;
  color: #64748b;
  font-size: 12px;
}

.workspace-tool-inline-fields {
  margin-top: 0.7rem;
}

.workspace-tool-btn-row {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.workspace-tool-result {
  margin: 0.6rem 0 0;
  color: #475569;
  font-size: 12px;
}

.merge-pdf-upload-zone,
.split-pdf-upload-zone {
  margin-top: 0.35rem;
  text-align: center;
}

.merge-pdf-upload-zone .field-label,
.split-pdf-upload-zone .field-label {
  font-weight: 600;
  color: #334155 !important;
}

.upload-row input[type="file"] {
  padding: 0.5rem;
  cursor: pointer;
}

.upload-result {
  color: var(--sidebar-dark-text-muted);
  font-size: var(--font-size-sm);
  margin-top: 0.75rem;
}

.workspace-job-progress {
  margin-top: 0.8rem;
  border: 1px solid var(--sidebar-dark-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.7rem 0.8rem;
}

.btn {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: var(--font-size-sm);
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
}

.app-main .btn-primary,
.app-main .btn-surface,
.app-main .btn-light {
  background: linear-gradient(180deg, #4f7cff, #3f67ef);
  color: #fff;
  border: 1px solid #476ff2;
  box-shadow: 0 8px 16px rgba(79, 124, 255, 0.18);
}

.app-main .btn-primary:hover,
.app-main .btn-surface:hover,
.app-main .btn-light:hover {
  background: linear-gradient(180deg, #5c87ff, #4b72f3);
  border-color: #4f77f4;
  box-shadow: 0 10px 18px rgba(79, 124, 255, 0.24);
}

.btn-surface {
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-dark-text-hover);
  border: 1px solid var(--sidebar-dark-border);
}

.btn-surface:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-light {
  background: rgba(255, 255, 255, 0.1);
  color: var(--sidebar-dark-text-hover);
}

.btn-light:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-ghost-sidebar {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-dark-text-hover);
  border: 1px solid var(--sidebar-dark-border);
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.btn-ghost-sidebar:hover {
  background: rgba(255, 255, 255, 0.1);
}

#jobsList .job {
  border: 1px solid var(--sidebar-dark-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
}

.job-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.meta {
  color: var(--sidebar-dark-text-hover);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.status {
  font-size: var(--font-size-xs);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  border: 1px solid transparent;
  font-weight: 600;
}

.status-queued {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.35);
}

.status-processing {
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.35);
}

.status-done {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.35);
}

.status-failed {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
}

.artifacts {
  margin-top: 0.5rem;
}

.job-progress-wrap {
  margin-top: 0.7rem;
  margin-bottom: 0.25rem;
}

.job-progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.job-progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #3b82f6);
  transition: width 0.3s ease;
}

.job-progress-wrap.done .job-progress-fill {
  background: linear-gradient(90deg, #34d399, #10b981);
}

.job-progress-wrap.failed .job-progress-fill {
  background: linear-gradient(90deg, #f87171, #ef4444);
}

.job-progress-steps {
  margin-top: 0.4rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
}

.job-progress-step {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--sidebar-dark-text-muted);
  font-size: 11px;
}

.job-progress-step .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: transparent;
}

.job-progress-step.active {
  color: #93c5fd;
}

.job-progress-step.active .dot {
  background: #60a5fa;
  border-color: #60a5fa;
}

.job-progress-step.completed {
  color: #86efac;
}

.job-progress-step.completed .dot {
  background: #22c55e;
  border-color: #22c55e;
}

.artifacts a {
  color: var(--sidebar-dark-active-text);
  margin-right: 0.75rem;
  font-size: var(--font-size-sm);
  text-decoration: none;
}

.artifacts a:hover {
  text-decoration: underline;
}

.err {
  color: #fca5a5;
  margin-top: 0.5rem;
  font-size: var(--font-size-sm);
}

.empty-hint {
  color: var(--sidebar-dark-text-muted);
  font-size: var(--font-size-sm);
}

.jobs-pagination {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5edf7;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.history-filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  margin-bottom: 1rem;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

@media (min-width: 980px) {
  .history-filters {
    grid-template-columns: 1.05fr 2.25fr 0.95fr 0.95fr 0.95fr auto;
    align-items: end;
  }
}

.history-filter-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.history-filter-item.compact .field-label {
  display: none;
}

.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}

.history-tabs {
  display: inline-flex;
  border-radius: 10px;
  background: #f4f5f7;
  padding: 2px;
  gap: 2px;
}

.history-tab {
  border: none;
  background: transparent;
  color: #6b7280;
  border-radius: 8px;
  padding: 0.36rem 0.72rem;
  font-size: 12px;
  cursor: default;
}

.history-tab.active {
  background: #ece8ff;
  color: #635bce;
  font-weight: 600;
}

.history-toolbar-right {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.history-search {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #f4f5f7;
  border: 1px solid #eceef2;
  border-radius: 8px;
  height: 30px;
  padding: 0 0.5rem;
  color: #9ca3af;
}

.history-search input {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  height: 100%;
  padding: 0 !important;
  width: 100px;
  background: transparent !important;
  color: #4b5563 !important;
  font-size: 12px !important;
}

.history-refresh-btn {
  border: 1px solid #eceef2;
  background: #f4f5f7;
  color: #6b7280;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.history-refresh-btn:hover {
  background: #eceff4;
}

.history-filters select,
.history-filters input[type="datetime-local"],
.history-filters input[type="text"] {
  height: 36px;
  border-radius: 6px !important;
  border: 1px solid #eceef2 !important;
  background: #f4f5f7 !important;
  font-size: 13px !important;
  color: #4b5563 !important;
  padding: 0 0.65rem !important;
}

.history-filter-range {
  min-width: 0;
  align-self: end;
}

.history-range-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid #eceef2;
  border-radius: 6px;
  background: #f4f5f7;
  height: 36px;
  padding: 0 0.5rem 0 0.35rem;
  box-sizing: border-box;
}

.history-range-wrap input[type="datetime-local"] {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0 0.25rem !important;
}

#historyFilterDateRange {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0 0.2rem !important;
  cursor: pointer;
  height: 100%;
  line-height: 36px;
  font-size: 13px !important;
  color: #6b7280 !important;
  text-align: center !important;
  text-align-last: center;
}

#historyFilterDateRange::placeholder {
  text-align: center !important;
  color: #9ca3af !important;
}

.history-filter-sep {
  color: #9ca3af;
  font-size: 14px;
  user-select: none;
  margin: 0 0.1rem;
}

.history-range-calendar {
  color: #9ca3af;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.05rem;
}

.flatpickr-calendar {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: #6366f1;
  border-color: #6366f1;
}

.history-filter-actions {
  justify-content: flex-end;
}

.history-filter-actions .btn {
  height: 36px;
  padding: 0 0.8rem;
}

.jobs-page-info {
  color: #64748b;
  font-size: var(--font-size-sm);
  min-width: 96px;
  text-align: center;
}

@media (min-width: 920px) {
  .history-overview-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.editor-toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.editor-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 1100px) {
  .editor-layout {
    grid-template-columns: minmax(0, 1fr) 360px;
  }
}

.editor-canvas-wrap {
  border: 1px solid var(--sidebar-dark-border);
  border-radius: var(--radius-xl);
  background: rgba(0, 0, 0, 0.15);
  padding: 0.75rem;
  overflow: auto;
  max-height: 72vh;
}

.editor-canvas-root {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.editor-page {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #f8fafc;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.editor-page-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 12px;
  padding: 2px 8px;
}

.editor-box {
  position: absolute;
  border: 1px solid rgba(99, 102, 241, 0.65);
  background: rgba(99, 102, 241, 0.14);
  color: #0f172a;
  font-size: 12px;
  line-height: 1.25;
  padding: 2px;
  overflow: hidden;
  cursor: move;
  user-select: none;
}

.editor-box.active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.16);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.4);
}

.editor-side-panel {
  border: 1px solid var(--sidebar-dark-border);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.03);
  padding: 1rem;
}

.editor-side-panel h3 {
  margin: 0 0 0.75rem;
  color: var(--sidebar-dark-text-hover);
  font-size: 15px;
}

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

.editor-diff-panel {
  margin-bottom: 1rem;
  border: 1px solid var(--sidebar-dark-border);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.75rem;
}

.editor-diff-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  color: var(--sidebar-dark-text-hover);
}

.editor-diff-summary {
  color: var(--sidebar-dark-text-muted);
  font-size: var(--font-size-sm);
}

.editor-diff-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 220px;
  overflow: auto;
}

.editor-diff-item {
  border: 1px solid var(--sidebar-dark-border);
  border-radius: var(--radius-lg);
  background: rgba(2, 6, 23, 0.45);
  padding: 0.5rem 0.65rem;
}

.editor-diff-item strong {
  color: var(--sidebar-dark-text-hover);
  font-size: var(--font-size-sm);
}

.editor-diff-item code {
  color: #c7d2fe;
  font-size: 12px;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #dbeafe, #f8fafc 45%);
}

.login-card {
  width: 100%;
  max-width: 430px;
}
