/* Layout base */
:root {
  --bg: #fff;
  --border: #e5e7eb;
  --muted: #6b7280;
  --primary: #2563eb;
}

html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: #111; font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji"; }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,0.95); backdrop-filter: blur(6px);
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo { text-decoration: none; font-weight: 700; color: #111; }
.top-link { color: var(--muted); text-decoration: none; }
.top-actions { display: flex; align-items: center; gap: 8px; }
@media (max-width: 799px) { .top-actions .legend, .top-actions .muted { display: none !important; } }
.legend { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; max-width: 40vw; }
.legend .user { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 999px; font-size: 12px; border: 1px solid var(--border); }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.btn { border: 1px solid var(--border); background: #fff; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.btn:hover { background: #f8fafc; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.ghost { background: transparent; }
.only-mobile { display: none; }

.layout { display: grid; grid-template-columns: 280px 1fr; height: calc(100dvh - 52px); }
.sidebar { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.sidebar-scrim { position: fixed; inset: 52px 0 0 0; background: rgba(0,0,0,.25); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.sidebar-scrim.show { opacity: 1; pointer-events: auto; z-index: 15; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 10px; }
.sidebar-search { padding: 0 10px 10px; }
.sidebar-search input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; }
.notes-list { overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 0 8px 12px; }
.note-item { display: block; text-decoration: none; color: inherit; border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.note-item:hover { background: #f9fafb; }
.note-row { display: flex; gap: 8px; align-items: center; }
.note-title-item { font-weight: 600; margin-bottom: 4px; display: inline-flex; align-items: center; gap: 6px; }
.note-title-item[contenteditable="true"] { border-bottom: 1px dashed #cbd5e1; outline: none; }
.note-snippet { color: var(--muted); font-size: 12px; }
.note-meta { color: var(--muted); font-size: 11px; }
.note-actions { margin-left: auto; display: inline-flex; gap: 6px; }
.btn.icon { padding: 4px 6px; font-size: 12px; }
.empty { color: var(--muted); padding: 12px; }

/* Indicadores discretos */
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid var(--border); }
.status-ok { background: #10b981; }
.status-bad { background: #ef4444; }
.status-idle { background: #e5e7eb; }

.editor-pane { display: flex; flex-direction: column; min-width: 0; }
.toolbar { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .sep { width: 1px; background: var(--border); margin: 0 6px; }
.note-title { border: none; outline: none; font-size: 20px; font-weight: 700; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.editor { flex: 1; padding: 16px; overflow: auto; line-height: 1.6; }
.editor:focus { outline: none; }
.ProseMirror { min-height: 100%; outline: none; }
.ProseMirror p { margin: 0 0 10px; }
/* Cursor remoto minimalista (sem rótulo de nome) */
.ycursor-caret { pointer-events: none; }
.editor h1 { font-size: 24px; }
.editor h2 { font-size: 20px; }
.editor ul, .editor ol { padding-left: 20px; }
.offline { position: sticky; bottom: 0; background: #fff7ed; color: #b45309; border-top: 1px solid #fed7aa; padding: 8px 12px; font-size: 14px; }

/* Start screen (sem criação automática de nota) */
.start-screen { position: absolute; inset: 52px 0 0 280px; display: grid; place-items: center; padding: 16px; }
.start-card { max-width: 520px; width: 100%; border: 1px solid var(--border); border-radius: 12px; padding: 20px; background: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.06); }
.start-card h1 { margin: 0 0 8px; font-size: 22px; }
.start-card p { margin: 0 0 16px; color: var(--muted); }
.start-actions { display: flex; gap: 10px; }

@media (max-width: 799px) {
  .layout { grid-template-columns: 1fr; height: calc(100dvh - 52px); }
  .sidebar { position: fixed; inset: 52px 0 0 0; transform: translateX(-100%); transition: transform .2s ease; background: #fff; z-index: 20; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 10px 30px rgba(0,0,0,.15); }
  .editor-pane { height: calc(100dvh - 52px); display: flex; flex-direction: column; }
  .toolbar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .note-title { font-size: 18px; padding: 12px 14px; }
  .editor { padding: 12px; }
  .only-mobile { display: inline-flex; }

  /* Melhor ajuste de zoom/tipografia no mobile */
  html, body { font-size: 16px; }
  .topbar { padding: 8px 12px; }
  .start-screen { inset: 52px 0 0 0; }
}
