:root {
  --bg: #f5f5f5;
  --panel-bg: #ffffff;
  --text: #222222;
  --muted: #666666;
  --line: #d7d7d7;
  --line-soft: #ebebeb;
  --head-bg: #fafafa;
  --primary: #333333;
  --primary-dark: #111111;
  --accent: #333333;
  --ok: #2f7a38;
  --error: #b23a30;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
}

.workspace {
  min-height: 100%;
  padding: 14px;
}

.header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.header img {
  width: min(310px, 40vw);
  max-height: 64px;
  object-fit: contain;
}

.header-text h1 {
  margin: 0;
  font-size: clamp(20px, 1.8vw, 28px);
}

.header-text p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.layout-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr) minmax(260px, 320px);
  gap: 14px;
  align-items: start;
}

.left-column,
.center-column,
.right-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-bg);
  padding: 12px;
}

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

.panel-title {
  margin: 0 0 10px;
  font-size: 15px;
}

.panel-head .panel-title {
  margin-bottom: 0;
}

.file-picker {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 148px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  border: 1px dashed #bfbfbf;
  border-radius: 6px;
  background: #f9f9f9;
  padding: 12px 10px;
  cursor: pointer;
}

.file-picker:hover {
  border-color: #8e8e8e;
}

#importPanel.is-dragover .file-picker {
  border-color: #666;
  background: #f1f1f1;
}

.file-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: #666;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.upload-title {
  font-size: 15px;
  font-weight: 600;
}

.upload-desc {
  font-size: 12px;
  color: var(--muted);
}

.status {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
}

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

.status.error {
  color: var(--error);
}

.project-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 38vh;
  overflow: auto;
}

.project-item {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 8px;
  background: #fff;
  cursor: pointer;
}

.project-item:hover {
  border-color: #9d9d9d;
}

.project-item.active {
  border-color: #666;
  background: #fff;
}

.project-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.project-name {
  font-size: 13px;
  font-weight: 600;
  word-break: break-all;
}

.project-progress {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

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

.project-list.compact {
  max-height: 24vh;
}

.action-bar {
  position: sticky;
  top: 10px;
  z-index: 5;
}

.button-row,
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-row {
  margin-top: 10px;
}

.main-btn,
.sub-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 4px;
  border: 1px solid #c8c8c8;
  background: #fff;
  color: #222;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.main-btn:hover,
.sub-btn:hover {
  background: #f1f1f1;
  border-color: #b8b8b8;
  color: #111;
}

.main-btn.ghost {
  background: #fff;
  border-color: #c8c8c8;
}

.main-btn.ghost:hover {
  color: #111;
}

.main-btn.accent {
  background: #fff;
  border-color: #c8c8c8;
  color: #222;
}

.main-btn.accent:hover {
  background: #f1f1f1;
  border-color: #b8b8b8;
}

.main-btn:active,
.sub-btn:active {
  background: #e9e9e9;
}

.main-btn:disabled,
.sub-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.main-btn:disabled:hover,
.sub-btn:disabled:hover {
  background: #fff;
  border-color: #c8c8c8;
  color: #222;
}

.search-box {
  flex: 1 1 340px;
  min-width: 240px;
}

.search-box input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  font: inherit;
  color: inherit;
  background: #fff;
}

.search-box input {
  min-height: 36px;
}

textarea {
  min-height: 50px;
  resize: vertical;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.check-row input {
  width: 15px;
  height: 15px;
}

.hint-line {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.table-panel {
  min-height: 56vh;
}

.table-wrap {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow: auto;
  max-height: 72vh;
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  background: var(--head-bg);
  padding: 10px 8px;
  color: #25314a;
}

tbody td {
  border-bottom: 1px solid #edf2fa;
  vertical-align: top;
  padding: 10px 8px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.idx {
  width: 50px;
}

.key {
  width: 30%;
}

.source,
.target {
  width: 35%;
}

.code-key {
  font-family: Consolas, monospace;
  font-size: 12px;
  word-break: break-word;
}

.source-cell {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.lang-badge {
  display: inline-block;
  margin: 0 6px 4px 0;
  padding: 1px 6px;
  border: 1px solid #d2d2d2;
  border-radius: 4px;
  background: #f3f3f3;
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
}

.empty {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.meta-grid {
  display: grid;
  gap: 6px;
}

.meta-grid div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
  font-size: 12px;
  align-items: start;
}

.meta-grid span {
  color: var(--muted);
}

.meta-grid strong {
  font-weight: 600;
  word-break: break-all;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: #ececec;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #666;
  transition: width 0.25s ease;
}

.progress-text {
  margin: 6px 0 8px;
  font-size: 12px;
  color: var(--muted);
}

.domain-progress {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 24vh;
  overflow: auto;
}

.domain-progress li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  font-size: 12px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1360px) {
  .layout-grid {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .right-column {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}

@media (max-width: 980px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .right-column {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    max-height: none;
  }

  .action-bar {
    position: static;
  }
}

@media (max-width: 680px) {
  .workspace {
    padding: 10px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header img {
    width: min(280px, 80vw);
  }

  .meta-grid div {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  thead th,
  tbody td {
    padding: 8px 6px;
  }
}
