html, body {
  height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #1e1e1e;
}

#app {
  display: flex;
  height: 100vh;
}

#sidebar {
  width: 260px;
  background: #1e1e1e;
  color: #ccc;
  overflow-y: auto;
  padding: 8px;
  box-sizing: border-box;
  border-right: 1px solid #2d2d2d;
  flex-shrink: 0;
}

#sidebar h2 {
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #888;
  margin: 4px 0 8px;
}

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: #252526;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}

#toolbar-left,
#toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- presence + share ---------- */

#presence-stack {
  display: flex;
  align-items: center;
}

.presence-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #252526;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  color: #14181f;
  cursor: default;
}

.presence-avatar:not(:first-child) {
  margin-left: -8px;
}

.share-wrap {
  position: relative;
}

#share-btn {
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid #0e639c;
  background: #0e639c;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}

#share-btn:hover { background: #1177bb; }

#share-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: #252526;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 50;
}

.share-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: #eee;
}

.share-note {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: #999;
  line-height: 1.4;
}

.share-link-row {
  display: flex;
  gap: 8px;
}

#share-link-input {
  flex: 1;
  min-width: 0;
  padding: 7px 9px;
  border-radius: 4px;
  border: 1px solid #444;
  background: #1e1e1e;
  color: #ddd;
  font-size: 12.5px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}

#share-copy-btn {
  padding: 7px 12px;
  border-radius: 4px;
  border: 1px solid #444;
  background: #2d2d2d;
  color: #eee;
  cursor: pointer;
  font-size: 12.5px;
  flex-shrink: 0;
}

#share-copy-btn:hover { background: #3a3a3a; }

#share-copy-status {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: #4fb286;
  min-height: 14px;
}

#verify-btn {
  padding: 6px 14px;
  border-radius: 4px;
  border: none;
  background: #3c8f3c;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}

#verify-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

#verify-status {
  color: #9cdcfe;
  font-size: 12px;
}

#terminal {
  flex-shrink: 0;
  height: 220px;
  margin: 0;
  padding: 10px 12px;
  overflow-y: auto;
  background: #0c0c0c;
  color: #d4d4d4;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  border-top: 1px solid #333;
}

#tab-bar {
  display: flex;
  background: #252526;
  overflow-x: auto;
  flex-shrink: 0;
  min-height: 34px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: #ccc;
  background: #2d2d2d;
  border-right: 1px solid #1e1e1e;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.tab.active {
  background: #1e1e1e;
  color: #fff;
}

.tab-close {
  opacity: 0.6;
}

.tab-close:hover {
  opacity: 1;
}

#editor {
  flex: 1;
  min-height: 0;
}

#empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 14px;
}

#chat-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: #252526;
  border-top: 1px solid #333;
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid #444;
  background: #1e1e1e;
  color: #eee;
  font-size: 14px;
}

#chat-send {
  padding: 8px 16px;
  border-radius: 4px;
  border: none;
  background: #0e639c;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
}

#chat-send:disabled {
  opacity: 0.5;
  cursor: default;
}

.inline-btn {
  margin-left: 6px;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid #444;
  background: #2d2d2d;
  color: #eee;
  cursor: pointer;
  font-size: 11px;
}

.inline-btn:hover {
  background: #3a3a3a;
}

#chat-status {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  color: #9cdcfe;
  font-size: 12px;
  max-width: 480px;
}

.cross-stack-note {
  flex-basis: 100%;
  color: #7fbf7f;
  font-size: 11.5px;
  margin-top: 2px;
}

.file-tree-list {
  list-style: none;
  margin: 0;
  padding-left: 14px;
}

#file-tree > .file-tree-list {
  padding-left: 0;
}

.file-tree-dir, .file-tree-file {
  padding: 3px 4px;
  cursor: pointer;
  font-size: 13px;
  border-radius: 3px;
  white-space: nowrap;
}

.file-tree-dir:hover, .file-tree-file:hover {
  background: #2a2d2e;
}

.file-tree-file.active {
  background: #37373d;
  color: #fff;
}

.catalog-heading {
  margin-top: 18px;
  border-top: 1px solid #2d2d2d;
  padding-top: 12px;
}

