.container {
  margin: 24px auto;
  max-width: 1200px;
  font-family: Arial, Helvetica, sans-serif;
}

h1 {
  margin-bottom: 8px;
}

.toolbar,
.buttons {
  margin: 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sheet-tabs {
  display: flex;
  gap: 4px;
}

.sheet-tab {
  padding: 8px 16px;
  border: 1px solid #ccc;
  background: #f9f9f9;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  transition: background-color 0.2s;
}

.sheet-tab.active {
  background: #fff;
  border-bottom: 1px solid #fff;
  font-weight: bold;
}

.sheet-tab:hover {
  background: #e9e9e9;
}

.sheet-controls {
  display: none;
  margin: 12px 0 8px;
}

.sheet-controls.active {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.sheet-search {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 280px;
}

.sheet-search label {
  font-size: 14px;
  font-weight: bold;
}

.sheet-search input {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.sheet-search-button {
  width: fit-content;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f9f9f9;
  cursor: pointer;
}

.sheet-search-button:hover {
  background: #e9e9e9;
}

.sheet-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sheet-action-button {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f9f9f9;
  cursor: pointer;
  font-size: 14px;
}

.sheet-action-button:hover {
  background: #e9e9e9;
}

.sheet-action-button:disabled {
  color: #888;
  cursor: not-allowed;
  background: #f2f2f2;
}

#table-wrapper {
  overflow-x: auto;
}

.transcription-box {
  min-width: 320px;
  max-width: 600px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fafafa;
  padding: 10px 12px;
}

.transcription-title {
  font-weight: bold;
  margin-bottom: 6px;
}

.transcription-body {
  min-height: 48px;
  white-space: pre-wrap;
  color: #333;
}

.json-import-box {
  min-width: 320px;
  max-width: 600px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fafafa;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.json-import-input {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.4;
  box-sizing: border-box;
}


.grid {
  border-collapse: collapse;
  width: 100%;
  margin-top: 8px;
}

.grid.grid-adaptive-columns {
  width: max-content;
  min-width: 100%;
}

.grid.grid-fixed-columns {
  width: max-content;
}

.grid th,
.grid td {
  border: 1px solid #999;
  padding: 4px;
}

.grid.grid-fixed-columns th:not(:first-child),
.grid.grid-fixed-columns td:not(:first-child) {
  min-width: 180px;
  width: 180px;
}

.grid tr.even-row td,
.grid tr.even-row th {
  background: #f9f9f9;
}

.grid tr.odd-row td,
.grid tr.odd-row th {
  background: #ffffff;
}

.grid input {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  background: transparent;
}

.grid textarea {
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  font-family: Arial, Helvetica, sans-serif;
}

.grid-corner-cell {
  background: #f2f2f2;
}

.btn-add-column {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.btn-add-column:hover {
  background-color: #45a049;
}

.btn-add-column:active {
  background-color: #3d8b40;
}

.column-header-container {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.btn-clear-column {
  align-self: center;
  width: 22px;
  height: 22px;
  border: 1px solid #d43f3a;
  border-radius: 50%;
  background: #fff5f5;
  color: #c00000;
  cursor: pointer;
  font-size: 15px;
  font-weight: bold;
  line-height: 18px;
  padding: 0;
}

.btn-clear-column:hover {
  background: #ffdede;
  border-color: #b00000;
}

.btn-clear-column:active {
  background: #ffc7c7;
}


.header-cell {
  font-weight: bold;
  background: #f2f2f2;
}

.column-draggable {
  cursor: grab;
}

.column-dragging {
  opacity: 0.5;
}

.column-drop-target {
  outline: 2px solid #4c8bf5;
  outline-offset: -2px;
}

.row-draggable {
  cursor: grab;
}

.row-dragging {
  opacity: 0.5;
}

.row-drop-target {
  outline: 2px solid #4c8bf5;
  outline-offset: -2px;
}

.column-drag-preview {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #7f8c9a;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  min-width: 180px;
}

.column-drag-preview-cell {
  border-bottom: 1px solid #c8d0d8;
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #ffffff;
  font-size: 13px;
}

.column-drag-preview-cell:first-child {
  font-weight: bold;
  background: #eef2f6;
}

.column-drag-preview-cell:last-child {
  border-bottom: none;
}

.row-drag-preview {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  display: flex;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #7f8c9a;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  max-width: 90vw;
}

.row-drag-preview-cell {
  border-right: 1px solid #c8d0d8;
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #ffffff;
  font-size: 13px;
  min-width: 120px;
}

.row-drag-preview-cell:first-child {
  font-weight: bold;
  background: #eef2f6;
  min-width: 240px;
}

.row-drag-preview-cell:last-child {
  border-right: none;
}

.row-label {
  width: 320px;
}

.status {
  margin: 8px 0;
  padding: 8px;
}

.status.success {
  background: #e6ffe6;
  border: 1px solid #5faa5f;
  color: #115e11;
}

.cell-error {
  background-color: #ffcccc !important;
  border: 1px solid #ff0000 !important;
}

.cell-critical {
  background-color: #ff7f7f !important;
  border: 1px solid #ff0000 !important;
}

.cell-na {
  background-color: #5b5b5b !important;
  color: #ffffff !important;
}

.cell-m {
  background-color: #ffcc80 !important;
}

.cell-empty {
  background-color: #ffcccc !important;
}

.cell-x {
  background-color: #d9f2d9 !important;
}

.cell-container {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
}

.cell-btn {
  padding: 2px 4px;
  font-size: 11px;
  border: 1px solid #ccc;
  background: #f9f9f9;
  cursor: pointer;
  border-radius: 2px;
  min-width: 24px;
  flex-shrink: 0;
}

.cell-btn:hover {
  background: #e9e9e9;
}

.cell-btn:active {
  background: #ddd;
}

.cell-input {
  flex: 1;
  padding: 2px;
  border: 1px solid #ccc;
  border-radius: 2px;
  font-size: 12px;
  min-width: 0;
}

.history-row td,
.history-row th {
  min-height: 120px;
}

.history-cell {
  height: 120px;
  vertical-align: top;
}

.history-container {
  align-items: flex-start;
  min-height: 112px;
}

.history-input {
  min-height: 108px;
  resize: vertical;
  line-height: 1.35;
  white-space: pre-wrap;
}

.summary-cell {
  background: #f3f6f9 !important;
  font-weight: bold;
  text-align: right;
  color: #334155;
}

.status.error {
  background: #ffe6e6;
  border: 1px solid #cc5f5f;
  color: #900;
}

.notif-output {
  background: #f9f9f9;
  border: 1px solid #ccc;
  min-height: 120px;
  padding: 8px;
  white-space: pre-wrap;
}
