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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #fafafa;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: #fff;
  border-bottom: 1px solid #eee;
}

.nav-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111;
  text-decoration: none;
}

.nav-user {
  color: #666;
  text-decoration: none;
}

.nav-user:hover {
  color: #111;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
  width: 100%;
}

.profile {
  margin-bottom: 2rem;
}

.profile h1 {
  font-size: 1.5rem;
  color: #111;
}

.profile-count {
  color: #888;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.note-list {
  list-style: none;
}

.note-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid #eee;
}

.note-item-title {
  color: #111;
  text-decoration: none;
  font-size: 1.05rem;
}

.note-item-title:hover {
  color: #0066cc;
}

.note-item-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.note-item-date {
  color: #aaa;
  font-size: 0.85rem;
  white-space: nowrap;
}

.btn-delete-sm {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.15rem 0.4rem;
  font-family: inherit;
  border-radius: 3px;
  transition: color 0.15s;
}

.btn-delete-sm:hover {
  color: #e53e3e;
}

.delete-form-inline {
  display: inline;
  margin-left: auto;
}

.note-header {
  margin-bottom: 2rem;
}

.note-header h1 {
  font-size: 2rem;
  line-height: 1.3;
  color: #111;
  margin-bottom: 0.5rem;
}

.note-date {
  color: #888;
  font-size: 0.9rem;
}

.markdown-body {
  line-height: 1.8;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  color: #111;
}

.markdown-body h1 { font-size: 1.6rem; }
.markdown-body h2 { font-size: 1.35rem; }
.markdown-body h3 { font-size: 1.15rem; }

.markdown-body p {
  margin-bottom: 1em;
}

.markdown-body a {
  color: #0066cc;
}

.markdown-body code {
  background: #f0f0f0;
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

.markdown-body pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 1em;
}

.markdown-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.markdown-body blockquote {
  border-left: 3px solid #ddd;
  padding-left: 1rem;
  color: #666;
  margin-bottom: 1em;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.5em;
  margin-bottom: 1em;
}

.markdown-body img {
  max-width: 100%;
  border-radius: 6px;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1em;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid #ddd;
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.markdown-body th {
  background: #f5f5f5;
  font-weight: 600;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 2em 0;
}

.footer {
  text-align: center;
  padding: 2rem;
  color: #aaa;
  font-size: 0.85rem;
}

.footer a {
  color: #888;
}

/* Nav right section */
.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link {
  color: #666;
  text-decoration: none;
  font-size: 0.9rem;
}

.nav-link:hover {
  color: #111;
}

.nav-logout-form {
  display: inline;
}

.btn-link {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  font-family: inherit;
}

.btn-link:hover {
  color: #111;
}

/* Login page */
.login-card {
  max-width: 400px;
  margin: 4rem auto;
  text-align: center;
}

.login-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: #111;
}

.login-subtitle {
  color: #888;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.login-error {
  color: #e53e3e;
  background: #fff5f5;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid #ddd;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.btn-github {
  background: #24292e;
  color: #fff;
  border-color: #24292e;
}

.btn-github:hover {
  background: #1b1f23;
}

.btn-google {
  background: #fff;
  color: #333;
  border-color: #ddd;
}

.btn-google:hover {
  background: #f8f8f8;
  border-color: #ccc;
}

.btn-danger {
  color: #e53e3e;
  border-color: #e53e3e;
  background: #fff;
}

.btn-danger:hover {
  background: #fff5f5;
}

/* Settings page */
.settings-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

.settings-section:first-of-type {
  border-top: none;
}

.settings-section h2 {
  font-size: 1.15rem;
  color: #111;
  margin-bottom: 0.5rem;
}

.settings-hint {
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.settings-message {
  color: #38a169;
  background: #f0fff4;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.token-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #f5f5f5;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  overflow-x: auto;
}

.token-box code {
  font-size: 0.9rem;
  word-break: break-all;
  flex: 1;
}

.token-regen {
  margin-top: 0.75rem;
}

.settings-info {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.5rem 1rem;
}

.settings-info dt {
  color: #888;
  font-size: 0.9rem;
}

.settings-info dd {
  color: #333;
  font-size: 0.9rem;
}

/* Password form */
.password-form {
  margin-top: 1rem;
}

.password-label {
  display: block;
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.password-input-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.password-input {
  flex: 1;
  padding: 0.6rem 0.85rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.password-input:focus {
  border-color: #999;
}

.password-btn {
  white-space: nowrap;
}

.note-lock {
  font-size: 0.8em;
  margin-left: 0.3em;
}

/* Visibility bar (owner only) */
.visibility-bar {
  margin-bottom: 1.5rem;
  padding: 0.6rem 1rem;
  background: #f8f8f8;
  border: 1px solid #eee;
  border-radius: 6px;
}

.visibility-form {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.visibility-option {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
}

.visibility-option input[type="radio"] {
  margin: 0;
}

.visibility-pwd {
  display: inline-flex;
  align-items: center;
}

.password-input-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
  width: 150px;
  border: 1px solid #ddd;
  border-radius: 4px;
  outline: none;
  font-family: inherit;
}

.password-input-sm:focus {
  border-color: #999;
}

/* Category bar */
.cat-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.cat-pill {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  color: #555;
  background: #f0f0f0;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.cat-pill:hover {
  background: #e0e0e0;
  color: #111;
}

.cat-pill-active {
  background: #111;
  color: #fff;
}

.cat-pill-active:hover {
  background: #333;
  color: #fff;
}

/* Note category tag */
.note-cat {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  color: #888;
  background: #f0f0f0;
  text-decoration: none;
  margin-left: 0.4rem;
  vertical-align: middle;
}

a.note-cat:hover {
  background: #e0e0e0;
  color: #555;
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Category input in settings */
.category-input {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
  width: 120px;
  border: 1px solid #ddd;
  border-radius: 4px;
  outline: none;
  font-family: inherit;
}

.category-input:focus {
  border-color: #999;
}