#catalog-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.catalog-item {
  padding: 6px 8px;
  border-radius: 4px;
  background: #252526;
  font-size: 12px;
}

.catalog-resource {
  color: #eee;
  font-weight: 600;
}

.catalog-meta {
  color: #999;
  margin-top: 2px;
}

.catalog-empty {
  color: #666;
  font-size: 12px;
  padding: 4px 8px;
}

#metrics-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metrics-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 8px;
  font-size: 12px;
}

.metrics-label {
  color: #999;
}

.metrics-value {
  color: #eee;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.metrics-value-danger {
  color: #e2685a;
}

.metrics-subheading {
  margin-top: 10px;
  padding: 0 8px 2px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #777;
  border-top: 1px solid #2d2d2d;
  padding-top: 8px;
}

.sidebar-footer-link {
  margin: 16px 8px 0;
  font-size: 12px;
}

.sidebar-footer-link a {
  color: #4fa3ff;
  text-decoration: none;
}

.sidebar-footer-link a:hover {
  text-decoration: underline;
}

#export-compose-btn {
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid #444;
  background: #2d2d2d;
  color: #eee;
  cursor: pointer;
  font-size: 13px;
  margin-left: 12px;
}

#export-compose-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

#export-status {
  color: #9cdcfe;
  font-size: 12px;
}

/* Landing page (index.html) */
#landing {
  max-width: 560px;
  margin: 60px auto;
  padding: 0 20px;
  color: #eee;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#landing h1 {
  font-size: 28px;
  margin-bottom: 6px;
}

.landing-subtitle {
  color: #999;
  line-height: 1.5;
  margin-bottom: 32px;
}

.landing-card {
  background: #252526;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.landing-card h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #999;
  margin: 0 0 14px;
}

.landing-card button,
.join-card button {
  padding: 10px 18px;
  border-radius: 4px;
  border: none;
  background: #0e639c;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
}

#open-form {
  display: flex;
  gap: 8px;
}

.landing-card input,
.join-card input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid #444;
  background: #1e1e1e;
  color: #eee;
  font-size: 14px;
}

.landing-status {
  color: #f88;
  font-size: 13px;
  margin: 10px 0 0;
}

.sample-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sample-btn {
  padding: 8px 14px;
  border-radius: 4px;
  border: 1px solid #444;
  background: #2d2d2e;
  color: #ddd;
  cursor: pointer;
  font-size: 13px;
}
.sample-btn:hover {
  background: #383839;
  border-color: #555;
}

.paste-row {
  margin-bottom: 10px;
}

.paste-textarea {
  width: 100%;
  min-height: 160px;
  padding: 12px;
  border-radius: 4px;
  border: 1px solid #444;
  background: #1e1e1e;
  color: #eee;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  box-sizing: border-box;
}

.paste-hint {
  color: #888;
  font-size: 12.5px;
  margin: 10px 0 0;
}

#check-btn {
  padding: 12px 22px;
  border-radius: 4px;
  border: none;
  background: #0e639c;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
#check-btn:hover {
  background: #1177bb;
}
#check-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.target-picker {
  border: 1px solid #444;
  border-radius: 4px;
  padding: 10px 14px 12px;
  margin-bottom: 14px;
  display: flex;
  gap: 20px;
}

.target-picker legend {
  padding: 0 6px;
  color: #999;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.target-picker label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #eee;
  cursor: pointer;
}

#check-status {
  color: #9cdcfe;
}

#violation-count {
  color: #ccc;
  font-size: 13px;
  margin-bottom: 8px;
}

#violation-list {
  margin: 0;
  padding-left: 20px;
  color: #ddd;
  font-size: 13px;
  line-height: 1.6;
}

/* Join modal (project.html) */
#join-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.join-card {
  background: #252526;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 24px;
  width: 320px;
  color: #eee;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.join-card h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.join-card p {
  color: #999;
  font-size: 13px;
  line-height: 1.4;
  margin: 0 0 14px;
}

.join-card input {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 12px;
}

/* Not-found state (project.html) */
#not-found {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #eee;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  gap: 8px;
}

#not-found a {
  color: #4fa3ff;
}
