:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e2e5ea;
  --text: #1f2328;
  --muted: #6a737d;
  --accent: #2563eb;
  --danger: #dc2626;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
button {
  font: inherit;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  cursor: pointer;
}
button:hover { border-color: var(--accent); color: var(--accent); }

.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar .logout-form { margin-left: auto; }
.link-btn { border: none; background: none; color: var(--accent); padding: 0; }
.muted { color: var(--muted); font-size: 0.9em; }

.explorer { max-width: 900px; margin: 24px auto; padding: 0 16px; }
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; gap: 12px;
}
.breadcrumb a { color: var(--accent); text-decoration: none; margin-right: 4px; }
.breadcrumb a:hover { text-decoration: underline; }
.actions button { margin-left: 6px; }

.listing {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
}
.row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.row:last-child { border-bottom: none; }
.row:hover { background: #f0f4ff; }
.row .icon { width: 20px; text-align: center; }
.row .name { flex: 1; }
.row .row-actions { display: flex; gap: 6px; opacity: 0.6; }
.row:hover .row-actions { opacity: 1; }
.row .row-actions button { padding: 2px 8px; font-size: 0.8em; }

.auth-body, .share-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.auth-card, .share-card {
  background: var(--panel); padding: 28px; border-radius: 10px;
  border: 1px solid var(--border); width: 100%; max-width: 380px;
}
.share-card { max-width: 720px; }
.auth-card h1, .share-card h1 { margin: 0 0 16px; font-size: 1.4em; }
.auth-card label { display: block; margin-bottom: 12px; font-size: 0.9em; }
.auth-card input {
  display: block; width: 100%; padding: 8px 10px; margin-top: 4px;
  border: 1px solid var(--border); border-radius: 6px; font: inherit;
}
.auth-card button {
  width: 100%; padding: 10px; background: var(--accent); color: white;
  border-color: var(--accent); margin-top: 6px;
}
.auth-card button:hover { background: #1d4ed8; color: white; }
.error { color: var(--danger); margin: 0 0 12px; font-size: 0.9em; }
.captcha-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.captcha-row img { border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.captcha-row input { flex: 1; }

.note-content {
  background: #f8f9fb; border: 1px solid var(--border); border-radius: 6px;
  padding: 12px; font-family: var(--mono); font-size: 0.9em;
  white-space: pre-wrap; word-wrap: break-word; margin: 8px 0;
}
.share-list { list-style: none; padding: 0; }
.share-list li { margin-bottom: 16px; }
.share-list strong { display: block; margin-bottom: 4px; }

/* Modal editor */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 10;
}
.modal {
  background: var(--panel); border-radius: 10px; padding: 20px;
  width: 100%; max-width: 640px;
}
.modal h2 { margin: 0 0 12px; font-size: 1.1em; }
.modal input, .modal textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; font: inherit; margin-bottom: 10px;
}
.modal textarea { min-height: 260px; font-family: var(--mono); resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }


/* Toast notifications */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1f2328;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.9em;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 100;
  max-width: 320px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast.error {
  background: #dc2626;
}
.toast.success {
  background: #16a34a;
}
