* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f7f8;
  color: #1c1c1c;
}

#app {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
}

.sidebar {
  padding: 16px;
  border-right: 1px solid #e0e0e0;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar h1 {
  margin: 0 0 8px 0;
  font-size: 18px;
}

.auth {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid #e4e4e4;
  border-radius: 8px;
  background: #fafafa;
}

.auth-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth.readonly {
  opacity: 0.75;
}

.repo-actions {
  display: flex;
  gap: 6px;
}

.repo-actions input {
  flex: 1;
}

.repo-actions button {
  flex: 0 0 auto;
}

#auth-status,
#repo-status,
#repo-modal-status {
  font-size: 12px;
  color: #666666;
}

.sidebar input,
.sidebar button,
.sidebar select,
.editor input,
.editor textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
}

.sidebar button,
.editor button {
  background: #1c1c1c;
  color: #ffffff;
  border: none;
  cursor: pointer;
}

button.text-link {
  background: transparent;
  color: #1c1c1c;
  border: none;
  padding: 0;
  font-size: 14px;
  text-align: left;
}

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

button.text-link:disabled {
  color: #9a9a9a;
  cursor: not-allowed;
  text-decoration: none;
}

.sidebar select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  background: #ffffff;
}

#notes {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
}

#notes li {
  padding: 8px 10px;
  border-radius: 6px;
}

#notes li.active {
  background: #1c1c1c;
  color: #ffffff;
}

.note-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.note-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  color: inherit;
  flex: 1;
}

.sidebar .note-link,
.sidebar .note-delete {
  background: transparent;
  color: inherit;
}

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

.note-delete {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  opacity: 0.7;
}

.note-delete:hover {
  opacity: 1;
}

.editor {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.editor textarea {
  flex: 1;
  resize: none;
  min-height: 300px;
}

.actions {
  display: flex;
  gap: 8px;
}

.actions button {
  flex: 1;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-card {
  position: relative;
  background: #ffffff;
  padding: 24px;
  border-radius: 12px;
  width: min(420px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 21;
}

.modal-card h2 {
  margin: 0;
  font-size: 18px;
}

.modal-card p {
  margin: 0;
  color: #555555;
  font-size: 14px;
}

.modal-card label {
  font-size: 12px;
  color: #555555;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}

.modal-actions button {
  padding: 8px 16px;
}
