.button.compact,
button.compact {
  padding: 6px 10px;
}

.upload-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.output-mode-select,
.output-format-select,
.source-language-select,
.target-language-select,
.pdf-mode-select,
.pdf-layout-select {
  display: flex;
  min-width: 0;
  align-items: stretch;
  flex-direction: column;
  gap: 6px;
}

.task-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 150px)) minmax(220px, 300px);
  align-items: end;
  justify-content: start;
  gap: 12px;
  min-width: 0;
}

.task-options label > span {
  color: #59686b;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.pdf-layout-select[hidden] {
  display: none;
}

.output-mode-select select,
.output-format-select select,
.source-language-select select,
.target-language-select select,
.pdf-mode-select select,
.pdf-layout-select select {
  width: 100%;
  min-width: 0;
  height: 44px;
  margin: 0;
}

.file-picker {
  grid-column: 1 / -1;
}

.start-translation-button {
  align-self: end;
  min-width: 144px;
  min-height: 44px;
}

.file-icon {
  width: 54px;
  height: 54px;
  line-height: 1.05;
}

.file-picker,
.file-picker-copy {
  min-width: 0;
}

.file-picker-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.selected-files-panel {
  min-width: 0;
  grid-column: 1 / -1;
  padding-top: 15px;
  border-top: 1px solid #e4e9e9;
}

.selected-files-panel[hidden] {
  display: none;
}

.selected-files-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
}

.selected-files-summary {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}

.selected-files-summary strong {
  color: #2b3b3e;
  font-size: 13px;
}

.selected-files-summary span {
  color: #718083;
  font-size: 12px;
}

body.app-body .selected-files-clear {
  min-height: 32px;
  gap: 6px;
  padding: 5px 7px;
  border-color: transparent;
  background: transparent;
  color: #5f6e71;
  font-size: 12px;
}

body.app-body .selected-files-clear:hover {
  border-color: #d8e0e0;
  background: #f5f7f7;
  color: #2b3b3e;
}

.selected-files-clear .ui-icon {
  width: 15px;
  height: 15px;
  flex-basis: 15px;
}

.selected-files {
  display: grid;
  min-width: 0;
  max-height: 272px;
  overflow-y: auto;
  border: 1px solid #dce3e3;
  border-radius: 6px;
  background: #fff;
}

.selected-file-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 56px;
  padding: 9px 10px 9px 12px;
  border-bottom: 1px solid #e8ecec;
}

.selected-file-row:last-child {
  border-bottom: 0;
}

.selected-file-row:hover {
  background: #fafcfc;
}

.selected-file-type {
  display: inline-grid;
  width: 48px;
  min-height: 24px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #d4dede;
  border-radius: 4px;
  background: #f4f7f7;
  color: #536467;
  font-size: 9px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-file-details {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.selected-file-name {
  display: block;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-file-size {
  flex: 0 0 auto;
  color: #7a888b;
  font-size: 11px;
  white-space: nowrap;
}

body.app-body .selected-file-remove {
  width: 32px;
  height: 32px;
  min-height: 32px;
  flex: 0 0 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #718083;
}

body.app-body .selected-file-remove:hover,
body.app-body .selected-file-remove:focus-visible {
  border-color: #f0d0cc;
  background: #fff3f1;
  color: var(--danger);
}

.selected-file-remove .ui-icon {
  width: 16px;
  height: 16px;
  flex-basis: 16px;
}

.job-actions {
  min-width: max-content;
}

.job-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}

.job-detail-actions form {
  margin: 0;
}

.status.stopped {
  background: #f1f1f1;
  color: #555;
}

body.app-body .status.needs_review {
  background: #fff5d6;
  color: #7a5100;
  border-color: #ead28b;
}

.file-actions {
  flex-wrap: wrap;
}

.file-format-list [hidden],
.task-file-error[hidden] {
  display: none;
}

.task-file-error {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--danger);
}

.dashboard-stats .metric-copy span {
  white-space: normal;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, auto) auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
}

.search-form input,
.search-form select {
  margin: 0;
}

.memory-text {
  min-width: 260px;
  max-width: 440px;
  white-space: normal;
  line-height: 1.55;
}

.memory-text textarea {
  width: 100%;
  min-width: 260px;
  margin: 0;
  padding: 8px;
  border: 1px solid #b9c1cb;
  border-radius: 5px;
  resize: vertical;
  font: inherit;
}

.log-search-form {
  grid-template-columns: minmax(260px, 1fr) 150px 130px auto auto;
}

.log-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  color: var(--muted);
}

.log-toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.log-toolbar select {
  width: 92px;
  margin: 0;
  padding: 7px 9px;
}

.operation-log-table table {
  min-width: 1040px;
}

.log-time {
  white-space: nowrap;
}

.log-path {
  max-width: 290px;
  overflow-wrap: anywhere;
}

.log-path code {
  white-space: normal;
}

.status.warning {
  background: #fff5d6;
  color: #7a5100;
}

td small {
  display: block;
  color: #667085;
  margin-top: 4px;
}

@media (max-width: 1100px) {
  .upload-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .task-options {
    grid-column: 1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .upload-form > .primary {
    grid-column: 2;
  }
}

@media (max-width: 760px) {
  .topbar nav {
    flex: 0 0 100%;
    white-space: nowrap;
  }
  .topbar nav a {
    white-space: nowrap;
  }
  .upload-form {
    grid-template-columns: 1fr;
  }
  .task-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-column: auto;
    width: 100%;
  }
  .file-picker,
  .upload-form > .primary {
    grid-column: auto;
  }
  .upload-form > .primary {
    width: 100%;
  }
  .search-form {
    grid-template-columns: 1fr;
  }
  .log-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .selected-files-header {
    align-items: flex-start;
  }
  .selected-file-row {
    grid-template-columns: 42px minmax(0, 1fr) 32px;
    gap: 9px;
    padding-left: 9px;
  }
  .selected-file-type {
    width: 42px;
  }
  .selected-file-details {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
}

@media (max-width: 420px) {
  .task-options {
    grid-template-columns: 1fr;
  }
}
