* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: #000;
  background: #fff;
}

a {
  color: #000;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  font-family: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

header {
  border-bottom: 1px solid #ddd;
  padding: 20px 0;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 24px;
  font-weight: bold;
}

nav {
  display: flex;
  gap: 20px;
  align-items: center;
}

nav a {
  font-size: 14px;
  color: #666;
}

nav a:hover {
  color: #000;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  background: #000;
  color: #fff;
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
  background: #333;
}

.btn-outline {
  background: transparent;
  border: 1px solid #000;
  color: #000;
}

.btn-outline:hover {
  background: #000;
  color: #fff;
}

main {
  padding: 40px 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.card {
  border: 1px solid #ddd;
  padding: 20px;
}

.card:hover {
  border-color: #000;
}

.card h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.card p {
  font-size: 14px;
  color: #666;
  margin-bottom: 10px;
}

.card .meta {
  font-size: 12px;
  color: #999;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #000;
}

.pdf-viewer {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 40px;
}

.pdf-container {
  border: 1px solid #ddd;
  padding: 20px;
}

.pdf-container canvas {
  max-width: 100%;
  margin-bottom: 20px;
}

.notes-panel {
  border: 1px solid #ddd;
  padding: 20px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.note {
  padding: 15px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
}

.note.addon { border-color: #3b82f6; background: #f0f9ff; }
.note.alternate { border-color: #22c55e; background: #f0fdf4; }
.note.warning { border-color: #ef4444; background: #fef2f2; }
.note.qa { border-color: #eab308; background: #fefce8; }

.note-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
}

.note-type {
  font-weight: bold;
  text-transform: uppercase;
}

.note-author {
  color: #666;
}

.note-text {
  font-size: 14px;
  color: #666;
  margin-bottom: 10px;
  font-style: italic;
}

.note-content {
  margin-bottom: 10px;
}

.note-actions {
  display: flex;
  gap: 15px;
  font-size: 14px;
}

.note-actions button {
  background: none;
  border: none;
  padding: 0;
  color: #666;
}

.note-actions button:hover {
  color: #000;
  text-decoration: underline;
}

.note-form {
  padding: 15px;
  margin-bottom: 15px;
  border: 1px solid #000;
  background: #f9f9f9;
}

.note-form textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
}

.note-form .actions {
  display: flex;
  gap: 10px;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #666;
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

@media (max-width: 768px) {
  .pdf-viewer {
    grid-template-columns: 1fr;
  }

  header .container {
    flex-direction: column;
    gap: 15px;
  }

  nav {
    flex-wrap: wrap;
    justify-content: center;
  }
}

.replies {
  margin-top: 15px;
  padding-left: 0;
}

.reply {
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  background: #fafafa;
}

.reply.comment { border-left: 3px solid #999; }
.reply.agreement { border-left: 3px solid #22c55e; }
.reply.rebuttal { border-left: 3px solid #ef4444; }

.reply-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
}

.reply-author {
  font-weight: 500;
}

.reply-type {
  color: #666;
  text-transform: uppercase;
  font-size: 11px;
}

.reply-content {
  font-size: 14px;
  margin-bottom: 8px;
}

.reply-actions {
  display: flex;
  gap: 12px;
  font-size: 13px;
}

.reply-actions button {
  background: none;
  border: none;
  padding: 0;
  color: #666;
  cursor: pointer;
}

.reply-actions button:hover {
  color: #000;
  text-decoration: underline;
}

.reply-form {
  margin-top: 10px;
  padding: 10px;
  background: #f5f5f5;
  border: 1px solid #ddd;
}

.reply-form textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid #ddd;
  font-size: 14px;
}

.reply-form select {
  width: 100%;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid #ddd;
  font-size: 14px;
}

.reply-form .actions {
  display: flex;
  gap: 8px;
}

.nested-replies {
  margin-left: 20px;
  margin-top: 10px;
  padding-left: 15px;
  border-left: 2px solid #eee;
}

.show-replies {
  color: #666;
  font-size: 13px;
  cursor: pointer;
  margin-top: 8px;
}

.show-replies:hover {
  color: #000;
  text-decoration: underline;
}

.column-link {
  color: #000;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.column-link:hover {
  text-decoration: underline;
}

.column-link::before {
  content: "📄";
  font-size: 14px;
}

/* PDF Highlight Layer */
.pdf-page-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 20px;
}

.pdf-page-wrapper canvas {
  display: block;
  position: relative;
  z-index: 1;
}

.textLayer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  pointer-events: none;
  user-select: text;
  mix-blend-mode: multiply;
}

.textLayer > div {
  position: absolute;
  white-space: pre;
  transform-origin: 0% 0%;
}

.highlight-layer {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 3;
}

.highlight-rect {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  opacity: 0.3;
  transition: opacity 0.2s;
}

.highlight-rect:hover {
  opacity: 0.5;
}

.highlight-rect.addon {
  background-color: #3b82f6;
}

.highlight-rect.alternate {
  background-color: #22c55e;
}

.highlight-rect.warning {
  background-color: #ef4444;
}

.highlight-rect.qa {
  background-color: #eab308;
}
