body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background: #f4f7fa;
  color: #333;
}

* {
  box-sizing: border-box;
}

.container {
  width: min(1400px, calc(100% - 32px));
  margin: 40px auto;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.view-container {
  min-height: calc(100vh - 120px);
}

.split-view {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  align-items: stretch;
  min-height: calc(100vh - 240px);
}

.split-view .left {
  flex: 3;
  min-width: 0;
  min-height: 0;
}

.split-view .right {
  flex: 2;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.file-viewer {
  width: 100%;
}

.file-viewer iframe,
.file-viewer img {
  display: block;
  width: 100%;
  height: 80vh;
  max-height: 80vh;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
}

.file-viewer img {
  object-fit: contain;
}

.file-viewer .file-fallback {
  display: block;
  padding: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #0d6efd;
  text-decoration: none;
}

.file-viewer .file-fallback:hover {
  text-decoration: underline;
}

.split-view .right textarea {
  display: block;
  width: 100%;
  min-height: 260px;
  max-width: 100%;
  margin-top: 20px;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
  font: inherit;
  color: inherit;
  background: #fff;
}

.split-view .right textarea:focus {
  outline: none;
  border-color: #86b7fe;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.btn {
  flex: 1;
  padding: 10px 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  text-align: center;
  transition:
    opacity 0.15s ease,
    transform 0.05s ease;
}

.btn:hover:not(:disabled) {
  opacity: 0.95;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-success {
  background: #198754;
  color: #fff;
}

.btn-danger {
  background: #dc3545;
  color: #fff;
}

.action-buttons {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 20px;
}

.language-switch {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1000;
}

.language-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #d6dbe1;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  color: #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(4px);
}

.language-toggle:hover {
  background: #f3f6f9;
  border-color: #bfc7d1;
}

.language-toggle:focus {
  outline: none;
  border-color: #86b7fe;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.language-toggle .flag {
  line-height: 1;
}

.language-toggle .chevron {
  font-size: 12px;
  line-height: 1;
  color: #666;
}

.language-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 170px;
  padding: 6px;
  border: 1px solid #d6dbe1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.language-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #333;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  text-align: left;
}

.language-option:hover {
  background: #f3f6f9;
}

.language-option:focus {
  outline: none;
  background: #eef4ff;
}

.status-box {
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.status-box.pending {
  background: #fff3cd;
  border-color: #ffe69c;
  color: #664d03;
}

.status-box.approved {
  background: #d1e7dd;
  border-color: #badbcc;
  color: #0f5132;
}

.status-box.rejected {
  background: #f8d7da;
  border-color: #f5c2c7;
  color: #842029;
}

.status-box.revoked {
  background: #fff3cd;
  border-color: #f0ad4e;
  color: #7a5a00;
}

.status-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  flex: 0 0 22px;
  border: 1px solid currentColor;
  background: transparent;
}

.status-box.pending .status-icon {
  font-size: 0;
}

.status-box.pending .status-icon::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.status-note {
  margin-top: 10px;
  font-size: 14px;
}

.status-comment-box {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f8f8f8;
  font-size: 14px;
  overflow-wrap: break-word;
}

.status-comment-box h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
}

.history-box {
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
}

.history-box h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
}

.history-box-scrollable {
  margin-top: auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  padding: 10px 12px;
  border: 1px solid #e3e3e3;
  border-radius: 6px;
  background: #f8f8f8;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.history-date {
  margin-top: 4px;
  font-size: 13px;
  color: #666;
}

.history-comment {
  margin-top: 8px;
  font-size: 14px;
  overflow-wrap: break-word;
}

.history-links {
  margin-top: 8px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.history-links a,
.status-comment-box a {
  color: #0d6efd;
  text-decoration: none;
}

.history-links a:hover,
.status-comment-box a:hover {
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .container {
    width: calc(100% - 24px);
    margin: 64px auto 20px;
    padding: 16px;
  }

  .view-container {
    min-height: auto;
  }

  .split-view {
    flex-direction: column;
    min-height: auto;
  }

  .split-view .left,
  .split-view .right {
    width: 100%;
  }

  .file-viewer iframe,
  .file-viewer img {
    height: 65vh;
    max-height: 65vh;
  }

  .history-box-scrollable {
    max-height: none;
    overflow-y: visible;
  }

  .language-switch {
    top: 8px;
    right: 8px;
  }

  .language-dropdown {
    right: 0;
    left: auto;
    min-width: 160px;
  }
}

@media (max-width: 640px) {
  .container {
    width: calc(100% - 16px);
    margin: 58px auto 16px;
    padding: 14px;
    border-radius: 6px;
  }

  .action-buttons {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .split-view .right textarea {
    min-height: 220px;
  }

  .file-viewer iframe,
  .file-viewer img {
    height: 55vh;
    max-height: 55vh;
  }

  .language-toggle {
    min-height: 36px;
    padding: 7px 11px;
    font-size: 13px;
  }

  .language-dropdown {
    min-width: 150px;
  }

  .language-option {
    font-size: 13px;
  }
}
