:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #d9e0e7;
  --text: #17202a;
  --muted: #637083;
  --accent: #136f63;
  --accent-2: #0f5c9c;
  --warn: #a15c00;
  --danger: #a23b3b;
  --ok: #247a3d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Noto Sans KR", sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

button:disabled {
  cursor: default;
  opacity: 0.6;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.app {
  display: grid;
  grid-template-columns: 280px minmax(760px, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #edf1f5;
  border-right: 1px solid var(--line);
  padding: 18px;
}

.workspace {
  min-width: 0;
  padding: 18px;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.2;
}

h2 {
  font-size: 15px;
  margin-bottom: 12px;
}

.brand p,
.toolbar p,
.hint {
  color: var(--muted);
}

.brand p {
  margin-top: 4px;
}

.badge {
  flex: none;
  padding: 4px 8px;
  border-radius: 999px;
  background: #dfe9ef;
  color: #34495e;
  font-size: 12px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.panel button,
.panel select {
  width: 100%;
  margin-top: 8px;
}

.panel label {
  display: block;
  margin: 9px 0;
}

.panel label span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.guide textarea,
.ai-work textarea,
.edit {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  color: var(--text);
  background: #fbfcfd;
  line-height: 1.5;
}

.ai-work textarea {
  min-height: 110px;
}

.guide textarea {
  min-height: 300px;
}

.hint {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
}

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

.toolbar h2 {
  margin-bottom: 5px;
  font-size: 20px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar-actions input {
  width: 260px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
}

.result-summary {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  white-space: nowrap;
}

.filter-summary {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.top-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  height: 16px;
  margin-bottom: 4px;
}

.top-scroll > div {
  height: 1px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.pagination button {
  min-width: 34px;
  padding: 0 8px;
}

.pagination button.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: default;
}

.pagination .page-info {
  margin-left: 10px;
  color: var(--muted);
  font-size: 13px;
}

.ai-section {
  margin-bottom: 14px;
}

.ai-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--panel);
  text-align: left;
}

.ai-toggle span:first-child {
  font-weight: 700;
}

.ai-toggle span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.ai-toggle.open {
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.ai-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.38fr) minmax(520px, 0.62fr);
  gap: 14px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid var(--line);
  border-top: 0;
  border-bottom-right-radius: 8px;
  border-bottom-left-radius: 8px;
  background: #eef2f6;
}

.ai-workspace[hidden] {
  display: none;
}

.ai-workspace .panel,
.ai-workspace .ai-results {
  margin: 0;
}

.ai-results {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-width: 0;
}

.ai-results header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ai-results h2 {
  margin-bottom: 0;
}

.ai-results header button {
  width: 34px;
  padding: 0;
}

.ai-jobs {
  display: grid;
  gap: 8px;
  max-height: 250px;
  overflow: auto;
}

.ai-job {
  display: grid;
  grid-template-columns: 90px 86px minmax(0, 1fr) 110px 110px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

.ai-job strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.ai-job small {
  color: var(--muted);
}

.ai-job strong,
.ai-job small {
  overflow-wrap: anywhere;
}

.ai-job-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border: 1px solid #b7ddb9;
  border-radius: 999px;
  background: #e9f6ee;
  color: var(--accent);
  font-size: 12px;
}

.ai-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe9ef;
}

.ai-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
}

table {
  width: 100%;
  min-width: 1900px;
  table-layout: fixed;
  border-collapse: collapse;
}

.col-status {
  width: 46px;
}

.col-note {
  width: 130px;
}

.col-key {
  width: 118px;
}

.col-category {
  width: 90px;
}

.col-base {
  width: 320px;
}

.col-lang {
  width: 240px;
}

.col-back {
  width: 240px;
}

.col-action {
  width: 56px;
}

.col-count {
  width: 64px;
}

#group-toggle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #405064;
  font-size: 12px;
  z-index: 1;
  white-space: nowrap;
}

td:nth-child(1),
td:nth-child(3),
td:nth-child(4),
td:nth-child(6),
td:nth-child(7),
td:nth-child(8),
td:nth-child(9) {
  word-break: keep-all;
  overflow-wrap: normal;
}

tbody tr.selected {
  background: #eef8f5;
  outline: 2px solid #9fd2c6;
}

.status {
  display: inline-block;
  white-space: nowrap;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid transparent;
}

.status.review {
  color: var(--warn);
  background: #fff4df;
  border-color: #efd09b;
}

.status.revision {
  color: #7b3f99;
  background: #f4eafa;
  border-color: #d8b8e9;
}

.row-status {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #e9f6ee;
  color: transparent;
  appearance: none;
  -webkit-appearance: none;
}

.row-status.review,
.row-status.revision,
.row-status.upload {
  background: #e9f6ee;
  border-color: #b7ddb9;
}

.row-status.todo {
  background: #fdecec;
  border-color: #efbcbc;
}

.row-note {
  width: 100%;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  background: #fbfcfd;
  color: var(--text);
}

.row-save {
  width: 34px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
}

.row-save.dirty {
  border-color: var(--accent);
  background: #e9f6ee;
  color: var(--accent);
}

.key-link {
  display: block;
  width: 100%;
  height: auto;
  min-height: 28px;
  border: 0;
  border-radius: 4px;
  padding: 0;
  background: transparent;
  color: var(--accent-2);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editable-cell {
  cursor: text;
}

.editable-cell.edited {
  background: #f0faf5;
}

.cell-editor {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 8px;
  background: #fff;
  color: var(--text);
  line-height: 1.35;
}

.status.done {
  color: var(--ok);
  background: #e7f6eb;
  border-color: #b7ddb9;
}

.status.todo {
  color: var(--danger);
  background: #fdecec;
  border-color: #efbcbc;
}

.status.upload {
  color: var(--accent-2);
  background: #eaf3fb;
  border-color: #b8d4ec;
}

.empty {
  color: #9a3e3e;
  background: #fff7f7;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

.limit-note {
  text-align: center;
  color: var(--muted);
  background: #f8fafc;
}

dl {
  margin: 0 0 10px;
}

dt {
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
}

dd {
  margin: 3px 0 0;
}

@media (max-width: 1180px) {
  .app {
    grid-template-columns: 240px 1fr;
  }

  .ai-workspace,
  .ai-job {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 820px) {
  .app {
    display: block;
  }

  .toolbar,
  .toolbar-actions {
    display: block;
  }

  .toolbar-actions input,
  .toolbar-actions button {
    width: 100%;
    margin-top: 8px;
  }

}
