.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-view.hidden { display: none; }

.login-card {
  background: rgba(24, 24, 27, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 48px 40px;
  width: 400px;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.login-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 4px 12px rgba(0,0,0,0.2);
}
.login-card h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0;
  margin-bottom: 8px;
}
.login-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 36px;
}
.login-hint {
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-muted);
}
.login-card .form-group { text-align: left; }

.mode-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  min-height: 42px;
  padding: 3px;
  gap: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(9, 9, 11, 0.7);
}

.mode-segment {
  min-width: 0;
  min-height: 34px;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.mode-segment:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.mode-segment.active {
  color: #fff;
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(37, 99, 235, 0.28);
  box-shadow: 0 1px 6px rgba(37, 99, 235, 0.18);
}

.mode-segment:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.field-binding-list {
  display: flex;
  flex-direction: column;
}

.field-binding-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(220px, 1.2fr);
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 7px 10px;
  border-top: 1px solid var(--border);
}

.field-binding-row:first-child { border-top: 0; }

.field-binding-row code {
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-size: 12px;
}

.field-binding-row select {
  min-height: 34px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.placeholder-source-editor {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.placeholder-source-editor summary {
  display: list-item;
  padding: 12px 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.placeholder-source-editor summary::marker { color: var(--text-muted); }

.placeholder-source-summary-content {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: calc(100% - 18px);
}

.placeholder-source-summary-content span:last-child {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.placeholder-source-content { padding: 0 0 12px; }

.field-binding-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.field-binding-summary > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 10px;
}

.field-binding-summary > div + div { border-left: 1px solid var(--border); }

.field-binding-summary strong {
  color: var(--text);
  font-size: 20px;
  font-weight: 650;
}

.field-binding-summary span {
  color: var(--text-muted);
  font-size: 12px;
}

.field-binding-section { border-bottom: 1px solid var(--border); }

.field-binding-section-header {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 8px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

.field-binding-source-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
}

.field-binding-section-shared .field-binding-source-dot { background: #a78bfa; }
.field-binding-section-company .field-binding-source-dot { background: #22c55e; }
.field-binding-section-system .field-binding-source-dot { background: #60a5fa; }

.field-binding-section-count {
  min-width: 22px;
  text-align: right;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

@media (max-width: 640px) {
  .field-binding-row { grid-template-columns: 1fr; gap: 6px; }
  .field-binding-summary > div { padding: 10px 8px; }
}
.login-btn {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 15px;
  margin-top: 12px;
}

.app-layout {
  display: none;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}
.app-layout.visible { display: flex; }

.sidebar {
  width: 260px;
  background: rgba(9, 9, 11, 0.6);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
}
.sidebar-header {
  padding: 24px 20px 12px;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.sidebar-brand:hover { background: rgba(255,255,255,0.05); }
.sidebar-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
}
.nav {
  flex: 1;
  padding: 8px 16px;
  overflow-y: auto;
}
.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 16px 8px 8px;
}
.nav-item {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  text-align: left;
}
a.nav-item { color: var(--text-secondary); }
.nav-item svg { flex-shrink: 0; opacity: 0.6; transition: var(--transition-spring); }
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item:hover svg { opacity: 0.9; transform: scale(1.1); }
.nav-item.active { 
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
  color: #fff; 
  font-weight: 600; 
  border-left: 3px solid var(--primary);
  padding-left: 9px;
}
.nav-item.active svg { opacity: 1; color: var(--primary); }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sidebar-footer-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}
.mobile-chrome {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(9, 9, 11, 0.92);
}
.mobile-chrome-user {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}
.mobile-chrome-actions {
  display: flex;
  gap: 6px;
  flex: none;
}
.mobile-nav-toggle,
.mobile-nav-backdrop { display: none; }
.jobs-auto-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  color: #93c5fd;
  font-size: 12px;
  font-weight: 500;
}
.jobs-auto-refresh::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 rgba(147, 197, 253, 0.5);
  animation: jobsPulse 1.4s ease-out infinite;
}
@keyframes jobsPulse {
  0% { box-shadow: 0 0 0 0 rgba(147, 197, 253, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(147, 197, 253, 0); }
  100% { box-shadow: 0 0 0 0 rgba(147, 197, 253, 0); }
}
.seal-size-controls {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.seal-pos-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}
.seal-match-ok {
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 4px;
  color: #22c55e;
  background: rgba(34,197,94,0.1);
}
.seal-match-warn {
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 4px;
  color: #f59e0b;
  background: rgba(245,158,11,0.1);
}
.gen-result-box {
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.05));
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.admin-name { font-size: 14px; color: var(--text); font-weight: 500; }

.main {
  flex: 1;
  overflow-y: auto;
  padding: 48px 56px;
  max-width: 100%;
  position: relative;
}

.panel { display: none; max-width: 1200px; margin: 0 auto; }
.panel.active { display: block; animation: panelIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

@keyframes panelIn {
  from { opacity: 0; transform: translateY(12px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}
.panel-header h2 { font-size: 28px; font-weight: 600; letter-spacing: 0; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}
.stat-card {
  background: linear-gradient(180deg, rgba(24, 24, 27, 0.8) 0%, rgba(24, 24, 27, 0.4) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition-spring);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.stat-card:hover { 
  border-color: rgba(255,255,255,0.15); 
  transform: translateY(-4px); 
  box-shadow: 0 12px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05); 
}
.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}
.stat-card .stat-value {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: 0;
  color: #fff;
  background: linear-gradient(180deg, #fff 0%, #a1a1aa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.health-panel {
  margin: -10px 0 32px;
  padding: 22px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.health-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.health-panel-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--border);
}

.health-item {
  min-width: 0;
  padding: 14px 16px;
  background: rgba(24, 24, 27, 0.88);
}

.health-item span,
.health-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.health-item span {
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: 12px;
}

.health-item strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.health-issues {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.health-issue {
  padding: 9px 12px;
  border-left: 3px solid var(--warning);
  background: rgba(234, 179, 8, 0.08);
  color: #fde68a;
  font-size: 13px;
}

.health-issue-critical {
  border-left-color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
  color: #fda4af;
}

.health-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.list-item {
  background: rgba(24, 24, 27, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition-fast);
  margin-bottom: 12px;
  backdrop-filter: blur(8px);
}
.list-item:hover { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.12); transform: scale(1.002); }
.list-item-info { flex: 1; min-width: 0; }
.list-item-name { font-size: 15px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; color: #fff; }
.list-item-meta { font-size: 13px; color: var(--text-secondary); display: flex; gap: 20px; flex-wrap: wrap; }
.list-item-actions { display: flex; gap: 8px; flex-shrink: 0; margin-left: 20px; }

.template-release-state {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  color: var(--text-secondary);
  font-size: 13px;
}

.company-card-grid, .tpl-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.company-card, .tpl-group-card {
  background: rgba(24, 24, 27, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: var(--transition-spring);
  display: flex;
  flex-direction: column;
  gap: 16px;
  backdrop-filter: blur(8px);
}
.company-card:hover, .tpl-group-card:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
}

.company-card:focus-visible,
.tpl-group-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-color: rgba(59, 130, 246, 0.55);
}

.company-card-header, .tpl-group-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.company-card-name, .tpl-group-card-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
}

.company-card-seals {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 56px;
}
.company-card-seal-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.9);
  padding: 4px;
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.company-card-no-seal { font-size: 13px; color: var(--text-muted); font-style: italic; }
.company-card-seal-more {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 4px 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 20px;
}

.company-card-meta, .tpl-group-card-meta {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  gap: 16px;
}

.company-card-actions {
  display: flex;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: auto;
}

.tpl-group-card-count {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.3);
}
.tpl-group-card-expand {
  font-size: 13px;
  color: #60a5fa;
  margin-top: 4px;
  font-weight: 500;
  transition: var(--transition-fast);
}
.tpl-group-card:hover .tpl-group-card-expand { color: #93c5fd; }

.platform-group { margin-bottom: 36px; }
.platform-group-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0 0 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.license-template-groups {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.license-template-group {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.license-template-group:first-child { border-top: 0; }

.license-template-group-header {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.license-template-group-header input {
  width: auto;
  margin: 0;
}

.license-template-group-name {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  word-break: break-word;
}

.license-template-group-selection {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.license-template-group.has-selection .license-template-group-selection { color: #60a5fa; }

.license-template-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 12px;
  padding-left: 30px;
}

.license-template-items .checkbox-item {
  min-width: 0;
  padding: 9px 12px;
}

.license-template-items .checkbox-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.seal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.seal-card {
  background: rgba(24, 24, 27, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  transition: var(--transition-spring);
  backdrop-filter: blur(8px);
}
.seal-card:hover { 
  border-color: rgba(255,255,255,0.15); 
  background: rgba(255,255,255,0.04); 
  transform: translateY(-4px); 
  box-shadow: 0 12px 24px rgba(0,0,0,0.3);
}
.seal-card img {
  width: 100%;
  height: 120px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.9);
  margin-bottom: 16px;
  padding: 8px;
  transition: var(--transition-spring);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.seal-card:hover img { transform: scale(1.08) translateY(-4px); }
.seal-card .seal-label { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: #fff; }
.seal-card .seal-actions { display: flex; gap: 8px; justify-content: center; }

.placeholder-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.code-display {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  padding: 20px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 15px;
  text-align: center;
  word-break: break-all;
  margin: 20px 0;
  user-select: all;
  color: #60a5fa;
  font-weight: 500;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
}

.preview-images {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}
.preview-images img {
  max-width: 100%;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.card {
  margin-bottom: 32px;
}
.card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
  letter-spacing: 0;
  color: #fff;
}

.jobs-panel-header {
  align-items: flex-end;
  margin-bottom: 18px;
}

.jobs-total {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13px;
}

.jobs-header-actions {
  display: flex;
  gap: 10px;
}

.jobs-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.job-summary-item {
  min-height: 82px;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(24, 24, 27, 0.55);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.job-summary-item span {
  color: var(--text-muted);
  font-size: 13px;
}

.job-summary-item strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.job-summary-success strong { color: #4ade80; }
.job-summary-failed strong { color: #fb7185; }

.jobs-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px 150px auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.jobs-toolbar input,
.jobs-toolbar select,
.jobs-toolbar button {
  min-height: 40px;
  margin: 0;
}

.jobs-search { min-width: 0; }
.jobs-result-count {
  min-height: 22px;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.jobs-table-container {
  border-radius: 6px;
}

.jobs-table {
  min-width: 1040px;
}

.jobs-table th {
  padding-top: 13px;
  padding-bottom: 13px;
  color: var(--text-secondary);
}

.jobs-table td {
  padding-top: 15px;
  padding-bottom: 15px;
  vertical-align: top;
}

.job-row-failed { background: rgba(127, 29, 29, 0.08); }

.job-contract-name {
  max-width: 250px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.job-contract-company,
.job-number,
.job-source-detail,
.job-download-count {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.job-number {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-source {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.job-source-admin {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.13);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.job-source-api {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.24);
}

.job-remark-cell {
  width: min(240px, 24vw);
  min-width: 150px;
}

.job-remark-text {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.job-remark-empty {
  color: var(--text-muted);
  font-size: 13px;
}

.job-remark-edit {
  border: 0;
  background: transparent;
  color: #60a5fa;
  cursor: pointer;
  padding: 6px 0 0;
  font-size: 12px;
}

.job-remark-edit:hover { color: #bfdbfe; }

.job-result-badges,
.job-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.job-format {
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

.job-error {
  max-width: 180px;
  margin-top: 7px;
  color: #fda4af;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-created-at {
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
}

.job-file-cleared {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

@media (max-width: 980px) {
  .jobs-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jobs-toolbar { grid-template-columns: minmax(0, 1fr) 1fr; }
  .jobs-search { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .jobs-summary { gap: 8px; }
  .job-summary-item { min-height: 72px; padding: 12px; }
  .job-summary-item strong { font-size: 21px; }
  .jobs-toolbar { grid-template-columns: 1fr; }
  .jobs-search { grid-column: auto; }
  .jobs-toolbar button { width: 100%; }
}

@media (max-width: 760px) {
  .app-layout.visible {
    display: flex;
    height: 100vh;
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: min(84vw, 300px);
    height: 100dvh;
    border-right: 1px solid rgba(255,255,255,0.08);
    transform: translateX(-102%);
    transition: transform 180ms ease;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .app-layout.nav-open .sidebar { transform: translateX(0); }

  .sidebar-header { padding: 16px 14px 8px; }
  .sidebar-footer { display: none; }

  .mobile-chrome { display: flex; }

  .nav {
    display: block;
    padding: 8px 12px;
    overflow-y: auto;
  }

  .nav-item {
    width: 100%;
    min-height: 44px;
    margin: 0 0 4px;
    padding: 10px 12px;
    gap: 12px;
  }

  .nav-item.active {
    padding-left: 9px;
    border-left: 3px solid var(--primary);
    border-bottom: 0;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    width: 36px;
    height: 36px;
    padding: 0;
    align-items: center;
    justify-content: center;
    flex: none;
  }

  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.6);
  }

  .app-layout.nav-open .mobile-nav-backdrop { display: block; }

  .main {
    width: 100%;
    padding: 20px 14px 32px;
    overflow-y: auto;
  }

  .modal {
    max-height: 92vh;
    padding: 20px 16px;
  }

  .modal-actions {
    bottom: -20px;
  }

  .list-item-actions {
    width: 100%;
  }

  .list-item-actions .btn-sm {
    flex: 1 1 auto;
  }

  .health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .panel-header h2 { font-size: 24px; }
  .jobs-panel-header { align-items: center; }

  .jobs-table-container {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .jobs-table,
  .jobs-table tbody {
    display: block;
    min-width: 0;
    width: 100%;
  }

  .jobs-table thead { display: none; }

  .jobs-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 13px 16px;
    margin-bottom: 10px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(24, 24, 27, 0.55);
  }

  .jobs-table td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .jobs-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 7px;
    color: var(--text-muted);
    font-size: 11px;
  }

  .jobs-table td:nth-child(1),
  .jobs-table td:nth-child(3) {
    grid-column: 1 / -1;
  }

  .job-contract-name,
  .job-number,
  .job-remark-cell,
  .job-error {
    width: auto;
    max-width: none;
  }
}

/* ===== R4 专业后台：顶栏、紧凑 KPI、告警带、表格化 ===== */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-generate { display: inline-flex; align-items: center; gap: 6px; }
.topbar-alert { margin-left: auto; display: flex; align-items: center; }
.topbar-alert-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.topbar-alert-warning .topbar-alert-dot { background: var(--warning); }
.topbar-alert-critical .topbar-alert-dot { background: var(--danger); }
.topbar-alert-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.topbar-user { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.kpi-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-item span { font-size: 12px; color: var(--text-muted); }
.kpi-item strong { font-size: 20px; line-height: 1.2; }
.kpi-item strong em { font-style: normal; font-size: 13px; color: var(--text-muted); font-weight: 400; }

.alert-band {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  overflow: hidden;
}
.alert-band-ok {
  padding: 10px 14px;
  color: var(--success);
  font-size: 13px;
  background: rgba(34, 197, 94, 0.06);
  border-color: rgba(34, 197, 94, 0.2);
}
.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 13px;
}
.alert-item + .alert-item { border-top: 1px solid var(--border); }
.alert-item-warning { background: rgba(234, 179, 8, 0.05); }
.alert-item-critical { background: rgba(239, 68, 68, 0.06); }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.alert-item-warning .alert-dot { background: var(--warning); }
.alert-item-critical .alert-dot { background: var(--danger); }
.alert-text { flex: 1; min-width: 0; }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(360px, 5fr) minmax(320px, 7fr);
  gap: 14px;
  align-items: start;
}
.card-header-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-header-row h3 { margin: 0; }
.fail-reasons-title { margin: 18px 0 8px; font-size: 14px; }
.fail-reasons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fail-reasons li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
}
.fail-reason-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }

.companies-table, .licenses-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.companies-table th, .licenses-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.companies-table td, .licenses-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.company-seal-summary { color: var(--text-secondary); display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.license-prefix { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.text-danger { color: var(--danger); }

.jobs-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px;
  flex-wrap: wrap;
}
.jobs-pagination-info { font-size: 13px; color: var(--text-secondary); }
.jobs-page-size { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); margin-left: auto; }
.jobs-page-size select {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 5px 8px;
}

@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 8px 12px; }
  .topbar-user { display: none; }
  .jobs-page-size { margin-left: 0; width: 100%; }
}

/* 移动端：企业与授权码表格转卡片式摘要行 */
@media (max-width: 760px) {
  .companies-table thead, .licenses-table thead { display: none; }
  .companies-table, .licenses-table { display: block; }
  .companies-table tbody, .licenses-table tbody { display: block; }
  .companies-table tr, .licenses-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    background: var(--bg-card);
  }
  .companies-table td, .licenses-table td { display: block; padding: 0; border: 0; }
  .companies-table td::before, .licenses-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 11px;
  }
  .companies-table td:first-child, .licenses-table td:first-child { grid-column: 1 / -1; }
  .companies-table td:last-child, .licenses-table td:last-child { grid-column: 1 / -1; }
}

/* ===== R5 模板工作台 ===== */

.workbench { display: flex; flex-direction: column; }
.workbench-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  position: sticky;
  top: 42px;
  z-index: 10;
  margin-bottom: 12px;
}
.workbench-status { font-size: 13px; color: var(--text-muted); }
.workbench-status.dirty { color: var(--warning); font-weight: 600; }
.workbench-actions { margin-left: auto; display: flex; gap: 8px; }
.workbench-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  padding: 0 4px;
  overflow-x: auto;
}
.workbench-body {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.workbench-body .modal-tab {
  border: 0;
  background: none;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 8px 14px;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.workbench-body .modal-tab.active {
  color: var(--text);
  border-bottom-color: var(--primary);
  background: none;
}

@media (max-width: 600px) {
  .workbench-topbar { top: 0; flex-wrap: wrap; }
  .workbench-actions { margin-left: 0; width: 100%; }
  .workbench-actions button { flex: 1; }
}
