* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Asap', Arial, sans-serif;
  background: #f5f7fa;
  color: #1a1a2e;
  min-height: 100vh;
}

header, #mast {
  background: #386193;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#logo {
  max-width: 100%;
  height: 70px;
  display: block;
}

.mast-title {
  color: #fff;
  font-size: 1.4rem;
  font-weight: 600;
  margin-left: 48px;
  letter-spacing: 0.5px;
}

.tool-tabs {
  display: flex;
  gap: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 3px;
  margin-left: auto;
  margin-right: 2rem;
}
.tab {
  padding: 0.5rem 1.2rem;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.8);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}
.tab:hover { color: white; }
.tab.active {
  background: white;
  color: #386193;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-bar span {
  color: rgba(255,255,255,0.85);
  font-size: 0.85em;
}
.logout-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 5px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8em;
  font-family: inherit;
  transition: all 0.2s ease;
}
.logout-btn:hover { background: rgba(255,255,255,0.3); border-color: rgba(255,255,255,0.7); }

.tool-panel { display: none; }
.tool-panel.active { display: block; }

.translate-embed {
  margin: 0;
}
.translate-embed iframe {
  width: 100%;
  height: calc(100vh - 80px);
  border: none;
}

main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.card h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #386193;
}

.card .subtitle {
  color: #666;
  margin-bottom: 1.5rem;
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-primary {
  background: #386193;
  color: white;
}
.btn-primary:hover { background: #2a4d78; }

.btn-secondary {
  background: #e8edf3;
  color: #386193;
}
.btn-secondary:hover { background: #d4dce8; }

/* Upload Area */
.upload-area {
  border: 2px dashed #c4d1e0;
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 1rem;
}
.upload-area:hover { border-color: #386193; background: #f8fafc; }
.upload-area.dragging { border-color: #386193; background: #eef3f9; }
.upload-icon { font-size: 3rem; margin-bottom: 1rem; }

/* Progress */
.progress-bar {
  margin-top: 1rem;
  background: #e8edf3;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  height: 36px;
}
.progress-fill {
  height: 100%;
  background: #386193;
  width: 0%;
  transition: width 0.3s;
  animation: indeterminate 1.5s infinite;
}
.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.85rem;
  font-weight: 500;
  color: #386193;
}
@keyframes indeterminate {
  0% { width: 0%; margin-left: 0; }
  50% { width: 40%; margin-left: 30%; }
  100% { width: 0%; margin-left: 100%; }
}

/* Spinner */
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e8edf3;
  border-top-color: #386193;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 1.5rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Entities List */
.entities-list { margin-top: 1rem; }

.entity-group {
  margin-bottom: 1.5rem;
}
.entity-group-header {
  font-weight: 600;
  color: #386193;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e8edf3;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.entity-group-count {
  font-size: 0.8rem;
  background: #e8edf3;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-weight: 500;
}

.entity-item {
  display: flex;
  align-items: center;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  margin-bottom: 0.3rem;
  transition: background 0.15s;
}
.entity-item:hover { background: #f8fafc; }
.entity-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 0.8rem;
  accent-color: #386193;
}
.entity-text {
  font-family: 'Courier New', monospace;
  background: #fff3cd;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
}
.entity-type {
  margin-left: auto;
  font-size: 0.75rem;
  color: #666;
  text-transform: uppercase;
}
.entity-score {
  font-size: 0.75rem;
  color: #999;
  margin-left: 0.5rem;
}

/* Review Controls */
.review-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}
.count-badge {
  margin-left: auto;
  font-size: 0.9rem;
  font-weight: 500;
  color: #386193;
}

/* Download Bar */
.download-bar {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e8edf3;
  text-align: center;
}

/* Success */
.success-icon {
  font-size: 3rem;
  text-align: center;
  margin: 1rem 0;
}

#downloadSection { text-align: center; }
#downloadSection .btn { margin: 0.5rem; }

.preview-container {
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e8edf3;
  background: #f5f7fa;
}
.pdf-preview {
  width: 100%;
  height: 500px;
  border: none;
}
.download-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1.5rem 0 1rem;
}
.secure-notice {
  font-size: 0.85rem;
  color: #155724;
  background: #d4edda;
  border: 1px solid #c3e6cb;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  margin-top: 1rem;
}

/* Jobs List */
.jobs-list { margin-top: 1rem; }
.job-item {
  display: grid;
  grid-template-columns: 3fr 2fr 1fr 100px;
  align-items: center;
  padding: 0.8rem 1rem;
  border-radius: 6px;
  border: 1px solid #e8edf3;
  margin-bottom: 1rem;
  gap: 4rem;
}
.job-item:hover { background: #f8fafc; }
.job-item.job-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: #386193;
  border: none;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #e8edf3;
  border-radius: 0;
}
.job-item.job-header:hover { background: none; }
.job-filename { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-date { font-size: 0.8rem; color: #888; }
.job-download-link { 
  color: white; 
  text-decoration: none; 
  font-weight: 500; 
  font-size: 0.8rem; 
  background: #386193;
  padding: 0.35rem 0.8rem;
  border-radius: 20px;
  transition: background 0.2s;
  display: inline-block;
}
.job-download-link:hover { background: #2a4d78; text-decoration: none; }
.job-status {
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
  border-radius: 12px;
  font-weight: 500;
  display: inline-block;
  text-align: center;
}
.job-status.ready { background: #d4edda; color: #155724; }
.job-status.processing { background: #fff3cd; color: #856404; }
.job-status.uploading { background: #fff3cd; color: #856404; }
.job-status.error { background: #f8d7da; color: #721c24; }
.job-status.downloaded { background: #d1ecf1; color: #0c5460; }

.empty-state { color: #999; font-style: italic; }

/* Login */
#loginSection {
  text-align: center;
  padding: 4rem 2rem;
}
#loginSection h2 { margin-bottom: 1rem; }
#loginSection p { margin-bottom: 2rem; color: #666; }
